code
stringlengths
6
947k
repo_name
stringlengths
5
100
path
stringlengths
4
226
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
6
947k
# -*- coding: utf-8 -*- """Tests for the eventstreams module.""" # # (C) Pywikibot team, 2017 # # Distributed under the terms of the MIT license. # from __future__ import absolute_import, unicode_literals from types import FunctionType from tests import mock from pywikibot.comms.eventstreams import EventStreams from...
magul/pywikibot-core
tests/eventstreams_tests.py
Python
mit
8,303
from sys import byteorder from array import array from struct import pack from multiprocessing import Process import unreal_engine as ue import pyaudio import wave THRESHOLD = 500 CHUNK_SIZE = 1024 FORMAT = pyaudio.paInt16 RATE = 44100 def is_silent(snd_data): "Returns 'True' if below the 'silent' t...
jbecke/VR-Vendor
AmazonCompetition/Content/Scripts/record.py
Python
mit
3,740
import setuptools if __name__ == '__main__': setuptools.setup( name="groupmestats", version="0.0.1", author="Kyle Teske", author_email="kjteske@gmail.com", description="Calculating and displaying groupme statistics", packages=setuptools.find_packages(), licen...
kjteske/groupmestats
setup.py
Python
mit
1,136
# Copyright (c) 2006-2015 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr> # Copyright (c) 2012-2014 Google, Inc. # Copyright (c) 2013 buck@yelp.com <buck@yelp.com> # Copyright (c) 2014-2020 Claudiu Popa <pcmanticore@gmail.com> # Copyright (c) 2014 Brett Cannon <brett@python.org> # Copyright (c) 2014 Arun Persaud <aru...
ruchee/vimrc
vimfiles/bundle/vim-python/submodules/pylint/pylint/checkers/imports.py
Python
mit
38,570
from flask import Flask, render_template from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.mail import Mail from flask.ext.assets import Environment #from flask.ext.admin import Admin #from flask_debugtoolbar import DebugToolbarExtension app = Flask(__name__) app.config.from_object('config') # SelectiveHTMLCo...
ics/doc8643
app/__init__.py
Python
mit
930
#-*- coding: UTF-8 -*- from bs4 import BeautifulSoup import logging import sys import re from .cleaners import clean_tag from .cleaners import clean_spam import gzip log = logging.getLogger("tidypage.extractor") TEXT_TAG_COLLECTION = {"p":5, "span":4, "font":3, "i":2, "b":1, "pre": 1} REGEXES = { 'positiveRe': re...
desion/tidy_page
tidypage/extractor.py
Python
mit
13,177
import string, urllib, urllib2, logging from webapp2_extras import json import Handlers, Config class FoursquareException(Exception): def __init__(self, message, value): super(self, Exception).__init__(message) self.value = value class FoursquareApiException(FoursquareException): pass class Four...
timgilbert/how-you-been
src/howyoubeen/Foursquare.py
Python
mit
3,878
import _plotly_utils.basevalidators class ColorsrcValidator(_plotly_utils.basevalidators.SrcValidator): def __init__( self, plotly_name="colorsrc", parent_name="waterfall.insidetextfont", **kwargs ): super(ColorsrcValidator, self).__init__( plotly_name=plotly_name, pare...
plotly/python-api
packages/python/plotly/plotly/validators/waterfall/insidetextfont/_colorsrc.py
Python
mit
472
from json import loads import codecs import environ FIXTURE_PATH = (environ.Path(__file__) - 1).path('fixtures') def read_json(fpath): with codecs.open(fpath, 'rb', encoding='utf-8') as fp: return loads(fp.read()) def read_fixture(*subpath): fixture_file = str(FIXTURE_PATH.path(*subpath)) retu...
Rustem/toptal-blog-celery-toy-ex
celery_uncovered/tricks/utils.py
Python
mit
347
from .core import * from .sgr import * from .orphan import * from .propermotion import * from .velocity_transforms import *
abonaca/gary
gary/coordinates/__init__.py
Python
mit
124
# -*- coding: utf-8 -*- from __future__ import unicode_literals import django.utils.timezone import model_utils.fields from django.conf import settings from django.db import migrations, models import waldur_core.core.fields import waldur_core.structure.models class Migration(migrations.Migration): replaces = [...
opennode/nodeconductor
waldur_core/users/migrations/0001_squashed_0004.py
Python
mit
3,908
"""Unittests for the barrista project.""" # pylint: disable=F0401, C0330, C0302, C0103, R0201, R0914, R0915, W0212 # pylint: disable=no-name-in-module, no-member import unittest import logging logging.basicConfig(level=logging.WARN) try: import cv2 # pylint: disable=W0611 CV2_AVAILABLE = True except ImportEr...
classner/barrista
tests.py
Python
mit
108,780
#!usr/bin/python ''' Overlay classes and satellite data ''' import os,csv,json import utils.gdal_rasterize as gdal_rasterize from PIL import Image from functools import partial from multiprocessing import Pool from utils.coordinate_converter import CoordConvert from utils.getImageCoordinates import imageCoordinates fro...
worldbank/cv4ag
modules/overlay.py
Python
mit
12,673
# 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/security/azure-mgmt-security/azure/mgmt/security/operations/_regulatory_compliance_controls_operations.py
Python
mit
9,157
# -*- coding: utf-8 -*- import re import logging from completor.utils import check_subseq from .utils import parse_uri word_pat = re.compile(r'([\d\w]+)', re.U) word_ends = re.compile(r'[\d\w]+$', re.U) logger = logging.getLogger("completor") # [ # [{ # u'range': { # u'start': {u'line': 273, u'ch...
maralla/completor.vim
pythonx/completers/lsp/action.py
Python
mit
3,344
"""nightcrawler URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Clas...
ZucchiniZe/nightcrawler
nightcrawler/urls.py
Python
mit
992
#!/usr/bin/env python # -*- coding: utf-8 -*- """ HTTP streaming toolbox with flow control, written in Python. :copyright: (c) 2014 Runzhou Li (Leo) :license: The MIT License (MIT), see LICENSE for details. """ __title__ = 'tidehunter' __version__ = '1.0.1' VERSION = tuple(map(int, __version__.split('.'))) __author_...
woozyking/tidehunter
tidehunter/__init__.py
Python
mit
858
"""Task Utilities. @see: Cake Build System (http://sourceforge.net/projects/cake-build) @copyright: Copyright (c) 2010 Lewis Baker, Stuart McMahon. @license: Licensed under the MIT license. """ import sys import threading _threadPool = None _threadPoolLock = threading.Lock() def setThreadPool(threadPool): """Set ...
lewissbaker/cake
src/cake/task.py
Python
mit
15,540
# encoding: utf-8 import json import os.path from time import time from itertools import chain from collections import defaultdict from gevent import wsgi from flask import Flask, make_response, request, render_template from . import runners from .cache import memoize from .runners import MasterLocustRunner from loc...
pglass/locust
locust/web.py
Python
mit
6,577
""" MERGEJSON - command-line utility Given a set of .json files, this merges them in time order. Each file must contain a JSON list of messages, of the form: [ { "$id" : 123, "$ts" : 456, "other" : "stuff" }, { "$id" : 234, "$ts" : 567, "more" : "stuff" } ] ...
DevicePilot/synth
synth/analysis/mergejson.py
Python
mit
3,010
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2012, Yujin Robot # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must r...
CARMinesDouai/MultiRobotExplorationPackages
inria_demo/scripts/autodock_client.py
Python
mit
3,861
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Saverio Giallorenzo # Copyright (c) 2018 Saverio Giallorenzo # # License: MIT # from SublimeLinter.lint import Linter, util # or NodeLinter, PythonLinter, ComposerLinter, RubyLinter class Lacheck(Linter): cmd =...
thesave/SublimeLinter-contrib-lacheck
linter.py
Python
mit
650
import os import sys sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/' + '..')) from models import gru_simple from helpers import checkpoint # Get the review summary file review_summary_file = 'extracted_data/review_summary.csv' # Initialize Checkpointer to ensure checkpointing checkpointer = checkpoint...
harpribot/deep-summarization
train_scripts/train_script_gru_simple_attn.py
Python
mit
879
from importlib import import_module from django.apps import AppConfig as BaseAppConfig class AppConfig(BaseAppConfig): name = "moleculeci" def ready(self): import_module("moleculeci.receivers")
iModels/ffci
moleculeci/apps.py
Python
mit
215
""" Python unit-test """ import unittest import numpy as np import numpy.testing as npt from .. import qr_decomposition class TestHouseholderReflection(unittest.TestCase): """Test case for QR decomposition using Householder reflection.""" def test_wikipedia_example1(self): """Test of Wikipedia exa...
danbar/qr_decomposition
qr_decomposition/tests/test_householder_reflection.py
Python
mit
1,155
#!/usr/bin/env python """ EvoLife Cellular Automaton implementation using CUDA. Rules are: - Each living cell has its own birth/sustain ruleset and an energy level; - Cell is loosing all energy if number of neighbours is not in its sustain rule; - Cell is born with max energy if there are exactly N neighbours with N i...
a5kin/evolife
evolife.py
Python
mit
16,479
# -*- coding: utf-8 -*- import datetime from django.shortcuts import render from django.utils.timezone import now from django.utils.translation import ugettext_lazy as _ def home(request): today = datetime.date.today() return render(request, "taskbuster/index.html", {'today': today, ...
caithess/taskbuster
taskbuster/views.py
Python
mit
451
#!/usr/bin/python # -*- coding: UTF-8 -*- # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: import json import requests class Instapush(object): def __init__(self, user_token): self.user_token = user_token self._headers = {} @property def headers(self): if not self._headers:...
adamwen829/instapush-py
instapush/instapush.py
Python
mit
2,190
""" This file is for biased simulation for alanine dipeptide only, it is used as the test for more general file biased_simulation_general.py, which could be easily extend to other new systems. """ from ANN_simulation import * from simtk.openmm.app import * from simtk.openmm import * from simtk.unit import * from sys i...
weiHelloWorld/accelerated_sampling_with_autoencoder
MD_simulation_on_alanine_dipeptide/current_work/src/biased_simulation.py
Python
mit
16,759
# # -*- coding: utf-8 -*- # # Copyright © 2013 Kimmo Parviainen-Jalanko <k@77.fi> # # 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 right...
kimvais/nimismies
nimismies/__init__.py
Python
mit
1,159
#!/usr/bin/python # -*- coding: utf-8 -*- from os import path, environ class Config(object): DEBUG = False PORT = 5000 HOST = "0.0.0.0" SQLALCHEMY_ECHO = True BASE_URL = "http://{{ PROJECT_NAME }}.com" PROJECT_ROOT = path.abspath(path.dirname(__file__)) TEMPLATE_FOLDER = path.join(PROJECT...
mikeywaites/flask-skeleton
{{PROJECT_NAME}}/config.py
Python
mit
1,292
import pytest from tests.compiler import compile_base, internal_call from thinglang.compiler.opcodes import OpcodePushStatic, OpcodePushLocal INLINING_TEST_PROGRAM = ''' thing Program setup number n1 = 0 number n2 = 1 {} static does add with number a, number b a + b ...
ytanay/thinglang
tests/compiler/test_inlining.py
Python
mit
1,570
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "munger_builder.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
cscanlin/munger-builder
manage.py
Python
mit
257
# -*- coding: utf-8 -*- from __future__ import print_function,division,absolute_import import logging log = logging.getLogger(__name__) # __name__ is "foo.bar" here import os import numpy as np from datastorage import DataStorage from .string import timeToStr np.seterr(all='ignore') try: import progressbar as pb ...
marcocamma/trx
trx/utils/misc.py
Python
mit
4,140
import os, sys, subprocess from PySide import QtCore,QtGui class ProcessThread(QtCore.QThread): def __init__(self,program,path): super(ProcessThread,self).__init__() self.path = path self.program = program def run(self): subprocess.call([self.program,self.path])
Symphonia/Searcher
ProcessThread.py
Python
mit
306
import re print " Write product name : " nume_produs = raw_input() print " Write product price : " cost_produs = input() if (nume_produs == re.sub('[^a-z]',"",nume_produs)): print ('%s %d'%(nume_produs,cost_produs)) else: print "Error ! You must tape letters" input()
ActiveState/code
recipes/Python/578947_Validate_product/recipe-578947.py
Python
mit
281
#!/usr/bin/env python """zemanta.py: Get suggestions from zemanta. Last modified: Sat Jan 18, 2014 05:01PM """ __author__ = "Dilawar Singh" __copyright__ = "Copyright 2013, Dilawar Singh" __license__ = "GPL" __version__ = "1.0.0" __maintainer__ = "Dilawar Singh" __email...
dilawar/pywordpress
pyblog/zemanta.py
Python
mit
926
# -*- coding: utf-8 -*- import spidev import math def reverse_bit_order(x): x_reversed = 0x00 if (x & 0x80): x_reversed |= 0x01 if (x & 0x40): x_reversed |= 0x02 if (x & 0x20): x_reversed |= 0x04 if (x & 0x10): x_reversed |= 0x08 if (x & 0x08): x_reversed |= 0x10 if (x & 0x04): x_...
extsui/7SegFinger
test_8digit.py
Python
mit
4,304
""" .. module:: python-etcd :synopsis: A python etcd client. .. moduleauthor:: Jose Plana <jplana@gmail.com> """ import logging try: # Python 3 from http.client import HTTPException except ImportError: # Python 2 from httplib import HTTPException import socket import urllib3 import urllib3.util im...
dmonroy/python-etcd
src/etcd/client.py
Python
mit
27,306
#import results # Not using results? import loc import json #asinfo = results.asinfo locinfo = loc.locinfo #fields = asinfo["fields"] #del asinfo["fields"] #print fields # for asn, dat in asinfo.items(): # if int(asn) in locinfo: # dat.extend(locinfo[int(asn)]) # else: # dat.extend([0, 0]) # # for asn, dat i...
steamclock/internetmap
Data-Pipeline/converttojson.py
Python
mit
646
import unittest import os from PIL import Image from SUASSystem.utils import crop_target class SUASSystemUtilsDataFunctionsTestCase(unittest.TestCase): def test_crop_image(self): """ Test the crop image method. """ input_image_path = "tests/images/image2_test_image_bounder.jpg" ...
FlintHill/SUAS-Competition
tests/unit_tests/test_suassystem_utils_data_functions.py
Python
mit
1,006
from collections import namedtuple from typing import Optional class License(namedtuple("License", "id name is_osi_approved is_deprecated")): id: str name: str is_osi_approved: bool is_deprecated: bool CLASSIFIER_SUPPORTED = { # Not OSI Approved "Aladdin", "CC0-1.0", ...
python-poetry/poetry-core
src/poetry/core/spdx/license.py
Python
mit
5,634
"""Truncate graph by distance, bounding box, or polygon.""" import networkx as nx from . import utils from . import utils_geo from . import utils_graph def truncate_graph_dist(G, source_node, max_dist=1000, weight="length", retain_all=False): """ Remove every node farther than some network distance from sou...
gboeing/osmnx
osmnx/truncate.py
Python
mit
6,740
import numpy from chainer.backends import cuda from chainer import optimizer _default_hyperparam = optimizer.Hyperparameter() _default_hyperparam.lr = 0.01 _default_hyperparam.alpha = 0.99 _default_hyperparam.eps = 1e-8 _default_hyperparam.eps_inside_sqrt = False class RMSpropRule(optimizer.UpdateRule): """Up...
rezoo/chainer
chainer/optimizers/rmsprop.py
Python
mit
4,921
from django.db import models from OctaHomeCore.models import * class ButtonInputDevice(InputDevice): ButtonOneAction = models.ForeignKey('OctaHomeCore.TriggerEvent', related_name="oneButtonActions", blank=True, null=True, on_delete=models.SET_NULL) ButtonTwoAction = models.ForeignKey('OctaHomeCore.TriggerEvent', rel...
Tomcuzz/OctaHomeAutomation
OctaHomeDeviceInput/models.py
Python
mit
1,014
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse from collections import OrderedDict import imp import time import logging import itertools import os import numpy as np from path import Path import theano import theano.tensor as T import lasagne from fuel.datasets import CelebA from gan.util import ( ...
spellrun/Neural-Photo-Editor
gan/sample_ian.py
Python
mit
5,521
import re import os import sys from Bio import Seq from Bio import SeqIO import pandas as pd import itertools import numpy as np path = "/home/venevs/fludb_pH1N1" # seg5-GenomicFastaResults.fasta # seg7.afa centroids = SeqIO.parse(os.path.join(path,"nr.fasta"),"fasta") clust_msa = SeqIO.parse(os.path.join(path,"seg1....
sergpolly/FluUtils
FluDB_coding_aln/DEPRECEATED/cluster_msa_processing.py
Python
mit
2,495
from urllib.request import urlopen from bs4 import BeautifulSoup import time # time will allow a delay in program execution # added 2 time delays: One for each page while scraping the URLs, # and one for each page while scraping the text about each player # also added get_text() in the get_player_details() function ...
macloo/web-scraper-steps
MLS_scraper_4.py
Python
mit
1,865
import sys import os import struct import binascii from time import sleep from ctypes import (CDLL, get_errno) from ctypes.util import find_library from socket import (socket, AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI, SOL_HCI, HCI_FILTER,) os.system("hciconfig hci0 down") os.system("hciconfig hci0 up") if not os.geteuid()...
jsantoso91/smartlighting
characterizeRSSI.py
Python
mit
1,721
import csv from numpy import histogram def review_stats(count_ratings, length): # print "in extract_rows" ip_csv = "data\input\yelp_academic_dataset_review_ext.csv" with open(ip_csv, "rb") as source: rdr = csv.reader(source) firstline = True for r in rdr: if firstline: ...
abhirevan/Yelp-Rate-my-Review
src/review_stats.py
Python
mit
2,318
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unittest import os from ovm.exceptions import OVMError from ovm.resources.resources import Resources ROOT = os.path.dirname(os.path.realpath(__file__)) CONFIG = os.path.join(ROOT, 'files', 'resources.yml') class TestResourceLoader(unittest.TestCase): def ...
lightcode/OVM
tests/test_resource_loader.py
Python
mit
1,714
"""Test methods in duco/modbus.py.""" import unittest from duco.const import (DUCO_MODULE_TYPE_MASTER, DUCO_MODULE_TYPE_ACTUATOR_PRINT) from duco.enum_types import (ModuleType) class TestModuleType(unittest.TestCase): def test_supported(self): for idx in range(DUCO_MODULE_TYPE_MAST...
luuloe/python-duco
tests/test_enum_types.py
Python
mit
569
import os, sys dirname = os.path.dirname(__file__) lib_path = os.path.join(dirname, "python_speech_features") sys.path.append(lib_path) import features as speechfeatures import numpy as np def filter(samplerate, signal, winlen=0.02, winstep=0.01, nfilt=40, nfft=512, lowfreq=100, highfreq=5000, preemph=0.9...
twerkmeister/iLID
preprocessing/audio/melfilterbank.py
Python
mit
1,553
from qlibcj import * def DJAlg(size, U_f, **kwargs): # U_f es el oraculo, que debe tener x1..xn e y como qubits. Tras aplicarlo el qubit y debe valer f(x1..xn) XOR y. El argumento size es n + 1, donde n es el numero de bits de entrada de f. rnd.seed(kwargs.get('seed', None)) # Para asegurar la repetibilidad fijamos l...
JhooClan/QLibCJ
qalg.py
Python
mit
9,431
from collections import Counter def TFIDF(TF, complaints, term): if TF >= 1: n = len(complaints) x = sum([1 for complaint in complaints if term in complaint['body']]) return log(TF + 1) * log(n / x) else: return 0 def DF(vocab, complaints): term_DF = dict() for term in ...
ryanarnold/complaints_categorizer
categorizer/feature_selection.py
Python
mit
2,179
#!/usr/bin/python3 import machine from update_display import update_display as update_display_function config = { "gateway": { # "type": "electrodragon-wifi-iot-relay-board-spdt-based-esp8266" "id": "thermostat" # "description": "Thermostat Control near Kitchen" }, "devices": [ { "type": "Di...
Morteo/kiot
devices/thermostat/config.py
Python
mit
1,329
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Interpreter version: python 2.7 # # Imports ===================================================================== from collections import namedtuple # Functions & classes ========================================================= class TrackingResponse(namedtuple("Tra...
edeposit/edeposit.amqp.ltp
src/edeposit/amqp/ltp/amqp_structures/responses.py
Python
mit
725
import _plotly_utils.basevalidators class SizeValidator(_plotly_utils.basevalidators.NumberValidator): def __init__(self, plotly_name="size", parent_name="layout.font", **kwargs): super(SizeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, edi...
plotly/python-api
packages/python/plotly/plotly/validators/layout/font/_size.py
Python
mit
475
# -*- coding: utf-8 -*- # 只是个模板,继承还是有问题,不用于继承 class Singleton(object): def __init__(self): globals()[self.__class__.__name__] = self def __call__(self): return self # class Singleton: # def __call__(self): # return self # # Singleton = Singleton()
yes7rose/maya_utils
python/maya_utils/singleton.py
Python
mit
330
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- """MSTIC S...
VirusTotal/msticpy
msticpy/sectools/__init__.py
Python
mit
788
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('structure', '0039_remove_permission_groups'), ] operations = [ migrations.AlterField( model_name='customerpermis...
opennode/nodeconductor
waldur_core/structure/migrations/0040_make_is_active_nullable.py
Python
mit
634
from proteus import * from proteus.default_n import * from pressureInitial_p import * triangleOptions = triangleOptions femSpaces = {0:pbasis} stepController=FixedStep #numericalFluxType = NumericalFlux.ConstantAdvection_Diffusion_SIPG_exterior #weak boundary conditions (upwind ?) matrix = LinearAlgebraTools.Spars...
erdc/proteus
proteus/tests/cylinder2D/sbm_3Dmesh/pressureInitial_n.py
Python
mit
1,224
import sys import os def create_javascript_file(file_name, javascript_stub): """ :param file_name: path with file name relative to script :return: """ with open(file_name, 'w') as f: f.write(javascript_stub) def make_module_dirs(path, dir_names): """ :param path: :param dir...
hamicornfury/twistbit_django_angular_boilerplate
scripts/init_angular_module.py
Python
mit
2,096
# coding: utf-8 import itertools def tset(*args): """ .. function:: termsetdiff(termset1, termset2) -> termset Returns the termset that is the difference of sets of termset1 - termset2. Examples: >>> table1(''' ... 't1 t2 t3' 't2 t3' ... 't3 t2 t1' 't3 t4' ... ''') >>> sql("sel...
madgik/exareme
Exareme-Docker/src/exareme/exareme-tools/madis/src/functions/row/termsetops.py
Python
mit
2,487
#!/usr/bin/python2 #coding=utf8 import httplib import urllib import urllib2 import json req = urllib2.Request('http://h.acfun.tv/综合版1.json') res = urllib2.urlopen(req) json_str = res.read() json_dic = json.loads(json_str) print json.dumps(json_dic, indent=4, encoding='utf-8') # print json.dumps(json_dic['data']['repl...
SnowOnion/ero
acfunh.py
Python
mit
353
#!/usr/bin/env python # delete_frame_set.py """ deletes the frame files associated with a stop action movie """ import argparse import os FILE_TYPE = '.png' # images will be saved as .png files COUNT_TYPE = '.count' # file type for the file containing the image count READ_ONLY = 'r' # open ...
makeralchemy/stop-action-movie-maker
delete_frame_set.py
Python
mit
4,978
# -*- coding: utf-8 -*- # Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). # For example, this binary tree is symmetric: # 1 # / \ # 2 2 # / \ / \ # 3 4 4 3 # But the following is not: # 1 # / \ # 2 2 # \ \ # 3 3 # Definition for a ...
ammzen/SolveLeetCode
101SymmetricTree.py
Python
mit
1,224
import sys from Bio import SeqIO input_file = sys.argv[1] output_file = sys.argv[2] def Ungap(seq): seq.seq=seq.seq.ungap('-') return seq output_gen = (Ungap(seq) for seq in SeqIO.parse(input_file, 'fasta')) SeqIO.write(output_gen,output_file, 'fasta')
wonder041/MegaPipeline
Standardize.py
Python
mit
264
#!/usr/bin/env python # # Copyright (c) 2017-2018 Intel Corporation # # 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 a...
gallenmu/MoonGen
libmoon/deps/tbb/build/build.py
Python
mit
8,400
import sys import traceback __author__ = 'xshu' # global variables refseq2uniprotMapping = {} def showHelp(): print\ ''' This program updates MAF by adding a column of uniprot id list Usage: %s Parameter Description -gene2refseq gene id to refseq id mapping file...
cancerregulome/gidget
commands/maf_processing/python/archive/mergeGeneAndUnitprot.py
Python
mit
2,322
# -*- coding: utf-8 -*- import falcon import falcon.testing import json import mock from keyard.app import resource from keyard.app.utils import prepare_app from keyard.app.middlewares import requireJSON class TestKeyardResource(falcon.testing.TestBase): def before(self): self.resource = resource.Keyard...
rzanluchi/keyard
tests/app/test_app.py
Python
mit
6,392
from django.test import TestCase from .models import Profile from django.contrib.auth.models import User # models test class ProfileTest(TestCase): def setUp(self): self.user = User.objects.create(username='user1', password='123456') Profile.objects.create(city='noida', contact_no='1234567890') ...
ChillarAnand/junction
junction/profiles/tests.py
Python
mit
519
# coding: utf8 from util import load_line_corpus from nose.tools import assert_equal def test_load_line_corpus(): corpus = load_line_corpus("test_data/line_corpus.dat") corpus = list(corpus) assert_equal(len(corpus), 3) assert_equal(corpus[0], u"We introduce the Randomized Dependence Coefficient (RDC...
xiaohan2012/temporal-topic-mining
test_util.py
Python
mit
748
# -*- coding: utf-8 -*- import itertools def evaluateGroup(packages, grouping): firstcount = 0 qe = 1 weight = [0,0] for i in range(len(packages)): weight[ grouping[i] ] = weight[ grouping[i] ] + packages[i] if (grouping[i] == 0): firstcount = firstcount + 1 qe...
jborlik/AdventOfCode2015
day24.py
Python
mit
1,524
from .ascendinggaugedstrategy import AscendingGaugedStrategy from .gauge import AverageItemSize class MinAverageItemSize(AscendingGaugedStrategy): def _gauge(self, item): return AverageItemSize(item)
vialette/binreconfiguration
binreconfiguration/strategy/minaverageitemsize.py
Python
mit
205
from functools import wraps def context(*context_funcs): """ Decorator to inject additional arguments taken by :param context_funcs: >>> data = {1: "user1", 2: "user2"} >>> @context( ... lambda r, i: data.get(i), ... ) ... def some_view(request, user_id, username): ... print(usern...
hirokiky/wraptools
wraptools/context.py
Python
mit
630
""" A simple beam example with fixed geometry. Solves the discretized Euler-Bernoulli beam equations for a constant distributed load """ import numpy as np import gpkit from gpkit.shortcuts import Var, Vec, Model from gpkit.small_scripts import mag class Beam(Model): """Discretization of the Euler beam equations ...
galbramc/gpkit
docs/source/examples/beam.py
Python
mit
3,127
# setup.py # This script will build the main subpackages # See LICENSE for details from distutils.util import get_platform from numpy.distutils.misc_util import Configuration, get_info from numpy.distutils.core import setup from os.path import join import sys TTFORT_DIR = 'tt-fort' TTFORT_SRC = [ 'nan.f9...
uranix/ttpy
tt/setup.py
Python
mit
1,856
""" parsedatetime Parse human-readable date/time text. Requires Python 2.6 or later """ __author__ = 'Mike Taylor (bear@code-bear.com)' __copyright__ = 'Copyright (c) 2004 Mike Taylor' __license__ = 'Apache v2.0' __version__ = '1.1.0' __contributors__ = [ 'Darshana Chhajed', '...
rec/echomesh
code/python/external/parsedatetime/__init__.py
Python
mit
77,277
import re import threading import time import logging from commands import COMMANDS from message import Message READ_WEB_SOCKET_DELAY = 1 class Sbb8(threading.Thread): def __init__(self, bot_id, in_queue, out_queue, group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None): ...
fivunlm/sbb8
droids.py
Python
mit
1,525
import json from django.http import HttpResponse from django.shortcuts import render from torrents.logic import active_torrents_info def active(request): if request.is_ajax(): content = {"torrents": active_torrents_info()} return HttpResponse(json.dumps(content), content_type="application/json") ...
onepesu/django_transmission
torrents/views.py
Python
mit
371
#!/usr/bin/env python import sys, glob,astropy, astropy.io.fits as pyfits, os.path #from numpy import * import scipy import scipy.interpolate.interpolate as interp #from readtxtfile import readtxtfile #from optparse import OptionParser c = 299792458e10 #Angstroms/s def get_sdss_spectra(gmi,umg,gmr,imz,number=4,tol=0...
deapplegate/wtgpipeline
warp_the_pickle_new.py
Python
mit
33,252
_male_start_hi = ['https://media.giphy.com/media/dzaUX7CAG0Ihi/giphy-downsized.gif', 'https://media.giphy.com/media/oJiCqvIqPZE3u/giphy.gif'] _female_start_hi = ['https://media.giphy.com/media/a1QLZUUtCcgyA/giphy-downsized.gif', 'https://media.giphy.com/media/EPJZhOrStSpz2/giphy-d...
mayukh18/BlindChat
modules/gifs.py
Python
mit
646
import logging import unittest from functools import reduce from ass_parser import StyleInfo, UsageData from font_loader import TTFFont, FontInfo, FontLoader, TTCFont, FontWeight from tests.common import get_file_in_test_directory class FontLoaderTests(unittest.TestCase): def test_returns_all_not_found_fonts(self)...
tp7/assfc
tests/font_parsing_tests.py
Python
mit
5,846
from contextlib import contextmanager import sys from . import CorpusContext from .client.client import PGDBClient, ClientError, ConnectionError def get_corpora_list(config): with CorpusContext(config) as c: statement = '''MATCH (n:Corpus) RETURN n.name as name ORDER BY name''' results = c.execute...
PhonologicalCorpusTools/PyAnnotationGraph
polyglotdb/utils.py
Python
mit
1,770
import os import glob import importlib import logging logger = logging.getLogger(__name__) class UnknownFormatError(RuntimeError): pass item_classes = [] supported_protocols = [] def constructor_exists(path): for klass in item_classes: if klass.applies(path): return True return Fal...
janpipek/hlava
hlava/items/__init__.py
Python
mit
2,350
import unittest from fluentcheck.classes import Check from fluentcheck.exceptions import CheckError class TestFileFormatAssertions(unittest.TestCase): # noinspection PyUnresolvedReferences def test_is_yaml(self): res = Check("hello").is_yaml() self.assertIsInstance(res, Check) try: ...
csparpa/check
fluentcheck/tests/tests_check/test_file_formats.py
Python
mit
2,101
# -*- coding: utf-8 -*- import datetime import json import time from unittest import TestCase import requests_mauth import mock from mock import patch from six import assertRegex from flask_mauth.mauth.authenticators import LocalAuthenticator, AbstractMAuthAuthenticator, RemoteAuthenticator, \ mws_attr from flas...
mdsol/flask-mauth
tests/test_authenticators.py
Python
mit
42,880
from datetime import datetime import subprocess import logging import os from flask import Flask, current_app from flask.ext.sqlalchemy import SQLAlchemy from jinja2 import FileSystemLoader from werkzeug.local import LocalProxy import yaml from flask.ext.cache import Cache from bitcoinrpc import AuthServiceProxy r...
fscook/simplevert
simplecoin/__init__.py
Python
mit
4,347
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import umibukela.models class Migration(migrations.Migration): dependencies = [ ('umibukela', '0028_cycle_materials'), ] operations = [ migrations.CreateModel( name='Prog...
Code4SA/umibukela
umibukela/migrations/0029_auto_20170226_0745.py
Python
mit
1,763
class FixedPointTheorem: def cycleRange(self, R): x = 0.25 high = -1 low = 999 for i in range(0, 201001): x = R * x * (1-x) if(i > 200000): if(x > high): high = x if(x < low): low...
mikefeneley/topcoder
src/SRM-152/fixed_point_theorem.py
Python
mit
351
#!/usr/bin/env python ########################## # Modules import. ########################## import f_dist # to prevent segmentation fault import os import logging import sys, argparse import numpy as np import time from shutil import copy as shcopy import modules as mod ####################################...
brunetto/MasterThesisCode
master_code/otherMiscCode/CF_CCF-code-template/serial.py
Python
mit
14,251
# -*- coding: utf-8 -*- __all__ = ['host_blueprint'] from datetime import datetime, timedelta # dateutil from dateutil.parser import parse as dtparse # flask from flask import ( Flask, request, session, g, redirect, url_for, abort, render_template, flash, jsonify, Blueprint, abort, send_from_direc...
mtasic85/dockyard
host.py
Python
mit
5,231
""" Django settings for languagecorrelation project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_...
ssuljic/language-correlation
languagecorrelation/settings.py
Python
mit
2,352
from django.test import TestCase from magazine.utils.word_cleaner import clean_word_text class HTMLSanitizerTestCase(TestCase): def testStripAttributes(self): html = (u"<a href=\"foobar\" name=\"hello\"" u"title=\"View foobar\" onclick=\"malicious()\">hello!</a>") self.assertEqual...
dominicrodger/django-magazine
magazine/tests/html_sanitizer.py
Python
mit
1,974
from django.db import models from .user import User from .post import Post class Medal(models.Model): rank = models.IntegerField() user = models.ForeignKey(User, related_name='medals') post = models.OneToOneField(Post, on_delete=models.CASCADE, related_name='medal') def __str__(self): ...
frostblooded/kanq
api/models/medal.py
Python
mit
373
from distutils import spawn import mock import pytest import requests from pyepm import config as c config = c.get_default_config() has_solc = spawn.find_executable("solc") solc = pytest.mark.skipif(not has_solc, reason="solc compiler not found") COW_ADDRESS = '0xcd2a3d9f938e13cd947ec05abc7fe734df8dd826' def is_h...
etherex/pyepm
test/helpers.py
Python
mit
931
# -*- coding: utf-8 from __future__ import unicode_literals, absolute_import import django DEBUG = True USE_TZ = True # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii' DATABASES = { 'default': { 'ENGINE': 'django.db.backe...
mrc75/django-service-status
tests/settings.py
Python
mit
1,279
#! /usr/bin/env python import os import time import traceback import re import locale import subprocess import zlib import zipfile import private.metadata as metadata import private.messages as messages from glob import glob from private.exceptionclasses import CustomError, CritError, SyntaxError, Logic...
gslab-econ/gslab_python
gslab_make/dir_mod.py
Python
mit
9,540
import numpy as np from scipy.special import iv def tapering_window(time,D,mywindow): """ tapering_window returns the window for tapering a WOSA segment. Inputs: - time [1-dim numpy array of floats]: times along the WOSA segment. - D [float]: Temporal length of the WOSA segment. - mywindow [int]: Choice of ...
guillaumelenoir/WAVEPAL
wavepal/tapering_window.py
Python
mit
2,207