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
e4bf4091ea267cae2c584c8a442f57d3dda0cbf8
Create wksp2.py
wksp2.py
wksp2.py
"""Rx Workshop: Observables versus Events. Part 1 - Little Example. Usage: python wksp2.py """ from __future__ import print_function import rx class Program: """Main Class. """ S = rx.subjects.Subject() @staticmethod def main(): """Main Method. """ p = Program() ...
Python
0.000002
a1744d6a6f4c369403ac2ed67f167ca1ecd9cb5e
add input output outline
input-output.py
input-output.py
# input-output.py # review console I/O # CLI parameters # file I/O
Python
0.000037
72a6ca31ac313b89b5e4ce509c635f675484cf3e
Create solution.py
data_structures/linked_list/problems/find_length/py/solution.py
data_structures/linked_list/problems/find_length/py/solution.py
import LinkedList # Problem description: Find the length of a linked list. # Solution time complexity: O(n) # Comments: # Linked List Node inside the LinkedList module is declared as: # # class Node: # def __init__(self, val, nxt=None): # self.val = val # self.nxt = n...
Python
0.000018
ed6958f477c65a2973d43d669035de80b7cbd7a5
Change needs_auth ZeroConf key
homeassistant/components/zeroconf.py
homeassistant/components/zeroconf.py
""" This module exposes Home Assistant via Zeroconf. Zeroconf is also known as Bonjour, Avahi or Multicast DNS (mDNS). For more details about Zeroconf, please refer to the documentation at https://home-assistant.io/components/zeroconf/ """ import logging import socket from homeassistant.const import (EVENT_HOMEASSIS...
""" This module exposes Home Assistant via Zeroconf. Zeroconf is also known as Bonjour, Avahi or Multicast DNS (mDNS). For more details about Zeroconf, please refer to the documentation at https://home-assistant.io/components/zeroconf/ """ import logging import socket from homeassistant.const import (EVENT_HOMEASSIS...
Python
0.000001
1079fcc08ede0fe1530448ff6d1c7c61ce650ffb
Fix for py2exe optimizer that discards docstrings
rdflib/py3compat.py
rdflib/py3compat.py
""" Utility functions and objects to ease Python 3 compatibility. """ import sys try: from functools import wraps assert wraps except ImportError: # No-op wraps decorator def wraps(f): def dec(newf): return newf return dec def cast_bytes(s, enc='utf-8'): if isinstance(...
""" Utility functions and objects to ease Python 3 compatibility. """ import sys try: from functools import wraps assert wraps except ImportError: # No-op wraps decorator def wraps(f): def dec(newf): return newf return dec def cast_bytes(s, enc='utf-8'): if isinstance(...
Python
0
9aa368d528448c485c940c646394b44dafd1e62f
Create iomanager.py
basemod/iomanager.py
basemod/iomanager.py
Python
0.000002
d899fbda7c86067fc705de6fb3b04b1a7b3ed962
add a rest service to send commands to the actors via POST and retrieve information via GET
pyCrow/crowlib/rest.py
pyCrow/crowlib/rest.py
#!/usr/bin/python # -*- coding: utf-8 -*- """REST Actor. """ # Python-native imports import logging.config from http.server import BaseHTTPRequestHandler, HTTPServer import json import threading # Third-party imports import pykka # App imports from pyCrow.crowlib.aux import Action # prepare logging, i.e. load con...
Python
0
1a37c09fe0ba755dac04819aea0a6d02327330db
Add files via upload
module3.py
module3.py
import psycopg2 try: conn = psycopg2.connect("dbname=battleport user=postgres host=localhost password=gregory123") except: print("cannot connect to the database") cur=conn.cursor() conn.set_isolation_level(0) #cur.execute("INSERT INTO score (name,gamesp,gamesw,gamesl) \ #VALUES ('Rens', 10, ...
Python
0
f60b3f00b7a4675f1bfc4cab1b9d1b5c150d9dfc
Add simple utility class that extends a dictionary but can be used as object.
phyhlc/util.py
phyhlc/util.py
# encoding: UTF-8 """Utilities that are used throughout the package. ..moduleauthor:: Dylan Maxwell <maxwelld@frib.msu.edu> """ class ObjectDict(dict): """Makes a dictionary behave like an object, with attribute-style access. """ def __getattr__(self, name): try: return self[name] ...
Python
0
c9e4c18ea54de5c168994b47f70f0bdac0a76c73
add ocr_pdf.py
ocr_pdf.py
ocr_pdf.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ ocr_pdf.py ~~~~~~~~~~~~~~ A brief description goes here. """ import subprocess def call(cmd, check=True, stdout=None, stderr=None): """ Args: check: check return code or not """ if check: return subprocess.check_call(cmd...
Python
0.000001
32fa82e983e88cc902cd75d7c3059dec2a08f524
Wrong variable
judge/bridge/judgelist.py
judge/bridge/judgelist.py
from operator import attrgetter from random import choice class JudgeList(object): def __init__(self): self.queue = [] self.judges = [] self.submission_map = {} def register(self, judge): self.judges.append(judge) for elem in self.queue: id, problem, langua...
from operator import attrgetter from random import choice class JudgeList(object): def __init__(self): self.queue = [] self.judges = [] self.submission_map = {} def register(self, judge): self.judges.append(judge) for elem in self.queue: id, problem, langua...
Python
0.978879
564f1b2287d3825266b82d9b0f2f1c289285a493
Add vectorfiled class.
pyoommf/vectorfield.py
pyoommf/vectorfield.py
import numpy as np import matplotlib.pyplot as plt class VectorField(object): def __init__(self, filename): f = open(filename, 'r') lines = f.readlines() for line in lines: if line.startswith('# xmin'): self.xmin = float(line[7:]) if line.startswith(...
Python
0
d58a021704669a8bb6b7d36d068ca596fc0f813e
add problem0010.py
python3/problem0010.py
python3/problem0010.py
from problem0003 import primes from itertools import takewhile print(sum(takewhile(lambda x: x < 2000000, primes())))
Python
0.000608
91927b441425703463f0ee1e08293ad942a26a93
Add debounce.py and implementation.
pythonicqt/debounce.py
pythonicqt/debounce.py
"""module contains datastructures needed to create the @debounce decorator.""" import time from functools import wraps, partial from PySide import QtCore class DebounceTimer(QtCore.QTimer): """Used with the debounce decorator, used for delaying/throttling calls.""" def __init__(self, msecs, fire_on_first=False...
Python
0
50795568e35669916f1654d50e5f1bdd1800d41e
Create imposto.py
imposto.py
imposto.py
numero = float(input('Digite o valor Bruto: ')) inss = numero * 11/100 if (inss >= 482.93 ): real = 482.93 else: real = inss Pissqn = numero - real issqn = Pissqn * 3/100 Pissqn = numero - real - issqn if (numero <= 1787.77 ): num = 'Não desconta inposto' vp = 0 elif (numero <= 2679.29): num = ...
Python
0.000007
cebe8dffbf9819c370257b7030848ef0ea4e971c
Initialize stuff
ghlist.py
ghlist.py
import requests api = 'https://api.github.com/users/{}/repos' repos = data = requests.get(url=api.format('kshvmdn')).json() for repo in repos: print(repo['name'])
Python
0
62c02c185063465e51bd40e648f75d519e68c1d2
Create Euler2.py
Euler2.py
Euler2.py
def sequence(n): if n <= 1: return n else: return(sequence(n-1) + sequence(n-2)) i = 1 j = 0 total = 0 while j < 4000000: j = sequence(i) if j%2: print(j) else: print(j) total = total + j i+=1 print("total is") print(total)
Python
0.000175
25b5b8fc89164dc386218ae1edd660735781241d
add simple font comparison tool in examples
examples/font_comparison.py
examples/font_comparison.py
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are me...
Python
0
778df30911226a7aac1e45406fa629f7f83e7136
Add example on robust training
examples/robust_training.py
examples/robust_training.py
# Copyright 2021 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Python
0.000001
d300081826f7ebffefb4eeb8ca1077f028b40852
Add fractal shader example.
examples/shader_onscreen.py
examples/shader_onscreen.py
from scikits.gpu.api import * import pyglet.window from pyglet import gl # GLSL code based on http://nuclear.sdf-eu.org/articles/sdr_fract # by John Tsiombikas v_shader = VertexShader(""" uniform vec2 offset; uniform float zoom; uniform float width_ratio; varying vec2 pos; void main(void) { pos.x = gl_Vertex.x ...
Python
0
522201ec9e00ed2fe135a621bde1b288c59ddd25
Add test utils
keras/utils/test_utils.py
keras/utils/test_utils.py
import numpy as np def get_test_data(nb_train=1000, nb_test=500, input_shape=(10,), output_shape=(2,), classification=True, nb_class=2): ''' classification=True overrides output_shape (i.e. output_shape is set to (1,)) and the output consists in integers in [0, nb_class-1]. ...
Python
0.000001
bd02fd2d163a2f044029ddb0adef031c2dcd824a
Remove deprecated function call
kivy/core/clipboard/clipboard_sdl2.py
kivy/core/clipboard/clipboard_sdl2.py
''' Clipboard SDL2: an implementation of the Clipboard using sdl2. ''' __all__ = ('ClipboardSDL2', ) from kivy.utils import platform from kivy.core.clipboard import ClipboardBase if platform not in ('win', 'linux', 'macosx', 'android', 'ios'): raise SystemError('unsupported platform for pygame clipboard') try: ...
''' Clipboard SDL2: an implementation of the Clipboard using sdl2. ''' __all__ = ('ClipboardSDL2', ) from kivy.utils import platform from kivy.core.clipboard import ClipboardBase if platform() not in ('win', 'linux', 'macosx', 'android', 'ios'): raise SystemError('unsupported platform for pygame clipboard') try...
Python
0.000037
04b96b35d8d6e56eb1d545bafedc1af4d5914577
add Proxy pattern
proxy/Proxy.py
proxy/Proxy.py
# # Python Design Patterns: Proxy # Author: Jakub Vojvoda [github.com/JakubVojvoda] # 2016 # # Source code is licensed under MIT License # (for more details see LICENSE) # import sys # # Subject # defines the common interface for RealSubject and Proxy # so that a Proxy can be used anywhere a RealSubject is expected ...
Python
0
2f82c96257af5e5596c02348621572b08ff99b64
test mixed returns
pychecker2/utest/returns.py
pychecker2/utest/returns.py
from pychecker2.TestSupport import WarningTester from pychecker2 import ReturnChecks class ReturnTestCase(WarningTester): def testReturnChecks(self): w = ReturnChecks.MixedReturnCheck.mixedReturns self.silent('def f(): return\n') self.silent('def f(): return 1\n') self.silent('def f...
Python
0
83580051da3ad427c815dca0ca88cc8005c014f2
add nightly script to perform test over a wide range of parameters
nightly.py
nightly.py
import itertools import os import subprocess # the range of each parameter param_range = { 'n': ['2', '10', '100', '1000', '10000', '100000', '1000000', '10000000'], 'P': ['4', '10', '20', '30', '40'], 't': ['0.5', '0.4', '0.3', '0.2'], 'd': ['c', 's', 'o', 'p'] } # the...
Python
0
d399a3088059714eb0d9e0a131274e46eca44a6f
Add example UI plugin
python/examples/asm_to_llil_view.py
python/examples/asm_to_llil_view.py
# Copyright (c) 2019 Vector 35 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, dist...
Python
0
7b29e5a735fe495c3504d585acab2826bbd44bf9
Add tests for classes that use __eq__
raiden/tests/unit/test_operators.py
raiden/tests/unit/test_operators.py
# -*- coding: utf-8 -*- from raiden.utils import sha3 from raiden.transfer.state_change import ( ActionCancelTransfer, ActionTransferDirect, Block, ReceiveTransferDirect, ) from raiden.transfer.state import ( RouteState, RoutesState, ) from raiden.transfer.events import ( EventTransferSentSu...
Python
0.000001
e7bbd7f975d478846843e14e83e238294feaee86
Create mc_tools.py
mc_tools.py
mc_tools.py
""" Filename: mc_tools.py Authors: John Stachurski and Thomas J. Sargent """ import numpy as np from discrete_rv import DiscreteRV def mc_compute_stationary(P): """ Computes the stationary distribution of Markov matrix P. Parameters =========== P : a square 2D NumPy array Returns: A fla...
Python
0.000004
a3e9097247f4abe660696e5bd19f06e7e5756249
Add start of Python solution for day 9 (parsing only)
python/day9.py
python/day9.py
#!/usr/local/bin/python3 def parse_input(text): """Parse a list of destinations and weights Returns a list of tuples (source, dest, weight). Edges in this graph and undirected. The input contains multiple rows appearing like so: A to B = W Where A and B are strings and W is the weight t...
Python
0
1f5bd0236e3fd97287891c37bf64cadcae38c444
add python
python/exmo.py
python/exmo.py
import httplib import urllib import json import hashlib import hmac import time api_key = "your_key" api_secret = "your_secret" nonce = int(round(time.time()*1000)) params = {"nonce": nonce} params = urllib.urlencode(params) H = hmac.new(api_secret, digestmod=hashlib.sha512) H.update(params) sig...
Python
0.998891
f8085a14a7327f06255ca696bc0d83c630c071ab
Add two basic layer types, Softmax and normal hidden layer.
layers/one_dimensional.py
layers/one_dimensional.py
import numpy import theano import theano.tensor as T import time from elements.cost_functions import l1_norm, l2_norm, l2_norm_sqr from elements.erro_functions import negative_log_likelihood_error, zero_one_error class BaseLayer: """ Base class for all neural network layers. """ def __init__(self, n_...
Python
0
5ba61a7898a8fe70bd19993f8b0f8c502f514621
add batch cp
batchmv.py
batchmv.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'xilei' import os import sys import hashlib import shutil def md5hex(s): m = hashlib.md5() m.update(s.encode('UTF-8')) return m.hexdigest() if __name__ == '__main__': if len(sys.argv) < 2: print("miss args, use like batchmv.py /var...
Python
0.000003
422baea7ea6120dae3f7ac0d412a19b66958e3ad
Add migration
project/apps/api/migrations/0074_catalog_song_name.py
project/apps/api/migrations/0074_catalog_song_name.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0073_auto_20151027_1111'), ] operations = [ migrations.AddField( model_name='catalog', name='...
Python
0.000002
c1a5bd8268890f359427f578204886fe5d01909e
Add a large, graphical integration test.
tests/graphical/one_view.py
tests/graphical/one_view.py
# -*- coding: utf-8 -*- # Copyright (c) 2015-2016 MIT Probabilistic Computing Project # 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 # Unles...
Python
0
552b5d97fc9a0298ca43c316aad3d221234b894c
Add fontTools.misc.classifyTools, helpers to classify things into classes
Lib/fontTools/misc/classifyTools.py
Lib/fontTools/misc/classifyTools.py
""" fontTools.misc.classifyTools.py -- tools for classifying things. """ from __future__ import print_function, absolute_import from fontTools.misc.py23 import * class Classifier: """ Main Classifier object, used to classify things into similar sets. """ def __init__(self, sorted=True): self._things = set() ...
Python
0
67d44755557347a390ede3a4b5f872dc08b73805
add tests for weighting angles
tests/test_angle_weights.py
tests/test_angle_weights.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Tests backpropagation algorithm """ from __future__ import division, print_function import numpy as np import os from os.path import abspath, basename, dirname, join, split, exists import platform import sys import warnings import zipfile # Add parent directory to beg...
Python
0
4dbd776380591afe144e148912ff8ee55ec48ff9
test docs
tests/test_documentation.py
tests/test_documentation.py
import re import os import unittest import ModernGL EMPTY_SET = set() def read_docs(filename): root = os.path.dirname(os.path.dirname(__file__)) f = open(os.path.normpath(os.path.join(root, 'docs', filename))) docs = f.read() f.close() return docs def detect_members(docs): search = re.sea...
Python
0.000001
594df6d33eaa66acc5d232b9ea3fcbb8917ca26e
Update user tests
tests/test_user_security.py
tests/test_user_security.py
from unittest import TestCase from app import create_app, db from app.api.models import User class UserModelTestCase(TestCase): def setUp(self): self.app = create_app('default') self.app_context = self.app.app_context() self.app_context.push() db.create_all() self.client =...
Python
0.000001
2f127de7520a0b689bfe5082360eeb53a05d6e2d
Add "repo overview" command.
subcmds/overview.py
subcmds/overview.py
# # Copyright (C) 2012 The Android Open Source Project # # 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 la...
Python
0.000008
9da427f7b1345ba140561a213cb24f857c3f3482
Add partial spamhandling tests
test/test_spamhanding.py
test/test_spamhanding.py
from spamhandling import * import pytest @pytest.mark.parametrize("title, body, username, site, match", [ ('18669786819 gmail customer service number 1866978-6819 gmail support number', '', '', '', True), ('Is there any http://www.hindawi.com/ template for Cloud-Oriented Data Center Networking?', '', '', '',...
Python
0
8979c2122abc6f37b31fe9d4193ef9df350d73f0
Add bwt implementation
bwt/bwt.py
bwt/bwt.py
def encode(s): shifts = [] for i in range(len(s)): shifts.append(s[i:] + s[:i]) shifts.sort() encoded = ''.join(shifted[-1] for shifted in shifts) return encoded, shifts.index(s) def decode(s, indx): table = ['' for ch in s] for _ch in s: for k in range(len(table)): ...
Python
0
b81825eb66bd5a9dac6a1e3ff4dfb99e6addd5ac
add ex0 template
ch3/ex0.py
ch3/ex0.py
#!/usr/bin/env python # # To be used as an exercise template for all the rest of the exercises. # # Style guide to be used: https://google.github.io/styleguide/pyguide.html # def main(): print "Hello world!" return if __name__ == '__main__': main()
Python
0
9572f256d57bb43cac63cbf0325226d36426eb8d
Add urls file for pods.
casepro/pods/urls.py
casepro/pods/urls.py
from casepro.pods.registry import get_url_patterns urlpatterns = get_url_patterns()
Python
0
17831f16aadece921fe2424f305c1c368e12c6e7
Add user defined operator
riko/modules/udf.py
riko/modules/udf.py
# -*- coding: utf-8 -*- # vim: sw=4:ts=4:expandtab """ riko.modules.udf ~~~~~~~~~~~~~~~~ Provides functions for performing an arbitrary (user-defined) function on stream items. Examples: basic usage:: >>> from riko.modules.udf import pipe >>> >>> items = [{'x': x} for x in range(5)] ...
Python
0
b95e5cd706a1cf81e41debae30422345cef3a1ee
Add simple parser to return some activity numbers from our git log.
tests/committerparser.py
tests/committerparser.py
#!/usr/bin/python import sys import getopt import re import email.utils import datetime class Usage(Exception): def __init__(self, msg): self.msg = msg def parse_date(datestr): d = email.utils.parsedate(datestr) return datetime.datetime(d[0],d[1],d[2],d[3],d[4],d[5],d[6]) def parse_gitlog(filena...
Python
0
666582ff2edf201102e88038e8053908b8020472
add player data test
tests/test_playerData.py
tests/test_playerData.py
from unittest import TestCase from nba_data.data.player_data import PlayerData class TestPlayerData(TestCase): def test_instantiation(self): player_id = '1234' name = 'jae' jersey = 0 team_seasons = list() self.assertIsNotNone(PlayerData(player_id=player_id, name=name, jer...
Python
0
19bff8fb2141e9e389e4af057c4ea1623a07ac47
Add serializer test
tests/test_serializer.py
tests/test_serializer.py
from datetime import datetime from tinydb import TinyDB, where from tinydb.middlewares import SerializationMiddleware from tinydb.serialize import Serializer from tinydb.storages import MemoryStorage class DateTimeSerializer(Serializer): OBJ_CLASS = datetime FORMAT = '%Y-%m-%dT%H:%M:%S' def encode(self,...
Python
0.000001
3020b2084b24f1e00f0b9fc1d06186b1e697647e
Test long jid passed on CLI
tests/unit/utils/args.py
tests/unit/utils/args.py
# -*- coding: utf-8 -*- # Import Salt Libs from salt.utils import args # Import Salt Testing Libs from salttesting import TestCase, skipIf from salttesting.mock import NO_MOCK, NO_MOCK_REASON from salttesting.helpers import ensure_in_syspath ensure_in_syspath('../../') @skipIf(NO_MOCK, NO_MOCK_REASON) class ArgsTes...
Python
0
8f597e766e9ef8014da4391a7109d9b77daf127e
Add tests for user utilities sum_ and prod_
tests/user_utils_test.py
tests/user_utils_test.py
"""Tests for user utility functions.""" from drudge import Vec, sum_, prod_ from drudge.term import parse_terms def test_sum_prod_utility(): """Test the summation and product utility.""" v = Vec('v') vecs = [v[i] for i in range(3)] v0, v1, v2 = vecs # The proxy object cannot be directly compare...
Python
0
49b3bc23edfb3016228c4f39e4af6e8909eb183f
Create the_supermarket_queue.py
the_supermarket_queue.py
the_supermarket_queue.py
#Kunal Gautam #Codewars : @Kunalpod #Problem name: The Supermarket Queue #Problem level: 6 kyu def queue_time(customers, n): if not customers: return 0 li=customers[:n] for customer in customers[n:]: li[li.index(min(li))]+=customer return max(li)
Python
0.000513
06c3a417f0270d76a7fcc9e94fdb40f9952b9d12
Add a login view that automatically starts the oauth2 flow for authenticating using the IdM server
src/wirecloud/fiware/views.py
src/wirecloud/fiware/views.py
# -*- coding: utf-8 -*- # Copyright (c) 2012-2013 CoNWeT Lab., Universidad Politécnica de Madrid # This file is part of Wirecloud. # Wirecloud is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either v...
Python
0
ba0ee66177f11fb1c13b00167b04e0ddd23f4e28
Update bulma
wdom/themes/bulma.py
wdom/themes/bulma.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from wdom.tag import NewTagClass as NewTag from wdom.tag import * css_files = [ '//cdnjs.cloudflare.com/ajax/libs/bulma/0.0.20/css/bulma.min.css', ] js_files = [] headers = [] Button = NewTag('Button', bases=Button, class_='button') DefaultButton = NewTag('Default...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from wdom.tag import NewTagClass as NewTag from wdom.tag import * css_files = [ '//cdnjs.cloudflare.com/ajax/libs/bulma/0.0.20/css/bulma.min.css', ] js_files = [] headers = [] Button = NewTag('Button', bases=Button, class_='button') DefaultButton = NewTag('Default...
Python
0.000001
07b01296bcbc8c8b9220c93d9014973704d88caa
add script/json/ts-pycurl.py
script/json/ts-pycurl.py
script/json/ts-pycurl.py
#!/usr/bin/env python # # ts-pycurl.py # # Author: Zex <top_zlynch@yahoo.com> # import pycurl #import json from os import path, mkdir from basic import * from StringIO import StringIO if not path.isdir(RESPONSE_DIR): mkdir(RESPONSE_DIR) def case(): headers = { #'Content-Type' : 'application/json' ...
Python
0.000003
c51bb87714ade403aeabc9b4b4c62b4ee3a7a8c5
Add test script for checking to see if scrobbling works on new installs
scripts/test-scrobble.py
scripts/test-scrobble.py
#!/usr/bin/env python ##### CONFIG ##### SERVER = "turtle.libre.fm" USER = "testuser" PASSWORD = "password" ################## import gobble, datetime print "Handshaking..." gs = gobble.GobbleServer(SERVER, USER, PASSWORD, 'tst') time = datetime.datetime.now() - datetime.timedelta(days=1) # Yesterday track = gobb...
Python
0
ff1da8b72e0b40d48e6d740bd9eee3fb8f391a58
add NYU hyperopt search script
scripts/hyperopt/hyperopt_search.py
scripts/hyperopt/hyperopt_search.py
#!/usr/bin/env python from __future__ import print_function import sys import math from hyperopt import fmin, tpe, hp from hyperopt.mongoexp import MongoTrials def get_space(): space = (hp.quniform('numTrees', 1, 10, 1), hp.quniform('samplesPerImage', 10, 7500, 1), hp.quniform('featur...
Python
0
379171e30269cfa219bddb481a9300514941f083
update header
homeassistant/components/switch/demo.py
homeassistant/components/switch/demo.py
""" homeassistant.components.switch.demo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Demo platform that has two fake switches. """ from homeassistant.helpers.entity import ToggleEntity from homeassistant.const import STATE_ON, STATE_OFF, DEVICE_DEFAULT_NAME # pylint: disable=unused-argument def setup_platform(hass, config...
""" Demo platform that has two fake switches. """ from homeassistant.helpers.entity import ToggleEntity from homeassistant.const import STATE_ON, STATE_OFF, DEVICE_DEFAULT_NAME # pylint: disable=unused-argument def setup_platform(hass, config, add_devices_callback, discovery_info=None): """ Find and return demo s...
Python
0.000001
05948850d76626f3b29a80a447280bbd693a93cb
Update HeadingAnchors to receive config options.
wok/contrib/hooks.py
wok/contrib/hooks.py
# vim: set fileencoding=utf8 : """Some hooks that might be useful.""" import os import subprocess from StringIO import StringIO import logging from wok.exceptions import DependencyException from wok.util import slugify try: from lxml import etree except ImportError: etree = None class HeadingAnchors(object...
# vim: set fileencoding=utf8 : """Some hooks that might be useful.""" import os import subprocess from StringIO import StringIO import logging from wok.exceptions import DependencyException from wok.util import slugify try: from lxml import etree except ImportError: etree = None class HeadingAnchors(object...
Python
0
76c4f9b4acbedab7606ddca4c6456db47e68a744
Add Currency model
game/currencies/__init__.py
game/currencies/__init__.py
# -*- coding: utf-8 -*- """ Enchants - CurrencyTypes.dbc """ from .. import * class Currency(Model): def getTooltip(self): return CurrencyTooltip(self) class CurrencyTooltip(Tooltip): def tooltip(self): self.append("name", self.obj.getName()) self.append("description", self.obj.getDescription(), color=Y...
Python
0
f2b6d7cb70a0a5b4f1a96657ba66455cdab67b45
Add search for weird memories
weird.py
weird.py
# # Author: Brent Nelson # Created: 18 Dec 2020 # Description: # Given a directory, will analyze all the MDD files import glob import patch_mem import parseutil.parse_mdd as mddutil from collections import namedtuple Mdd = namedtuple('Mdd', 'typ width addrbeg addrend') def main(dirs, verbose): ...
Python
0
c0f71cd818c52bd02bdaff28a1220456bfd4ee5f
Create basecache.py
cutout/cache/basecache.py
cutout/cache/basecache.py
# -*- coding: utf-8 -*- #from itertools import izip from .posixemulation import _items class BaseCache(object): """Baseclass for the cache systems. All the cache systems implement this API or a superset of it. :param default_timeout: the default timeout that is used if no timeout is ...
Python
0.000001
0312a4210d07618755b6ad9caf49b144e7bec58c
add en-gb format tests
babybuddy/tests/formats/tests_en_gb.py
babybuddy/tests/formats/tests_en_gb.py
# -*- coding: utf-8 -*- import datetime from django.core.exceptions import ValidationError from django.forms.fields import DateTimeField from django.test import TestCase, override_settings, tag from django.utils.formats import date_format, time_format from babybuddy.middleware import update_en_gb_date_formats class...
Python
0.000002
f14ca27897ade9b4a19aa29b869a845486f67829
Create audit object class
market/audit.py
market/audit.py
__author__ = 'hoffmabc' from log import Logger class Audit(object): """ A class for handling audit information """ def __init__(self, db): self.db = db self.log = Logger(system=self) self.action_ids = { "GET_PROFILE": 0, "GET_CONTRACT": 1, ...
Python
0.000001
49bb25a16d652dee43be5454b984134918200fe1
Add tool to validate interfaces usage.
tools/validateinterfaces.py
tools/validateinterfaces.py
#! /usr/bin/env python # -*- coding: utf8 -*- # # Copyright (C) 2014 Andrei Karas (4144) import os import re from sets import Set interfaceRe = re.compile("struct (?P<name1>[a-z_]+)_interface (?P<name2>[a-z_]+)_s;") class Tracker: pass def searchDefault(r, ifname): defaultStr = "void {0}_defaults(void)".fo...
Python
0
83a7b19d33c9dac43e103933c9b4a734304ed2a1
Add some unit tests.
HearthStone2/test/utils/test_misc.py
HearthStone2/test/utils/test_misc.py
#! /usr/bin/python # -*- coding: utf-8 -*- import os import sys import unittest sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')) import MyHearthStone.utils.misc as misc __author__ = 'fyabc' class TestMisc(unittest.TestCase): @classmethod def setUpClass(cls): ...
Python
0
3f1e21e1d2a3d1418c19e454f77071686d21f7b9
add external project
meinberlin/apps/extprojects/admin.py
meinberlin/apps/extprojects/admin.py
from django.contrib import admin from . import models @admin.register(models.ExternalProject) class ExternalProjectAdmin(admin.ModelAdmin): fields = ( 'name', 'url', 'description', 'tile_image', 'tile_image_copyright', 'is_archived' ) list_display = ('__str__', 'organisation', 'is_draft',...
Python
0
be30299c1e9013a99bf7e828700741c1ce3fe386
Create a contrib rule for creating docker_push defaults. (#92)
docker/contrib/with-defaults.bzl
docker/contrib/with-defaults.bzl
# Copyright 2017 The Bazel Authors. 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
Python
0
40136d00bb5f81fa35d2240511c02ea2f6d26fd7
792. Number of Matching Subsequences
LeetCode/NumberOfMatchingSubsequences.py
LeetCode/NumberOfMatchingSubsequences.py
""" Naive solution counting matches was too slow (O(sum # letters in words)). Sped it up just enough by preventing recalculation on duplicate words. """ from collections import Counter def is_subsequence(subs, s): if len(subs) == 0: return True if len(subs) > len(s): return False i = 0 # i...
Python
0.999999
07b1602fbab9708929ac331617f4d6635b6e503d
Add test for `/v3/job/list`
tdclient/test/job_api_test.py
tdclient/test/job_api_test.py
#!/usr/bin/env python from __future__ import print_function from __future__ import unicode_literals from __future__ import with_statement import functools import os from tdclient import api from tdclient import version def setup_function(function): try: del os.environ["TD_API_SERVER"] except KeyErro...
Python
0
e7ec8c2023be2a480d7f459854133b1f5e4a3642
Add module metrics, with plugins to calculate Cyclomatic Complexity and Halstead metrics of Scratch projects
hairball/plugins/metrics.py
hairball/plugins/metrics.py
"""This module provides plugins with clasic Sw Engineering metrics""" import math from collections import Counter from hairball.plugins import HairballPlugin class CyclomaticComplexity(HairballPlugin): """Plugin that calculates the Cyclomatic Complexity of a project.""" def __init__(self): super(Cyc...
Python
0
42b4ca440ea785ae764f2c50fa0ca96539c2db8d
Create ShuffleLabel.py
histomicstk/ShuffleLabel.py
histomicstk/ShuffleLabel.py
import numpy as np from skimage import measure as ms def ShuffleLabel(Label): """ Shuffles labels in a label image to improve visualization and enhance object boundaries. Parameters ---------- Label : array_like A label image generated by segmentation methods. Returns -------...
Python
0
9c185b4e81deee0aede8e66b2ef258ea0dbd00d8
Fix LXDContainerImage.fetch_image
nclxd/nova/virt/lxd/container_image.py
nclxd/nova/virt/lxd/container_image.py
# Copyright 2015 Canonical Ltd # 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 obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
# Copyright 2015 Canonical Ltd # 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 obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
Python
0.000002
dcd83ea781ad8de1111984c8972b314f6f88e4d0
add orm-1
www/transwarp/orm.py
www/transwarp/orm.py
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Jeff Chen' ''' 封装orm操作 ''' import db class Field(object): ''' db的字段名和类型 ''' def __init__(self, name, column_type): self.name = name self.column_type = column_type def __str__(self): # 定制类,反馈类实例的内部信息 return '<%s:...
Python
0.004123
5e1ba2f9a14634fb1e8a7eaadbad370b97beb383
Add Middle English
cltk/corpus/middle_english/alphabet.py
cltk/corpus/middle_english/alphabet.py
""" Sources: From Old English to Standard English: A Course Book in Language Variation Across Time, Dennis Freeborn https://web.cn.edu/kwheeler/documents/ME_Pronunciation.pdf https://en.wikipedia.org/wiki/Middle_English_phonology """ ALPHABET = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'l',...
Python
0.000002
77b06bf2737095b889b8c31e5d296d03b3030bb4
add promise model pesudo codes
promise.py
promise.py
# coding: utf-8 __author__ = 'cloud' ''' promise model: ''' # example 1: ''' create vol and attach ''' def vol_create(vol_arg): pass def vol_wait_available(scope): pass def vol_attach_get_lock(scope): pass def vol_attach(scope): pass def vol_attach_release_lock(scope): pass def vol_cr...
Python
0
51dc6dc1ebe6babb468f0ef607ff750327a366ba
Enable the change tracking tables in admin.
pubsubpull/admin.py
pubsubpull/admin.py
""" Enable admin """ from django.contrib import admin from pubsubpull.models import Request, UpdateLog admin.site.register(Request) admin.site.register(UpdateLog)
Python
0
bce4656156b4f04655f38099a4b577651dc794d5
make python -m crossbar work, using the same console script
crossbar/__main__.py
crossbar/__main__.py
##################################################################################### # # Copyright (C) Tavendo GmbH # # Unless a separate license agreement exists between you and Tavendo GmbH (e.g. you # have purchased a commercial license), the license terms below apply. # # Should you enter into a separate licen...
Python
0.000001
6798e3460e573b06bbf941f96102ef4ce196ca49
add channel for rpc
python/proto/pyRpc2/channler.py
python/proto/pyRpc2/channler.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # # Copyright (c) 2016 ASMlover. 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 retain the above copyrig...
Python
0.000001
23da66a6a36ab82b7cb356d110c26ef9a0412932
Create EVE-FAG-DETECTOR.py
EVE-FAG-DETECTOR.py
EVE-FAG-DETECTOR.py
print("EVE FAG DETECTOR v2.2.3") eveName = input("What is the character's name?") if(eveName == "Raven Null"): print("Raven Null is not a fag.") elif(eveName =="raven null"): print("Learn how to use the shift key dumbass. Also, no faggotry was detected for Raven Null.") else: print("Player is confirmed to be a fag."...
Python
0.00013
7f43f49b429afb2cc9e90b43fec31915158f73ea
Add module redfish_config (#43470)
lib/ansible/modules/remote_management/redfish/redfish_config.py
lib/ansible/modules/remote_management/redfish/redfish_config.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2017-2018 Dell EMC Inc. # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'status': ['preview'], ...
Python
0
6214758e0a4b7140454a4ef244521e87541307e5
Add python3 template
python3.py
python3.py
#!/usr/bin/env python3 import warnings with warnings.catch_warnings(): import re import sys import argparse import os import os.path import logging script_dir=os.path.abspath(os.path.dirname(__file__)) def create_preferences_directory(): if os.name != "posix": from win32com.sh...
Python
0
31eb882d7f4a25805068f2c6277907775c685dca
add 91porn.py
91porn.py
91porn.py
#!/usr/bin/env python2 # vim: set fileencoding=utf8 import os import sys import requests import urlparse import re import argparse import random import select ############################################################ # wget exit status wget_es = { 0: "No problems occurred.", 2: "User interference.", 1<...
Python
0.998404
aea51be0e9428ddb4f72b3382fea1ae1cd99f1a9
add crude performance test script
test/performance.py
test/performance.py
# -*- coding: utf-8 -*- # import time import numpy import pytest import meshio def generate_mesh(): '''Generates a fairly large mesh. ''' import pygmsh geom = pygmsh.built_in.Geometry() geom.add_circle( [0.0, 0.0, 0.0], 1.0, # 5.0e-3, 1.0e-2, num_sections...
Python
0.000001
478a78494199b8282b635323128c07f2661df58b
add pong
pong/pong.py
pong/pong.py
#TKinterPongGame.py from tkinter import * import random import time class Ball: def __init__(self, canvas, paddle, color): self.canvas = canvas self.paddle = paddle self.id = canvas.create_oval(10, 10, 25, 25, fill=color) self.canvas.move(self.id, 245, 150) starts = [-3, -2, ...
Python
0.001045
97b9ee00277fa35c92886b1ed39864eba3707dce
Add organizer permissions to staff group
bluebottle/activities/migrations/0020_auto_20200224_1005.py
bluebottle/activities/migrations/0020_auto_20200224_1005.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2019-11-11 12:19 from __future__ import unicode_literals from django.db import migrations from bluebottle.utils.utils import update_group_permissions def add_group_permissions(apps, schema_editor): group_perms = { 'Staff': { 'perms': ( ...
Python
0
4e6d7b7625d7f6c1a65fd8cc41c59ae07671aa34
add command to register SubService Entity
src/orchestrator/commands/registerSubServiceEntity.py
src/orchestrator/commands/registerSubServiceEntity.py
#!/usr/bin/env python # # Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U # # This file is part of IoT orchestrator # # IoT orchestrator is free software: you can redistribute it and/or # modify it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, eith...
Python
0
f2ec232ce654a645e5d243cc2a794b7a69fd438d
use your RPI for powerpoint presentations!
presenter.py
presenter.py
""" this script uses XAutomation, i.e. the xte command. install it with: >sudo apt-get install xautomation """ import RPi.GPIO as GPIO import subprocess import time btnPin1 = 27 btnPin2 = 22 GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(btnPin1, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.setup(btnPin2, ...
Python
0
9ce799511701f1d8f06ce2555253325ad8c76cc2
add abstract action class
rprpg/battle/action.py
rprpg/battle/action.py
import abc class Action(object): __metaclass__ = abc.ABCMeta def __init__(self, requires_target): self.target = None self.requires_target = requires_target @abc.abstractmethod def execute(self): pass
Python
0.000538
b2b09ffd38a05f7a9a065dc0a2b23ee292efee12
fix NameError in impute
Engine.py
Engine.py
import inspect # import numpy # import cython.State as State class Engine(object): def __init__(self): self.seed = 0 def initialize(self, M_c, M_r, T, i): p_State = State.p_State(numpy.array(T)) X_L = p_State.get_X_L() X_D = p_State.get_X_D() return M_c, M_r, X_L, X_D...
import inspect # import numpy # import cython.State as State class Engine(object): def __init__(self): self.seed = 0 def initialize(self, M_c, M_r, T, i): p_State = State.p_State(numpy.array(T)) X_L = p_State.get_X_L() X_D = p_State.get_X_D() return M_c, M_r, X_L, X_D...
Python
0.000003
b77187592e3a6ba4fd06c13fb2a576ab9066d893
add test for #313
numba/tests/issues/test_issue_313.py
numba/tests/issues/test_issue_313.py
# -*- coding: utf-8 -*- from numba import void, double, jit import numpy as np # thanks to @ufechner7 def multiassign(res0, res1, val0, val1): res0[:], res1[:] = val0[:], val1[:] if __name__ == "__main__": multiassign1 = jit(void(double[:], double[:], double[:], double[:]))(multiassign) res0 = np.zer...
Python
0
efbf98235b82c954364f35cb09f63006e23346e2
Create tests for JavaScript parser.
tests/test_lang_javascript.py
tests/test_lang_javascript.py
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- import pytest # type: ignore from sensibility.language import Language from sensibility.language.javascript import javascript from sensibility.token_utils import Position from location_factory import LocationFactory test_file = r"""#!/usr/bin/env node /*! * This is a...
Python
0
b29a37c92efca42cbd85b24306455b063dce33e2
debug module can be imported to cause break-on-exception
pug/debug.py
pug/debug.py
"""Import this module to invoke the interractive python debugger, ipydb, on any exception Resources: Based on http://stackoverflow.com/a/242531/623735 Examples: >>> import debug >>> x=[][0] """ # from http://stackoverflow.com/a/242514/623735 # if __name__ == '__main__': # try: # main() #...
Python
0.000003
fd3a4e39b17995f75d9b6027b4abcb29013f479d
add network/sshd.py.
network/sshd.py
network/sshd.py
from __future__ import print_function import os import sys import re import time import datetime def get_ptyreq_reply(line): # for Microsoft Windows, the `pty-req reply` in sshd log would be 0. # for Linux, the `pty-req reply` would be 1. REGEX = r'(?<=pty-req reply )\d' try: return re.search(...
Python
0
45c746c6c6aee03092b2b08bf1aff73ead85683e
add form
150409/server/form.py
150409/server/form.py
# -*- coding: utf-8 -*- """ Created on Thu Apr 23 18:48:43 2015 @author: Wasit """ from flask import Flask from flask import request app = Flask(__name__) form_str="""<form action="login" method="POST"> First name:<br> <input type="text" name="firstname" value="Mickey"> <br> Last name:<br> <input type="text" name="l...
Python
0.000001
a9077802269270a1d8cfb685400b9f23f45d6940
add propagator test
tests/pptc/test_propagator.py
tests/pptc/test_propagator.py
from pybbn.graph.dag import BbnUtil from pybbn.pptc.potentialinitializer import PotentialInitializer from pybbn.pptc.moralizer import Moralizer from pybbn.pptc.triangulator import Triangulator from pybbn.pptc.transformer import Transformer from pybbn.pptc.initializer import Initializer from pybbn.pptc.propagator import...
Python
0
9100015cf25d0ab09aa3b8d6410343f933b599fc
Add quicklook.py, a quick way of checking properties across all the data
quicklook.py
quicklook.py
from fiona import collection from sys import argv from glob import glob if (len(argv) == 2): addrs = glob("chunks/addresses-%s.shp") for addr in addrs: print addr else: addrs = glob("chunks/addresses*.shp") for addr in addrs: try: with collection(addr, "r") as input: ...
Python
0
34939554fc3697867979a6ca711583b24d38def0
Create quicksort.py
quicksort.py
quicksort.py
"""Implements Quicksort algorithm. """ import random # for random selection of pivot element def swap_elements(mut_seq, index1, index2): """Swaps two elements of mutable sequence. Args: mut_seq: mutable sequence index1: index of element to be swapped with element with index 'index2' ...
Python
0.000004
09ee7c5972f3a508355f6dfd49ff05d8de482cd9
Add example of slide-hold-slide test
shs_example.py
shs_example.py
import numpy as np import matplotlib.pyplot as plt import rsf model = rsf.RateState() # Set model initial conditions model.mu0 = 0.6 # Friction initial (at the reference velocity) model.a = 0.005 # Empirical coefficient for the direct effect model.b = 0.01 # Empirical coefficient for the evolution effect model.dc = 1...
Python
0.000001
4f7b103d6c5fa3b07abb23e346caa995a7f803ef
Make new test fail correctlyish
tests/completion.py
tests/completion.py
import sys from nose.tools import ok_ from _utils import _output_eq, IntegrationSpec, _dispatch, trap, expect_exit class ShellCompletion(IntegrationSpec): """ Shell tab-completion behavior """ def no_input_means_just_task_names(self): _output_eq('-c simple_ns_list --complete', "z_toplevel\n...
from _utils import _output_eq, IntegrationSpec class ShellCompletion(IntegrationSpec): """ Shell tab-completion behavior """ def no_input_means_just_task_names(self): _output_eq('-c simple_ns_list --complete', "z_toplevel\na.b.subtask\n") def no_input_with_no_tasks_yields_empty_response(...
Python
0.998843
b5dcc8d77ebbe3f1e62599164139cf60927c94c8
Create Precio.py
Precio.py
Precio.py
#!/usr/bin/python # -*- coding: utf-8 -*- from att import * #from att import Sector_Destino from zona import zona from Conexion import * # lugar = "Costa del Este" # # lugar = "Altos del Hipódromo" # # destino="El Tecal" # # # lugar = "El Tecal" # destino="Costa del Este" lugar = "Albrook" destino ="24 de Diciembre" ...
Python
0
661943403b9a4b7c28bf9e0a59ba937dc2298fef
Add SSH auto detect feature
netmiko/ssh_autodetect.py
netmiko/ssh_autodetect.py
""" This module is used to auto-detect the type of a device in order to automatically create a Netmiko connection. The will avoid to hard coding the 'device_type' when using the ConnectHandler factory function from Netmiko. """ from netmiko.ssh_dispatcher import CLASS_MAPPER_BASE, ConnectHandler SSH_MAPPER_BASE = {}...
Python
0