commit
stringlengths
40
40
subject
stringlengths
1
1.49k
old_file
stringlengths
4
311
new_file
stringlengths
4
311
new_contents
stringlengths
1
29.8k
old_contents
stringlengths
0
9.9k
lang
stringclasses
3 values
proba
float64
0
1
8af510b18a3f0f8298f9a992bffdccc9aee2c8c2
add sandbox file
src/gmv/sandbox.py
src/gmv/sandbox.py
''' Created on Jan 30, 2012 @author: guillaume.aubert@gmail.com ''' from cmdline_utils import CmdLineParser if __name__ == '__main__': global_parser = CmdLineParser() global_parser.disable_interspersed_args()
Python
0.000001
65f149c33c1ec6e7d7262092def4b175aa52fe54
Create BinTreeRightSideView_001.py
leetcode/199-Binary-Tree-Right-Side-View/BinTreeRightSideView_001.py
leetcode/199-Binary-Tree-Right-Side-View/BinTreeRightSideView_001.py
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @return a list of integers def rightSideView(self, root): if root == None: ...
Python
0
01c74cfea946eac098a0e144380314cd4676cf2f
Split lowpass filtering into another script.
analysis/04-lowpass.py
analysis/04-lowpass.py
#!/usr/bin/env python from __future__ import division import climate import lmj.cubes import pandas as pd import scipy.signal logging = climate.get_logger('lowpass') def lowpass(df, freq=10., order=4): '''Filter marker data using a butterworth low-pass filter. This method alters the data in `df` in-place. ...
Python
0
0224a259c7fd61fbabdb8ab632471e68b7fd6b4a
Add script used to generate devstats repo groups
hack/generate-devstats-repo-sql.py
hack/generate-devstats-repo-sql.py
#!/usr/bin/env python3 # Copyright 2019 The Kubernetes Authors. # # 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 appl...
Python
0
6a6b9eff5e5d0d7c4a1a969b15a2a4583cf79855
add game-of-throne-ii
algorithms/strings/game-of-throne-ii/game-of-throne-ii.py
algorithms/strings/game-of-throne-ii/game-of-throne-ii.py
from collections import Counter MOD = 10**9 + 7 def factMod(x): ret = 1 for i in range(1, x): ret = (ret * (i + 1)) % MOD; return ret def powMod(x, y): if y == 0: return 1 if y == 1: return x % MOD temp = powMod(x, y / 2) if y % 2 == 0: return (temp * temp)...
Python
0.999371
6a9b6f0227b37d9c4da424c25d20a2b7e9397a9f
Make `publication_date` column not nullable.
alembic/versions/3800f47ba771_publication_date_not_nullable.py
alembic/versions/3800f47ba771_publication_date_not_nullable.py
"""Make the `publication_date` column required. Revision ID: 3800f47ba771 Revises: 17c1af634026 Create Date: 2012-12-13 21:14:19.363112 """ # revision identifiers, used by Alembic. revision = '3800f47ba771' down_revision = '17c1af634026' from alembic import op import sqlalchemy as sa def upgrade(): op.alter_c...
Python
0.000001
7bae0fdf5fb6c92548875d21d00daa01cfe86100
Add test
corehq/motech/repeaters/expression/tests.py
corehq/motech/repeaters/expression/tests.py
import json from datetime import datetime, timedelta from django.test import TestCase from casexml.apps.case.mock import CaseFactory from corehq.apps.accounting.models import SoftwarePlanEdition from corehq.apps.accounting.tests.utils import DomainSubscriptionMixin from corehq.apps.accounting.utils import clear_plan...
Python
0.000005
57e2776a59214318d335f2fa0e2cc1854c33d488
Add lc0532_k_diff_pairs_in_an_array.py
lc0532_k_diff_pairs_in_an_array.py
lc0532_k_diff_pairs_in_an_array.py
"""Leetcode 532. K-diff Pairs in an Array Easy URL: https://leetcode.com/problems/k-diff-pairs-in-an-array/ Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), where i and j are both numbers in the arra...
Python
0.000015
c5a736a742897874262259a5199674b7f949de75
test coverage for templates
test/unit/templates_tests.py
test/unit/templates_tests.py
#!/usr/bin/env python """ templates tests """ import os import json import unittest import tempfile import dockerstache.templates as templ class TemplatesTests(unittest.TestCase): """ test coverage for templates module """ def setUp(self): self.tempdir = tempfile.mkdtemp() self.target_...
Python
0
a66ce55c2abcb434168aadb195fd00b8df6f4fd1
add scoreboard game test
tests/test_scoreboardGame.py
tests/test_scoreboardGame.py
from unittest import TestCase from datetime import datetime from nba_data.data.scoreboard_game import ScoreboardGame from nba_data.data.season import Season from nba_data.data.team import Team from nba_data.data.matchup import Matchup class TestScoreboardGame(TestCase): def test_instantiation(self): game...
Python
0.000002
6b1be6883ead01cc226226499644adb7e99542f8
Add functionality to load and test a saved model
Experiments/evaluate_model.py
Experiments/evaluate_model.py
# import os import sys import tensorflow as tf # sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/' + '../..')) from Models.low_level_sharing_four_hidden import LowLevelSharingModel from utils.data_utils.labels import Labels from utils.data_utils.data_handler import fetch_data class EvaluateModel(object...
Python
0
c97abb734c56730929d0f34e97b0855d467f44c1
Add the consul secret engine support
hvac/api/secrets_engines/consul.py
hvac/api/secrets_engines/consul.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Consul methods module.""" from hvac.api.vault_api_base import VaultApiBase class Consul(VaultApiBase): """Copnsul Secrets Engine (API). Reference: https://www.vaultproject.io/api/secret/consul/index.html """ def configure_access(self, address, token, ...
Python
0
d883cfac71c9ec39abcd75e79b9bec0f53e7890d
Initialize transpositionHacker
books/CrackingCodesWithPython/Chapter12/transpositionHacker.py
books/CrackingCodesWithPython/Chapter12/transpositionHacker.py
# Transposition Cipher Hacker # https://www.nostarch.com/crackingcodes/ (BSD Licensed) import pyperclip, detectEnglish, transpositionDecrypt def main(): # You might want to copy & paste this text from the source code at # https://www.nostarch.com/crackingcodes/: myMessage = """AaKoosoeDe5 b5sn ma reno ora...
Python
0.000672
75805397dd62cfa00eb9a9d253259ea9c79f426b
Test Issue #605
spacy/tests/regression/test_issue605.py
spacy/tests/regression/test_issue605.py
from ...attrs import LOWER, ORTH from ...tokens import Doc from ...vocab import Vocab from ...matcher import Matcher def return_false(doc, ent_id, label, start, end): return False def test_matcher_accept(): doc = Doc(Vocab(), words=[u'The', u'golf', u'club', u'is', u'broken']) golf_pattern = [ ...
Python
0
38dd3604918b2e0d7770e855f775db9ff6720de8
Add initial DrugBank client
indra/databases/drugbank_client.py
indra/databases/drugbank_client.py
import os from indra.util import read_unicode_csv mappings_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, 'resources', 'drugbank_mappings.tsv') def get_chebi_id(drugbank_id): return drugbank_chebi.get(drugbank_id) def get_chembl_id(drugbank_id): ret...
Python
0
84fcbb34005c5bfa19d33e583ca48583b04baeb4
Create mp3tag.py
plugins/mp3tag.py
plugins/mp3tag.py
.
Python
0.000001
407e0b6596539a5f8fcac099c11f1fabc956ea26
add plugin to show available package updates
plugins/pacman.py
plugins/pacman.py
""" @author Brian Bove https://github.com/bmbove """ import re import subprocess from .base import PluginBase class PacmanPlugin(PluginBase): def configure(self): defaults = { 'format': 'pacman {updates}' } return defaults def get_update_count(self): lines = subp...
Python
0
9f9e69ac19e982cd6cc577262704fa5c9f4ebdfc
Create test_logo_client.py (#90)
test/test_logo_client.py
test/test_logo_client.py
import unittest import logging import time #import mock from subprocess import Popen from os import path, kill import snap7 logging.basicConfig(level=logging.WARNING) ip = '127.0.0.1' tcpport = 1102 db_number = 1 rack = 0x1000 slot = 0x2000 class TestLogoClient(unittest.TestCase): @classmethod def setUpCl...
Python
0
71b84632478d5767e742a178edb222745dbd3aa3
Add tests for bson serialization functions
tests/test_serialization_bson.py
tests/test_serialization_bson.py
import unittest import dimod from dimod.serialization.bson import bqm_bson_decoder, bqm_bson_encoder import numpy as np try: import bson _bson_imported = True except ImportError: _bson_imported = False class TestBSONSerialization(unittest.TestCase): def test_empty_bqm(self): bqm = dimod.Bina...
Python
0
3501462ebafa15b19ef436231a5a0d9e3b5d430a
Add first implementation of virtual ontology
indra/ontology/virtual_ontology.py
indra/ontology/virtual_ontology.py
import requests from .ontology_graph import IndraOntology class VirtualOntology(IndraOntology): def __init__(self, url, ontology='bio'): super().__init__() self.url = url self.ontology = ontology def initialize(self): self._initialized = True def _rel(self, ns, id, rel_ty...
Python
0.000001
1139ca1d7c9a4badeb0c3addb23bf0f80866beb5
Task5
project1/task5.py
project1/task5.py
from sklearn.linear_model import RidgeCV, LassoCV import utils import pandas as pd data = pd.read_csv("datasets/housing_data.csv") X = data.ix[:, [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12]].values Y = data.ix[:, 13].values # Ridge regression tuningAlpha = [1,0.1,0.01,0.001] ridge = RidgeCV(normalize=True,alphas=tuni...
Python
0.999999
2154c816cdb3ff0f4a98980a2d590888f6819c81
add signals
rest_arch/signals.py
rest_arch/signals.py
# -*- coding: utf-8 -*- from blinker import signal before_api_called = signal('before_api_called') after_api_called = signal('after_api_called') # TODO add more signals
Python
0.000564
b6e84b87f7bcd12bd8264acd9e84d896d7783822
Create Obs.py
demo/openmrs/openmrs/Obs.py
demo/openmrs/openmrs/Obs.py
from BaseOpenmrsObject import * class ordered_dict(set): def __init__(self, *args, **kwargs): set.__init__(self, *args, **kwargs) self._order = self.keys() #change to elements, not keys def __setitem__(self, key): set.__setitem__(self, key) if key in self._order: se...
Python
0.000001
00c5dbbdeee045d9e474ce7b6094cd49df528b05
add container tests
tests/container_tests.py
tests/container_tests.py
import pytest from watir_snake.container import Container class TestContainerExtractSelector(object): def test_converts_2_arg_selector_into_a_dict(self): assert Container()._extract_selector('how', 'what') == {'how': 'what'} def test_returns_the_kwargs_given(self): assert Container()._extrac...
Python
0
1aebdce5d2fb233927930175fe60e205bca50962
Fix test :)
tests/test_comicnames.py
tests/test_comicnames.py
# -*- coding: utf-8 -*- # Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2016 Tobias Gruetzmacher from __future__ import absolute_import, division, print_function import re from dosagelib import scraper class TestComicNames(object): ...
# -*- coding: utf-8 -*- # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2016 Tobias Gruetzmacher from dosagelib import scraper, util class TestComicNames(object): def test_names(self): for scraperclass in scraper.get_scraperclasses(): name = scraperclass.getName() as...
Python
0
8b55c8a524dd853be2c72951f3656db1a991d0bc
test for Experiment class
tests/test_experiment.py
tests/test_experiment.py
#!/usr/bin/env python # −*− coding: UTF−8 −*− from __future__ import division from odelab.solver import SingleStepSolver from odelab.system import System from odelab.scheme import ExplicitEuler from odelab.experiment import Experiment import numpy as np import nose.tools as nt def f(t,u): return -u def test_experi...
Python
0.000002
cb788a5c82a4be58bb6b2d6d6608a17f914a42b4
Add basic tests for layer initialization.
test/graph_test.py
test/graph_test.py
import theanets import numpy as np import util class TestNetwork(util.MNIST): def _build(self, *hiddens): return theanets.Regressor((self.DIGIT_SIZE, ) + hiddens) def test_predict(self): net = self._build(15, 13) y = net.predict(self.images) assert y.shape == (self.NUM_DIGITS...
import theanets import numpy as np import util class TestNetwork(util.MNIST): def _build(self, *hiddens): return theanets.Regressor((self.DIGIT_SIZE, ) + hiddens) def test_predict(self): net = self._build(15, 13) y = net.predict(self.images) assert y.shape == (self.NUM_DIGITS...
Python
0
5e52a7551b20f74d0b08393e8da89463bb6b5366
add new tests for busco
test/test_busco.py
test/test_busco.py
from sequana.busco import BuscoConfig, BuscoDownload from sequana import sequana_data from easydev import TempFile def test_busco_config(): bc = BuscoConfig("species", outpath="test", sample_name="test", conda_bin_path="test", tmp_path="test", hmmsearch_bin_path="itest", Rscript_bin_path=No...
Python
0
a4ad209ba361ed07574de37598bcedd3ea499a0a
add test file for testing patches
test/test_patch.py
test/test_patch.py
# The positive cases of patch are extensively tested in test_diff.py because a # sensible way to validate a diff of two objects is to check that when you apply # the patch to the first object you get the second. # Here the testing mainly focuses on patch operations which would fail and some # of the obscure positive ca...
Python
0
3e8dad480392cc654bca0b0fdf3ac27f4f4be3c6
Add speed test script
test/test_speed.py
test/test_speed.py
import numpy numpy.random.seed(0) import time import cProfile import pstats import pandas from mhcflurry import Class1AffinityPredictor from mhcflurry.common import random_peptides NUM = 100000 DOWNLOADED_PREDICTOR = Class1AffinityPredictor.load() def test_speed(profile=False): starts = {} timings = {} ...
Python
0.000001
3283c9ac640112ab7a26ec3f82e051394ca72ecf
Add catapult presubmit with list of trybots.
PRESUBMIT.py
PRESUBMIT.py
# Copyright (c) 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Top-level presubmit script for catapult. See https://www.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the pres...
Python
0
e39abc889b27c5cebb4c098b2c3858f2a861a6d3
test to build lstm ner model
kilogram/entity_types/test.py
kilogram/entity_types/test.py
import sys from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.layers.recurrent import LSTM from gensim.models import word2vec def get_features(sentence, index): vector = np.array([]) vector = vector.reshape((0, 128)) # get the context and create a train...
Python
0
05a5599fd0cf08cf33c8a90673e8c71b4c1d6c36
Test implementation of convex hull
slides/ComputationalGeometry/convex-hull.py
slides/ComputationalGeometry/convex-hull.py
import math class Vector: def __init__(self, x, y): self.x = x self.y = y # add theta, so we can sort by it later self.theta = math.atan2(y, x) def add(self, other): return Vector(self.x + other.x, self.y + other.y) def negate(self): return Vec...
Python
0
d30db10d1038301fe7b659e23d96a256f77bec6b
remove debug clause
beetsplug/mpdupdate.py
beetsplug/mpdupdate.py
# This file is part of beets. # Copyright 2013, Adrian Sampson. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, ...
# This file is part of beets. # Copyright 2013, Adrian Sampson. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, ...
Python
0
e0597427d93f2260dfce35cfdd3e2714037fb0fb
Implement cheb_dif for getting 1D chebyshev grids and differentiation matrices.
src/spatial_discretizations/FourierChebyshevSpatialDiscretization.py
src/spatial_discretizations/FourierChebyshevSpatialDiscretization.py
import numpy as np from numpy.fft import fft, ifft, fftshift, fft2, ifft2 from scipy.linalg import toeplitz class FourierChebyshevSpatialDiscretization: def __init__(self, config): self.length_x = config['length_x'] self.length_y = config['length_y'] self.num_points_x = config['num_points_x...
Python
0
0cb320dee7336f7e68bc9cc5efe0ae88de5541fb
Add YCM config
.ycm_extra_conf.py
.ycm_extra_conf.py
import os import ycm_core # These are the compilation flags that will be used in case there's no # compilation database set (by default, one is not set). # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. flags = [ '-Wall', '-Wextra', '-Werror', '-Wno-long-long', '-Wno-variadic-macros', '-D...
Python
0
23bd2cedbeeef22715fbd65229f881e7230507d8
Create decorator.py
notebook2/decorator.py
notebook2/decorator.py
def decor(func): def wrap(): print('===') func() print('===') return wrap def print_text(): print('Text') decorated = decor(print_text) decorated()
Python
0.000001
6fffbc806c44b00d6a5ce4fec178c93484afd960
Add a f2py tool
numscons/tools/f2py.py
numscons/tools/f2py.py
"""f2py Tool Tool-specific initialization for f2py. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ import os.path import re import SCons.Action import SCons.Defaults import SCons.Scanner import SCons.Tool ...
Python
0.000006
42c9ce432f1e5a328fe35eef64d0667a01eeeb19
allow it to have a name and a type
python/qidoc/template_project.py
python/qidoc/template_project.py
class TemplateProject(object): def __init__(self, doc_worktree, worktree_project): self.doc_type = "template" self.name = "template" self.src = worktree_project.src self.path = worktree_project.path self.doc_worktree = doc_worktree ## # Add self.doxfile_in, self.sphi...
class TemplateProject(object): def __init__(self, doc_worktree, worktree_project): self.src = worktree_project.src self.path = worktree_project.path self.doc_worktree = doc_worktree ## # Add self.doxfile_in, self.sphinx_conf_in, etc. def __repr__(self): return "<Templat...
Python
0.000002
3f38f149cf357549006ed97364eb886287d0d2be
Add support for discovering k8s api info from service account
kubespawner/utils.py
kubespawner/utils.py
""" Misc. general utility functions, not tied to Kubespawner directly """ import os import yaml from tornado.httpclient import HTTPRequest def request_maker(): """ Return a k8s api aware HTTPRequest factory that autodiscovers connection info """ if os.path.exists('/var/run/secrets/kubernetes.io/servi...
""" Misc. general utility functions, not tied to Kubespawner directly """ import os import yaml from tornado.httpclient import HTTPRequest def request_maker(path='~/.kube/config'): """ Return a function that creates Kubernetes API aware HTTPRequest objects Reads a .kube/config file from the given path, ...
Python
0
283c049d3a3bdba4a35d71f44fb7a2c453713c9f
Calculate "minute" correctly.
opbeat/utils/traces.py
opbeat/utils/traces.py
from collections import defaultdict import threading import time from datetime import datetime class _RequestList(object): def __init__(self, transaction, response_code, minute): self.transaction = transaction self.response_code = response_code self.minute = minute self.durations =...
from collections import defaultdict import threading import time from datetime import datetime class _RequestList(object): def __init__(self, transaction, response_code, minute): self.transaction = transaction self.response_code = response_code self.minute = minute self.durations =...
Python
0.998189
2a1e09f99c5c1c80286048a27d6ba0c2ef7fc5b3
Add none property store
txdav/base/propertystore/none.py
txdav/base/propertystore/none.py
# -*- test-case-name: txdav.base.propertystore.test.test_none,txdav.caldav.datastore,txdav.carddav.datastore -*- ## # Copyright (c) 2010-2011 Apple Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may o...
Python
0.000001
d77dd62203e0898ab326092c410638a0274e53d9
Initialize P02_errorExample
books/AutomateTheBoringStuffWithPython/Chapter10/P02_errorExample.py
books/AutomateTheBoringStuffWithPython/Chapter10/P02_errorExample.py
# This program raises an exception and automatically displays the traceback def spam(): bacon() def bacon(): raise Exception("This is the error message.") spam()
Python
0.000006
61d0649925fae2d1eca1f512ec519f440f4a5528
Create OutputNeuronGroup_multiple_outputs_2.py
examples/OutputNeuronGroup_multiple_outputs_2.py
examples/OutputNeuronGroup_multiple_outputs_2.py
''' Example of a spike receptor (only receives spikes) In this example spikes are received and processed creating a raster plot at the end of the simulation. ''' from brian import * import numpy from brian_multiprocess_udp import BrianConnectUDP # The main function with the NeuronGroup(s) and Synapse(s) must be na...
Python
0
180a1cd82b02d23b824d706c44d4c6838eca0dd2
Add from_nailgun.py manager
f2s/resources/role_data/managers/from_nailgun.py
f2s/resources/role_data/managers/from_nailgun.py
#!/usr/bin/env python import sys import json from fuelclient.objects.environment import Environment ARGS = json.loads(sys.stdin.read()) env = Environment(ARGS['env']) facts = env.get_default_facts('deployment', [ARGS['uid']]) sys.stdout.write(json.dumps(facts))
Python
0.000001
cd444633870a83adc4220b0bc7025a4ee014ba69
Add e2e testing python file
tests/e2e/test_e2e_identidock.py
tests/e2e/test_e2e_identidock.py
import sys print(sys.path)
Python
0.000001
d22e9e6c5c7bded0be5d5c90e86c8dd4ea9ba7d0
add tests for tree plotting
tests/tree/test_tree_plotting.py
tests/tree/test_tree_plotting.py
import matplotlib import matplotlib.pyplot as plt import numpy as np import unittest from discretize import TreeMesh matplotlib.use("Agg") class TestOcTreePlotting(unittest.TestCase): def setUp(self): mesh = TreeMesh([32, 32, 32]) mesh.refine_box([0.2, 0.2, 0.2], [0.5, 0.7, 0.8], 5) self....
Python
0
475560d9e7320f93bf3e3d40506ffe2092e59d07
check soft clip position
lib/QC/bamSoftClipPosition.py
lib/QC/bamSoftClipPosition.py
import pysam import argparse import sys import logging import os from asyncore import read parser = argparse.ArgumentParser(description="Build soft clip position distribution in BAM file.", formatter_class=argparse.ArgumentDefaultsHelpFormatter) DEBUG=False NOT_DEBUG = not ...
Python
0
5e575e5584a895d9c46a725f42c14cc06a48ccd4
add rst2dtree task to build doctree files
src/escadrille/tasks/rst2dtree.py
src/escadrille/tasks/rst2dtree.py
# Copyright 2017 Curtis Sand <curtissand@gmail.com> # # 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 or...
Python
0.000006
4c6de322d04504e4c0c2c46f686820d3d62b7dac
Add mdata grains as separate module
salt/grains/mdata.py
salt/grains/mdata.py
# -*- coding: utf-8 -*- ''' test grains ''' from __future__ import absolute_import # Import python libs import os import logging # Import salt libs import salt.utils # Solve the Chicken and egg problem where grains need to run before any # of the modules are loaded and are generally available for any usage. impo...
Python
0.000001
ccdc943f4c0292d6046b32cacab410ba6cf1477a
Add the StatePass module
lib/game_states/state_pass.py
lib/game_states/state_pass.py
"""This module contains the StatePass class which defines the data object that will be passed between Game States. """ from pygame.mixer import Channel from lib.custom_data.settings_data import SettingsData class StatePass(object): """Stores common data that will be passed between Game States. All States sho...
Python
0
4041727b93c0d754f134f2b8fa71c893a768ee32
Add utility script
scripts/fix-version.py
scripts/fix-version.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import json # from collections import OrderedDict from collections import OrderedDict as _OrderedDict try: from thread import get_ident as _get_ident except ImportError: from dummy_thread import get_ident as _get_ident class ListDict(_OrderedDict): ...
Python
0.000001
7d09120e1122c5b9888368e7d98b41fe8fdedf87
add script to send test messages to MNOs
scripts/test-MNOs.py
scripts/test-MNOs.py
#!/usr/bin/env python import urllib2 import urllib import sys import datetime import pytz test_phones = [ ('MTN', '2348142235832'), ('Etisalat', '2348183273915'), ('Glo', '2348117159357'), ('Airtel', '2347010915898'), ] wat = pytz.timezone('Africa/Lagos') for via_operator, _ in test_phones: for p...
Python
0
0eab290aa16a28a3efd82dadea1e545796b7ca68
Add spider for UPS Store
locations/spiders/upsstore.py
locations/spiders/upsstore.py
import scrapy import json from locations.items import GeojsonPointItem from locations.hours import OpeningHours DAY_MAPPING = { "MONDAY": "Mo", "TUESDAY": "Tu", "WEDNESDAY": "We", "THURSDAY": "Th", "FRIDAY": "Fr", "SATURDAY": "Sa", "SUNDAY": "Su" } class UpsStoreSpider(scrapy.Spider): ...
Python
0
308fb5c3cb69966d7f7bf20ea1e4753d68d3fe4b
Add init
scrapi/consumers/cmu/__init__.py
scrapi/consumers/cmu/__init__.py
from consumer import consume, normalize
Python
0.085164
79343dda0711e34ef577ff37bddfe3f83d0035f5
add script to fetch NOMADS data
scripts/model/fetch_nomads_nc.py
scripts/model/fetch_nomads_nc.py
""" Download netcdf data from NOMADS Thredds service, run as /usr/local/python/bin/python fetch_nomads_nc.py """ import mx.DateTime import subprocess # start time, GMT sts = mx.DateTime.DateTime(2010,11,1) # end time, GMT ets = mx.DateTime.DateTime(2012,9,17) # Interval interval = mx.DateTime.RelativeDateTime(hours=6...
Python
0
44f81107d829f76d9f6338a0ba2545a68539515e
Introduce Partial differences class.
Core/Difference.py
Core/Difference.py
# -*- coding:utf-8 -*- #-- # # Copyright (C) 2013-2014 Michaël Roy # #-- #-- # # External dependencies # #-- # from numpy import array #-- # # Difference # #-- # # Defines a class representing partial differences on triangular mesh # class Difference : #-- # # Initialisation # #-- # def __init__( self, ...
Python
0
059a9b14e6db26f6131d41e758d1f14b33bc25b8
add python script to jump to a random line
vim/goto-random.py
vim/goto-random.py
import random import vim # Jumps to a random line inside the current buffer. Helpful if you have lots of # testcases inside a single file and you want to minimize conflicts, i.e. just # appending tests to the end of the file is a bad strategy. def main(): # Add an entry to the jump list. vim.command("normal! ...
Python
0.000001
ae6eb7d4716cab50e8850a94a93c96167337c150
add fourth tool of Ultimate family, Ultimate GemCutter
benchexec/tools/ultimategemcutter.py
benchexec/tools/ultimategemcutter.py
# This file is part of BenchExec, a framework for reliable benchmarking: # https://github.com/sosy-lab/benchexec # # SPDX-FileCopyrightText: 2016-2021 Daniel Dietsch <dietsch@informatik.uni-freiburg.de> # SPDX-FileCopyrightText: 2016-2020 Dirk Beyer <https://www.sosy-lab.org> # # SPDX-License-Identifier: Apache-2.0 fr...
Python
0
b24cc6048a07f1e0787cbd732c29583bcdf5ba3d
Add the roman.py module which docutils require.
Doc/tools/roman.py
Doc/tools/roman.py
"""Convert to and from Roman numerals""" __author__ = "Mark Pilgrim (f8dy@diveintopython.org)" __version__ = "1.4" __date__ = "8 August 2001" __copyright__ = """Copyright (c) 2001 Mark Pilgrim This program is part of "Dive Into Python", a free Python tutorial for experienced programmers. Visit http://diveintopython....
Python
0
772ebd24f21f69eacfaae2b1a6658b82031dbd75
add import script for North Norfolk
polling_stations/apps/data_collection/management/commands/import_north_norfolk.py
polling_stations/apps/data_collection/management/commands/import_north_norfolk.py
from django.contrib.gis.geos import Point from data_collection.management.commands import BaseCsvStationsCsvAddressesImporter from data_finder.helpers import geocode_point_only, PostcodeError class Command(BaseCsvStationsCsvAddressesImporter): council_id = 'E07000147' addresses_name = 'PropertyPostCodePo...
Python
0
912ec1162e18b6ffc05ecebaf74f0b946748fa00
fix device/proxy functions arguments names to
zmq/cffi_core/devices.py
zmq/cffi_core/devices.py
# coding: utf-8 from ._cffi import C, ffi, zmq_version_info from .socket import Socket from zmq.error import ZMQError def device(device_type, frontend, backend): rc = C.zmq_device(device_type, frontend._zmq_socket, backend._zmq_socket) if rc != 0: raise ZMQError(C.zmq_errno()) return rc def pro...
# coding: utf-8 from ._cffi import C, ffi, zmq_version_info from .socket import Socket from zmq.error import ZMQError def device(device_type, isocket, osocket): rc = C.zmq_device(device_type, isocket.zmq_socket, osocket.zmq_socket) if rc != 0: raise ZMQError(C.zmq_errno()) return rc def proxy(i...
Python
0
a9348b49b6e91046941fb3af3a6b85edd072d7d9
add a module for descriptors
cheeseprism/desc.py
cheeseprism/desc.py
class updict(dict): """ A descriptor that updates it's internal represention on set, and returns the dictionary to original state on deletion. """ def __init__(self, *args, **kw): super(updict, self).__init__(*args, **kw) self.default = self.copy() def __get__(self, obj, ob...
Python
0.000001
dc477c7b1f0e0ffca01b934919cd32cbd635baab
Implement web scraper for GitHub repos
cibopath/scraper.py
cibopath/scraper.py
# -*- coding: utf-8 -*- import asyncio import logging import aiohttp from cibopath import readme_parser, github_api from cibopath.templates import Template logger = logging.getLogger('cibopath') JSON_STORE = 'templates.json' class CibopathError(Exception): """Custom error class for the app.""" class Cookie...
Python
0.000019
71f321452f735d84ce0cdd9088c9ac0a163f2016
set formatter for loggers
zstacklib/zstacklib/utils/log.py
zstacklib/zstacklib/utils/log.py
''' @author: frank ''' import logging import logging.handlers import sys import os.path class LogConfig(object): instance = None LOG_FOLER = '/var/log/zstack' def __init__(self): if not os.path.exists(self.LOG_FOLER): os.makedirs(self.LOG_FOLER, 0755) ...
''' @author: frank ''' import logging import logging.handlers import sys import os.path class LogConfig(object): instance = None LOG_FOLER = '/var/log/zstack' def __init__(self): if not os.path.exists(self.LOG_FOLER): os.makedirs(self.LOG_FOLER, 0755) ...
Python
0
549562247018e9c51e8cb8023972c1cf73fc84f4
add gc01.py
trypython/stdlib/gc01.py
trypython/stdlib/gc01.py
# coding: utf-8 """gcモジュールについてのサンプルです。""" import gc import secrets import string from trypython.common.commoncls import SampleBase, timetracer from trypython.common.commonfunc import pr class Sample(SampleBase): def __init__(self) -> None: super().__init__() self._data_list = None self._c...
Python
0.000001
4593aa5edf05b014aa6c7fe9de8b239ab2fa91b8
Add snapshot_framework_stats.py script
scripts/snapshot_framework_stats.py
scripts/snapshot_framework_stats.py
#!/usr/bin/env python """Change user password Usage: snapshot_framework_stats.py <framework_slug> <stage> <api_token> Example: ./snapshot_framework_stats.py g-cloud-7 dev myToken """ import sys import logging logger = logging.getLogger('script') logging.basicConfig(level=logging.INFO) from docopt import do...
Python
0
dcd02e0a7b626111bc0fc344df9f6fff2de832ae
Add a (bad) example of missing method.
examples/missingmethod.py
examples/missingmethod.py
#!/usr/bin/python3 """Send an invalid request with missing method member.""" from simpleclient import send_data_to_socket EXAMPLE = { "params": { "filter": { 'store': 'catalog', 'schema': 'product', 'id': '704e418e-682d-4ade-99be-710f2208102e' } } } def m...
Python
0.000074
57b9fcfa5b200ec971f8f3070447cbc98026f5a5
add example of variable-length array branch
examples/tree/vararray.py
examples/tree/vararray.py
#!/usr/bin/env python """ ================================= Trees with variable-length arrays ================================= This example demonstrates how to create a tree with a variable-length array. """ print(__doc__) from rootpy.tree import Tree, TreeModel, IntCol, FloatArrayCol from rootpy.io import root_open...
Python
0.000004
daa44efe23fb5e96f403e80c382ebe7e33fee25c
add tutorial/bnn.py
examples/tutorials/bnn.py
examples/tutorials/bnn.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division import os import time import tensorflow as tf from six.moves import range, zip import numpy as np import sys sys.path.insert(0, os.path.dirname(os.path.dirname( ...
Python
0
8ab83988f66270c76b28f36e8263f029011e773b
use Task & Job, a Task has many Jobs
farmer/models.py
farmer/models.py
#coding=utf8 import os import time import json from datetime import datetime from commands import getstatusoutput from django.db import models class Task(models.Model): # hosts, like web_servers:host1 . inventories = models.TextField(null = False, blank = False) # 0, do not use sudo; 1, use sudo . ...
#coding=utf8 import os import time import json from datetime import datetime from commands import getstatusoutput from django.db import models class Job(models.Model): # hosts, like web_servers:host1 . inventories = models.TextField(null = False, blank = False) # 0, do not use sudo; 1, use sudo . s...
Python
0.000021
d692508e9c6fba847f3bb179bbfd3684e6ebcef0
Add py solution for 384. Shuffle an Array
py/shuffle-an-array.py
py/shuffle-an-array.py
from random import randint class Solution(object): def __init__(self, nums): """ :type nums: List[int] """ self.nums = nums def reset(self): """ Resets the array to its original configuration and return it. :rtype: List[int] """ return se...
Python
0.99853
6c7b9a0315bf12fb3e40ddd49f43fe8bec5c6132
Create 0001_0.py
pylyria/0001/0001_0.py
pylyria/0001/0001_0.py
# -*- coding: utf-8 -*- #!/usr/bin/env python #第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)? import random import string def activation_code(id,length=16): prefix = hex(int(id))[2:]+'V' length = length - len(prefix) chars=string.ascii_uppercase+string.digits ...
Python
0.019732
96f72f6e3825cd01dda430efcaf703286ff568e0
Create codahale_metrics.py
codahale_metrics.py
codahale_metrics.py
#!/usr/bin/env python ##################################################### ## Parse codahale/yammer/dropwizard JSON metrics ## ## put the tuples into a list, ## ## pickle the list and dump it into the graphite ## ## pickle port ## ##########################...
Python
0
706a88810abc1be1fcfa799b7bb46a1c8e774d59
add pygithub.login_github()
codekit/pygithub.py
codekit/pygithub.py
""" pygithub based functions intended to replace the github3.py based functions in codetools. """ import logging from public import public from github import Github import codekit.codetools as codetools logging.basicConfig() logger = logging.getLogger('codekit') @public def login_github(token_path=None, token=None)...
Python
0.000001
abc527d4e35b2a0946986575fd6b2ae2a87e0556
Create filter_vcf_deamination.py
filter_vcf_deamination.py
filter_vcf_deamination.py
#!/usr/bin/python # # filter_vcf_deamination.py # version: 1.1 # Removes potential deamination from vcf file # optional arguments: # -h, --help show this help message and exit # -i VCF_INPUT # -o VCF_OUTPUT # usage: filter_vcf_deamination.py [-h] [-i VCF_INPUT] [-o VCF_OUTPUT] # # Date: 12/11/2015 # Author...
Python
0.000001
b68c8eab696f5950c4cd528bf60506469c97d08a
Create fixer.py
fixer.py
fixer.py
from datetime import datetime from typing import List, TypeVar import requests BASE_URL = 'https://api.fixer.io/' CURRENCY_CHOICE = ["EUR", "AUD", "BGN", "BRL", "CAD", "CHF", "CNY", "CZK", "DKK", "GBP", "HKD", "HRK", "HUF", "IDR", "ILS", "INR", "JPY", "KRW", "MXN", "MYR", "NOK", ...
Python
0.000001
16ec8043799c7aac029c5528f1c00f96070434d4
Move build view names function to utils
foundry/utils.py
foundry/utils.py
from django.conf import settings def _build_view_names_recurse(url_patterns=None): """ Returns a tuple of url pattern names suitable for use as field choices """ if not url_patterns: urlconf = settings.ROOT_URLCONF url_patterns = __import__(settings.ROOT_URLCONF, globals(), locals(), \...
Python
0
26ef831edbb25deaa7f3497c88d329db7ff8db91
Add temporary file interpolate-layout.py
Lib/fontTools/varLib/interpolate-layout.py
Lib/fontTools/varLib/interpolate-layout.py
""" Interpolate OpenType Layout tables (GDEF / GPOS / GSUB). """ from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * from fontTools.ttLib import TTFont from fontTools.ttLib.tables import otTables as ot from fontTools.varLib import designspace, models, builder import os.pat...
Python
0
f13045b5f933078225b89405a786c14da34d0af5
Add ClamAV script to analyze HTTPS traffic for viruses
scripts/clamav.py
scripts/clamav.py
import pyclamd from libmproxy.flow import decoded #http://www.eicar.org/85-0-Download.html clamd = pyclamd.ClamdUnixSocket() try: # test if server is reachable clamd.ping() except AttributeError, pyclamd.ConnectionError: # if failed, test for network socket clamd = pyclamd.ClamdNetworkSocket() cla...
Python
0
079b5d26ef01a29a36672495cf794417204d336e
add unit test, check small average mean squared error
statsmodels/nonparametric/tests/test_asymmetric.py
statsmodels/nonparametric/tests/test_asymmetric.py
# -*- coding: utf-8 -*- """ Created on Mon Mar 8 16:18:21 2021 Author: Josef Perktold License: BSD-3 """ import numpy as np from numpy.testing import assert_array_less from scipy import stats import pytest import statsmodels.nonparametric.kernels_asymmetric as kern kernels_rplus = [("gamma", 0.1), ...
Python
0
805b393c51d9fa82f0dd28aa502378dfcf80924b
Add a binary demo.
reggie/demos/binary.py
reggie/demos/binary.py
import os import numpy as np import mwhutils.plotting as mp import mwhutils.grid as mg import reggie as rg if __name__ == '__main__': cdir = os.path.abspath(os.path.dirname(__file__)) data = np.load(os.path.join(cdir, 'xy.npz')) # create the GP and optimize the model gp1 = rg.make_gp(0.1, 1.0, 0.1) ...
Python
0
def9592885ab4093973e8547de5deac3b7022515
Create MaxSubarray_003.py
leetcode/053-Maximum-Subarray/MaxSubarray_003.py
leetcode/053-Maximum-Subarray/MaxSubarray_003.py
class Solution: # @param {integer[]} nums # @return {integer} def maxSubArray(self, nums): res, tmp = nums[0], nums[0] for i in range(1, len(nums)): tmp = max(tmp + nums[i], nums[i]) res = max(res, tmp) return res
Python
0.000053
67300787f1f910065a88396f99f0d4dd25bec2d1
apply monkeypatch
buildbot.tac
buildbot.tac
import os from monkeypatch import apply_patches apply_patches() from twisted.application import service from buildbot.master import BuildMaster basedir = '.' rotateLength = 10000000 maxRotatedFiles = 10 configfile = 'master.cfg' # Default umask for server umask = None # if this is a relocatable tac file, get the d...
import os from twisted.application import service from buildbot.master import BuildMaster basedir = '.' rotateLength = 10000000 maxRotatedFiles = 10 configfile = 'master.cfg' # Default umask for server umask = None # if this is a relocatable tac file, get the directory containing the TAC if basedir == '.': impo...
Python
0.000001
e85bab14ab8058ba14d1f73dd2d47d8c38318c48
Add db_sqlite.py
db_sqlite.py
db_sqlite.py
import sqlite3
Python
0.000019
266a3a3ddb99afc6fa696bdd2b7d3dc770b921ea
Add enroller talking to redis
spanky/lib/enroll.py
spanky/lib/enroll.py
import redis class Enroller(object): def __init__(self, config): self.config = config @property def conn(self): if not hasattr(self, '_conn'): self._conn = redis.StrictRedis(host='localhost', port=6379, db=0) return self._conn def join(self, name, host, port): ...
Python
0
95ceeb0af4e549e0d211b4e1ba6157d26ad5e44d
Fix race between MQ and mongo setting QueuedAt
sync_scheduler.py
sync_scheduler.py
from tapiriik.database import db from tapiriik.messagequeue import mq from tapiriik.sync import Sync from datetime import datetime from pymongo.read_preferences import ReadPreference import kombu import time from tapiriik.settings import MONGO_FULL_WRITE_CONCERN Sync.InitializeWorkerBindings() producer = kombu.Produc...
from tapiriik.database import db from tapiriik.messagequeue import mq from tapiriik.sync import Sync from datetime import datetime from pymongo.read_preferences import ReadPreference import kombu import time Sync.InitializeWorkerBindings() producer = kombu.Producer(Sync._channel, Sync._exchange) while True: queuein...
Python
0.000001
e532a4a5ba6706974dc1245b269f18fa0e82cb66
Create duplicates.py
module/duplicates.py
module/duplicates.py
import os import sys def search(dir) for root, subdirs, files in os.walk(dir): print('Dir(%s)' % root) for filename in files: print('- File(%s)' % r)
Python
0.000391
c8271b02c3636aa9620cce8b85c823ff0ec35c4a
Add a mobile device test of the Skype website
examples/test_skype_site.py
examples/test_skype_site.py
""" This is a mobile device test for Chromium-based browsers (such as MS Edge) Usage: pytest test_skype_site.py --mobile --browser=edge Default mobile settings for User Agent and Device Metrics if not specifed: User Agent: --agent="Mozilla/5.0 (Linux; Android 9; Pixel 3 XL)" CSS Width, CSS Height, P...
Python
0.000001
ea54e294d68962ec370dc1dc2381720f53ce6f01
Add local_settings.py stuff
voiexp/local_settings_example.py
voiexp/local_settings_example.py
SECRET_KEY = '.uadjgfi67&%€yuhgsdfakjhgayv&/%yugjhdfsc$y53' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False ALLOWED_HOSTS = ['127.0.0.1', 'some.example.com', ] LANGUAGE_CODE = 'fi-fi' TIME_ZONE = 'Europe/Helsinki'
Python
0.000001
8daf4237aa84a6b032e7627afb31b29a44f47ddc
Add another .py file for progress bar
ProgressBar.py
ProgressBar.py
import sys, time from CmdFormat import CmdFormat class ProgressBar(CmdFormat): def __init__(self, count = 0, total = 0, width = 80, bWithheader=True, bWithPercent=True,barColor='white'): super(CmdFormat, self).__init__() self.count = count self.total = total self.width = wid...
Python
0.000001
865128a2224473b218c6736ac608c5963968df82
add hCaptcha support
src/pyload/plugins/anticaptchas/HCaptcha.py
src/pyload/plugins/anticaptchas/HCaptcha.py
# -*- coding: utf-8 -*- import re import urllib.parse from ..base.captcha_service import CaptchaService class HCaptcha(CaptchaService): __name__ = 'HCaptcha' __type__ = 'captcha' __version__ = '0.01' __status__ = 'testing' __description__ = 'hCaptcha captcha service plugin' __license__ = 'GP...
Python
0
49070f3ae636c458551ea53b1cb79975dd029a4c
add methods
RNN/methods.py
RNN/methods.py
#!usr/bin/env python #-*- coding:utf-8 -*- """ @author: James Zhang @date: """ import numpy as np import theano import theano.tensor as T from theano.ifelse import ifelse from theano.tensor.shared_randomstreams import RandomStreams from collections import OrderedDict import copy import sys sys.setrecursionlimit(10000...
Python
0.000008
5e3b2ca14c4cc421e47d2709fe52390ee51eee11
Create S3toSQS.py
SQS/S3toSQS.py
SQS/S3toSQS.py
""" Copyright 2016 Nicholas Christian 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 or agreed to in writing, softwar...
Python
0.000001
f0e733a3f62d37dc25d70b334dd3e1e46936477d
Add missing non-important migration
homedisplay/info_transportation/migrations/0016_auto_20150304_2159.py
homedisplay/info_transportation/migrations/0016_auto_20150304_2159.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('info_transportation', '0015_line_type'), ] operations = [ migrations.AlterField( model_name='line', ...
Python
0.003209
468a4c181768f0dcfcaa40201c26015b7c94e39e
add random gesture test
home/moz4r/Test/random.py
home/moz4r/Test/random.py
import random from time import sleep i01 = Runtime.createAndStart("i01", "InMoov") i01.startHead("COM3") sleep(1) def MoveHeadRandomize(): if IcanMoveHeadRandom==1: i01.moveHead(random.randint(50,130),random.randint(50,130)) MoveHeadTimer = Runtime.start("MoveHeadTimer","Clock") MoveHeadTimer.setInterval(10...
Python
0
bb63af8be9abf1bcc8f3716bbd1a1a375685533f
Add a new feed bot, abusehelper.contrib.abusech.feodoccbot, for catching abuse.ch's Feodo Tracker RSS feed.
abusehelper/contrib/abusech/feodoccbot.py
abusehelper/contrib/abusech/feodoccbot.py
from abusehelper.core import bot from . import host_or_ip, split_description, AbuseCHFeedBot class FeodoCcBot(AbuseCHFeedBot): feed_type = "c&c" feeds = bot.ListParam(default=["https://feodotracker.abuse.ch/feodotracker.rss"]) # The timestamp in the title appears to be the firstseen timestamp, # sk...
Python
0
94c125925b61a57bd29e9265dc993e1d868f2b7f
Create Selenium_Google.py
Selenium_Google.py
Selenium_Google.py
__author__ = 'Christie' # from selenium import webdriver from selenium.webdriver.common.keys import Keys browser = webdriver.Firefox() browser.get('http://www.google.com') assert 'Google' in browser.title #browser.get('http://www.yahoo.com') #assert 'Yahoo' in browser.title #elem = browser.find_element_by_name('p') ...
Python
0
b00ae10f9ad841131ead33aa690587b7e2c50976
Add fetch recipe for fletch
recipes/fletch.py
recipes/fletch.py
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import sys import recipe_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 clas...
Python
0.000016
76c25395590aa9dee64ca138633f01b62ac0d26b
Add new provider migration for osf registrations
providers/io/osf/registrations/migrations/0001_initial.py
providers/io/osf/registrations/migrations/0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-07-08 16:17 from __future__ import unicode_literals from django.db import migrations import share.robot class Migration(migrations.Migration): dependencies = [ ('share', '0001_initial'), ('djcelery', '0001_initial'), ] operatio...
Python
0