code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2016 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | HPENetworking/topology_docker | lib/topology_docker/networks.py | Python | apache-2.0 | 4,822 |
#!/usr/bin/env python
#
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
from gnuradio import analog
from gnuradio import audio
from gnuradio.filter import... | mbr0wn/gnuradio | gr-analog/examples/fm_demod.py | Python | gpl-3.0 | 2,750 |
import os
from pathlib import Path
from spython.main import Client
def test_AFNI_libraries():
SINGULARITY_IMAGE_PATH = '/home/circleci/project/C-PAC-CI.simg'
if not os.path.exists(SINGULARITY_IMAGE_PATH):
try:
SINGULARITY_IMAGE_PATH = [d for d in os.listdir(
str(Path(__fil... | FCP-INDI/C-PAC | dev/circleci_data/test_install.py | Python | bsd-3-clause | 897 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-eventhub/azure/mgmt/eventhub/event_hub_management_client.py | Python | mit | 4,767 |
__author__ = 'kpiorno'
import os
import math
import kivy
from textwrap import dedent
from xml.dom.minidom import parse
from itertools import *
from kivy.graphics import *
from kivy.core.image import Image
from kivy.resources import resource_find
from kivy3dgui.objloader import ObjFile
from kivy.uix.widget import Widg... | kpiorno/kivy3dgui | kivy3dgui/node.py | Python | mit | 26,366 |
"""
Grayscale morphological operations
"""
import functools
import numpy as np
from scipy import ndimage as ndi
from .misc import default_selem
from ..util import crop
__all__ = ['erosion', 'dilation', 'opening', 'closing', 'white_tophat',
'black_tophat']
def _shift_selem(selem, shift_x, shift_y):
"""... | paalge/scikit-image | skimage/morphology/grey.py | Python | bsd-3-clause | 15,054 |
# -*- coding: utf-8 -*-
import subprocess
# List of engine specific test commands to run
engine_tests = (
'py.test tests/integration/engines/pytest_suite.py',
'nosetests tests/integration/engines/nose_suite.py',
'python -m unittest tests.integration.engines.unittest_suite',
)
def test_engines():
for... | h2non/pook | tests/integration/engines_test.py | Python | mit | 506 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import itertools
import logging
from collections import defaultdict
import copy
import math
from math import cos
from math import sin
from fractions import Fraction
import numpy as np
import spglib
from pym... | dongsenfo/pymatgen | pymatgen/symmetry/analyzer.py | Python | mit | 64,595 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
"""Tests for the Hello World"""
import os
from autopilot.matchers import Eventually
from testtools.matchers import Equals
import tip
class MainViewTestCase(tip.ClickAppTestCase):
"""Generic tests for the Hello World"""
def test_in... | halfsail/tipster-ubuntu | tests/autopilot/tip/test_main.py | Python | gpl-2.0 | 763 |
"""
Generic helper functions to utilize them in several parts of the backend.
"""
from django.http import JsonResponse, Http404
from django.forms.models import model_to_dict
from distrochooser.models import Question, Answer
def get_json_response(data) -> JsonResponse:
"""
Returns a HTTP Response w... | distrochooser/distrochooser | backend/distrochooser/util.py | Python | mpl-2.0 | 2,035 |
# coding=utf-8
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from pants.backend.native.config.environment import CCompiler, CppCompiler, Pl... | twitter/pants | src/python/pants/backend/native/subsystems/binaries/gcc.py | Python | apache-2.0 | 3,604 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('sports', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='game',
name='sport',
... | liddiard/skry | sports/migrations/0002_game_sport.py | Python | mit | 437 |
# Copyright (c) 2018 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | openstack/sahara | sahara/plugins/conductor.py | Python | apache-2.0 | 1,161 |
# Copyright (c) 2018, Xilinx Inc.
#
# Siva Durga Prasad Paladugu
#
# SPDX-License-Identifier: GPL-2.0
import pytest
import re
import random
import u_boot_utils
"""
Note: This test relies on boardenv_* containing configuration values to define
the network available and files to be used for testing. Without this, this ... | Digilent/u-boot-digilent | test/py/tests/test_zynqmp_secure.py | Python | gpl-2.0 | 3,375 |
## A script for finding every cox coefficient and pvalue for every mRNA in GBM Tier 3 data downloaded Jan. 5th, 2016
## Load necessary modules
from rpy2 import robjects as ro
import numpy as np
import os
ro.r('library(survival)')
import re
##This call will only work if you are running python from the command line.
#... | OmnesRes/onco_lnc | mrna/cox/GBM/cox_regression.py | Python | mit | 9,246 |
from django.apps import AppConfig
class SimpleActivityConfig(AppConfig):
name = 'simple_activity'
verbose_name = "Simple Activity"
def ready(self):
from .verbs import *
from .signals import *
| owais/django-simple-activity | simple_activity/apps.py | Python | bsd-2-clause | 223 |
#!/usr/bin/env python3
import os
print("root prints out directories only from what you specified")
print("dirs prints out sub-directories from root")
print("files prints out all files from root and directories")
print("*" * 20)
'''
for root, dirs, files in os.walk("/var/log"):
print('Root: '.format(root))
pr... | talapus/Ophidian | Academia/Filesystem/demo_os_walk.py | Python | bsd-3-clause | 483 |
# Generated by Django 3.2 on 2021-05-18 14:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('controls', '0049_auto_20210518_0038'),
]
operations = [
migrations.AddField(
model_name='element',
name='component_sta... | GovReady/govready-q | controls/migrations/0050_auto_20210518_1405.py | Python | gpl-3.0 | 1,001 |
"""
Slider
======
.. image:: images/slider.jpg
The :class:`Slider` widget looks like a scrollbar. It supports horizontal and
vertical orientations, min/max values and a default value.
To create a slider from -100 to 100 starting from 25::
from kivy.uix.slider import Slider
s = Slider(min=-100, max=100, valu... | akshayaurora/kivy | kivy/uix/slider.py | Python | mit | 13,060 |
#!/usr/bin/env python
#
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
import random
from gnuradio import gr, gr_unittest, blocks
import pmt
class qa_repack_bits_bb (gr_unittest.TestCase):
def setUp (self):
random.seed... | TheWylieStCoyote/gnuradio | gr-blocks/python/blocks/qa_repack_bits_bb.py | Python | gpl-3.0 | 5,600 |
"""
BSD 3-Clause License
Copyright (c) 2017, Mairie de Paris
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of cond... | LouisTrezzini/projet-mairie | api/server.py | Python | bsd-3-clause | 2,416 |
import random
class ai:
def __init__(self, actions, responses):
self.IN = actions
self.OUT = responses
def get_act(self, action, valres):
if action in self.IN:
mList = {}
for response in self.OUT:
if self.IN[self.OUT.index(response)] == ... | iTecAI/Stixai | Module/Stixai.py | Python | mit | 1,343 |
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | yu239/Paddle | python/paddle/trainer_config_helpers/optimizers.py | Python | apache-2.0 | 13,875 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | dims/ironic | ironic/tests/unit/drivers/modules/test_ssh.py | Python | apache-2.0 | 60,083 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 Pexego (<www.pexego.es>). All Rights Reserved
# $Omar Castiñeira Saavedra$
#
# This program is free software: you can redistribute it ... | Pexego/alimentacion | sale_follow_up/partner.py | Python | agpl-3.0 | 4,045 |
### RGB -> Gray
import cv2
from . import print_image
def rgb2gray(img, device, debug=False):
# Convert image from RGB colorspace to Gray
# img = image object, RGB colorspace
# device = device number. Used to count steps in the pipeline
# debug = True/False. If True, print image
gray = cv2.cvtColor(img, cv2.... | dlebauer/plantcv | lib/plantcv/rgb2gray.py | Python | gpl-2.0 | 434 |
#
# This file is a part of the normalize python library
#
# normalize is free software: you can redistribute it and/or modify
# it under the terms of the MIT License.
#
# normalize is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FI... | hearsaycorp/normalize | normalize/diff.py | Python | mit | 38,885 |
import os
from django.conf import settings
from django.core.files import File as DjangoFile
from django.forms.models import modelform_factory
from django.test import TestCase
from tests.helpers import (
create_clipboard_item, create_folder_structure, create_image,
create_superuser,
)
from filer import settin... | divio/django-filer | tests/test_models.py | Python | bsd-3-clause | 12,044 |
import datetime
from django.core.exceptions import ValidationError
from django import forms
class HoursField(forms.DurationField):
def __init__(self, **kwargs):
kwargs['label_suffix'] = ' (Hours)'
super(HoursField, self).__init__(**kwargs)
def prepare_value(self, value):
if isinstance(... | nocarryr/AV-Asset-Manager | avam/assets/fields.py | Python | gpl-3.0 | 1,171 |
#!/usr/bin/env python
import os
import math
from collections import Iterable, OrderedDict
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.ioff()
from matplotlib.patches import Rectangle
from matplotlib.colors import LinearSegmentedColormap
from matplotlib import cm
fro... | mahajrod/MACE | MACE/Routines/Drawing.py | Python | apache-2.0 | 49,658 |
from ..errors import *
from .core import Context, Object, BoundObject, Type
from .links import BoundLink, ContextLink
#
# Constant
#
class Constant(BoundLink):
assigned = False
def __init__(self, value:Object, tokens = None):
BoundLink.__init__(self, value, tokens)
def verifyAssignment(self, va... | CameronLonsdale/jam | compiler/lekvar/modifiers.py | Python | mit | 1,727 |
import functools
import numpy as np
from scipy.stats import norm as ndist
import regreg.api as rr
from selection.tests.instance import gaussian_instance
from selection.learning.utils import (partial_model_inference,
pivot_plot,
lee_inference)
fr... | selective-inference/selective-inference | doc/learning_examples/multi_target/lee_multi.py | Python | bsd-3-clause | 3,610 |
# Copyright 2017 BrainPad Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | BrainPad/FindYourCandy | robot-arm/web/config.py | Python | apache-2.0 | 1,841 |
from django.contrib import admin
from .models import *
class FacebookPostAdmin(admin.ModelAdmin):
pass
admin.site.register(FacebookPostAdmin, FacebookPost)
| bolster/django-social-stream | social_stream/facebook/admin.py | Python | mit | 165 |
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Sylvain Afchain <sylvain.afchain@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apach... | Juniper/neutron | neutron/tests/unit/services/metering/drivers/test_iptables_driver.py | Python | apache-2.0 | 18,262 |
#!/usr/bin/python
# -*- python -*-
# reportbug - Report a bug in the Debian distribution.
# Written by Chris Lawrence <lawrencc@debian.org>
# Copyright (C) 1999-2008 Chris Lawrence
# Copyright (C) 2008-2014 Sandro Tosi <morph@debian.org>
#
# This program is freely distributable per the following license:
#
LICENS... | ruibarreira/linuxtrail | usr/lib/python2.7/dist-packages/reportbug/__init__.py | Python | gpl-3.0 | 1,423 |
from django.test.client import Client
from cyder.base.tests import TestCase
from cyder.base.tests.test_views_base import GenericViewTests
from cyder.core.ctnr.models import Ctnr
from cyder.core.system.models import System
def do_setUp(self, test_data):
self.client = Client()
self.client.login(username='test_... | drkitty/cyder | cyder/core/tests/test_views.py | Python | bsd-3-clause | 1,247 |
import math
from subway_data import subway_data
"""
Returns: (distance in meters, subway stop data)
Subway stop data has: lat, lng, stop (name), lines
Lines is: string of all lines, i.e, '456'
"""
def get_distance_to_nearest_subway_stop(lat, lng, subway_lines = ['6','R','L']):
structs = get_all_subway_structs_... | MultiRRomero/manhattan-map | la-data/manhattan_dist.py | Python | mit | 1,100 |
#!/usr/bin/env python
'''
Reformat headers when user started with already demultiplexed data
@OURSEQ:lolapalooza1234#MySample/1
AACCGGTT
+
abcdefgh
becomes output like
@sample=MySample;1
AACCGGTT
+whatever
abcdefgh
where the ;1 means it's the first read that mapped to donor1_day5... | almlab/SmileTrain | reformat_headers.py | Python | mit | 1,747 |
from collections import namedtuple
import django.apps as apps
from . import model_exporters, datagroup_exporters
class GroupDefinition(
namedtuple(
'GroupDefinition', [
'name', 'dirname', 'datagroups', 'models'])):
def __new__(cls, name, dirname, datagroups=(), models=()):
return... | muccg/rdrf | rdrf/rdrf/services/io/content/export_import/definitions.py | Python | agpl-3.0 | 6,437 |
# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | waprin/gcloud-python | gcloud/logging/handlers/handlers.py | Python | apache-2.0 | 4,411 |
from string import Template
from tornado.web import StaticFileHandler
class GrafanaHandler(StaticFileHandler):
"""Grafana page handler"""
def __init__(self, application, request, **kw):
super(GrafanaHandler, self).__init__(application, request, **kw)
self.broker = application.broker
def ... | loads/loads-broker | loadsbroker/webapp/views.py | Python | apache-2.0 | 1,822 |
# (C) British Crown Copyright 2014 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | Jozhogg/iris | lib/iris/tests/unit/fileformats/um/optimal_array_structuring/test_optimal_array_structure.py | Python | lgpl-3.0 | 10,029 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | tensorflow/data-validation | tensorflow_data_validation/statistics/generators/natural_language_stats_generator_test.py | Python | apache-2.0 | 17,981 |
from hand_optimizer import *
import time
# Testing
# print possible_hands(['TH', '9H'], 1, ['2H', '2S', 'JC', 'QC', '8C', '7H', 'AH'])
# print possible_hands(['TH', '5S'], 1, ['2H', '2S', 'JC', '8C', '7H', '9D', '5C', '5D'])
# print possible_hands([], 1, ['2H', '2S', 'JC', '8C', '7H', 'TH', 'JH', 'QH', 'TC', 'TD', '... | session-id/pineapple-ai | hand_optimizer_test.py | Python | mit | 2,954 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import (absolute_import, divi... | mganeva/mantid | scripts/AbinsModules/InstrumentProducer.py | Python | gpl-3.0 | 781 |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import re
import subprocess
import sys
class TestFailedError(Exception):
pass
def escapeCmdArg(arg):
if '"' in arg or ' ' in arg:
return '"%s"' % arg.replace('"', '\\"')
else:
return arg
def run_com... | natecook1000/swift | utils/incrparse/test_util.py | Python | apache-2.0 | 13,303 |
# jhbuild - a tool to ease building collections of source packages
# Copyright (C) 2001-2006 James Henstridge
# Copyright (C) 2007-2008 Frederic Peters
#
# autotools.py: autotools module type definitions.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Genera... | c-a/jhbuild | jhbuild/modtypes/autotools.py | Python | gpl-2.0 | 18,392 |
# Copyright (c) 2016, DjaoDjin inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | djaodjin/drop | src/tero/setup/sldap.py | Python | bsd-2-clause | 12,154 |
# -*- coding: UTF-8 -*-
import os, sys, re, xbmc, xbmcgui, string, time, urllib, urllib2
import mechanize
from utilities import log
_ = sys.modules[ "__main__" ].__language__
movie_url = "http://www.small-industry.com"
tvshow_url = "http://www.subs4series.com"
debug_pretext = "subs4free"
def get_url(url,referer=None)... | SMALLplayer/smallplayer-image-creator | storage/.xbmc/addons/script.xbmc.subtitles/resources/lib/services/Subs4Free/service.py | Python | gpl-2.0 | 13,139 |
# Copyright (c) 2008-2015 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/util/nitro_util.py | Python | apache-2.0 | 3,844 |
import sys
import pymysql
from PyQt4 import QtGui
config = {
'host':'localhost',
'port' : 3306,
'database' : 'LojaDB',
'user' : 'root',
'password' : 'admin'
}
def sair():
sys.exit()
class classApp(QtGui.QWidget):
def bdExcluirProdutos(self):
db = pymysql.connect(**c... | ronas/PythonGNF | Artur/PyQt4Produtos.py | Python | gpl-3.0 | 7,425 |
from numba.cuda.testing import unittest
from numba.cuda.testing import skip_on_cudasim, skip_unless_conda_cudatoolkit
from numba.misc.findlib import find_lib
@skip_on_cudasim('Library detection unsupported in the simulator')
@skip_unless_conda_cudatoolkit
class TestLibraryDetection(unittest.TestCase):
def test_de... | cpcloud/numba | numba/cuda/tests/cudadrv/test_cuda_libraries.py | Python | bsd-2-clause | 801 |
from ophyd import EpicsScaler
from ophyd import EpicsSignalRO
em = EpicsScaler('XF:28IDC-BI:1{IM:02}', name='em')
em.channels.read_attrs = ['chan%d' % i for i in [22, 21, 20, 23]]
# Default of em.channels.chan22 is 'em_channels_chan22'.
# Change it to 'em_chan22' for brevity.
for ch_name in em.channels.component_names... | NSLS-II-XPD/ipython_ophyd | profile_collection/startup/20-scalers.py | Python | bsd-2-clause | 825 |
import imaginet.simple_data as sd
import imaginet.experiment as E
import imaginet.vendrov_provider as dp
import imaginet.defn.visual2_rhn as D
from imaginet.simple_data import words
dataset = 'coco'
batch_size = 128
epochs=15
prov = dp.getDataProvider(dataset, root='/home/gchrupala/repos/reimaginet/', audio_kind=None)... | gchrupala/reimaginet | run-rhn-coco-word-4/run.py | Python | mit | 1,188 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cv2
import numpy as np
class CVGaborProcessedImage(object):
def __init__(self, scale, epsilon, k0y):
self.scale = scale
self.epsilon = epsilon
self.k0y = k0y
def generate(self, image):
waveletSize = self.getIdealWaveletSiz... | zodz-linux/Retinopatia_Segmentacion | TestFolder/Morlet_test/transformadaMorlet.py | Python | gpl-2.0 | 6,927 |
# Copyright 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | prmtl/fuel-web | fuelmenu/fuelmenu/common/network.py | Python | apache-2.0 | 2,903 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 26 13:43:10 2016
@author: fr0zty
"""
import sys
import os
try:
from PySide import QtCore, QtGui, QtUiTools
from gui.pyside_dynamic import loadUi
from mav_control import ObstacleAvoidance, ROSControl, BaseController
import numpy as n... | fR0zTy/mav_control | mav_control.py | Python | gpl-3.0 | 11,353 |
import os
from os import path
import golem.appconfig as appconfig
from golem.core.simpleenv import SimpleEnv
from golem.appconfig import logger, AppConfig, ClientConfigDescriptor, NodeConfig
from golem.tools.assertlogs import LogTestCase
from golem.tools.testdirfixture import TestDirFixture
class TestNodeConfig(Log... | scorpilix/Golemtest | tests/golem/test_appconfig.py | Python | gpl-3.0 | 4,071 |
# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
# Copyright (c) 2011, 2012 Open Networking Foundation
# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
# See the file LICENSE.pyloxi which should have been included in the source distribution
# Automatically generated by LOXI from ... | floodlight/loxigen-artifacts | pyloxi3/loxi/of14/port_desc_prop.py | Python | apache-2.0 | 33,330 |
# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | kubernetes-client/python | examples/pod_config_list.py | Python | apache-2.0 | 1,882 |
# -*- coding: utf-8 -*-
import unittest
from zombase import worker
class FakeDbSession(object):
def __init__(self):
self.has_been_committed = False
def commit(self):
self.has_been_committed = True
class FakeForeman(object):
def __init__(self):
self._dbsession = FakeDbSession()... | mozaiques/zombase | tests/test_worker.py | Python | mit | 1,539 |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | wavemind/gcb17ml | modules/unsubscribe/unsubscribe.py | Python | apache-2.0 | 6,740 |
__author__ = "Yuriy"
from add_contact.fixture.session import SessionHelper
from selenium.webdriver.firefox.webdriver import WebDriver
from add_contact.fixture.contact import ContactHelper
class Application:
def __init__(self):
self.wd = WebDriver()
self.wd.implicitly_wait(15)
self.session ... | YuriyJurayev/pythonproject | 1Python_training/add_contact1/fixture/application.py | Python | apache-2.0 | 508 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache/incubator-airflow | tests/utils/test_trigger_rule.py | Python | apache-2.0 | 1,676 |
# No shebang line, this module is meant to be imported
#
# Copyright 2014 Oliver Palmer
# Copyright 2014 Ambient Entertainment GmbH & Co. KG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
... | pyfarm/pyfarm-agent | pyfarm/agent/http/api/tasks.py | Python | apache-2.0 | 5,070 |
import struct
from inspect import isclass
from StringIO import StringIO
import vstruct.primitives as vs_prims
def isVstructType(x):
return isinstance(x, vs_prims.v_base)
class VStruct(vs_prims.v_base):
'''
The VStruct class is the bases for all groups of primitive fields which
define a "structure".
... | HackerTool/vivisect | vstruct/__init__.py | Python | apache-2.0 | 17,687 |
from rest_framework.permissions import DjangoObjectPermissions
class ExtendedDjangoObjectPermissions(DjangoObjectPermissions):
hide_forbidden_for_read_objects = True
def has_object_permission(self, request, view, obj):
if self.hide_forbidden_for_read_objects:
return super().has_object_per... | chibisov/drf-extensions | rest_framework_extensions/permissions.py | Python | mit | 754 |
#!/usr/bin/python3
import unittest
from dsCmp import FileComparer, SA, SZ, RN, LN
class FileStub:
def __init__(self, mtime, size, md5):
self.__mtime = mtime
self.__size = size
self.__hash = md5
def mtime(self):
return self.__mtime
def size(self):
return self.__size
... | Kazark/dirspync | dsCmpSpecs.py | Python | mit | 1,750 |
#!/usr/bin/env python
# Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This is a script for generating easily-viewable comparisons of text and pixel
diffs.
"""
import optparse
from layout_pack... | rwatson/chromium-capsicum | webkit/tools/layout_tests/test_output_formatter.py | Python | bsd-3-clause | 4,736 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: illuz <iilluzen[at]gmail.com>
# File: AC_two_point_n.py
# Create Date: 2015-04-22 17:56:59
# Usage: AC_two_point_n.py
# Descripton:
class Solution:
# @param {integer} n
# @return {boolean}
def isHappy(self, n):
# define proce... | daniyuu/leetcode | solutions/202.Happy_Number/AC_two_point_n.py | Python | gpl-2.0 | 700 |
import random
from math import sin, pi
from spiralgalaxygame.body import Body, BodyKind
from spiralgalaxygame.geometry import Vector, Circle
from spiralgalaxygame.discdist import DiscreteDistribution
def generate_galaxy_bodies(randgen = random.random,
parentmu = 1000,
... | nejucomo/sgg | spiralgalaxygame/demiurge.py | Python | agpl-3.0 | 4,151 |
#!/usr/bin/env python
#
# wifitools.py
# Hugo Chargois - 17 jan. 2010 - v.0.1
# and Joe Crop :)
# Parses the output of iwlist scan into a table
import sys
import subprocess
import netifaces as ni
from uuid import getnode as get_mac
#interface = "wlan0"
interface = "en0"
# You can add or change the functions to parse... | joecrop/SDMO | cgi-bin/wifitools.py | Python | mit | 5,865 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['LinearTrend'] , ['Seasonal_Hour'] , ['ARX'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Logit/model_control_one_enabled_Logit_LinearTrend_Seasonal_Hour_ARX.py | Python | bsd-3-clause | 154 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/google-ctf | 2019/quals/hardware-flagrom/src/emu8051/gen_opcodes.py | Python | apache-2.0 | 5,851 |
"""Various tests for the Crystal class and its methods.
"""
import numpy as np
import pytest
from operator import mod
from itertools import product
from pydft.crystal import *
from pydft.bases.planewave import *
from numpy.fft import fftn, ifftn
def test_I_matrix():
"""Verify the I matrix acting on the N matrix i... | jerjorg/dft | tests/planewave_tests.py | Python | gpl-3.0 | 6,585 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from collections import namedtuple
CacheEntry = namedtuple('CacheEntry', 'model_plural class_name cache_type')
MappingEntry = namedtuple('MappingEntry', 'class_name attr polymorph')
def resource(model_pl... | kr41/ggrc-core | src/ggrc/cache/cache.py | Python | apache-2.0 | 7,039 |
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | gaolichuang/py-task-framework | nova/sample/manager.py | Python | apache-2.0 | 3,012 |
#!/usr/bin/env python
# As close as possible to a direct copy of the sample in PEP 257 and still
# be valid code. Simple as can be.
complex_zero = 0j
## @brief Form a complex number.
#
#
# @param real the real part (default 0.0)
# @param imag the imaginary part (default 0.0)
#
#
# @namespace sample_pep.complex
def... | Feneric/doxypypy | doxypypy/test/sample_pep.outnc.py | Python | gpl-2.0 | 459 |
from fabric.api import local
from fabric.decorators import task
from fabric.context_managers import settings, hide
@task
def install():
"""Install requirements packages"""
local("pip install -r requirements.txt")
@task
def runserver():
"""Run Server"""
local("./manage.py runserver")
@task
def pep8... | phodal/growth-code | chapter4/fabfile.py | Python | mit | 738 |
__all__ = ('WebSocketResponse', 'MsgType')
import asyncio
import warnings
from . import hdrs
from .errors import HttpProcessingError, ClientDisconnectedError
from .websocket import do_handshake, Message, WebSocketError
from .websocket_client import MsgType, closedMessage
from .web_exceptions import (
HTTPBadReque... | lfblogs/aiopy | aiopy/required/aiohttp/web_ws.py | Python | gpl-3.0 | 8,998 |
from tracking.signals import hit, hit_handler
hit.connect(hit_handler)
| tsoporan/tehorng | tracking/__init__.py | Python | agpl-3.0 | 72 |
from __future__ import absolute_import
import pytest
import schematec.schema
import schematec.abc as abc
import schematec.exc as exc
import schematec.converters as converters
import schematec.validators as validators
def test_empty_dict():
schema = schematec.schema.expand({})
assert isinstance(schema, schem... | mylokin/schematec | tests/test_schema_expand.py | Python | mit | 1,324 |
from pprint import pprint
| anselmobd/fo2 | src/cd/views/abandon.py | Python | mit | 26 |
# https://leetcode.com/problems/longest-absolute-file-path/
class Solution(object):
def lengthLongestPath(self, input):
"""
:type input: str
:rtype: int
"""
maxlen = 0
parent_pathlen = {0:0}
lines = input.split('\n')
for line in lines:
name... | young-geng/leet_code | problems/388_longest-absolute-file-path/main.py | Python | mit | 817 |
# Copyright (c) 2006-2007 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this ... | dpac-vlsi/SynchroTrace | util/configs/common/Caches.py | Python | bsd-3-clause | 2,224 |
# -*- coding: utf-8 -*-
import unittest
import uuid
from webtest import TestApp
from src.card.core import app
# mock for response
TEST_CARD_NAME = "testcard"
TEST_CARD_DESC = "testdescription"
TEST_LIST_ID = str(uuid.uuid4())
TEST_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMmJhNDNjM2MtNmMzYS00OTR... | reneleban/jak-services | tests/test_card.py | Python | gpl-3.0 | 1,733 |
import pytest
from eventum.lib.text import clean_markdown
@pytest.mark.parametrize(["markdown", "output"], [
('**Bold** text is unbolded.', 'Bold text is unbolded.'),
('So is *underlined* text.', 'So is underlined text.'),
('An [](http://empty-link).', 'An.'),
('A [test](https://adicu.com)', 'A test ... | danrschlosser/eventum | tests/test_text.py | Python | mit | 790 |
# BSD 3-Clause License
#
# Copyright (c) 2016-19, University of Liverpool
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notic... | fsimkovic/cptbx | conkit/io/_parser.py | Python | gpl-3.0 | 3,072 |
from typing import Dict, Union
import tidy3d as td
from tidy3d.components.medium import PoleResidue
from tidy3d.components.types import ComplexNumber
from tidy3d.material_library import material_library
MATERIAL_NAME_TO_MEDIUM = {
"si": material_library["cSi"]["Li1993_293K"],
"csi": material_library["cSi"]["L... | gdsfactory/gdsfactory | gdsfactory/simulation/gtidy3d/materials.py | Python | mit | 2,898 |
"""
WSGI config for formula1 project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | sar009/formula-1 | formula1/wsgi.py | Python | mit | 1,425 |
# Copyright (c) by it's authors.
# Some rights reserved. See LICENSE, AUTHORS.
from peer import *
class DocumentCredentialsDocument(Peer):
from documentCache import DocumentCache
from documentCredentials import DocumentCredentials
from database import Database
Routings = [
(DocumentCache.Out... | FreshXOpenSource/wallaby-base | wallaby/pf/peer/documentCredentialsDocument.py | Python | bsd-2-clause | 774 |
print "I will now count my chickens:"
print "Hens", 25 + 30 / 6
print "Roosters", 100 - 25 * 3 % 4
print "Now I will count the eggs:"
print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6
print "Is it true that 3 + 2 < 5 - 7?"
print 3 + 2 < 5 - 7
print "What is 3 + 2?", 3 + 2
print "What is 5 - 7?", 5 - 7
prin... | vfahrenheit/python-study | learnpythonthehardway/ex3.py | Python | apache-2.0 | 497 |
# -*- coding: utf-8 -*-
'''
Copyright (C) 2013 onwards University of Deusto
All rights reserved.
This software is licensed as described in the file COPYING, which
you should have received as part of this distribution.
This software consists of contributions made by many individuals,
listed below:
@auth... | gomezgoiri/reusingWebActuatorsFromSemanticSpace | actuation/scenarios/mixed_space_rest.py | Python | apache-2.0 | 2,861 |
def bradycardia(hr, lowerthresh):
"""
This module determines when in the ECG data there is bradycardia
:param hr: (ndarray) heart rate- used to determine when
bradycardia occurred in ECG trace
:param lowerthresh: (int or double) lower threshold for determining
bradycardia- user input or defa... | polortiz4/bme590_assignment02 | tachybradycardia.py | Python | mit | 1,295 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Unit converter using pint.
"""
from pint import UnitRegistry
from logger import Logger
class UnitConverter():
def __init__(self, log_level="ERROR"):
logger = Logger(log_level)
self.log = logger.get_logger()
self.ureg = UnitRegistry()
... | PlanetHunt/satgen | unit_converter.py | Python | mit | 1,295 |
## TODO: update the following assignment description
"""
<h3>
Assessment of test case coverage for <code>[TODO: function name]()</code>
</h3>
<p>
A machine test that automatically assesses the completeness of a list of
provided test cases for the <code>[TODO: function name]()</code> function.
<p>
... | rice-cs-edutools/testception | evaluation/instructor_template.py | Python | gpl-3.0 | 12,327 |
#!/usr/bin/python
# -*- coding: utf8 -*-
"""
Copyright (C) 2012 Xycl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This pr... | Xycl/plugin.image.mypicsdb | resources/lib/pathscanner.py | Python | gpl-2.0 | 5,480 |
from urlparse import urlparse
import logging
import urllib3
import pyramid_airbrake
log = logging.getLogger(__name__)
def create_http_pool(settings):
url = settings['notification_url']
maxsize = settings['threaded.threads'] # sort of a lie, potentially
timeout = settings['timeout']
if settings['us... | epii/pyramid_airbrake | pyramid_airbrake/airbrake/submit.py | Python | mit | 3,343 |
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from .models import Exchange, Resources, Territory, Bond
from .widgets import KnobInput
class ExchangeForm(forms.Form):
offeror_as_bond = forms.BooleanField(label = 'As Bond?',
ini... | jimmyskull/ironandblood | ironandblood/game/forms.py | Python | mit | 4,723 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.