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
a174eb57037254f6277a9418db407995ea9aff9c
Add python 3.9 imports
isort/stdlibs/py39.py
isort/stdlibs/py39.py
""" File contains the standard library of Python 3.9. DO NOT EDIT. If the standard library changes, a new list should be created using the mkstdlibs.py script. """ stdlib = { "_thread", "abc", "aifc", "argparse", "array", "ast", "asynchat", "asyncio", "asyncore", "atexit", ...
Python
0.000397
9c22d354da4c09d2e98b657d334e7594df1042d7
Create q2.py
work/q2.py
work/q2.py
def union(arr1, arr2): result = [] for i in range(1, len(arr1)): result.append(arr1[i]) result.append(arr2[i]) return result def create_array(): return [x for x in range(0,100)] print(union(create_array(), create_array()))
Python
0.000114
4e1f87bf7805d20e52015b8c283181e4035de54b
Create _init_.py
luowang/tools/tree-tagger-windows-3.2/TreeTagger/cmd/_init_.py
luowang/tools/tree-tagger-windows-3.2/TreeTagger/cmd/_init_.py
Python
0.000145
40ef5b1a6347d54eeb043c64f36286768b41dc3e
Add lldbToolBox.py scaffolding in ./utils for adding lldb python helpers to use when debugging swift.
utils/lldbToolBox.py
utils/lldbToolBox.py
""" LLDB Helpers for working with the swift compiler. Load into LLDB with 'command script import /path/to/lldbToolBox.py' This will also import LLVM data formatters as well, assuming that llvm is next to the swift checkout. """ import os REPO_BASE = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, ...
Python
0.00001
e0db4982016a724c368feafbe4182016dc0fa67d
Create mongo_to_csv.py
mongo_to_csv.py
mongo_to_csv.py
import unicodecsv import sys from pymongo import MongoClient # call this with 3 arguments: 1) mongodb uri 2) collection nam e3) output filename class generic_converter: def __init__(self): self.header_dict = {} def retrieve_headers(self, test_dict, name_var): for element in test_dict: ...
Python
0.000362
f5c8f8d819143b4a49064847a6eb1a7813a3f06b
Create solution.py
hackerrank/algorithms/sorting/easy/closest_numbers/py/solution.py
hackerrank/algorithms/sorting/easy/closest_numbers/py/solution.py
#!/bin/python size = int(raw_input()) values = sorted([int(value) for value in raw_input().split()][:size]) differences = sorted([(values[i - 1], values[i]) for i in range(1, len(values))], key = lambda x : abs(x[0] - x[1])) i = 1 while (i < len(differences) and abs(differences[i][0] - differences[i][1]) == abs(d...
Python
0.000018
823bf93a9d931ed106ac4ed83f0448215c38580a
Create network_auth.py
network_auth.py
network_auth.py
#!/usr/bin/python # Authenticates against a LAN using HTTP Basic Auth import sys if len(sys.argv) != 4: print ("Invalid arguments") print ("Proper syntax is: " + sys.argv[0] + " [url] [username] [password]") sys.exit(1) import requests import requests.exceptions auth_target = sys.argv[1] username = sys....
Python
0.000003
0cad5e1673069d0fb8f2abb4eb6b062e3461fb70
Add fortran ABI mismatch test for scipy.linalg.
scipy/linalg/tests/test_build.py
scipy/linalg/tests/test_build.py
from subprocess import call, PIPE, Popen import sys import re import numpy as np from numpy.testing import TestCase, dec from scipy.linalg import flapack # XXX: this is copied from numpy trunk. Can be removed when we will depend on # numpy 1.3 class FindDependenciesLdd: def __init__(self): self.cmd = ['l...
Python
0
6e1c43015beae6afbc7b351d19aa1d899678ca44
Add Star class topology
pyswarms/backend/topology/star.py
pyswarms/backend/topology/star.py
# -*- coding: utf-8 -*- """ A Star Network Topology This class implements a star topology where all particles are connected to one another. This social behavior is often found in GlobalBest PSO optimizers. """ # Import from stdlib import logging # Import modules import numpy as np # Import from package from .. imp...
Python
0
096a1d94c2f54246d51954b59fc5c3fdb28154b2
add persistence strategy enum
keen/__init__.py
keen/__init__.py
__author__ = 'dkador' class PersistenceStrategy: """ An enum that defines the persistence strategy used by the KeenClient. Currently supported: DIRECT, which means any time add_event is called the client will call out directly to Keen, or REDIS, which means add_event will simply add the event to a ...
__author__ = 'dkador'
Python
0.000002
46d7ce6a8ce93eb439617cb942d3a7e923b2ed7a
hello world
example/hello.py
example/hello.py
print("Hello World!")
Python
0.999981
295dc1e11563350181558001366275369df90639
Add a sysutil module
sahgutils/sysutil.py
sahgutils/sysutil.py
# System utility functions from subprocess import Popen, PIPE def exec_command(cmd_args): """Execute a shell command in a subprocess Convenience wrapper around subprocess to execute a shell command and pass back stdout, stderr, and the return code. This function waits for the subprocess to complete, b...
Python
0
74034ccc6d1b7436c81520fb287330b852d54c62
Create a.py
a.py
a.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Simple Bot to reply to Telegram messages. This is built on the API wrapper, see # echobot2.py to see the same example built on the telegram.ext bot framework. # This program is dedicated to the public domain under the CC0 license. import logging import telegram from tel...
Python
0.000489
e2dbee01734a981e8fcbbdca7d7d96f0506f929b
Create b.py
b.py
b.py
b = 43
Python
0.000018
ef7b6fb0bbe0c0d263a8c28ccaed1365f50f0ad9
Solve Knowit2019/07
knowit2019/07.py
knowit2019/07.py
def zee_special_divison_operator(exp_r, x): for y_d in range(2, 27644437): b = y_d * x r = b % 27644437 if exp_r == r: break return y_d def test_special(): assert 13825167 == zee_special_divison_operator(5897, 2) assert 9216778 == zee_special_divison_operator(5897...
Python
0.99801
849321eb5a34518afa85e0e5643c1a8f30aad4dc
remove encoding
petl/io/xlsx.py
petl/io/xlsx.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, division import locale from petl.util.base import Table def fromxlsx(filename, sheet=None, range_string=None, row_offset=0, column_offset=0, **kwargs): """ Extract a table from a sheet in an Excel .xlsx file. ...
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, division import locale from petl.util.base import Table def fromxlsx(filename, sheet=None, range_string=None, row_offset=0, column_offset=0, **kwargs): """ Extract a table from a sheet in an Excel .xlsx file. ...
Python
0.9998
e61dbf66d6f73e4999a5ff9f732a8df0637fdbf2
Add an example of SQLalchemy model
server/models.py
server/models.py
from flask.ext.sqlalchemy import SQLAlchemy app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db' db = SQLAlchemy(app) class User(db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(80), unique=True) email = db.Column(db.String(120), unique=True) def __in...
Python
0.000051
b6fb4cadb9ac1506fef3a230ee7ec983daa64922
Remove tail
judge/templatetags/markdown/lazy_load.py
judge/templatetags/markdown/lazy_load.py
from copy import deepcopy from django.contrib.staticfiles.templatetags.staticfiles import static from lxml import html def lazy_load(tree): blank = static('blank.gif') for img in tree.xpath('.//img'): src = img.get('src') if src.startswith('data'): continue noscript = html...
from copy import deepcopy from django.contrib.staticfiles.templatetags.staticfiles import static from lxml import html def lazy_load(tree): blank = static('blank.gif') for img in tree.xpath('.//img'): src = img.get('src') if src.startswith('data'): continue noscript = html...
Python
0.001071
eb145b78d4c84a29ee77fbe77142dee6f97f67dd
put urls and getter in its own file
filemail/urls.py
filemail/urls.py
import os from errors import FMConfigError base_url = 'https://www.filemail.com' api_urls = { 'login': 'api/authentication/login', 'logout': 'api/authentication/logout', 'init': 'api/transfer/initialize', 'get': 'api/transfer/get', 'complete': 'api/transfer/complete', 'forward': 'api/transfer...
Python
0
beb549ba090a1a72761a7e81feb3edcbf85ca543
Add files via upload
first_attempt.py
first_attempt.py
print("Hello world")
Python
0
036601c8172dc71f2ea106abdae9a157a8e60855
update find best results
scripts/find-best.py
scripts/find-best.py
""" Find the best result from experiments. Author: Yuhuang Hu Email : duguyue100@gmail.com """ import sys; import os; from numba.cuda.cudadrv.nvvm import RESULT_CODE_NAMES sys.path.append(".."); import argparse; import cPickle as pickle; import numpy as np; import rolling.dataset as ds; import rolling.draw as draw;...
Python
0.000002
747fa222d1e382ced363ced9d2565f384769316c
add button listener
button-listen.py
button-listen.py
#!/usr/bin/env python import sys from time import time, sleep import RPi.GPIO as GPIO def main(argv=sys.argv): channel = int(argv[1]) GPIO.setmode(GPIO.BCM) try: GPIO.setup(channel, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) ts = 0 while True: GPIO.wait_for_edge(channel, ...
Python
0.000001
4576d623fa48242ede9a106b642cc4b020ec3595
Create processDNAta.py
processDNAta.py
processDNAta.py
""" processDNAta.py version 9/5/2014 Author: Ellen Blaine This program takes in a folder containing files of exon sequences and returns data about those files in the form of a CSV file, including which species for whom a sequence was recovered, the percentage AT/CG bias, and the median recovered sequence length. T...
Python
0.000001
090cdf443aba871c9230a274fbe2242a7e873822
Create gpiorpiplugin.py
gpiorpiplugin.py
gpiorpiplugin.py
""" GPIORPiPlugin.py :: Fauxmo plugin for simple RPi.GPIO. """ try: import RPi.GPIO as GPIO except ImportError: import testRPiGPIO as GPIO print('Using testRPiGPIO') from functools import partialmethod # type: ignore # not yet in typeshed from fauxmo.plugins import FauxmoPlugin from time import sleep impo...
Python
0
8dc7f657e816ab9becbabcf032e62d088f2b6b3c
Add network visualization tool
viz.py
viz.py
import os import json import hashlib def get_data_path(): if not 'OPENSHIFT_DATA_DIR' in os.environ: return '../data/data.json' else: return os.path.join(os.environ['OPENSHIFT_DATA_DIR'], 'data.json') def get_data(): if not os.path.isfile(get_data_path()): with open(get_data_path()...
Python
0
0f3815ed22c4e25d311f36e0d9be9c5b38bd32bd
Create the basic structure for the topic handler.
handler/topic.py
handler/topic.py
class IndexHandler(BaseHandler): class ViewHandler(BaseHandler): class CreateHandler(BaseHandler): class EditHandler(BaseHandler): class FavoriteHandler(BaseHandler): class CancelFavoriteHandler(BaseHandler): class VoteHandler(BaseHandler): class ReplyEditHandler(BaseHandler):
Python
0
c725fb59055810903fd4a9b1da1b6ef11cab2d74
Add functions for timeseries reduction in mpopf
edisgo/opf/timeseries_reduction.py
edisgo/opf/timeseries_reduction.py
import logging import pandas as pd from edisgo.flex_opt import check_tech_constraints logger = logging.getLogger(__name__) def _scored_critical_current(edisgo_obj, grid): # Get allowed current per line per time step i_lines_allowed = check_tech_constraints.lines_allowed_load( edisgo_obj, grid, 'mv')...
Python
0
b48a17f45bbb9a2202c8c3fcb377037b92961f0b
Create na.py
na.py
na.py
hjghjgj
Python
0.000005
00f2a9ae8a7deaa8a0cb49b9f1ce5b9b6a41f654
handle None for timestamps
src/robot/result/configurer.py
src/robot/result/configurer.py
# Copyright 2008-2011 Nokia Siemens Networks Oyj # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
# Copyright 2008-2011 Nokia Siemens Networks Oyj # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
Python
0.000387
48a9b87dd86d600cdab4224c84aa5ce0685b775c
Add fetch data file
python/fetch.py
python/fetch.py
#!/usr/bin/env python import time import json import requests headers = { "Host": "xgs15.c.bytro.com", "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0", "Accept": "text/plain, */*; q=0.01", "Accept-Language": "en-US,en;q=0.5", "Accept-Encodin...
Python
0.000001
3c7e8f08699fa6d2b004f86e6bdb0bc4792ae8c2
Create regex.py
python/regex.py
python/regex.py
# re.IGNORECASE can be used for allowing user to type arbitrary cased texts. QUIT_NO_CASE = re.compile('quit', re.IGNORECASE)
Python
0.000212
b01c602f156b5a72db1ea4f27989aa5b1afdada8
ADD Cleaning before each test
src/behavior/features/terrain.py
src/behavior/features/terrain.py
from lettuce import * import requests TARGET_URL='http://localhost:8080' tenantList = [ "511", "615", "634", "515" ] @before.each_scenario def cleanContext(feature): for tenant in tenantList: url = TARGET_URL + '/pap/v1/' + tenant r = requests.delete(url)
Python
0
5f4263b6968c839bd67a60f4a2ffd89f8b373193
Update __init__.py
tendrl/provisioning/objects/definition/__init__.py
tendrl/provisioning/objects/definition/__init__.py
import pkg_resources from ruamel import yaml from tendrl.commons import objects class Definition(objects.BaseObject): internal = True def __init__(self, *args, **kwargs): self._defs = True super(Definition, self).__init__(*args, **kwargs) self.data = pkg_resources.resource_string(_...
import pkg_resources from ruamel import yaml from tendrl.commons import objects class Definition(objects.BaseObject): internal = True def __init__(self, *args, **kwargs): self._defs = True super(Definition, self).__init__(*args, **kwargs) self.data = pkg_resources.resource_string(_...
Python
0.000072
f784228170557643bc5cb1efc61ea38b45796210
Add flask application
app.py
app.py
# -*- coding: utf-8 -*- from flask import Flask app = Flask(__name__) @app.route('/') def main(): return 'hello' if __name__ == "__main__": app.run()
Python
0.000001
ef67bf3d8a418399fca676502a87ccb7d3914ed1
Add module with common potentials, with force versions for some
Lib/potentials.py
Lib/potentials.py
import numpy as np import utils def LJ(r_0, U_0): ''' Lennard-Jones with minimum at (r_0, -U_0). ''' r_0_6 = r_0 ** 6 def func(r_sq): six_term = r_0_6 / r_sq ** 3 return U_0 * (six_term ** 2 - 2.0 * six_term) return func def step(r_0, U_0): ''' Potential Well at r with ...
Python
0
1ece8c8640214d69a224f94f1b1ac93ec53d7699
Add image processing system (dummy)
chunsabot/modules/images.py
chunsabot/modules/images.py
from chunsabot.botlogic import brain @brain.route("@image") def add_image_description(msg, extras): attachment = extras['attachment'] if not attachment: return None return "asdf"
Python
0
84be951a9160e9998f3ed702542cee7274081091
Create __init__.py
spectrum/__init__.py
spectrum/__init__.py
Python
0.000429
92fde42097c4e0abbf5a7835a72f58f52c9b8499
Create example.py
Python/example.py
Python/example.py
#This is an example script.
Python
0.000001
3a56b89aacad2f948bf85b78c0834edf7c8d8d01
Add missing file.
renamer/util.py
renamer/util.py
import re class ConditionalReplacer(object): def __init__(self, cond, regex, repl): super(ConditionalReplacer, self).__init__() self.cond = re.compile(cond) self.regex = re.compile(regex) self.repl = repl @classmethod def fromString(cls, s): return cls(*s.strip()....
Python
0.000001
ed6cf52b347a49651b715c724f098446d4933353
Create cnn.py
cnn.py
cnn.py
import argparse import sys import tensorflow as tf import functools import tools from mnist import mnist_data def doublewrap(function): @functools.wraps(function) def decorator(*args, **kwargs): if len(args) == 1 and len(kwargs) == 0 and callable(args[0]): return function(args[0]) else: return lambda wr...
Python
0.000003
066673aea6887d9272646d8bac8f99c69387e61d
add management command to check the status of a bounced email
corehq/util/management/commands/check_bounced_email.py
corehq/util/management/commands/check_bounced_email.py
from django.core.management.base import BaseCommand from corehq.util.models import ( BouncedEmail, PermanentBounceMeta, ComplaintBounceMeta, ) class Command(BaseCommand): help = "Check on the bounced status of an email" def add_arguments(self, parser): parser.add_argument('bounced_email'...
Python
0
fea6011cf14e87492d511db3ed9415f5938929bf
add ex8
ex8.py
ex8.py
formatter = "%r %r %r %r" print formatter %(1, 2, 3, 4) print formatter % ("one", "two", "three", "four") print formatter %(True, False, False, True) print formatter %(formatter, formatter, formatter,formatter) print formatter % ( "I had this thing.", "That you could type up right", "But it did't sing.", ...
Python
0.99848
2ea014495f559072c5ecfac0b1117979793cf042
Create ruuvitag-web.py
ruuvitag-web.py
ruuvitag-web.py
#!/usr/bin/python3 from flask import Flask, render_template from datetime import datetime, timedelta import sqlite3 import json import random app = Flask(__name__) def randomRGB(): r, g, b = [random.randint(0,255) for i in range(3)] return r, g, b, 1 @app.route('/') def index(): conn = sqlite3.connect("ru...
Python
0
2becf3b5223da8dc8d312462ae84f32ec3aff129
Create hw1.py
hw1.py
hw1.py
# Name: Yicheng Liang # Computing ID: yl9jv import math k = raw_input("Please enter the value for k: ") while (not k.isdigit()): k = raw_input("Please enter a number for k: ") k = int(k) m = raw_input("Please enter the value for M: ") while (not m.isdigit()): m = raw_input("Please enter a number for M: "...
Python
0.000015
6274ee8d776c829998dfaa56cb419d1263242a48
Add topological sorting in Python
Algorithms/Sort_Algorithms/Topological_Sort/TopologicalSort.py
Algorithms/Sort_Algorithms/Topological_Sort/TopologicalSort.py
''' Topological sort. Taken from : http://stackoverflow.com/questions/15038876/topological-sort-python ''' from collections import defaultdict from itertools import takewhile, count def sort_topologically(graph): levels_by_name = {} names_by_level = defaultdict(set) def walk_depth_first(name): i...
Python
0.000001
df52febb14761d741a20dcdc1cbfd5ea8cd7e07b
add my bing script as an example
bingaling.aclark.py
bingaling.aclark.py
#!/usr/bin/python import re import baseformat import bingaling bingcheck_restr = r'([a4][c][l1][a4][r][k])|([a4][l1][i1])' bingcheck_full = re.compile(r'(('+'\x04\x65'+r')|('+'\x04\x63'r')|([^\w\-'+'\x04'+r'])|(^)|(\t))(' + bingcheck_restr + r')(([^\w\-])|($))', re.IGNORECASE) def bingcheck(line): r = baseform...
Python
0
452763d4eba3b9ec6872c710ef84ee19b8c33c14
Add Untested Class DatabaseSqlite which should handle SQLlite3 Database
src/database/DatabaseSqlite.py
src/database/DatabaseSqlite.py
from typing import List, Dict import sqlite3 from src.database.DatabaseAdapter import DatabaseAdapter class DatabaseSqlite(DatabaseAdapter): def __init__( self, config_path: str): self.db = sqlite3.connect(config_path) self.db.execute("CREATE TABLE " + "track(" + ...
Python
0.000001
d95732ce90c5c9ac571ffc78b45eaa4424a11038
Create nested_scrape.py
nested_scrape.py
nested_scrape.py
""" PROJECT SCRAPER """ from bs4 import BeautifulSoup import urllib2 def scraper(url, outer_tag, outer_attr, outer_attr_name, inner_tag, inner_attr, inner_attr_name): ''' BEAUTIFUL SOUP INIT ''' web=urllib2.urlopen(url) soup=BeautifulSoup(web,'html.parser',from_encoding='utf-8') ''' ***** CONTENT LIST *****...
Python
0.000001
7c1d67d6aa8810d166dcef4fec94fe258db9361c
Add harvester for "Enseignement supérieur et recherche".
etalabckanharvesters/data_enseignementsup_recherche.py
etalabckanharvesters/data_enseignementsup_recherche.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # Etalab-CKAN-Harvesters -- Harvesters for Etalab's CKAN # By: Emmanuel Raviart <emmanuel@raviart.com> # # Copyright (C) 2013 Etalab # http://github.com/etalab/etalab-ckan-harvesters # # This file is part of Etalab-CKAN-Harvesters. # # Etalab-CKAN-Harvesters is free soft...
Python
0
147a0815f21f807ac6a3e1c39c820e2b8364ad02
Tweak style.
script/libuv.py
script/libuv.py
#!/usr/bin/env python # Downloads and compiles libuv. from __future__ import print_function import os import os.path import platform import shutil import subprocess import sys LIB_UV_VERSION = "v1.6.1" LIB_UV_DIR = "build/libuv" def ensure_dir(dir): """Creates dir if not already there.""" if os.path.isdir(dir...
#!/usr/bin/env python # Downloads and compiles libuv. from __future__ import print_function import os import os.path import platform import shutil import subprocess import sys LIB_UV_VERSION = "v1.6.1" LIB_UV_DIR = "build/libuv" def ensure_dir(dir): """Creates dir if not already there.""" if os.path.isdir(dir...
Python
0
d2ed4e7a0d8edafa250044e8b9ecf319c14b85e0
add pkc.py
pkc.py
pkc.py
class PkcError(BaseException): pass class PkcTypeError(TypeError, PkcError): pass class PkcCertificateError(ValueError, PkcError): pass class PkcPublickeyError(ValueError, PkcError): pass def pkc_extract_publickey_from_certificate(certificate): if type(certificate) is bytes: return _pkc_...
Python
0.000308
3641160e055128c0d799926229959fef33ffa26e
use our own django style, width increased to flow nicely with default toolbar
ckeditor/widgets.py
ckeditor/widgets.py
from django import forms from django.conf import settings from django.core.urlresolvers import reverse from django.template.loader import render_to_string from django.utils.safestring import mark_safe from django.utils.html import conditional_escape from django.utils.encoding import force_unicode from django.utils impo...
from django import forms from django.conf import settings from django.core.urlresolvers import reverse from django.template.loader import render_to_string from django.utils.safestring import mark_safe from django.utils.html import conditional_escape from django.utils.encoding import force_unicode from django.utils impo...
Python
0
b716ae64ec574d741386b1dfc18c76e9bddec9a0
add closure example
closure.py
closure.py
""" %%closure cell magic for running the cell in a function, reducing pollution of the namespace %%forget does the same thing, but explicitly deletes new names, rather than wrapping the cell in a function. """ from IPython.utils.text import indent def closure(line, cell): """run the cell in a function, generatin...
Python
0.000001
7d28f97fb16684c58cf9e55bcca213e853741ca4
Create rmq.py
rmq.py
rmq.py
#!/usr/local/bin/python3 from sys import stdin from math import ceil, log from decimal import Decimal as d class RMQ(object): def __init__(self, numbers): self.e = [] n = len(numbers) if (n & (n-1))!=0: x = ceil(log(n, 2)) nn = 2**x; while n != nn: numbers.append(d('...
Python
0.000002
72678c437f1b1110fb8a14c78dcdd4c3c8b64157
Add initial version of bot script
rtm.py
rtm.py
import time from slackclient import SlackClient token = 'kekmao' sc = SlackClient(token) team_join_event = 'team_join' def send_welcome_message(user): user_id = user['id'] response = sc.api_call('im.open', user=user_id) try: dm_channel_id = response['channel']['id'] except (KeyError, ValueErr...
Python
0
49a8df22679489cc3174f02d5e771cacf60a434d
Create rtm.py
rtm.py
rtm.py
# -*- coding: utf-8 -*- """ @author: Adi Wijaya """ from __future__ import division import finite_difference as fd import numpy as np def rtm1d(v,seis,dt,dz): nt = len(seis) nx = len(v) a = fd.alpha(v,dt,dz) ul, u, up = np.zeros((3,nx)) data = np.zeros((nt,nx)) g = np.zeros(u.shape) g[0]...
Python
0.000001
4c499d366429f68ff29c7a2f93553b06f3697405
Add missing oslo/__init__.py
oslo/__init__.py
oslo/__init__.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Python
0.000007
c18bbb7cb752e6a4421b98c100f682f3c7c45882
Fix bug 1254581 - Exclude file upload view from zone middleware.
kuma/wiki/middleware.py
kuma/wiki/middleware.py
from django.http import HttpResponseRedirect from django.shortcuts import render from kuma.core.utils import urlparams from .exceptions import ReadOnlyException from .jobs import DocumentZoneURLRemapsJob class ReadOnlyMiddleware(object): """ Renders a 403.html page with a flag for a specific message. ""...
from django.http import HttpResponseRedirect from django.shortcuts import render from kuma.core.utils import urlparams from .exceptions import ReadOnlyException from .jobs import DocumentZoneURLRemapsJob class ReadOnlyMiddleware(object): """ Renders a 403.html page with a flag for a specific message. ""...
Python
0
5ee021af46f7b6420b5edeac38f5f34f675fa625
create basic crawler
crawler.py
crawler.py
# -*- coding:utf-8 -*- from urllib import request, parse, error from time import sleep import re, os start_tid = '2507213' # change initial url at here SEXINSEX_URLS_PREFIX = 'http://www.sexinsex.net/forum/' encoding = 'gbk' path = os.path.abspath('.') sleeptime = 0 def generate_url(tid,pid): return ''.join([SE...
Python
0.000005
5f3a665e4611ae8faf82fcfb2804a0fd9aa84d2b
Create majority_number_iii.py
lintcode/majority_number_iii/py/majority_number_iii.py
lintcode/majority_number_iii/py/majority_number_iii.py
class Solution: """ @param nums: A list of integers @param k: As described @return: The majority number """ def majorityNumber(self, nums, k): import collections ratio = 1.0 / k * len(nums) counter = collections.Counter(nums) for num in counter...
Python
0.999146
8be862467344b9cf45b567008f10face0ed3ebf3
Create zhconvert.py for Alpha 1.0.3
packages/zhconvert.py
packages/zhconvert.py
import requests _url = 'http://opencc.byvoid.com/convert/' def toTraditional(text): # if len(text) > 100: req = requests.post(_url, data={'text':text,'config':'s2t.json','precise':'0'}) return req.text # else: # result = '' # for segment in [text[i:i+1000] for i in range(0, len(text), ...
Python
0
22f550dd3499d7d063501a2940a716d42362f6bc
Add missing file.
migrations/versions/0031_add_manage_team_permission.py
migrations/versions/0031_add_manage_team_permission.py
"""empty message Revision ID: 0031_add_manage_team_permission Revises: 0030_add_template_permission Create Date: 2016-02-26 10:33:20.536362 """ # revision identifiers, used by Alembic. revision = '0031_add_manage_team_permission' down_revision = '0030_add_template_permission' import uuid from datetime import datetim...
Python
0.000001
e25a56331c386fc5478c812702ecc6de7ebf100a
Add script to run dynamorio coverage tool on log files.
scripts/slave/chromium/dynamorio_coverage.py
scripts/slave/chromium/dynamorio_coverage.py
#!/usr/bin/env python # Copyright 2013 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. """Script for creating coverage.info file with dynamorio bbcov2lcov binary. """ import glob import optparse import os import subproce...
Python
0.000001
f9d399fb9fa923c68581279085566ba479349903
test for api export endpoint
onadata/apps/api/tests/viewsets/test_export_viewset.py
onadata/apps/api/tests/viewsets/test_export_viewset.py
import os from django.test import RequestFactory from onadata.apps.api.viewsets.export_viewset import ExportViewSet from onadata.apps.main.tests.test_base import TestBase class TestDataViewSet(TestBase): def setUp(self): super(self.__class__, self).setUp() self._create_user_and_login() ...
Python
0.000001
890f2d61db6925eb9baba74421fecd1aba205c96
922. Sort Array By Parity II
LeetCode/SortArrayByParity2.py
LeetCode/SortArrayByParity2.py
""" given half of them are even and half are odd and internal order between odd and even indexes doesn't matter, we can scan odd and even indexes until we find a pair that need to be swapped and swap that. Under the assumptions everything can be put in place with swaps like that. """ class Solution: # in-place imp...
Python
0.999988
5a5900a5c0ab1e0ac41469770e3775faf482c21e
write TagField basic
tags/fields.py
tags/fields.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.db.models.fields import CharField from django.utils.translation import ugettext_lazy as _ from tags.models import Tag class TagField(CharField): def __init__(self, verbose_name=_(u'Tags'), max_length=4000, ...
Python
0.000004
11d2f5e649ef5c5aedec9723894cd29c1d4d81f4
Add missing migration
froide/document/migrations/0027_alter_document_content_hash.py
froide/document/migrations/0027_alter_document_content_hash.py
# Generated by Django 3.2.4 on 2021-07-07 20:08 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('document', '0026_auto_20210603_1617'), ] operations = [ migrations.AlterField( model_name='document', name='content_...
Python
0.0002
36e3cb292b24d5940efed635c49bf5bb62007edb
Create __init__.py
acupoints/__init__.py
acupoints/__init__.py
Python
0.000011
66a38d1dd6eb2030c576e83a3aec588dd76ab528
Add a script to import ward Places and set their parent constituency Place
mzalendo/core/management/commands/core_add_ward_places_2013.py
mzalendo/core/management/commands/core_add_ward_places_2013.py
#!/usr/bin/env python # This script requires the CSV version of # "/home/mark/Dropbox/Mzalendo/Final Constituencies and Wards Description.pdf" # (in Dropbox) which contains details of every ward of every # constituency, and will create Place objects for each ward, with the # appropriate parent constituency, in Mzalend...
Python
0
41631175c7aae124f7504f068d9c2f8cf1c9e617
Add exception to describe errors in configuration processing
plugins/configuration/configurationtype/configuration_error.py
plugins/configuration/configurationtype/configuration_error.py
#!/usr/bin/env python #-*- coding: utf-8 -*- #This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software. #The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif...
Python
0
39fe6bb60e24ac8ac6d9eea60f7dc5b42de25682
Create PyCompare.py
PyCompare.py
PyCompare.py
import os from bs4 import BeautifulSoup def getfiles(path1, path2): #Load files on root of path1 on files1 for root, dir, names in os.walk(path1): files1 = names break #Will break the for to read just the root folder #Load files on root of path2 on files2 for root, dir, names in os.walk(path2): files2 = n...
Python
0
a857273666cb616e1c019bedff81d3014070c896
increase Proofread of Henochbuch
scripts/online_scripts/150916_increase_proofread_Henochbuch.py
scripts/online_scripts/150916_increase_proofread_Henochbuch.py
# -*- coding: utf-8 -*- __author__ = 'eso' import sys sys.path.append('../../') from tools.catscan import CatScan import re import requests import pywikibot from pywikibot import proofreadpage site = pywikibot.Site() for i in range(455, 474): page = pywikibot.proofreadpage.ProofreadPage(site, 'Seite:Riessler Altj...
Python
0
1d75b7e0bd0c498b5ea2c32c4e98a278ca2aed1b
make sitelockdown generic
src/python/expedient/common/middleware/sitelockdown.py
src/python/expedient/common/middleware/sitelockdown.py
''' @author jnaous ''' from django.conf import settings from django.http import HttpResponseRedirect from utils import RegexMatcher class SiteLockDown(RegexMatcher): """ This middleware class will force almost every request coming from Django to be authenticated, or it will redirect the user to a login ...
Python
0
4f8fff9fb2da7bbdab68a0a4c02b51d00410e8c4
Add synthtool scripts (#3765)
java-automl/google-cloud-automl/synth.py
java-automl/google-cloud-automl/synth.py
# Copyright 2018 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
Python
0.000001
dacd4e66a367987a84ae13da4e1ad74a4113b25c
Create Congress.py
Congress.py
Congress.py
# # Author : John Dvorak # Contact : jcd3247@rit.edu # File : Congress.py # Usage : Senate parser & webcrawler # """ Contains Bill and Politician objects. A Bill represents a proposed bill from the U.S. Senate or House of Representatives, and a set of Politicians are created who cosponsor a giv...
Python
0.000001
3dd454f899f556d99ae2bc6947a21d04428f8496
Add the extraction for DCE signal normalized to accelerate the loading
pipeline/feature-extraction/dce/pipeline_extraction_dce.py
pipeline/feature-extraction/dce/pipeline_extraction_dce.py
""" This pipeline is used to resave the data from lemaitre-2016-nov for faster loading. """ import os import numpy as np from sklearn.externals import joblib from sklearn.preprocessing import label_binarize from protoclass.data_management import DCEModality from protoclass.data_management import GTModality from pr...
Python
0
c7987bde28992ef0ae8cae9fca500730b2fcea15
Add url rewriter for eztv
flexget/plugins/urlrewrite_eztv.py
flexget/plugins/urlrewrite_eztv.py
from __future__ import unicode_literals, division, absolute_import import re import logging from urlparse import urlparse, urlunparse from requests import RequestException from flexget import plugin from flexget.event import event from flexget.plugins.plugin_urlrewriting import UrlRewritingError from flexget.utils imp...
Python
0
c60b152573ccfe01997f3d970968180ac82af8ba
Add forgotten migration
bluebottle/funding_stripe/migrations/0014_auto_20190916_1645.py
bluebottle/funding_stripe/migrations/0014_auto_20190916_1645.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2019-09-16 14:45 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('funding_stripe', '0013_auto_20190913_1458'), ] operations = [ migrations.A...
Python
0.000004
7d6932a07caed84c424f62ab8d980fde7eddeaed
Create lc375.py
LeetCode/lc375.py
LeetCode/lc375.py
class Solution(object): def getMoneyAmount(self, n): """ :type n: int :rtype: int """ dp = [[0 for x in range(n+1)] for y in range(n+1)] for i in range(2,n+1): for x in range(n): if x + i > n: break dp[x]...
Python
0.000001
74d718b19ec49c0ca4c724533af1ec725003adef
remove emtry transtion of region
cities_light/management/commands/region_missing_translations.py
cities_light/management/commands/region_missing_translations.py
from django.core.management.base import BaseCommand class Command(BaseCommand): def handle(self, *args, **options): from cities_light import Region for item in Region.published.all(): if not item.translations.all(): obj = item.translate(item.default_language) ...
Python
0.001989
8578d221498eee26be8cbd27849ac9a4fbfc27a5
Create ethernetip-multi.py
ethernetip-multi.py
ethernetip-multi.py
require 'msf/core' class Metasploit3 < Msf::Auxiliary include Msf::Exploit::Remote::Tcp include Rex::Socket::Tcp def initialize(info={}) super(update_info(info, 'Name' => 'Allen-Bradley/Rockwell Automation EtherNet/IP CIP commands', 'Description' => %q{ The EtnerNet/IP CIP protocol allows a number of u...
Python
0.000825
b09bfaa7a9f9bed7f3d19176cd67b83031347872
Largest prime factor
p3.py
p3.py
# Find the largest prime factor of a positive (composite) number def prime_factors(n): factors = [] d = 2 while n > 1: while n % d == 0: factors.append(d) n /= d d = d + 1 return factors pfs = prime_factors(600851475143) largest_prime_factor = max(pfs) largest_...
Python
0.999936
1fff4fb083e2ac0dad8d8a3ac59fc68ef2939073
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
e20002febd14a2f6d31b43ee85d57bfa26c745e5
test game/board.py
yaranullin/game/tests/board.py
yaranullin/game/tests/board.py
# yaranullin/game/tests/board.py # # Copyright (c) 2012 Marco Scopesi <marco.scopesi@gmail.com> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE S...
Python
0
913610bafe6aa98f7b8c550ea2ee896b130310ec
Add VAE code
adhoc/vae.py
adhoc/vae.py
from tensorflow.examples.tutorials.mnist import input_data from keras.layers import Input, Dense, Lambda from keras.models import Model from keras.objectives import binary_crossentropy from keras.callbacks import LearningRateScheduler import numpy as np import matplotlib.pyplot as plt import keras.backend as K import ...
Python
0
d3f556b6d7da2c67fc9dcc6b7d73a0d1b76d278c
Add tests for valid recipes
tests/functional_tests/test_valid_recipes.py
tests/functional_tests/test_valid_recipes.py
import os import pytest from conda_verify import utils from conda_verify.exceptions import RecipeError from conda_verify.verify import Verify @pytest.fixture def recipe_dir(): return os.path.join(os.path.dirname(__file__), 'test-recipes') @pytest.fixture def verifier(): recipe_verifier = Verify() retu...
Python
0.000001
40f4bc4602da9f66c08a6ee7dcdb3af71e891441
Create Python1.py
Python1.py
Python1.py
#!/usr/bin/env python def main(): print('hello world') print '------------' main()
Python
0.999934
0209c363371b0f1a8b570deab4995e83a638222d
Write New Product tests
whats_fresh/whats_fresh_api/tests/views/entry/test_new_product.py
whats_fresh/whats_fresh_api/tests/views/entry/test_new_product.py
from django.test import TestCase from django.core.urlresolvers import reverse from whats_fresh_api.models import * from django.contrib.gis.db import models import json class NewProductTestCase(TestCase): """ Test that the New Product page works as expected. Things tested: URLs reverse correctly ...
Python
0.000226
1de7573b08274646d961e7a667ed48aff5ca2932
return export path from Rule.do_build()
peru/rule.py
peru/rule.py
import os import subprocess from .cache import compute_key from .error import PrintableError class Rule: def __init__(self, name, build_command, export): self.name = name self.build_command = build_command self.export = export def cache_key(self, resolver, input_tree): return...
import os import subprocess from .cache import compute_key from .error import PrintableError class Rule: def __init__(self, name, build_command, export): self.name = name self.build_command = build_command self.export = export def cache_key(self, resolver, input_tree): return...
Python
0
6713290528778b53076f2e278ea505d7be03928b
Add example python bindings using ctypes
examples/example.py
examples/example.py
#!/usr/bin/python from ctypes import * from time import sleep libShake = cdll.LoadLibrary('libshake.so') Shake_EffectType = c_int SHAKE_EFFECT_RUMBLE = Shake_EffectType(0) SHAKE_EFFECT_PERIODIC = Shake_EffectType(1) SHAKE_EFFECT_CONSTANT = Shake_EffectType(2) SHAKE_EFFECT_SPRING = Shake_EffectType(3) SHAKE_EFFECT_FRI...
Python
0
729bed3fd3e7bd3ecabda3ab25525019f3f83661
Add py-imageio for python3 (#8553)
var/spack/repos/builtin/packages/py-imageio/package.py
var/spack/repos/builtin/packages/py-imageio/package.py
############################################################################## # Copyright (c) 2013-2018, 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.000001
1cb2855054c40e6de7c6f9bf8efb7c8331009ca8
add new package (#24702)
var/spack/repos/builtin/packages/py-iso8601/package.py
var/spack/repos/builtin/packages/py-iso8601/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 PyIso8601(PythonPackage): """Simple module to parse ISO 8601 dates""" homepage = "htt...
Python
0
ace0f80344519a747a71e09faca46c05594dd0d9
Add examples/req_rep.py
examples/req_rep.py
examples/req_rep.py
#!env/bin/python """ Example txzmq client. examples/req_rep.py --method=connect --endpoint=ipc:///tmp/req_rep_sock --mode=req examples/req_rep.py --method=bind --endpoint=ipc:///tmp/req_rep_sock --mode=rep """ import os import socket import sys import time import zmq from optparse import OptionParser from t...
Python
0
9805f9a4e837f3897fc5146c4a9b4d89a0c3f913
Revert "deleted"
examples/steady2.py
examples/steady2.py
# -*- coding: utf-8 -*- """Storage selection (SAS) functions: example with two flux out at steady state Runs the rSAS model for a synthetic dataset with two flux in and out and steady state flow Theory is presented in: Harman, C. J. (2014), Time-variable transit time distributions and transport: Theory and applicatio...
Python
0
3513b039b90e4b16d94fedb3f9715918eaa3bc36
Test cookies
tests/test_tutorial/test_cookie_params/test_tutorial001.py
tests/test_tutorial/test_cookie_params/test_tutorial001.py
import sys import pytest from starlette.testclient import TestClient from cookie_params.tutorial001 import app client = TestClient(app) print(sys.path) openapi_schema = { "openapi": "3.0.2", "info": {"title": "Fast API", "version": "0.1.0"}, "paths": { "/items/": { "get": { ...
Python
0.000007
3ed611cebed6c9283b5668a7c237deae265fdd64
create fedex_cir_import.py
fedex_cir_import.py
fedex_cir_import.py
import os, pdb, psycopg2 print 'begin script - fedex_cir_import.py' path = '/usr/local/cirdata/' imported = '/usr/local/cirdata/imported/' phoenixDB = psycopg2.connect("dbname='database' user='user' host='host' password='password'") for file in os.listdir(path): current = os.path.join(path, file) if os...
Python
0
513df9e9ce48c7877244d5c9ad1dcf220d368386
Add findexposurehist to finde exposure dist for each country.
findexposurehist.py
findexposurehist.py
from __future__ import division import ConfigParser import csv import time import datetime import matplotlib; matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import scipy as sp import scipy.stats as spstats import exposure import util def main(): # Read config config = ConfigPa...
Python
0
539098d24cb671fe30543917928404a8de0f02e5
make video using ffmpeg
fisspy/makemovie.py
fisspy/makemovie.py
""" Makevideo Using the ffmpeg make a movie file from images """ from __future__ import absolute_import, division, print_function import numpy as np import subprocess as sp import platform from matplotlib.pyplot import imread from shutil import copy2 import os __author__="J. Kang: jhkang@astro.snu.ac.kr" __email__="j...
Python
0.000001
ef20713c0b4b7378fe91aae095258452d01e81ba
Create 1.py
basics/action/QWidgetAction/1.py
basics/action/QWidgetAction/1.py
class SelectionSetsView(QTableView): def _onContextMenu(self, widget, pos): menu = QtGui.QMenu() colorAction = menu.addAction("Edit Color") colorAction.triggered.connect(partial(self._editColor, widget, pos)) colorWidgetAction = QtGui.QWidgetAction(menu) cbg = ColoredButtonGr...
Python
0.000007
2e558cc09729d5e87d13ddea0f19a82dd7e7ac05
add file at company
Python_FunctionalProgramming.py
Python_FunctionalProgramming.py
#以下来自廖雪峰的Python学习之Python函数式编程 #我们首先要搞明白计算机(Computer)和计算(Compute)的概念。 #在计算机的层次上,CPU执行的是加减乘除的指令代码,以及各种条件判断和跳转指令,所以,汇编语言是最贴近计算机的语言。 #而计算则指数学意义上的计算,越是抽象的计算,离计算机硬件越远。 #对应到编程语言,就是越低级的语言,越贴近计算机,抽象程度低,执行效率高,比如C语言;越高级的语言,越贴近计算,抽象程度高,执行效率低,比如Lisp语言。 #高阶函数/////////////////////////////////// #变量可以指向函数 print('abs(-10) =', abs(-10...
Python
0