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 urllib2 import ( urlopen, HTTPError, URLError, ) BASEURL = 'http://169.254.169.254/' DEFAULT_TIMEOUT = 2 DEFAULT_API_VERSION = 'latest' class MetadataError(Exception): pass def path(path=None, api_version=DEFAULT_API_VERSION, timeout=DEFAULT_TIMEOUT): if not api_version: api_versi...
slank/awsmeta
awsmeta/metadata.py
Python
mit
1,422
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import pytest # pylint: disable=attribute-defined-outside-init class TestOutput(object): @pytest.fixture(autouse=True) def init(self, ssh_audit): self.Output = ssh_audit.Output self.OutputBuffer = ssh_audit.OutputBuffer def t...
arthepsy/ssh-audit
test/test_output.py
Python
mit
4,631
""" This example opens the connection in async mode (does not work properly in Python 2.7). """ import os import time from msl.equipment import ( EquipmentRecord, ConnectionRecord, Backend, ) record = EquipmentRecord( manufacturer='Pico Technology', model='5244B', # update for your PicoScope ...
MSLNZ/msl-equipment
msl/examples/equipment/picotech/picoscope/open_unit_async.py
Python
mit
1,130
from collections import OrderedDict import csv,re,sys # returns an ordered dict[int,list[int]] def load_from_csv_file(path_to_file): # ordered dict so as to keep the same order and avoid 'surprises' data = OrderedDict() with open(path_to_file,'r') as csvfile: reader = csv.reader(csvfile,delimiter=';') for ro...
queirozfcom/vector_space_retrieval
vsr/common/helpers/results.py
Python
mit
1,477
"""Microscoper is a wrapper around bioformats using a forked python-bioformats to extract the raw images from Olympus IX83 CellSense .vsi format, into a more commonly used TIFF format. Images are bundled together according to their channels. This code is used internally in SCB Lab, TCIS, TIFR-H. You're free to modify...
pskeshu/microscoper
microscoper/io.py
Python
mit
6,962
# Generated by Django 3.1 on 2020-08-25 12:15 import django.db.models.deletion from django.db import migrations, models import s3upload.fields class Migration(migrations.Migration): initial = True dependencies = [] operations = [ migrations.CreateModel( name="Cat", fie...
yunojuno/django-s3-upload
example/migrations/0001_initial.py
Python
mit
1,676
from outsourcer import Code from . import utils from .base import Expression from .constants import BREAK, POS, RESULT, STATUS class Sep(Expression): num_blocks = 2 def __init__( self, expr, separator, discard_separators=True, allow_trailer=False, ...
jvs/sourcer
sourcer/expressions/sep.py
Python
mit
2,062
#!/usr/bin/env python3 """JSON data parser for snippet crawler""" from BaseLogger import BaseLogger from DatabaseAccessor import DatabaseAccessor from bs4 import BeautifulSoup from config import config_queue_page, config_idle_sleep, config_parse_domain, config_parse_process from contextlib import closing from datetime...
vejuhust/snippet-crawler
Parser.py
Python
mit
3,773
from flask import Flask import numerals app = Flask("Numerical converter") @app.route("/") def home(): return "Hello from converter" @app.route("/<arabic>/roman") def to_roman(arabic): print("Converting {} to roman".format(arabic)) converted = numerals.convert_arabic_to_roman(int(arabic)) print("Co...
takemyoxygen/playground
py/numerals/server.py
Python
mit
647
import os import datetime def exit(): os._exit(0) def GetTimeString(m = -1): if m==0: s1 = datetime.datetime.now().strftime("%Y%m%d%H%M%S") else: s1 = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") return s1 def MakeDir(directory): if not os.path.exists(directory): os....
dalek7/umbrella
Python/DDUtil.py
Python
mit
339
from pymongo import MongoClient from dalmongo import configuration # get the instance of MongoDB client client = MongoClient(configuration.MONGODB_HOST, configuration.MONGODB_PORT) # get the main application database db = getattr(client, configuration.MONGODB_NAME)
RobertoPrevato/flask-three-template
dalmongo/__init__.py
Python
mit
267
#!/usr/bin/env python import sys, json, psycopg2, argparse parser = argparse.ArgumentParser(description='Imports word data into the taboo database.') parser.add_argument('--verified', dest='verified', action='store_true', help='include if these words are verified as good quality') parser.add_argument('--source', dest=...
jbowens/taboo
wordgen/data-importer.py
Python
mit
1,307
''' Copyleft Feb 11, 2017 Arya Iranmehr, PhD Student, Bafna Lab, UC San Diego, Email: airanmehr@gmail.com ''' import numpy as np; np.set_printoptions(linewidth=200, precision=5, suppress=True) import pandas as pd; pd.options.display.max_rows = 20; pd.options.display.expand_frame_repr = False import pylab as plt; imp...
airanmehr/bio
Scripts/KyrgysHAPH/GenomeAFS.py
Python
mit
1,365
#!/usr/bin/env python3 import rainbow import hashlib import string import time import random """SHA-256 hash function Precondition: Input plaintext as string Postcondition: Returns hash as string """ def sha256(plaintext): return hashlib.sha256(bytes(plaintext, 'utf-8')).hexdigest() """Returns a reduction function...
clu8/RainbowTable
crack.py
Python
mit
2,202
# Copyright (C) 2010-2011 Richard Lincoln # # 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...
rwl/PyCIM
CIM15/CDPSM/Balanced/IEC61970/Wires/EnergyConsumer.py
Python
mit
4,290
# -*- coding: utf-8 -*- """ Production settings file for project 'project' """ from project.settings import * DEBUG = False SITE_DOMAIN = 'sveetch.github.io/Sveetoy' # Directory where all stuff will be builded PUBLISH_DIR = os.path.join(PROJECT_DIR, '../docs') # Path where will be moved all the static files, usually...
sveetch/Sveetoy
project/githubpages_settings.py
Python
mit
428
from disco.core import Job from disco.worker.task_io import task_input_stream import hustle import hustle.core import hustle.core.marble from hustle.core.marble import Marble, Column, Aggregation from functools import partial from hustle.core.pipeworker import HustleStage import sys SPLIT = "split" GROUP_ALL = "group_...
txiner/db-xiner
hustle/core/pipeline.py
Python
mit
19,643
import unittest import os import subprocess from test.stub_config import StubConfig, StubConfigOnStubProject from test.stub_environment import StubEnvironment from test.stub_stdout import StubStdout from googkit.commands.update_deps import UpdateDepsCommand from googkit.compat.unittest import mock class TestUpdateD...
googkit/googkit
test/commands/test_update_deps.py
Python
mit
4,284
"""Context processors, these get called and add things to template contexts""" from django.conf import settings def analytics_and_ads(request): """ Adds the google analytics code to the context """ out = {} if request.user.is_authenticated() and request.user.settings.no_analytics: out["analyti...
RossBrunton/BMAT
bmat/context_processors.py
Python
mit
786
# jsb socket related plugins # # """ this package contains all the socket related plugins. """ import os (f, tail) = os.path.split(__file__) __all__ = [] for i in os.listdir(f): if i.endswith('.py'): __all__.append(i[:-3]) elif os.path.isdir(f + os.sep + i) and not i.startswith('.'): __all__...
melmothx/jsonbot
jsb/plugs/socket/__init__.py
Python
mit
406
import subprocess def runBash(cmd): p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) out = p.stdout.read().strip() return out
chasemp/sup
suplib/run.py
Python
mit
152
from django.apps import AppConfig class BattlenetclientConfig(AppConfig): name = 'battlenetclient'
maksimbulva/sc2streamhelper_info
battlenetclient/apps.py
Python
mit
105
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # PEP 8 check with Pylint """Word to pinyin. """ from numpy import mat, zeros, where from pypinyin import pinyin, lazy_pinyin # from .mytools import time_me def sum_cosine(matrix, threshold): """Calculate the parameters of the semantic Jaccard model based on...
Decalogue/chat
chat/word2pinyin.py
Python
mit
4,070
###################################################################### # # Copyright (C) 2013 # Associated Universities, Inc. Washington DC, USA, # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published by # the Free Software Fo...
e-koch/VLA_Lband
16B/pipeline4.7.1_custom/EVLA_pipe_fluxgains.py
Python
mit
6,065
from setuptools import setup setup( name="python-cmr", version="0.4.1", license="MIT", url="https://github.com/jddeal/python-cmr", description="Python wrapper to the NASA Common Metadata Repository (CMR) API.", long_description=open("README.rst").read(), author="Justin Deal, Matt Isnor", ...
jddeal/python-cmr
setup.py
Python
mit
455
import wx # type: ignore from gooey.gui import formatters from gooey.gui.components.widgets.bases import TextContainer from gooey.python_bindings import types as t class Slider(TextContainer): """ An integer input field """ widget_class = wx.Slider def getWidget(self, *args, **options): ...
chriskiehl/Gooey
gooey/gui/components/widgets/slider.py
Python
mit
1,260
import kronos import random @kronos.register('0 0 * * *') def complain(): complaints = [ "I forgot to migrate our applications's cron jobs to our new server! Darn!", "I'm out of complaints! Damnit!" ] print random.choice(complaints)
Weatherlyzer/weatherlyzer
base/cron.py
Python
mit
264
# # IIT Kharagpur - Hall Management System # System to manage Halls of residences, Warden grant requests, student complaints # hall worker attendances and salary payments # # MIT License # """ @ authors: Madhav Datt, Avikalp Srivastava """ from ..database import db_func as db from ..database import password_validatio...
madhav-datt/kgp-hms
src/workers/mess_manager.py
Python
mit
2,480
"""Parent class and utility class for producing a scansion pattern for a line of Latin verse. Some useful methods * Perform a conservative i to j transformation * Performs elisions * Accents vowels by position * Breaks the line into a list of syllables by calling a Syllabifier class which may be injected into this cl...
D-K-E/cltk
src/cltk/prosody/lat/verse_scanner.py
Python
mit
18,030
from concurrency.get_websites import get_number_of_links import time # Run get_number_of_links and compare it to a serial version # stub out load_url with a sleep function so the time is always the same # Show that the concurrent version takes less time than the serial import unittest from unittest.mock import patch...
b-ritter/python-notes
concurrency/tests_integration/test_collection_times.py
Python
mit
1,528
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fiveLessons.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
rednerrus/fiveLessons
manage.py
Python
mit
254
#!/usr/bin/env python import argparse import json import time import logging from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTShadowClient import RPi.GPIO as GPIO parser = argparse.ArgumentParser(description='Lightbulb control unit.') parser.add_argument('-e', '--endpoint', required=True, help='The AWS Iot endpoint.') ...
stephenjelfs/aws-iot-gddev2016
controlUnit.py
Python
mit
3,371
# coding: utf-8 import threading import time from datetime import datetime from flask import Flask from influxdb import InfluxDBClient from oslo_service import periodic_task from oslo_config import cfg from oslo_log import log from oslo_service import service from keystoneauth1.identity import v3 from keystoneauth1...
syunkitada/openstack-helm
openstack/lib/k8s_openstack_monitor_manager.py
Python
mit
6,662
# Imports from django.conf.urls import url from .models import OurFoto from .views import HomeFoto, ShowFoto, DeleteFoto, AddFoto, \ EditFoto, SearchFoto # Urls for app urlpatterns = [ url(r'^$', HomeFoto.as_view(model = OurFoto), name = 'index'), url(r'^foto/(?P<pk>\d+)/$', ShowFoto.as_view(model = OurF...
Sergey19940808/OurFoto
repository_our_fotos/urls.py
Python
mit
671
from django.shortcuts import render, get_object_or_404 from django.http import HttpResponse from .models import * import requests import json user_id = '139169754@N02' api_key = '41dd3aff041c00c52febdef9786a9ca0' api_secret = '0f5a3b5047f760f7' def index(request): context = {} context['photos'] = [] method = '...
xurichard/mysite
photos/views.py
Python
mit
753
""" Tests for main.py """ import pathlib import main def test_get_id(): path = pathlib.Path("./nbs/chapters/00-Introduction-to-the-course.ipynb") assert main.get_id(path) == "00" def test_get_id_with_no_id(): path = pathlib.Path("./nbs/other/Assessment.ipynb") assert main.get_id(path) == "assessment"...
drvinceknight/gt
test_main.py
Python
mit
1,347
class ClassC(object): FAMILY_INHERIT = {'a'} def c(self): return 'family_b: C' @classmethod def super_family(cls): return cls.module.super_family
IvIePhisto/Ancestration
tests/adopt_into_b.py
Python
mit
181
import logging import pprint from flask import jsonify, make_response, request from flask_restful import Resource, reqparse, fields, marshal from app.models import BucketList from app.common.db import save_record, delete_record from app.common.auth.authorize import login_required logger = logging.getLogger(__name__) ...
brayoh/bucket-list-api
app/resources/bucketlist.py
Python
mit
8,468
__author__ = 'tahsmith' from operator import add import os from cmake.context import Context from functools import reduce class VariableReference(object): def __init__(self, tokens): self.name = tokens[0] def evaluate(self, ctx): """ Perform any nested interpolations and give the va...
tahsmith/pycmake
cmake/arguments/argument.py
Python
mit
1,893
import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) TRIG = 35 ECHO = 38 GPIO.setup(TRIG,GPIO.OUT) GPIO.output(TRIG,0) GPIO.setup(ECHO,GPIO.IN) time.sleep(0.1) print ("Starting gesture recognition") try: # here you put your main loop or block of code while True: value_list = [] for x in xran...
s6joui/MirrorOS
system/core/gesture-recognizer/sensors_raw_left.py
Python
mit
1,155
# coding: utf-8 """Test the kernel specs webservice API.""" import errno import io import json import os import shutil pjoin = os.path.join import requests from IPython.kernel.kernelspec import NATIVE_KERNEL_NAME from IPython.html.utils import url_path_join from IPython.html.tests.launchnotebook import NotebookTest...
mattvonrocketstein/smash
smashlib/ipy3x/html/services/kernelspecs/tests/test_kernelspecs_api.py
Python
mit
4,428
# vim:fileencoding=utf-8:noet from __future__ import (unicode_literals, division, absolute_import, print_function) import sys import os from functools import partial from collections import namedtuple from time import sleep from platform import python_implementation from powerline.segments import shell, tmux, pdb, i...
bezhermoso/powerline
tests/test_segments.py
Python
mit
79,449
from corrdb.common.core import setup_app from flask.ext.testing import LiveServerTestCase import twill class DatabaseTest(LiveServerTestCase): def create_app(self): try: browser = twill.get_browser() browser.go("http://localhost:5200/") app = setup_app(__name__, 'corrdb...
wd15/corr
corr-db/corrdb/tests/test_backend.py
Python
mit
1,456
#coding:utf-8 import os import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(filename)s:%(lineno)s - %(funcName)20s() - %(name)s - %(levelname)s - %(message)s') logging.warning('load module:%s', __name__) user_path = os.path.expanduser("~/") dir_path = os.path.join(user_path, '.mywunder/') tr...
snowleung/mywunder
mywunder/myconfig.py
Python
mit
505
from .topology import Master, OVS, Netns, Link from collections import OrderedDict def direct_veth(disable_offloading=False, **settings): m = Master() ns1 = Netns('x-ns1').add_to(m) ns2 = Netns('x-ns2').add_to(m) Link.declare((ns1, '10.112.1.1'), (ns2, '10.112.1.2'), disable_offloading=disable_offlo...
serl/topoblocktest
lib/topologies.py
Python
mit
8,613
# This module should be imported from REPL, not run from command line. import socket import uos import network import uwebsocket import websocket_helper import _webrepl listen_s = None client_s = None def setup_conn(port, accept_handler): global listen_s listen_s = socket.socket() listen_s.setsockopt(sock...
trezor/micropython
extmod/webrepl/webrepl.py
Python
mit
2,184
# 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-datafactory/azure/mgmt/datafactory/models/self_hosted_integration_runtime_node.py
Python
mit
6,083
import sublime import sublime_plugin from isort.isort import SortImports class PysortCommand(sublime_plugin.TextCommand): def run(self, edit): old_content = self.view.substr(sublime.Region(0, self.view.size())) new_content = SortImports(file_contents=old_content).output self.view.replace(...
turbidsoul/isort
sort.py
Python
mit
556
# coding=utf-8 r""" This code was generated by \ / _ _ _| _ _ | (_)\/(_)(_|\/| |(/_ v1.0.0 / / """ from tests import IntegrationTestCase from tests.holodeck import Request from twilio.base.exceptions import TwilioException from twilio.http.response import Response class ConnectAppTestCase(Integr...
tysonholub/twilio-python
tests/integration/api/v2010/account/test_connect_app.py
Python
mit
7,437
""" Import prescribing data from CSV files into SQLite """ from collections import namedtuple import csv from itertools import groupby import logging import os import sqlite3 import gzip import heapq from matrixstore.matrix_ops import sparse_matrix, finalise_matrix from matrixstore.serializer import serialize_compress...
ebmdatalab/openprescribing
openprescribing/matrixstore/build/import_prescribing.py
Python
mit
7,057
__author__ = 'jdaniel' from GaiaSolve.model import Model class ZDT2(Model): def __init__(self): super(ZDT2, self).__init__() def evaluate(self): g = 1.0 + 9.0*sum(self.x[1:])/(len(self.x) - 1) f1 = self.x[0] f2 = g*(1.0 - (f1/g)**2) self.obj = [f1, f2] self.eq...
jldaniel/Gaia
Models/zdt2.py
Python
mit
1,190
# -*- coding: utf-8 -*- import keyring from ironworks.database import mDb, db app = None rundir = None datadir = None logger = None webroot = "" log_list = [] log_file = "" commits_behind = 0 latest_commit = None current_commit = None commits_compare_url = "" use_git = False first_run = 0 threads = [] host = '0.0.0.0'...
hephaestus9/Ironworks
ironworks/serverTools.py
Python
mit
6,472
# MIT License # # Copyright (c) 2020-2021 CNRS # # 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, pu...
pyannote/pyannote-audio
pyannote/audio/tasks/segmentation/speaker_tracking.py
Python
mit
5,325
from django import forms from lists.models import Item EMPTY_LIST_ERROR = "You can't have an empty list item" class ItemForm(forms.models.ModelForm): class Meta: model = Item fields = ('text',) widgets = { 'text': forms.fields.TextInput(attrs={ 'placeholder': 'Enter a to-do item', 'class': 'form...
rmelchorv/TDD-Cuervos
lists/forms.py
Python
mit
435
from crpyto_tool.libs.finite_field_op import FiniteFieldNumber if __name__ == '__main__': magical_number = FiniteFieldNumber(FiniteFieldNumber.magical_number, False) print 'p(x): ' + str(magical_number) number2 = FiniteFieldNumber('0') number3 = FiniteFieldNumber('1000110') print 'Q5-(1):' + str(n...
YcheLanguageStudio/PythonStudy
crpytography/tests/test_finite_field.py
Python
mit
675
#! /usr/bin/env python # -*- encoding: utf-8 -*- # Michel Mooij, michel.mooij7@gmail.com """ Tool Description ================ This module provides a waf wrapper (i.e. waftool) around the C/C++ source code checking tool 'cppcheck'. See http://cppcheck.sourceforge.net/ for more information on the cppcheck tool itself...
michelm/beehive
waftools/cppcheck.py
Python
mit
16,204
import win32api import os import sys import subprocess import logging from itertools import izip_longest #itertools recipe def grouper(n, iterable, fillvalue=None): "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx" args = [iter(iterable)] * n return izip_longest(fillvalue=fillvalue, *args) def harddrive_enumer...
yoavfrancis/KeepItUp
KeepItUp/harddrive_enumerator.py
Python
mit
1,589
# coding=utf-8 import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), ".."))) from db.MysqlUtil import initMysql, execute, select, batchInsert, disconnect from common.JsonHelper import loadJsonConfig from api.tushareApi import getSimpleHistoryData from datetime import datetime, timedelta f...
zwffff2015/stock
task/GetStockHistoryInfoTask.py
Python
mit
7,619
# -*- coding: utf-8 -*- """ flask.ext.hippocket.tasks ~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2013 by Sean Vieira. :license: MIT, see LICENSE for more details. """ from flask import Blueprint, Markup, request, render_template from itertools import chain from os import path from pkgutil import walk_p...
svieira/Flask-HipPocket
flask_hippocket/tasks.py
Python
mit
3,301
a = "nabb jasj jjs, jjsajdhh kjkda jj" a1 = a.split(",") for i in range(0,len(a1)): print (len(a1[i].split()))
shakcho/Indic-language-ngram-viewer
demo.py
Python
mit
120
"""The tests for the analytics .""" from unittest.mock import patch from homeassistant.components.analytics.const import ANALYTICS_ENDPOINT_URL, DOMAIN from homeassistant.setup import async_setup_component MOCK_VERSION = "1970.1.0" async def test_setup(hass): """Test setup of the integration.""" assert awai...
rohitranjan1991/home-assistant
tests/components/analytics/test_init.py
Python
mit
1,428
# django-drf imports from rest_framework import serializers # app level imports from .models import Player, Team class PlayerSerializer(serializers.ModelSerializer): class Meta: model = Player fields = ( 'id', 'name', 'rating', 'teams', 'install_ts', 'update_ts' )...
manjitkumar/drf-url-filters
example_app/serializers.py
Python
mit
525
"""Clowder command line diff controller .. codeauthor:: Joe DeCapo <joe@polka.cat> """ import argparse import clowder.util.formatting as fmt from clowder.clowder_controller import CLOWDER_CONTROLLER, print_clowder_name, valid_clowder_yaml_required from clowder.config import Config from clowder.git.clowder_repo impo...
JrGoodle/clowder
clowder/cli/diff.py
Python
mit
1,529
import time from torba.server import util def sessions_lines(data): """A generator returning lines for a list of sessions. data is the return value of rpc_sessions().""" fmt = ('{:<6} {:<5} {:>17} {:>5} {:>5} {:>5} ' '{:>7} {:>7} {:>7} {:>7} {:>7} {:>9} {:>21}') yield fmt.format('ID', 'Fl...
lbryio/lbry
torba/torba/server/text.py
Python
mit
3,433
from kompromatron.core import app from kompromatron.views.base import base # app.register_blueprint(entities) # app.register_blueprint(relations) #app.register_blueprint(base)
pudo/kompromatron
kompromatron/web.py
Python
mit
177
import numpy as np def weighted_pick(weights): t = np.cumsum(weights) s = np.sum(weights) return(int(np.searchsorted(t, np.random.rand(1)*s))) def list_to_string(ascii_list): res = u"" for a in ascii_list: if a >= 0 and a < 256: res += unichr(a) return res
litoeknee/byteNet-tensorflow
utils.py
Python
mit
271
from __future__ import print_function f = open('inputs/input_01.txt') contents = f.read() print("Floor:", contents.count('(') - contents.count(')')) # Part Two change = {'(': 1, ')': -1} floor = 0 position = 1 for c in contents: if c in change: floor += change[c] if floor == -1: print("Basemen...
jjhelmus/adventofcode
day01.py
Python
mit
390
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-04-18 22:59 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('about', '0001_initial'), ] operations = [ migrations.RemoveField( model_...
Arlefreak/ApiArlefreak
about/migrations/0002_remove_entry_notes.py
Python
mit
377
""" Django settings for CatyHIS project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) im...
LyndonChin/CatyHIS
CatyHIS/settings.py
Python
mit
2,157
''' cloudelements: tests module. Meant for use with py.test. Organize tests into files, each named xxx_test.py Read more here: http://pytest.org/ Copyright 2015, LeadGenius Licensed under MIT '''
rsimba/cloudelements
tests/__init__.py
Python
mit
197
#!/usr/bin/env python2 ## # autosign # https://github.com/leosartaj/autosign.git # # copyright (c) 2014 sartaj singh # licensed under the mit license. ## import unittest import os, shutil import helper from autosign.main import removeSign, isSign from autosign.exce import UnsignedError class TestremoveSign(unittest...
leosartaj/autosign
tests/test_removeSign.py
Python
mit
1,228
from time import time from os import remove from matplotlib.image import imread import json import subprocess import numpy as np import matplotlib.pyplot as plt def time_a_function(program, args): start = time() subprocess.call([program] + [args]) end = time() return float(end - start) def clean...
sebasvega95/HPC-assignments
CUDA/grayscale/timing.py
Python
mit
2,425
import unittest import unittest.mock import functools from g1.asyncs import kernels from g1.operations.databases.bases import interfaces from g1.operations.databases.servers import connections # I am not sure why pylint cannot lint contextlib.asynccontextmanager # correctly; let us disable this check for now. # # py...
clchiou/garage
py/g1/operations/databases/servers/tests/test_connections.py
Python
mit
8,015
''' Animation ========= :class:`Animation` and :class:`AnimationTransition` are used to animate :class:`~kivy.uix.widget.Widget` properties. You must specify at least a property name and target value. To use an Animation, follow these steps: * Setup an Animation object * Use the Animation object on a Widget ...
darkopevec/kivy
kivy/animation.py
Python
mit
24,358
from django.http import HttpResponseRedirect, Http404 from django.contrib import auth from django.contrib.auth import get_user_model from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User @login_required def switch_user(request, username): if request.user.is_superu...
empty/django-switch-user
su/views.py
Python
mit
838
# -*- coding: utf-8 -*- # Copyright (c) 2010-2017 Tuukka Turto # # 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,...
tuturto/pyherc
src/pyherc/data/magic/spell.py
Python
mit
3,082
#!/usr/bin/env python2 """ COSMO TECHNICAL TESTSUITE General purpose script to compare two files containing tables Only lines with given table pattern are considered """ # built-in modules import os, sys, string # information __author__ = "Xavier Lapillonne" __maintainer__ = "xavier.lapillonne@meteoswiss.ch" ...
C2SM-RCM/testsuite
tools/comp_table.py
Python
mit
5,041
#!/usr/bin/env python import sys def parse_map_file(path): map_grid = [] # Create a two-dimensional list based on the input data with open(path, 'r') as f: width, height = map(int, f.readline().split()) for line in f: row = map(int, line.split()) map_grid.append(row...
baudm/sg-ski
sg-ski.py
Python
mit
3,012
import unittest import transaction import os import csv from pyramid import testing from thesis.models import DBSession from sqlalchemy import create_engine from thesis.models import ( Base, GriddedMappablePoint, Layer ) class TestGriddedMappableItem(unittest.TestCase): def setUp(self): s...
robertpyke/PyThesis
thesis/tests/gridded_mappable_point.py
Python
mit
6,740
import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as mcolors from matplotlib.colors import Normalize class MidpointNormalize(Normalize): def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False): self.midpoint = midpoint Normalize.__init__(self, vmin, vmax, cl...
cdiazbas/LMpyMilne
allplot.py
Python
mit
2,084
#!/usr/bin/env python import sys import argparse from .audio import create_tracks from .downloader import YouTube from .parser import parse_tracks_file from .prompt import wizard from .exceptions import WizardError def get_from_youtube(source): yt = YouTube(source) highest_bitrate = yt.audio_available.get('...
noahfx/lobster
lobster/__main__.py
Python
mit
3,384
# -*- coding: utf-8 -*- from .baserequest import BaseRequest from oandapyV20.types import TradeID, PriceValue from oandapyV20.definitions.orders import TimeInForce, OrderType class StopLossOrderRequest(BaseRequest): """create a StopLossOrderRequest. StopLossOrderRequest is used to build the body for a StopL...
hootnot/oanda-api-v20
oandapyV20/contrib/requests/stoplossorder.py
Python
mit
2,841
# Copyright (C) 2017-2018 Intel Corporation # # SPDX-License-Identifier: MIT import base_bs_erf import numba as nb from math import log, sqrt, exp, erf def black_scholes_numba_opt(price, strike, t, mr, sig_sig_two, vol, call, put): P = float( price [0] ) S = strike [0] T = t [0] a = ...
IntelPython/BlackScholes_bench
bs_erf_numba_guvec_par.py
Python
mit
1,146
#!/usr/bin/python import pyglet from pyglet.gl import * from pyglet.window import key import math import random window = pyglet.window.Window(fullscreen=True) pyglet.resource.path.append('./images') pyglet.resource.reindex() center_x = int(window.width/2) center_y = int(window.height/2) def center_anchor(img): ...
AnthonyBriggs/Python-101
hello_python_source_py3/chapter 09/ship-6-alien.py
Python
mit
9,407
def percDown(self,i): while (i * 2) <= self.currentSize: mc = self.minChild(i) if self.heapList[i] > self.heapList[mc]: tmp = self.heapList[i] self.heapList[i] = self.heapList[mc] self.heapList[mc] = tmp i = mc def minChild(self,i): if i * 2 + 1 > sel...
robin1885/algorithms-exercises-using-python
source-code-from-author-book/Listings-for-Second-Edition/listing_6_20.py
Python
mit
488
#!/usr/bin/env python3 import unittest import logging import importlib import copy import os from docopt import docopt from unittest.mock import patch import pytest import ciftify.utils logging.disable(logging.CRITICAL) ciftify_recon_all = importlib.import_module('ciftify.bin.ciftify_recon_all') class ConvertFreesu...
edickie/ciftify
tests/test_ciftify_recon_all.py
Python
mit
15,712
import http from openbrokerapi.service_broker import LastOperation, OperationState from tests import BrokerTestCase class LastBindingOperationTest(BrokerTestCase): def setUp(self): self.broker.service_id.return_value = 'service-guid-here' def test_last_operation_called_just_with_required_fields(self...
eruvanos/openbrokerapi
tests/test_last_binding_operation.py
Python
mit
2,530
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # seamless documentation build configuration file, created by # sphinx-quickstart on Mon Jul 3 17:16:13 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # a...
sjdv1982/seamless
docs/archive/documentation-OLD/sphinx-source/conf.py
Python
mit
5,272
# CVS conversion code inspired by hg-cvs-import and git-cvsimport import os, locale, re, socket from cStringIO import StringIO from mercurial import util from common import NoRepo, commit, converter_source, checktool class convert_cvs(converter_source): def __init__(self, ui, path, rev=None): super(conve...
carlgao/lenga
images/lenny64-peon/usr/share/python-support/mercurial-common/hgext/convert/cvs.py
Python
mit
11,997
import unittest import time from datetime import datetime from app import create_app, db from app.models import User, AnonymousUser, Role, Permission, Follow class UserModelTestCase(unittest.TestCase): def setUp(self): self.app = create_app('testing') self.app_context = self.app.app_context() ...
caser789/xuejiao-blog
tests/test_user_model.py
Python
mit
6,887
# coding: utf-8 # # GIL limit python multi-thread effectiveness. # But is seems fine, because these operation have so many socket IO # So it seems no need to use multiprocess # import uiautomator2 as u2 import adbutils import threading from logzero import logger def worker(d: u2.Device): d.app_start("io.appium.a...
openatx/uiautomator2
examples/multi-thread-example.py
Python
mit
747
"""autogenerated by genpy from Ref/image.msg. Do not edit.""" import sys python3 = True if sys.hexversion > 0x03000000 else False import genpy import struct import Ref.msg import std_msgs.msg class image(genpy.Message): _md5sum = "f5f5ba95d6a5e2a82d553cdc6692532a" _type = "Ref/image" _has_header = True #flag to...
robotics-silver-surfer/surfer-main
lab3/Ref/src/Ref/msg/_image.py
Python
mit
6,271
#!/usr/bin/env python import os import sys sys.path.insert(0, os.pardir) from testing_harness import TestHarness class StatepointTestHarness(TestHarness): def __init__(self): self._sp_name = None self._tallies = False self._opts = None self._args = None def _test_output_crea...
mjlong/openmc
tests/test_statepoint_batch/test_statepoint_batch.py
Python
mit
654
from __future__ import absolute_import from .check_info import check_info_annotation from .rank_scores import build_rank_score_dict from .build_info import (build_info_string, build_info_dict) from .build_compounds import build_compounds_dict from .build_models import build_models_dict from .build_vep import (build_ve...
moonso/vcf_parser
vcf_parser/utils/__init__.py
Python
mit
481
# -*- coding: utf-8 """ Tests related to the Cuttle class. """ import os import unittest import warnings import time from cuttle.reef import Cuttle, Column from cuttlepool import CuttlePool from cuttlepool.cuttlepool import PoolConnection DB = '_cuttle_test_db' DB2 = '_cuttle_test_db2' HOST = 'localhost' class Bas...
smitchell556/cuttle
tests/test_cuttle_class.py
Python
mit
6,111
# -*- coding: utf-8 -*- """ Simple sockjs-tornado chat application. By default will listen on port 8080. """ import sys import os import json from urllib import urlencode import tornado.ioloop import tornado.web from tornado import gen from tornado.httpclient import AsyncHTTPClient import sockjs.tornado sys.path....
woojing/pairgramming
dj_backend/sock_serv.py
Python
mit
5,135
# # GDAX/AuthenticatedClient.py # Daniel Paquin # # For authenticated requests to the GDAX exchange import hmac import hashlib import time import requests import base64 import json from requests.auth import AuthBase from gdax.public_client import PublicClient class AuthenticatedClient(PublicClient): def __init__...
acontry/GDAX-Python
gdax/authenticated_client.py
Python
mit
11,447
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'billdetails.end_date' db.alter_column(u'employee_billd...
asm-technologies/management
employee/migrations/0006_auto__chg_field_billdetails_end_date__chg_field_billdetails_start_date.py
Python
mit
4,781
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Provide ways to loading molecules for the test instances. """ import os import re __license__ = 'X11' __DATA_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) + '/../../data/' __DATASET_DIRECTORY = __DATA_DIRECTORY + 'datasets/' __MOLECULES_FILE_CACHE = {} cl...
skodapetr/lbvs-environment
scripts/libs/data.py
Python
mit
6,451
#!/usr/bin/env python3 # Copyright (c) 2009-2019 The Bitcoin Core developers # Copyright (c) 2014-2019 The DigiByte Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Check RPC argument consistency.""" from collect...
digibyte/digibyte
test/lint/check-rpc-mappings.py
Python
mit
6,062