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
2c2d594b7d8d5d74732e30c46859779b88621baa
Create __init__.py
FireModules/__init__.py
FireModules/__init__.py
Python
0.000429
328274b6a938667326dbd435e7020c619cd80d3d
Add EmojiUtils.py
EmojiUtils.py
EmojiUtils.py
# coding=utf-8 # 2015-11-19 # yaoms # emoji 表情符号转义 """ emoji 表情 编码/解码 类 encode_string_emoji(string) decode_string_emoji(string) """ import re def __is_normal_char(c): """ 判断字符是不是普通字符, 非普通字符, 认定为 emoji 字符 :param c: :return: 普通字符 True, Emoji 字符 False """ i = ord(c) return ( i...
Python
0.000002
54a10f78a6c71d88e1c2441bb636e6b636f74613
add unit test
rstem/led2/test_unittest.py
rstem/led2/test_unittest.py
#!/usr/bin/python3 import unittest import os from rstem import led2 # TODO: single setup for all testcases???? # TODO: make hardware versions that you can optionally skip if __name__ == '__main__': unittest.main() def query(question): ret = int(input(question + " [yes=1,no=0]: ")) if ret == 1: ...
Python
0.000001
f0587e44be1c7f85dbbf54e1d6c47458a4960d7c
Create date_time.py
date_time.py
date_time.py
#!/usr/bin/env python # -*_ coding: utf-8 -*- import datetime import sys def main(): now = datetime.datetime.now() while True: user_request = input("\nCurrent [time, day, date]: ") if user_request == "quit": sys.exit() if user_request == "time": second = str...
Python
0.000939
c15f8805d3ce5eab9f46dc24a6845ce27b117ac3
Add TeamTest
dbaas/account/tests/test_team.py
dbaas/account/tests/test_team.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django.test import TestCase from django.db import IntegrityError from . import factory from ..models import Team from drivers import base import logging LOG = logging.getLogger(__name__) class TeamTest(TestCase): def setUp(sel...
Python
0
264863c1a8d60dd35babec22470626d13ebf3e66
Remove unused import.t
debug_toolbar/panels/__init__.py
debug_toolbar/panels/__init__.py
from __future__ import absolute_import, unicode_literals import warnings from django.template.loader import render_to_string class Panel(object): """ Base class for panels. """ # name = 'Base' # template = 'debug_toolbar/panels/base.html' # If content returns something, set to True in subcl...
from __future__ import absolute_import, unicode_literals import warnings from django.template.defaultfilters import slugify from django.template.loader import render_to_string class Panel(object): """ Base class for panels. """ # name = 'Base' # template = 'debug_toolbar/panels/base.html' #...
Python
0
4bfd69bc49b17e7844077949560bd6259ea33e9b
test the root scrubadub api
tests/test_api.py
tests/test_api.py
import unittest import scrubadub class APITestCase(unittest.TestCase): def test_clean(self): """Test the top level clean api""" self.assertEqual( scrubadub.clean("This is a test message for example@exampe.com"), "This is a test message for {{EMAIL}}", ) def te...
Python
0.000007
cd906789b4ed339542722c04dd09f8aca04fd7ff
add missing revision
crowdsourcing/migrations/0170_task_price.py
crowdsourcing/migrations/0170_task_price.py
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2017-05-24 00:15 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('crowdsourcing', '0169_auto_20170524_0002'), ] operations = [ migrations.AddFie...
Python
0.000004
369dff642883ded68eca98754ce81369634da94d
Add box tests
tests/test_box.py
tests/test_box.py
import pytest from rich.box import ASCII, DOUBLE, ROUNDED, HEAVY def test_str(): assert str(ASCII) == "+--+\n| ||\n|-+|\n| ||\n|-+|\n|-+|\n| ||\n+--+\n" def test_repr(): assert repr(ASCII) == "Box(...)" def test_get_top(): top = HEAVY.get_top(widths=[1, 2]) assert top == "┏━┳━━┓" def test_get_r...
Python
0.000001
dbaad481ab9ddbdccd4430765e3eee0d0433fbd8
Create doc_check.py
doc_check.py
doc_check.py
import requests,json,ctypes,time tasks = [ # speciality_id, clinic_id, name '' - for any name, description (40,279,'','Невролог'), (2122,314,'Гусаров','Дерматолог'), ] h = { 'Host': 'gorzdrav.spb.ru', 'Connection': 'keep-alive', 'Accept': '*/*', 'X-Requested-With': 'XMLHttpRequest', 'User-Agent':...
Python
0.000001
8eec6e7596e8a5bd8159753be2aeaaffb53f613b
Add Python version
Python/shorturl.py
Python/shorturl.py
class ShortURL: """ ShortURL: Bijective conversion between natural numbers (IDs) and short strings ShortURL.encode() takes an ID and turns it into a short string ShortURL.decode() takes a short string and turns it into an ID Features: + large alphabet (51 chars) and thus very short resulting strings + proof ag...
Python
0.000023
7a5ca2f63dab36664ace637b713d7772870a800a
Create make-fingerprint.py
make-fingerprint.py
make-fingerprint.py
Python
0.000102
cd7187dc916ebbd49a324f1f43b24fbb44e9c9dc
Create afstand_sensor.py
afstand_sensor.py
afstand_sensor.py
import gpiozero from time import sleep sensor = gpiozero.DistanceSensor(echo=18,trigger=17,max_distance=2, threshold_distance=0.5) led = gpiozero.LED(22) while True: afstand = round(sensor.distance*100) print('obstakel op', afstand, 'cm') if sensor.in_range: led.on() sleep(1) led.off()
Python
0.000011
f1bda6deeb97c50a5606bea59d1684d6d96b10b4
Create api_call.py
PYTHON/api_call.py
PYTHON/api_call.py
def product_import_tme(request): # /product/product_import_tme/ token = '<your's token(Anonymous key:)>' app_secret = '<Application secret>' params = { 'SymbolList[0]': '1N4007', 'Country': 'PL', 'Currency': 'PLN', 'Language': 'PL', } response = api_call('Produ...
Python
0.000002
1166ef7520ee26836402f028cb52ed95db7173e6
Add CTC_new_refund_limited_all_payroll migration file
webapp/apps/taxbrain/migrations/0058_taxsaveinputs_ctc_new_refund_limited_all_payroll.py
webapp/apps/taxbrain/migrations/0058_taxsaveinputs_ctc_new_refund_limited_all_payroll.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('taxbrain', '0057_jsonreformtaxcalculator_errors_warnings_text'), ] operations = [ migrations.AddField( model_nam...
Python
0
fc1a9b7870f4d7e789c3968df6ddda698a7c4d62
update to search all the TEMPLATES configurations
django_extensions/compat.py
django_extensions/compat.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from io import BytesIO import csv import six import codecs import importlib import django from django.conf import settings # # Django compatibility # def load_tag_library(libname): """Load a templatetag library on multiple Django versions. Re...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from io import BytesIO import csv import six import codecs import importlib import django from django.conf import settings # # Django compatibility # def load_tag_library(libname): """Load a templatetag library on multiple Django versions. Re...
Python
0
55d9610f519713b889ffb68daa3c72ef6c349d3d
Add ExportPPMs.py script.
TrueType/ExportPPMs.py
TrueType/ExportPPMs.py
#FLM: Export PPMs """ This script will write (or overwrite) a 'ppms' file in the same directory as the opened VFB file. This 'ppms' file contains the TrueType stem values and the ppm values at which the pixel jumps occur. These values can later be edited as the 'ppms' file is used as part of the conversion process....
Python
0
5aff575cec6ddb10cba2e52ab841ec2197a0e172
Add SignalTimeout context manager
Utils/SignalTimeout.py
Utils/SignalTimeout.py
# Taken from https://gist.github.com/ekimekim/b01158dc36c6e2155046684511595d57 import os import signal import subprocess class Timeout(Exception): """This is raised when a timeout occurs""" class SignalTimeout(object): """Context manager that raises a Timeout if the inner block takes too long. Will even...
Python
0.000001
58020c2c207e02525d310a43af39e1282538957b
add new metric classes
mfr/core/metrics.py
mfr/core/metrics.py
import copy def _merge_dicts(a, b, path=None): """"merges b into a Taken from: http://stackoverflow.com/a/7205107 """ if path is None: path = [] for key in b: if key in a: if isinstance(a[key], dict) and isinstance(b[key], dict): _merge_dicts(a[key], b[...
Python
0
e18ee4aacd42ec28b2d54437f61d592b1cfaf594
Create national_user_data_pull.py
custom/icds_reports/management/commands/national_user_data_pull.py
custom/icds_reports/management/commands/national_user_data_pull.py
import csv from django.core.management.base import BaseCommand from corehq.apps.reports.util import get_all_users_by_domain from custom.icds_reports.const import INDIA_TIMEZONE from custom.icds_reports.models import ICDSAuditEntryRecord from django.db.models import Max class Command(BaseCommand): help = "Custom ...
Python
0.000125
0f983464451e828eff1f99859bc4334536e2d131
add solarized theme for code snippets
docs/source/_themes/solarized.py
docs/source/_themes/solarized.py
# -*- coding: utf-8 -*- """ pygments.styles.solarized.light ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The Solarized style, inspired by Schoonover. :copyright: Copyright 2012 by the Shoji KUMAGAI, see AUTHORS. :license: MIT, see LICENSE for details. """ from pygments.style import Style from pygments.token i...
Python
0
ed157602d965be952aadc9fe33b2e517c7f98ccf
Add urls
dumpling/urls.py
dumpling/urls.py
from django.conf.urls import include, url from . import views urlpatterns = [ url(r'css/(?P<name>.*)\.css$', views.styles, name='styles'), url(r'(?P<path>.*)', views.PageView.as_view()), ]
Python
0.000013
380178c585d4b9e2689ffdd72c9fa80be94fe3a9
add more calculation
examples/ingap_gaas_radeta_paper.py
examples/ingap_gaas_radeta_paper.py
__author__ = 'kanhua' import numpy as np from scipy.interpolate import interp2d import matplotlib.pyplot as plt from scipy.io import savemat from iii_v_si import calc_2j_si_eta, calc_3j_si_eta if __name__=="__main__": algaas_top_ere=np.logspace(-7,0,num=50) algaas_mid_ere=np.logspace(-7,0,num=50) eta_a...
Python
0
93b38901b25f6c5db4700343050c5bb2fc6ef7e6
add utility to make digraph out of router
emit/graphviz.py
emit/graphviz.py
def make_digraph(router, name='router'): header = 'digraph %s {\n' % name footer = '\n}' lines = [] for origin, destinations in router.routes.items(): for destination in destinations: lines.append('"%s" -> "%s";' % (origin, destination)) return header + '\n'.join(lines) + foote...
Python
0
c16620dffd2cd6396eb6b7db76a9c29849a16500
Add support for cheminformatics descriptors
components/lie_structures/lie_structures/cheminfo_descriptors.py
components/lie_structures/lie_structures/cheminfo_descriptors.py
# -*- coding: utf-8 -*- """ file: cheminfo_molhandle.py Cinfony driven cheminformatics fingerprint functions """ import logging from twisted.logger import Logger from . import toolkits logging = Logger() def available_descriptors(): """ List available molecular descriptors for all active cheminformatics...
Python
0
718b8dcb87ae2b78e5ce0aded0504a81d599daf7
Create envToFish.py
envToFish.py
envToFish.py
#!/usr/bin/env python import os import subprocess badKeys = ['HOME', 'PWD', 'USER', '_', 'OLDPWD'] with open('profile.fish', 'w') as f: for key, val in os.environ.items(): if key in badKeys: continue if key == 'PATH': f.write("set -e PATH\n") pathUnique = set(va...
Python
0
01328db808d3f5f1f9df55117ef70924fb615a6a
Create config reader
escpos/config.py
escpos/config.py
from __future__ import absolute_import import os import appdirs from localconfig import config from . import printer from .exceptions import * class Config(object): _app_name = 'python-escpos' _config_file = 'config.ini' def __init__(self): self._has_loaded = False self._printer = None ...
Python
0.000001
0f43f3bdc9b22e84da51e490664aeedc4295c8c9
Add test for ELB
tests/test_elb.py
tests/test_elb.py
# -*- coding: utf-8 -*- from jungle import cli def test_elb_ls(runner, elb): """test for elb ls""" result = runner.invoke(cli.cli, ['elb', 'ls']) assert result.exit_code == 0 def test_elb_ls_with_l(runner, elb): """test for elb ls -l""" result = runner.invoke(cli.cli, ['elb', 'ls', '-l']) as...
Python
0.000001
c1bf53c5c278cafa3b1c070f8a232d5820dcb7a4
add elb list test.
tests/test_elb.py
tests/test_elb.py
from __future__ import (absolute_import, print_function, unicode_literals) from acli.output.elb import (output_elb_info, output_elbs) from acli.services.elb import (elb_info, elb_list) from acli.config import Config from moto import mock_elb import pytest from boto3.session import Session session = Session(region_name=...
Python
0
ee3e04d32e39d6ac7ef4ac7abc2363a1ac9b8917
Add an example for the music module
example_music.py
example_music.py
from screenfactory import create_screen from modules.music import Music import config import time import pygame screen = create_screen() music = Music(screen) music.start() while True: if config.virtual_hardware: pygame.time.wait(10) for event in pygame.event.get(): pass else: time.sleep(0.01)
Python
0.000002
9be3bf6d71c54fe95db08c6bc1cd969dfbb2ebd1
Add Dia generated .py file
doc/StationMeteo.Diagram.py
doc/StationMeteo.Diagram.py
class Station : def __init__(self) : self.ser = SerialInput() # self.parser = InputParser() # self.datab = DatabManager() # self.input = None # str self.sensor_dict = dict('id': ,'name': ) # self.last_meterings_list = LastMeteringList() # pass def __get_serial_input_content (self, ser) : # return...
Python
0
54718d95c4398d816546b45ed3f6a1faf2cdace8
add modules/flexins/nsversion.py
modules/flexins/nsversion.py
modules/flexins/nsversion.py
"""Analysis and Check the FlexiNS software version. """ import re from libs.checker import ResultInfo,CheckStatus from libs.log_spliter import LogSpliter,LOG_TYPE_FLEXI_NS from libs.tools import read_cmdblock_from_log ## Mandatory variables ##-------------------------------------------- module_id = 'fnsbase.01' tag ...
Python
0
8cb94efa41e5350fccdc606f4959f958fc309017
Add lldb debug visualizer
tools/rlm_lldb.py
tools/rlm_lldb.py
############################################################################## # # Copyright 2014 Realm Inc. # # 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/...
Python
0
ec41564bb99c8e79bcee1baabd75d2282601415c
add refund
shopify/resources/refund.py
shopify/resources/refund.py
from ..base import ShopifyResource class Refund(ShopifyResource): _prefix_source = "/admin/orders/$order_id/"
Python
0
e7247c8c70a8cfefaee057e0c731aa5dab41ca9a
Create Contours.py
Contours.py
Contours.py
from PIL import Image from pylab import * #read image into an array im = array(Image.open('s9.jpg').convert('L')) #create a new figure figure() #don't use colors gray() #show contours contour(im,origin = 'image') axis('equal') axis('off') figure() hist(im.flatten(),128) show()
Python
0
9315c59746e2be9f2f15ff2bae02e1b481e9a946
Create mr.py
mr.py
mr.py
Mapper: #!/usr/bin/python import sys while 1: line = sys.stdin.readline() if line == "": break fields = line.split(",") year = fields[1] runs = fields[8] if year == "1956": print runs Reducer: #!/usr/bin/python import sys total_count = 0 for line in sys.stdin: try: ...
Python
0.000004
c91e231c8d71458a7c347088ad7ec6431df234d7
add ss.py to update proxy automatically
ss.py
ss.py
# -*- coding:utf8 -*- import urllib2 response = urllib2.urlopen("http://boafanx.tabboa.com/boafanx-ss/") html = response.read() print(html[:20000])
Python
0
4015a16ec32660d25646f62772876d53166f46f2
Add files via upload
PEP.py
PEP.py
#-*- coding: utf-8 -*- from optparse import OptionParser import genLabelData,genUnlabelData,mainEdit,genVecs import os.path def parse_args(): parser = OptionParser(usage="RNA editing prediction", add_help_option=False) parser.add_option("-f", "--feature", default="300", help="Set the number of features of Word2Vec...
Python
0
8016dbc50238d2baf5f89c191ec3355df63af1a2
Implement basic flask app to add subscribers
app.py
app.py
import iss from flask import Flask, request, render_template app = Flask(__name__) @app.route('/', methods=['GET']) def index(): return render_template() @app.route('/subscribe', methods=['POST']) def subscribe(): number = request.form['number'] lat = request.form['latitude'] lon = request.form['...
Python
0.000001
6d8da9ec6a0dba1c5b61ea88de6a808f36d4f271
Add Aruba device tracker
homeassistant/components/device_tracker/aruba.py
homeassistant/components/device_tracker/aruba.py
""" homeassistant.components.device_tracker.aruba ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Device tracker platform that supports scanning a Aruba Access Point for device presence. This device tracker needs telnet to be enabled on the router. Configuration: To use the Aruba tracker you will need to add something...
Python
0
341890bfff2d8a831e48ebb659ce7f31d4918773
Update utils.py
tendrl/commons/central_store/utils.py
tendrl/commons/central_store/utils.py
from tendrl.commons.etcdobj import fields def to_etcdobj(cls_etcd, obj): for attr, value in vars(obj).iteritems(): if attr.startswith("_"): continue if attr in ["attrs", "enabled", "obj_list", "obj_value", "atoms", "flows"]: continue setattr(cls_etcd, attr, to_etcd_...
from tendrl.commons.etcdobj import fields def to_etcdobj(cls_etcd, obj): for attr, value in vars(obj).iteritems(): if not attr.startswith("_"): setattr(cls_etcd, attr, to_etcd_field(attr, value)) return cls_etcd def to_etcd_field(name, value): type_to_etcd_fields_map = {dict: fields....
Python
0.000001
9d41eba840f954595a5cebbacaf56846cd52c1f4
add new file
functions.py
functions.py
def add(a,b):
Python
0.000006
3000a9c0b7213a3aeb9faa0c01e5b779b2db36d4
add a noisy bezier example (todo: should noise be part of the animation, or stay out of it?)
examples/example_bezier_noise.py
examples/example_bezier_noise.py
if __name__ == "__main__": import gizeh import moviepy.editor as mpy from vectortween.BezierCurveAnimation import BezierCurveAnimation from vectortween.SequentialAnimation import SequentialAnimation import noise def random_color(): import random return (random.uniform(0, 1) fo...
Python
0
05c7d62e0e26000440e72d0700c9806d7a409744
Add migrations for game change suggestions
games/migrations/0023_auto_20171104_2246.py
games/migrations/0023_auto_20171104_2246.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2017-11-04 21:46 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('games', '0022_installer_reason'), ] operations = [...
Python
0
ad073b043b2965fb6a1939682aeca8ac90259210
add daily import to database
daily.py
daily.py
import datetime import httplib import urllib import redis import json from datetime import timedelta #now = datetime.datetime.now(); #today = now.strftime('%Y-%m-%d') #print today rdb = redis.Redis('localhost') def isfloat(value): try: float(value) return True except ValueError: return False def convfloat(v...
Python
0
09d51aef1127b55fdc6bf595ca85285d9d7d64d1
Add wrapwrite utility method
gignore/utils.py
gignore/utils.py
import sys def wrapwrite(text): """ :type text: str :rtype: str """ text = text.encode('utf-8') try: # Python3 sys.stdout.buffer.write(text) except AttributeError: sys.stdout.write(text)
Python
0.000001
eebaea9bb57fa276207775612d669b5af61b3c86
Add some work
gen.py
gen.py
#! /usr/bin/python3 import xml.etree.ElementTree as ET from copy import deepcopy def print_comment(s, multiline=False): if not multiline: print('/*', s.strip(), '*/') return print('/*') for line in s.splitlines(): print(' *', line.strip()) print(' */') def objc_case(name, firs...
Python
0.000109
617a44bcce3e6e19383065f7fcab5b44ceb82714
add logger
log.py
log.py
import logging import sys logger = logging.getLogger('micro-meta') logger.setLevel(logging.DEBUG) fh = logging.StreamHandler(sys.stdout) fh.setLevel(logging.DEBUG) logger.addHandler(fh) logger.debug('test') logger.info('test')
Python
0.000026
a38b313799b7c0cdc25ff68161c2b2890db8e16d
Create log.py
log.py
log.py
import glob import pandas as pd logs = [log for log in glob.glob("*.log")] dataset = {"id": [], "pos": [], "affinity (kcal/mol)": [], "rmsd l.b.": [], "rmsd u.b.": []} for log in logs: with open(log) as dock: for line in dock.readlines(): if line.st...
Python
0.000002
7263d7546aec62834fa19f20854522eba4916159
add simple http server
run.py
run.py
import sys import BaseHTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler HandlerClass = SimpleHTTPRequestHandler ServerClass = BaseHTTPServer.HTTPServer Protocol = "HTTP/1.0" if sys.argv[1:]: port = int(sys.argv[1]) else: port = 8000 server_address = ('127.0.0.1', port) HandlerClass.proto...
Python
0
e6d420296b3f2234382bdcdf1122abc59af148ed
add plot function for classification
mousestyles/visualization/plot_classification.py
mousestyles/visualization/plot_classification.py
import numpy as np import pandas as pd import matplotlib.pyplot as plt def plot_performance(model): """ Plots the performance of classification model.It is a side-by-side barplot. For each strain, it plots the precision, recall and F-1 measure. Parameters ---------- model: string ...
Python
0.000009
a1ec669f4c494709dc9b8f3e47ff4f84b189b2e9
add get_workflow_name.py
.circleci/get_workflow_name.py
.circleci/get_workflow_name.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.000002
3abf7e60d3bd028f86cb6aa2e1e1f3d4fff95353
Create BinaryTreeMaxPathSum_001.py
leetcode/124-Binary-Tree-Maximum-Path-Sum/BinaryTreeMaxPathSum_001.py
leetcode/124-Binary-Tree-Maximum-Path-Sum/BinaryTreeMaxPathSum_001.py
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def maxPathSum(self, root): """ :type root: TreeNode :rtype: int """ totMax, bran...
Python
0.000023
59fd4bf04c8c89cdc87673de94788c5d34d4e5fe
Create Goldbach.py
Goldbach.py
Goldbach.py
import math #Funcion para saber si un numero es 3 o no def es_primo(a): contador = 0 verificar= False for i in range(1,a+1): if (a% i)==0: contador = contador + 1 if contador >= 3: verificar=True break if contador==2 or verificar==False: return True return False #Creacion ...
Python
0
e33774beb2f2b1264f654605294f0ad837fa7e8b
Add message_link function
utils/backends.py
utils/backends.py
""" Handle backend specific implementations. """ def message_link(bot, msg): """ :param bot: Plugin instance. :param msg: Message object. :returns: Message link. """ backend = bot.bot_config.BACKEND.lower() if backend == 'gitter': return 'https://gitter.im/{uri}?at={idd}'.format(m...
Python
0.000001
f509d556cc4a20b55be52f505fcee200c5d44ef2
add rehex util
scripts/rehex.py
scripts/rehex.py
import simplejson import binascii import sys import pdb from pprint import pprint import sys, os sys.path.append( os.path.join( os.path.dirname(__file__), '..' ) ) sys.path.append( os.path.join( os.path.dirname(__file__), '..', 'lib' ) ) import dashlib # =================================================================...
Python
0.000001
ab67a0c86a473c5d30da2c127d661b2f91483d22
add missing files for quota
nova/tests/quota_unittest.py
nova/tests/quota_unittest.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compli...
Python
0.000001
cf881dd1ba8c98dd116f2269bf0cfd38f14a7b40
add a reel OVSFtree
OVSFTree.py
OVSFTree.py
import math numberOfMobile=512 class Node: def __init__(self, val): self.l = None self.r = None self.v = val class Tree: def __init__(self): self.root = None self.root=Node(1) thislevel = [self.root] for i in range(0,math.ceil(math.log(numberOfMobile,2)))...
Python
0.000001
632c4dffe8a217ca07410d0a353455a4c6142d39
Solve problem 29
problem029.py
problem029.py
#!/usr/bin/env python3 print(len(set(a**b for a in range(2, 101) for b in range(2, 101))))
Python
0.99998
b1815075ac1a1697c99a6293c8cc7719060ab9b2
Add cpuspeed sensor
homeassistant/components/sensor/cpuspeed.py
homeassistant/components/sensor/cpuspeed.py
""" homeassistant.components.sensor.cpuspeed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Shows the current CPU speed. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.cpuspeed.html """ import logging from homeassistant.helpers.entity import Entity RE...
Python
0.000001
43605bd5340374a3a62e91cf544b2ba16edb320e
Add a tf-serving example for KerasBERT.
official/nlp/bert/serving.py
official/nlp/bert/serving.py
# Lint as: python3 # Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
Python
0.999998
abd41ea78f2962f0b8b7166f0540727538d56471
ajoute la state get_object
sara_flexbe_states/src/sara_flexbe_states/Wonderland_Get_Object.py
sara_flexbe_states/src/sara_flexbe_states/Wonderland_Get_Object.py
#!/usr/bin/env python # encoding=utf8 from flexbe_core import EventState, Logger import requests import json from geometry_msgs.msg import Pose, Point from tf.transformations import quaternion_from_euler class GetObject(EventState): ''' Get an ># id int id of the object ># name string ...
Python
0.000001
272031cfbef13a5a3edbf3cf3c6fe5f00608d650
add test for importcuedmembers command
edpcmentoring/cuedmembers/tests/test_managementcommands.py
edpcmentoring/cuedmembers/tests/test_managementcommands.py
import os import shutil import tempfile from django.core.management import call_command from django.test import TestCase from ..models import Member class TemporaryDirectoryTestCase(TestCase): """A TestCase which creates a temporary directory for each test whose path is available as the "tmpdir" attribute. ...
Python
0.000001
0ba15652a5624cf8fa42f4caf603d84c09a0698b
Add kata: 6 kyu
6_kyu/Decode_the_Morse_code.py
6_kyu/Decode_the_Morse_code.py
# @see: https://www.codewars.com/kata/decode-the-morse-code def decodeMorse(morseCode): return ' '.join( map(lambda m_word: ''.join( map(lambda m_symbol: MORSE_CODE[m_symbol], m_word.split())), morseCode.strip().split(' ')))
Python
0.999999
6837bbf2a1816d97b6c517bcb244aa51cf1eb7ba
Create robots_txt.py
robots_txt.py
robots_txt.py
import urlib.request import io def ger_robots_txt(url): if url.endswith('/') path = url else: path - url + '/' # https://reddit.com/
Python
0.000064
b36192eec53664f9178bfc4000d89b8ca9be1544
Add merge migration
osf/migrations/0030_merge.py
osf/migrations/0030_merge.py
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2017-01-24 18:57 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('osf', '0029_merge'), ('osf', '0029_externalaccount_date_last_refreshed'), ] operations...
Python
0
6abf2f993813142ea685bc48a7a5a266d1905f1a
build indices qsub for bowtie or star with rsem
rsem_build.py
rsem_build.py
#/usr/bin/env python import commands import os from subprocess import call def write_file(filename, contents): """Write the given contents to a text file. ARGUMENTS filename (string) - name of the file to write to, creating if it doesn't exist contents (string) - contents of the file to be written """ # Open th...
Python
0
db41bce3d90cfada9916baa8f9267cd9e6160a94
Add an example for opening a file.
examples/open_file.py
examples/open_file.py
import numpy as np import pyh5md f = pyh5md.H5MD_File('poc.h5', 'r') at = f.trajectory('atoms') at_pos = at.data('position') r = at_pos.v.value print r f.f.close()
Python
0
2cd57876c72d5c941bcb1ae497df48dbbc943ba9
Create new package. (#6213)
var/spack/repos/builtin/packages/r-forecast/package.py
var/spack/repos/builtin/packages/r-forecast/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
c192042bbaf9060ce3a76f1cbabc5f380fa4bfd6
Adding uppercase character
src/Character.py
src/Character.py
import pygame from sprite import * from constants import * class Character: def __init__(self): self.sprite = Sprite('../resources/char.png') self.health = 10 self.speed = 40 def move(self, direction): #pos = self.sprite.getPosition() charWidth = self.sprite.rect.width charHeight = self.sprite.rect.heig...
Python
0.999723
10eb703867fd10df543a141837c2a57d1052ba2c
Rename file with correct pattern
ideascube/conf/kb_civ_babylab.py
ideascube/conf/kb_civ_babylab.py
# -*- coding: utf-8 -*- """KoomBook conf""" from .kb import * # noqa from django.utils.translation import ugettext_lazy as _ LANGUAGE_CODE = 'fr' IDEASCUBE_NAME = 'BabyLab' HOME_CARDS = STAFF_HOME_CARDS + [ { 'id': 'blog', }, { 'id': 'mediacenter', }, { 'id': 'bsfcampus', ...
Python
0.000001
f31fcd789254f95b311f4fa4009a04ad919c2027
add url update migration
accelerator/migrations/0049_update_fluent_redirect_url.py
accelerator/migrations/0049_update_fluent_redirect_url.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.18 on 2019-04-11 11:35 from __future__ import unicode_literals from django.db import migrations from accelerator.sitetree_navigation.sub_navigation import ( create_directory_subnav, create_events_subnav, create_home_subnav, create_judging_subnav, ...
Python
0.000001
f21ff91cb3c70a150eca68dc03c51577ff343f18
Solve challenge 8
Challenges/chall_8.py
Challenges/chall_8.py
#!/Applications/anaconda/envs/Python3/bin # Python challenge - 8 # http://www.pythonchallenge.com/pc/def/integrity.html # http://www.pythonchallenge.com/pc/return/good.html import bz2 def main(): ''' Hint: Where is the missing link? <area shape="poly" coords="179,284,214,311,255,320,281,226,319,224,363,30...
Python
0.004408
96ba88c74a77f3b71ef4a8b51c29013d16e23973
Create tofu/plugins/MISTRAL/Inputs with empty __init__.py
tofu/plugins/MISTRAL/Inputs/__init__.py
tofu/plugins/MISTRAL/Inputs/__init__.py
Python
0.000017
87a717b76ccc4ba36c394fafa4a8bc89ef6dca4b
Add 'series' tests
git_pw/tests/test_series.py
git_pw/tests/test_series.py
import unittest from click.testing import CliRunner as CLIRunner import mock from git_pw import series @mock.patch('git_pw.api.detail') @mock.patch('git_pw.api.download') @mock.patch('git_pw.utils.git_am') class ApplyTestCase(unittest.TestCase): def test_apply_without_args(self, mock_git_am, mock_download, moc...
Python
0.000014
35317e778b2fe1d238e21954df1eac0c5380b00b
Add corpus fetch from database
generate_horoscope.py
generate_horoscope.py
#!/usr/bin/env python3 # encoding: utf-8 import argparse import sqlite3 import sys """generate_horoscope.py: Generates horoscopes based provided corpuses""" __author__ = "Project Zodiacy" __copyright__ = "Copyright 2015, Project Zodiacy" _parser = argparse.ArgumentParser(description="Awesome SQLite importer") _pars...
Python
0
0b03dd638dd5ac3358d89a5538c707d5412b84ae
Add basic network broker state machine
broker/network.py
broker/network.py
from hypothesis.stateful import GenericStateMachine class NetworkBroker(GenericStateMachine): """ Broker to coordinate network traffic nodes = A map of node ids to node objects. network = An adjacency list of what nodes can talk to each other. If a is in network[b] than b -> a communcation is ...
Python
0
3ab61b1e9cc155868108e658ad7e87fac9569e10
add run script for bulk loader.
loader/loader.py
loader/loader.py
#!/usr/bin/python import os, sys, urllib2, urllib def cleanup(args): cmd = "hadoop fs -rm -r /tmp/%s" % args["htable_name"] print cmd ret = os.system(cmd) print cmd, "return", ret return ret def hfile(args): cmd = """spark-submit --class "subscriber.TransferToHFile" \ --name "TransferToHFile@shon" \ --conf "s...
Python
0
c48be39a1f04af887349ef7f19ecea4312425cf9
initialize for production
shoppley.com/shoppley/apps/offer/management/commands/initialize.py
shoppley.com/shoppley/apps/offer/management/commands/initialize.py
from django.core.management.base import NoArgsCommand from shoppleyuser.models import Country, Region, City, ZipCode, ShoppleyUser import os, csv from googlevoice import Voice FILE_ROOT = os.path.abspath(os.path.dirname(__file__)) class Command(NoArgsCommand): def handle_noargs(self, **options): f = open(FILE_ROOT...
Python
0.000001
00f3e74387fc7a215af6377cb90555d142b81d74
Add acoustics module with class AcousticMaterial.
pyfds/acoustics.py
pyfds/acoustics.py
class AcousticMaterial: """Class for specification of acoustic material parameters.""" def __init__(self, sound_velocity, density, shear_viscosity=0, bulk_viscosity=0, thermal_conductivity=0, isobaric_heat_cap=1, isochoric_heat_cap=1): """Default values for optional pa...
Python
0
75ffc049d021e88fed37dc009376761661452cbe
Add unit tests for heat.scaling.template
heat/tests/test_scaling_template.py
heat/tests/test_scaling_template.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.000015
3d8ef3b0f31575354f03583a5f053fad6838084d
add `YouCompleteMe` config file.
.ycm_extra_conf.py
.ycm_extra_conf.py
import os import ycm_core # These are the compilation flags that will be used in case there's no # compilation database set (by default, one is not set). # CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. flags = [ '-Wall', '-Wextra', '-Werror', '-Wno-long-long', '-Wno-variadic-macros', '-f...
Python
0
3e723f3419468654c9606b27d2127c94054b4bed
Add YouCompleteMe config for vim autocompletion
.ycm_extra_conf.py
.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
60e65d31c943f63e646b39350f18e6d177fbb66b
Add okupy.common.test_helpets.set_request
okupy/common/test_helpers.py
okupy/common/test_helpers.py
# vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python from django.contrib.auth.models import AnonymousUser from django.contrib.messages.middleware import MessageMiddleware from django.contrib.sessions.middleware import SessionMiddleware from django.contrib.messages.storage.cookie import CookieStorage from django.test i...
# vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python from django.test import TestCase from django.contrib.messages.storage.cookie import CookieStorage class OkupyTestCase(TestCase): def _get_matches(self, response, text): """ Get messages that match the given text """ messages = self._get_messag...
Python
0.000007
b25a172cd89e8811e5cb38414bdf86ef5a5afaee
fix ABC for py2.7
rhea/system/cso.py
rhea/system/cso.py
from __future__ import absolute_import from abc import ABCMeta, abstractclassmethod from myhdl import Signal, SignalType, always_comb class ControlStatusBase(object): __metaclass__ = ABCMeta def __init__(self): """ Base class for control and status classes Many complex digital block have c...
from __future__ import absolute_import from abc import ABCMeta, abstractclassmethod from myhdl import Signal, SignalType, always_comb class ControlStatusBase(metaclass=ABCMeta): def __init__(self): self._isstatic = False @property def isstatic(self): return self._isstatic @isstati...
Python
0.99992
682b52e3f5b1f1de5009e7fc7fac95f453dbe631
Enable more content in header/footer
rinohlib/templates/manual.py
rinohlib/templates/manual.py
from rinoh.document import Document, DocumentPart, Page, PORTRAIT from rinoh.dimension import PT, CM from rinoh.layout import Container, FootnoteContainer, Chain, \ UpExpandingContainer, DownExpandingContainer from rinoh.paper import A4 from rinoh.structure import Section, Heading, TableOfContents, Header, Foote...
from rinoh.document import Document, DocumentPart, Page, PORTRAIT from rinoh.dimension import PT, CM from rinoh.layout import Container, FootnoteContainer, Chain from rinoh.paper import A4 from rinoh.structure import Section, Heading, TableOfContents, Header, Footer # page definition # ----------------------------...
Python
0
c0ab9b755b4906129988348b2247452b6dfc157f
Add a module to set the "display name" of a dedicated server
plugins/modules/dedicated_server_display_name.py
plugins/modules/dedicated_server_display_name.py
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function) from ansible.module_utils.basic import AnsibleModule __metaclass__ = type DOCUMENTATION = ''' --- module: dedicated_server_display_name short_description: Modify the server display name in ovh manager descri...
Python
0
ffdee2f18d5e32c2d0b4f4eb0cebe8b63ee555f7
Document tools/mac/dump-static-initializers.py more.
tools/mac/dump-static-initializers.py
tools/mac/dump-static-initializers.py
#!/usr/bin/env python # Copyright (c) 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. """ Dumps a list of files with static initializers. Use with release builds. Usage: tools/mac/dump-static-initializers.py out/Re...
#!/usr/bin/env python # Copyright (c) 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. import optparse import re import subprocess import sys # Matches for example: # [ 1] 000001ca 64 (N_SO ) 00 0000 ...
Python
0.000002
b783ddcaad104ac5cfa7b6903852e6f68b736bf3
Add python implementation of motion propagation.
tools/propagate/motion_propagation.py
tools/propagate/motion_propagation.py
#!/usr/bin/env python import argparse import glob import os import scipy.io as sio from vdetlib.utils.protocol import proto_load from vdetlib.utils.common import imread import numpy as np import pdb def _boxes_average_sum(motionmap, boxes, box_ratio=1.0): h, w = motionmap.shape accum_map = np.cumsum(np.cumsum...
Python
0
8fbc5877fa97b6b8df621ff7afe7515b501660fc
Convert string to camel case
LeetCode/ConvertStringToCamelCase.py
LeetCode/ConvertStringToCamelCase.py
def to_camel_case(text): if len(text) < 2: return text capped_camel = "".join([word.title() for word in text.replace('-','_').split('_')]) return capped_camel if text[0].isupper() else capped_camel[0].lower()+capped_camel[1:]
Python
0.999999
6dd1545ae9ff3ac10586144494f763bcc1bea1d8
Add script to verify that image files exist for every actual_result checksum
tools/verify_images_for_gm_results.py
tools/verify_images_for_gm_results.py
#!/usr/bin/python # Copyright (c) 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. """ Look through skia-autogen, searching for all checksums which should have corresponding files in Google Storage, and verify that t...
Python
0.006359
98abb69d2c5cd41e9cdf9decc1180fe35112bc28
Add initial base for the feed handler
backend/feed_daemon.py
backend/feed_daemon.py
import feedparser import psycopg2 import sys import configparser import logging class FeedHandler(): def __init__(self): self.config = configparser.ConfigParser(interpolation=None) self.config.read(('config.ini',)) logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', lev...
Python
0
c684ab17fc83242ee32db4b4c4bf57a7798acae4
Add ordering prefix
examples/00_empty_window.py
examples/00_empty_window.py
import ModernGL from ModernGL.ext.examples import run_example class Example: def __init__(self, wnd): self.wnd = wnd self.ctx = ModernGL.create_context() def render(self): self.ctx.viewport = self.wnd.viewport self.ctx.clear(0.2, 0.4, 0.7) run_example(Example)
Python
0.000114
c660de10b58b985273675396a214a3f4bf968a20
Fix credentials initialization.
tools/telemetry/telemetry/core/backends/chrome/cros_test_case.py
tools/telemetry/telemetry/core/backends/chrome/cros_test_case.py
# Copyright 2014 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 os import unittest from telemetry.core import browser_finder from telemetry.core import extension_to_load from telemetry.core import util from teleme...
# Copyright 2014 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 os import unittest from telemetry.core import browser_finder from telemetry.core import extension_to_load from telemetry.core import util from teleme...
Python
0.999998
35a683738f00a67b88f26fdc2453a29777fe7f82
Add raw outputter
salt/output/raw.py
salt/output/raw.py
''' Print out the raw python data, the original outputter ''' def ouput(data): ''' Rather basic.... ''' print(data)
Python
0.002716
ad284dfe63b827aaa1ca8d7353e1bf1a54ea4fdf
Change arduino board from first example from mega to nano
src/arduino_sourcecodes/src/arduino_serial_nodes/connect_arduino_nano1.py
src/arduino_sourcecodes/src/arduino_serial_nodes/connect_arduino_nano1.py
#!/usr/bin/env python ##################################################################### # Software License Agreement (BSD License) # # Copyright (c) 2011, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that th...
Python
0.000005
07528bd828c28a18f3118481d1cdb9cf1287fd0b
Revert "don't track django.wsgi". It is part of the documentation.
railroad/sample/django.wsgi
railroad/sample/django.wsgi
# Copyright 2010 ITA Software, Inc. # # 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 wr...
Python
0
e7dd12377a5f3a46019c5244de08a5cfc00f44db
add Anscombe's Quartet example
examples/glyphs/anscombe.py
examples/glyphs/anscombe.py
import os import numpy as np import pandas as pd from bokeh.objects import ( ColumnDataSource, GlyphRenderer, Grid, GridPlot, LinearAxis, Plot, Range1d ) from bokeh.glyphs import Circle, Line from bokeh import session from StringIO import StringIO data = """ I I II II III III IV ...
Python
0.000024
2d65862d77338dc503e34f389de1dc3bc553b6cd
Add DomainCaseRuleRun to admin site
corehq/apps/data_interfaces/admin.py
corehq/apps/data_interfaces/admin.py
from django.contrib import admin from corehq.apps.data_interfaces.models import DomainCaseRuleRun class DomainCaseRuleRunAdmin(admin.ModelAdmin): list_display = [ 'domain', 'started_on', 'finished_on', 'status', 'cases_checked', 'num_updates', 'num_closes',...
Python
0
017f276bb9544578417444c34ce2c04d87bb5852
Fix zds #323
markdown/extensions/emoticons.py
markdown/extensions/emoticons.py
# Emoticon extension for python-markdown # Original version : # https://gist.github.com/insin/815656/raw/a68516f1ffc03df465730b3ddef6de0a11b7e9a5/mdx_emoticons.py # # Patched by cgabard for supporting newer python-markdown version and extend for support multi-extensions import re import markdown from markdown.inlinepa...
# Emoticon extension for python-markdown # Original version : # https://gist.github.com/insin/815656/raw/a68516f1ffc03df465730b3ddef6de0a11b7e9a5/mdx_emoticons.py # # Patched by cgabard for supporting newer python-markdown version and extend for support multi-extensions import re import markdown from markdown.inlinepa...
Python
0