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 unittest import skip import requests from django.core.urlresolvers import reverse from django.utils import timezone from django.core.management import call_command from django.test import TestCase from django.utils.six import StringIO from django.contrib.auth import get_user_model from .models import Run, Runke...
Socialsquare/RunningCause
runs/tests.py
Python
mit
3,502
import FWCore.ParameterSet.Config as cms #--------------------------------------------------------------------------------------------------- # M A I N #--------------------------------------------------------------------------------------------------- # create the process pro...
cpausmit/Kraken
filefi/042/mc-notrig.py
Python
mit
7,750
__author__ = 'cenk' def get_flags(*args, **kwargs): """ :param args: :param kwargs: :return: my, player, free flag respectively """ return kwargs.get('my_flag', 'X'), kwargs.get('player_flag', 'O'), kwargs.get('free', 0)
cenkbircanoglu/tic-tac-toe
game/utils/flags.py
Python
mit
247
import click from photomanager.commands.index import CommandIndex from photomanager.commands.display import CommandList from photomanager.commands.remove_dup import CommandRemoveDuplicate from photomanager.commands.config import CommandConfig from photomanager.commands.update import CommandUpdate @click.group() def p...
wrenchzc/photomanager
photomanager/photo_manager.py
Python
mit
2,330
# -*- coding: utf-8 -*- from __future__ import division, print_function import pytest import numpy as np from ... import Ensemble from ..common import NormalWalker, UniformWalker __all__ = ["test_invalid_coords_init", "test_invalid_dims_init", "test_valid_init"] def test_invalid_coords_init(nwalkers=32...
dfm/emcee3
emcee3/tests/unit/test_ensemble.py
Python
mit
1,237
# Whether we're simply testing the site and no webcam should be used. DEBUG = False # Minimum area to consider a contour as valid. AREA_THREASHOLD = 100 # Write debug images to disk. SAVE_TO_DISK = False # Size of the area used to learn color profile. SAMPLE_SIZE = 15 class RectArea(object): def __init__(self,...
Plezito/rpgesture
config.py
Python
mit
1,099
import math import tensorflow as tf #from .utils import base_name def base_name(var): """Extracts value passed to name= when creating a variable""" return var.name.split('/')[-1].split(':')[0] def copy_variables(variables): res = {} for v in variables: name = base_name(v) copied_var = ...
mburq/Deep_rl_stochastic_opt
src/agent/dqn/models.py
Python
mit
6,469
# http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.ab...
davidwest/TreeCollections
docs/conf.py
Python
mit
1,682
#!/usr/bin/python # -*- coding: utf-8 -*- from nltk.corpus import wordnet def Levenshtein_Dist(s1,s2): m = [[0 for col in range(len(s2)+1)] for row in range(len(s1)+1)] for i in range(len(s1)+1): m[i][0] = i for j in range(len(s2)+1): m[0][j] = j for i in range(len(s1)): for j in range(len(s2)):...
Impavidity/SearchEngine
OldCode/revised.py
Python
mit
1,014
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import requests import time from spider163.utils import encrypt from spider163.spider import public as uapi from spider163.spider import music from spider163.utils import pysql from spider163.utils import pylog from spider163.utils import tools from spider163 imp...
Chengyumeng/spider163
spider163/spider/authorize.py
Python
mit
4,612
from crash_hound import CrashHound, CommonChecks, SenderMail # helper lambda for gracefully degrading environmental variables from os import environ env = lambda e, d: environ[e] if environ.has_key(e) else d # load configuration from environment variables monitor_url = env('MONITOR_URL', '') smtp_host = env('SMTP_HOS...
kblum/webmonitor
worker.py
Python
mit
923
import os from flask import Blueprint from flask import json, url_for, current_app from flask import g, request, abort, send_file from flaskext.uploads import UploadSet from ..utils import as_resource, as_collection from ..db import sim as sim_db parameters_page = Blueprint('parameters', __name__)
mcflugen/wmt-rest
wmt/flask/views/parameters.py
Python
mit
303
#!/usr/bin/env python # encoding: utf-8 # http://axe.g0v.tw/level/3 import urllib2, re, cookielib lines = [] # The hint is that we need to accept cookies. jar = cookielib.FileCookieJar("cookies") opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar)) for index in range(1, 77): url = "http://axe-level-1.he...
zonble/axe_py
axe3.py
Python
mit
766
#!/usr/bin/python # -*- coding: utf-8 -*- import time import datetime import urllib2 import json from requests_oauthlib import OAuth1Session from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.events import EVENT_JOB_EXECUTED import logging logging.basicConfig() class Configuration(obj...
kotori-sonoda/chunchun
chunchun.py
Python
mit
3,382
""" Wrapper for timedelta class to provide nicer access for alarms """ class TimeSpan: def __init__(self, seconds): self._seconds = seconds @staticmethod def fromTimeDelta(delta): return TimeSpan(delta.total_seconds()) @property def seconds(self): return self._seconds @property def minutes(self): re...
zix99/sshsysmon
sshsysmon/lib/util/timespan.py
Python
mit
1,196
# this file is for interactive tests of the ppi_networkit cython API # thus it just loads the configuration and # database connection and enables tab completion import os import re import itertools import numpy import time import sys import pappi.id_mapping import pappi.sql from pappi.data_config import * #########...
patflick/tsppi
src/networkit_test.py
Python
mit
1,149
# coding: utf-8 """ DocuSign REST API The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501 OpenAPI spec version: v2.1 Contact: devcenter@docusign.com Generated by: https://github.com/swagger-api/swagger-codegen.gi...
docusign/docusign-python-client
docusign_esign/models/envelope_attachment.py
Python
mit
7,184
#!/usr/bin/env python # # Copyright under the latest Apache License 2.0 '''A class the inherits everything from python-twitter and allows oauth based access Requires: python-twitter simplejson oauth ''' __author__ = "Hameedullah Khan <hameed@hameedkhan.net>" __version__ = "0.2" from jsb.contrib import twitt...
Petraea/jsonbot
jsb/contrib/oauthtwitter.py
Python
mit
6,745
# Copyright 2019 by Sergio Valqui. All rights reserved. def SendEmail(fs_smtpsvr, fs_user, fs_pass, fs_emailcontent): import smtplib import socket fs_FromAddr = '' fs_ToAddr = '' fs_emailcontent = 'Hello' # Delta test s = socket.socket() s.bind(('', 50007)) s.listen(1) s.close() ...
svalqui/sysad
coms/mail.py
Python
mit
505
# SteamFootBridge # Copyright (c) 2016 Bryan DeGrendel from . import config import steam # TODO: Does capitalization mater? __root_userconfig_key__ = 'UserLocalConfigStore' __friends_userconfig_key__ = 'friends' __autologin_friends_key__ = 'AutoSignIntoFriends' __system_userconfig_key__ = 'system' __enable_...
sirnuke/steamfootbridge
steamfootbridge/setup.py
Python
mit
1,601
import datetime import logging import math from pylons import cache, config, request, response, session, tmpl_context as c, url from pylons.controllers.util import abort, redirect from pylons.decorators.secure import authenticate_form from routes import request_config from sqlalchemy.orm import aliased, contains_eager...
veekun/spline
splinext/forum/controllers/forum.py
Python
mit
10,448
#!/usr/bin/env python # -*- coding: UTF-8 -*- from __future__ import division from quant import config from .broker import Broker from quant.api.bitfinex import PrivateClient as BfxClient from quant.common import constant import logging # python -m quant.cli -m Bitfinex_BCH_BTC get-balance class Bitfinex(Broker): ...
doubleDragon/QuantBot
quant/brokers/_bitfinex.py
Python
mit
9,514
#!/usr/bin/env python import unittest import math import mastermind class TestMasterMind(unittest.TestCase): def test_code(self): code = mastermind.gencode() self.assertTrue(code) def test_duplicates(self): '''Duplicate guesses are not counted''' code = (1,1,2,2) guess = (1,1,1,2) fb = mastermind...
peterstark72/mastermind
test.py
Python
mit
2,224
#! /usr/bin/python2 # vim: set fileencoding=utf-8 # from http://code.activestate.com/recipes/576611/ from operator import itemgetter from heapq import nlargest from itertools import repeat, ifilter class Counter(dict): '''Dict subclass for counting hashable objects. Sometimes called a bag or multiset. Elemen...
daureg/illalla
Counter.py
Python
mit
6,401
# coding: utf-8 """ Generated by: https://openapi-generator.tech """ from dataclasses import dataclass import re # noqa: F401 import sys # noqa: F401 import typing import urllib3 from urllib3._collections import HTTPHeaderDict from openapi_client import api_client, exceptions import decimal # noqa: F401 fro...
cliffano/swaggy-jenkins
clients/python-experimental/generated/openapi_client/api/remote_access_api_endpoints/get_view.py
Python
mit
5,347
"""Mongo osid profile elements for proxy service packages""" # -*- coding: utf-8 -*- # pylint: disable=unused-import # importing common values to be used by proxy.ProfileManger implementation from ..profile import ID from ..profile import LANGUAGETYPE from ..profile import SCRIPTTYPE from ..profile import FORMATTYP...
mitsei/dlkit
dlkit/json_/proxy/profile.py
Python
mit
781
from keypad import Keypad def parse(lines): return [x.strip() for x in lines] def step1(input): keypad_look = """ 1 \n 234 \n56789\n ABC \n D """ keys = Keypad.parse_keys(keypad_look) keypad = Keypad(keys) keypad.follow(input) return keypad.code
erikedin/aoc2016
aoc2016/day2.py
Python
mit
275
#!/usr/bin/env python # Try to use setuptools from http://peak.telecommunity.com/DevCenter/setuptools import os try: from setuptools import setup except ImportError: from distutils.core import setup from distutils.core import Extension try: from Pyrex.Distutils import build_ext except ImportError: buil...
Knio/miru
setup.py
Python
mit
1,904
# from sqlalchemy import Table from sqlalchemy import Column, String, Integer, event, ForeignKey from sqlalchemy.dialects.sqlite import DATETIME from sqlalchemy.orm import relationship, backref import uuid from datetime import datetime from ..db import db custom_datetime = DATETIME( timezone="UTC", ) # TODO...
mozey/taskmage
taskmage/db/models.py
Python
mit
4,552
import argparse import logging import math import random import re import string import warnings from abc import ABC, abstractmethod from enum import Enum from functools import lru_cache, reduce from itertools import groupby, product from pathlib import Path from typing import Any, Callable, Dict, FrozenSet, Iterable, ...
Udzu/pudzu
pudzu/sandbox/patterns.py
Python
mit
78,270
import subprocess import importlib from SALib.util import avail_approaches def test_cli_usage(): cmd = ["salib"] try: out = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True, ...
willu47/SALib
tests/test_cli.py
Python
mit
1,147
#!/usr/bin/python # coding: utf-8 # Copyright (c) 2013 Mountainstorm # # 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, ...
RoshanNindrai/MobileDevice
amdevice.py
Python
mit
33,356
from django.contrib.auth import get_user_model from rest_framework import serializers from djoser.conf import settings from djoser.serializers import UserCreateMixin from .models import CredentialOptions from .utils import create_challenge, create_ukey User = get_user_model() class WebauthnSignupSerializer(seriali...
sunscrapers/djoser
djoser/webauthn/serializers.py
Python
mit
2,050
import datetime import os env = os.getenv('BOT_ENV', 'staging') stages = { 1: datetime.timedelta(minutes=0), 2: datetime.timedelta(minutes=30), 3: datetime.timedelta(hours=8), 4: datetime.timedelta(hours=24), 5: datetime.timedelta(days=3), 6: datetime.timedelta(weeks=1), 7: datetime.timedelt...
Omrigan/shiny-language-learner
study_settings.py
Python
mit
481
import os from lxml import etree from flask.ext.script import Command, Option from flask import current_app class Readfeed(Command): """ Reads the given feed.xml and upserts the data """ EVE_RESOURCE = 'product' XML_ELEM_PRODUCT = 'product' XML_ELEM_FEATURE = 'feature' XML_ELEM_LABEL = 'l...
tspycher/python-productdb
productdb/app/commands/readfeed.py
Python
mit
2,508
from flask import Blueprint url_prefix = '/{{cookiecutter.project_slug}}' main = Blueprint('main', __name__, url_prefix=url_prefix) from . import views
by46/recipe
templates/python.flask/{{cookiecutter.project_safe_name}}/app/main/__init__.py
Python
mit
160
''' >>> c = Conf('climon.conf.test') >>> list(c.iter_ids('sensor')) ['sine', 'web'] >>> list(c.iter_ids('toggle')) ['fake'] >>> c.get_element('sensor', 'sine') # doctest: +ELLIPSIS <function sine.<locals>.sine_sensor at ...> >>> c.get_element('toggle', 'fake') # doctest: +ELLIPSIS <toggles.FakeToggle object at ...> ...
jwustrack/climon
conf.py
Python
mit
3,204
import numpy as np import decimal import spectra class Smear(object): """ This class smears the energy and radius of a spectra. The class can recieve energy and radius as individual data points or a 1 dimensional numpy array to smear which is then returned. 2d and 3d arrays with linked energy, radius ...
EdLeming/echidna
echidna/core/smear.py
Python
mit
17,880
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals from copy import deepcopy import os from .file_utils import read_yaml_file, read_yaml_string from collections import MutableMapping import logging log = logging.getLogger('configmate.config') CONFIG_INCLUDE_KEY = 'include' CONFIG_INCLU...
wamonite/configmate
configmate/config.py
Python
mit
7,565
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from wagtail.wagtailimages.utils import get_fill_filter_spec_migrations class Migration(migrations.Migration): dependencies = [ ('images', '0005_auto_20161108_2120'), ] forward, reverse = g...
CIGIHub/greyjay
greyjay/images/migrations/0006_auto_20161108_2123.py
Python
mit
457
# ===The application coordinator: it starts the application and it let it run=== """ It instantiate two objects: 1. a **tester** to run the unit tests 2. an **app** and runs the run() method """ __author__ = 'cosmin' import model import tester import ui from tester.tester import Tester from ui.calculator import Ca...
rusucosmin/courses
ubb/logic/BaseCalculator/app_coordinator.py
Python
mit
424
# Copyright (c) 2008, Aldo Cortesi. 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,...
kynikos/qtile
libqtile/window.py
Python
mit
45,570
def safe_pawns(pawns): safePawns = 0 for pawn in pawns: col = pawn[0] row = pawn[1] defenseRow = str(int(row)-1) defenseLeft = chr(ord(col)-1) + defenseRow defenseRight = chr(ord(col)+1) + defenseRow if defenseLeft in pawns or defenseRi...
Pouf/CodingCompetition
CiO/pawn-brotherhood.py
Python
mit
395
import unittest from bpython import inspection class TestInspection(unittest.TestCase): def test_is_callable(self): class OldCallable: def __call__(self): pass class Callable(object): def __call__(self): pass class OldNoncallable: ...
5monkeys/bpython
bpython/test/test_inspection.py
Python
mit
1,387
# -*- coding: utf-8 -*- """ pyyp.client ~~~~~~~~~~~ This module provides the http client for Yunpian. """ import logging import requests from .exceptions import RequestException, Timeout from .utils import encode_params logger = logging.getLogger(__name__) class Client(object): """Client to send requests"""...
pragkent/pyyp
pyyp/client.py
Python
mit
1,631
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from ebstall.deployers.openvpn import OpenVpnConfig __author__ = 'dusanklinec' test1 = """client-to-client server 10.8.0.0 255.255.255.0 ;server 10.7.0.0 255.255.255.0 key server.key # This file should be kept secret ;key server.key # This file should ...
EnigmaBridge/ebstall.py
ebstall/tests/test_openvpnparser.py
Python
mit
7,696
import logging import numpy as np from src.iBeatles.fitting.kropff.kropff_automatic_threshold_algorithms import Algorithms from src.iBeatles.utilities.table_handler import TableHandler class KropffBraggPeakThresholdCalculator: def __init__(self, parent=None, grand_parent=None): self.parent = parent ...
ornlneutronimaging/iBeatles
src/iBeatles/fitting/kropff/kropff_bragg_peak_threshold_calculator.py
Python
mit
3,672
from __future__ import print_function import numpy as np import matplotlib.pyplot as plt from pgmult.distributions import PGMultinomial from pgmult.utils import compute_uniform_mean_psi, pi_to_psi, psi_to_pi def test_psi_pi_conversion(): K = 10 pi = np.ones(K) / float(K) psi = pi_to_psi(pi) pi2 = ps...
fivejjs/pgmult
test/test_psi_pi.py
Python
mit
3,554
'''oscaar v2.0 Module for differential photometry Extends dataBank functionality to output the graph to the filesystem. ''' from matplotlib import pyplot as plt from dataBank import dataBank class dataBankFileOutput(dataBank): def __init__(self, initParFilePath=None, imageFilePath=None): self....
bluegod/OSCAAR
oscaar/dataBankFileOutput.py
Python
mit
541
# Maximum value of the prime n = int(input("What number should I go up to? ")) # The prime p = 2 # The number of the prime x = 0 for p in range(2, n+1): for i in range(2, p): if p % i == 0: break else: x +=1 print ("#", x, "->",100 p), print ("Done")
Praenomen/My-Project-Euler
Python/Problem007.py
Python
mit
296
""" This file is part of the everest project. See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information. Created on Feb 21, 2012. """ from everest.resources.storing import build_resource_dependency_graph from everest.resources.utils import get_member_class from everest.testing import TestCaseWithCon...
helixyte/everest
everest/tests/test_resourcegraphs.py
Python
mit
2,059
# -*- coding: utf-8 -*- # Generated by Django 1.10a1 on 2016-06-23 11:18 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('discussions', '0013_auto_2...
Udayraj123/dashboard_IITG
Binder/discussions/migrations/0014_auto_20160623_1648.py
Python
mit
590
#!/usr/bin/env python from __future__ import print_function from os.path import expanduser import syslog import urllib2 import json from user_data import get_user_data # Logs in to docker index if auth is given (builds ~/.dockercfg) # docker.email: Email address to login in as # docker.auth: Base64-encoded login (user...
hayesgm/cerberus
scripts/docker_login.py
Python
mit
956
# Copyright (c) 2015 Xilinx Inc. # # 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, distrib...
Xilinx/hopper
hopper/utils/tasks.py
Python
mit
5,205
import pafy def dl_audiostream(url, path=''): """download audiostream from youtube :url: the youtube url :returns: filename of the downloaded file """ video = pafy.new(url) audio = video.getbestaudio() if path != '': path = "%s/%s" %(path, audio.filename) name = audio.download...
bastinat0r/webaudio
youtube.py
Python
mit
615
from .messages import * class BaseAction(object): """ This class represents a base action """ def __init__(self, shdr): self.header = shdr self.messages = [] @classmethod def get_message_class(cls): """ This method returns the message class associated with the ...
Korrigan/pfstatelogger
pfsync/actions.py
Python
mit
3,637
#!/usr/bin/env python """ Predict firing rates from calcium traces. Examples: c2s predict -p 1 data.pck predictions.xpck c2s predict -m model.xpck data.preprocessed.pck predictions.xpck c2s predict -t mat data.preprocessed.pck predictions.mat """ import sys from argparse import ArgumentParser from pickle import...
lucastheis/c2s
scripts/c2s-predict.py
Python
mit
1,863
from random import randint print ('Bem vindo!') secreta = randint(1, 100) tentativa = 0 while True: chute = int(input('Chute um número: ')) tentativa += 1 if chute == secreta: print ('Parabéns! Você acertou o número %d na %dª tentativa' %(secreta, tentativa)) break else: ...
outrofelipe/Python-para-zumbis
exercicios-e-exemplos/chute2.py
Python
mit
402
# -*- coding: utf-8 -*- from selenium import webdriver class tweetshot: def __init__(self): self.driver = webdriver.PhantomJS() def __exit__(self): self.driver.quit() def take_screenshot(self, url, output): self.driver.get(url) e = self.driver.find_elemen...
todd64/screenshot-tweet
screenshot-tweet.py
Python
mit
1,406
from flask import render_template, redirect, url_for, request, flash, Blueprint from app import forms, models, db, login_manager from flask.ext.login import login_user, login_required, logout_user import datetime bp = Blueprint('app', __name__) @login_manager.user_loader def load_user(username): return models.Us...
jawrainey/atc
app/views.py
Python
mit
1,790
from __future__ import absolute_import from django import forms from django.utils.translation import ugettext_lazy as _ from django.core.validators import MinValueValidator from fobi.base import BaseFormFieldPluginForm, get_theme from fobi.settings import DEFAULT_MAX_LENGTH, DEFAULT_MIN_LENGTH from fobi.widgets impor...
mansonul/events
events/contrib/plugins/form_elements/fields/email/forms.py
Python
mit
3,065
"""" Contains code to: - hit the Sierra request-API """ import datetime, json, logging, os, pprint import requests from requests.auth import HTTPBasicAuth log = logging.getLogger(__name__) class SierraHelper( object ): """ Gets item_id and places hold. """ def __init__( self ): pass s...
birkin/easyrequest_project
easyrequest_app/lib/sierra.py
Python
mit
3,821
#Exercise A.1.1: Interest rates #Author: Andreas Solberg Sagen - University of Oslo
exTerEX/PrimeOnScientificProgramming
Chapter A/module1.py
Python
mit
84
import sys import traceback import os import logging from six.moves import range from six.moves import zip from io import open from datetime import datetime from .version import __version__ from .plugins import default_plugin_manager logger = logging.getLogger('honeybadger.payload') def error_payload(exception, exc...
honeybadger-io/honeybadger-python
honeybadger/payload.py
Python
mit
3,579
from ctypes import c_char, c_ubyte, c_short, c_ushort, c_int, c_uint, c_ulong, c_long, pointer, Structure dsInt8_t = c_char dsUint8_t = c_ubyte dsInt16_t = c_short dsUint16_t = c_ushort dsInt32_t = c_int dsUint32_t = c_uint dsULong_t = c_ulong dsLong_t = c_long dsChar_t = c_char def dsTEXT(x): return x dsString_...
DenisKuzin/python-tsm
dsmapips.py
Python
mit
1,044
# Python - 3.6.0 test.assert_equals(char_freq('I like cats'), {'a': 1, ' ': 2, 'c': 1, 'e': 1, 'I': 1, 'k': 1, 'l': 1, 'i': 1, 's': 1, 't': 1})
RevansChen/online-judge
Codewars/8kyu/character-frequency-2/Python/test.py
Python
mit
145
#!/usr/bin/python import socket import fcntl import struct import argparse from json import load from urllib2 import urlopen parser = argparse.ArgumentParser() parser.add_argument ("-s","--server", help="add server url") parser.add_argument ("-i","--ip", help="add parameter for ip in url") parser.add_argument ("-n","...
tsevillano/ip.py
ip.py
Python
mit
1,018
import asyncio import sys import settings if __name__ == "__main__": user_settings = settings.load_user_settings() settings.set_settings(user_settings) if sys.platform == 'win32': loop = asyncio.ProactorEventLoop() asyncio.set_event_loop(loop) from communication import server, pubsub, topics from int...
osspeak/osspeak
osspeak/main.py
Python
mit
1,630
import sys import telnetlib import logging logger = logging.getLogger(__name__) class adbConsole: def __init__(self, host="localhost",port=5554): self.HOST = host self.PORT = port self.tn = telnetlib.Telnet(self.HOST,self.PORT) #read all the adb stuff self.tn.read_until("OK") def __del__(s...
tvidas/a5
scripts/bin/adbconsole.py
Python
mit
1,278
# -*- coding: utf8 -*- import sys import os import logging import argparse from datetime import datetime from collections import defaultdict from common_tools import parent_parser from parser import Request_Parser, Response_Parser from config import settings from image import image_type_detection, compress_image_by_we...
CharlesZhong/Mobile-Celluar-Measure
http_parser/main.py
Python
mit
5,954
import re import time lowest_cost = 9999999999999 best_spells = [] # MUCH faster than deepcopy def spell_copy(spells): return {'recharge' : [x for x in spells['recharge']], 'poison' : [x for x in spells['poison']], 'shield' : [x for x in spells['shield']], 'magic missile' : [x for x in spells['magic missile...
JulienCote/advent_of_code_2015
day22/wizard_battle.py
Python
mit
3,890
""" Milestones [x] display a diff of two files [x] color code the diff [x] populate output area after 'compare button' is pressed [x] accept pasted data [x] track download button event [x] make diff downloadable [x] autofill from gist combo ( webdiff/gist_id1-gist_id2 ) [x] deal with multifile gists somehow ( must gath...
zeffii/GAE-webdiff
webdiff.py
Python
mit
4,959
# -*- coding: utf-8 -*- from bs4 import BeautifulSoup import requests import pickle import os import time import re import sys WJN_BASE_URL = 'http://wjn.jp' WJN_URL = 'http://wjn.jp/article/category/7/' index_list_pkl = 'wjn_cat7_index_link_list.pkl' sys.setrecursionlimit(1000000) class WjnContents(): def __in...
hanarchy/DetectWjnAuthor
get_wjn_content.py
Python
mit
4,180
from __future__ import print_function, division, absolute_import # Local imports from rapid.common.spectrum import spectrum, SpectrumError, ZMat from rapid.common.utils import normalize, clip, numerics, write_data from rapid.common.save_script import save_script from rapid.common.read_input import read_input __all__...
jensengrouppsu/rapid
rapid/common/__init__.py
Python
mit
537
#!/usr/bin/python from controller.client import ClientController from controller.movie import MovieController from controller.rent import RentController from domain.session import Session from repository.fileclient import FileClientRepository from repository.filemovie import FileMovieRepository from repository.fileren...
leyyin/university
fundamentals-of-programming/labs/lab_5-11/app.py
Python
mit
2,835
# vim: set fileencoding=utf8 : from __future__ import with_statement from __future__ import unicode_literals import os import random import string import codecs from six import StringIO, BytesIO import logging import socket from pytds.tds_types import TimeType, DateTime2Type, DateType, DateTimeOffsetType, BitType, Tin...
tpow/pytds
tests/all_test.py
Python
mit
40,325
import pytest from parglare import Grammar, GrammarError def test_terminal_exists_noerror_on_terminal_definition_before(): """ Test the situation where we have inline terminal used but the same terminal is defined in the `terminals` section. """ grammar = """ Program: "begin" stat...
igordejanovic/parglare
tests/func/regressions/test_terminal_exists_noerror_on_terminal_definition_before.py
Python
mit
720
class LRUCache(object): def __init__(self, size): self.size = size self.cache = {} self.priorities = [] def adjust(self, key): item_index = self.priorities.index(key) self.priorities[:] = self.priorities[:item_index] + self.priorities[item_index+1:] self.priorit...
mmayet/mmayet.github.io
projects/lru_cache_mud_mayet.py
Python
mit
1,373
def kwo(*a, c): print(a, c) kwo(1, 2, 3, c=7) # prints: (1, 2, 3) 7 kwo(c=4) # prints: () 4 # kwo(1, 2) # breaks, invalid syntax, with the following error # TypeError: kwo() missing 1 required keyword-only argument: 'c' def kwo2(a, b=42, *, c): print(a, b, c) kwo2(3, b=7, c=99) # prints: 3 7 99 ...
mkhuthir/learnPython
Book_learning-python-r1.1/ch4/arguments.keyword.only.py
Python
mit
490
""" WSGI config for RealBack 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.10/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SET...
martinlunde/RealBack
RealBack/wsgi.py
Python
mit
541
# -*- coding: utf-8 -*- # # WebAlerts documentation build configuration file, created by # sphinx-quickstart on Thu Jan 31 11:29:44 2013. # # 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 # autogenerated file. # # A...
clee704/WebAlerts
docs/conf.py
Python
mit
8,018
import typing import requests from stampman.services import base from stampman.helpers import config_, mail_, exceptions_ class MailgunEmailService(base.AbstractEmailService): def __init__(self, config: typing.NamedTuple = None, failure_mode: bool = False, domain: str = None): self._fail...
thunderboltsid/stampman
stampman/services/mailgun/mailgun.py
Python
mit
1,801
"""Utility functions used by projects. """ import fnmatch import os import re import subprocess import traceback import logging from httplib2 import Http from django.conf import settings from distutils2.version import NormalizedVersion, suggest_normalized_version import redis log = logging.getLogger(__name__) def...
phalcon/readthedocs.org
readthedocs/projects/utils.py
Python
mit
6,659
#!/usr/bin/env python import sys from setuptools import setup, find_packages from setuptools.command.test import test class Tox(test): def finalize_options(self): test.finalize_options(self) self.test_args = [] self.test_suite = True def run_tests(self): import tox er...
kxz/interstat
setup.py
Python
mit
1,618
"""Service Client""" # pylint: disable=too-many-arguments import warnings from json import loads from launchkey.exceptions import InvalidParameters, \ UnableToDecryptWebhookRequest, UnexpectedAuthorizationResponse, \ UnexpectedAPIResponse, UnexpectedWebhookRequest, XiovJWTValidationFailure,\ XiovJWTDecry...
iovation/launchkey-python
launchkey/clients/service.py
Python
mit
21,659
from revscoring.utilities.fetch_idioms import is_idiom def test_is_idiom(): phrases = [ 'Appendix:English 19th Century idioms', 'about to', 'activist justice', 'attaboy', 'bat for the other team', 'beard the lion in his den', 'as gentle as a dove'...
wiki-ai/revscoring
tests/utilities/test_fetch_idioms.py
Python
mit
496
from django.apps import AppConfig class AuthConfig(AppConfig): name = 'apps.auth' label = 'qr_server_auth'
ycheng-aa/qr_server
apps/auth/apps.py
Python
mit
117
#!/usr/bin/python from menuclass import * from empClass import * from functions import * employees = [] mainMenu = MainMenu() while True: cmd = raw_input("What you want to DO: ") br() if cmd.lower() == "q": print "Quiting Now......" waits() exit() elif cmd.lower() == "m": while True: sldOpt = "" ...
imughal/EmployeeScript
main.py
Python
mit
893
# ValPy -- Validate.R in Python # Author: Dustin Landers # Contact: (770 289-8830 :: dustin.landers@gmail.com """Dependencies""" from commandline import * from fileimport import * from checkhidden import * """Main function and execution""" def main(): initializeGraphics() folder, analysis, truth, snp, score, beta...
mtnman38/ktaR
valpy/validate.py
Python
mit
1,338
# -*- coding: utf-8 -*- """ Master Dictionary Translations 0: English 1: Chinese 2: Dutch 3: French 4: Italian 5: Japanese 6: Korean 7: Portuguese 8: Russian 9: Spanish """ class MD_F: # Master Dictionary Functions def get_languages_list(): languages = [] languages.append("English") ...
mdmintz/SeleniumBase
seleniumbase/translate/master_dict.py
Python
mit
99,028
from plotly.basedatatypes import BaseTraceType as _BaseTraceType import copy as _copy class Scatter(_BaseTraceType): # class properties # -------------------- _parent_path_str = "" _path_str = "scatter" _valid_props = { "cliponaxis", "connectgaps", "customdata", "c...
plotly/python-api
packages/python/plotly/plotly/graph_objs/_scatter.py
Python
mit
107,803
from lasagne.layers import DenseLayer, DropoutLayer, batch_norm from lasagne.regularization import regularize_layer_params_weighted, l1, l2 import utils class Layer(object): def __init__(self, layers_info): self.non_linearity = layers_info['non_linearity'] self.n_hidden = layers_i...
louishenrifranc/spearmint-for-neural-network
script/Layer.py
Python
mit
1,980
from app import app, db from flask import json, request, abort, render_template from models import Sensor, Measure from datetime import datetime import time @app.route('/', methods=['GET']) def index(): return 'Hello, world.' @app.route('/api/sensors', methods=['GET']) @app.route('/api/sensors/<int:id>', methods=['...
aguegu/busykoala-rpi
app/views.py
Python
mit
1,013
# -*- coding: utf-8 -*- from setuptools.command import easy_install import importlib import pkg_resources # If pip is not installed, install it try: import pip except ImportError: easy_install.main(['-U','pip']) finally: pkg_resources.require('pip') import pip # Install external packages packages = ['m...
yenbekbay/ion-downloader
IonDownloader/Python/imports.py
Python
mit
498
import re import logging import argparse from weblib.logs import default_logging from spiders.blogs import DataScienceBlogsSpider from settings import db_connection logger = logging.getLogger(__name__) if __name__ == '__main__': default_logging(grab_log='var/grab.log', level=logging.DEBUG, mode='w', ...
istinspring/grab-datascience-blogs
cli.py
Python
mit
3,773
# from materials.tests import * # from analysis.tests import * # from analysis.thermodynamics.tests import * # from io.tests import *
wolverton-research-group/qmpy
qmpy/tests.py
Python
mit
134
from codegen import * from secd import * import sys # read eval print loop machine = SECD() while True: line = input('SECDrepl> ') code = codegen(parse(line), [], ['stop']) machine.runProgram(code, [])
yarbroughw/secdpy
repl.py
Python
mit
219
# coding: utf-8 """Webmail tests.""" from __future__ import unicode_literals import os import shutil import tempfile try: import mock except ImportError: from unittest import mock from six import BytesIO from django.core import mail from django.urls import reverse from modoboa.admin import factories as ad...
modoboa/modoboa-webmail
modoboa_webmail/tests/test_views.py
Python
mit
14,655
import sublime import os import sys import re from .test_package import UnitTestingCommand try: import coverage except Exception: print("coverage not found.") class UnitTestingCoverageCommand(UnitTestingCommand): def unit_testing(self, stream, package, settings): package_path = os.path.join(subl...
randy3k/UnitTesting
unittesting/test_coverage.py
Python
mit
2,342
# -*- coding: utf-8 -*- from elasticsearch_dsl import DocType, Keyword, Float, Nested, Date, Long, Short, Boolean from elasticsearch_dsl import MetaField class Account(DocType): # 机器人名字 botName = Keyword() # 可用现金 cash = Float() # 具体仓位 positions = Nested() # 市值 value = Float() # 市值...
foolcage/fooltrader
fooltrader/domain/business/es_account.py
Python
mit
1,971