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
#!/usr/bin/env python import time import RPi.GPIO as GPIO # NOTE(nox): This only works when disable_camera_led=1 is set in /boot/config.txt GPIO.setmode(GPIO.BCM) CAMLED = 32 GPIO.setup(CAMLED, GPIO.OUT, initial=False) for _ in range(5): GPIO.output(CAMLED,True) time.sleep(0.5) GPIO.output(CAMLED,False) ...
weirdNox/BEESIC
sky/scripts/testCameraLed.py
Python
mit
338
''' Created on 1.12.2016 @author: Darren '''''' Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each element in the result should appear as many times as it shows in both arrays. The result can be in any order....
darrencheng0817/AlgorithmLearning
Python/leetcode/IntersectionOfTwoArraysIi.py
Python
mit
655
""" byceps.blueprints.admin.shop.shipping.views ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2020 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from flask import abort from .....services.shop.shipping import service as shipping_service from .....services.shop.shop import s...
m-ober/byceps
byceps/blueprints/admin/shop/shipping/views.py
Python
bsd-3-clause
1,165
from online_monitor.converter.transceiver import Transceiver from zmq.utils import jsonapi import numpy as np # pyBAR related imports from pybar_fei4_interpreter.data_interpreter import PyDataInterpreter from online_monitor.utils import utils class PybarFEI4(Transceiver): def setup_interpretation(self): ...
SiLab-Bonn/silab_online_monitor
silab_online_monitor/converter/pybar_fei4.py
Python
mit
2,267
"""Stand density factor estimators""" import logging from pygypsy.density import ( estimate_density_aw, estimate_density_sw, estimate_density_sb, estimate_density_pl, ) LOGGER = logging.getLogger(__name__) def estimate_sdf_aw(spc, site_index, bhage, density): '''Main purpose of this function is ...
tesera/pygypsy
pygypsy/stand_density_factor.py
Python
mit
5,831
from twisted.trial import unittest from twisted.python.failure import Failure from foolscap.promise import makePromise, send, sendOnly, when, UsageError from foolscap.eventual import flushEventualQueue, fireEventually class KaboomError(Exception): pass class Target: def __init__(self): self.calls = ...
david415/foolscap
src/foolscap/test/test_promise.py
Python
mit
7,328
# goto_assignments command tests are different in syntax definition = 3 #! 0 ['a = definition'] a = definition #! [] b #! ['a = definition'] a b = a c = b #! ['c = b'] c cd = 1 #! 1 ['cd = c'] cd = c #! 0 ['cd = e'] cd = e #! ['module math'] import math #! ['import math'] math #! ['import math'] b = math #! ['b =...
Eddy0402/Environment
vim/ycmd/third_party/jedi/test/completion/goto.py
Python
gpl-3.0
2,526
# !/usr/bin/env python # Copyright 2014 Vodkasoft # # 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 agre...
vodkasoft/CanYouSinkMe
backend/controller/user.py
Python
apache-2.0
4,205
import random import re import pathlib from datetime import datetime from bson.objectid import ObjectId from pymongo import MongoClient from flask_restful import ( Resource, Api, request, abort, ) from .app import app from .exif import ExifTags from .paginator import Paginator from .parsers import (...
cryporchild/rusty-neutron
rusty_neutron/rusty_webapp/api.py
Python
gpl-3.0
7,233
# -*- coding: utf-8 -*- """Enumerators for currency types""" from dlkit.abstract_osid.osid.errors import NotFound ISO_CURRENCY_TYPES = { # UAE Dirham # 'AED': 'UAE Dirham', # Afghani # 'AFN': 'Afghani', # Lek # 'ALL': 'Lek', # Armenian Dram # 'AMD': 'Armenian Dram', # Netherlan...
mitsei/dlkit
dlkit/primordium/locale/types/currency.py
Python
mit
9,461
# Copyright (C) 2017 Dell Inc. or its subsidiaries. # 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 # # ...
mahak/cinder
cinder/tests/unit/volume/drivers/dell_emc/powerflex/test_versions.py
Python
apache-2.0
3,271
import urllib.request import urllib.error import sys from stockmarket import * if __name__ == '__main__': set_skip_symbol("") update_all_symbols(["dlprice", "dlrss", "price2json", "rss2json", "dlnews", "processnews", "today", "updateCSV"])
Matchoc/stockmarketpy
start.py
Python
apache-2.0
252
import datetime from django.contrib.gis.db import models from django.utils.translation import gettext_lazy as _ # # #class Question(models.Model): # question_text = models.CharField(max_length = 200) # pub_date = models.DateTimeField('Date published') # #class Choice(models.Model): # question = models.For...
freightliner/cargo
cargo/tms/models.py
Python
gpl-2.0
29,635
import os import numpy as np import matplotlib matplotlib.use('Qt4Agg', warn=True, force=True) import matplotlib.pyplot as plt from sklearn.decomposition import PCA from PIL import Image home = 'C:/Users/joncrall' os.chdir(home+'/Dropbox/Code') stride = 4 img = plt.imread('micro.jpg') imgGRAY = np.asarray(Image.open...
Erotemic/local
misc/code/microcolor_test.py
Python
gpl-3.0
1,569
""" Django settings for go_coup project. Generated by 'django-admin startproject' using Django 1.11.4. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os...
Go-In/go-coup
web/go_coup/settings.py
Python
mit
4,762
def _recur(graph, vertex, visited, stack): visited[vertex] = True for i in range(len(graph)): if not visited[i] and graph[vertex][i] > 0: _recur(graph, i, visited, stack) stack.append(vertex) def print_order(graph): visited = [ False ] * len(graph) stack = [] for i i...
sshh12/SchoolCode
Algorithms/Graphs/TopologicalSort.py
Python
mit
734
from os import system from gpiozero import LED, LightSensor from time import sleep import opto import sms ldr = LightSensor(4) led = LED(17) while True: if ldr.value < 0.2: print(ldr.value) led.on() sms.send_sms() opto.send_mail() ...
jayasuryajsk/Laser-Security-System-using-raspberrypi
led.py
Python
mit
396
# Copyright 2011 David Malcolm <dmalcolm@redhat.com> # Copyright 2011 Red Hat, Inc. # # This 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) a...
jasonxmueller/gcc-python-plugin
libcpychecker/diagnostics.py
Python
gpl-3.0
8,596
import psycopg2 as psy from functools import wraps def db_connection(db): def tag_dec(f): @wraps(f) def wrapper(*args, **kwargs): connection = psy.connect('dbname = %s host = localhost' % (db)) cursor = connection.cursor() result = f(cursor, *args, **kwargs) ...
Thru-Echoes/ewaim-webapp
static/py/db_util.py
Python
bsd-3-clause
1,044
# -*- coding: utf-8 -*- """ flask.testing ~~~~~~~~~~~~~ Implements test support helpers. This module is lazily imported and usually not used in production environments. :copyright: (c) 2014 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from contextlib import contextmana...
5y/flask
flask/testing.py
Python
bsd-3-clause
5,069
#!/usr/bin/env python # -*- coding: utf-8 -*- from urllib.parse import urlencode import urllib3 from common import LitPlugin, LitJob import logging import webbrowser BASE = 'http://www.iciba.com/index.php' def _uri(key): return '%s?%s' % (BASE, urlencode({'a': 'suggest', 's': key.replace(' ', '|1{')})) def ...
Answeror/lit
iciba.py
Python
mit
1,838
from django.core import serializers from django.test import TestCase from fields import Small from models import DataModel, MyModel, OtherModel class CustomField(TestCase): def test_defer(self): d = DataModel.objects.create(data=[1, 2, 3]) self.assertTrue(isinstance(d.data, list)) d = D...
mzdaniel/oh-mainline
vendor/packages/Django/tests/modeltests/field_subclassing/tests.py
Python
agpl-3.0
2,804
#!/usr/bin/env python from __future__ import print_function from logging import handlers from os.path import dirname import logging import os import select import signal import socket import subprocess import sys import traceback import time # Root path base_path = dirname(os.path.abspath(__file__)) # Insert local di...
entomb/CouchPotatoServer
CouchPotato.py
Python
gpl-3.0
4,539
# -*- coding: utf-8 -*- import itertools import json import os import tempfile import time from contextlib import nested from datetime import datetime, timedelta from urlparse import urlparse from django import forms from django.contrib.auth.models import AnonymousUser from django.conf import settings from django.core...
Joergen/zamboni
apps/addons/tests/test_models.py
Python
bsd-3-clause
89,563
from toolib.util.iterators import iterContinuousRanges class TAddRemoveRows(object): def OnRemoveRows(self, event): indices = filter(lambda x: x >= 0, self.GetSelectedRows()) if indices: indices.sort() self.ClearSelection() for index, size in iterContinuousRanges(indices): self.GetTable().DeleteRows...
onoga/toolib
toolib/wx/grid/TAddRemoveRows.py
Python
gpl-2.0
567
from common import common_global from sanic import Blueprint blueprint_user_media_3d = Blueprint('name_blueprint_user_media_3d', url_prefix='/user') @blueprint_user_media_3d.route('/user_media_3d', methods=['GET', 'POST']) @common_global.jinja_template.template('bss_user/media/bss_user_media_3d.html') @common_global...
MediaKraken/MediaKraken_Deployment
source/web_app_sanic/blueprint/user/bp_user_media_3d.py
Python
gpl-3.0
427
import sys import os import optparse import webbrowser from copy import copy import simplejson as json from cuddlefish import packaging from cuddlefish.bunch import Bunch from cuddlefish.version import get_version MOZRUNNER_BIN_NOT_FOUND = 'Mozrunner could not locate your binary' MOZRUNNER_BIN_NOT_FOUND_HELP = """ I ...
grammarly/browser-extensions
generate/lib/run-firefox/cuddlefish/__init__.py
Python
bsd-3-clause
31,578
#!/usr/bin/python # # -*- coding: utf-8 -*- import urllib2 import lxml.html from time import sleep title = [""] wait_time = 180 def classical(): global title global wait_time req = urllib2.Request('http://www.xfm.co.uk/js/NowPlayingDisplay.aspx?tzc=8&f=http%3A//rope.ixfm.fimc.net/Feeds/NowPlaying/GCap_Me...
romanetz/fmstick
parsers/xfm_parser.py
Python
gpl-2.0
1,987
# -*- coding: utf-8 -*- """ Created on Sun Apr 09 17:33:05 2017 @author: chenym """ from nipy import load_image import re import matplotlib.pyplot as plt vminval = -2000 vmaxval = 2000 class BrainImageComparator: @classmethod def create_from_file(cls, *args): images = {} for file_name in...
anjaligr05/epilepsy_preprocessing
compare_brain_image.py
Python
mit
3,558
# -*- encoding: utf-8; py-indent-offset: 4 -*- # +------------------------------------------------------------------+ # | ____ _ _ __ __ _ __ | # | / ___| |__ ___ ___| | __ | \/ | |/ / | # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / ...
naemon/naemon-livestatus
api/python/livestatus.py
Python
gpl-2.0
25,278
from __future__ import print_function import collections import re import sys import six from six import StringIO from six import string_types as basestring __author__ = "raphtee@google.com (Travis Miller)" class StubNotFoundError(Exception): 'Raised when god is asked to unstub an attribute that was not stubb...
avocado-framework/avocado-vt
virttest/unittest_utils/mock.py
Python
gpl-2.0
18,469
import numpy as np t, T1, T2, pa, pb, N = np.genfromtxt('tabelle.txt', skip_header=2, unpack=True) print('Mittelwert von N =', np.mean(N)) print('Standardabweichung von N =', np.std(N)) print('Varianz von N =', np.var(N))
pascalgutjahr/Praktikum-1
Waermepumpe/mittel.py
Python
mit
224
"""Learner that implements a greedy learning algorithm""" import time from pebl import network, result, evaluator from pebl.util import * from pebl.learner.base import * class GreedyLearnerStatistics: def __init__(self): self.restarts = -1 self.iterations = 0 self.unimproved_iterations = ...
arnaudsj/pebl
src/pebl/learner/greedy.py
Python
mit
4,765
#!/usr/bin/env python3 from xml.etree import ElementTree import sys, shlex, subprocess, argparse, os from collections import namedtuple from urllib.parse import urlsplit, urlunsplit from pathlib import PurePath parser = argparse.ArgumentParser(description='Light-weight google repo alternative.') parser.add_argument(...
hillsprig/yarepo
yarepo.py
Python
gpl-3.0
8,065
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Author: Chinmaya Pancholi <chinmayapancholi13@gmail.com> # Copyright (C) 2017 Radim Rehurek <radimrehurek@seznam.cz> # Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html """Scikit learn interface for :class:`~gensim.models.ldamodel.LdaModel`. Fol...
midnightradio/gensim
gensim/sklearn_api/ldamodel.py
Python
gpl-3.0
11,323
from __future__ import unicode_literals from django.apps import AppConfig class SystemConfig(AppConfig): name = 'system'
inteos/IBAdmin
system/apps.py
Python
agpl-3.0
128
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ Low-level objects providing an abstraction for the objects involved in the calculation. """ from __future__ import unicode_literals, division, print_function import collections import abc import six import ...
setten/pymatgen
pymatgen/io/abinit/abiobjects.py
Python
mit
50,073
import logging import re import os import signal from avocado.utils import path from avocado.utils import process from avocado.utils import linux_modules from .compat_52lts import results_stdout_52lts from .versionable_class import VersionableClass, Manager, factory from . import utils_misc # Register to class mana...
xutian/avocado-vt
virttest/openvswitch.py
Python
gpl-2.0
16,638
# Copyright 2012 Nebula, Inc. # 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...
windskyer/nova
nova/tests/functional/api_sample_tests/test_keypairs.py
Python
gpl-2.0
9,490
from django.conf.urls import patterns, url from rango import views urlpatterns = patterns('', url(r'^$', views.index, name='index'), url(r'^about/$', views.about, name='about'), url(r'^add_category/$', views.add_category, name='add_category'), url(r'^category/(?P<category_name_slug>[\w\...
leifos/tango_with_tests
tango_with_django_project/rango/urls.py
Python
mit
1,257
from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible from taggit.managers import TaggableManager from taggit.models import (TaggedItemBase, GenericTaggedItemBase, TaggedItem, TagBase, Tag) # Ensure that two TaggableManagers with custo...
guoqiao/django-taggit
tests/models.py
Python
bsd-3-clause
4,355
# -*- coding: utf-8 -*- from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('tasks', '0002_task_jplag_up_to_date'), ('checker', '0003_isabellechecker_trusted_theories'), ] operations = [ migrations.CreateModel( name='Sca...
KITPraktomatTeam/Praktomat
src/checker/migrations/0004_textchecker_and_scalabuilder.py
Python
gpl-2.0
2,523
# DatabaseStorage for django. # 2011 (c) Mike Mueller <mike@subfocal.net> # 2009 (c) GameKeeper Gambling Ltd, Ivanov E. from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist from django.core.files.storage import Storage from django.core.files import File from django.db import connection, transact...
saukrIppl/seahub
seahub/base/database_storage/database_storage.py
Python
apache-2.0
9,365
# Copyright (c) 2010-2012 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...
kalrey/swift
swift/common/constraints.py
Python
apache-2.0
10,266
# -*- coding: utf-8 -*- """ The main class here is MetaDataHandler that will allow collecting the metadata information for the hdf5 files from a single object. """ from xmlconfig import DaqXmlConfig ##import PyTango import sys import threading import time import traceback class InvalidEntry(Exception): """ ...
ess-dmsc/do-ess-data-simulator
DonkiDirector/metadatahandler.py
Python
bsd-2-clause
10,785
# Copyright 2016 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...
xuleiboy1234/autoTitle
tensorflow/tensorflow/contrib/tensor_forest/python/tensor_forest_test.py
Python
mit
5,484
../../../../../share/pyshared/sessioninstaller/backends/dummy.py
Alberto-Beralix/Beralix
i386-squashfs-root/usr/lib/python2.7/dist-packages/sessioninstaller/backends/dummy.py
Python
gpl-3.0
64
""" Copyright 2014 Scott Lemmer <scottlemmer1@gmail.com> Nelson Akoku Ebot Eno Akpa <akokuenow@gmail.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.apache.or...
scolem/Post-Its
pi/test.py
Python
apache-2.0
3,183
# -*- coding: UTF-8 -*- import pandas class CrimesPorCluster(object): def crimes(self): dataFrame = pandas.read_csv("./cluster-janeiro.csv") indices = dataFrame.groupby('CLUSTER').indices for i in indices: novo = dataFrame[dataFrame['CLUSTER'] == i] novo.to_csv("./cluster-" + str(i) + "-janeiro.csv"...
netodeolino/TCC
TCC 02/Code Files/Análises/crimesPorCluster.py
Python
mit
403
# -*- coding:utf8 -*- # File : opr.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 5/25/17 # # This file is part of TensorArtist. from tartist.nn import opr as O __all__ = ['sigmoid_gan_loss'] def sigmoid_gan_loss(logits, real): if real: return O.sigmoid_cross_entropy_with_logit...
vacancy/TensorArtist
tartist/app/gan/opr.py
Python
mit
470
#!/usr/bin/env python import io import unittest from pycoin.block import Block from pycoin import ecdsa from pycoin.encoding import public_pair_to_sec, public_pair_to_bitcoin_address, wif_to_secret_exponent from pycoin.serialize import h2b from pycoin.tx import Tx, SIGHASH_ALL from pycoin.tx.TxIn import TxIn from p...
moocowmoo/pycoin
tests/build_tx_test.py
Python
mit
7,928
def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config=Configuration('flib',parent_package,top_path) config.add_extension('flib',['flib.f90'],libraries=[]) return config if __name__ == '__main__': from numpy.distutils.core import setup set...
GiggleLiu/dmrg
flib/setup.py
Python
gpl-2.0
352
class TestFilter: def filter(self, test_ref): return True def __str__(self): return "Filter Class: %s.%s" % (self.__module__, self.__class__.__name__) class TestIncludeTagsFilter(TestFilter): def __init__(self, tags): self._tags = tags def filter(self, test_ref): retu...
KarlGong/ptest
ptest/test_filter.py
Python
apache-2.0
1,645
from .signal import Signal from ..abstract.application import app import functools class _Tick(object): def __init__(self, tmr): self.timer = tmr self.cancelled = False def cancel(self): self.cancelled = True def __call__(self): if not self.cancelled: ...
sam-roth/Keypad
keypad/core/timer.py
Python
gpl-3.0
1,855
#!/usr/bin/python3 import argparse import boto3 from botocore.exceptions import NoCredentialsError, NoRegionError from helpers import cloudwatch_bucket_size, formatted_size, print_sizes_by_dir import sys parser = argparse.ArgumentParser(description="This script is meant to be like the `du` tool for linux, except for ...
owocki/s3_disk_util
du.py
Python
mit
2,105
import numpy from third_party.odict import OrderedDict from safe.impact_functions.core import ( FunctionProvider, get_hazard_layer, get_exposure_layer, get_question, get_function_title, default_minimum_needs, evacuated_population_weekly_needs) from safe.storage.raster import Raster from safe...
danylaksono/inasafe
safe/impact_functions/inundation/flood_population_evacuation.py
Python
gpl-3.0
11,532
#!/usr/bin/env python # pylint: disable=R0903 # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2016 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public L...
franciscod/python-telegram-bot
telegram/parsemode.py
Python
gpl-2.0
1,054
from Tkinter import *
AndrewLu810914/pyQt_miniFlowC
prog/tktest.py
Python
mit
22
import sys import PyLineParser def adb_connect(r): if r['flags'].has_key('l'): print 'Connect to localhost:5037' else: print 'Connect to %s:%s' % (r['params']['host'],r['params']['p']) def adb_disconnect(r): print 'Disconnect' def adb_push(r): print 'Push file %s to %s' % (r['args'...
pydev/Python.LineParser
PyLineParser/PyLineParser.test.py
Python
mit
1,888
# Copyright 2020 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. from parameterized import parameterized import unittest import xml.dom.minidom import actions_model PRETTY_XML = """ <actions> <action name="Action1"> <...
scheib/chromium
tools/metrics/actions/actions_model_test.py
Python
bsd-3-clause
9,216
""" Workspace implemented over files, using the mongomock package. """ __author__ = 'Dan Gunter <dkgunter@lbl.gov>' __date__ = '9/3/15' # Imports # Stdlib try: import cStringIO as StringIO except: import StringIO from datetime import datetime import json import logging import msgpack import os import re impor...
kbase/data_api
lib/doekbase/data_api/wsfile.py
Python
mit
17,807
''' Glue for returning descriptive statistics. ''' import numpy as np from scipy import stats import os ############################################# # #============================================ # Univariate Descriptive Statistics #============================================ # def sign_test(samp,mu0=0): ...
wesm/statsmodels
scikits/statsmodels/sandbox/descstats.py
Python
bsd-3-clause
7,666
# -*- coding: utf-8 -*- # Copyright 2022 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...
googleapis/python-aiplatform
google/cloud/aiplatform_v1beta1/types/index.py
Python
apache-2.0
5,038
from pygments.token import string_to_tokentype from pygments.util import ClassNotFound from prompt_toolkit.styles import PygmentsStyle import pygments.styles def style_factory(name, cli_style): try: style = pygments.styles.get_style_by_name(name) except ClassNotFound: style = pygments.styles.g...
darikg/pgcli
pgcli/pgstyle.py
Python
bsd-3-clause
593
from abc import abstractmethod from nettest import utils from nettest.exceptions import NettestError import socket import struct class Field(object): def __init__(self, length=0, default=None): self._default_value = default self._length = length @property def default_value(self): ...
public0821/nettest
nettest/packets/fields.py
Python
apache-2.0
6,091
import unittest from ptpy import PtMySql class PtMySqlTest(unittest.TestCase): mysql = None def init_mysql(self): self.mysql = PtMySql('127.0.0.1','test','root','root') def setUp(self): self.init_mysql() def test_init(self): mysql = PtMySql('127.0.0.1','test','root','root') ...
ptphp/PtPy
test/test_ptmysql.py
Python
bsd-3-clause
873
import tensorflow as tf from tensorflow import keras model = keras.Sequential() # Adds a densely-connected layer with 64 units to the model: model.add(keras.layers.Dense(64, activation='relu')) # Add another: model.add(keras.layers.Dense(64, activation='relu')) # Add a softmax layer with 10 output units: model.add(ker...
WmHHooper/aima-python
tutorials/keras1.py
Python
mit
3,683
from contextlib import closing import datetime import mmap import os import sys import syslog import time def log_to_syslog(message, version_info=None): logname = 'angel' # To-do: use project name here if version_info is not None: logname += '-v%s' % version_info logname += '[%s]' % os.getpid()...
chillinc/angel
lib/devops/logging.py
Python
apache-2.0
13,812
"""Main module of Machine Shift Application.""" import time as _time from threading import Thread as _Thread import logging as _log import numpy as _np from ..util import update_bit as _updt_bit, get_bit as _get_bit from ..namesys import SiriusPVName as _PVName from ..epics import PV as _PV from ..callbacks import Cal...
lnls-sirius/dev-packages
siriuspy/siriuspy/injctrl/main.py
Python
gpl-3.0
40,205
#!/usr/bin/python """ This program will retype volumes """ import os from optparse import OptionParser import random import sys import time from cinderclient import client as cinderclient from novaclient.v2 import client as novaclient USER = os.getenv('OS_USERNAME') TENANT = os.getenv('OS_TENANT_NAME') PASSWORD = ...
solidfire/solidfire-ai
sfai-openstack/verification_scripts/retype_volumes.py
Python
apache-2.0
2,559
"""Automated test views.""" from flask import Blueprint def get_blueprint(app): return Blueprint('iati', __name__, url_prefix='/iati', static_folder=app.config.get('IATI_DATA_PATH'), static_url_path='')
pwyf/IATI-Data-Quality
tracker/iati/views.py
Python
agpl-3.0
251
# -*- coding: utf-8 -*- import sublime, json from .sync_logger import SyncLogger from .libs.utils import Utils from .libs.logger import Logger from .libs.gist_api import Gist class SyncManager: SETTINGS_FILENAME = 'SyncSettings.sublime-settings' @classmethod def settings(cls, key = None, new_value = None): ...
adnedelcu/SyncSettings
sync_settings/sync_manager.py
Python
mit
5,301
from pythonforandroid.recipe import CompiledComponentsPythonRecipe class EvdevRecipe(CompiledComponentsPythonRecipe): name = 'evdev' version = 'v0.4.7' url = 'https://github.com/gvalkov/python-evdev/archive/{version}.zip' depends = [] build_cmd = 'build' patches = ['evcnt.patch', ...
kronenpj/python-for-android
pythonforandroid/recipes/evdev/__init__.py
Python
mit
654
import argparse import xml.etree.cElementTree as ET import jobset argp = argparse.ArgumentParser(description='Run interop tests.') argp.add_argument('-l', '--language', default='c++') args = argp.parse_args() # build job build_job = jobset.JobSpec(cmdline=['tools/run_tests/run_interops_build.sh', '%...
crast/grpc
tools/run_tests/run_interops.py
Python
bsd-3-clause
1,163
from ..factor import trial, fermat import pytest trial_values = [(2, {2: 1}), (17, {17: 1}), (384, {2: 7, 3: 1}), (29483, {29483: 1}), (583928, {2: 3, 47: 1, 1553: 1})] @pytest.mark.parametrize("n,expected", trial_values) def test_passing(n...
useanalias/primer
primer/test/test_factor.py
Python
mit
621
# -*- coding: utf-8 -*- """ flask.testsuite.deprecations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests deprecation support. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import flask import unittest from flask.testsuite import FlaskTestCase, catch_warn...
fancasy/final
lib/flask/testsuite/deprecations.py
Python
apache-2.0
535
from typing import Any import pytest from permutation import Permutation EQUIV_CLASSES = [ [ Permutation(), Permutation(1), Permutation(1, 2), Permutation(1, 2, 3, 4, 5), Permutation.cycle(), Permutation.from_cycles(), Permutation.from_cycles(()), ], ...
jwodder/permutation
test/test_eq.py
Python
mit
2,573
import json import math import os from string import lower import urllib import zipfile import re import random import csv import time from django.core.exceptions import PermissionDenied, ObjectDoesNotExist from django.db.models.query_utils import Q from django.forms.forms import NON_FIELD_ERRORS from django.forms.uti...
voer-platform/vp.web
vpw/views.py
Python
agpl-3.0
101,170
from django.apps import AppConfig as BaseAppConfig from django.utils.importlib import import_module class AppConfig(BaseAppConfig): name = "potluck" def ready(self): import_module("potluck.receivers")
hnassif/potluck
potluck/apps.py
Python
mit
221
''' Faraday Penetration Test IDE - Community Version Copyright (C) 2013 Infobyte LLC (http://www.infobytesec.com/) See the file 'doc/LICENSE' for the license information ''' import qt import os from gui.qt3.dialogs import BaseDialog from config.configuration import getInstanceConfiguration CONF = getInsta...
Snifer/BurpSuite-Plugins
faraday/gui/qt3/configdialog.py
Python
gpl-2.0
4,581
''' Test ACS columns ''' from tasks.util import shell # TODO clean this up in a more general init script try: shell('createdb test') except: pass from nose.tools import with_setup from tasks.us.census.lodes import WorkplaceAreaCharacteristicsColumns from tests.util import runtask, setup, teardown @with_...
CartoDB/bigmetadata
tests/us/census/test_lodes.py
Python
bsd-3-clause
423
""" Django settings for django_xrm project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...)...
acruxsa/django-xrm
django_xrm/django_xrm/settings.py
Python
mit
2,066
# encoding: utf-8 """ ms.py Created by Thomas Mangin on 2012-07-17. Copyright (c) 2009-2015 Exa Networks. All rights reserved. """ from exabgp.bgp.message.open.capability import Capability # ================================================================= MultiSession # class MultiSession (Capability,list): def _...
lochiiconnectivity/exabgp
lib/exabgp/bgp/message/open/capability/ms.py
Python
bsd-3-clause
1,293
from rsqueakvm.util.cells import QuasiConstant from rsqueakvm.plugins.vmdebugging.model import wrap_oplist, wrap_greenkey, wrap_debug_info from rpython.rlib.jit import JitHookInterface, Counters jit_iface_recursion = QuasiConstant(False) def make_hook(args, func): import inspect, re src = "\n".join([ ...
HPI-SWA-Lab/RSqueak
rsqueakvm/plugins/vmdebugging/hooks.py
Python
bsd-3-clause
3,381
# -*- coding: utf-8 -*- from odoo import fields, models class AccountMove(models.Model): _inherit = 'account.move' stock_move_id = fields.Many2one('stock.move', string='Stock Move', index=True) stock_valuation_layer_ids = fields.One2many('stock.valuation.layer', 'account_move_id', string='Stock Valuatio...
rven/odoo
addons/stock_account/models/account_move.py
Python
agpl-3.0
10,807
"""Scoreboard Test.""" import datetime from django.core.urlresolvers import reverse from django.test import TransactionTestCase from apps.managers.challenge_mgr import challenge_mgr from apps.utils import test_utils from apps.widgets.participation import participation from apps.managers.cache_mgr import cache_mgr cl...
csdl/makahiki
makahiki/apps/widgets/participation/tests.py
Python
mit
1,493
import json from nose.tools import eq_ import amo import amo.tests from amo.urlresolvers import reverse from addons.models import Addon from compat.models import CompatReport # This is the structure sent to /compatibility/incoming from the ACR. incoming_data = { 'appBuild': '20110429030623', 'appGUID': '{ec...
jbalogh/zamboni
apps/compat/tests.py
Python
bsd-3-clause
2,985
import sys from glob import glob from os.path import join, dirname from kivy.uix.scatter import Scatter from kivy.uix.widget import Widget from kivy.uix.label import Label from kivy.app import App from kivy.graphics.svg import Svg from kivy.core.window import Window from kivy.uix.floatlayout import FloatLayout from kiv...
woylaski/notebook
graphic/kivy-master/examples/svg/main-smaa.py
Python
gpl-3.0
4,479
# Copyright (C) 2000-2014 Bastian Kleineidam # # 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 2 of the License, or # (at your option) any later version. # # This program is distr...
linkcheck/linkchecker
linkcheck/threader.py
Python
gpl-2.0
1,302
# -*- coding: utf-8 -*- try: import xml.etree.cElementTree as ET except ImportError: import xml.etree.ElementTree as ET from textblob_de.lemmatizers import PatternParserLemmatizer from general import * ONLY_PERSONS = 0 WITHOUT_PERSONS = 1 ALL_ARTICLES = 2 class XMLImporter: _lemmatizer = '' database =...
swalter2/PersonalizationService
Service/xmlimporter.py
Python
mit
7,597
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) from builtins import * from future.builtins.disabled import * import re import os from ._guest_common import * class GuestDelete(GuestCommand): def __init__(self, *args, **kwargs): super(...
dahuebi/vsmomi
vsmomi/commands/guest_delete.py
Python
apache-2.0
2,515
#*************************************************************************** #* * #* Copyright (c) 2011 * #* Yorik van Havre <yorik@uncreated.net> * #* ...
balazs-bamer/FreeCAD-Surface
src/Mod/Arch/ArchAxis.py
Python
lgpl-2.1
19,342
# -*- coding: utf-8 -*- import os import subprocess from setuptools import setup src_dir = os.path.abspath(os.path.dirname(__file__)) try: # Try to get the latest version string dynamically from git: # (latest version, commits since latest release, and commit SHA-1) git_args = ['git', '--work-tree', sr...
yasserglez/pyenscript
setup.py
Python
apache-2.0
1,451
from south.db import db from django.db import models from courant.core.discussions.models import * class Migration: def forwards(self, orm): # Adding model 'CommentOptions' db.create_table('discussions_commentoptions', ( ('name', models.CharField(max_length=50)), ...
maxcutler/Courant-News
courant/core/discussions/migrations/0002_initial.py
Python
bsd-3-clause
1,836
import os import transfert from transfert import Resource import transfert.actions import transfert.exceptions from .utils import delete_files def test_copy(tmpdir, storages): f = tmpdir.join('alpha') f.write_binary(os.urandom(1024 * 40)) f_http = Resource(storages['http']('index.html')) f_file = Reso...
rbernand/transfert
tests/fonct/test_copy.py
Python
mit
916
#!/usr/bin/env python3 from Utils import * if __name__ == "__main__": nj = NumberJuggler(10000) for i in range(len(nj.primeList)): prime1 = nj.primeList[i] if not len(str(prime1)) == 4: continue for j in range(i + 1, len(nj.primeList)): prime2 = nj.primeList[j] ...
bobismijnnaam/bobe-euler
49/49.py
Python
mit
860
#!/usr/bin/env python # # BitCurator # # This code is distributed under the terms of the GNU General Public # License, Version 3. See the text file "COPYING" for further details # about the terms of this license. # # Routines related generating reports from text file generated by fiwalk # import re import os from ...
queer1/bitcurator
python/bc_genrep_text.py
Python
gpl-3.0
6,628
# -*- coding: utf-8 -*- # Licensed under the MIT license # http://opensource.org/licenses/mit-license.php # Copyright 2006,2007 Frank Scholz <coherence@beebits.net> # Copyright 2014, Hartmut Goebel <h.goebel@crazy-compilers.com> from coherence.upnp.devices.basics import DeviceHttpRoot, BasicDevice from coherence.upn...
coherence-project/Coherence
coherence/upnp/devices/media_renderer.py
Python
mit
1,103
#!/usr/bin/env python3 import xml.etree.ElementTree as ET def getRoot(file): return ET.parse(file).getroot()
tibyte/autowkid
xmlparse.py
Python
apache-2.0
115
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2014 CodUP (<http://codup.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affer...
Jgarcia-IAS/SAT
openerp/addons-extra/asset_purchase/__openerp__.py
Python
agpl-3.0
1,725