code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
##############################################################################
#
# Copyright (c) 2014, 2degrees Limited.
# All Rights Reserved.
#
# This file is part of hubspot-contacts
# <https://github.com/2degrees/hubspot-contacts>, which is subject to the
# provisions of the BSD at
# <http://dev.2degreesnetwork.com... | 2degrees/hubspot-contacts | hubspot/__init__.py | Python | bsd-3-clause | 884 |
""" Types of conv net layers that pydeeplearn supports now."""
__author__ = "Mihaela Rosca"
__contact__ = "mihaela.c.rosca@gmail.com"
import numpy as np
import numpy.random as random
import theano
from theano import tensor as T
from theano.tensor.nnet import conv
from theano.tensor.signal import downsample
from act... | Warvito/pydeeplearn | code/lib/cnnLayers.py | Python | bsd-3-clause | 4,913 |
import re
from django.core.exceptions import ImproperlyConfigured
from sqlalchemy import create_engine, MetaData
from sqlalchemy.orm import sessionmaker
from tranquil.models import Importer
__all__ = ( 'engine', 'meta', 'Session', )
class EngineCache(object):
__shared_state = dict(
engine = None,
meta = None,
... | g2p/tranquil | tranquil/__init__.py | Python | bsd-3-clause | 1,717 |
# Import USB support depending on version of pyUSB
try:
import usb.core
import usb.util
#import usb.backend.libusb01
#backend = usb.backend.libusb01.get_backend()
USBVER=1
except ImportError:
import usb
#print("Warning: You are using pyUSB 0.x, future deprecation planned.")
USBVER=0
imp... | JonathonReinhart/killerbee | killerbee/kbutils.py | Python | bsd-3-clause | 22,117 |
import logging
from django.utils.translation import ugettext_lazy as _
from connected_accounts.conf import settings
from connected_accounts.provider_pool import providers
from .base import OAuth2Provider, ProviderAccount
logger = logging.getLogger('connected_accounts')
class GoogleAccount(ProviderAccount):
de... | mishbahr/django-connected | connected_accounts/providers/google.py | Python | bsd-3-clause | 1,465 |
import os
import pytest
from rdflib.graph import Graph, ConjunctiveGraph
import unittest
from rdflib.term import Literal, URIRef
from rdflib.plugins.parsers.notation3 import BadSyntax, exponent_syntax
import itertools
from urllib.error import URLError
from test import TEST_DIR
test_data = """
# Definitions of term... | RDFLib/rdflib | test/test_n3.py | Python | bsd-3-clause | 8,671 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from kombu.async.http.curl import READ, WRITE, CurlClient
from kombu.tests.case import (
HubCase, Mock, call, patch, case_requires, set_module_symbol,
)
@case_requires('pycurl')
class test_CurlClient(HubCase):
class Client(CurlClient):
... | rhcarvalho/kombu | kombu/tests/async/http/test_curl.py | Python | bsd-3-clause | 5,102 |
# -*- coding: utf-8 -*-
import unittest
from flask import Flask
from flask.ext.testing import TestCase
from pkpserver import app as application
class BaseTest(TestCase):
def create_app(self):
app = Flask(__name__)
app.config['TESTING'] = True
application.configure_api(app)
return a... | petrilli/pkpserver | tests/test_pin_validation_error.py | Python | bsd-3-clause | 1,018 |
from setuptools import setup, find_packages
setup(
name='django-oneforty',
version=__import__('oneforty').__version__,
description='django-oneforty is designed to be a simple, lightweight status/update engine.',
long_description=open('README.txt').read(),
author='Pure Blue Inc',
author_email='d... | davemerwin/django-oneforty | setup.py | Python | bsd-3-clause | 1,060 |
from collections import OrderedDict
import logging
import time
import sys
import pandas as pd
import numpy as np
import pyprind
import dask
from dask import delayed
from dask.diagnostics import ProgressBar
import cloudpickle as cp
import pickle
from py_entitymatching.blocker.blocker import Blocker
import py_entitym... | anhaidgroup/py_entitymatching | py_entitymatching/dask/dask_black_box_blocker.py | Python | bsd-3-clause | 22,385 |
#!/usr/bin/python
##
#
# @file
## This script modifies the VHDL system code generated by SOPC Builder.
# It parses the basic system description to find all slave modules that are connected to more than one master module and
# modifies the SOPC-generated arbitrators to support a TDMA access scheme.
# @copyright BSD N... | mikulcak/forsyde_psopc | source_code/system_creation/lib/modify_arbiters.py | Python | bsd-3-clause | 14,408 |
# !/usr/bin/env python
"""Defines the unit tests for the :mod:`colour_hdri.generation.radiance` module."""
from __future__ import annotations
import numpy as np
import os
import unittest
from colour import RGB_COLOURSPACES
from colour.hints import List
from colour_hdri import TESTS_RESOURCES_DIRECTORY
from colour_h... | colour-science/colour-hdri | colour_hdri/generation/tests/test_radiance.py | Python | bsd-3-clause | 2,680 |
# -*- encoding: utf-8 -*-
import datetime
from django import forms
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from django.core import exceptions as django_exceptions
from lyra import models
class Reservation(forms.ModelForm):
def __init__(self, *args, **kw... | hylje/Lyra | lyra/forms.py | Python | bsd-3-clause | 3,064 |
import h5py
import sys
import os.path as op
from fos import *
import numpy as np
a=np.loadtxt(op.join(op.dirname(__file__), "data", "rat-basal-forebrain.swc") )
pos = a[:,2:5].astype( np.float32 )
radius = a[:,5].astype( np.float32 ) * 4
# extract parent connectivity and create full connectivity
parents = a[1:,6] - ... | fos/fos | examples/microcircuit_multi.py | Python | bsd-3-clause | 2,857 |
"""
Integrate a grid of dens and temp using the defaults in net.par.default
This could use some updating to be more user-friendly
Donald Willcox
"""
from __future__ import print_function
import numpy as np
import subprocess
import re
num_dens = 100
num_temp = 100
dens = np.logspace(8.0, 11.0, num=num_dens, endpoint=... | dwillcox/pyreaclib | util/grid.py | Python | bsd-3-clause | 2,575 |
import datetime
from decimal import Decimal as D, InvalidOperation
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.loading import get_model
from django.db... | Idematica/django-oscar | oscar/apps/dashboard/orders/views.py | Python | bsd-3-clause | 28,253 |
# -*- coding: utf-8 -*-
import os
from django.conf import settings
from django.utils.encoding import smart_text
from django.core.files import temp
from django.core.files.base import File as DjangoFile
from django.utils.http import urlquote
from unittest import mock
from pyquery import PyQuery
from olympia import am... | psiinon/addons-server | src/olympia/versions/tests/test_views.py | Python | bsd-3-clause | 19,783 |
"""Attention combination strategies.
This modules implements attention combination strategies for multi-encoder
scenario when we may want to combine the hidden states of the encoders in
more complicated fashion.
Currently there are two attention combination strategies flat and hierarchical
(see paper `Attention Combi... | bastings/neuralmonkey | neuralmonkey/encoders/encoder_wrapper.py | Python | bsd-3-clause | 18,095 |
from twisted.trial.unittest import TestCase
from vusion.persist import Export
from tests.utils import ObjectMaker
class TestExport(TestCase, ObjectMaker):
def test_validation_ok(self):
export = Export(**self.mkdoc_export())
self.assertTrue(isinstance(export, Export))
| texttochange/vusion-backend | vusion/persist/export/tests/test_export.py | Python | bsd-3-clause | 293 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_foxtabs
----------------------------------
Tests for `foxtabs` module.
"""
import unittest
from foxtabs import foxtabs
class TestFoxtabs(unittest.TestCase):
def setUp(self):
pass
def test_something(self):
pass
def tearDown(self)... | gjost/foxtabs | tests/test_foxtabs.py | Python | bsd-3-clause | 382 |
import os, sys
from scipy.misc import imread, imsave
from scipy.ndimage.interpolation import rotate
import numpy as np
if len(sys.argv) < 3:
print "Usage: python gen_train_register.py input_folder output_folder"
exit(1)
fi = sys.argv[1]
fo = sys.argv[2]
classes = os.listdir(fi)
os.chdir(fo)
for cls in class... | JesseLivezey/plankton | pylearn2/scripts/plankton/gen_train_register.py | Python | bsd-3-clause | 1,233 |
#!/usr/bin/env python
#### Sudoku generator ####
import random
import time
from collections import defaultdict
class Square(object):
'''Main class holding the attributes for each square of the sudoku'''
def __init__(self, x, y):
self.value = None
self.x = x
self.y = y
... | michalczaplinski/sudoku | sudoku_generator.py | Python | bsd-3-clause | 5,317 |
from __future__ import absolute_import
import logging
from django.dispatch.dispatcher import NO_RECEIVERS, Signal
class BetterSignal(Signal):
def connect(self, receiver=None, **kwargs):
"""
Support decorator syntax:
>>> @signal.connect(sender=type)
>>> def my_receiver(**kwargs):... | mvaled/sentry | src/sentry/signals.py | Python | bsd-3-clause | 4,787 |
from __future__ import (division, print_function, absolute_import,
unicode_literals)
from collections import OrderedDict
import os
from io import BytesIO
import numpy as np
from astropy.io import fits
import msumastro
from .notebook_dir import get_data_path
from .ipython_version_helper impo... | astrofrog/reducer | reducer/image_browser.py | Python | bsd-3-clause | 12,267 |
"""
Test the memory module.
"""
# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# Copyright (c) 2009 Gael Varoquaux
# License: BSD Style, 3 clauses.
import shutil
import os
import os.path
import pickle
import sys
import time
import datetime
import pytest
from joblib.memory import Memory
from job... | lesteve/joblib | joblib/test/test_memory.py | Python | bsd-3-clause | 39,966 |
# -*- coding: utf-8 -*-
import json
import os
import tempfile
import urllib
from decimal import Decimal
from StringIO import StringIO
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from mock import patch
from nose.tools import eq_
from rest_framework.request import Request
... | washort/zamboni | mkt/api/tests/test_handlers.py | Python | bsd-3-clause | 37,545 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ラムダ式(Python3)
#
def sub(price, money):
change = money - (int)( (lambda a:a*1.08)(price) )
print("おつりは{}円 {}".format(change, "(´・ω・`)"))
def main():
sub(100, 500)
if __name__ == "__main__":
main()
| yutakakn/MyScript | Python/lambda.py | Python | bsd-3-clause | 301 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('discussion', '0011_attachment_name'),
]
operations = [
migrations.AlterField(
model_name='attachment',
... | BuildmLearn/University-Campus-Portal-UCP | UCP/discussion/migrations/0012_auto_20160623_1849.py | Python | bsd-3-clause | 442 |
# Authors: Nicolas Goix <nicolas.goix@telecom-paristech.fr>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD 3 clause
import numpy as np
from warnings import warn
from scipy.stats import scoreatpercentile
from .base import NeighborsBase
from .base import KNeighborsMixin
from .bas... | wazeerzulfikar/scikit-learn | sklearn/neighbors/lof.py | Python | bsd-3-clause | 12,181 |
import re, os
def cmd_install(ensoapi):
seldict = ensoapi.get_selection()
text = seldict.get("text", "").strip()
lines = text.split("\n")
ensoapi.display_message(lines)
return
if len(lines) < 3:
msg = "There was no command to install!"
ensoapi.display_message(msg)
ensoapi.set_selection({
... | curaloucura/Enso-Ubuntu | ensocommands/random.py | Python | bsd-3-clause | 2,893 |
from ..math import vectorops,so3,se3
class SimLogger:
"""A CSV logger for a simulation. """
def __init__(self,sim,state_fn,contact_fn=None,colliding='all',saveheader=True):
"""
Logs a simulation to a CSV file.
Arguments:
- sim: the klampt.Simulator object you wish to use
... | hpbader42/Klampt | Python/klampt/sim/simlog.py | Python | bsd-3-clause | 14,115 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
brush = orm.Brush.objects.get(canonical_name='paintbrush')
brush.description = "Billy is perfect for that painter... | drawquest/drawquest-web | website/drawquest/apps/brushes/migrations/0009_add_iphone_fields_to_paintbrush.py | Python | bsd-3-clause | 5,409 |
""" Profile module
"""
from operator import itemgetter
from cProfile import Profile
from SpeedIT.ProjectErr import Err
from SpeedIT.Utils import (
format_time,
get_table_rst_formatted_lines
)
def _profile_it(func, func_positional_arguments, func_keyword_arguments, name, profileit__max_slashes_fileinfo, profile... | peter1000/SpeedIT | SpeedIT/ProfileIT.py | Python | bsd-3-clause | 7,430 |
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 5, s, t 10.1, s, t 10.2, s, q"
tags = "spawn, Reverse"
import cocos
from cocos.director import director
from cocos.actions import Rotate, R... | eevee/cocos2d-mirror | test/test_spawn.py | Python | bsd-3-clause | 1,024 |
import opendbpy as odb
import helper
import odbUnitTest
class TestWireCodec(odbUnitTest.TestCase):
#This Function is called before each of the test cases defined below
def setUp(self):
self.db, self.tech, self.m1, self.m2, self.m3, self.v12, self.v23 = helper.createMultiLayerDB()
self.chip = ... | The-OpenROAD-Project/OpenROAD | src/odb/test/unitTestsPython/TestWireCodec.py | Python | bsd-3-clause | 5,470 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy.io import fits
from astropy.utils.data import get_pkg_data_filename
from astropy.wcs import WCS
from numpy.testing import assert_allclose
from ..high_level import reproject_exact
class TestReprojectExact(ob... | barentsen/reproject | reproject/spherical_intersect/tests/test_high_level.py | Python | bsd-3-clause | 1,908 |
import requests
from config import constants
from database import db
from database import db_models
from util import fips
R = db_models.Rep
HOUSE_MEMBERS_LEAVING_OFFICE_URL = 'https://api.propublica.org/congress/v1/114/house/members/leaving.json'
SENATE_MEMBERS_LEAVING_OFFICE_URL = 'https://api.propublica.org/congre... | jlgoldman/writetogov | database/populate_rep_status_from_propublica.py | Python | bsd-3-clause | 2,149 |
"""
Braubuddy LibratoAPI unit tests.
"""
from mock import call, patch, MagicMock
from braubuddy.tests import BraubuddyTestCase
from braubuddy.output import libratoapi
@patch('braubuddy.output.libratoapi.librato.connect')
class LibratoAPIOutput(BraubuddyTestCase):
def test_librato_api_connect(self, mk_libratoapi... | amorphic/braubuddy | braubuddy/tests/output/test_libratoapi.py | Python | bsd-3-clause | 1,721 |
from app import write_entries
import datetime
import random
ts = datetime.datetime.now().strftime("%Y-%m-%d%H:%M-%S")
offset = random.randrange(0, 1475)
print("Enter user=%s" % ts)
print("Enter email=%s" % offset)
prime = write_entries.delay(ts, offset)
| aseemm/flask-template | wentries.py | Python | bsd-3-clause | 256 |
# Copyright (c) 2016, LE GOFF Vincent
# 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 conditions and th... | vlegoff/cocomud | src/ui/sharp_editor.py | Python | bsd-3-clause | 10,805 |
#-*- coding: utf-8 -*-
from django.db import models
from django.contrib import admin
from datetime import datetime, timedelta
import pytz
def default_now():
now = datetime.utcnow().replace(tzinfo=pytz.utc)
# Essa merda de UTC só funciona direito na versão 1.4 :(
# Era fazer essa gambi ou modificar o códig... | thiagopa/thiagopagonha | wiki/models.py | Python | bsd-3-clause | 842 |
from robot.utils import ConnectionCache
class BrowserCache(ConnectionCache):
def __init__(self):
ConnectionCache.__init__(self, no_current_msg='No current browser')
self._closed = set()
@property
def browsers(self):
return self._connections
def get_open_browsers(s... | WandyYing/Selenium2LibraryPlus | Selenium2Library/utils/browsercache.py | Python | bsd-3-clause | 927 |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise Runtime... | mfem/PyMFEM | mfem/_par/nonlinearform.py | Python | bsd-3-clause | 14,566 |
# Generated from STIXPattern.g4 by ANTLR 4.9.2
from antlr4 import *
if __name__ is not None and "." in __name__:
from .STIXPatternParser import STIXPatternParser
else:
from STIXPatternParser import STIXPatternParser
# This class defines a complete generic visitor for a parse tree produced by STIXPatternParser.... | oasis-open/cti-pattern-validator | stix2patterns/v21/grammars/STIXPatternVisitor.py | Python | bsd-3-clause | 6,827 |
from blogengine.models import Post
from django.contrib import admin
admin.site.register(Post)
| rickhurst/Django-non-rel-blog | blogengine/admin.py | Python | bsd-3-clause | 95 |
"""
Label printing models
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import os
import logging
import datetime
from django.conf import settings
from django.db import models
from django.urls import reverse
from django.core.validators import FileExtensionValidator, MinValueValidator
... | inventree/InvenTree | InvenTree/label/models.py | Python | mit | 10,528 |
import json
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from helpcenter import models
from helpcenter.api import serializers
from helpcenter.api.testing_utils import full_url
from helpcenter.testing_utils import create_article, create_category
class TestArticleSerializer(Test... | smalls12/django_helpcenter | helpcenter/api/tests/test_serializers.py | Python | mit | 6,657 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/lair/base/shared_objective_data_terminal.iff"
result.attribute_temp... | anhstudios/swganh | data/scripts/templates/object/tangible/lair/base/shared_objective_data_terminal.py | Python | mit | 457 |
"""Provides all the generic data related to the address."""
COUNTRY_CODES = {
"a2": [
"AD",
"AE",
"AF",
"AG",
"AI",
"AL",
"AM",
"AN",
"AO",
"AQ",
"AR",
"AS",
"AT",
"AU",
"AW",
"AX",
... | lk-geimfari/elizabeth | mimesis/data/int/address.py | Python | mit | 20,986 |
#Databank API demo
import urllib2
import base64
import urllib
from lib.multipartform import MultiPartForm
#===============================================================================
#Using urllib2 to create a package in Databank
url = "http://databank-vm1.oerc.ox.ac.uk/test/datasets"
req = urllib2.Requ... | benosteen/RDFDatabank | docs/using_databank_api/DatabankDemo.py | Python | mit | 1,544 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import pendulum
import config
import busses
def get_message_type(msg):
if msg.text is not None:
return "text"
elif msg.audio is not None:
return "audio"
elif msg.document is not None:
return "document"
e... | Pixdigit/Saufbot | helper.py | Python | mit | 5,080 |
# Generated by Django 2.2.13 on 2020-09-30 11:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('marketplace', '0022_extend_description_limits'),
]
operations = [
migrations.AddField(
model_name='category',
name=... | opennode/nodeconductor-assembly-waldur | src/waldur_mastermind/marketplace/migrations/0023_category_i18n.py | Python | mit | 917 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'Key', fields ['owner', 'id']
db.delete_u... | imperodesign/paas-tools | deis/stg/controller/api/south_migrations/0024_auto__chg_field_key_fingerprint__del_unique_key_owner_id__add_unique_k.py | Python | mit | 12,806 |
from django.contrib.auth.decorators import (
login_required, permission_required
)
from django.core.urlresolvers import reverse
from django.db import IntegrityError
from django.shortcuts import render
from django.utils.translation import ugettext as _, ungettext
import reversion
from modoboa.lib import events
fr... | bearstech/modoboa-admin | modoboa_admin/views/alias.py | Python | mit | 4,252 |
"""Disassembler of Python byte code into mnemonics."""
import sys
import types
from opcode_25 import *
from opcode_25 import __all__ as _opcodes_all
__all__ = ["dis","disassemble","distb","disco"] + _opcodes_all
del _opcodes_all
def dis(x=None):
"""Disassemble classes, methods, functions, or code.
With no ... | whymirror/unholy | decompyle/decompyle/dis_23.py | Python | mit | 6,551 |
#!/usr/bin/env python
import unittest
from pycoin.serialize import h2b
from pycoin.intbytes import int_to_bytes, bytes_from_ints
from pycoin.tx.script.tools import bin_script, compile, disassemble, int_to_script_bytes, int_from_script_bytes
from pycoin.tx.script.opcodes import OPCODE_LIST
from pycoin.tx.script.vm imp... | moocowmoo/pycoin | tests/tools_test.py | Python | mit | 4,283 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/wearables/ithorian/shared_ith_bandolier_s08.iff"
result.attribute_t... | anhstudios/swganh | data/scripts/templates/object/tangible/wearables/ithorian/shared_ith_bandolier_s08.py | Python | mit | 472 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='hailtop',
version="0.0.1",
author="Hail Team",
author_email="hail@broadinstitute.org",
description="Top level Hail module.",
url="https://hail.is",
project_urls={
'Documentation': 'https://hail.is/docs/0... | danking/hail | hail/python/setup-hailtop.py | Python | mit | 848 |
# Copyright (c) 2010 Resolver Systems Ltd.
# All Rights Reserved
#
from __future__ import with_statement
from os import path
import urllib2
from urlparse import urljoin
from functionaltest import FunctionalTest, PAGE_LOAD_TIMEOUT
class Test_2774_ExportCSV(FunctionalTest):
def test_can_export_csv(self):
... | jmptrader/dirigible-spreadsheet | dirigible/fts/tests/test_2774_ExportCSV.py | Python | mit | 7,349 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division, print_function
import pickle
import pytest
from poker import Hand, Combo, Rank
def test_first_and_second_are_instances_of_Rank():
assert isinstance(Hand('22').first, Rank)
assert Hand('22').first == Rank('2')
asse... | Seanmcn/poker | tests/test_hand.py | Python | mit | 5,035 |
# an example of how to plugin the max aggregate manager with the flavour model
# might need to be tested
#
from sfa.generic.pl import pl
class max (pl):
# the max flavour behaves like pl, except for
# the aggregate
def aggregate_manager_class (self) :
import sfa.managers.aggregate_manager_max
re... | yippeecw/sfa | sfa/generic/max.py | Python | mit | 553 |
#!/usr/bin/env python
#alphabeta.py
from __future__ import print_function
import sys
import random
#import player # I don't think this is needed anymore
import transpositions
UPPER_BOUND = 100
LOWER_BOUND = -100
DEFAULT_DEPTH = 5
VOLATILE_DEPTH = -3
ORDER_NORMAL = 1
ORDER_FREE = 2
#function for returning randomly f... | blamed-cloud/AISuite | alphabeta.py | Python | mit | 6,127 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-20 16:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('billjobs', '0001_initial'),
]
operations = [
migrations.AddField(
... | ioO/billjobs | billjobs/migrations/0002_service_is_available.py | Python | mit | 478 |
from pycukes import BeforeAll, AfterAll, BeforeEach, AfterEach
@BeforeAll
def add_message1_attr(context):
context.counter = 1
@BeforeEach
def add_message_attr(context):
context.counter += 1
setattr(context, 'message%d' % context.counter, 'msg')
@AfterEach
def increment_one(context):
context.counter... | hltbra/pycukes | specs/console_examples/stories_with_hooks/support/env.py | Python | mit | 392 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/deed/event_perk/shared_lambda_shuttle_static_deed.iff"
result.attri... | anhstudios/swganh | data/scripts/templates/object/tangible/deed/event_perk/shared_lambda_shuttle_static_deed.py | Python | mit | 487 |
# -*- coding: utf-8 -*-
""" Sahana Eden DVI Model
@author: Dominic König <dominic[at]aidiq.com>
@copyright: 2009-2012 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files ... | ashwyn/eden-message_parser | modules/eden/dvi.py | Python | mit | 22,129 |
from typing import Dict, List
import numpy as np
from scipy.stats import norm
from . import common_args
from ..util import (read_param_file, compute_groups_matrix, ResultDict,
_define_problem_with_groups, _compute_delta, _check_groups)
def analyze(problem: Dict, X: np.ndarray, Y: np.ndarray,
... | SALib/SALib | src/SALib/analyze/morris.py | Python | mit | 16,738 |
# -*- coding: utf-8 -*-
"""
Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved.
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without res... | xunxunzgq/open-hackathon-bak_01 | open-hackathon-server/src/hackathon/storage/local_storage.py | Python | mit | 7,616 |
#!/usr/bin/env python
import os
import argparse
import numpy as np
import pandas as pd
import pycondor
import comptools as comp
if __name__ == "__main__":
p = argparse.ArgumentParser(
description='Extracts and saves desired information from simulation/data .i3 files')
p.add_argument('-c', '--config... | jrbourbeau/cr-composition | processing/legacy/anisotropy/random_trials/process_kstest.py | Python | mit | 7,627 |
# flake8: noqa
from __future__ import absolute_import, unicode_literals
import warnings
from feincms.extensions.ct_tracker import *
warnings.warn(
'Import %s from feincms.extensions.%s' % (__name__, __name__),
DeprecationWarning, stacklevel=2)
| mcmaxwell/idea_digital_agency | idea/feincms/module/extensions/ct_tracker.py | Python | mit | 255 |
#!/usr/bin/env python
import os
import sys
sys.path.insert(0, os.pardir)
from testing_harness import TestHarness, PyAPITestHarness
import openmc
class FilterMaterialTestHarness(PyAPITestHarness):
def _build_inputs(self):
filt = openmc.Filter(type='material', bins=(1, 2, 3, 4))
tally = openmc.Tall... | mjlong/openmc | tests/test_filter_material/test_filter_material.py | Python | mit | 858 |
# Generated by Django 1.11.7 on 2018-05-21 09:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('waldur_jira', '0017_project_action'),
]
operations = [
migrations.AddField(
model_name='project',
name='runtime_stat... | opennode/nodeconductor-assembly-waldur | src/waldur_jira/migrations/0018_project_runtime_state.py | Python | mit | 465 |
from test_plus.test import TestCase
from ..trakt import Trakt
class TestTraktApi(TestCase):
def setUp(self):
self.api = Trakt(context='/search')
def test_should_find_exact_movie(self):
data = DataProvider.full_info()
self.assertIsNotNone(self.api.query(query=data['title'], year=data[... | APMD/PMD | PMD/externalapi/tests/test_trakt.py | Python | mit | 1,683 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-07-19 14:51
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('query_designer', '0012_query_dataset_query'),
]
operations = [
migrations.RemoveField... | dipapaspyros/bdo_platform | query_designer/migrations/0013_remove_query_dataset_query.py | Python | mit | 405 |
import asposewordscloud
from asposewordscloud.WordsApi import WordsApi
from asposewordscloud.WordsApi import ApiException
from asposewordscloud.models import ProtectionRequest
import asposestoragecloud
from asposestoragecloud.StorageApi import StorageApi
from asposestoragecloud.StorageApi import ResponseMessage
apiK... | aspose-words/Aspose.Words-for-Cloud | Examples/Python/Examples/ReadingAllHyperlinksFromDocument.py | Python | mit | 1,469 |
def remove_exclamation_marks(s):
return s.replace('!', '')
| the-zebulan/CodeWars | katas/kyu_8/remove_exclamation_marks.py | Python | mit | 63 |
# -*- encoding: utf-8 -*-
__author__ = 'Thomas Sileo (thomas@trucsdedev.com)'
import unittest
import os
import tempfile
from camlipy.tests import CamliPyTestCase
class TestCamliPy(CamliPyTestCase):
def testPutBlobStr(self):
test_blob_str = os.urandom(4096)
resp = self.server.put_blobs([test_bl... | lowks/camlipy | camlipy/tests/test_camlipy.py | Python | mit | 3,051 |
from __future__ import absolute_import, unicode_literals
import os
from virtualenv.util.six import ensure_str, ensure_text
from .convert import convert
def get_env_var(key, as_type):
"""Get the environment variable option.
:param key: the config key requested
:param as_type: the type we would like to ... | TeamSPoon/logicmoo_workspace | packs_web/butterfly/lib/python3.7/site-packages/virtualenv/config/env_var.py | Python | mit | 844 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/container/quest/crafting_contract/shared_weapon_crate.iff"
result.a... | anhstudios/swganh | data/scripts/templates/object/tangible/container/quest/crafting_contract/shared_weapon_crate.py | Python | mit | 451 |
"""
Provides functionality to interact with thermostats.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/thermostat/
"""
import logging
import os
import voluptuous as vol
from homeassistant.helpers.entity_component import EntityComponent
from homeassi... | Zyell/home-assistant | homeassistant/components/thermostat/__init__.py | Python | mit | 8,539 |
from __future__ import print_function
import logging
from twisted.internet import reactor, ssl
from txjsonrpc.web.jsonrpc import Proxy
from OpenSSL import SSL
from twisted.python import log
def printValue(value):
print("Result: %s" % str(value))
def printError(error):
print('error', error)
def shutDown(dat... | oubiwann/txjsonrpc | examples/ssl/client.py | Python | mit | 1,418 |
# 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 ... | v-iam/azure-sdk-for-python | azure-mgmt-consumption/azure/mgmt/consumption/models/__init__.py | Python | mit | 1,087 |
import requests
from django.conf import settings
from icalendar import Calendar
def get_calendar_data():
feed_url = settings.CALENDAR_ICAL_URL
resp = requests.get(feed_url)
cal = Calendar.from_ical(resp.content)
return cal
def get_events():
events = []
for component in get_calendar_data().wa... | bonniejools/cabot | cabot/cabotapp/calendar.py | Python | mit | 638 |
#!/usr/bin/env python2
# Based on example.py from DIGITS
# https://github.com/NVIDIA/DIGITS
"""
Classify an image using individual model files imported from DIGITS
This tool is for testing your deployed model with images from the test folder.
All the configuration params are removed or commented out as compared to ... | gyurisc/DigitsRest | use_archive.py | Python | mit | 8,394 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from gaegraph.business_base import NodeSearch, DeleteNode
from emprestado_app.commands import ListEmprestadoCommand, SaveEmprestadoCommand, UpdateEmprestadoCommand, \
EmprestadoPublicForm, EmprestadoDetailForm, EmprestadoShortForm, Sal... | gutooliveira/progScript | tekton/backend/apps/emprestado_app/facade.py | Python | mit | 2,614 |
#! /usr/bin/env python
from distutils.core import setup, Extension
module1 = Extension('graph', sources = ['graph.cpp'])
setup (name = 'igem2013', version = '1.0', description = 'This is a demo package', ext_modules = [module1])
| igemsoftware/SYSU-Software2013 | project/Python27_32/web/setup.py | Python | mit | 232 |
# Copyright (c) 2015 Kurt Yoder
# See the file LICENSE for copying permission.
import pytest
import bassist.parser.log_file.processes_stdout
good_processes_text = ''' PID PPID UID GID CGROUP F NI PRI TT COMMAND
1 0 0 0 - 4 0 19 ? /s... | Doveps/bassist | tests/parser/test_processes_stdout.py | Python | mit | 5,195 |
# -*- coding:utf-8 -*-
# date:2018-03-14 16:27
# auther:yang
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
class SearchWithBaidu(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome()
def test_search_in_python_org... | tencrance/cool-config | test_tools/test_web.py | Python | mit | 766 |
# -*- coding: utf-8 -*-
"""
requests.utils
~~~~~~~~~~~~~~
This module provides utility functions that are used within Requests
that are also useful for external consumption.
"""
import cgi
import codecs
import collections
import contextlib
import io
import os
import platform
import re
import socket
import struct
imp... | libscie/liberator | liberator/lib/python3.6/site-packages/requests/utils.py | Python | cc0-1.0 | 27,607 |
#!/usr/bin/env python
# Update current cspan IDs using NYT Congress API.
import json, urllib.request, urllib.parse, urllib.error
from utils import load_data, save_data
def run():
# load in current members
y = load_data("legislators-current.yaml")
for m in y:
# retrieve C-SPAN id, if available, fr... | unitedstates/congress-legislators | scripts/cspan.py | Python | cc0-1.0 | 760 |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | Southpaw-TACTIC/TACTIC | src/pyasm/prod/checkin/maya_checkin_test.py | Python | epl-1.0 | 1,267 |
import os
import os.path
import tornado.web
import tornado.ioloop
import tornado.httpserver
import tornado.options
import const
import importlib
from config import ConfigReader
def convert_arr(handlers):
last_arr = []
for handler in handlers:
hans = handler[1].split(":")
last_arr.append((handl... | decemcat/gpyblog | app.py | Python | gpl-2.0 | 1,295 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
try:
import matplotlib.pyplot as pl
except(ImportError):
pass
__all__ = ["get_best", "get_truths", "get_percentiles", "get_stats",
"posterior_samples", "hist_samples", "joint_pdf", "compute_sigma_level",
"trim_walkers", "fi... | bd-j/bsfh | prospect/utils/plotting.py | Python | gpl-2.0 | 9,476 |
import os
import re
import hashlib
import datetime
from django.conf import settings
from django.core.management.base import BaseCommand
from webgis.mapcache import Disk
from webgis.app.models import Project_registry
from webgis.map.metadata_parser import MetadataParser
from webgis.map.project import get_last_project_... | gislab-npo/gislab-web | server/webgis/mapcache/management/commands/mapcache_clean.py | Python | gpl-2.0 | 3,659 |
# -*- Mode: Python; test-case-name: flumotion.test.test_admin_multi -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Pub... | flyapen/UgFlu | flumotion/test/test_admin_multi.py | Python | gpl-2.0 | 3,725 |
from __future__ import print_function
from numpy import pi, arange, sin
import numpy as np
import time
from bokeh.browserlib import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models.glyphs import Circle
from bokeh.models import (
Plot, DataRange1d, DatetimeAxis,
Colu... | zrhans/python | exemplos/Examples.lnk/bokeh/glyphs/dateaxis.py | Python | gpl-2.0 | 1,293 |
class Base(object):
def test(self):
print("----Base")
class A(Base):
def test1(self):
print("-----test1")
class B(Base):
def test2(self):
print("-----test2")
class C(A,B):
pass
c = C()
c.test1()
c.test2()
c.test()
| jameswatt2008/jameswatt2008.github.io | python/Python基础/截图和代码/面对对象-2/10-多继承.py | Python | gpl-2.0 | 259 |
import logging
from pymongo import MongoClient
import json
from bson import json_util
import time
import datetime
logger = logging.getLogger(__name__)
class UIPusher:
def __init__(self,core,parm):
# register event handler
core.registerEventHandler("controlleradapter", self.controllerHandler)
# register webso... | starbops/OpenADM | core/src/floodlight_modules/uipusher.py | Python | gpl-2.0 | 6,838 |
###########################################################################
#
# This program is part of Zenoss Core, an open source monitoring platform.
# Copyright (C) 2008, Zenoss Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License versi... | anksp21/Community-Zenpacks | ZenPacks.community.powerware/setup.py | Python | gpl-2.0 | 3,281 |
# -*- coding: utf-8 -*-
#
# AWL simulator - GUI hardware module configuration widget
#
# Copyright 2015 Michael Buesch <m@bues.ch>
#
# 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 versio... | gion86/awlsim | awlsim/gui/hwmodconfig.py | Python | gpl-2.0 | 12,877 |