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 -*-
from unittest import TestCase
from voluptuous import MultipleInvalid
from correios_lib.entities import Destinatario
class TestDestinatario(TestCase):
def test_invalid_destinatario(self):
self.assertRaises(MultipleInvalid, Destinatario)
def test_valid_destinatario(self):
... | trocafone/correios-lib | tests/unit/entities/destinatario_test.py | Python | mit | 606 |
import os
import re
import glob
import commands
import nose.tools
here = os.path.dirname( os.path.realpath( __file__ ) )
home = os.path.join( here, ".." )
executable = os.path.join( home, "apps/appginger/cpp/ginger-script")
def runtest( in_file_name ):
out_file_name = re.sub( r'\.in.gnx$', '.out.txt', in_file_nam... | Spicery/ginger | functests/test_appginger.py | Python | gpl-3.0 | 957 |
#!/usr/bin/env python
import sys
import os
from string import Template
import templates
medRoot = sys.argv[1]
rt = 180
ns = 1000
nf = 10
nOrders = 2
nt = 9
t = []
for i in range(nt):
t.append(float(i)*10.0)
nThreads = 1
parTemplate = Template(templates.t_scatter)
parTemplate = Template(templates.t_submit)
... | dronir/EM | python/genInput.py | Python | gpl-3.0 | 3,797 |
from .modulation import ModulationTypes
class TuningParameterCollection(object):
"""
Holds multiple tuning parameters at various heights. Each acts as a calibration point.
"""
tuning_parameters = []
build_x_min = -50.0
build_y_min = -50.0
build_x_max = 50.0
build_y_max = 50.0
dwell_... | PeachyPrinter/peachytoolchain | src/audio/tuning_parameters.py | Python | gpl-3.0 | 4,182 |
# -*- coding: utf-8 -*-
# Copyright (c) Pilot Systems and Libération, 2010
# This file is part of SeSQL.
# SeSQL 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 2 of the License, or
# (at you... | liberation/sesql | sesql/results.py | Python | gpl-2.0 | 2,929 |
""" CMAC Corrected Precipitation Radar Moments in Antenna Coordinates
Using fuzzy logic, scipy, and more to identify gates as rain, melting,
snow, no clutter, and second trip. Many fields such as reflectivity and
coorelation coefficient are used, but also SNR and sounding data is used.
More information can be found at... | zssherman/cmac2.0 | setup.py | Python | bsd-3-clause | 3,745 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms_shiny', '0005_shinyapppluginmodel'),
]
operations = [
migrations.AlterField(
model_name='shinyapp',
... | mfcovington/djangocms-shiny-app | cms_shiny/migrations/0006_auto_20151207_0046.py | Python | bsd-3-clause | 835 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 clowwindy
#
# 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 r... | ultimate010/shadowsocks | shadowsocks/local.py | Python | apache-2.0 | 3,096 |
from subprocess import Popen, PIPE
from .record import Record
from .visitor import Visitor
BLUE = '#aec7e8'
ORANGE = '#ffbb78'
GREEN = '#dbdb8d'
RED = '#ff9896'
PURPLE = '#f7b6d2'
SILVER = '#eeeeee'
GRAY = 'gray'
DARKGRAY = '#888888'
def dot2svg(source):
process = Popen(
['dot', '-T', 'svg'],
... | bureaucratic-labs/yargy | yargy/dot.py | Python | mit | 4,132 |
# Generated by Django 2.0.9 on 2018-12-04 11:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0013_feature_slug_unique'),
]
operations = [
migrations.AddField(
model_name='featureoption',
name='slug',
... | cmu-db/dbdb.io | dbdb/core/migrations/0014_featureoption_slug.py | Python | apache-2.0 | 384 |
from ..idasix import QtWidgets, QtCore
import ida_funcs
import ida_kernwin
import idc
from ..network import QueryWorker
class QItem(object):
def __init__(self, item, name_field, id_field, description_field,
exclude=None, columns=3, selected=None, empty_disabled=True,
**kwargs):
s... | nirizr/rematch | idaplugin/rematch/dialogs/widgets.py | Python | gpl-3.0 | 10,008 |
# 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, software
# d... | stevei101/oslo.messaging | tools/simulator.py | Python | apache-2.0 | 9,935 |
from django.db import models
class TaskStoreStatistic(models.Model):
MEASURE_SIZE = "size"
MEASURE_CHOICES = (
(
MEASURE_SIZE,
"Repository Size",
),
)
store = models.ForeignKey(
"TaskStore",
related_name="statistics",
on_delete=models.C... | coddingtonbear/inthe.am | inthe_am/taskmanager/models/taskstorestatistic.py | Python | agpl-3.0 | 813 |
#/usr/bin/env python
from ..ast_object import ASTObject
class SpecFrame(ASTObject):
'''
self.astObject is of type starlink.Ast.SpecFrame.
'''
def __init__(self):
pass | demitri/cornish | source/cornish/mapping/frame/spec_frame.py | Python | mit | 176 |
import msgpack
import requests
def authenticate(username, password):
pass
def create_public_key():
pass
def get_public_key():
pass
def is_internet_alive():
pass
def is_port_alive(port):
pass
def forward_port(auth_uid, public_key, port):
pass
| Cetsoft/macun | macun/client/client.py | Python | apache-2.0 | 278 |
#!/usr/bin/python
# This script is used to generate luabinding glue codes.
# Android ndk version must be ndk-r9b.
import sys
import os, os.path
import shutil
import ConfigParser
import subprocess
import re
from contextlib import contextmanager
def _check_ndk_root_env():
''' Checking the environment NDK_ROOT, w... | cedricporter/everlost | frameworks/cocos2d-x/tools/tolua/genbindings.py | Python | apache-2.0 | 5,614 |
# -*- coding: utf-8 -*-
#
# 2015-02-25 Cornelius Kölbel <cornelius@privacyidea.org>
# Initial writeup
#
#
# License: AGPLv3
# contact: http://www.privacyidea.org
#
# This code is free software; you can redistribute it and/or
# modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
# License... | wheldom01/privacyidea | privacyidea/lib/machines/__init__.py | Python | agpl-3.0 | 1,086 |
#SQL Server details
SQL_HOST = 'localhost'
SQL_USERNAME = 'root'
SQL_PASSWORD = ''
SQL_PORT = '3306'
#Youtube details
YOUTUBE_CLIENT_ID = ''
YOUTUBE_CLIENT_SECRET = ''
#Fab - configuration for deploying to a remote server
FAB_HOSTS = []
FAB_GITHUB_URL = 'https://github.com/UQ-UQx/uqx_api.git'
FAB_REMOTE_PATH = '/file/t... | UQ-UQx/uqx_api | config.example.py | Python | mit | 557 |
## This Python file uses the following encoding: utf-8
import codecs
import tamil
import sys
from pprint import pprint
def safe_splitMeiUyir(arg):
try:
# when uyir letters are passed to splitMeiUyir function it will throw an IndexError
rval = tamil.utf8.splitMeiUyir(arg)
if len(rval) == 1:
... | arcturusannamalai/open-tamil | examples/classifier/typewords.py | Python | mit | 3,106 |
# Copyright 2016-2021 IBM Corp. 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... | zhmcclient/python-zhmcclient | tests/unit/zhmcclient/test_activation_profile.py | Python | apache-2.0 | 11,882 |
from datetime import date
from django.forms import DateInput
from django.test import override_settings
from django.utils import translation
from .base import WidgetTest
class DateInputTest(WidgetTest):
widget = DateInput()
def test_render_none(self):
self.check_html(self.widget, 'date', None, html=... | Beauhurst/django | tests/forms_tests/widget_tests/test_dateinput.py | Python | bsd-3-clause | 1,557 |
# Copyright (c) 2010-2013 OpenStack Foundation
#
# 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... | Akanoa/swift | swift/obj/diskfile.py | Python | apache-2.0 | 98,599 |
"""
Sandbox tests for the projection operator
"""
import numpy as np
import theano
from pylearn2.sandbox.nlp.linear.matrixmul import MatrixMul
from pylearn2.utils import sharedX
from theano import tensor
def test_matrixmul():
"""
Tests for projection
"""
rng = np.random.RandomState(222)
dtypes = ... | fyffyt/pylearn2 | pylearn2/sandbox/nlp/linear/tests/test_matrixmul.py | Python | bsd-3-clause | 1,494 |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import os
import sys
import time
child_pid = os.fork()
if child_pid > 0:
time.sleep(60)
else:
sys.exit()
| sivel/ansible | test/integration/targets/wait_for/files/zombie.py | Python | gpl-3.0 | 202 |
# coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.gi... | docusign/docusign-python-client | docusign_esign/models/pay_pal_legacy_settings.py | Python | mit | 6,167 |
from setuptools import setup, find_packages
setup(
name = "django-test-utils",
version = "0.3",
packages = find_packages(),
author = "Eric Holscher",
author_email = "eric@ericholscher.com",
description = "A package to help testing in Django",
url = "http://github.com/ericholscher/django-tes... | ericholscher/django-test-utils | setup.py | Python | mit | 592 |
#!/usr/bin/env python
#coding: utf-8
#### FUNCTIONS ####
def header(string):
"""
Display header
"""
timeInfo = time.strftime("%Y-%m-%d %H:%M")
print '\n', timeInfo, "****", string, "****"
def subHeader(string):
"""
Display subheader
"""
timeInfo = time.strftime("%Y-%m-%... | brguez/TEIBA | src/python/germlineMEI_frequency_adjustedCounts.py | Python | gpl-3.0 | 13,609 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('iom', '0019_auto_20151023_1141'),
]
operations = [
migrations.CreateModel(
name='Waarneming',
fields... | acaciawater/iom | iom/migrations/0020_auto_20151023_1445.py | Python | apache-2.0 | 1,528 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('common', '0003_auto_20150717_2226'),
]
operations = [
migrations.AlterField(
model_name='news',
name... | Turupawn/website | common/migrations/0004_auto_20150717_2348.py | Python | agpl-3.0 | 567 |
import math
import time
import numpy as np
class Timer:
def __init__(self, text=None):
self.text = text
def __enter__(self):
self.cpu = time.clock()
self.time = time.time()
if self.text:
print("{}...".format(self.text))
return self
def __exit__(self, *... | yaxinus/santander-product-recommendation-8th-place | utils.py | Python | mit | 2,269 |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Xiangxiang Telecom Corporation.
# @author: Liusha
"""This is the lte module.
"""
from flask import Blueprint
lte = Blueprint('lte', __name__, static_folder='static', template_folder='templates')
from app.lte.views import *
| flowsha/zhwh | web_root/app/lte/__init__.py | Python | apache-2.0 | 270 |
# Copyright (c) 2013 OpenStack Foundation
#
# 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 ... | lmaycotte/quark | quark/api/extensions/floatingip.py | Python | apache-2.0 | 1,435 |
from __future__ import unicode_literals
from django.core import mail
from django.utils import six
from reviewboard.reviews.models import Review
from reviewboard.webapi.resources import resources
from reviewboard.webapi.tests.base import BaseWebAPITestCase
from reviewboard.webapi.tests.mimetypes import (review_reply_i... | 1tush/reviewboard | reviewboard/webapi/tests/test_review_reply.py | Python | mit | 10,358 |
from seeds.nodes import NodeSeeder
from app import flapp
import requests
from satoyama.tests.dbtestbase import DBTestBase
from app.apihelpers import UrlHelper, ApiResponseHelper
from satoyama.models import SensorType
# class SensorResourceTests(DBTestBase):
# def test_GET_existing_sensor_by_id(self):
# """
# Cr... | DgFutureLab/satoyama-api | app/tests/test_sensor_resource.py | Python | mit | 2,146 |
from cert_wizard import cert_utils
import sys
def validation_error(message, abort=True):
print('[CW] Error: {}'.format(message))
if abort:
print('[CW] Aborting.')
sys.exit(1)
def combined_ca_and_server_separate_key(server_cert_path, private_key_path):
# server cert should ... | s0lst1c3/eaphammer | cert_wizard/importer/validators.py | Python | gpl-3.0 | 4,975 |
import socket, console, time, sys
console.set_color(1,0,0)
print """ _____ _____ _____ _____
| _ | _ |___| __ | |
| | __|___| -| | |
|__|__|__|SavSec|__|__|_____|
UPnP Exploitation"""
console.set_color()
time.sleep(1)
ssdpsrc = { "ip_address" : "239.255.255.250",
"port" :... | RussianOtter/networking | ap-ro.py | Python | gpl-3.0 | 4,174 |
from __future__ import print_function, division
from warnings import warn
from ..node import Node
from ..utils import index_of_column_name
class Clip(Node):
"""Ensures that no value is below a lower limit or above an upper limit.
If self.lower and self.upper are None then will use clip settings from
'devi... | diegocavalca/Studies | phd-thesis/nilmtk/nilmtk/preprocessing/clip.py | Python | cc0-1.0 | 1,947 |
import jwt
from aiohttp.web import json_response
from closure_table.auth.db.queries import user_get
from closure_table.settings import JWT_ALGORITHM, JWT_SECRET
def setup_middlewares(app):
app.middlewares.append(auth_middleware)
async def auth_middleware(app, handler):
async def middleware(request):
... | vyacheslav-bezborodov/dvhb | src/closure_table/auth/middlewares.py | Python | mit | 1,093 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" MultiQC submodule to parse output from GATK varianteval """
import logging
from collections import OrderedDict
from multiqc import config
from multiqc.plots import bargraph, table
# Initialise the logger
log = logging.getLogger(__name__)
class VariantEvalMixin():
... | robinandeer/MultiQC | multiqc/modules/gatk/varianteval.py | Python | gpl-3.0 | 8,431 |
from __future__ import absolute_import
from cas.config import DEBUG
import logging
LOG = logging.getLogger()
logging.basicConfig()
LOG.setLevel(logging.CRITICAL)
def enable_debug():
LOG.setLevel(logging.DEBUG)
if DEBUG:
enable_debug()
| jcmcken/cas | cas/log.py | Python | bsd-3-clause | 247 |
from datetime import datetime
from django.utils import timezone
from django.utils import dateparse
from rest_framework import viewsets
from rest_framework.views import APIView
from rest_framework.response import Response
from ..models import Event, User, Tag
from ..serializers import EventSerializer
class EventView... | LorenzSelv/pinned | core/views/event_viewset.py | Python | mit | 1,723 |
# Copyright 2018 The TensorFlow 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 applica... | hfp/tensorflow-xsmm | tensorflow/python/ops/stateless_random_ops.py | Python | apache-2.0 | 11,692 |
"""
Plotting (requires matplotlib)
"""
from colorsys import hsv_to_rgb, hls_to_rgb
from libmp import NoConvergence
class VisualizationMethods(object):
plot_ignore = (ValueError, ArithmeticError, ZeroDivisionError, NoConvergence)
def plot(ctx, f, xlim=[-5,5], ylim=None, points=200, file=None, dpi=None,
singul... | mattpap/sympy-polys | sympy/mpmath/visualization.py | Python | bsd-3-clause | 9,017 |
# Define a custom User class to work with django-social-auth
from django.db import models
from django.contrib.auth.models import User
class Task(models.Model):
name = models.CharField(max_length=200)
owner = models.ForeignKey(User)
finished = models.BooleanField(default=False)
shared ... | kurdd/Oauth | app/models.py | Python | apache-2.0 | 1,109 |
#=========================================================================
# GcdUnit cycle-level model
#=========================================================================
from pymtl import *
from pclib.ifcs import InValRdyBundle, OutValRdyBundle
from pclib.fl import Queue
from pclib.cl import InV... | Abhinav117/pymtl | examples/gcd_cp2/GcdProcCL.py | Python | bsd-3-clause | 2,395 |
from ScriptingLanguage.Interpreter import Interpreter
__author__ = 'chronium'
def visit_func_call(function_call):
try:
return Interpreter().get_function(function_call.value)()
except KeyError:
print('Function [{}] undefined'.format(function_call.value))
| chronium/ChronoScript | ScriptingLanguage/Visitors/FunctionVisitor.py | Python | gpl-2.0 | 280 |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN)
##
## Indico 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... | Ictp/indico | setup.py | Python | gpl-3.0 | 21,182 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
'''Pychemqt, Chemical Engineering Process simulator
Copyright (C) 2009-2017, Juan José Gómez Romera <jjgomera@gmail.com>
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 Softwar... | jjgomera/pychemqt | lib/mEoS/NF3.py | Python | gpl-3.0 | 14,872 |
"""Generate the test, save it, and then call all relevant checkers."""
# NOTE: Currenlty works only with S3DataStore
import os
from util.data_store.s3_data_store import S3DataStore
from util.analytics_platform_util import get_path_names
from evaluation_platform.uranus.src.generate_test_data import TestData
from eval... | sara-02/fabric8-analytics-stack-analysis | evaluation_platform/uranus/src/evaluate_data.py | Python | gpl-3.0 | 3,062 |
from django.conf.urls import url
from .views import MainView
urlpatterns = [
url(r'^$', MainView.as_view(), name="main"),
] | rudikovrf/django_blog | main/urls.py | Python | mit | 129 |
from datetime import datetime
from settings import STORAGE
from settings import DATE_FORMAT
class Item(object):
def __init__(self, oid, **kwargs):
self.id = oid
self.content = kwargs.get("content", "")
self.title = kwargs.get("title", "")
self.created = kwargs... | broganross/kivy_tests | todo/models/item.py | Python | mit | 1,964 |
# -*- coding: utf-8 -*-
###########################################################################
## Python code generated with wxFormBuilder (version Jun 6 2014)
## http://www.wxformbuilder.org/
##
## PLEASE DO "NOT" EDIT THIS FILE!
###########################################################################
#####... | chungchris/cloud-system-reconfiguration-tool | gui_reconfigsingle.py | Python | mit | 12,850 |
from keras.models import Sequential
from keras.layers import GRU
import numpy as np
model = Sequential()
ly = GRU(2, activation='tanh', recurrent_activation='relu',implementation = 1, stateful=False, batch_input_shape=(5, 3, 3))
model.add(ly)
model.compile(optimizer='sgd', loss='mse')
kernel = np.ones((3, 6))
rec_ker... | adamtiger/NNSharp | PythonUtils/GRU.py | Python | mit | 985 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('restaurant', '0030_kitchen_usertable'),
]
operations = [
migrations.AlterField(
model_name='kitchen',
... | gauravbose/digital-menu | digimenu2/restaurant/migrations/0031_auto_20150708_0754.py | Python | bsd-3-clause | 409 |
import gc
import sys
import unittest
import collections
import weakref
import operator
from test import support
# Used in ReferencesTestCase.test_ref_created_during_del() .
ref_from_del = None
class C:
def method(self):
pass
class Callable:
bar = None
def __call__(self, x):
self.bar = ... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.0/Lib/test/test_weakref.py | Python | mit | 40,936 |
from django.http import HttpResponse
from django.shortcuts import render_to_response
from models import Delivery
from django.core import serializers
import json
def helloworld(request):
return HttpResponse('Hello world', content_type='text/plain')
def list_all(request):
out = ''
for delivery in Delivery.o... | espenak/inf3331-djevelskap | djevelskap/base/views.py | Python | bsd-3-clause | 1,764 |
#problem 51
| jhuang314/euler | p51.py | Python | mit | 14 |
# -*- coding: utf-8 -*-
{
'name': 'test-field-converter',
'version': '0.1',
'category': 'Tests',
'description': """Tests of field conversions""",
'author': 'OpenERP SA',
'maintainer': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['base'],
'data': ['ir.model.access.cs... | vileopratama/vitech | src/openerp/addons/test_converter/__openerp__.py | Python | mit | 379 |
from distutils.core import setup
from distutils.extension import Extension
import os,os.path
import sys
import numpy as np
if sys.platform == 'win32' or sys.platform == 'win64':
print 'Windows is not a supported platform.'
quit()
else:
COOLCVMFSROOT="/cvmfs/icecube.opensciencegrid.org/py2-v3_early_access... | arguelles/Sterilizer | python/setup.py | Python | lgpl-3.0 | 1,757 |
from django.contrib import admin
from openedx.features.data_extract.models import CourseDataExtraction
#admin.site.register(CourseDataExtraction)
| philanthropy-u/edx-platform | openedx/features/data_extract/admin.py | Python | agpl-3.0 | 147 |
#!/usr/bin/env python
import sys
import os
import re
try:
path = sys.argv[1]
length = int(sys.argv[2])
except:
print >>sys.stderr, "Usage: $0 <path> <length>"
sys.exit(1)
path = re.sub(os.getenv('HOME'), '~', path)
while len(path) > length:
dirs = path.split("/");
# Find the longest directo... | werebus/dotfiles | bin/shorten_path.py | Python | mit | 772 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from Peach.analyzer import *
from Peach.Engine.dom import *
from Peach.Engine.common import *
from Peach.Engine.parser im... | sigma-random/peach | Peach/Analyzers/xml.py | Python | mpl-2.0 | 7,147 |
import os
import uuid
import yaml
import json
import shutil
import typing
import itertools
from copy import deepcopy
from datetime import datetime
from collections import defaultdict, namedtuple
from flask import current_app
from flask_security import current_user
from sqlalchemy.orm import aliased
from sqlalchemy.sql... | cloudify-cosmo/cloudify-manager | rest-service/manager_rest/resource_manager.py | Python | apache-2.0 | 122,592 |
__author__ = 'nekmo'
def append_or_update(original_list, new_list, override=True):
for i, arg in enumerate(new_list):
if i < len(original_list) and override:
original_list[i] = arg
elif i >= len(original_list):
original_list.append(arg)
return original_list
| Nekmo/nekutils | iter.py | Python | mit | 308 |
#!/usr/bin/env python
import os
from distutils.core import setup
from tvrage import __version__, __author__, __license__
setup(name='python-tvrage',
description='python client for the tvrage.com XML API',
long_description = file(
os.path.join(os.path.dirname(__file__),'README.rst')).read(),
... | GetSomeBlocks/Score_Soccer | resources/lib/tvrage/setup.py | Python | mit | 872 |
import unittest
import six
from pyrad import tools
try:
import ipaddress
except ImportError:
ipaddress = None
class EncodingTests(unittest.TestCase):
def testStringEncoding(self):
self.assertRaises(ValueError, tools.EncodeString, 'x' * 254)
self.assertEqual(
tools.EncodeSt... | tom-mi/pyrad | pyrad/tests/testTools.py | Python | bsd-3-clause | 7,407 |
from builtins import range
import numpy as np
def affine_forward(x, w, b):
"""
Computes the forward pass for an affine (fully-connected) layer.
The input x has shape (N, d_1, ..., d_k) and contains a minibatch of N
examples, where each example x[i] has shape (d_1, ..., d_k). We will
reshape each ... | halimacc/CS231n-assignments | assignment2/cs231n/layers.py | Python | unlicense | 25,347 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
"scandir==1.10.0",
]
test_requirements = [
"mock==3.0.5",
"pyte... | SpamExperts/se-mailbox | setup.py | Python | gpl-2.0 | 1,161 |
# Copyright 2017 The TensorFlow 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 applica... | e-bug/distributed-tensorflow-benchmarks | google-benchmarks/tf_cnn_benchmarks/benchmark_storage.py | Python | gpl-3.0 | 1,679 |
import numpy as np
from tools.walk_trees import walk_trees
from tools.game_tree.builder import GameTreeBuilder
from tools.game_tree.nodes import ActionNode
from tools.game_tree.node_provider import NodeProvider
class StrategiesWeightedMixtureActionNode(ActionNode):
def __init__(self, parent, player):
sup... | JakubPetriska/poker-cfr | implicit_modelling/strategies_weighted_mixeture.py | Python | mit | 1,484 |
from SpecImports import *
from toontown.toonbase import ToontownGlobals
CogParent = 10000
BattleCellId = 0
BattleCells = {BattleCellId: {'parentEntId': CogParent,
'pos': Point3(0, 0, 0)}}
CogData = [{'parentEntId': CogParent,
'boss': 1,
'level': 16,
'battleCell': BattleCellId,
'pos': Point3(-6, ... | silly-wacky-3-town-toon/SOURCE-COD | toontown/coghq/LawbotOfficeOilRoom_Battle01_Cogs.py | Python | apache-2.0 | 960 |
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import matplotlib.pyplot as plt
from torchvision import transforms
from PIL import Image
# torch config
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
# Configurations
CHANNELS = 16
WIDTH = HEIGHT = ... | samuxiii/prototypes | cellauto/CellAutomata.py | Python | mit | 5,230 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-07-19 07:52
from __future__ import absolute_import, unicode_literals
from django.db import migrations, models
import django.utils.timezone
import model_utils.fields
import opaque_keys.edx.django.models
class Migration(migrations.Migration):
dependenc... | ESOedX/edx-platform | openedx/core/djangoapps/video_config/migrations/0005_auto_20180719_0752.py | Python | agpl-3.0 | 1,315 |
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------
# drawElements Quality Program utilities
# --------------------------------------
#
# Copyright 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use t... | chadversary/deqp | modules/gles2/scripts/genutil.py | Python | apache-2.0 | 20,521 |
""" The Watchdog Factory instantiates a given Watchdog based on a quick
determination of the local operating system.
"""
__RCSID__ = "$Id$"
import re
import platform
from DIRAC import S_OK, S_ERROR, gLogger
class WatchdogFactory( object ):
##################################################################... | Andrew-McNab-UK/DIRAC | WorkloadManagementSystem/JobWrapper/WatchdogFactory.py | Python | gpl-3.0 | 2,076 |
"""
Read data from Mi Flora plant sensor.
Reading from the sensor is handled by the command line tool "gatttool" that
is part of bluez on Linux.
No other operating systems are supported at the moment
inspired by # https://github.com/open-homeautomation/miflora
usage:
cd [path plugin ou copy de ce script]/jeedom_MiFl... | rjullien/jeedom_MiFlora | resources/GetMiFloraDataPy3.py | Python | gpl-2.0 | 5,040 |
# encoding: utf8
from sympy import Add
from uncertainties import __version_info__ as uncert_version
from uncertainties import ufloat, ufloat_fromstr
from uncertainties.core import Variable, AffineScalarFunc
if uncert_version < (3, 0):
raise Warning("Your version of uncertanties is not supported. Try\n"
... | kirienko/unseries | unseries.py | Python | gpl-3.0 | 9,529 |
#!/usr/bin/python
#
# Given a game lib, generate HTML map for all components
#
import olypy.oio as oio
from olypy.oid import to_oid
import olypy.dbck as dbck
import pathlib
from jinja2 import Environment, PackageLoader, select_autoescape
from olymap.loc import build_complete_loc_dict
from olymap.ship import build_com... | olympiag3/olypy | olymap/__init__.py | Python | apache-2.0 | 9,708 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for large portions of L{twisted.mail}.
"""
import os
import errno
import shutil
import pickle
import StringIO
import rfc822
import tempfile
import signal
import time
from hashlib import md5
from zope.interface.verify import verifyClass... | Architektor/PySnip | venv/lib/python2.7/site-packages/twisted/mail/test/test_mail.py | Python | gpl-3.0 | 83,905 |
# This file is part of ZS
# Copyright (C) 2013-2014 Nathaniel Smith <njs@pobox.com>
# See file LICENSE.txt for license information.
import sys
from zs import ZS
def open_zs(opts, **kwargs):
zs_path_or_url = opts["<zs_file>"]
if zs_path_or_url.startswith("http"):
kwargs["url"] = zs_path_or_url
els... | njsmith/zs | zs/cmdline/util.py | Python | bsd-2-clause | 545 |
#-------Main Package Settings-----------#
name = "Cheetah"
from src.Version import Version as version
maintainer = "Tavis Rudd"
author = "Tavis Rudd"
author_email = "cheetahtemplate-discuss@lists.sf.net"
url = "http://www.CheetahTemplate.org/"
packages = ['Cheetah',
'Cheetah.Macros',
... | carvalhomb/tsmells | lib/Cheetah/SetupConfig.py | Python | gpl-2.0 | 4,534 |
# Library for full image cnn operations
import numpy as np
import scipy.ndimage
from scipy.signal import convolve2d
from scipy.signal import fftconvolve
from numpy.fft import rfftn
from numpy.fft import irfftn
import mahotas
import time
import h5py
import pycuda.autoinit
import pycuda.driver as cu
import pycuda.compi... | Rhoana/membrane_cnn | maxout/custom_classify/lib_maxout_gpu.py | Python | bsd-3-clause | 15,712 |
#!/usr/bin/env python3
"""Prepares a simple TVM library for testing."""
from os import path as osp
import sys
import tvm
def main():
n = tvm.var('n')
A = tvm.placeholder((n,), name='A')
B = tvm.placeholder((n,), name='B')
C = tvm.compute(A.shape, lambda *i: A(*i) + B(*i), name='C')
s = tvm.creat... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/rust/tests/test_tvm_basic/src/build_test_lib.py | Python | apache-2.0 | 551 |
from openzwave.network import ZWaveNode
from openzwave.value import ZWaveValue
from Firefly import logging
from Firefly.components.zwave.device_types.contact_sensor import ZwaveContactSensor
TITLE = 'Ecolink Contact Sensor'
def Setup(firefly, package, **kwargs):
logging.message('Entering %s setup' % TITLE)
sens... | Firefly-Automation/Firefly | Firefly/components/zwave/ecolink/contact_sensor.py | Python | apache-2.0 | 940 |
from test_health_ntd_dengue import suite
| kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/modules/health_ntd_dengue/tests/__init__.py | Python | gpl-3.0 | 41 |
"""Convenience methods for extracting metadata from an audio file."""
import asyncio
import io
from typing import NamedTuple, Optional, Union
from mediafile import MediaFile
class AudioMetadata(NamedTuple):
"""Audio metadata."""
title: Optional[str]
artist: Optional[str]
album: Optional[str]
dur... | postlund/pyatv | pyatv/support/metadata.py | Python | mit | 1,057 |
from ._abstract import AbstractScraper
from ._utils import get_minutes
class MarthaStewart(AbstractScraper):
@classmethod
def host(cls):
return "marthastewart.com"
def title(self):
return self.schema.title()
def total_time(self):
s = (
self.soup.findAll("div", {"c... | hhursev/recipe-scraper | recipe_scrapers/marthastewart.py | Python | mit | 907 |
#!/usr/bin/env python2.7
# coding=utf-8
# Author: Dustyn Gibson <miigotu@gmail.com>
# URL: http://github.com/SickRage/SickRage
#
# This file is part of SickRage.
#
# SickRage 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 Softwar... | hernandito/SickRage | tests/helpers_tests.py | Python | gpl-3.0 | 16,369 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-03-05 16:33
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
def element_to_frozen_element(apps, schema_editor):
Answer = apps.get_model("review", "ReviewAssignmentAnswer")
Frozen = ... | BirkbeckCTP/janeway | src/review/migrations/0011_keep_answers_on_form_delete.py | Python | agpl-3.0 | 4,224 |
import setuptools
if __name__ == "__main__":
setuptools.setup(
name='friendly_computing_machine',
version="0.1.1",
description='A starting template for Python programs',
author='Sangeeta Sur',
author_email='ssx9f@mst.edu',
url="https://github.com/ssx9f/friendly-com... | ssx9f/friendly-computing-machine | setup.py | Python | bsd-3-clause | 1,261 |
# encoding: utf-8
# Copyright 2013 maker
# License
#-*- coding: utf-8 -*-
import handlers
from django.conf.urls.defaults import *
from maker.core.api.auth import auth_engine
from maker.core.api.doc import documentation_view
from maker.core.api.resource import CsrfExemptResource
ad = { 'authentication': auth_engine }... | alejo8591/maker | sales/api/urls.py | Python | mit | 2,334 |
# Copyright 2018 Capital One Services, 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... | taohungyang/cloud-custodian | tests/test_batch.py | Python | apache-2.0 | 3,254 |
# -*- coding: utf-8 -*-
"""
werkzeug.testsuite
~~~~~~~~~~~~~~~~~~
Contains all test Werkzeug tests.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
import re
import sys
import unittest
import shutil
import tempfile
im... | skycucumber/Messaging-Gateway | webapp/venv/lib/python2.7/site-packages/werkzeug/testsuite/__init__.py | Python | gpl-2.0 | 7,756 |
from main import app
app.run(host='127.0.0.1', port=8090, debug=True)
| andimiller/pizza-auth | pizza_auth/run.py | Python | mit | 70 |
#!/usr/bin/env python
# Copyright 2021 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 generated, do not edit. Update BuildConfigGenerator.groovy and
# 3ppFetch.template instead.
from __future__ import print_fun... | nwjs/chromium.src | third_party/android_deps/libs/javax_annotation_javax_annotation_api/3pp/fetch.py | Python | bsd-3-clause | 1,385 |
"""django_test URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | oliverroick/django-tests | django_test/urls.py | Python | mit | 914 |
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 5 11:47:27 2015
"""
#####################################################################################################
# Groupe d'Étude pour la Traduction/le Traitement Automatique des Langues et de la Parole (GETALP)
# Homepage: http://getalp.imag.fr
#
# Author: Tien... | besacier/WCE-LIG | wce_system/common_module/cm_config.py | Python | gpl-3.0 | 3,815 |
#local urls.py file
from django.conf.urls import url, include
from . import views
urlpatterns = [
#url(r'^', views.appView.postLocation, name = 'postLocation'),
url(r'^volunteer/', views.appView.member, name = 'member'),
#url(r'^(?P<member_id>[0-9]+)/$', views.appView.detail, name = 'd... | Fazer56/Assignment3 | charitysite/volunteer/urls.py | Python | mit | 352 |
# -*- encoding: utf-8 -*-
import traceback
import pprint
import uuid
import time
import sys
from django.db.models.fields.related import ManyToManyField, ForeignKey
from django.core.mail import EmailMessage, EmailMultiAlternatives
try:
from django.core.urlresolvers import reverse, NoReverseMatch
except ImportErro... | LPgenerator/django-db-mailer | dbmail/backends/mail.py | Python | gpl-2.0 | 11,834 |
#!/usr/bin/python
#The MIT License (MIT)
#
#Copyright (c) 2015 Stephen P. Smith
#
#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 restriction, including without limitation the rights
#to... | steve71/MAX31856 | max31856.py | Python | mit | 6,588 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.