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
49d28814c498d1698c61b8eeae3c3e3e019a09c3
add recipe3 scrap
scrap/recipe3.py
scrap/recipe3.py
import scrapy class Recipe3Spider(scrapy.Spider): name = "recipe3" download_delay = 0.5 start_urls = [ "http://www.cuisineaz.com/recettes/recherche_v2.aspx?recherche={}".format(r) for r in [ 'bases', 'aperitifs', 'entrees', 'plats', ...
Python
0.000373
f486343277a94e511ea1e152ca6b69f12fd657a0
Create droidgpspush.py
droidgpspush.py
droidgpspush.py
import androidhelper import socket import time droid = androidhelper.Android() port=12345 s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.connect(("10.201.19.201",port)) #connecting to pi as client droid.makeToast("Starting location fetch") #notify me while True: location = droid.getLastKnownLocation().result ...
Python
0
fc0d54ff6d6b6ca91727c7aa0832f6c6dfc64967
Add a prototype WinNT updater
rwho-update-winnt.py
rwho-update-winnt.py
#!/usr/bin/python """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Half of this hasn't been implemented yet. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" import ctypes as c import socket as so import win32api as api #import win32con as con import win32ts as...
Python
0
6d25c1958a84eb1a6004ebadec6769511974cca4
add basic rsa by request
basic-rsa/rsa.py
basic-rsa/rsa.py
def main(): e = int('3', 16) n = int('64ac4671cb4401e906cd273a2ecbc679f55b879f0ecb25eefcb377ac724ee3b1', 16) d = int('431d844bdcd801460488c4d17487d9a5ccc95698301d6ab2e218e4b575d52ea3', 16) c = int('599f55a1b0520a19233c169b8c339f10695f9e61c92bd8fd3c17c8bba0d5677e', 16) m = pow(c, d, n) print(hex(...
Python
0
ad4471dfc4210e34b66c65293f71f7ba4936beba
Create arbitrage_algo.py
vnpy/app/algo_trading/algos/arbitrage_algo.py
vnpy/app/algo_trading/algos/arbitrage_algo.py
from vnpy.trader.constant import Direction from vnpy.trader.object import TradeData, OrderData from vnpy.trader.engine import BaseEngine from vnpy.app.algo_trading import AlgoTemplate class ArbitrageAlgo(AlgoTemplate): """""" display_name = "Arbitrage 套利" default_setting = { "active_vt_symbol":...
Python
0.000257
6be3e0c5264ca2750a77ac1dbd4175502e51fd3c
Add argparse tests for ceph-deploy admin
ceph_deploy/tests/parser/test_admin.py
ceph_deploy/tests/parser/test_admin.py
import pytest from ceph_deploy.cli import get_parser class TestParserAdmin(object): def setup(self): self.parser = get_parser() def test_admin_help(self, capsys): with pytest.raises(SystemExit): self.parser.parse_args('admin --help'.split()) out, err = capsys.readouterr(...
Python
0
2ee5f1e3563e5a7104515adf74e41a8781fbcd9e
Create exercise5.py
exercise5.py
exercise5.py
# -- coding: utf-8 -- my_name = 'Zed A. Shaw' my_age = 35 # not a lie my_height = 74 # inches my_weight = 180 # lbs my_eyes = 'Blue' my_teeth = 'White' my_hair = 'Brown' print "Let's talk about %s." % my_name print "He's %d inches tall." % my_height print "He's %d pounds heavy." % my_weight print "Actually that's no...
Python
0.000001
1dbd94379662638639945bd58910f3a0e67bb61e
Create backend.py
backend.py
backend.py
# -*- coding: utf-8 -*- from bs4 import BeautifulSoup import requests import urllib import time import os import sys import re import lyrics as minilyrics import services as s if sys.platform == "win32": import win32gui elif sys.platform == "darwin": import subprocess else: import subprocess import dbu...
Python
0.000002
2523d34d4f3e26a408c7ec0e43708efea77f03a9
Add to support the chinese library
workflow/cndic_naver_search.py
workflow/cndic_naver_search.py
# Naver Search Workflow for Alfred 2 # Copyright (C) 2013 Jinuk Baek # This program 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 2 # of the License, or (at your option) any later versi...
Python
0
ac0e7cb6ff2885457ccbe9f7311489edf7c9406b
create train object utils
mozi/utils/train_object_utils.py
mozi/utils/train_object_utils.py
from __future__ import absolute_import from __future__ import print_function import matplotlib # matplotlib.use('Agg') import theano import theano.tensor as T import numpy as np import matplotlib.pyplot as plt from theano.compile.ops import as_op from mozi.utils.progbar import Progbar import tarfile, inspect, os from...
Python
0.000018
1768a69163c50e5e964eaf110323e590f13b4ff0
add 0000 file
Drake-Z/0000/0000.py
Drake-Z/0000/0000.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- '第 0000 题:将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。 类似于图中效果' __author__ = 'Drake-Z' from PIL import Image, ImageDraw, ImageFont def add_num(filname, text = '4', fillcolor = (255, 0, 0)): img = Image.open(filname) width, height = img.size myfont = Image...
Python
0.000001
ebc2b419a3cc7cace9c79d1c5032a2ae33b8bff1
Remove unused imports
custom/up_nrhm/reports/asha_reports.py
custom/up_nrhm/reports/asha_reports.py
from corehq.apps.reports.filters.select import MonthFilter, YearFilter from corehq.apps.reports.generic import GenericTabularReport from corehq.apps.reports.standard import CustomProjectReport, DatespanMixin from corehq.apps.reports.filters.dates import DatespanFilter from custom.up_nrhm.filters import DrillDownOptionF...
import datetime from dateutil.relativedelta import relativedelta from corehq.apps.reports.filters.select import MonthFilter, YearFilter from corehq.apps.reports.generic import GenericTabularReport from corehq.apps.reports.standard import CustomProjectReport, DatespanMixin from corehq.apps.reports.filters.dates import D...
Python
0.000001
3d8f02eb7c1b9b363143f25af9eadeb94c43b4ae
increase uwnetid maxlength
myuw/migrations/0017_netidlen.py
myuw/migrations/0017_netidlen.py
# Generated by Django 2.0.13 on 2020-03-12 17:48 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('myuw', '0016_myuw_notice_group'), ] operations = [ migrations.AlterField( model_name='user', name='uwnetid', ...
Python
0.000015
53a0e58bb68c3fb247a65fabf6c80b5bb41f440e
Fix custom attribute test factories
test/integration/ggrc/models/factories.py
test/integration/ggrc/models/factories.py
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Factories for models""" # pylint: disable=too-few-public-methods,missing-docstring,old-style-class # pylint: disable=no-init import random import factory from ggrc import db from ggrc import models ...
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Factories for models""" # pylint: disable=too-few-public-methods,missing-docstring,old-style-class # pylint: disable=no-init import random import factory from ggrc import db from ggrc import models ...
Python
0.000001
1e7b84155623691fb9fc1cec4efa6386938f3e72
Add missing migration (updating validators=)
core/migrations/0055_update_username_validators.py
core/migrations/0055_update_username_validators.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-07-22 22:03 from __future__ import unicode_literals import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0054_add_provider__cloud_config_and_timezone'), ] ...
Python
0
48217e5317412a9b5fb8181b6915963783efeaf2
Add test for kline result of exact amount
tests/test_historical_klines.py
tests/test_historical_klines.py
#!/usr/bin/env python # coding=utf-8 from binance.client import Client import pytest import requests_mock client = Client('api_key', 'api_secret') def test_exact_amount(): """Test Exact amount returned""" first_res = [] row = [1519892340000,"0.00099400","0.00099810","0.00099400","0.00099810","4806.040...
Python
0
b1069d90130070c1fb5f35ba2d455bead235f8b2
add views.py of django
django/views.py
django/views.py
from django.shortcuts import render from django.db.models import Q from django.shortcuts import render_to_response from search.engine.search import dosearch from django.core.paginator import Paginator,EmptyPage, PageNotAnInteger import string import sys from search.engine.query_process import query_parser_no_stopwords,...
Python
0
1f3a15b8ae6ffcb96faaf0acab940d9590fe6cb1
Add migration
fat/migrations/0064_auto_20160809_1559.py
fat/migrations/0064_auto_20160809_1559.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-08-09 15:59 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fat', '0063_auto_20160809_1545'), ] operations = [ migrations.AlterField( ...
Python
0.000002
5ec3f8dbe9f044d08a80563c05b648590fabdda7
add fibonnaci example
examples/fib.py
examples/fib.py
# / 0 if i is 0 # fib(i) = | 1 if i is 1 # \ fib(i - 1) + fib(i - 2) otherwise def fib(n): """ Imperative definition of Fibonacci numbers """ a, b = 0, 1 for i in range(n): a, b = b, a + b return b # This is intuitive but ...
Python
0.999895
c663f6b6e31832fae682c2c527955b13682b701e
Remove learner_testimonials column from course_metadata course run table
course_discovery/apps/course_metadata/migrations/0127_remove_courserun_learner_testimonials.py
course_discovery/apps/course_metadata/migrations/0127_remove_courserun_learner_testimonials.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2018-11-07 17:16 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('course_metadata', '0126_course_has_ofac_restrictions'), ] operations = [ migration...
Python
0.000002
8b1bd5995ff4c95335e25e19962724e6d8c399d7
Create 0003_auto_20150930_1132.py
cities/migrations/0003_auto_20150930_1132.py
cities/migrations/0003_auto_20150930_1132.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('cities', '0002_auto_20150811_1912'), ] operations = [ migrations.AddField( model_name='city', name='...
Python
0.000016
b75e10f3235e9215458071279b67910627a95180
Add celery based job runner
ceam/framework/celery_tasks.py
ceam/framework/celery_tasks.py
import os from time import time import logging import pandas as pd from celery import Celery from billiard import current_process app = Celery() @app.task(autoretry_for=(Exception,), max_retries=2) def worker(draw_number, component_config, branch_config, logging_directory): worker = current_process().index ...
Python
0.000011
164f43f902b89b84b4f0d474f4d3e0a18924110d
Add test of randomized select algorithm
selection_test.py
selection_test.py
import quicksort.quicksort import random_selection.random_selection import sys import time from random import randint def main(max_len, check): for n in [2**(n+1) for n in range(max_len)]: arr = [randint(0, 2**max_len) for n in range(n)] median = int((len(arr)+1)/2) - 1 current_time = time.time() result = r...
Python
0.000005
80651fc7dba6a390091dc0f0908ec165cf33c0bb
make diagnostic plots for a star
scripts/plot_star.py
scripts/plot_star.py
""" Make diagnostic plots for a specified APOGEE ID """ # Standard library from os import path # Third-party import h5py import matplotlib.pyplot as plt from sqlalchemy.orm.exc import NoResultFound # Project from twoface.log import log as logger from twoface.db import db_connect from twoface.db import (JokerRun, All...
Python
0.000003
b528956e9394dc56951c2fb0894fefd7ee6872ff
Create cnn_evaluation.py
Convolutional_Neural_Network/cnn_evaluation.py
Convolutional_Neural_Network/cnn_evaluation.py
""" Using an Convolutional Nural Network on MNIST handwritten digits, and evaluating its performance with different scores References: Tflearn.org/examples Tensorflow.org Links: [MNIST Dataset] http://yann.lecun.com/exdb/mnist/ Method and Examples Used: [1] An simple example from Tflean, which is an hi...
Python
0.000002
9168807db69372ffb93430991fc4e666fa53a8f5
Add missing example file
examples/movemean.py
examples/movemean.py
""" A moving average function using @guvectorize. """ import numpy as np from numba import guvectorize @guvectorize(['void(float64[:], intp[:], float64[:])'], '(n),()->(n)') def move_mean(a, window_arr, out): window_width = window_arr[0] asum = 0.0 count = 0 for i in range(window_width): asum...
Python
0.000005
82d34111295fdfa35d0e9815053498e935d415af
Add example script to store & read datetime
examples/store_datetimes.py
examples/store_datetimes.py
import h5py import numpy as np arr = np.array([np.datetime64('2019-09-22T17:38:30')]) with h5py.File('datetimes.h5', 'w') as f: # Create dataset f['data'] = arr.astype(h5py.opaque_dtype(arr.dtype)) # Read print(f['data'][:])
Python
0
e581eb8af860456b0ff46e99398002b3df0f0677
add Julia magic for IPython
julia/magic.py
julia/magic.py
""" ========================== Julia magics for IPython ========================== {JULIAMAGICS_DOC} Usage ===== ``%%julia`` {JULIA_DOC} """ #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- from...
Python
0.000406
e830ce7115ea417feb00c62bf68a7d1829815630
Create UAV_State class
scripts/uav_state.py
scripts/uav_state.py
#!/usr/bin/env python # # UAV State Model: # Encapsulates UAV state and abstracts communication # States: # - Setpoint pose # - local_position # - MAV mode # - arm # import ROS libraries import rospy import mavros from mavros.utils import * from mavros import setpoint as SP import mavros_msgs.msg import mavros_msgs.sr...
Python
0
12691d47c4dbbaac42d2c9a8fe04e70cb5a94e98
add Yaspin.write usage example
examples/write_method.py
examples/write_method.py
# -*- coding: utf-8 -*- """ examples.write_method ~~~~~~~~~~~~~~~~~~~~~ Basic usage of ``write`` method. """ import time from yaspin import yaspin def main(): with yaspin(text='Downloading images') as sp: # task 1 time.sleep(1) sp.write('> image 1 download complete') # task 2 ...
Python
0
324bc6f72deef0349f0da48366ab11b749a231b5
Make AzureKeyVaultBackend backwards-compatible (#12626)
airflow/contrib/secrets/azure_key_vault.py
airflow/contrib/secrets/azure_key_vault.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
Python
0
165d6795c2e3b173282736127c092ede57ae8f55
Create create_recurring_for_failed.py
erpnext/patches/v6_27/create_recurring_for_failed.py
erpnext/patches/v6_27/create_recurring_for_failed.py
import frappe from erpnext.controllers.recurring_document import manage_recurring_documents def execute(): frappe.db.sql("""update `tabSales Invoice` set is_recurring=1 where (docstatus=1 or docstatus=0) and next_date='2016-06-26' and is_recurring=0""") manage_recurring_documents("Sales Invoice", "2016-06-26...
Python
0.000004
93d1d4cc446cd13affaf1b467e39845c5dc437a5
Add missing migration
events/migrations/0002_auto_20150119_2138.py
events/migrations/0002_auto_20150119_2138.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('events', '0001_initial'), ] operations = [ migrations.AlterField( model_name='offer', name='price', ...
Python
0.0002
a8b46224dfda38173ea130d820411aad6a47acfc
Add Commander.py
src/Commander.py
src/Commander.py
# Copyright (c) 2013 Molly White # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distrib...
Python
0.000004
52c9a8ab10934c7acf8bcc404dccd2524199acb7
support for qualifying keys with dot('.') in JSON reference
src/DictUtils.py
src/DictUtils.py
import collections class DictUtils: @staticmethod def __retrieveFromDict(t, key): if None != t: found = True if str == type(key): keys = key.split('.') else: keys = key for k in keys: if k in t: ...
import collections class DictUtils: @staticmethod def __retrieveFromDict(t, key): if None != t: found = True if str == type(key): keys = [key] else: keys = key for k in keys: if k in t: ...
Python
0.000072
fe36fd79c1981c489fd1db548c7468acbf98fff5
add test for s3 filename unquote
app/backend/gwells/tests/test_documents.py
app/backend/gwells/tests/test_documents.py
from django.test import TestCase from gwells.documents import MinioClient class DocumentsTestCase(TestCase): def test_document_url_with_space(self): minio_client = MinioClient(disable_private=True) test_document = { "bucket_name": "test_bucket", "object_name": "test key" ...
Python
0.000001
510a3ddd61fb5c6599b85650c09a0f1b799f06b2
add 'fw11.py' which supports urlpath parameter
framework_python/fw11.py
framework_python/fw11.py
# -*- coding: utf-8 -*- ## ## URLパスパラメータをサポート ## import os import re import json class Request(object): def __init__(self, environ): self.environ = environ self.method = environ['REQUEST_METHOD'] self.path = environ['PATH_INFO'] class Response(object): def __init__(self): ...
Python
0.000004
4b06b5ec929af3466bfe9f03892b6c68259a2e3e
add gunicorn app
gunicorn_app.py
gunicorn_app.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os DATA_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), 'data')) from logbook.compat import redirect_logging redirect_logging() from aip import make from aip.log import RedisPub with RedisPub(): app = make( instance_path=DATA_PATH, ...
Python
0
52236b1ad285683d828b248e462a7b984d31e636
Add example of connecting OGR to matplotlib through shapely and numpy
examples/world.py
examples/world.py
import ogr import pylab from numpy import asarray from shapely.wkb import loads source = ogr.Open("/var/gis/data/world/world_borders.shp") borders = source.GetLayerByName("world_borders") fig = pylab.figure(1, figsize=(4,2), dpi=300) while 1: feature = borders.GetNextFeature() if not feature: break ...
Python
0.000002
bc871956d492a3bc34e28847de136e1b4ad82035
Create codechallenge.py
codechallenge.py
codechallenge.py
Python
0.000004
08a813019c43288051e2ef5cbdfc6daaa0b6a32c
fix running rubyspec?
fabfile/travis.py
fabfile/travis.py
import glob import os from fabric.api import task, local from fabric.context_managers import lcd class Test(object): def __init__(self, func, deps=[], needs_pypy=True, needs_rubyspec=False): self.func = func self.deps = deps self.needs_pypy = needs_pypy self.needs_rubyspec = needs...
import glob import os from fabric.api import task, local from fabric.context_managers import lcd class Test(object): def __init__(self, func, deps=[], needs_pypy=True, needs_rubyspec=False): self.func = func self.deps = deps self.needs_pypy = needs_pypy self.needs_rubyspec = needs...
Python
0
2044e3b018595e45cc2969d0675d5006ea02ccf5
update to use new struct data of g_project
trunk/editor/savefilerooms.py
trunk/editor/savefilerooms.py
#!/usr/bin/env python from xml.dom import minidom from xml.etree import ElementTree #to use OrderedDict in python < 2.7 try: from collections import OrderedDict except ImportError: from misc.dict import OrderedDict from structdata.project import g_project def prettify(content): """ Return a pretty-p...
#!/usr/bin/env python from xml.dom import minidom from xml.etree import ElementTree #to use OrderedDict in python < 2.7 try: from collections import OrderedDict except ImportError: from misc.dict import OrderedDict from structdata.world import g_world def prettify(content): """ Return a pretty-print...
Python
0
93d91ba059a7037281f6a5e4d6afd5e071668d81
Create freebook.py
freebook/reddit/freebook.py
freebook/reddit/freebook.py
# Get free ebooks from Reddit from bs4 import BeautifulSoup import feedparser import requests url = "https://www.reddit.com/r/freebooks.rss" headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:59.0) Gecko/20100101 Firefox/59.0"} urls = [] books = [] book_data_all = [] d = feedparser.parse(req...
Python
0
6edadeb278be9b776845a12954871386ead270d4
add tests for log rotation
plenum/test/test_log_rotation.py
plenum/test/test_log_rotation.py
import pytest import os import logging import shutil import time from plenum.common.logging.TimeAndSizeRotatingFileHandler \ import TimeAndSizeRotatingFileHandler def cleanFolder(path): if os.path.exists(path): shutil.rmtree(path) os.makedirs(path, exist_ok=True) return path def test_time_lo...
Python
0
fd75ee4a96eddc1e71eb85dd36a2c8f5b13807ca
Create RemoveLinkedListElement.py
RemoveLinkedListElement.py
RemoveLinkedListElement.py
"""Remove Linked List Elements Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6 Return: 1 --> 2 --> 3 --> 4 --> 5 """ class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution...
Python
0.000001
fd33fadc260cda2bd2395f027457f990ab05480b
Add migration for Registration changed
registration/migrations/0008_auto_20160418_2250.py
registration/migrations/0008_auto_20160418_2250.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.4 on 2016-04-18 13:50 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('registration', '0007_auto_20160416_1217'), ] operations = [ migrations.Alter...
Python
0
3c1be9f8fb362699737b6dd867398e734057c300
Add main entry point.
rave/__main__.py
rave/__main__.py
import argparse import sys from os import path def parse_arguments(): parser = argparse.ArgumentParser(description='A modular and extensible visual novel engine.', prog='rave') parser.add_argument('-b', '--bootstrapper', help='Select bootstrapper to bootstrap the engine with. (default: autoselect)') parse...
Python
0
592b3dda603dec0765825fc8dc03fb623906cb63
Add migration
infrastructure/migrations/0018_auto_20210928_1642.py
infrastructure/migrations/0018_auto_20210928_1642.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2021-09-28 14:42 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('infrastructure', '0017_auto_20210928_1329'), ] op...
Python
0.000002
ede4704704f5f6b246d70c84a16be9465cfa55e2
Triplet with given sum
Arrays/triplet_with_given_sum.py
Arrays/triplet_with_given_sum.py
import unittest """ Given an unsorted array of numbers, and a value, find a triplet whose sum is equal to value. Input: 12 3 4 1 6 9, value = 24 Output: 12 3 9 """ """ Approach: 1. Sort the array. 2. Scan from left to right. 3. Fix current element as potential first element of triplet. 4. Find a pair which has sum as ...
Python
0.999999
05659cd132a5dfb54b50ec38ff1d405697de251a
Add crawler for superpoop
comics/crawler/crawlers/superpoop.py
comics/crawler/crawlers/superpoop.py
from comics.crawler.base import BaseComicCrawler from comics.crawler.meta import BaseComicMeta class ComicMeta(BaseComicMeta): name = 'Superpoop' language = 'en' url = 'http://www.superpoop.com/' start_date = '2008-01-01' history_capable_days = 30 schedule = 'Mo,Tu,We,Th' time_zone = -5 ...
Python
0.000053
6da1f28296a8db0c18c0726dcfdc0067bebd9114
add a script to test learned DQN
learning_tools/keras-rl/dqn/dqn_tester.py
learning_tools/keras-rl/dqn/dqn_tester.py
import numpy as np import gym import os import pickle import argparse import pandas as pd from keras.models import Sequential from keras.layers import Dense, Activation, Flatten from keras.optimizers import Adam from rl.agents.dqn import DQNAgent from rl.policy import BoltzmannQPolicy, LinearAnnealedPolicy from rl.me...
Python
0
9f6f6b727458eb331d370443074a58d1efa6d755
Add migration for blank true.
kolibri/logger/migrations/0003_auto_20170531_1140.py
kolibri/logger/migrations/0003_auto_20170531_1140.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2017-05-31 18:40 from __future__ import unicode_literals import kolibri.core.fields from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('logger', '0002_auto_20170518_1031'), ] operations = [ mig...
Python
0.000141
d68a89b73e6ff47a2ebd169c06070815d9fd859c
Add example tests for REST API
game/tests/test_api.py
game/tests/test_api.py
# -*- coding: utf-8 -*- # Code for Life # # Copyright (C) 2015, Ocado Limited # # This program 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 option) any ...
Python
0
529f5ac7fe7a41dda9a9078df17b0fd27d897597
Add another example, which was created during a user training.
pymcxray/examples/simulation_training_map.py
pymcxray/examples/simulation_training_map.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ .. py:currentmodule:: pymcxray.examples.simulation_test_maps :synopsis: Script to simulate mcxray maps for MM2017 with Nadi. .. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca> Script to simulate mcxray maps for MM2017 with Nadi. """ ################...
Python
0
b04e3787de29d4bee68854e15a7e783cbe3c3bd0
Add test for microstructure generator
pymks/tests/test_microstructure_generator.py
pymks/tests/test_microstructure_generator.py
import pytest import numpy as np from pymks.datasets import make_microstructure @pytest.mark.xfail def test_size_and_grain_size_failure(): make_microstructure(n_samples=1, size=(7, 7), grain_size=(8, 1)) @pytest.mark.xfail def test_volume_fraction_failure(): make_microstructure(n_samples=1, volume_fraction=...
Python
0
d741dd17315ffdf8935d22989ce680cbf08f46fa
Add TV plugin
plugins/tv/plugin.py
plugins/tv/plugin.py
from datetime import datetime import logging from twisted.internet import defer from twisted.internet.threads import deferToThread import requests from cardinal.decorators import command from cardinal.decorators import help class ShowNotFoundException(Exception): pass @defer.inlineCallbacks def fetch_show(sho...
Python
0
74ede836ad6572c9e6c7865e5d29671a994629af
Create ManifoldWR.py
SmilNN/ManifoldWR.py
SmilNN/ManifoldWR.py
# -*- coding: utf-8 -*- import numpy as np import keras.backend as K from keras.callbacks import ModelCheckpoint from keras.layers import Dense from keras.layers.noise import GaussianDropout from keras.models import Sequential from keras.optimizers import SGD from sklearn.datasets import load_svmlight_file from keras.r...
Python
0.000002
14a9bd6a1c5e1a5605f5161b46d65bd35f89e44a
Add foreman callback plugin (#17141)
lib/ansible/plugins/callback/foreman.py
lib/ansible/plugins/callback/foreman.py
# -*- coding: utf-8 -*- # (C) 2015, 2016 Daniel Lobato <elobatocs@gmail.com> # 2016 Guido Günther <agx@sigxcpu.org> # # This file is part of Ansible # # Ansible 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 Foundati...
Python
0
04dcdadf4f8b18405754683af0138ddc8363580e
Create followExpression.py
maya/python/animation/followExpression.py
maya/python/animation/followExpression.py
ctrlShape = cmds.createNode('locator') ctrlTransform = cmds.listRelatives(ctrlShape,p=True,f=True) if isinstance(ctrlTransform,list): ctrlTransform = ctrlTransform[0] jt = cmds.createNode('joint',n='followJoint') attrName = 'follow' if not cmds.attributeQuery(attrName,n=ctrlTransform,ex=True): cmds.addAttr(ctr...
Python
0.000001
58c62061c0c02682f96d6793b0570b455887d392
Add pytest tools
delocate/tests/pytest_tools.py
delocate/tests/pytest_tools.py
import pytest def assert_true(condition): __tracebackhide__ = True assert condition def assert_false(condition): __tracebackhide__ = True assert not condition def assert_raises(expected_exception, *args, **kwargs): __tracebackhide__ = True return pytest.raises(expected_exception, *args, **...
Python
0.000001
dd93995a119323d9b67dce1f8797eb72788a044a
solve 12704
UVA/vol-127/12704.py
UVA/vol-127/12704.py
from sys import stdin, stdout I = list(map(int, stdin.read().split())) for i in range(0, I[0]): [x, y, r] = I[3*i + 1: 3*i + 4] cd = (x*x + y*y) ** 0.5 stdout.write('{:.2f} {:.2f}\n'.format(r-cd, r+cd))
Python
0.999999
08cade084a38952907b24580f597da08f850573d
Add mongo_source
mongo_source.py
mongo_source.py
#! /usr/bin/env python # coding:utf-8 import pymongo as pm import preprocessing import sys import re import os def twitter( db: str, coll: str, target: str, logger, target_dir: str="source", sfilter: dict={}, delimiter: str=",", limit: int=0, verbose: bool=True, host: str="lo...
Python
0.000002
3ad0f9ee142e3a08e82749f47003870f14029bff
Fix urls.py to point to web version of view
mysite/urls.py
mysite/urls.py
from django.conf.urls.defaults import * import settings from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^$', 'mysite.search.views.fetch_bugs'), (r'^search/$', 'mysite.search.views.fetch_bugs'), (r'^admin/(.*)', admin.site.root), (r'^static/(?P<path>...
from django.conf.urls.defaults import * import settings from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^$', 'mysite.search.views.fetch_bugs'), (r'^search/$', 'mysite.search.views.fetch_bugs'), (r'^admin/(.*)', admin.site.root), (r'^static/(?P<path>...
Python
0.000004
920d9db6ff993d57349dd0e3f12d53f284fd05ed
Create nasa_weblogs.py
nasa_weblogs.py
nasa_weblogs.py
#!/usr/bin/env python import sys import os import re import pandas as pd # import modin.pandas as pd #replcaing basic Pandas with faster modin from pyspark.context import SparkContext from pyspark.sql.session import SparkSession from pyspark.sql.context import SQLContext from pyspark.sql.functions import udf import g...
Python
0
9d058f4b324dabf4f2cdd2ea88f40c9aabe2d622
Add test for the Py binding of Hash.
runtime/python/test/test_hash.py
runtime/python/test/test_hash.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
Python
0
8706ec4678bc4740b64265ced63fb12d837e0297
Add Basic Histogram Example
altair/vegalite/v2/examples/histogram.py
altair/vegalite/v2/examples/histogram.py
""" Histogram ----------------- This example shows how to make a basic histogram, based on the vega-lite docs https://vega.github.io/vega-lite/examples/histogram.html """ import altair as alt movies = alt.load_dataset('movies') chart = alt.Chart(movies).mark_bar().encode( x=alt.X("IMDB_Rating", type='...
Python
0
0dc2417894ef1b6bd3f5386f7dfa0bb3d34a594c
Add contest calendar generation code & styles; #55
judge/contest_calendar.py
judge/contest_calendar.py
import calendar, datetime from judge.models import Contest, ContestParticipation, ContestProblem, Profile class MyCal(calendar.HTMLCalendar): def __init__(self, x): super(MyCal, self).__init__(x) self.today = datetime.datetime.date(datetime.datetime.now()) def formatweekday(self, day): ...
Python
0
4f1ddebb0fc185dfe4cd5167c67be8f6cea78273
Create listenCmd.py
listenCmd.py
listenCmd.py
#!/usr/bin/python #impoer the necessary modules import re # the regexp module # listen command test python file # // THE FCNS // # the fcn that iterate through the recognized command list to find a match with the received pseech command def listenForCommand( theCommand ): #for s in range( len( cmdsList ) ): for ...
Python
0.000002
fd1b2885057512d6b91a2b2ed4df183e66093e61
Create extended_iter_with_peek.py
lld_practice/extended_iter_with_peek.py
lld_practice/extended_iter_with_peek.py
class ExtendedIter: """An extended iterator that wraps around an existing iterators. It provides extra methods: - `has_next()`: checks if we can still yield items. - `peek()`: returns the next element of our iterator, but doesn't pass by it. If there's nothing more to return, raises `StopIteration`...
Python
0.000001
7ce7ce4bd899e6c386de669d11a2fc5593157c91
move processing in a mixin
pipeline/storage.py
pipeline/storage.py
import os try: from staticfiles import finders from staticfiles.storage import CachedFilesMixin, StaticFilesStorage except ImportError: from django.contrib.staticfiles import finders from django.contrib.staticfiles.storage import CachedFilesMixin, StaticFilesStorage from django.core.exceptions import ...
import os try: from staticfiles import finders from staticfiles.storage import CachedStaticFilesStorage, StaticFilesStorage except ImportError: from django.contrib.staticfiles import finders from django.contrib.staticfiles.storage import CachedStaticFilesStorage, StaticFilesStorage from django.core.ex...
Python
0
77e980157f51af421eceb7c7b7a84945d8d33a91
Convert caffemodel of FCN8s to chainer model
scripts/caffe_to_chainermodel.py
scripts/caffe_to_chainermodel.py
#!/usr/bin/env python from __future__ import print_function import argparse import os.path as osp import caffe import chainer.functions as F import chainer.serializers as S import fcn from fcn.models import FCN8s data_dir = fcn.get_data_dir() caffemodel = osp.join(data_dir, 'voc-fcn8s/fcn8s-heavy-pascal.caffemodel...
Python
0.999999
a8423d5759a951b7f8d765203e3a02a6d3211f35
add body task generator
neurolabi/python/flyem/BodyTaskManager.py
neurolabi/python/flyem/BodyTaskManager.py
''' Created on Sep 18, 2013 @author: zhaot ''' import os; class ExtractBodyTaskManager: ''' classdocs ''' def __init__(self): ''' Constructor ''' self.commandPath = ''; self.minSize = 0; self.maxSize = -1; self.overwriteLevel = 1 self.zO...
Python
0.000008
18935881745b7bc65741837d63ec60e9d62583f1
Split the big file into smaller pieces
face_track/sound_track.py
face_track/sound_track.py
# # sound_track.py - Tracking of sound sources # Copyright (C) 2014,2015,2016 Hanson Robotics # Copyright (C) 2015,2016 Linas Vepstas # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; e...
Python
0.999531
b41444b5f7c48c4bc46a49405f7b053dcb8ea66c
rename resource function
into/backends/sas.py
into/backends/sas.py
from __future__ import absolute_import, division, print_function import sas7bdat from sas7bdat import SAS7BDAT import datashape from datashape import discover, dshape from collections import Iterator import pandas as pd import sqlalchemy as sa from .sql import dshape_to_alchemy, dshape_to_table from ..append import ...
from __future__ import absolute_import, division, print_function import sas7bdat from sas7bdat import SAS7BDAT import datashape from datashape import discover, dshape from collections import Iterator import pandas as pd import sqlalchemy as sa from .sql import dshape_to_alchemy, dshape_to_table from ..append import ...
Python
0.000005
4e1d611a06874d478e91185a0349cfc3747e36ab
Create __init__.py
bin/map/__init__.py
bin/map/__init__.py
Python
0.000429
7f4079c30bf5a693f1ccad38109bbfc83a076f22
Add palette utilities
bingraphvis/util.py
bingraphvis/util.py
#generated using palettable PALETTES = { 'grays' : ['#FFFFFD', '#D6D6D4', '#B1B1B0', '#908F8F', '#727171', '#545453', '#373737', '#1A1919', '#000000'], 'greens' : ['#F7FCF5', '#E5F5E0', '#C7E9C0', '#A1D99B', '#74C476', '#41AB5D', '#238B45', '#006D2C', '#00441B'], 'purples': ['#FCFBFD', '#EFEDF5', '#DADAEB', '#BCB...
Python
0
aed1f0e4e33dd956f4499ecffd6bf50bb58e7df4
Add fermi.py
scripts/fermi.py
scripts/fermi.py
# This example file is part of the ENVISIoN Electronic structure visualization studio # # Load this file into the Inviwo Python Editor (which you can access under the menu Python, # which is available if Inviwo has been compiled with the Python module on) # # For Copyright and License information see the file LICENSE ...
Python
0.000022
9ffa7ab2b4b5fb03d9cd8dd2740234ebaf8c8097
Add per client ignore exception option.
redis_cache/cache.py
redis_cache/cache.py
# -*- coding: utf-8 -*- from django.conf import settings from django.core.cache.backends.base import BaseCache from django.core.exceptions import ImproperlyConfigured from django.core.cache import get_cache from .util import load_class from .exceptions import ConnectionInterrupted import functools DJANGO_REDIS_IGNO...
# -*- coding: utf-8 -*- from django.conf import settings from django.core.cache.backends.base import BaseCache from django.core.exceptions import ImproperlyConfigured from django.core.cache import get_cache from .util import load_class from .exceptions import ConnectionInterrupted import functools DJANGO_REDIS_IGNO...
Python
0
b4fd94008fa5b1dcdb6dd61651d8776dfb41f2d6
Make sure we return a list.
oscar/apps/dashboard/catalogue/widgets.py
oscar/apps/dashboard/catalogue/widgets.py
import six from django.forms.util import flatatt from django.core.urlresolvers import reverse from django.utils.safestring import mark_safe from django import forms class ProductSelect(forms.Widget): is_multiple = False css = 'select2 input-xlarge' def format_value(self, value): return six.text_t...
import six from django.forms.util import flatatt from django.core.urlresolvers import reverse from django.utils.safestring import mark_safe from django import forms class ProductSelect(forms.Widget): is_multiple = False css = 'select2 input-xlarge' def format_value(self, value): return six.text_t...
Python
0.000272
7e449b0267f47ee08327d9d76976c5e1b197501b
Add missing migration (#9504)
osf/migrations/0219_auto_20201020_1836.py
osf/migrations/0219_auto_20201020_1836.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2020-10-20 18:36 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('osf', '0218_auto_20200929_1850'), ] operations = [ migrations.AlterField( ...
Python
0.000002
c137028a98cd762a4e93950fbde085969500999e
Build tagger
installer/build_tag.py
installer/build_tag.py
#!/usr/python import os from subprocess import call, check_output ver = check_output([ "python", "version.py", "../apps/Tasks/src/version.h", "PROGRAM_VERSION_MAJOR,PROGRAM_VERSION_MINOR,PROGRAM_VERSION_PATCH,PROGRAM_VERSION_BUILD", "PROGRAM_VERSION_BUILD"]) VERSION = ver.strip() call(["git","add","../apps...
Python
0.000001
866b1c634c4fc6dc27ad953ccde6b6dcd11dcc91
Add mood light script
moodlight.py
moodlight.py
from maya.utils import executeDeferred import pymel.core as pm import threading import time _active_mood_light = None _running = False class MoodLightThread(threading.Thread): def __init__(self, speed): self.speed = speed super(MoodLightThread, self).__init__() def run(self): while _running: time.sleep...
Python
0.000001
b0d699066799d0309e7af3f8892f56a6feaac778
Write tests for new functionality; several destinations
new_tests.py
new_tests.py
from numpy import testing import unittest import numpy as np from numpy import pi from robot_arm import RobotArm class TestRobotArm(unittest.TestCase): def setUp(self): self.lengths = (3, 2, 2,) self.destinations = ( (5, 0,), (4, 2,), (6, 0.5), ...
Python
0.000001
50f698c2fdd90bc4b3e60a583c196381fc23e099
Implement a rudimentary API for LLTK
lltk-restful/base.py
lltk-restful/base.py
#!/usr/bin/python # -*- coding: UTF-8 -*- import lltk import lltk.generic import lltk.caching import lltk.exceptions from flask import Flask from flask import jsonify, request __author__ = 'Markus Beuckelmann' __author_email__ = 'email@markus-beuckelmann.de' __version__ = '0.1.0' DEBUG = True CACHING = True NAME = ...
Python
0.000034
aef4998354ee5872557392be4bc635e015e5d76d
add serial decoder
serialDecoder.py
serialDecoder.py
#!/usr/bin/python2.7 import signal import sys import time import serial import io import getopt interval = '0.1' device = '/dev/cu.usbserial' try: port=serial.Serial(port=device, baudrate=2400, bytesize=serial.EIGHTBITS, stopbits=serial.STOPBITS_ONE,...
Python
0.000007
04f19b29c79e1ab624d7ce596730ad9b4fd500fd
add lcdb.helpers.py
lcdb/helpers.py
lcdb/helpers.py
import yaml from jsonschema import validate, ValidationError def validate_config(config, schema): schema = yaml.load(open(schema)) cfg = yaml.load(open(config)) try: validate(cfg, schema) except ValidationError as e: msg = '\nPlease fix %s: %s\n' % (config, e.message) raise Val...
Python
0.001346
f4944256092b085b1546eaec114e0987da6697bc
add simple cli client
instapaper_cli.py
instapaper_cli.py
#!/opt/local/bin/python2.6 from instapaper import Instapaper from optparse import OptionParser from getpass import getpass def usage(): print "Usage: instapaper.py [-h] username password url" print "Options:" print "-h Print this help" def main(): # initialize parser usage = "usage: %prog -u U...
Python
0.000001
77886d170cba5c2427982992f3ff54f6357e3a07
add basic inverted index tool
inverted_index.py
inverted_index.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- # # @author: Jason Wu (bowenwu@sohu-inc.com) # This is a simple Inverted Index library to pretreatment for PMI compute or similar way import math import re from operator import itemgetter class InvertedIndex: ''' Inverted Index class for docs The libra...
Python
0.000001
4d740138dc7101e2816837c070d3051835977d75
Add lc0621_task_scheduler.py
lc0621_task_scheduler.py
lc0621_task_scheduler.py
"""Leetcode 621. Task Scheduler Medium URL: https://leetcode.com/problems/task-scheduler/ Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent differenttasks. Tasks could be done without original order. Each task could be done in one interval. For ...
Python
0.000004
af8f7a09c6cf8a96b716d016fc3a983340760869
Create problem10.py
python/problem10.py
python/problem10.py
import primes def problem10(limit): ps = itertools.takewhile(lambda x: x < limit, primes.Eppstein_Sieve()) # ps = primes.Eratosthenes(limit) # memory error return sum(ps)
Python
0.000029
5b276622f570adac64eda9932c7da47bf4bcd25c
Add PPM sample
ppm_practice.py
ppm_practice.py
#!/usr/bin/env python # -*- coding: utf-8 -*- class PpmImage(object): """PPM 画像を表すクラス""" def __init__(self, name, width, height, image, depth=8): """ :param name: :param width: :param height: :param image: :param depth depth: 各色の階調数 (bit) :return: ...
Python
0
4f404a71cb7ee912bca8184fe94c97d6cfba1186
Add script to rotate a solid angle in the xz plane
preprocessing_tools/solid_rotation_y.py
preprocessing_tools/solid_rotation_y.py
''' Rotates the protein by a solid angle on the plane xz ''' import numpy import os from argparse import ArgumentParser from move_prot_helper import (read_vertex, read_pqr, rotate_y, modify_pqr) def read_inputs(): """ Parse command-line arguments to run move_protein. User s...
Python
0
9e32b1211c0096488142192f5e280fe6258f368e
Add basic SG generator with limited features
misc/sg_generator.py
misc/sg_generator.py
#!/usr/bin/python -u # # Copyright (c) 2016 Balazs Nemeth # # This file is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This file i...
Python
0
468302f6552be4c61e74aa4147d83465287aa2e8
Revert "Moved "linked_clone.py" script into samples directory"
linked_clone.py
linked_clone.py
#!/usr/bin/env python """ Written by Reuben ur Rahman Github: https://github.com/rreubenur Email: reuben.13@gmail.com Linked clone example """ import atexit import requests.packages.urllib3 as urllib3 import ssl from pyVmomi import vim from pyVim.connect import SmartConnect, Disconnect from tools import cli from to...
Python
0
daf23cbb6d6015a2819de5d089a35903cbce9441
Create katakan.py
list/katakan.py
list/katakan.py
""" 4 2 belas seratus 4 puluh 0 9 ribu seratus 2 puluh 1 2 puluh 1 ribu 3 puluh 0 9 ratus 5 ribu 0 8 puluh 2 juta 8 ratus 8 belas ribu seratus 8 puluh 8 3 ratus 1 juta 4 puluh 8 ribu 5 ratus 8 puluh 8 """ def kata(n): angka = range(11) temp = "" if n < 12: temp += str(angka[n]) elif n < 20: ...
Python
0.000004
1555164ff275436de580a33735a2d8c6e6893b42
Create lab4.py
laboratorios/lab4.py
laboratorios/lab4.py
#lab 4 #josue dde leon for i in range (1, 4): nombre = input("\n\nintroduce nombre: ") n1 = input ("Introduce nota 1: ") n2 = input ("Introduce nota 2: ") n3 = input ("Introduce nota 3: ") n4 = input ("Introduce nota 4: ") n5 = input ("Introduce nota 5: ") prom=(float(n1)+float(n2)+float(n3)+float(n4)+float(n5...
Python
0.000001
7b06edf37a630d4582fc84832cd1d40b790e4aa3
Add server
pygls/server.py
pygls/server.py
import asyncio import logging from .protocol import LanguageServerProtocol logger = logging.getLogger(__name__) class Server: def __init__(self, protocol_cls): assert issubclass(protocol_cls, asyncio.Protocol) self.loop = asyncio.get_event_loop() self.lsp = protocol_cls(self) se...
Python
0.000001
357ce31d1f28fbc5d12a23dfd3bb2aa40a4e27a3
Add serialdumpbytexor.py
serialdumpbytexor.py
serialdumpbytexor.py
#!/usr/bin/env python import sys, serial if __name__ == '__main__': ser = serial.Serial('/dev/cu.usbserial-A8004ISG', 115200, timeout=10, xonxoff=0, rtscts=0) # ser.open() bb = bytearray(512) while 1: ba = bytearray(ser.read(1024)) for i in range(512): j = i * 2 ...
Python
0.000128
ca99e80e04a1d7fb3ff3698f23cdc19c8ec16113
add refresh test
refresh_test.py
refresh_test.py
#!/usr/bin/env python # This program 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 option) any later version. # # This program is distributed in the hop...
Python
0
b440872f71d37cc5bf110eb0c7c13a4a2dcb7f6c
create utils package, field_template_read update var name to template render
opps/fields/utils.py
opps/fields/utils.py
# -*- coding: utf-8 -*- def field_template_read(obj): """Use replace because the django template can't read variable with "-" """ fields = {} for o in obj: fields[o.replace("-", "_")] = obj[o] return fields
Python
0