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 abc import abstractmethod from deepx.core.hof import Binary __all__ = ["Add", "Sub", "Mul", "Div"] class Add(Binary): def combinator(self, a, b): return a + b def __repr__(self): return "{} + {}".format( self.left_op, self.right_op ) class Sub(Binary): ...
sharadmv/deepx
deepx/core/arithmetic.py
Python
mit
882
def read_in_run_time(log_file): fin=os.popen(r'''head -1 %s'''%(log_file)) pin=fin.readline().strip().split() start=float(pin[0]) fin.close() fin=os.popen(r'''tail -1 %s'''%(log_file)) pin=fin.readline().strip().split() end=float(pin[0]) fin.close() return [end-start] def chromos_re...
mills-lab/svelter
Support.records/Run.Time.Evaluation/Calculate.RunTime.Simulated.py
Python
mit
23,513
import os, sys, re VERSION_REGEX = r'v?[0-9]+\.[0-9]+\.[0-9]+' def isValidTag(tag): if tag is None: return False if tag == '': return False regex = re.compile(VERSION_REGEX) if regex.match(tag): return True print('WARNING: Ignoring invalid tag: {}'.format(tag)) return False def version...
williwacker/FritzBackwardSearch
tag.py
Python
mit
3,221
# 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
CIM14/CPSM/Equipment/Meas/Discrete.py
Python
mit
2,923
from indexing.abstract_index import AbstractIndex import numpy as np class GloveIndex(AbstractIndex): vectors = None def __init__(self, dimension): self.dimension = dimension AbstractIndex.__init__(self, None, dimension) self.vocab_size = self.get_vocab_size() self.load_file...
MichSchli/QuestionAnsweringGCN
indexing/indexes/glove_index.py
Python
mit
1,114
from enum import Enum import json import shlex import socket import subprocess import sys import os from time import sleep from kafka import KafkaConsumer, KafkaProducer DEBUG = True SOCKET_HOST = '192.168.1.50' SOCKET_PORT = 80 NAME = "" MASTER_NAME = "master" KAFKA_HOST = '192.168.1.50:9092' KAFKA_TOPIC = "clus...
Mwerzen/cluster-controller
cluster-slave/controller/slavecontroller.py
Python
mit
8,745
from datetime import datetime, time import six from django import forms from django.conf import settings from django.contrib import admin from django.utils import timezone from django.utils.translation import pgettext from suit.widgets import SuitDateWidget class DateRangeForm(forms.Form): def __init__(self, *a...
f213/django-suit-daterange-filter
date_range_filter/filter.py
Python
mit
3,019
from pyspark import SparkContext, SparkConf def sparkly(): #logFile = "s3a://elasticmapreduce/samples/wordcount/wordSplitter.py" logFile = "s3a://europace.reporting/banking-batch.csv" conf = SparkConf()\ .setAppName("Simple Application")\ .setMaster("local") sc = SparkContext().getOrC...
bweigel/local-spark-s3-access
python/src/spark.py
Python
mit
635
# -*- coding: utf-8 -*- from code import InteractiveConsole from threading import Thread import traceback import readline import rlcompleter import sys from .thing_type import _ThingType class _GaminatorInteractiveConsole(InteractiveConsole): def __init__(self, game): self.game = game locals ...
syslo/gaminator
gaminator-src/interactive.py
Python
mit
987
#!/usr/bin/env python # -*- coding=utf-8 -*- from __future__ import division, unicode_literals import re import os.path class IndicTokenizer(): def __init__(self, lang='hin', split_sen=False): self.lang = lang self.split_sen = split_sen file_path = os.path.dirname(os.path.abspath(__file_...
ltrc/indic-tokenizer
irtokz/indic_tokenizer.py
Python
mit
14,712
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Interactive', fields=[ ('id', models.AutoField(...
OpenCanada/website
interactives/migrations/0001_initial.py
Python
mit
523
"""Unittest for datakick.models module.""" import copy import six import unittest try: import unittest.mock as mock except ImportError: import mock from datakick.models import DatakickProduct class TestModels(unittest.TestCase): def setUp(self): self.json_response = { "gtin14": "00...
carlos-a-rodriguez/datakick
tests/test_models.py
Python
mit
5,403
# Copyright (c) 2015 Nicolas JOUANIN # # See the file license.txt for copying permission. """ hbmqtt_pub - MQTT 3.1.1 publisher Usage: hbmqtt_pub --version hbmqtt_pub (-h | --help) hbmqtt_pub --url BROKER_URL -t TOPIC (-f FILE | -l | -m MESSAGE | -n | -s) [-c CONFIG_FILE] [-i CLIENT_ID] [-q | --qos QOS] [-...
beerfactory/hbmqtt
scripts/pub_script.py
Python
mit
6,116
# -*- coding: utf-8 -*- """ Created on Wed Jan 06 19:04:27 2016 @author: matsumi """ import load_mnist import numpy as np from sklearn.cross_validation import train_test_split import matplotlib.pyplot as plt import time import copy import chainer.functions as F from chainer import Variable, FunctionSet import chainer...
matsumishoki/machine_learning
mnist_chainer_neural_network_cupy.py
Python
mit
9,648
from ..graph import Greengraph
drewUCL/Greengraph
Greengraph/test/__init__.py
Python
mit
30
#!/usr/bin/python # -*- coding: utf-8 -*- # thumbor imaging service # https://github.com/thumbor/thumbor/wiki # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license # Copyright (c) 2011 globo.com timehome@corp.globo.com import re from functools import partial from urlparse import urlparse...
BetterCollective/thumbor
thumbor/loaders/http_loader.py
Python
mit
4,350
# -*- coding: utf-8 -*- import mock import sys import pytest from marshmallow import Schema from werkzeug.datastructures import MultiDict as WerkMultiDict PY26 = sys.version_info[0] == 2 and int(sys.version_info[1]) < 7 if not PY26: # django does not support python 2.6 from django.utils.datastructures import Mul...
hyunchel/webargs
tests/test_core.py
Python
mit
21,617
from modules.Configuration import config from modules.FileUtils import FileUtils from CorpusIterator import * ## Reads corpus from a file or all file of a folder # @author Adriano Zanette # @version 0.1 class FileCorpusIterator(CorpusIterator): ## Class constructor # @author Adriano Zanette # @ve...
adzanette/scf-extractor
scf-extractor/reader/FileCorpusIterator.py
Python
mit
1,264
# coding: utf8 import json import logging from taobaopy.taobao import TaoBaoAPIError logger = logging.getLogger(__name__) def get_taobao_item(top, config, num_iid): try: r = top.item_seller_get(num_iid=num_iid, fields=config.DEFAULT_ITEM_FIELDS, session=config.token) logger.debug(json.dumps(r,...
whusnoopy/taobao_uploader
utils.py
Python
mit
761
#!/usr/bin/env python import glob import setuptools from distutils.core import setup setup(name="{{PROJECT_NAME}}", version="0.0.1", description="Python Distribution Utilities", author="John Evans", author_email="lgastako@gmail.com", url="https://github.com/lgastako/{{PROJECT_NAME}}", ...
lgastako/protopy
setup.py
Python
mit
387
import re from vint.ast.node_type import NodeType from vint.linting.level import Level from vint.linting.policy.abstract_policy import AbstractPolicy from vint.linting.policy_registry import register_policy @register_policy class ProhibitEncodingOptionAfterScriptEncoding(AbstractPolicy): description = 'Set encodi...
Kuniwak/vint
vint/linting/policy/prohibit_encoding_opt_after_scriptencoding.py
Python
mit
1,015
#!/usr/bin/env python # -*- coding: utf-8 -*- """ :mod:`steamurlparser` --- Steam URL parser plugin ================================================= .. note:: This module requires `lxml library <http://lxml.de/>'_ .. note:: This module is currently deprecated """ from __future__ import unicode_literals ...
tetra5/gooby
gooby/plugins/steamurlparser.py
Python
mit
22,197
import logging from app import cache from app.parser.v0_0_1.schema_parser import SchemaParser from app.schema_loader.schema_loader import load_schema logger = logging.getLogger(__name__) def get_schema(metadata): """ Get the schema for the current user :return: (json, schema) # Tuple of json and schema ...
qateam123/eq
app/utilities/schema.py
Python
mit
1,339
""" eval_loop (c) @elegantonyx Ch. 7, Ex 4 """ from math import sqrt def eval_loop(): while True: user_inp = input("value?> ") if user_inp.lower() == "done": break print(eval(user_inp)) if __name__ == '__main__': eval_loop() #work in progress, i guess.
brupoon/mustachedNinja
eval_loop.py
Python
mit
318
# -*- coding: utf-8 -*- from anima import logger from anima.ui.lib import QtCore, QtGui, QtWidgets class DoubleListWidget(object): """This is a Widget that has two QListWidgets.""" def __init__( self, dialog=None, parent_layout=None, primary_label_text="", secondary_l...
eoyilmaz/anima
anima/ui/widgets/__init__.py
Python
mit
17,105
from flask import Flask, render_template, jsonify, request from flask_bootstrap import Bootstrap from config import port, host, debug from dice import DiceController from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config.from_object('config') Bootstrap(app) app.config['SQLALCHEMY_TRACK_MODIFICATIONS'...
trudikampfschaf/landing_page
website.py
Python
mit
4,755
import zipfile import shutil import os ####################################################### ### ### VER = '0.0.1' ### CHANNELS = ['360','qq','xiaomi'] ####################################################### EMPTY_FILE = 'empty' CHANNEL_FILE = 'META-INF/channel_{ch}' ORIGIN_FILE = 'release-{ver}.apk'.format(v...
ihuanglei/scripts
android/hl_android_channel.py
Python
mit
919
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('pages', '0005_auto_20151010_1809'), ] operations = [ migrations.AlterField( model_name='page', name=...
xianjunzhengbackup/code
data science/machine_learning_for_the_web/chapter_8/movie_reviews_analizer_app/webmining_server/pages/migrations/0006_auto_20160401_1918.py
Python
mit
641
import enum class DeviceType(enum.IntEnum): MIDI = 0 INSTRUMENT = 1 AUDIO = 2
Pulgama/supriya
supriya/daw/DeviceType.py
Python
mit
92
import unittest import time import threading import uuid import redis from nose.tools import raises from nose.tools import eq_ from retools import global_connection class TestLock(unittest.TestCase): def _makeOne(self): from retools.lock import Lock return Lock def _lockException(self): ...
bbangert/retools
retools/tests/test_lock.py
Python
mit
1,830
import random import string import hashlib def make_salt(): return ''.join(random.choice(string.letters) for x in xrange(5)) def make_pw_hash(name, pw, salt=None): """Generate a string containing the hashed password and salt used to hash it """ if not salt: salt = make_salt() h = ha...
samrum/fswd-project3
password_encrypt.py
Python
mit
640
from __future__ import unicode_literals from pkgutil import extend_path __path__ = extend_path(__path__, 'flask_github') __version__ = '1.0.1'
gregorynicholas/flask-github
flask_github/__init__.py
Python
mit
145
# For information about this, see this tutorial: # https://python-packaging.readthedocs.org/en/latest/minimal.html from setuptools import setup def text_of(file_name): with open(file_name) as f: return f.read() def long_description(): readme = text_of('README.md') license = text_of('LICENSE') ...
spejamchr/unties
setup.py
Python
mit
834
import os import sys import argparse import re from roblib import stream_fastq from taxon import get_taxonomy_db, get_taxonomy sys.stderr.write("Connecting to db\n") c = get_taxonomy_db() sys.stderr.write("Connected\n") def determine_phylogeny(fn, verbose=False): m = re.search('\[(\d+)\]', fn) if no...
linsalrob/EdwardsLab
jplacer/test_taxonomy.py
Python
mit
1,245
import sublime import sublime_plugin import gzip import json import StringIO import threading import urllib2 class Settings: settings = sublime.load_settings(__name__ + '.sublime-settings') @staticmethod def init(): Settings.settings.add_on_change(__name__ + '-reload', Settings.setup) Settings.setup() ...
IgorGilyazov/HtmlValidator
HtmlValidator.py
Python
mit
7,174
# The MIT License (MIT) # # Copyright (c) 2014 Richard Moore # # 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...
ricmoo/pycoind
pycoind/util/key.py
Python
mit
3,854
#!/usr/bin/env python """ Analyse data """ import os import sys import inspect # Add extra libraries' directories to import list baseLibDir = os.path.join(os.path.realpath(os.path.dirname( inspect.getfile(inspect.currentframe()))), 'lib') sys.path.append(baseLibDir) # Import own libraries from analysis import An...
nelsyeung/half-metals-analysis
analyse_data.py
Python
mit
455
from channels.staticfiles import StaticFilesConsumer from map import consumers channel_routing = { # This makes Django serve static files from settings.STATIC_URL, similar # to django.views.static.serve. This isn't ideal (not exactly production # quality) but it works for a minimal example. 'http.requ...
bobvoorneveld/spindlechannels
spindlechannels/routing.py
Python
mit
557
#!/usr/bin/env python # -*- coding: utf-8 -*- from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages from os.path import join, dirname from particledensitydouble.version import version as __version__ setup( name="ParticleDensityDouble.py", version=__version__, d...
maxdl/ParticleDensityDouble.py
setup.py
Python
mit
988
#------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. #-------------------------------------------------------------------------- import logg...
Azure/azure-sdk-for-python
sdk/eventgrid/azure-eventgrid/tests/test_exceptions_async.py
Python
mit
3,756
from django.db import models from django.contrib.auth.models import User import datetime import uuid APPLICATION_STATUSES = ( (0, 'Start'), (1, 'Step 1'), (2, 'Complete'), ) YES_NO = ( (True, 'Yes',), (False, 'No',) ) STATES = ( ('AL', 'Alabama',), ('AK', 'Alaska',), ('AZ', 'Arizona'...
ask5/eatuxchallenge
eat/models.py
Python
mit
31,508
# -*- coding: utf-8 -*- import os from bottle import post, request, run, hook, template, route from howdoi import howdoi @hook('before_request') def strip_path(): request.environ['PATH_INFO'] = request.environ['PATH_INFO'].rstrip('/') @post('/howdoi') def howdoi_handler(): """ Example: /howdoi...
ellisonleao/slack-howdoi
app.py
Python
mit
958
#!/usr/bin/env python import logging import os import sys from pprint import pformat from twisted.internet import reactor, stdio, defer from twisted.protocols.basic import LineReceiver import twisted.python.log as twisted_log from exchangelib import bitstamp, bitfinex, btce, huobi log = logging.getLogger(__name__) ...
socillion/exchangelib
interactive.py
Python
mit
3,632
# Copyright (C) 2013-2015 MetaMorph Software, Inc # Permission is hereby granted, free of charge, to any person obtaining a # copy of this data, including any software or models in source or binary # form, as well as any drawings, specifications, and documentation # (collectively "the Data"), to deal in the Data ...
pombredanne/metamorphosys-desktop
metamorphosys/META/test/TestDymolaLicense/CyPhy/PostProcessing/common/post_processing_class.py
Python
mit
27,993
# 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/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/aio/_configuration.py
Python
mit
2,937
import time as timer import cvxopt as co import numpy as np import pylab as pl import sklearn.metrics as metric import matplotlib.pyplot as plt import scipy.io as io from kernel import Kernel from ocsvm import OCSVM from latent_ocsvm import LatentOCSVM from toydata import ToyData from so_hmm import SOHMM def get_mo...
nicococo/LAD
15_icml_toy_runtime.py
Python
mit
8,705
import os import logging import tensorflow as tf import numpy as np from .BinaryReader import BinaryReader def _int64_feature(value): return tf.train.Feature(int64_list=tf.train.Int64List(value=[value])) def _bytes_feature(value): return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value])) cla...
JonathanHunz/BLL_MNIST
src/data/utils/Extractor.py
Python
mit
2,940
""" WSGI config for dddppp 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.8/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application from whitenoise.django import DjangoW...
tysonclugg/dddppp
dddppp/wsgi.py
Python
mit
480
#!/usr/bin/env python import datetime import time import logging from suncalc import SunCalc import serial #Convert strings to bytes. According to the Arduino Doc, this is needed isDay = b'Day' isNight = b'Night' serialBauds=115200 #Open the serial port ser = serial.Serial('/dev/ttyACM0', serialBauds) while not ser.i...
sejoruiz/weatherino
daytnightrelay.py
Python
mit
796
########################################### ## RITVIK KHARKAR ## UCLA CLASS OF 2017 ## COMPUTATIONAL MATHEMATICS & ECONOMICS ## www.ritvikmath.com ## SEPT 2016 ########################################### from pulp import * import numpy as np import pandas as pd from random import s...
ritvikmath/ritvikmath.github.io
SADIE/SADIE.py
Python
mit
12,640
#!/usr/bin/env python import os #os.chdir('/home/travis/build/erdc/proteus/air-water-vv/2d/benchmarks/wavesloshing') import pytest from proteus.iproteus import * from proteus import Comm comm = Comm.get() #import wavesloshing_so #import wavesloshing import numpy as np import collections as cll import csv from proteus.t...
erdc-cm/air-water-vv
Tests/2nd_set/test_wavesloshing.py
Python
mit
5,638
# coding=utf-8 r""" This code was generated by \ / _ _ _| _ _ | (_)\/(_)(_|\/| |(/_ v1.0.0 / / """ from twilio.base import deserialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base...
tysonholub/twilio-python
twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py
Python
mit
16,389
# -*- coding: utf-8 -*- # # wradlib documentation build configuration file, created by # sphinx-quickstart on Wed Oct 26 13:48:08 2011. # adapted with code from https://github.com/ARM-DOE/pyart/blob/master/doc/source/conf.py # # This file is execfile()d with the current directory set to its containing dir. # # ...
jjhelmus/wradlib
doc/source/conf.py
Python
mit
10,250
""" 3-D variables: -------------- Instantaneous: ['U', 'V', 'OMEGA', 'T', 'QV', 'H'] Time-average: ['DUDTANA'] 2-D variables: -------------- Time-average surface fluxes: ['PRECTOT', 'EVAP', 'EFLUX', 'HFLUX', 'QLML', 'TLML'] Time-average vertically integrated fluxes: ['UFLXQV', 'VFLXQV', 'VFLXCPT', 'VFLXPHI'] Instan...
jenfly/atmos-read
scripts/fram/merra2-mfc.py
Python
mit
9,470
#!/usr/bin/python import os import sys import matplotlib.pyplot as plt import math import time import glob import numpy as np from matplotlib.widgets import Button from matplotlib import cm from mpsse import * import lepton3rd Read=True maxval=0 ImgID=0 class Index: ind = 0 def __init__(self, lep): self.lepton=l...
penguintantin/Flir_lepton
DispLepton3rd.py
Python
mit
4,170
#!/usr/bin/python # -*- coding: utf-8 -*- from django.test import TestCase from django.test.client import Client from django.core.urlresolvers import reverse from dtnsprsm.apps.pdfbuilder.models import Form class PdfBuilderTest(TestCase): fixtures = [ 'pdfbuilder-form.json', 'api-municipality.j...
jbspeakr/datensparsam
dtnsprsm/apps/pdfbuilder/tests.py
Python
mit
1,351
#!/usr/bin/env python3 import os import sys import subprocess if __name__=="__main__": if len(sys.argv) < 2: print("wrong format\n") print("Format: "+sys.argv[0]+" key-value.txt") sys.exit(1) fname = sys.argv[1] if not os.path.isfile(fname): print("Key-value pair file "+fn...
zhaozhang/amfora
examples/PageRank/bin/addition.py
Python
mit
715
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os from arbitrator import __version__, version_info on_rtd = os.environ.get('READTHEDOCS', None) == 'True' project = 'arbitrator' copyright = '2015, Dan Tracy' version = __version__ release = '.'.join(str(x) for x in version_info[:2]) needs_sphinx = '1.0' extens...
djt5019/arbitrator
docs/conf.py
Python
mit
926
#!/usr/bin/env python from nodes import Node class Base(Node): char = "b" args = 1 results = 1 contents = "0123456789abcdefghijklmnopqrstuvwxyz" default_arg = 10 def __init__(self, base: Node.NumericLiteral): self.base = base def prepare(self, stack): if not self....
muddyfish/PYKE
node/base.py
Python
mit
2,345
import _plotly_utils.basevalidators class TicktextsrcValidator(_plotly_utils.basevalidators.SrcValidator): def __init__( self, plotly_name="ticktextsrc", parent_name="indicator.gauge.axis", **kwargs ): super(TicktextsrcValidator, self).__init__( plotly_name=plotly_name, ...
plotly/python-api
packages/python/plotly/plotly/validators/indicator/gauge/axis/_ticktextsrc.py
Python
mit
477
# Electrum - Lightweight Bitcoin Client # Copyright (c) 2011-2016 Thomas Voegtlin # # 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 rig...
wakiyamap/electrum-mona
electrum_mona/network.py
Python
mit
58,862
# (c) Copyright IBM Corp. 2021 # (c) Copyright Instana Inc. 2020 import threading def launch_background_thread(app, app_name, fun_args=(), fun_kwargs={}): print("Starting background %s app..." % app_name) app_thread = threading.Thread(target=app, name=app_name, ...
instana/python-sensor
tests/apps/utils.py
Python
mit
483
import unittest from katas.beta.caesar_cipher_encryption_variation import caesar_encode class CaesarEncodeTestCase(unittest.TestCase): def test_equal_1(self): self.assertEqual( caesar_encode('conquer et impera', 130), 'conquer fu korgtc' ) def test_equal_2(self): self.ass...
the-zebulan/CodeWars
tests/beta_tests/test_caesar_cipher_encryption_variation.py
Python
mit
794
import discord import asyncio client = discord.Client() @client.event async def on_ready(): print('Logged in as') print(client.user.name) print(client.user.id) print('------') @client.event async def on_message(message): if message.content.startswith('!test'): counter = 0 tmp = aw...
xFallenLight/kiyomi-bot
bot.py
Python
mit
867
#------------------------------------------------------------------------------- # Name: Point maps # Purpose: Drought live Greece Monitor # # Author: Anastasiadis Stavros / Antonis Tsorvas # # Created: 13/09/2013 # Copyright: (c) Anastasiadis Stavros 2013 # (c) Tzorvas Konstant...
atzorvas/droughtmeteo
modules/pointsMaps.py
Python
mit
4,767
"""empty message Revision ID: 2a8d18eaacba Revises: None Create Date: 2013-12-09 12:15:40.023000 """ # revision identifiers, used by Alembic. revision = '2a8d18eaacba' down_revision = None from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please adjust! ###...
ardinor/mojibake-flat
migrations/versions/2a8d18eaacba_.py
Python
mit
1,642
import bottlenose from bs4 import BeautifulSoup import json import csv import re from collections import Counter import time import random from urllib.error import HTTPError def error_handler(err): ex = err['exception'] print("error") if isinstance(ex, HTTPError) and ex.code == 503: time.sleep(...
yabirgb/maths-books
p_scrap/database.py
Python
mit
2,757
from unittest import TestCase from ..database_tests import DatabaseTestCase from rebel.drivers.sqlite import SqliteDriver class SqliteTestCase(DatabaseTestCase, TestCase): def get_driver(self): return SqliteDriver(database=':memory:') def create_tables(self): self.db.execute(""" ...
hugollm/rebel
tests/driver_tests/sqlite_tests.py
Python
mit
971
import unittest from formscribe import Field from formscribe.error import InvalidFieldError class NoRegexKey(Field): """Missing the 'regex_key' attribute.""" regex_group = 'some-group' regex_group_key = 'some-group-key' def validate(self, value): return value class NoRegexGroup(Field): ...
martinjungblut/formscribe
tests/field/test_invalid.py
Python
mit
1,650
# Learning Python the hard way - http://learnpythonthehardway.org/book/ex6.html # Exercise 6 - Strings and Text # creates a variable named x that is a string with a replacement x= "There are %d types of people." %10 # binary is a tring and do_not is a string binary = "binary" do_not = "don't" # create a new variable...
gghezzo/prettypython
TheHardWay/ex6.py
Python
mit
716
from time import time class StopWatch(object): """ A simple timekeeping class. Slightly more convenient than keeping track of two time variables. """ def __init__(self): self.start_time = None self.end_time = None self.start() def start(self): """ Sta...
jackmaney/rate-limited-queue
rate_limited_queue/stopwatch.py
Python
mit
822
#!/usr/bin/python3 import json import sqlite3 as lite class InitAlbumView(): def __init__(self): pass def _get_init_album_info(self, dbpath, jpath, albidlist): print(len(albidlist)) resultlist = [] for albid in albidlist: con = lite.connect(dbpath['ampyche']) cur = con.cursor() cur.execute("SELE...
ampyche/ampyche
setup/createalbumsjson.py
Python
mit
765
import os import requests import urllib import spotify import threading import logging from time import sleep IMPORTIO_API_INDIEPOP_URL = ( 'https://api.import.io/store/data/' 'c3914ba4-3da3-4fee-8120-fcb6bfb66d3f/_query?input/webpage/' 'url=http%3A%2F%2Fsomafm.com%2Findiepop%2Fsonghistory.html' '&_us...
andreagrandi/spotisoma
spotisoma.py
Python
mit
4,283
""" This file contains unittests for the loading functions in .load """ import datetime as dt from load.load_ticker import load_cac40_names, load_valid_cac40_names from load.load_local_data import load_local_data_from_yahoo from load.load_data import load_stock_close_price from nose.plugins.attrib import attr def t...
aliciawyy/CompInvest
tests/test_load.py
Python
mit
1,821
# Python - 3.6.0 swap = lambda st: st.translate(str.maketrans('aeiou', 'AEIOU'))
RevansChen/online-judge
Codewars/7kyu/changing-letters/Python/solution1.py
Python
mit
82
from os import path from setuptools import setup, find_packages #this should hopefully allow us to have a more pypi friendly, always up to date readme readMeDir = path.abspath(path.dirname(__file__)) with open(path.join(readMeDir, 'README.md'), encoding='utf-8') as readFile: long_desc = readFile.read() VERSION ...
HurricaneLabs/machinae
setup.py
Python
mit
1,409
import unittest import json import responses from pyshk.api import Api from pyshk import models from pyshk import errors class ApiTests(unittest.TestCase): """ Test various API functions """ def test_api_creation(self): a = Api(consumer_key='test', consumer_secret='test', ...
jeremylow/pyshk
tests/test_api.py
Python
mit
12,757
from ..libs.view_helpers import * from ..libs.text_helpers import * from ..libs import log from .event_hub import EventHub class TimeoutScheduler: """ If there are multiple timeouts set for the same function, only call the function in the last timeout in chronological order. """ def __init__(self,...
nimzco/Environment
Sublime/Packages/TypeScript/typescript/listeners/idle.py
Python
mit
8,720
import logging logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s') logging.debug('Start of program') def factorial(n): logging.debug('Start of factorial(%s)' % (n)) # book is missing %s total = 1 for i in range(1, n + 1): total *= i logging.debug(...
parhelia/AutomateStuffWithPython
Chapter 10/factorialLog.py
Python
mit
507
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
vgeshel/gae-image
main.py
Python
mit
6,183
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2016-11-29 18:31 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0001_initial'), ] operations = [ migrations.RemoveField( ...
Lujeni/matterllo
core/migrations/0002_auto_20161129_1831.py
Python
mit
546
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2017-08-24 19:38 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('regions', '0010_auto_20170818_2156'), ] operations = [ migrations.AlterFiel...
texastribune/scuole
scuole/regions/migrations/0011_auto_20170824_1938.py
Python
mit
1,239
from app.schema.answer import Answer from app.schema.widgets.percentage_widget import PercentageWidget from app.validation.percentage_type_check import PercentageTypeCheck class PercentageAnswer(Answer): def __init__(self, answer_id=None): super().__init__(answer_id) self.widget = PercentageWidget...
qateam123/eq
app/schema/answers/percentage_answer.py
Python
mit
475
# -*- coding: iso-8859-1 -*- import os import json import shutil import stat import common import mysql.connector class BaseCrawler: def __init__(self, configurationsDictionary): self._extractConfig(configurationsDictionary) self.echo = common.EchoHandler(self.config["echo"]) def _ext...
fghso/instagram-crawler
json2mysql/crawler.py
Python
mit
11,607
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django import template from ..util import get_and_set_user_agent register = template.Library() @register.filter() def is_mobile(request): return get_and_set_user_agent(request).is_mobile @register.filter() def is_pc(request): return get...
sainipray/djadmin
djadmin/templatetags/user_agents.py
Python
mit
657
from io import StringIO import linesep scenarios = [ ( "empty", { "entries": [], "sep": "\n", "preceded": "", "terminated": "", "separated": "", }, ), ( "empty_str", { "entries": [""], ...
jwodder/linesep
test/test_core/test_join_text.py
Python
mit
1,704
import argparse import socket import time import hmac import hashlib import random import string import os.path import sys from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import padding BLOCK_SIZE...
henrytran28/CPSC-526
assignment_4/server.py
Python
mit
8,873
from parcellearning.conv.gatconv import GATConv import numpy as np import dgl from dgl import data from dgl.data import DGLDataset import dgl.function as fn import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Linear, LSTM from dgl.nn.pytorch import GraphConv class JKGAT(nn.Module...
kristianeschenburg/parcellearning
parcellearning/jkgat/jkgat.py
Python
mit
6,147
from django.contrib import admin from django.conf.urls import url, include from jwt_auth.urls import urlpatterns as jwt_auth_patterns urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^api/', include(jwt_auth_patterns, namespace='api')), ]
codertx/lightil
lightil/urls.py
Python
mit
255
def nested(): pass
github/codeql
python/ql/test/library-tests/PointsTo/import_star/nested/nested.py
Python
mit
23
from django.contrib import admin from .models import * @admin.register(Snippet) class SnippetAdmin(admin.ModelAdmin): list_filter = ('created_by', 'created_on') list_display = ('title', 'language', 'style', 'created_on', 'created_by') search_fields = ('title', 'code') readonly_fields = ('created_by',...
edilio/snippets-javaos
snippets_java/snippets_java/apps/snippets/admin.py
Python
mit
434
#!/usr/bin/env python import spmda.entity import spmda.message_handler import spmda.world def box_controller_action(cont, entity): if cont.listeners["msg_lstr_000"].get_state() == True: print "IT'S ALIVE!" raw_input("press enter to continue") entity.world.end_world() def rock_controller_ac...
huba/SPMDA
test.py
Python
mit
1,220
import unittest import random import time import utils import sdk import helpers class File(unittest.TestCase): # need to perform CRUD on existing file @utils.allow(apis=['storage']) def setUp(self): self.folder = utils.create_or_get_test_folder(self.account) self.file = utils.create_tes...
Kloudless/kloudless-python
tests/integration/test_cases/test_file.py
Python
mit
7,287
#!/usr/bin/python # -*- coding: utf-8 -*- import argparse import os import shlex import subprocess def str2args(cmd): return shlex.split(cmd) def build_component(build_type, build_dir, cmake_file_path, target): if not os.path.exists(build_dir): os.makedirs(build_dir) os.chdir(build_dir) su...
kingsamchen/Eureka
ConcurrentHttpServer/ConcurrentHttpServerLinux/gen.py
Python
mit
1,538
from .yamale import make_schema, make_data, validate from .yamale_testcase import YamaleTestCase
rigal-m/Yamale
yamale/__init__.py
Python
mit
97
"""Adds functionality to allow slow tests to be skipped by pytest when specified.""" import pytest def pytest_addoption(parser): """Add the `runslow` option to pytest.""" parser.addoption("--runslow", action="store_true", default=False, help="run slow tests") def pytest_collection_modif...
IATI/IATI-Website-Tests
conftest.py
Python
mit
672
class StructureSketch(object): """Create 'Sketch' of the structure""" def __init__(self,structureModel,structureGeometry): """init Required argument: Optional arguments: None. Return value: Exceptions: None. """ self.structureGeomet...
zjkl19/AbaqusPython
GuoxiSuspensionBridge01/GuoxiSuspensionBridge01/StructureSketch.py
Python
mit
5,583
#!/usr/bin/python import os, time def pdf_to_jpg(link, pdf_output, jpg_output): #Downloads the file from the link needed. update_command = 'curl -L -o ' + pdf_output + ' "' + link + '"' os.system(update_command) #Converts file just downloaded into a pic. picture_command = "convert -density 300 -t...
mjafri118/HHDash
Scripts/update.py
Python
mit
964
import copy from yahtr.core.hex_lib import index_of_direction from yahtr.utils import attr, clamp from yahtr.utils.event import Event from yahtr.data.actions import ActionType from yahtr.data.skill_template import Target from yahtr.rank import Rank from yahtr.weapon import RankedWeapon class Unit: """ Unit in a ...
fp12/yahtr
yahtr/unit.py
Python
mit
4,516
# Author Leigh Jewell # License https://github.com/leigh-jewell/cmx-anonymiser/blob/master/LICENSE # Github repository: https://github.com/leigh-jewell/cmx-anonymiser # Try and load in all the required modules. try: import sys import configparser import requests # Ignore HTTPS warnings if they...
leigh-jewell/cmx-anonymiser
cmx-anonymiser.py
Python
mit
20,909