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
from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals from SimPEG import Mesh, Utils import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches from scipy.sparse import spdiags,csr_matrix, eye,kron,hstack,vstack,eye,diags impor...
geoscixyz/em_examples
em_examples/Loop.py
Python
mit
6,800
""" Test the Multinet Class. """ import multinet as mn import networkx as nx class TestMultinet(object): def test_build_multinet(self): """ Test building Multinet objects. """ mg = mn.Multinet() assert mg.is_directed() == False mg.add_edge(0, 1, 'L1') mg...
wuhaochen/multinet
multinet/tests/test_classes.py
Python
mit
11,570
# Test hashlib module # # $Id: test_hashlib.py 79216 2010-03-21 19:16:28Z georg.brandl $ # # Copyright (C) 2005-2010 Gregory P. Smith (greg@krypto.org) # Licensed to PSF under a Contributor Agreement. # import hashlib import unittest from test import test_support from test.test_support import _4G, preci...
babyliynfg/cross
tools/project-creator/Python2.6.6/Lib/test/test_hashlib.py
Python
mit
7,399
# 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 ...
AutorestCI/azure-sdk-for-python
azure-mgmt-network/azure/mgmt/network/v2017_11_01/models/virtual_network_peering.py
Python
mit
4,677
# -*- coding: utf-8 -*- import sys sys.path.append('../browser_interface/browser') class BrowserFactory(object): def create(self, type, *args, **kwargs): return getattr(__import__(type), type)(*args, **kwargs)
xtuyaowu/jtyd_python_spider
browser_interface/browser/BrowserFactory.py
Python
mit
225
# -*- coding: utf-8 -*- import sqlite3 VERBOSE = 0 CTABLE_DOMAIN = ''' CREATE TABLE IF NOT EXISTS Domains( did INTEGER PRIMARY KEY AUTOINCREMENT, domain VARCHAR(64) UNIQUE, indegree INTEGER, outdegree INTEGER )''' CTABLE_WEBSITE = ''' CREATE TABLE IF NOT EXISTS Websites( wid INTEGER PRIMARY KEY AUTOINCREMENT, ...
JaySon-Huang/WebModel
WebModel/database/databasehelper.py
Python
mit
4,676
# coding: utf-8 import re from crossword import * class Crossword2(Crossword): def __init__(self): self.grid = OpenGrid() self.connected = {} self.used_words = [] def copy(self): copied = Crossword2() copied.grid = self.grid.copy() copied.connected = self.co...
yattom/crossword
crossword2.py
Python
mit
7,931
import math class Point: def __init__(self, x, y): self.x = x self.y = y def rssToEstimatedDistance(rss): freq = 2462 # freq of WiFi channel 6 origDBm = -20 # estimate this value loss = abs(origDBm - rss) dist = 10 ** ( ( loss + 27.55 - 20 * math.log10(freq) )...
DepthDeluxe/dot11sniffer
app/Trilateration_Colin.py
Python
mit
1,799
import pytest from swimlane.exceptions import ValidationError def test_getattr_fallback(mock_record): """Verify cursor __getattr__ falls back to AttributeError for unknown cursor + list methods""" with pytest.raises(AttributeError): getattr(mock_record['Text List'], 'unknown_method') def test_set_v...
Swimlane/sw-python-client
tests/fields/test_list.py
Python
mit
2,579
callback_functions = ["collision_enter", "collision_stay", "collision_exit"] length_area_world = 75 raise_exception = False # import all required modules from game import * from gameobject import * from contracts import * from configuration import * from component import * from loader import * from physics import * f...
temdisponivel/temdisponivellib_pygame
temdisponivellib/__init__.py
Python
mit
564
from functools import reduce # constants used in the multGF2 function mask1 = mask2 = polyred = None def setGF2(degree, irPoly): """Define parameters of binary finite field GF(2^m)/g(x) - degree: extension degree of binary field - irPoly: coefficients of irreducible polynomial g(x) """ def i...
srijs/hwsl2-core
calc.py
Python
mit
1,141
# -*- coding: utf8 -*- from __future__ import unicode_literals import unittest import os import sys from flake8.api import legacy as engine if sys.version_info[0] == 3: unicode = str if sys.version_info[:2] == (2, 6): # Monkeypatch to make tests work on 2.6 def assert_less(first, second, msg=None): ...
psykzz/flask-rollbar
tests/test_flake8.py
Python
mit
1,281
import pyak import yikbot import time # Latitude and Longitude of location where bot should be localized yLocation = pyak.Location("42.270340", "-83.742224") yb = yikbot.YikBot("yikBot", yLocation) print "DEBUG: Registered yikBot with handle %s and id %s" % (yb.handle, yb.id) print "DEBUG: Going to sleep, new yakker...
congrieb/yikBot
start.py
Python
mit
469
import prosper.datareader.exceptions import prosper.datareader._version
EVEprosper/ProsperDatareader
prosper/datareader/__init__.py
Python
mit
72
""" Visualization module. """ import numpy as np from matplotlib import animation import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes from mpl_toolkits.axes_grid1.inset_locator import mark_inset from pca import create_handles i...
mdeff/ntds_2017
projects/reports/terrorist_attacks/project/visualization.py
Python
mit
8,333
#!/usr/bin/python # -*- coding: utf-8 -*- __author__ = "Ricardo Ribeiro" __credits__ = ["Ricardo Ribeiro"] __license__ = "MIT" __version__ = "0.0" __maintainer__ = "Ricardo Ribeiro" __email__ = "ricardojvr@gmail.com" __status__ = "Development" import time from datetime import datetime, ...
sunj1/my_pyforms
pyforms/Utils/timeit.py
Python
mit
694
from app.app_and_db import app from flask import Blueprint, jsonify, render_template import datetime import random import requests dashboard = Blueprint('dashboard', __name__) cumtd_endpoint = 'https://developer.cumtd.com/api/{0}/{1}/{2}' cumtd_endpoint = cumtd_endpoint.format('v2.2', 'json', 'GetDeparturesByStop') ...
nickofbh/kort2
app/dashboard/views.py
Python
mit
1,414
from __future__ import print_function import sys sys.path.append('..') # help python find cyton.py relative to scripts folder from openbci import cyton as bci import logging import time def printData(sample): # os.system('clear') print("----------------") print("%f" % (sample.id)) print(sample.chann...
OpenBCI/OpenBCI_Python
scripts/test.py
Python
mit
937
__author__ = 'mengpeng' import os from unittest import TestCase from pycrawler.scraper import DefaultScraper from pycrawler.handler import Handler from pycrawler.utils.tools import gethash from test_scraper import SpiderTest class TestTempHandler(TestCase): def test_setargs(self): h = Handler.get('TempHan...
ymero/PyCrawler
test/test_handler.py
Python
mit
996
import datetime def suffix(d): return 'th' if 11<=d<=13 else {1:'st',2:'nd',3:'rd'}.get(d%10, 'th') def custom_strftime(format, t): return t.strftime(format).replace('{S}', str(t.day) + suffix(t.day)) print "Welcome to GenerateUpdateLines, the nation's favourite automatic update line generator." start = in...
ArthurStart/arthurstart.github.io
GenerateUpdateLines.py
Python
mit
889
#!/usr/bin/python import praw import re import os import pickle from array import * import random #REPLY = "I want all the bacon and eggs you have." REPLY = array('i',["I want all the bacon and eggs you have", "I know what I'm about son", "I'm not interested in caring about people", "Is this not rap?"]) if not os.pat...
dcooper2/Swanson_Bot
swanson_bot.py
Python
mit
2,143
from __future__ import absolute_import, unicode_literals from django.conf import settings from django.conf.urls import include, url from django.contrib import admin from django.contrib.auth import urls as djangoauth_urls from search import views as search_views from blog import views as blog_views from wagtail.wagtai...
philba/myblog
myblog/urls.py
Python
mit
1,474
from django.conf.urls import patterns, url from links import views urlpatterns = patterns('links.views', url(r'^link/settings/$', views.settings, name = 'settings'), url(r'^link/donate/(?P<url>[\d\w.]+)$', views.kintera_redirect, name = 'donate'), url(r'^link/rider/(?P<url>[\d\w.]+)$', views.t4k_redirect, ...
ethanperez/t4k-rms
links/urls.py
Python
mit
340
def get_planet_name(id): switch = { 1: "Mercury", 2: "Venus", 3: "Earth", 4: "Mars", 5: "Jupiter", 6: "Saturn", 7: "Uranus" , 8: "Neptune"} return switch[id]
NendoTaka/CodeForReference
CodeWars/8kyu/planetName.py
Python
mit
231
import sys import time import socket import struct import random import hashlib import urllib2 from Crypto import Random from Crypto.Cipher import AES # from itertools import izip_longest # Setting timeout so that we won't wait forever timeout = 2 socket.setdefaulttimeout(timeout) limit = 256*256*256*256 - 1 def ...
ytisf/PyExfil
pyexfil/network/QUIC/quic_client.py
Python
mit
6,330
"""Deals with input examples for deep learning. One "input example" is one storm object. --- NOTATION --- The following letters will be used throughout this module. E = number of examples (storm objects) M = number of rows in each radar image N = number of columns in each radar image H_r = number of radar heights F...
thunderhoser/GewitterGefahr
gewittergefahr/deep_learning/input_examples.py
Python
mit
103,640
import os import re import sys import json import shlex import logging import inspect import functools import importlib from pprint import pformat from collections import namedtuple from traceback import format_tb from requests.exceptions import RequestException import strutil from cachely.loader import Loader from ....
dakrauth/snarf
snagit/core.py
Python
mit
7,965
import antlr3; import sqlite3; import pickle; import sys, os; import re; from SpeakPython.SpeakPython import SpeakPython; from SpeakPython.SpeakPythonLexer import SpeakPythonLexer; from SpeakPython.SpeakPythonParser import SpeakPythonParser; #sort results based on length of labels def sortResults(results): l = len(r...
netgio/voicecount
devicecode/SpeakPythonMakeDB.py
Python
mit
4,765
from __future__ import unicode_literals from __future__ import print_function import socket import time import six import math import threading from random import choice import logging from kazoo.client import KazooClient from kazoo.client import KazooState from kazoo.protocol.states import EventType fro...
bendemott/solr-zkutil
solrzkutil/util.py
Python
mit
13,103
from turbogears.identity.soprovider import * from secpwhash import check_password class SoSecPWHashIdentityProvider(SqlObjectIdentityProvider): def validate_password(self, user, user_name, password): # print >>sys.stderr, user, user.password, user_name, password return check_password(user.password,password)
edwardsnj/rmidb2
rmidb2/sosecpwhashprovider.py
Python
mit
317
#!/usr/bin/env python from __future__ import print_function """ Batch Normalization + SVRG on MNIST Independent Study May 24, 2016 Yintai Ma """ """ # Use SGD AdaGrad instead """ """ under folder of batch_normalization Before merge; number 1 have options for "mlp", "mlpbn"; "sgd" and "custom_svrg2" and "sgd_adagrad...
myt00seven/svrg
cifar/large_gpu_cifar10_ffn.py
Python
mit
20,715
#!/usr/bin/env python """ cycle_basis.py functions for calculating the cycle basis of a graph """ from numpy import * import networkx as nx import matplotlib import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.path import Path if matplotlib.__version__ >= '1.3.0': from matplotlib.p...
hronellenfitsch/nesting
cycle_basis.py
Python
mit
11,955
from __future__ import unicode_literals import re from django.contrib.auth.models import (AbstractBaseUser, PermissionsMixin, UserManager) from django.core import validators from django.core.mail import send_mail from django.utils.translation import ugettext_lazy as _ from noti...
othreecodes/MY-RIDE
app/models.py
Python
mit
11,305
# coding: utf-8 """ ORCID Member No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: Latest Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import si...
Royal-Society-of-New-Zealand/NZ-ORCID-Hub
orcid_api_v3/models/education_summary_v30.py
Python
mit
13,754
# Script Name : sqlite_check.py # Author : Craig Richards # Created : 20 May 2013 # Last Modified : # Version : 1.0 # Modifications : # Description : Runs checks to check my SQLITE database import sqlite3 as lite import sys import os dropbox = os.getenv("dropbox") dbfile = ("Databases\jarvis.db") master_db = os...
areriff/pythonlearncanvas
Python Script Sample/sqlite_check.py
Python
mit
1,034
# 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 may ...
Azure/azure-sdk-for-python
sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/v3_0/models/__init__.py
Python
mit
4,297
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Mexican Wave #Problem level: 6 kyu def wave(str): li=[] for i in range(len(str)): x=list(str) x[i]=x[i].upper() li.append(''.join(x)) return [x for x in li if x!=str]
Kunalpod/codewars
mexican_wave.py
Python
mit
255
# This is modified from a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild import array import struct import zlib from enum import Enum from pkg_resources import parse_version from kaitaistruct import __version__ as ks_version, KaitaiStruct, KaitaiStream, BytesIO if parse_version...
sonusz/PhasorToolBox
phasortoolbox/parser/common.py
Python
mit
9,531
#!/usr/bin/python # -*- coding: utf-8 -*- """ This bot regenerates the page VEIDs The following parameters are supported: -debug If given, doesn't do any real changes, but only shows what would have been changed. """ __version__ = '$Id: basic.py 4946 2008-01-29 14:58:25Z wikipedian $'...
sicekit/sicekit
robots/tool-list_networks.py
Python
mit
2,437
def goodSegement1(badList,l,r): sortedBadList = sorted(badList) current =sortedBadList[0] maxVal = 0 for i in range(len(sortedBadList)): current = sortedBadList[i] maxIndex = i+1 # first value if i == 0 and l<=current<=r: val = current - l prev...
nithincvpoyyil/nithincvpoyyil.github.io
test.py
Python
mit
1,191
import sublime, sublime_plugin from indenttxt import indentparser class IndentToList(sublime_plugin.TextCommand): def run(self, edit): parser = indentparser.IndentTxtParser() #Get current selection sels = self.view.sel() selsParsed = 0 if(len(sels) > 0): for sel...
Harrison-M/indent.txt-sublime
indentsublime.py
Python
mit
967
def Setup(Settings,DefaultModel): # set1-test_of_models_against_datasets/osm299.py Settings["experiment_name"] = "set1_Mix_model_versus_datasets_299px" Settings["graph_histories"] = ['together'] #['all','together',[],[1,0],[0,0,0],[]] # 5556x_minlen30_640px 5556x_minlen20_640px 5556x_reslen20_299px 5...
previtus/MGR-Project-Code
Settings/set1-test_of_models_against_datasets/mix299.py
Python
mit
1,829
# -*- coding: UTF-8 -*- import base64 import unittest from ingenico.connect.sdk.defaultimpl.default_marshaller import DefaultMarshaller from ingenico.connect.sdk.domain.metadata.shopping_cart_extension import ShoppingCartExtension from ingenico.connect.sdk.meta_data_provider import MetaDataProvider from ingenico.conne...
Ingenico-ePayments/connect-sdk-python3
tests/unit/test_meta_data_provider.py
Python
mit
5,371
# -*- coding: utf-8 -*- import threading import logging import unittest import gc from stockviderApp.utils import retryLogger from stockviderApp.sourceDA.symbols.referenceSymbolsDA import ReferenceSymbolsDA from stockviderApp.localDA.symbols.dbReferenceSymbolsDA import DbReferenceSymbolsDA from stockviderApp.sourc...
aberdah/Stockvider
stockvider/stockviderApp/dbManager.py
Python
mit
33,602
# -*- coding: utf-8 -*- import wx import win32clipboard import win32con import gui import treeInterceptorHandler import textInfos import globalVars def getSelectedText(): obj = globalVars.focusObject if isinstance(obj.treeInterceptor, treeInterceptorHandler.DocumentTreeInterceptor) and not obj.treeInterceptor.passT...
kvark128/yandexTranslate
globalPlugins/yandexTranslate/helper.py
Python
mit
1,890
import numpy as np import matplotlib.pyplot as plt from sklearn.pipeline import Pipeline from sklearn.preprocessing import PolynomialFeatures from sklearn.linear_model import LinearRegression from sklearn.model_selection import cross_val_score np.random.seed(0) n_samples = 30 degrees = [1, 4, 15] true_fun = lambda X...
bhzunami/Immo
immo/scikit/scripts/Overfit_underfit.py
Python
mit
1,611
# -*- coding: utf-8 -*- """ This file is part of pyCMBS. (c) 2012- Alexander Loew For COPYING and LICENSE details, please refer to the LICENSE file """ from cdo import Cdo from pycmbs.data import Data import tempfile as tempfile import copy import glob import os import sys import numpy as np from pycmbs.benchmarking ...
pygeo/pycmbs
pycmbs/benchmarking/models/mpi_esm.py
Python
mit
41,720
from threading import Lock import requests from api.decorator import critical_section from api.importer import AdditionalDataImporter from api.importer import AdditionalDataImporterError from api.importer.wiktionary import dyn_backend rmi_lock = Lock() class DictionaryImporter(AdditionalDataImporter): def popu...
radomd92/botjagwar
api/importer/rakibolanamalagasy.py
Python
mit
1,609
import math class VirtualScreen: #cet ecran est normal a l'axe Z du Leap def __init__(self,Xoffset=0,Yoffset=50,Zoffset=-50,Zlimit=220,length=350,height=300): #en mm self.Xoffset = Xoffset; # position du milieu du bord bas de l'ecran par rapport au centre du Leap self.Yoffset = Yoffset; # position du milieu ...
IIazertyuiopII/PDS_sonification
python/VirtualScreen.py
Python
mit
2,759
from rewpapi.common.http import Request from rewpapi.listings.listing import ListingResidential class RemoteListingImages(Request): def __init__(self, base_site, auth, listing_type, listing_uuid): super(RemoteListingImages, self).__init__(auth) self._base_site = base_site self._auth = auth...
propdata/rewp-api
rewpapi/listings/images.py
Python
mit
2,288
# 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 may ...
Azure/azure-sdk-for-python
sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_exchange_operations.py
Python
mit
7,926
from __future__ import absolute_import import unittest import types if __name__ == "__main__": from optional import * #imports from package, not sub-module else: from .optional import * from .nulltype import * class TestNullType(unittest.TestCase): def test_supertype(self): self.assert_(isinst...
OaklandPeters/optional
optional/test_optional.py
Python
mit
3,279
# coding=utf-8 import pymysql import PyGdbUtil class PyGdbDb: # 初始化: 连接数据库 def __init__(self, host, port, dbname, user, passwd): self.project = None self.table_prefix = None try: self.connection = pymysql.connect( host=host, port=int(port), user=user, passwor...
Jecvay/PyGDB
PyGdbDb.py
Python
mit
10,962
#!/usr/bin/env python # -*- coding: utf-8 -*- import root import j
tonghuashuai/OnlyBoard
controller/_url.py
Python
mit
68
#!../../../.env/bin/python import os import numpy as np import time a = np.array([ [1,0,3], [0,2,1], [0.1,0,0], ]) print a row = 1 col = 2 print a[row][col] assert a[row][col] == 1 expected_max_rows = [0, 1, 0] expected_max_values = [1, 2, 3] print 'expected_max_rows:', expected_max_rows print 'expected_...
chrisspen/homebot
src/test/max_column/test_max_column.py
Python
mit
690
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns( '', url(r'', include('frontpage.urls')), url(r'^auth/', include('social.apps.django_app.urls', namespace='social')), url(r'^admin/', include(admin.site.urls)), url(r'^...
cncdnua/cncdnua
cncdnua/cncdnua/urls.py
Python
mit
405
import fetchopenfmri.fetch
wiheto/fetchopenfmri
fetchopenfmri/__init__.py
Python
mit
28
""" To run this test, type this in command line <kolibri manage test -- kolibri.core.content> """ import datetime import unittest import uuid import mock import requests from django.conf import settings from django.core.cache import cache from django.core.urlresolvers import reverse from django.test import TestCase fr...
indirectlylit/kolibri
kolibri/core/content/test/test_content_app.py
Python
mit
72,718
import os import re import subprocess from utils import whereis_exe class osx_voice(): def __init__(self, voice_line): mess = voice_line.split(' ') cleaned = [ part for part in mess if len(part)>0 ] self.name = cleaned[0] self.locality = cleaned[1] self.desc = cleaned[2]....
brousch/saythis2
tts_engines/osx_say.py
Python
mit
888
import urllib2 import os baseurl = "http://ceoaperms.ap.gov.in/TS_Rolls/PDFGeneration.aspx?urlPath=D:\SSR2016_Final\Telangana\AC_001\English\S29A" constituencyCount = 0 constituencyTotal = 229 while constituencyCount <= constituencyTotal: pdfCount = 1 notDone = True constituencyCount = constituencyCount ...
abhishek-malani/python-basic-coding
python-basic-coding/python-basic-coding/voter_data_download.py
Python
mit
1,936
#!/usr/bin/env python3 # Advent of Code 2016 - Day 7, Part One import sys import re from itertools import islice def window(seq, n=2): "Returns a sliding window (of width n) over data from the iterable" " s -> (s0,s1,...s[n-1]), (s1,s2,...,sn), ... " it = iter(seq) result = tuple(i...
mcbor/adventofcode
2016/day07/day07-pt1.py
Python
mit
1,067
from pydatastream import Datastream import json import datetime import sys import os.path #hardcoded directories dir_input = "input/" dir_output = "output/" #check that the login credentials and input file location are being passed in numOfArgs = len(sys.argv) - 1 if numOfArgs != 3: print "Please run this python s...
jinser/automate_pydatastream
getcustom.py
Python
mit
3,917
"""Unit tests for conus_boundary.py.""" import unittest import numpy from gewittergefahr.gg_utils import conus_boundary QUERY_LATITUDES_DEG = numpy.array([ 33.7, 42.6, 39.7, 34.9, 40.2, 33.6, 36.4, 35.1, 30.8, 47.4, 44.2, 45.1, 49.6, 38.9, 35.0, 38.1, 40.7, 47.1, 30.2, 39.2 ]) QUERY_LONGITUDES_DEG = numpy.arr...
thunderhoser/GewitterGefahr
gewittergefahr/gg_utils/conus_boundary_test.py
Python
mit
2,046
#!/usr/bin/python3.3 import somnTCP import somnUDP import somnPkt import somnRouteTable from somnLib import * import struct import queue import threading import socket import time import random PING_TIMEOUT = 5 class somnData(): def __init__(self, ID, data): self.nodeID = ID self.data = data class somnMes...
squidpie/somn
src/somnMesh.py
Python
mit
23,564
from rest_framework import serializers from workers.models import (TaskConfig, Task, Job, TaskProducer) from grabbers.serializers import (MapperSerializer, SequenceSerializer) from grabbers.models impor...
VulcanoAhab/delphi
workers/serializers.py
Python
mit
2,526
import tensorflow as tf from tensorflow.contrib.rnn import LSTMCell, GRUCell, MultiRNNCell, DropoutWrapper from tqdm import tqdm from decoder import pointer_decoder import dataset import matplotlib.pyplot as plt # TODO """ Michel: _____________________________________________________________________ ...
pcournut/deep-learning-for-combinatorial-optimization
MD/nnet.py
Python
mit
12,765
# 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 use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copi...
qtile/qtile
test/widgets/test_caps_num_lock_indicator.py
Python
mit
4,137
import random from string import digits, ascii_letters, punctuation def password_generator(length): while True: values = list(digits + ascii_letters + punctuation) yield ''.join([random.choice(values) for i in range(length)])
id2669099/turbo-waffle
task_07_02.py
Python
mit
249
# utils.py """ Utilities module containing various useful functions for use in other modules. """ import logging import numpy as np import scipy.linalg as sl import scipy.sparse as sps import scipy.special as ss from pkg_resources import Requirement, resource_filename from scipy.integrate import odeint from scipy.int...
jellis18/enterprise
enterprise/signals/utils.py
Python
mit
29,066
# ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ import os import pytest import platform import functools from azure.core.exceptions import HttpResponseError, ClientAuthenticationError from azure.core.credentials impo...
Azure/azure-sdk-for-python
sdk/textanalytics/azure-ai-textanalytics/tests/test_recognize_linked_entities_async.py
Python
mit
28,006
import sys import glob import numpy as np from .netcdf import netcdf_file _exclude_global = ['close', 'createDimension', 'createVariable', 'dimensions', 'filename', 'flush', 'fp', 'mode'...
altMITgcm/MITgcm66h
utils/python/MITgcmutils/MITgcmutils/mnc.py
Python
mit
14,112
"""Publishing native (typically pickled) objects. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from traitlets.config import Configurable from ipykernel.inprocess.socket import SocketABC from traitlets import Instance, Dict, CBytes from ipykernel.jsonutil imp...
bdh1011/wau
venv/lib/python2.7/site-packages/ipykernel/datapub.py
Python
mit
1,761
# -*- coding: utf-8 -*- # Generated by Django 1.9.3 on 2016-03-03 01:08 from __future__ import unicode_literals from django.db import migrations, models from blog.models import Post def slugify_all_posts(*args): for post in Post.objects.all(): post.save() class Migration(migrations.Migration): dep...
nnscr/nnscr.de
blog/migrations/0002_post_slug.py
Python
mit
608
import six from unittest import TestCase from dark.reads import Read, Reads from dark.score import HigherIsBetterScore from dark.hsp import HSP, LSP from dark.alignments import ( Alignment, bestAlignment, ReadAlignments, ReadsAlignmentsParams, ReadsAlignments) class TestAlignment(TestCase): """ Tests...
bamueh/dark-matter
test/test_alignments.py
Python
mit
7,278
import requests import platform from authy import __version__, AuthyFormatException from urllib.parse import quote # import json try: import json except ImportError: try: import simplejson as json except ImportError: from django.utils import simplejson as json class Resource(object): ...
smontoya/authy-python3
authy/api/resources.py
Python
mit
6,164
import datetime import MySQLdb from os import sys class DBLogger: def __init__(self, loc='default-location'): self.usr = '<user>' self.pwd = '<password>' self.dbase = '<database>' self.location = loc self.conn = MySQLdb.connect(host="localhost", user=self.usr, passwd=self.pwd, db=self.dbase) ...
georgetown-analytics/classroom-occupancy
SensorDataCollection/Sensors/DBLogger.py
Python
mit
421
from unittest.mock import Mock import sqlalchemy as sa from sqlalchemy import ForeignKey from sqlalchemy import Integer from sqlalchemy import String from sqlalchemy import testing from sqlalchemy.orm import query from sqlalchemy.orm import relationship from sqlalchemy.orm import scoped_session from sqlalchemy.orm imp...
sqlalchemy/sqlalchemy
test/orm/test_scoping.py
Python
mit
7,276
#!/usr/bin/env python ''' Creates an html treemap of disk usage, using the Google Charts API ''' import json import os import subprocess import sys def memoize(fn): stored_results = {} def memoized(*args): try: return stored_results[args] except KeyError: result = store...
geekoftheweek/disk-treemap
treemap.py
Python
mit
2,734
""" Check what the `lambdax` module publicly exposes. """ import builtins from inspect import isbuiltin, ismodule, isclass from itertools import chain import operator from unittest.mock import patch import lambdax.builtins_as_lambdas import lambdax.builtins_overridden from lambdax import x1, x2, x def _get_exposed(t...
hlerebours/lambda-calculus
lambdax/test/test_exposed.py
Python
mit
3,947
__author__ = 'ysahn' import logging import json import os import glob import collections from mako.lookup import TemplateLookup from mako.template import Template from taskmator.task.core import Task class TransformTask(Task): """ Class that transform a json into code using a template Uses mako as temp...
altenia/taskmator
taskmator/task/text.py
Python
mit
4,755
import sys import traceback import logging import time import inspect def run_resilient(function, function_args=[], function_kwargs={}, tolerated_errors=(Exception,), log_prefix='Something failed, tolerating error and retrying: ', retries=5, delay=True, critical=False, initial_delay_time=0.1, delay_multiplier = 2.0): ...
mikemaccana/resilience
__init__.py
Python
mit
2,874
#!/usr/bin/env python """ Solve day 23 of Advent of Code. http://adventofcode.com/day/23 """ class Computer: def __init__(self): """ Our computer has 2 registers, a and b, and an instruction pointer so that we know which instruction to fetch next. """ self.a = 0 ...
mpirnat/adventofcode
day23/day23.py
Python
mit
2,854
import subprocess import os import errno def download_file(url, local_fname=None, force_write=False): # requests is not default installed import requests if local_fname is None: local_fname = url.split('/')[-1] if not force_write and os.path.exists(local_fname): return local_fname dir_name = os.pat...
yancz1989/lr_semi
common/util.py
Python
mit
1,092
import unittest from locust.util.timespan import parse_timespan from locust.util.rounding import proper_round class TestParseTimespan(unittest.TestCase): def test_parse_timespan_invalid_values(self): self.assertRaises(ValueError, parse_timespan, None) self.assertRaises(ValueError, parse_timespan, ...
heyman/locust
locust/test/test_util.py
Python
mit
1,232
# This module is free software. You can redistribute it and/or modify it under # the terms of the MIT License, see the file COPYING included with this # distribution. from __future__ import division """ main.py -- main program of motif sequence coverage pipeline tool example for running code: python main.py -jid tes...
RamiOran/SeqCov
main.py
Python
mit
3,137
from __future__ import annotations from typing import Generic, TypeVar T = TypeVar("T") class DisjointSetTreeNode(Generic[T]): # Disjoint Set Node to store the parent and rank def __init__(self, data: T) -> None: self.data = data self.parent = self self.rank = 0 class DisjointSetTr...
TheAlgorithms/Python
graphs/minimum_spanning_tree_kruskal2.py
Python
mit
4,095
# 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 may ...
Azure/azure-sdk-for-python
sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/aio/operations/_policy_tracked_resources_operations.py
Python
mit
19,738
# -*- coding: utf-8 -*- # Generated by Django 1.9.4 on 2016-04-18 07:59 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('primus', '0006_auto_20160418_0959'), ] operations = [ migrations.AlterField(...
sighill/shade_app
primus/migrations/0007_auto_20160418_0959.py
Python
mit
457
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bikes_prediction.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
cheer021/BikesPrediction_DP
bikes_prediction/manage.py
Python
mit
259
# -*- coding: utf-8 -*- # Copyright (c) 2013–2015Molly White # # 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 use, copy, mod...
molly/Wikisource-to-LaTeX
core.py
Python
mit
3,449
"""Testing for ORM""" from unittest import TestCase import nose from nose.tools import eq_ from sets import Set from mdcorpus.orm import * class ORMTestCase(TestCase): def setUp(self): self.store = Store(create_database("sqlite:")) self.store.execute(MovieTitlesMetadata.CREATE_SQL) self...
sosuke-k/cornel-movie-dialogs-corpus-storm
mdcorpus/tests/test_orm.py
Python
mit
4,351
from ddt import ddt, data from django.test import TestCase from six.moves import mock from waldur_core.core import utils from waldur_core.structure import tasks from waldur_core.structure.tests import factories, models class TestDetectVMCoordinatesTask(TestCase): @mock.patch('requests.get') def test_task_se...
opennode/nodeconductor
waldur_core/structure/tests/unittests/test_tasks.py
Python
mit
2,443
#!/usr/bin/env python # encoding: utf-8 """ Make a grid of synths for a set of attenuations. 2015-04-30 - Created by Jonathan Sick """ import argparse import numpy as np from starfisher.pipeline import PipelineBase from androcmd.planes import BasicPhatPlanes from androcmd.phatpipeline import ( SolarZIsocs, Sola...
jonathansick/androcmd
scripts/dust_grid.py
Python
mit
2,095
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
lmazuel/azure-sdk-for-python
azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/application_gateway_http_listener_py3.py
Python
mit
3,718
# -*- coding: utf-8 -*- """ @file @brief Customer notebook exporters. """ import os from textwrap import indent from traitlets import default from traitlets.config import Config from jinja2 import DictLoader from nbconvert.exporters import RSTExporter from nbconvert.filters.pandoc import convert_pandoc def convert_pa...
sdpython/pyquickhelper
src/pyquickhelper/helpgen/notebook_exporter.py
Python
mit
4,770
# -*- coding: utf-8 -*- import scrapy from locations.items import GeojsonPointItem DAYS = [ 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su' ] class SparNoSpider(scrapy.Spider): name = "spar_no" allowed_domains = ["spar.no"] start_urls = ( 'https://spar.no/Finn-butikk/', ...
iandees/all-the-places
locations/spiders/spar_no.py
Python
mit
2,746
""" Controller for voting related requests. """ import webapp2 from models.vote import VoteHandler from models.vote_.cast_ballot import BallotHandler from models.vote_.view_results import ResultsHandler app = webapp2.WSGIApplication([ ('/vote', VoteHandler), ('/vote/cast-ballot', BallotHandler), ('/vote/...
rice-apps/rice-elections
src/controllers/vote.py
Python
mit
365
from galaxy.test.base.twilltestcase import TwillTestCase #from twilltestcase import TwillTestCase class EncodeTests(TwillTestCase): def test_00_first(self): # will run first due to its name """3B_GetEncodeData: Clearing history""" self.clear_history() def test_10_Encode_Data(self): ...
jmchilton/galaxy-central
galaxy/test/functional/test_3B_GetEncodeData.py
Python
mit
1,185
import click from bitshares.amount import Amount from .decorators import online, unlock from .main import main, config from .ui import print_tx @main.group() def htlc(): pass @htlc.command() @click.argument("to") @click.argument("amount") @click.argument("symbol") @click.option( "--type", type=click.Choice(...
xeroc/uptick
uptick/htlc.py
Python
mit
3,974
import os.path import requests import time from bs4 import BeautifulSoup from geotext import GeoText as gt from string import punctuation from collections import Counter import re import sys reload(sys) sys.setdefaultencoding("utf-8") threats = ['loss', 'fragmentation', 'hunting', 'poaching', 'fishing', 'overfishi...
andrewedstrom/cs638project
arkive table analysis/parse.py
Python
mit
5,243