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 pale.fields.string import StringField class TimestampField(StringField): """A field for timestamp strings.""" value_type = 'timestamp' # TODO - timestamp field rendering
Loudr/pale
pale/fields/timestamp.py
Python
mit
189
from nose.tools import * from Loggers import SearchLogger from TwitterSearchTools import * from DaoMocks import * from TwitterMocks import * from ObserverMocks import * import unittest class SearchTest(unittest.TestCase): def setUp(self): self.object = Search() self.redis = RedisDaoMock() ...
PainNarrativesLab/TwitterMining
tests/test_TwitterSearchTools.py
Python
mit
4,876
import sibling as alias class MyClass(alias.A.Inner): pass
east825/green-type
test/test_data/resolve/local/import_chain/main.py
Python
mit
64
#! /usr/bin/env python #-*-coding:utf-8-*- import BeautifulSoup import urllib2 import codecs import os URL='http://www.tetsudo.com/traffic/' html=urllib2.urlopen(URL).read() soup=BeautifulSoup.BeautifulSoup(html) f=codecs.open('Traininfopy.cache','w','utf-8') trableinfo=soup.findAll(id='hokai-1')[0].find('img').get('al...
HAYASAKA-Ryosuke/TrainInfo
traininfo.py
Python
mit
624
#!/usr/bin/env python from distutils.core import setup from version import __version__ setup(name='dmrg_helpers', version=__version__, description='Python helpers from our main DMRG code', long_description=open('README.md').read(), author='Ivan Gonzalez', author_email='iglpdc@gmail.com', url='https:...
iglpdc/dmrg_helpers
setup.py
Python
mit
912
# -*- coding:utf-8 -*- # Created by Vaayne at 2016/07/27 12:59 from . import view from flask import render_template @view.app_errorhandler(404) def page_not_found(e): return render_template('404.html'), 404 @view.app_errorhandler(500) def internet_server_error(e): return render_template('500.html'), 500
Vaayne/vaayne.com
app/views/error.py
Python
mit
318
from __future__ import division balance = 9999999 annualInterestRate = 0.18 min_pay = 10 def pay(m, min_pay): if m == 1: ub = (balance - min_pay) * (1 + annualInterestRate / 12) return ub else: last_ub = pay(m - 1, min_pay) ub = (last_ub - min_pay) * (1 + annualInterestRate / ...
fossilet/6.00x
week2/problemset2/ps2_2.py
Python
mit
470
import unittest import sys import os from Infrastructure.FileUtilities import FileUtilities from Infrastructure.TipsManager import TipsManager class TestsTipsManage(unittest.TestCase): @classmethod def setUpClass(cls): cls.fileUtilities = FileUtilities() def test_random_tip_from_file(self): ...
MobProgramming/MobTimer.Python
tests/Infrastructure/TipsManager/test_TipsManager.py
Python
mit
1,455
from Elements.G.Populators.Base.IElementPopulator import IElementPopulator class AllParametersListWithOneNamePopulator(IElementPopulator): def __init__(self, sectionName, templates, settingsObject): super(AllParametersListWithOneNamePopulator, self).__init__(sectionName, templates, settingsObject) self.separator ...
afronski/grammar-generator
grammar-generator/Elements/G/Populators/AllParametersListWithOneNamePopulator.py
Python
mit
1,335
from unittest import TestCase from dax.processor_graph import ProcessorGraph from dax import yaml_doc from dax.tests import unit_test_common_processor_yamls as yamls from dax.tests import unit_test_entity_common as common from dax.processors import AutoProcessor class TestLog: def __init__(self): self.w...
VUIIS/dax
dax/tests/unit_test_processor_graph.py
Python
mit
7,266
# 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-monitor/azure/mgmt/monitor/models/incident_py3.py
Python
mit
2,119
from kivy.logger import Logger ''' Mock for checking the connection. Set success to test ''' class Netcheck(): def __init__(self, prompt=None): if prompt is None: prompt = self._no_prompt self._prompt = prompt self.MOCK_RESULT=False self.MOCK_SETTINGS_RESULT=True ...
knappador/kivy-netcheck
src/netcheck/mockconn.py
Python
mit
1,385
import itertools def topological_order(graph): global current_label current_label = len(graph) global label_offset label_offset = -1 global ordered_graph ordered_graph = {} explored_nodes = [] for node in graph: if node not in explored_nodes: explored_nodes.extend(df...
Preston4tw/elearning
coursera/algo-pt1/week4/graph_primitives.py
Python
mit
3,909
from . import services def prep_rules(rules): prepped = [] for rule in rules: if rule['enabled']: prepped.append(prep_rule(rule)) return prepped def prep_rule(raw_rule): rule = dict(raw_rule) if rule['service'] != 'custom': proto, port = services.decode_service(rul...
Kromey/piroute
iptables/utils.py
Python
mit
808
import sys reload(sys) sys.setdefaultencoding("UTF8") import os import uuid from flask import * from flask.ext.socketio import SocketIO, emit from flask_socketio import join_room, leave_room import psycopg2 import psycopg2.extras app = Flask(__name__) app.config['SECRET_KEY'] = 'secret!' socketio = SocketIO(app) m...
cmpgamer/Sprint1
.~c9_invoke_HdX4pf.py
Python
mit
5,328
import logging import json import redis import sys import urllib import os from urlparse import urlparse from pylons import request, response, session, tmpl_context as c, url from pylons.decorators import jsonify from pylons.controllers.util import abort, redirect from mapofinnovation.lib.base import BaseController, r...
AnanseGroup/map-of-innovation
mapofinnovation/controllers/uifunc.py
Python
mit
2,555
#!/usr/bin/env python # -*- coding: utf-8 -*- # __BEGIN_LICENSE__ # Copyright (c) 2009-2013, United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. All # rights reserved. # # The NGT platform is licensed under the Apache License, Version 2.0 (the # "Lic...
sdrdis/iarpa_contest_submission
lib_exec/StereoPipeline/bin/lronac2mosaic.py
Python
mit
19,228
import pickle import unittest import numpy as np import scipy.sparse as sp from sklearn import linear_model, datasets, metrics from sklearn.base import clone from sklearn.linear_model import SGDClassifier, SGDRegressor from sklearn.preprocessing import LabelEncoder, scale, MinMaxScaler from sklearn.utils.testing impor...
DailyActie/Surrogate-Model
01-codes/scikit-learn-master/sklearn/linear_model/tests/test_sgd.py
Python
mit
44,262
import webtools import re class Trip(): """ Models a megabus trip.""" def __init__(self, data, number, mode, crawling_day): """ Initializes basic trip Data.""" self.data = data self.trip_number = number self.mode = mode self.day = crawling_day def pric...
dante092/Mega-Bus-Web-Crawler
megabus_request.py
Python
mit
8,077
#!/usr/bin/env python3 import calendar if __name__ == "__main__": for num in range(1, 13): month = calendar.month_name[num] print(f"{num:02} - {month}")
ammongit/scripts
print-months.py
Python
mit
175
import pygame as pg class Spritesheet: def __init__(self, filename, tile_size): self.sheet = pg.image.load(filename).convert_alpha() self.tile_size = tile_size def get_image(self, x, y, width, height): image = pg.Surface((width, height)) image.blit(self.sheet, (0, 0), (x, y, w...
kuroneko1996/cyberlab
spritesheet.py
Python
mit
869
#! /usr/bin/python #-*- coding:utf-8 -* __author__ = "Cedric Bonhomme" __version__ = "$Revision: 0.3 $" __date__ = "$Date: 2015/08/31$" __revision__ = "$Date: 2015/10/26 $" __copyright__ = "" __license__ = "" import sys import requests import json import pickle import clusters import list_clusters def recommend(use...
cedricbonhomme/k-means-clustering
recommend.py
Python
mit
2,926
""" WSGI config for django_shopfront project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJ...
rapilabs/django-shopfront
backend/django_shopfront/wsgi.py
Python
mit
410
from django.apps import AppConfig class ClothesConfig(AppConfig): name = 'clothes'
Meerkat007/Clothes-Shop-Website
server/clothes/apps.py
Python
mit
89
# -*- coding: utf-8 -*- """ MiniTwit ~~~~~~~~ A microblogging application written with Flask and sqlite3. :copyright: (c) 2010 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import time from sqlite3 import dbapi2 as sqlite3 from hashlib im...
HackingHabits/PersonalPasswordManager
packages/Flask/examples/minitwit/minitwit.py
Python
mit
8,424
from .rpc import * from .pcic import *
cfreundl/o3d3xx-python
o3d3xx/__init__.py
Python
mit
40
from django.apps import AppConfig class TestimonialsConfig(AppConfig): name = 'testimonials'
slavpetroff/sweetshop
backend/django/apps/testimonials/apps.py
Python
mit
99
#! /usr/bin/env python3 import numpy as np import sys def _quad_coeffs_hq(M, collocation_type, digits=20): if M == 1: x = np.array([0.0]) w = np.array([2.0]) elif collocation_type == "gauss_legendre": from sympy.integrals.quadrature import gauss_legendre x, w = gauss_legendre...
schreiberx/sweet
mule_local/python/mule_local/rexi/quadrature.py
Python
mit
2,629
from colossus.game import Route def test_route_step(): route = Route(100.0, 1) route.add_packet() dmg = route.update(10.0) assert dmg <= 0.0 dmg = 0.0 dmg += route.update(100000.0) dmg += route.update(100000.0) assert dmg > 0.0 def test_route_removal_of_packet_after_action(): route...
spectralflux/colossus
tests/test_route.py
Python
mit
458
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-09-25 01:43 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Accoun...
maxwallasaurus/arboretum
authentication/migrations 08-40-23-458/0001_initial 08-45-26-265.py
Python
mit
1,345
from .allow_origin import allow_origin_tween_factory # noqa from .api_headers import api_headers_tween_factory # noqa from .basic_auth import basic_auth_tween_factory # noqa
victorlin/pyramid-handy
pyramid_handy/tweens/__init__.py
Python
mit
177
import _plotly_utils.basevalidators class ValueValidator(_plotly_utils.basevalidators.StringValidator): def __init__( self, plotly_name="value", parent_name="volume.colorbar.tickformatstop", **kwargs ): super(ValueValidator, self).__init__( plotly_name=plotl...
plotly/python-api
packages/python/plotly/plotly/validators/volume/colorbar/tickformatstop/_value.py
Python
mit
497
"""MySQLdb Cursors This module implements Cursors of various types for MySQLdb. By default, MySQLdb uses the Cursor class. """ import re insert_values = re.compile(r"\svalues\s*(\(((?<!\\)'.*?\).*(?<!\\)?'|.)+?\))", re.IGNORECASE) from _mysql_exceptions import Warning, Error, InterfaceError, DataError, \ Databa...
carlgao/lenga
images/lenny64-peon/usr/share/python-support/python-mysqldb/MySQLdb/cursors.py
Python
mit
16,782
""" Twitter Most Followed Finding out top most followed accounts by a particular group of Twitter users such as the Hacker News community. For this exercise we consider @newsyc20 as our *source*, and @newsyc20 followers as the HNers, our *target group*. You can easily run the exercise for a different target group by ...
ducu/twitter-most-followed
main.py
Python
mit
3,521
import unittest from pathlib import Path from html_minifier import Minifier from html_minifier import DjangoMinifier class TestMinify(unittest.TestCase): ext_min = "_min" file_name = "base" _file = "{0}.html" location = "html" def setUp(self): path = Path(__file__).parent file_n...
Kaumer/html-minifier
test/test.py
Python
mit
999
# -*- coding: utf-8 -*- # from .common import * class AssignmentTest(TestCase): def test_assignment(self): context = Context() root = Node.add_root() var_def = VariableDefinition(name='K1') root.add_child(content_object=var_def) root = Node.objects.get(id=root.id) ...
dgk/django-business-logic
tests/test_assignment.py
Python
mit
1,797
# -*- coding: utf-8 -*- from . import exceptions from clare import common from clare.common import messaging from clare.common import retry class NopHandler(messaging.consumer.interfaces.IHandler): def handle(self, record): pass def __repr__(self): repr_ = '{}()' return repr_.format...
dnguyen0304/clare
clare/clare/application/download_bot/handlers.py
Python
mit
1,172
"""Convenient parallelization of higher order functions. This module provides two helper functions, with appropriate fallbacks on Python 2 and on systems lacking support for synchronization mechanisms: - map_multiprocess - map_multithread These helpers work like Python 3's map, with two differences: - They don't gu...
nataddrho/DigiCue-USB
Python3/src/venv/Lib/site-packages/pip/_internal/utils/parallel.py
Python
mit
3,327
# -*- coding: utf-8 -*- # Purpose: Xing(pystock 0.0.4a code list # Date: 2015-08-30 import sqlite3 from pystock_xingAPI import * import pandas as pd from datetime import datetime import time from time import gmtime, strftime xing = Xing() if xing.open("demo.ebestsec.co.kr", 20001, 1, 1, "insuyu", ...
3WiseMen/python
19. GetXingDayData/xingdb.py
Python
mit
2,589
#!/usr/bin/env python def get_db(db_name): from pymongo import MongoClient client = MongoClient('localhost:27017') db = client[db_name] return db def make_pipeline(): # complete the aggregation pipeline match = {"$match": {"created": {"$exists": 1}}} group = {"$group": {"_id": "$created....
MayukhSobo/OpenStreetMap
test/test.py
Python
mit
799
from gensim import corpora, models, similarities import json import os # from cpython cimport PyCObject_AsVoidPtr # from scipy.linalg.blas import cblasfrom scipy.linalg.blas import cblas # ctypedef void (*saxpy_ptr) (const int *N, const float *alpha, const float *X, const int *incX, float *Y, const int *incY) nogil ...
cesc-park/CRCN
doc2vec_training.py
Python
mit
1,588
""" Find the value function associated with a policy. Based on Sutton & Barto, 1998. Matthew Alger, 2015 matthew.alger@anu.edu.au """ import numpy as np def value(policy, n_states, transition_probabilities, reward, discount, threshold=1e-2): """ Find the value function associa...
crslab/Inverse-Reinforcement-Learning
irl/value_iteration.py
Python
mit
4,821
import datetime import patroni.zookeeper import psycopg2 import subprocess import sys import time import unittest import yaml from mock import Mock, patch from patroni.api import RestApiServer from patroni.dcs import Cluster, Member, Leader from patroni.etcd import Etcd from patroni.exceptions import DCSError, Postgre...
sean-/patroni
tests/test_patroni.py
Python
mit
7,260
import _plotly_utils.basevalidators class SurfacecolorValidator(_plotly_utils.basevalidators.DataArrayValidator): def __init__(self, plotly_name="surfacecolor", parent_name="surface", **kwargs): super(SurfacecolorValidator, self).__init__( plotly_name=plotly_name, parent_name=paren...
plotly/python-api
packages/python/plotly/plotly/validators/surface/_surfacecolor.py
Python
mit
459
from collections import defaultdict, namedtuple import regex as re from gary import ignore_parens_list Record = namedtuple('Record', ['dob', 'eng', 'pos', 'phn']) @ignore_parens_list def split_words(text:str) -> list: return re.split('\s*;\s*', text) class ShParser: def __init__(self, text): self....
longnow/panlex-tools
libpython/gary/sh_parser.py
Python
mit
1,521
import numpy as np import pandas as pd from emulator.env_factor import get_factors turnovers = pd.read_excel('emulator/SH50.xls', sheetname='total_turnover') opens = pd.read_excel('emulator/SH50.xls', sheetname='open') closes = pd.read_excel('emulator/SH50.xls', sheetname='close') highs = pd.read_excel('emulator/SH50....
AlphaSmartDog/DeepLearningNotes
Note-6 A3CNet/Note-6.3 强化学习选股-SH50指数增强/emulator/env_market.py
Python
mit
2,528
""" quilt.Quilter Object to stitch a page based on quilt {: .lead} 1. use [quilt file](#quiltfile) to create quilt 2. replace all [patch files](#patchfile) by matching `patch#id` tags in quilt with a `patch/id.html` file 3. parses [page file](#pagefile) using the following format: 1. `key: value` page variable *h...
tmthydvnprt/quilt
quilt/Quilter.py
Python
mit
18,778
import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier import xgboost as xgb from keras.models import Sequential from keras.layers.core import Dense, Activation, Dropout from keras.layers.advanced_activations import PReLU from keras.models import Sequential from keras.utils import np...
korbonits/kaggle-tau-to-three-muons
ensemble_model.py
Python
mit
5,133
import _plotly_utils.basevalidators class FamilyValidator(_plotly_utils.basevalidators.StringValidator): def __init__( self, plotly_name="family", parent_name="funnelarea.title.font", **kwargs ): super(FamilyValidator, self).__init__( plotly_name=plotly_name, parent_nam...
plotly/python-api
packages/python/plotly/plotly/validators/funnelarea/title/font/_family.py
Python
mit
616
""" Publish a new version: Change version in package __init__ file Change version in this setup file pull __init__ and setup Execute: $ git tag X.Y.Z -m "Release X.Y.Z" $ git push --tags $ pip install --upgrade twine wheel $ python setup.py sdist bdist_wheel --universal $ twine upload dist/* """ import codecs import os...
fredericklussier/ObservablePy
setup.py
Python
mit
1,377
# -*- coding: utf-8 -*- import re import sympy from colorama import Fore from plugin import alias, plugin @alias('calc', 'evaluate') @plugin('calculate') def calculate(jarvis, s): """ Jarvis will get your calculations done! -- Example: calculate 3 + 5 """ tempt = s.replace(" ", "") i...
sukeesh/Jarvis
jarviscli/plugins/evaluator.py
Python
mit
9,968
''' pickle Ä£¿éͬ marshal Ä£¿éÏàͬ, ½«Êý¾ÝÁ¬Ðø»¯, ±ãÓÚ±£´æ´«Êä. Ëü±È marshal ÒªÂýһЩ, µ«Ëü¿ÉÒÔ´¦ÀíÀàʵÀý, ¹²ÏíµÄÔªËØ, ÒÔ¼°µÝ¹éÊý¾Ý½á¹¹µÈ. ''' import pickle value = ( "this is a string", [1, 2, 3, 4], ("more tuples", 1.0, 2.3, 4.5), "this is yet another string" ) data = pickle.dumps(value) # interme...
iamweilee/pylearn
pickle-example-1.py
Python
mit
509
#!/usr/bin/env python # -*- coding: utf-8 -*- from pystructure.pystructure import PYStructureVisitor class TestPYStructureVisitor(object): def setup_class(self): self.visitor = PYStructureVisitor() def test_build_func_structure(self): func_name = "foo" args_list = [] default_...
hanks/pystructure
tests/test_pystructure.py
Python
mit
2,898
from ._testutil import GibsonTest, run_until_complete from aiogibson import errors class CommandsTest(GibsonTest): """Gibson high level commands. :see: http://gibson-db.in/commands/ """ @run_until_complete def test_set(self): key, value = b'test:set', b'bar' response = yield from...
jettify/aiogibson
tests/test_commands.py
Python
mit
10,025
""" Django settings for dota_world 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...
zubair-arbi/dota-world
dota_world/settings.py
Python
mit
8,644
from django.db import models from django.contrib.auth.models import AbstractUser class User(AbstractUser): phone_number = models.CharField(max_length=15)
theju/dtwt
accounts/models.py
Python
mit
160
from __future__ import absolute_import, print_function, unicode_literals import unittest from choicer.test import core_tests def suite(): return unittest.TestSuite([ unittest.TestLoader().loadTestsFromTestCase(core_tests.ChoicerTests), ]) def run_all(): return unittest.TextTestRunner(verbosity=2...
tonimichel/django-choicer
choicer/test/__init__.py
Python
mit
335
""" Description : This file implements the log key extraction algorithm for log parsing Author : LogPAI team License : MIT """ import math from datetime import datetime from ..logmatch import regexmatch import re import os import sys import pandas as pd import hashlib import numpy as np SAVED...
logpai/logparser
logparser/LKE/LKE.py
Python
mit
21,195
# -*- coding: utf-8 -*- """ @name: find_fold_points.py @vers: 0.1 @author: Douglas Thor @created: Sun Jun 29 17:03:12 2014 @modified: Sun Jun 29 17:03:12 2014 @descr: Returns the fold points - where code gets indented and dedented - of a .py file. """...
dougthor42/CodeSort
codesort/find_fold_points.py
Python
mit
2,335
from flask import Flask, request, abort import json from ReverseProxied import ReverseProxied app = Flask(__name__) app.wsgi_app = ReverseProxied(app.wsgi_app) with open("intervals.json") as b: data = json.load(b) def intersects(interval, min_age, max_age): if interval["lag"] <= min_age <= interval["eag"]: ...
tetherless-world/dtdi-geologic-time-resolver
app.py
Python
mit
1,824
import random import time from Pyro5.api import expose, Daemon, locate_ns @expose class StockMarket(object): def __init__(self, marketname, symbols): self._name = marketname self._symbols = symbols def quotes(self): while True: symbol = random.choice(self.symbols) ...
irmen/Pyro5
examples/stockquotes/phase2/stockmarket.py
Python
mit
1,133
""" `notipyserver` - User-Notification-Framework server Provides test cases for the notipyserver recipientsmanager module. :copyright: (c) by Michael Imfeld :license: MIT, see LICENSE for details """ from mock import patch from nose.tools import assert_equal, assert_raises from notipyserver.recipientsmanager import ...
michaelimfeld/notipy-server
tests/unit/test_recipientsmanager.py
Python
mit
833
import sys def ruler_algorithm(n1, n2): """ Ruler Algorithm yani Cetvel Algoritmasi. Verilen aralik ikiye bolundugunde her alt parca da devamli olarak ikiye bolunmekte. Alt parcalarin uzunlugu onceden verilen degere erisinceye kadar devam edilir. """ dot = (n1+n2)/2 if abs((n2-n1)) < 2: return print("[%s]" %...
aligoren/pyalgo
ruler_algorithm.py
Python
mit
1,641
# -*- coding: utf-8 -*- from app import app import os if __name__ == "__main__": port = int(os.environ.get('PORT', 33507)) app.run(port=port, debug = True)
jorgegarciadev/estacaidooque
run.py
Python
mit
166
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2017-10-29 18:57:52 # @Author : jingray (lionel_jing@163.com) # @Link : http://www.jianshu.com/u/01fb0364467d # @Version : $Id$ def zeroes(height, width): """ Creates a matrix of zeroes. """ g = [[0.0 for _ in range(width)] for __ in range(height...
jingr1/SelfDrivingCar
matrix.py
Python
mit
2,263
#!/usr/bin/env python3 # -*- coding: cp1252 -*- # created on May 21, 2014 by baloan """ Launch to orbit (with atmosphere) """ from threading import Thread import krpc from toolkit import ksp from toolkit import launch from toolkit import system from toolkit import warp from vessels import surveyor, ...
baloan/mt-krpc
krpc/lko.py
Python
mit
899
""" ------------------------------------------------------------------------- AIOpening - special.py useful functions created: 2017/09/01 in PyCharm (c) 2017 Sven - ducandu GmbH ------------------------------------------------------------------------- """ import numpy as np import tensorflow as tf def we...
ducandu/aiopening
aiopening/misc/special.py
Python
mit
1,167
from matplotlib import pyplot as plt from matplotlib import cm from os import path import numpy as np import cv2 import pandas as pd from math import exp, pi, sqrt import mahotas as mh from numbapro import vectorize def show_images(images,titles=None, scale=1.3): """Display a list of images""" n_ims = len(im...
fierval/retina
DiabeticRetinopathy/Refactoring/kobra/imaging.py
Python
mit
6,612
""" Test for single criteria EI example. """ import logging import os.path import random import unittest from numpy import pi from openmdao.examples.expected_improvement.single_objective_ei import Analysis from openmdao.main.api import set_as_top from pyevolve import Selectors class SingleObjectiveEITest(unittest.Te...
DailyActie/Surrogate-Model
01-codes/OpenMDAO-Framework-dev/examples/openmdao.examples.expected_improvement/openmdao/examples/expected_improvement/test/test_single_objective_ei.py
Python
mit
1,872
# -*- coding: utf-8 -*- from stash.tests.stashtest import StashTestCase class CowsayTests(StashTestCase): """tests for cowsay""" def test_help(self): """test help output""" output = self.run_command("cowsay --help", exitcode=0) self.assertIn("cowsay", output) self.assertIn("--...
ywangd/stash
tests/misc/test_cowsay.py
Python
mit
2,613
from toee import * import tpactions def GetActionName(): return "Divine Spell Power" def GetActionDefinitionFlags(): return D20ADF_None def GetTargetingClassification(): return D20TC_Target0 def GetActionCostType(): return D20ACT_NULL def AddToSequence(d20action, action_seq, tb_status): action_seq.add_action...
GrognardsFromHell/TemplePlus
tpdatasrc/tpgamefiles/rules/d20_actions/action02603_feat_divine_spell_power.py
Python
mit
346
__version__ = '0.0.1' __title__ = 'vigenere' __description__ = 'Enciphering and deciphering using the Vigenère algorithm.' __uri__ = 'https://github.com/kristofclaes/vigenere' __author__ = 'Kristof Claes' __email__ = 'kristof.c@gmail.com' __license__ = 'MIT'
kristofclaes/vigenere
src/vigenere/__init__.py
Python
mit
262
from lxml import etree from healthvaultlib.utils.xmlutils import XmlUtils from healthvaultlib.itemtypes.healthrecorditem import HealthRecordItem class Medication(HealthRecordItem): def __init__(self, thing_xml=None): super(Medication, self).__init__() self.type_id = '30cafccc-047d-4288-94ef-6435...
rajeevs1992/pyhealthvault
src/healthvaultlib/itemtypes/medication.py
Python
mit
865
from . import views def register_in(router): router.register(r'openstack', views.OpenStackServiceViewSet, base_name='openstack') router.register(r'openstack-images', views.ImageViewSet, base_name='openstack-image') router.register(r'openstack-flavors', views.FlavorViewSet, base_name='openstack-flavor') ...
opennode/nodeconductor-openstack
src/waldur_openstack/openstack/urls.py
Python
mit
928
#!/usr/bin/env python # # grab audio from bag # import rosbag, rospy, numpy as np import struct import sys, os, cv2, glob from itertools import izip, repeat from subprocess import call import subprocess import argparse depth_to_string = {16 : 'int16', 32: 'int32', None: 'int32'} if __name__ == '__main__': parse...
daniilidis-group/bird_recording
src/bag2audio.py
Python
mit
4,375
import click import workflow from alfred_omni_api import AuthKeys, ConfigKeys, config from omni_api.trello import TrelloClient wf = workflow.Workflow() def get_password(key): try: return wf.get_password(key) except workflow.PasswordNotFound: return None def prompt_for_keychain(label, key,...
harveyr/alfred-omni-api
config.py
Python
mit
2,741
from microbit import * while True: if button_a.is_pressed(): pin1.write_digital(1) pin2.write_digital(1) pin0.write_digital(0) pin8.write_digital(0) display.show(Image.ARROW_N) elif button_b.is_pressed(): pin0.write_digital(1) pin8.write_digital(1) ...
nanuxbe/microbit-files
button_motor_control.py
Python
mit
571
import os import argparse keywords = {\ "mac":[\ "brew install",\ "brew cask install",\ "port install"\ ],\ "linux":[\ "apt-get install",\ "aptitude install",\ "yum install",\ "pacman install",\ "dpkg -i",\ "dnf install",\ "zypper in",\ "make install",\ "tar "\ ],\ "lua":[\ "luarocks ins...
AlexMili/WhatInstalled
whatinstalled.py
Python
mit
1,456
import gevent import pytest from raiden.api.python import RaidenAPI from raiden.tests.utils.detect_failure import raise_on_failure from raiden.tests.utils.events import ( raiden_events_search_for_item, search_for_item, wait_for_raiden_event, wait_for_state_change, ) from raiden.tests.utils.network impo...
hackaugusto/raiden
raiden/tests/integration/transfer/test_refundtransfer.py
Python
mit
24,174
from .scholar import *
toni-heittola/pelican-btex
scholar/__init__.py
Python
mit
23
""" For using OpenGL to render to an off screen buffer Ref: """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from OpenGL.GL import * from OpenGL.raw.GL.VERSION import GL_1_1,GL_1_2, GL_3_0 class OffScreenRender(...
mpvismer/gltk
offscreenrender.py
Python
mit
3,321
from python_homeautomation.web.Home_Auto import app def run_webserver(): app.run(host='0.0.0.0', port=9000, use_reloader=False)
sroehl/python_homeautomation
python_homeautomation/web/run.py
Python
mit
134
import pytest pytestmark = pytest.mark.page('font.html') class TestFont(object): def test_finds_the_font_element(self, browser): assert browser.font(index=0).exists def test_knows_about_the_color_attribute(self, browser): assert browser.font(index=0).color == '#ff00ff' def test_knows_ab...
lmtierney/watir-snake
tests/browser/elements/font_tests.py
Python
mit
622
#!/usr/bin/env python3 import os import logging import download_table_pages import download_notices import parse_notice_tweets import find_censored_tweets #logging.basicConfig(level=logging.DEBUG) for path in ['store/table_pages', 'store/notices', 'store/tweets']: if not os.path.exists(path): os.mkdirs(...
jacksingleton/twitter-censorship
main.py
Python
mit
623
# import copy # import sys import unittest from rdflib.graph import Graph # from rdflib.namespace import NamespaceManager from rdflib import ( # RDF, # RDFS, Namespace, # Variable, # Literal, # URIRef, # BNode ) from rdflib.util import first from FuXi.Rete.RuleStore import ( # N3RuleStore, Setup...
mpetyx/pyrif
3rdPartyLibraries/FuXi-master/test/additionalDLPTests.py
Python
mit
8,179
import json from pprint import pprint from sys import argv jsonFile = argv[1] with open(jsonFile) as data_file: data = json.load(data_file) for i in range(0, data['resultCount']): if data['results'][i]['trackCount'] != 1: print(data['results'][i]['collectionName']), data['results'][i]['releaseDate'] ...
mrricearoni/iTunesSearch
printRecentAlbums.py
Python
mit
357
import codecs import sys from setuptools import setup version_file = "schema.py" with open(version_file) as f: for line in f.read().split("\n"): if line.startswith("__version__ ="): version = eval(line.split("=", 1)[1]) break else: print("No __version__ attribute found ...
keleshev/schema
setup.py
Python
mit
1,562
''' Copyright (c) 2017 Vanessa Sochat, All Rights Reserved 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...
radinformatics/som-tools
som/cli/search.py
Python
mit
3,872
# -*- coding: UTF-8 -*- # # Copyright 2014 Cole Maclean """Tornado forms: simple form validation. Utility classes. """ import functools def decapitalize(string): """Turn MinLength into minLength for JS""" if not string: return string return "{0}{1}".format(string[:1].lower(), string[1:]) class E...
cole/tornforms
tornforms/utils.py
Python
mit
1,334
# This file is part of beets. # Copyright 2014, Adrian Sampson. # # 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, ...
bj-yinyan/beets
beetsplug/embedart.py
Python
mit
8,648
# ##### BEGIN GPL LICENSE BLOCK ##### # # JewelCraft jewelry design toolkit for Blender. # Copyright (C) 2015-2019 Mikhail Rachinskiy # # 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, eith...
mrachinskiy/blender-addon-jewelcraft
op_product_report/report_get.py
Python
mit
5,560
from neo.Storage.Common.DataCache import DataCache class CloneCache(DataCache): def __init__(self, innerCache): super(CloneCache, self).__init__() self.innerCache = innerCache def AddInternal(self, key, value): self.innerCache.Add(key, value) def DeleteInternal(self, key): ...
hal0x2328/neo-python
neo/Storage/Common/CloneCache.py
Python
mit
828
import os import abc untyped_list = [] def high_complexity (arg): """High cyclomatic complexity.""" if arg == 0: print(0) elif arg == 1: print(1) elif arg == 2: print(2) elif arg == 3: print(3) elif arg == 4: print(4) elif arg == 5: print(5)...
cemsbr/yala
tests_data/fake_code.py
Python
mit
845
"""Utils for time travel testings.""" def _t(rel=0.0): """Return an absolute time from the relative time given. The minimal allowed time in windows is 86400 seconds, for some reason. In stead of doing the arithmetic in the tests themselves, this function should be used. The value `86400` is expo...
snudler6/time-travel
src/tests/utils.py
Python
mit
492
import os import io import sys import time import threading import struct import pickle import tempfile import shutil import types from threading import Thread from Queue import Queue from multiprocessing import cpu_count from mapping import DetMap2 import dbg import util import services import translators from blob...
UWNetworksLab/metasync
metasync/metasyncAPI.py
Python
mit
48,287
""" Caching tests :Author: Jonathan Karr <jonrkarr@gmail.com> :Date: 2018-03-31 :Copyright: 2018, Karr Lab :License: MIT """ import capturer import collections import os import shutil import tempfile import time import unittest import wc_utils.cache class CacheTestCase(unittest.TestCase): def setUp(self): ...
KarrLab/wc_utils
tests/test_cache.py
Python
mit
16,671
"""Solvebio DatasetField API Resource""" from .solveobject import convert_to_solve_object from .apiresource import CreateableAPIResource from .apiresource import ListableAPIResource from .apiresource import UpdateableAPIResource from .apiresource import DeletableAPIResource class DatasetField(CreateableAPIResource, ...
solvebio/solvebio-python
solvebio/resource/datasetfield.py
Python
mit
876
# Linked List Utils - LIFO #Interface required: # # Linked List class must have attributes: # - lltail (tail node linker) # - llhead (head node linker) # # Node class must have attributes: # - llprev (previous node linker) # - llnext (next node linker) # Node class must have methods (for debug): # __in...
AQuadroTeam/CellsCycle
CellCycle/MemoryModule/LinkedList.py
Python
mit
3,571
import math import random def test(): tmp1 = [] tmp2 = [] print('build') for i in xrange(1024): tmp1.append(chr(int(math.floor(random.random() * 256)))) tmp1 = ''.join(tmp1) for i in xrange(1024): tmp2.append(tmp1) tmp2 = ''.join(tmp2) print(len(tmp2)) print('run') for i in xrange(5000): res = tmp2.e...
tassmjau/duktape
tests/perf/test-hex-encode.py
Python
mit
341
import os.path import tempfile from time import time from streaming_form_data import StreamingFormDataParser from streaming_form_data.targets import FileTarget, ValueTarget from tornado.ioloop import IOLoop from tornado.web import Application, RequestHandler, stream_request_body one_hundred_gb = 100 * 1024 * 1024 * ...
siddhantgoel/streaming-form-data
examples/tornado/stream_request_body.py
Python
mit
1,487