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
f3a6281098b11ddd353a394d914186d5c7683f9b
add jupyter module
rasa/jupyter.py
rasa/jupyter.py
import pprint as pretty_print from typing import Any, Dict, Text, TYPE_CHECKING from rasa_core.utils import print_success, print_error if TYPE_CHECKING: from rasa_core.agent import Agent from rasa_core.interpreter import NaturalLanguageInterpreter def pprint(object: Any): pretty_print.pprint(object, inde...
Python
0
d8407723f9bf40ca166e5471e76c03c257bc71f9
Add lc208_implement_trie_prefix_tree.py
lc208_implement_trie_prefix_tree.py
lc208_implement_trie_prefix_tree.py
"""Leetcode 208. Implement Trie (Prefix Tree) Medium URL: https://leetcode.com/problems/implement-trie-prefix-tree/ Implement a trie with insert, search, and startsWith methods. Example: Trie trie = new Trie(); trie.insert("apple"); trie.search("apple"); // returns true trie.search("app"); // returns false tri...
Python
0.000001
8a7c3ad110c00e6049fa452634d06a6873a36f90
Add an examples folder.
examples/api.py
examples/api.py
# -*- coding: utf-8 -*- ''' This example demonstrates the skosprovider API with a simple DictionaryProvider containing just three items. ''' from skosprovider.providers import DictionaryProvider from skosprovider.uri import UriPatternGenerator from skosprovider.skos import ConceptScheme larch = { 'id': '1', '...
Python
0
1b00a597d8145b2df05054fef8d072d452209463
Make SurfaceHandler (for sfc data)
src/data/surface.py
src/data/surface.py
from glob import glob # Third-party modules import pandas as pd # Hand-made modules from base import LocationHandlerBase SFC_REGEX_DIRNAME = "sfc[1-5]" KWARGS_READ_CSV_SFC_MASTER = { "index_col": 0, } KWARGS_READ_CSV_SFC_LOG = { "index_col": 0, "na_values": ['', ' '] } class SurfaceHandler(LocationHandle...
Python
0
c025cd6649e2326ade7b81df8408c4363fdb2050
add music handler
app/music_handler.py
app/music_handler.py
#-*- coding:utf-8 -*- from tools.httptools import Route from models import Music @Route.get("/music") def get_music_handler(app): ret={}; ret['code']=200 ret['msg']='ok' ret['type']=3 ret['data']=[ {'music_name':'CountrintStars','music_url':'http://7xs7oc.com1.z0.glb.clouddn.com/music%2FJason%20Chen%20-%20Count...
Python
0.000001
3091555ca7fc421f886a1df1ac28f677feb70a53
Add default value for the fields object and field of the social network app model
app/migrations/0006_auto_20150825_1513.py
app/migrations/0006_auto_20150825_1513.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('app', '0005_auto_20150819_1054'), ] operations = [ migrations.AlterField( model_name='socialnetworkapp', ...
Python
0
f05bd26c7a275c38c092c821e5ef62284c36e783
Test transormation matrices
test/test_interpolate.py
test/test_interpolate.py
import pywt import sys import numpy as np from scipy.ndimage.interpolation import affine_transform sys.path.insert(0, '../mlp_test') from data_utils import load_mnist from skimage import transform as tf test_data = load_mnist()[2] chosen_index = 7 test_x_chosen = test_data[0][chosen_index] test_y_chosen = test_da...
Python
0
47cbcf130e76604ed93306f02fc2221a276d3bbf
Split out
pentai/gui/spacer.py
pentai/gui/spacer.py
from kivy.uix.widget import Widget class HSpacer(Widget): pass class VSpacer(Widget): pass
Python
0.000462
e37a616d23805ced7250d4cdd6422751d8ae5143
Add populate_anticrispr.py
phageAPI/populate_anticrispr.py
phageAPI/populate_anticrispr.py
#! /usr/bin/env python import os from Bio import SeqIO import textwrap def populate(sequences, AntiCRISPR): for seq in sequences: spacer, _ = AntiCRISPR.objects.get_or_create( accession=seq.name, sequence=str(seq.seq)) spacer.save() def main(): import argparse p...
Python
0
333cbe13d8104934a924f223427fa06a60a8b080
Create php4dvd_1.py
php4dvd/php4dvd_1.py
php4dvd/php4dvd_1.py
# -*- coding: utf-8 -*- from selenium import webdriver import unittest class Untitled(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.driver.implicitly_wait(30) self.base_url = "http://localhost:8080/" self.verificationErrors = [] self.accept_next...
Python
0.000013
d894e39e0280aaa45cef914f2202e978797b26fb
Update and rename 2 to 28.py
exercises/28.py
exercises/28.py
''' Write a function find_longest_word() that takes a list of words and returns the length of the longest one. Use only higher order functions. ''' def find_longest_word(lst): return len(max(lst, key=len))
Python
0.0001
4d9da24a0356bc63be6ab06eb084f97116d1dac4
should be functioning
cogs/packages.py
cogs/packages.py
import discord from cogs import common class Packages: def __init__(self, bot): self.bot = bot def pkg_url(pkg): """Returns the URL for JSON data about a package on PyPI.""" return f'https://pypi.python.org/pypi/{pkg}/json' @commands.command() async def pypi(self, c...
Python
0.999455
183b0c573478ff5e2480758abec629ddce4f0766
Create missing migration for model Meta changes in 9d1e29150407e906bc651a8249c53e5e6d1fb1e7.
atmo/jobs/migrations/0035_auto_20170529_1424.py
atmo/jobs/migrations/0035_auto_20170529_1424.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.1 on 2017-05-29 14:24 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('jobs', '0034_auto_20170529_1424'), ] operations = [ migrations.AlterModelOptions( ...
Python
0
b674ff31ab846bc4c11b615ad7f738ff176d5f96
Add /team test
picoCTF-web/tests/api/functional/v1/test_team.py
picoCTF-web/tests/api/functional/v1/test_team.py
"""Tests for the /api/v1/team endpoints.""" from common import ( # noqa (fixture) ADMIN_DEMOGRAPHICS, clear_db, client, decode_response, get_csrf_token, register_test_accounts, TEACHER_DEMOGRAPHICS, USER_DEMOGRAPHICS, get_conn ) def test_get_my_team(client): """Tests the /team endpoint.""" ...
Python
0
d8c8287cce7ddc48f4ea271a54bd6efa8dcabe66
Create OutputNeuronGroup_multiple_outputs_1.py
examples/OutputNeuronGroup_multiple_outputs_1.py
examples/OutputNeuronGroup_multiple_outputs_1.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
c70a127e17286f18e8d2d46bdc2e5ec6b0c55d0d
Add script to output statistics on body part emotion pairs
generate_body_part_emotion_pairs.py
generate_body_part_emotion_pairs.py
"""Find known body parts in sentences with predicted label 'Lichaamsdeel'. Extended body parts are saved to new text files. Usage: python classify_body_parts.py <json file with body part mapping> <dir with input texts> <dir for output texts> """ import os import codecs import argparse import json import copy from col...
Python
0
97f9540adfdd3805deb4f8e124513c34d65e0444
Add fritzcollectd
fritzcollectd.py
fritzcollectd.py
# fritzcollectd - FRITZ!Box collectd plugin # Copyright (c) 2014 Christian Fetzer # # 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...
Python
0.00002
e94dcbe781666ba8f083efab3dd63818d805c6d8
Add flac2mp3 script.
flac2mp3.py
flac2mp3.py
#!/usr/bin/env python import argparse import subprocess import os import glob def gettag(tag, filename): proc = subprocess.Popen(["metaflac", "--no-utf8-convert", "--show-tag=" + tag, filename], stdout=subprocess.PIPE) out = proc.communicate()[0].rstrip() remove = len(out.split("=")[0]) + 1 re...
Python
0
19ee2fbee238e94b7944154d692a9e488ee19a79
Add basic opps database configuration
opps/db/conf.py
opps/db/conf.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.conf import settings from appconf import AppConf class OppsDataBaseConf(AppConf): HOST = getattr(settings, 'OPPS_DB_HOSR', None) USER = getattr(settings, 'OPPS_DB_USER', None) PASSWORD = getattr(settings, 'OPPS_DB_PASSWORD', None) PORT = geta...
Python
0
8fa3accb670c665f6db420e291a2bc617f836994
Add script that counts word frequencies in the debate data
debates2csv.py
debates2csv.py
#!/usr/bin/env python # -.*- coding: utf-8 -.*- """Script to extract counts for words in word field. Usage: debates2csv.py <xml-file or directory containing xml files> 2014-11-18 j.vanderzwaan@esciencecenter.nl """ import argparse import xml.etree.ElementTree as ET import re from nltk.tokenize import RegexpTokenizer ...
Python
0
d1c791ccf5b2873bbc248c9b079a5b68159ffb50
Add ECM Keys script
python/ecep/portal/management/commands/update_ecm.py
python/ecep/portal/management/commands/update_ecm.py
import csv import os import re from django.core.management.base import NoArgsCommand from django.conf import settings from portal.models import Location class Command(NoArgsCommand): """ Import Cleaned Site Name, Address, and ECM Keys """ def handle(self, *args, **options): with open('mast...
Python
0
8ed1fccb2a1d72815bde93b19d45069e59db0900
add force404 sample
force404.py
force404.py
# -*- coding:utf-8 -*- from bottle import route, run, abort, error @route("/") def top(): abort(404, "go to 404") return "Hello world!" @error(404) def error404(error): return "Not Found!" run(host="0.0.0.0", port=8080, debug=True, reloader=True)
Python
0
5d58200622e05728acce8ffba1ddf7e5063f556c
Create formatIO.py
formatIO.py
formatIO.py
# 将输入输出格式化例如:(xxxx) -> (x)(x)(x)(x), ([x]) -> x, [xxxx] ->[x][x][x][x] def formatting(old_tune): ''' 格式化 ''' new_tune = '' sharped = False low = high = 0 for i in old_tune: if i == '(': low = low + 1 elif i == '[': high = high + 1 elif i == '...
Python
0.000003
aff6ff82ec4fc0076f8356d782a2a103510ebbfd
use Queue for product and custom problem
product_custom/use_queue.py
product_custom/use_queue.py
# http://blog.jobbole.com/52412/ from threading import Thread import time import random from Queue import Queue queue = Queue(10) class ProducerThread(Thread): def run(self): nums = range(5) while True: num = random.choice(nums) queue.put(num) print "Produc...
Python
0
b75a0293f214de4196d9df50ef5906885c2810fc
Create empClass.py
empClass.py
empClass.py
from rgfunc import * class Employee(object): year = 0 month = 0 day = 0 city = "" country = "" lastname = "" def __init__(self,name): self.name = name def dateofbirth(self): return str(self.day)+"/"+str(self.month)+"/"+str(self.year) #fullname = name," ",lastname def fullname(self): return st...
Python
0.000002
36f2890f326f80ec251ec0de12345525448842b9
Move file to bin; update ami to LTS release; use standard security group and keyname; add owner to instance name
bin/aws_launcher.py
bin/aws_launcher.py
#!/usr/bin/env python # encoding: utf-8 # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # ideas from # https://github.com/mozilla/telemetry-server/tree/master/provisio...
Python
0
d9be3f189fc34117bdec6e0c7856f7a7dc5f902a
Add tool for generating the JSONP required by the documentation versions.
cdap-docs/tools/versionscallback-gen.py
cdap-docs/tools/versionscallback-gen.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright © 2014 Cask Data, Inc. # # Used to generate JSONP from a CDAP documentation directory on a webserver. # # sudo echo "versionscallback({\"development\": \"2.6.0-SNAPSHOT\", \"current\": \"2.5.2\", \"versions\": [\"2.5.1\", \"2.5.0\"]});" > json-versions.js; l...
Python
0
fe1d75065f7371502cf81ea57e2a1019c2db093c
add config.py
custom_config.py
custom_config.py
# ===== GAE dev_appserver.py settings ===== # [Required] gae_sdk_path = "" project_path = "" # [Optional] datastore_path = "" port = "" admin_port = "" # ===== GAE Helper settings ===== # [Log] log_path = "" append_date_to_log = False # [Request Filter] file_type_filter = [] custom_regex_filter = [] use_time_delim...
Python
0.000002
90c36d54f8822ef28bef98be4ba735d15b405648
add get_dump.py utility
get_dump.py
get_dump.py
#!/usr/bin/python import argparse import mosquitto import time, random import sys def on_mqtt_message(arg0, arg1, arg2=None): # #~ print "on_mqtt_message", arg0, arg1, arg2 if arg2 is None: mosq, obj, msg = None, arg0, arg1 else: mosq, obj, msg = arg0, arg1, arg2 if msg.topic !...
Python
0.000002
e04d3bfd20879d0e8e404a3fff4ab37b914cd303
Add ContactForm
contact/forms.py
contact/forms.py
from django import forms from django.core.exceptions import ValidationError from prosodyauth.forms import PlaceholderForm from simplecaptcha import captcha contact_reasons = ( ('question', 'Question'), ('problem', 'Problem'), ('suggestion', 'Suggestion'), ('other', 'Other'), ...
Python
0
0aed5df2f7c08cdb365b098a93800b0269c0c6b4
Create class Dataset
gammacat/dataset.py
gammacat/dataset.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import logging from .utils import load_yaml, write_yaml from gammapy.catalog.gammacat import GammaCatResource __all__ = [ 'DataSet', ] log = logging.getLogger(__name__) class DataSet: """Process a dataset file.""" resource_type = 'ds' d...
Python
0.000002
828b065e857b5f148a0d20b06fd9d45824a1befc
add manager.py flask api for genmodel
genmodel/manager.py
genmodel/manager.py
from flask import Flask, request, render_template, jsonify import psycopg2 import os # Connect to Database try: DB_NAME=os.environ['DB_NAME'] DB_USER=os.environ['DB_USER'] DB_PASS=os.environ['DB_PASS'] except KeyError as e: raise Exception('environment variables for database connection must be set') c...
Python
0
7e28a3fe54c24a38a90bf0e7cf2f634ca78ee2ed
Add script used to generate a Cantor set
cantorset.py
cantorset.py
### BEGIN LICENSE # The MIT License (MIT) # # Copyright (C) 2015 Christopher Wells <cwellsny@nycap.rr.com> # # 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 wit...
Python
0
282383ab66f85ff6eb58b98c34558c02c9cf44eb
add a tool to list recipes used by builders (and ones not on recipes)
scripts/tools/builder_recipes.py
scripts/tools/builder_recipes.py
#!/usr/bin/env python # 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 argparse import json import operator import os import subprocess import sys import tempfile BASE_DIR = os.path.dirname(os.path...
Python
0.000004
b3a2daace23a8723d97428234b7503684b87adcf
Add BWA alignment module to replace Blast
readtagger/bwa.py
readtagger/bwa.py
import os import subprocess import pysam import temporary class Bwa(object): """Hold Blast-related data and methods.""" def __init__(self, input_path, bwa_index=None, reference_fasta=None, threads=1): """ BWA object for `sequences`. Align sequences in fastq/fasta file `input_path` to...
Python
0
bf3f14692b6e2a348f5a0171ad57e494801ed4f4
Add python script to write lib svm expected data format from my collected data
scripts/writelibsvmdataformat.py
scripts/writelibsvmdataformat.py
""" A script to write out lib svm expected data format from my collecting data """ import os import sys import csv import getopt cmd_usage = """ usage: writelibsvmdataformat.py --inputs="/inputs/csv_files" --output="/output/lib_svm_data" """ feature_space = 10 def write_libsvm_data(input_files, output_file): ...
Python
0
900c93e6917ef92da02cca6865284e0004b01695
add file
aiovk/mixins.py
aiovk/mixins.py
class LimitRateDriverMixin(object): requests_per_second = 3
Python
0.000001
6f75dd27772812cbd91b0fa9582110607c3ee2a3
check format strings for errors
pychecker/pychecker2/FormatStringChecks.py
pychecker/pychecker2/FormatStringChecks.py
from pychecker2.Check import Check from pychecker2.util import BaseVisitor from pychecker2.Warning import Warning from compiler import ast, walk from types import * import re class Unknown(Exception): pass def _compute_constant(node): try: if isinstance(node, ast.Const): return node.value ...
Python
0.000001
a30277835e65195fc68e6708fe5da394bc43e08c
Test Projection
tests/test_projection.py
tests/test_projection.py
from demosys.test import DemosysTestCase from demosys.opengl import Projection class ProjectionTest(DemosysTestCase): def test_create(self): proj = Projection(fov=60, near=0.1, far=10) proj.update(fov=75, near=1, far=100) proj.tobytes() proj.projection_constants
Python
0.000001
1c2c7d5134780e58bd69f24ee06050b2f405d946
Add unit test for run_nohw
src/program/lwaftr/tests/subcommands/run_nohw_test.py
src/program/lwaftr/tests/subcommands/run_nohw_test.py
""" Test the "snabb lwaftr run_nohw" subcommand. """ import unittest from random import randint from subprocess import call, check_call from test_env import DATA_DIR, SNABB_CMD, BaseTestCase class TestRun(BaseTestCase): program = [ str(SNABB_CMD), 'lwaftr', 'run_nohw', ] cmd_args = { '--...
Python
0
d36ce70863653238d88e8ec23416ec894d6140eb
Create _geoserver_publish_layergroup.py
lib/cybergis/gs/_geoserver_publish_layergroup.py
lib/cybergis/gs/_geoserver_publish_layergroup.py
from base64 import b64encode from optparse import make_option import json import urllib import urllib2 import argparse import time import os import subprocess def make_request(url, params, auth=None, data=None, contentType=None): """ Prepares a request from a url, params, and optionally authentication. """...
Python
0.000001
ff3e3e6be3a5a46db73a772f99071e83b9026d98
add wikipedia plugin
plugins/wiki.py
plugins/wiki.py
import wikipedia MAX_LEN = 350 @yui.command('wiki', 'wk', 'w') def wiki(argv): """wiki [-lang] <article>""" lang = 'en' if len(argv) < 2: return # check if a language is given argv = argv[1:] if len(argv) > 1 and argv[0].startswith('-'): lang = argv[0][1:] argv = argv[...
Python
0.000001
dfb611c84bb339cfdf7f9e0e06be8aa6ef6e17e3
Update ycm config
utils/.ycm_extra_conf.py
utils/.ycm_extra_conf.py
# This file is NOT licensed under the GPLv3, which is the license for the rest # of YouCompleteMe. # # Here's the license text for this file: # # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publish, use, compile, sell, or # distribute this software, either...
Python
0
8fc91c780cf7f0b43deac69b0e60f2b9472af172
Add script to automatically setup ln -s for the utilities I use
set-links.py
set-links.py
""" Helper script to set up ln -s <desired utilities> on a given bin/ PATH. """ import os utilities = ( 'mineutils/mc', 'misc/gitmail', 'misc/pipu', 'misc/reclick', ) def run(program, *args): """Spawns a the given program as a subprocess and waits for its exit""" # I for Invariant argument c...
Python
0
7556fd9f55fe84a82a4843fb0ba43e7ad144e874
Update tendrl_definitions.py
tendrl/node_agent/persistence/tendrl_definitions.py
tendrl/node_agent/persistence/tendrl_definitions.py
from tendrl.bridge_common.etcdobj.etcdobj import EtcdObj from tendrl.bridge_common.etcdobj import fields class TendrlDefinitions(EtcdObj): """A table of the Os, lazily updated """ __name__ = '/tendrl_definitions_node_agent' data = fields.StrField("data")
from tendrl.bridge_common.etcdobj.etcdobj import EtcdObj from tendrl.bridge_common.etcdobj import fields class TendrlDefinitions(EtcdObj): """A table of the Os, lazily updated """ __name__ = '/tendrl_definitions_node_agent' data = fields.StrField("data") def render(self): self.__name__ ...
Python
0
907fa0a42dd90ca67d86e61ce7984d5764455fb9
add missing __init__.py
src/distribution/__init__.py
src/distribution/__init__.py
# -*- coding: iso-8859-1 -*- # ----------------------------------------------------------------------------- # core.py - distutils functions for kaa packages # ----------------------------------------------------------------------------- # $Id: distribution.py 2110 2006-11-29 00:41:31Z tack $ # # ----------------------...
Python
0.001057
1dc8f8cb519f14b794f5bc698fe65c5944b35a20
Add Beginning plug-in with basic checking
hairball/neu.py
hairball/neu.py
"""This module provides plugins for NEU metrics.""" import kurt from hairball.plugins import HairballPlugin from PIL import Image import os class Variables(HairballPlugin): """Plugin that counts the number of variables in a project.""" def __init__(self): super(Variables, self).__init__() s...
Python
0
92f63d6ad055aa213b67ad2778187faee1fde821
Add in printParents.py
printParents.py
printParents.py
from types import * # https://stackoverflow.com/questions/2611892/get-python-class-parents def printParents(thing, ident = 2): ''' Print out all the parents (till the ancestors) of a given class / object. @param indent: Print indentation ''' typ = type(thing) if typ is ClassType: printClassParents(thing, 0) ...
Python
0.001401
87565c1e6032bff2cc3e20f5c4f46b7a17977f7c
Add organisation for TFL Dial a Ride
migrations/versions/0098_tfl_dar.py
migrations/versions/0098_tfl_dar.py
"""empty message Revision ID: 0098_tfl_dar Revises: 0097_notnull_inbound_provider Create Date: 2017-06-05 16:15:17.744908 """ # revision identifiers, used by Alembic. revision = '0098_tfl_dar' down_revision = '0097_notnull_inbound_provider' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects imp...
Python
0
22585d29220709dc3a3de16b03c626ca27c715ca
Add migration version? Not sure if this is right
migrations/versions/3025c44bdb2_.py
migrations/versions/3025c44bdb2_.py
"""empty message Revision ID: 3025c44bdb2 Revises: None Create Date: 2014-12-16 12:13:55.759378 """ # revision identifiers, used by Alembic. revision = '3025c44bdb2' down_revision = None from alembic import op import sqlalchemy as sa def upgrade(): pass def downgrade(): pass
Python
0.000006
23b291f6952f8b6a9fade50fef98dbf9d8721862
reorganize french corpus
reorganize_french_corpus.py
reorganize_french_corpus.py
import os import re import wave, struct import librosa import numpy as np import subprocess import shutil new_sr = 22050 corpus = '/media/share/datasets/aligner_benchmarks/AlignerTestData/2_French_2000files' #corpus = os.path.expanduser('~/dog_cat') sorted_corpus = '/media/share/datasets/aligner_benchmarks/sorted_que...
Python
0.999985
1938698ba018df7130acd2f955d43fbe05fc574b
Add donut example
examples/demo/donut.py
examples/demo/donut.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # vispy: gallery 60 """ Points revolving around circles (revolving in a circle) to create a torus. """ import numpy as np from vispy import gloo from vispy import app from vispy.gloo import gl from vispy.util.transforms import perspective, translate, rotate # points and...
Python
0
e21657f377cab4319c1a3ce6fedc76d15c8e6c0a
UVA 11777 Automate the grades
cp-book/ch2/lineards/collections/_11777_AutomateTheGrades.py
cp-book/ch2/lineards/collections/_11777_AutomateTheGrades.py
# Problem name: 11777 Automate the Grades # Problem url: https://uva.onlinejudge.org/external/117/11777.pdf # Author: Andrey Yemelyanov import sys import math def readline(): return sys.stdin.readline().strip() def main(): n_tests = int(readline()) for test in range(n_tests): print("Case {}: {}".format((test + ...
Python
0.999999
64c70f3f73d14d5bdd18cf5c4ad8b15ec745f517
Add helpful script for ascii checking - fyi @bruskiza
config/check_ascii.py
config/check_ascii.py
import json files = ["go-ussd_public.ibo_NG.json"] def is_ascii(s): return all(ord(c) < 128 for c in s) current_message_id = 0 for file_name in files: json_file = open(file_name, "rU").read() json_data = json.loads(json_file) print "Proccessing %s\n-------" % file_name for key, value in json_dat...
Python
0
289ce4a720c5863f6a80e1b86083fd2919b52f14
Add file for tests of start symbol as not nonterminal
tests/startsymbol_tests/NotNonterminalTest.py
tests/startsymbol_tests/NotNonterminalTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 10.08.2017 23:12 :Licence GNUv3 Part of grammpy """ from unittest import TestCase, main from grammpy import * class NotNonterminalTest(TestCase): pass if __name__ == '__main__': main()
Python
0.000001
764f02e5e8c53b47cb2e28375a049accba442f0c
Create __init__.py
app/__init__.py
app/__init__.py
# -*- encoding: utf-8 -*- # app/__init__.py
Python
0.000429
4215862d899c81f3421bd8607dc59500e41e2348
make enemy present enemy -bat and fireball- in game
text_materials_test/pygame/airplane_game/4_enemy.py
text_materials_test/pygame/airplane_game/4_enemy.py
# https://blog.naver.com/PostList.nhn?from=postList&blogId=samsjang&categoryNo=80&currentPage=10 # revision Jaehyeong Kim import pygame import sys import random import time from pygame.locals import * # 상수영역 # 초당 프레임 수 FPS = 30 # 윈도우 크기, 비율 일정하게 만듦 WINDOWWIDTH = 1080 WINDOWHEIGHT = int(WINDOWWIDTH / 2) # 배경 최대 크기 ORI...
Python
0.000055
d9291843d575e587efdd7aa0c4605fee766dc232
clean up test queries
examples/test_query.py
examples/test_query.py
from raco import RACompiler from raco.language import CCAlgebra, MyriaAlgebra from raco.algebra import LogicalAlgebra import logging logging.basicConfig(level=logging.DEBUG) LOG = logging.getLogger(__name__) def testEmit(query, name): LOG.info("compiling %s", query) # Create a compiler object dlog = RAC...
Python
0.000007
3aea50fd086975cfdcc6a337b2ff5a6cace8ce95
Create kuubio.py
kuubio.py
kuubio.py
from keras_diagram import ascii from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM from keras.models import model_from_json from load_data import * import numpy as np import matplotlib.pyplot as plt plt.style.use('bmh') %matplotlib inline import warnings warnings.filterwar...
Python
0.000001
acfa4877ac50a3895cc9f9cb2e349f948d4b8001
add a script to fetch official hero data from battle.net
bin/get_official_heroes.py
bin/get_official_heroes.py
import sys from selenium import webdriver from selenium.common.exceptions import WebDriverException """ The official heroes listing on battle.net is populated by a list of Objects defined in JS (window.heroes). This script fetches the full list and outputs a list of tuples relating official hero names to the battle.n...
Python
0
381c2537eff5003758d552281edfd885ee40ab80
Add migrations
sideloader/migrations/0003_auto_20141203_1708.py
sideloader/migrations/0003_auto_20141203_1708.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('sideloader', '0002_auto_20141203_1611'), ] operations = [ migrations.AlterField( model_name='project', ...
Python
0.000001
f405829f9f4bed9c833f7e25dc97610e34b5dd71
Add JSONField tests
cornflake/tests/fields/test_json_field.py
cornflake/tests/fields/test_json_field.py
import pytest from cornflake.fields import JSONField @pytest.mark.parametrize(('value', 'expected'), [ (True, True), (False, False), (123, 123), (123.456, 123.456), ('foo', 'foo'), (['foo', 'bar'], ['foo', 'bar']), ({'foo': 'bar'}, {'foo': 'bar'}) ]) def test_to_representation(value, expe...
Python
0.000001
8df06647abc7e5125e88af68000f04ac9eca3290
add missing file
quadpy/_exception.py
quadpy/_exception.py
class QuadpyError(Exception): pass
Python
0.000003
f641c8aa8e2eb5d98a90a10813fae6af4b136133
Add command that reindexes all tenants in parallel
bluebottle/clients/management/commands/reindex.py
bluebottle/clients/management/commands/reindex.py
from optparse import make_option import subprocess from multiprocessing import Pool from bluebottle.common.management.commands.base import Command as BaseCommand from bluebottle.clients.models import Client def reindex(schema_name): print(f'reindexing tenant {schema_name}') return ( schema_name, ...
Python
0.000001
1bfc53f5645d6dc7dbbdd020f23e86bebfdc2fc9
Add quick.py (quicksort)
python/quick.py
python/quick.py
#!/usr/bin/env python3 def main(): arr = [] fname = sys.argv[1] with open(fname, 'r') as f: for line in f: arr.append(int(line.rstrip('\r\n'))) quicksort(arr, start=0, end=len(arr)-1) print('Sorted list is: ', arr) return def quicksort(arr, start, end): if end - start <...
Python
0.000001
a493352e5d7e92303a571c2a7d4bcb4e6c76a90c
add qvm-ls
qubesmgmt/tests/tools/qvm_ls.py
qubesmgmt/tests/tools/qvm_ls.py
# pylint: disable=protected-access,pointless-statement # # The Qubes OS Project, https://www.qubesmgmt-os.org/ # # Copyright (C) 2015 Joanna Rutkowska <joanna@invisiblethingslab.com> # Copyright (C) 2015 Wojtek Porczyk <woju@invisiblethingslab.com> # # This program is free software; you can redistribute it and/or mo...
Python
0
25a6ad2a6b37bac4dd553c4e534092f2261d6037
Add response classes
client/responses.py
client/responses.py
class SuccessResponse: def __new__(cls, data=None, text=None, *args, **kwargs): return { 'status_code': 200, 'ok': True, 'data': data, 'text': text } class NonSuccessResponse: def __new__(cls, status=400, text=None, *args, **kwargs): re...
Python
0.000001
bd4ccf9c4876b84cad23f68ea81ecadae733589a
add example for raw binary IO with header
examples/tomo/data/raw_binary_io_with_header.py
examples/tomo/data/raw_binary_io_with_header.py
# Copyright 2014-2016 The ODL development group # # This file is part of ODL. # # ODL is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. #...
Python
0
d89bb401926698dc829be937d8f9c1959ecfd580
make ok,eq actual functions
cement/utils/test.py
cement/utils/test.py
"""Cement testing utilities.""" import unittest from ..core import backend, foundation # shortcuts from nose.tools import ok_ as ok from nose.tools import eq_ as eq from nose.tools import raises from nose import SkipTest class TestApp(foundation.CementApp): """ Basic CementApp for generic testing. "...
"""Cement testing utilities.""" import unittest from ..core import backend, foundation # shortcuts from nose.tools import ok_ as ok from nose.tools import eq_ as eq from nose.tools import raises from nose import SkipTest class TestApp(foundation.CementApp): """ Basic CementApp for generic testing. "...
Python
0.000012
935c145dfb4b40c892b8de11c6cd8deb617b1dbb
make compatible to python2 and 3
cryptoexchange/util/generate-api-key.py
cryptoexchange/util/generate-api-key.py
#/usr/bin/env python3 import json import ssl import getpass import signal try: from urllib.request import Request, urlopen from urllib.parse import urlparse, urlencode from urllib.error import URLError except ImportError: from urlparse import urlparse from urllib import urlencode from urllib2 i...
Python
0.000076
8e1e6585c4bfa76ebbd945d765c6a4a3dc98025d
Add new package: dnstracer (#18933)
var/spack/repos/builtin/packages/dnstracer/package.py
var/spack/repos/builtin/packages/dnstracer/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Dnstracer(Package): """Dnstracer determines where a given Domain Name Server gets its ...
Python
0
2f889b045c1a03b3b046127380f15909ea117265
add new package (#25844)
var/spack/repos/builtin/packages/py-kornia/package.py
var/spack/repos/builtin/packages/py-kornia/package.py
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyKornia(PythonPackage): """Open Source Differentiable Computer Vision Library for PyTorch...
Python
0
e73aac38882b90e7219035800b400c2ed1e181ef
add http data wrapper that can be used to specify options for a specific request
robj/lib/httputil.py
robj/lib/httputil.py
# # Copyright (c) 2010 rPath, Inc. # # This program is distributed under the terms of the MIT License as found # in a file called LICENSE. If it is not present, the license # is always available at http://www.opensource.org/licenses/mit-license.php. # # This program is distributed in the hope that it will be useful, b...
Python
0
4f5adf435eaf1f6f8b5ff8195a8f371afe3fbf21
Add volume backup tempest tests
cinder/tests/tempest/api/volume/test_volume_backup.py
cinder/tests/tempest/api/volume/test_volume_backup.py
# Copyright (c) 2016 Mirantis 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 obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
Python
0.000089
bc2abe4c295a371358064952e6c3afa395a4bd13
Rename Longest-Common-Prefix.py to LongestCommonPrefixtwo.py
leetcode/14.-Longest-Common-Prefix/LongestCommonPrefixtwo.py
leetcode/14.-Longest-Common-Prefix/LongestCommonPrefixtwo.py
#!/usr/bin/python #_*_ coding:utf-8 _*_ class Solution(object): def longestCommonPrefix(self, strs): """ :type strs: List[str] :rtype: str """ strNum=len(strs) #字符串的长度 if strNum == 0 or strs == None: return '' else: prefix = st...
Python
0.999999
5f9c9500296627a94221ecd9614209a2c791e8b9
remove pointless condition
plugins/messages.py
plugins/messages.py
import random class Message: def __init__(self, sent, msg): self.sent = sent self.msg = msg def replyFormat(self): return 'From {user}: {msg}'.format(user = self.sent, msg = self.msg) class MessageDatabase: def __init__(self): self.messages = {} def pendingMessages(self...
import random class Message: def __init__(self, sent, msg): self.sent = sent self.msg = msg def replyFormat(self): return 'From {user}: {msg}'.format(user = self.sent, msg = self.msg) class MessageDatabase: def __init__(self): self.messages = {} def pendingMessages(self...
Python
0.000581
f0f72e5d8a64f7f49406022fd170808417220289
Create publish.py
clickonce/publish.py
clickonce/publish.py
from __future__ import print_function import subprocess import os import sys import shutil import datetime import distutils.dir_util if sys.version_info < (3,): input = raw_input str = unicode pwd = os.getcwd() appver_file = r'.\AppVer' target_shares = { 'release': [], 'test' : [], 'dev' : ...
Python
0.000001
badbf8c89216b97ac29ea3582d99d28535f82a7e
Update __init__.py
slither/__init__.py
slither/__init__.py
from . import slither __all__ = ['slither','Mouse','Stage','Sprite','Sound']
from slither import slither __all__ = ['slither','Mouse','Stage','Sprite','Sound']
Python
0.000072
79df8ab80e6b14f16af125895f5b7338e5c41a60
add IOTools
base/IOTools.py
base/IOTools.py
import ROOT import os class Writer: def __init__(self, directory=None): """ :param directory: """ if directory is None: directory = os.path.abspath(os.curdir) self.dir = directory self.__check_and_create_directory(self.dir) def __check_and_create_d...
Python
0.000001
2786dd91b0bb7dc8849e3549ff40de28d72d40d5
add a django multi-database router
rdrf/rdrf/db.py
rdrf/rdrf/db.py
from io import StringIO import os from django.core.management import call_command from django.db import connections class RegistryRouter: # Whether clinical db is configured at all. one_db = "clinical" not in connections # Whether clinical db is configured to be the same as main db. same_db = (one_db ...
Python
0.000001
0b6f6a9fd3916d8a028d5c3ccf4ca4a0277b9781
Add arena class prototype
src/arena.py
src/arena.py
import jsonpickle class ArenaType(): Circle = 0 Square = 1 class ArenaCoverType(): Soil = 0 Sand = 1 Grass = 2 Stone = 3 class Arena(): def __init__(self, name, size, stype, cover): self.name = name self.size = size self.type = stype self.cover = cover
Python
0
4b0a21dd813d58370805053e60376f64b5927cd9
Add tutorial for MakeNumpyDataFrame
tutorials/dataframe/df032_MakeNumpyDataFrame.py
tutorials/dataframe/df032_MakeNumpyDataFrame.py
## \file ## \ingroup tutorial_dataframe ## \notebook ## Read data from Numpy arrays into RDataFrame. ## ## \macro_code ## \macro_output ## ## \date March 2021 ## \author Stefan Wunsch (KIT, CERN) import ROOT import numpy as np # Let's create some data in numpy arrays x = np.array([1, 2, 3], dtype=np.int32) y = np.arr...
Python
0
43eb4f930f14fcf693f0656a3f0bbe749ed98d2e
Move subgraph attribute copies tests to a separate file.
networkx/algorithms/components/tests/test_subgraph_copies.py
networkx/algorithms/components/tests/test_subgraph_copies.py
""" Tests for subgraphs attributes """ from copy import deepcopy from nose.tools import assert_equal import networkx as nx class TestSubgraphAttributesDicts: def setUp(self): self.undirected = [ nx.connected_component_subgraphs, nx.biconnected_component_subgraphs, ] ...
Python
0
f36a3e4e6cfbc5d3aa14017dcfea6e0fc67514f0
add delete_environment command
ebs_deploy/commands/delete_environment_command.py
ebs_deploy/commands/delete_environment_command.py
from ebs_deploy import out, parse_env_config def add_arguments(parser): """ Args for the delete environment command """ parser.add_argument('-e', '--environment', help='Environment name', required=True) def execute(helper, config, args): """ Deletes an environment ...
Python
0.000003
cf4e468ed28a7e750adfbcd41235ac5b90cb562b
Add new package: diffmark (#18930)
var/spack/repos/builtin/packages/diffmark/package.py
var/spack/repos/builtin/packages/diffmark/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Diffmark(AutotoolsPackage): """Diffmark is a DSL for transforming one string to another.""...
Python
0
ddff4237ae0bb8dd2575265707a843f4497ccbf2
Create headache.py
headache.py
headache.py
""" python plaintext obfuscator by n.bush """ import string import random def mess_maker(size=6, chars=string.ascii_uppercase + string.ascii_lowercase + string.digits): return ''.join(random.choice(chars) for x in range(size)) def headache(text): charlist = list(text) obfuscated = [] class_a = mes...
Python
0.001409
a7d6344428ef43374fb82f5b357968ec38402984
Create test_step_motor_Model_28BYJ_48p.py
test/test_step_motor_Model_28BYJ_48p.py
test/test_step_motor_Model_28BYJ_48p.py
from gadgets.motors.step_motor import Model_28BYJ_48 st_mot = Model_28BYJ_48([11,15,16,18]) for i in range(2): st_mot.angular_step(60,direction=2,waiting_time=2,bi_direction=True)
Python
0.00001
4585d6426a6c2945a359bbe02c58702a07e68746
Create new package. (#6209)
var/spack/repos/builtin/packages/r-gsubfn/package.py
var/spack/repos/builtin/packages/r-gsubfn/package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0
e76fa7d23894bb88d47b761f683b4bbd797ef889
Add Helpers object for cleaner helper syntax
knights/utils.py
knights/utils.py
class Helpers: ''' Provide a cheaper way to access helpers ''' def __init__(self, members): for key, value in members.items(): setattr(self, key, value)
Python
0
6c0e5b7823be4d2defc9f0ff7b4abe76bc6f9af7
sequence learner abc
marmot/learning/sequence_learner.py
marmot/learning/sequence_learner.py
# this is an abstract class representing a sequence learner, or 'structured' learner # implementations wrap various sequence learning tools, in order to provide a consistent interface within Marmot from abc import ABCMeta, abstractmethod class SequenceLearner(object): __metaclass__ = ABCMeta # subclasses mu...
Python
0.999952
4fe6f81e1ce58474761b7bae673e92e1d08c75b3
required drilldown*s* not singular
cubes/backends/mixpanel/store.py
cubes/backends/mixpanel/store.py
# -*- coding=utf -*- from ...model import * from ...browser import * from ...stores import Store from ...errors import * from .mixpanel import * from string import capwords DIMENSION_COUNT_LIMIT = 100 time_dimension_md = { "name": "time", "levels": ["year", "month", "day", "hour"], "hierarchies": [ ...
# -*- coding=utf -*- from ...model import * from ...browser import * from ...stores import Store from ...errors import * from .mixpanel import * from string import capwords DIMENSION_COUNT_LIMIT = 100 time_dimension_md = { "name": "time", "levels": ["year", "month", "day", "hour"], "hierarchies": [ ...
Python
0.99897
8efc243ef6f24025c0cac28c4c644b3928215b89
add cupti_make_report.py
cupti_trace/cupti_make_report.py
cupti_trace/cupti_make_report.py
#!/usr/bin/python3 # Copyright (C) 2015 Samuel Pitoiset <samuel.pitoiset@gmail.com> # All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including wi...
Python
0.000002
2838711c7fa12525c2ae6670bb130999654fe7ea
add shortest-palindrome
vol5/shortest-palindrome/shortest-palindrome.py
vol5/shortest-palindrome/shortest-palindrome.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: Zeyuan Shang # @Date: 2015-11-19 20:43:07 # @Last Modified by: Zeyuan Shang # @Last Modified time: 2015-11-19 20:43:21 class Solution(object): def shortestPalindrome(self, s): """ :type s: str :rtype: str """ ss = s...
Python
0.999999
10f72d72e988bf4aa570e21b0e0d6979edb843a7
add example "fit text path into a box"
examples/addons/fit_text_path_into_box.py
examples/addons/fit_text_path_into_box.py
# Copyright (c) 2021, Manfred Moitzi # License: MIT License from pathlib import Path import ezdxf from ezdxf import path, zoom from ezdxf.math import Matrix44 from ezdxf.tools import fonts from ezdxf.addons import text2path DIR = Path('~/Desktop/Outbox').expanduser() fonts.load() doc = ezdxf.new() doc.layers.new('...
Python
0
e075b0b1c8d581107209e869eda7f6ff07a7321c
Add script to create a historic->modern dictionary
reverse_dict.py
reverse_dict.py
"""Reverse modern->historic spelling variants dictonary to historic->modern mappings """ import argparse import codecs import json from collections import Counter if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('input_dict', help='the name of the json file ' ...
Python
0
8a4175461e36c11356b41e28ca250121f200dc7e
add a new basic longliving statement checker which looks at the health of items on the server
datastage/dataset/longliving/sword_statement_check.py
datastage/dataset/longliving/sword_statement_check.py
import logging import time import thread import urllib2 import sys from django_longliving.base import LonglivingThread from datastage.dataset import SUBMISSION_QUEUE from datastage.web.dataset.models import DatasetSubmission from datastage.web.dataset import openers from sword2 import Connection, UrlLib2Layer logge...
Python
0
34886d13155af33acd043ddcd0d87738a729115a
Add files via upload
faraday_cnn.py
faraday_cnn.py
# ============================================================================ # Convolutional Neural Network for training a classifier to determine the # complexity of a faraday spectrum. # Written using Keras and TensorFlow by Shea Brown # https://sheabrownastro.wordpress.com/ # https://astrophysicalmachinelearnin...
Python
0
64e04143fec40f11cc573140d53bd96765426465
Add scripts/evt2image.py to make image from event file
scripts/evt2image.py
scripts/evt2image.py
#!/usr/bin/env python3 # # Copyright (c) 2017 Weitian LI <liweitianux@live.com> # MIT license """ Make image by binning the event file, and update the manifest. TODO: use logging module instead of print() """ import sys import argparse import subprocess from manifest import get_manifest from setup_pfiles import set...
Python
0
6988a498504b382fd86099d3c037100ad14c62d3
fix bug, tpl_path is related to simiki source path, not wiki path
simiki/configs.py
simiki/configs.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from os import path as osp from pprint import pprint import yaml from simiki import utils def parse_configs(config_file): base_dir = osp.dirname(osp.dirname(osp.realpath(__file__))) try: with open(config_file, "rb") as fd: configs ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from os import path as osp from pprint import pprint import yaml from simiki import utils def parse_configs(config_file): #base_dir = osp.dirname(osp.dirname(osp.realpath(__file__))) try: with open(config_file, "rb") as fd: configs...
Python
0
6adae60ee018966199ee1f8e2120b2eb65dcdc9e
Add stub for registration executable.
nanshe/nanshe/nanshe_registerer.py
nanshe/nanshe/nanshe_registerer.py
#!/usr/bin/env python __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>" __date__ = "$Feb 20, 2015 13:00:51 EST$"
Python
0