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
470063b8d468394432e729e7417c88263614b5f0
Create msub_cluster.py
snakemake_ChIPseq_pipeline/msub_cluster.py
snakemake_ChIPseq_pipeline/msub_cluster.py
Python
0.000046
a7b0fc1effd0e68018bc3c33f1dc0b952b23003b
update nav access restrictions
accelerator/migrations/0095_update_nav_tree_access_restrictions.py
accelerator/migrations/0095_update_nav_tree_access_restrictions.py
# Generated by Django 2.2.24 on 2022-03-29 16:24 from django.db import migrations def update_nav_access_restrictions(apps, schema_editor): NavTreeItem = apps.get_model('accelerator', 'NavTreeItem') urls = ['/judging/panel/', '/judging/commitments/', '/nav/judging'] nav_items = NavTreeItem.objects.filter(...
Python
0
645efb8ffcc3c9a3e41db2619430ffcb7a6d570f
Migrate Req/Ass to have verified/finished date
src/ggrc/migrations/versions/20160314140338_4fd36860d196_add_finished_date_to_request_and_.py
src/ggrc/migrations/versions/20160314140338_4fd36860d196_add_finished_date_to_request_and_.py
# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: andraz@reciprocitylabs.com # Maintained By: andraz@reciprocitylabs.com """ add finished date to request and assessment Create Date: 2016-03-14 14:...
Python
0
092a8081e4fcecec0dc18c1eadcec0a46c5c73fb
add the AFL wrapper program
analysis/afl.py
analysis/afl.py
#!/usr/bin/env python import argparse import os import subprocess from multiprocessing import Process from functools import reduce MEMORY='2G' def getArch(iid): query = 'select arch from image where id=' + iid + ';' arch = dbquery(query)[0][0] if arch == 'armel': arch = 'arm' elif arch == 'mi...
Python
0
b05ab5401e716eab305625ad369ec5d362ae491a
add andromercury tool
andromercury.py
andromercury.py
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard 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,...
Python
0
bad82f3c77dbeebdc2332d193f0c8290c5186862
add rudimentary api
frontend/app.py
frontend/app.py
import os import sys import inspect import json from flask import Flask # move to top level currentdir = os.path.dirname( os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path.insert(0, parentdir) from api.reporting import Report from api.apiutils import Scope,...
Python
0.000007
37baa669ed1e00fabddd33478fa75f4047075ce3
Create Python object detection script.
cs473vision/ObjectDetector.py
cs473vision/ObjectDetector.py
''' Created on Feb 28, 2014 @author: Vance Zuo ''' import numpy import cv2 class ObjectDetector(object): ''' classdocs ''' def __init__(self, params): ''' Constructor ''' self.bg_img = None self.fg_img = None return def load_image(self, b...
Python
0
4aacc8d55c138c405d561bbf9ddfd9ddab483e62
add wxPython example.
trypython/extlib/gui/wx01.py
trypython/extlib/gui/wx01.py
""" wxPython についてのサンプルです お決まりの Hello world について REFERENCES:: http://bit.ly/2OcHRh7 """ # noinspection PyPackageRequirements import wx from trypython.common.commoncls import SampleBase class Sample(SampleBase): def exec(self): app = wx.App() frm = wx.Frame(parent=None, title='Hello World') ...
Python
0
9566d71a267015005ad937cd92bd105d2ffff274
print users with multiple matching urls
twnews/print_urls_by_user.py
twnews/print_urls_by_user.py
""" Print users who were found for multiple urls. user url1 score1 url2 score2 ... """ import codecs from collections import defaultdict import json import sys from . import __data__ sys.stdout = codecs.getwriter('utf8')(sys.stdout) def print_urls_by_user(tweets_file=__data__ + '/tweets.json'): user2urls = def...
Python
0.000006
bc9c057d57d4dbc2e3c70eaf3ac182df2b334107
fix bluffing again
player.py
player.py
import logging import card as c class Player(object): """ This class represents a player. It is basically a doubly-linked ring list with the option to reverse the direction. On initialization, it will connect itself to a game and its other players by placing itself behind the current player. ...
import logging import card as c class Player(object): """ This class represents a player. It is basically a doubly-linked ring list with the option to reverse the direction. On initialization, it will connect itself to a game and its other players by placing itself behind the current player. ...
Python
0.000009
e5627134d9a2c052a523f66a2ec9867b3432fae2
Test Issue #461: ent_iob tag incorrect after setting entities.
spacy/tests/tokens/test_add_entities.py
spacy/tests/tokens/test_add_entities.py
from __future__ import unicode_literals import spacy from spacy.vocab import Vocab from spacy.matcher import Matcher from spacy.tokens.doc import Doc from spacy.attrs import * from spacy.pipeline import EntityRecognizer import pytest @pytest.fixture(scope="module") def en_vocab(): return spacy.get_lang_class('en...
Python
0
7cee0980a67b827e4cf06c15e0f1c3b412f68c22
Create main.py to actually perform the test
main.py
main.py
import io import argparse def initialize_argument_parser(): parser = argparse.ArgumentParser(description='Simulate Indian health solutions') parser.add_argument('-s', '--solution', dest='solution', help='the solution to test', default='health kiosk') return vars(parser.parse_args()) if __name...
Python
0
233c7f0152a05afcef62b596f7c90abe7e9eec90
add a base pipeline for converting json to bigquery
pipeline/flatten_json.py
pipeline/flatten_json.py
"""Beam pipeline for converting json scan files into bigquery tables.""" from __future__ import absolute_import import argparse import json import logging from pprint import pprint import apache_beam as beam from apache_beam.io import ReadFromText from apache_beam.io.gcp.internal.clients import bigquery from apache_...
Python
0.000001
361c3496274a960c5e927899a39618f8fee9db0a
Add Basic Trellis Histogram to Examples
altair/vegalite/v2/examples/trellis_histogram.py
altair/vegalite/v2/examples/trellis_histogram.py
""" Trellis Histogram ----------------- This example shows how to make a basic trellis histogram. https://vega.github.io/vega-lite/examples/trellis_bar_histogram.html """ import altair as alt cars = alt.load_dataset('cars') chart = alt.Chart(cars).mark_bar().encode( x=alt.X("Horsepower", type="quantit...
Python
0
a7e8b3a2b63ed4717a783754446b30c4f288e76a
Create channelinfo.py
cogs/channelinfo.py
cogs/channelinfo.py
import discord from discord.ext import commands from random import randint, choice class Channelinfo: """Shows Channel infos.""" def __init__(self, bot): self.bot = bot @commands.command(aliases=['channel', 'cinfo', 'ci'], pass_context=True, no_pm=True) async def channelinfo(self, ctx, *, chan...
Python
0
333453fe6a74d7bada941ee7aeed3660452efcaf
add tests
tests/install_tests/test_cupy_builder/test_command.py
tests/install_tests/test_cupy_builder/test_command.py
from cupy_builder._command import filter_files_by_extension def test_filter_files_by_extension(): sources_cpp = ['a.cpp', 'b.cpp'] sources_pyx = ['c.pyx'] sources = sources_cpp + sources_pyx assert filter_files_by_extension( sources, '.cpp') == (sources_cpp, sources_pyx) assert filter_file...
Python
0
8a7963644ff470fc7da8bc22a7f3fd6ef1be3ed2
define password generator.
rio/utils/token.py
rio/utils/token.py
# -*- coding: utf-8 -*- """ rio.utils.token ~~~~~~~~~~~~~~~ """ import random import string def password_generator(length): """Generate a random password. :param length: integer. """ return ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(length))
Python
0.000001
1d4397860ffd297eb02b5f4b96b0e18a3c7e12cd
Add test recipes.
badgify/tests/recipes.py
badgify/tests/recipes.py
# -*- coding: utf-8 -*- from ..recipe import BaseRecipe from ..compat import get_user_model class BadRecipe(object): pass class NotImplementedRecipe(BaseRecipe): pass class Recipe1(BaseRecipe): name = 'Recipe 1' slug = 'recipe1' description = 'Recipe 1 description' @property def image...
Python
0
f6c07ad620f7e3ef73fdad5f2d97d1dd911e390f
Create signal.py
signal.py
signal.py
#!/usr/bin/python3 # Send via Signal import os from pydbus import SystemBus from dateutil import parser from datetime import datetime eventhostname=os.environ.get ("NOTIFY_HOSTNAME", "<no host>") eventdatetimeString=os.environ.get ("NOTIFY_LONGDATETIME", "<no time>") if eventdatetimeString == "<no time>": eventda...
Python
0.000002
269e9821a52f1d68e2a48beb76b20c227dc84b55
add 0007(count one file omitting multiple-line comment)
robot527/0007/count_codes.py
robot527/0007/count_codes.py
#! usr/bin/python3 """ 第 0007 题:有个目录,里面是你自己写过的程序,统计一下你写过多少行代码。 包括空行和注释,但是要分别列出来。 """ class PyfileInfo: def __init__(self, file): self.file_name = file self.total_line_num = 0 self.blank_line_num = 0 self.comment_line_num = 0 def count_lines(self): if self.file_...
Python
0
74d8390dce4dd5a8fe8a6f7f4304b80afadfec1d
Add basic calendar framework
app/calender.py
app/calender.py
class CalenderManager: def __init__(self): pass def add_event(self, user, starttime, endtime): pass def get_current_event(self): #Return NONE if no event pass def remove_event(self, id): pass def get_upcoming_events(self, num): pass
Python
0.000002
93a03023cf0c73b78680d431c828f4b9ebc49802
add disk_cache.py
3.下载缓存/3.disk_cache.py
3.下载缓存/3.disk_cache.py
#!/usr/bin/env python # coding:utf-8 import os import re import zlib import shutil import urlparse import cPickle as pickle from datetime import datetime, timedelta from link_crawler import link_crawler class DiskCache: """通过使用磁盘空间保存文件的方式对资源文件进行缓存 """ def __init__(self, cache_dir='cache', expires=timede...
Python
0.000002
b0be4dfb0fa13bb708cfe3aaa9c1f576dd5ccaa6
Add initial EDID parser
src/edider/parser.py
src/edider/parser.py
#!/usr/bin/env python3 from itertools import zip_longest from collections import namedtuple import string import struct def grouper(iterable, n, fillvalue=None): "Collect data into fixed-length chunks or blocks" # grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx" args = [iter(iterable)] * n return zip_longe...
Python
0.000001
9c33c1e7fcaf111e7a590b035974aa288bbe5895
Create weechat script
czar.py
czar.py
SCRIPT_NAME = 'czar' SCRIPT_AUTHOR = 'Samuel Damashek <samuel.damashek@gmail.com>' SCRIPT_VERSION = '1.0' SCRIPT_LICENSE = 'GPL3' SCRIPT_DESC = 'Run czar commands natively in WeeChat' SCRIPT_COMMAND = 'czar' try: import weechat except ImportError: print('This script must be run under WeeChat.') print('Get ...
Python
0
23086155315b39e814a1a73b49c80b19cbdb8e12
476. Number Complement
p476.py
p476.py
import unittest class Solution(object): def findComplement(self, num): """ :type num: int :rtype: int """ mask = num mask |= mask >> 1 mask |= mask >> 2 mask |= mask >> 4 mask |= mask >> 8 mask |= mask >> 16 return num ^ mask ...
Python
0.999999
af19c62cfa27f27cd37bf558ac77a7845dff7754
Create generate_chapters.py
sandbox/generate_chapters.py
sandbox/generate_chapters.py
@language python VOLUME = 'II' TOTAL_CHAPTERS = 42 URL = "http://www.feynmanlectures.caltech.edu/{0}_{1:02}.html" copied_position = p.copy() for index in range(1, TOTAL_CHAPTERS+1): new_node = copied_position.insertAsLastChild() new_node.h = "@chapter {0} Chapter {1:02} - ".format(VOLUME, index) new_node...
Python
0.000009
48115d48da43f7f4517d8f55edee95d6c9e7cc45
Create saveGraphToFile.py
save-load/saveGraphToFile.py
save-load/saveGraphToFile.py
from py2neo import Graph, Node, Relationship graph = Graph() # Get username usr_name = input("Enter username: ") print ("Username: " + usr_name) # Get user_id usr_id = input("Enter user id: ") print ("User id: " + usr_id) print("Nodes") resultsAllNodes = graph.cypher.execute("MATCH (n) RETURN n") print(resultsAllNode...
Python
0.000001
34fff4bf13fa2c4d481a06339981db08239138ae
add test case of petitlyrics
lyric_engine/tests/test_petitlyrics.py
lyric_engine/tests/test_petitlyrics.py
# coding: utf-8 import os import sys module_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'modules') sys.path.append(module_dir) import unittest from petitlyrics import PetitLyrics as Lyric class PetitLyricsTest(unittest.TestCase): def test_url_01(self): url = 'http://petitlyrics.c...
Python
0.002379
16fd4ba06b6da8ec33a83a8cfe2e38a130fb47b3
Add a module for common plotting routines that will be used.
plot.py
plot.py
#!/usr/bin/env python """ plot.py State Estimation and Analysis for PYthon Module with plotting utilities Written by Brian Powell on 10/18/13 Copyright (c)2013 University of Hawaii under the BSD-License. """ from __future__ import print_function import numpy as np from scipy import ndimage import os imp...
Python
0
cbbc6d943ebc4f7e1efa84f2c0b5d976de21101d
Add "imported from" source using a hardcoded list of items
scripts/claimit.py
scripts/claimit.py
# -*- coding: utf-8 -*- """ Copyright (C) 2013 Legoktm Copyright (C) 2013 Pywikipediabot team Distributed under the MIT License Usage: python claimit.py [pagegenerators] P1 Q2 P123 Q456 You can use any typical pagegenerator to provide with a list of pages Then list the property-->target pairs to add. """ import py...
# -*- coding: utf-8 -*- """ Copyright (C) 2013 Legoktm Copyright (C) 2013 Pywikipediabot team Distributed under the MIT License Usage: python claimit.py [pagegenerators] P1 Q2 P123 Q456 You can use any typical pagegenerator to provide with a list of pages Then list the property-->target pairs to add. """ import py...
Python
0.000051
a57fcbd436780adfaacfefb426b53458c65e1012
Create pubnubStreamUnlimited.py
pubnubStreamUnlimited.py
pubnubStreamUnlimited.py
from pubnub.callbacks import SubscribeCallback from pubnub.enums import PNStatusCategory from pubnub.pnconfiguration import PNConfiguration from pubnub.pubnub import PubNub from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream import json # Variables that contains the us...
Python
0.000001
dcca5e257336b7c28568c1a0535d4c3520836e8b
Create serializekiller.py
serializekiller.py
serializekiller.py
#!/usr/bin/env python #------------------------------------------------------------------------------- # Name: SerializeKiller # Purpose: Finding vulnerable vulnerable servers # # Author: (c) John de Kroon, 2015 #------------------------------------------------------------------------------- import os ...
Python
0.000044
94d40dfcf574d61df7def99a43d5b9fa0c75e244
Add py solution for 406. Queue Reconstruction by Height
py/queue-reconstruction-by-height.py
py/queue-reconstruction-by-height.py
from collections import defaultdict class Solution(object): def insert(self, now, p, front): lsize = 0 if now.left is None else now.left.val[1] if front <= lsize: if now.left is None: now.left = TreeNode((p, 1)) else: self.insert(now.left, p, f...
Python
0.000749
8fb97711dd84512a8a654de3dca2bee24689a2a7
add a test for pytestmark
pytest_tornado/test/test_fixtures.py
pytest_tornado/test/test_fixtures.py
import pytest from tornado import gen _used_fixture = False @gen.coroutine def dummy(io_loop): yield gen.Task(io_loop.add_callback) raise gen.Return(True) @pytest.fixture(scope='module') def preparations(): global _used_fixture _used_fixture = True pytestmark = pytest.mark.usefixtures('preparatio...
Python
0.000008
76ce9117ed92a743734cd5ba7e209617a7664ad1
Add partial benchmarking file for gala
benchmarks/bench_gala.py
benchmarks/bench_gala.py
import os from gala import imio, features, agglo, classify rundir = os.path.dirname(__file__) dd = os.path.abspath(os.path.join(rundir, '../tests/example-data')) em3d = features.default.paper_em() def setup_trdata(): wstr = imio.read_h5_stack(os.path.join(dd, 'train-ws.lzf.h5')) prtr = imio.read_h5_stack...
Python
0
79fb9449da73e70ef7ed9e1e6862da41fc42ab75
Add finalized source codes
src/hw1.py
src/hw1.py
import networkx as nx import numpy as np import matplotlib.pyplot as plt import pylab G = nx.Graph() G.add_edges_from([('1','2'),('1','4'),('2','3'),('2','4'),('3','4'),('4','5'),('5','6'),('5','7'),('6','7')]) # create the graph print G.nodes(), '\n', G.edges(), '\n', G.degree().values() # check graph is correct ...
Python
0.000002
180faadb24bf3b4d153f1c46c4883bdcc0b987ff
add a manifest (.cvmfspublished) abstraction class
python/cvmfs/manifest.py
python/cvmfs/manifest.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created by René Meusel This file is part of the CernVM File System auxiliary tools. """ import datetime class UnknownManifestField: def __init__(self, key_char): self.key_char = key_char def __str__(self): return self.key_char class ManifestV...
Python
0.000001
e044dceeb4f6dd91a1e29228cde7906a114f36ba
add ping-listener.py
src/ping-listener.py
src/ping-listener.py
#!/usr/bin/python # This tool is for educational use only! # Description: Listen on a networkinterface for incomming pings (ICMP packets) # and display this pings on the console # Requirements: scapy + root privileges import sys from scapy.all import * from pprint import * def printusage(): """ Prints usage info...
Python
0
a2dd80d7bcd1096b554c43d085eabe1eb858fec8
Add code to create test data
code/make_test_data.py
code/make_test_data.py
from __future__ import absolute_import, division, print_function import nibabel as nib import numpy as np import os # Paths to directories containing the test subject's data path_data = "../data/ds005/testsub/" path_BOLD = path_data + "BOLD/task001_testrun/bold.nii.gz" path_behav = path_data + "behav/task001_testrun/...
Python
0.000001
f2fb5fc41c78ac7722812aa1cdb54078bcbc70fe
Add Node test cases
coil/test/test_node.py
coil/test/test_node.py
"""Tests for coil.struct.Node""" import unittest from coil import errors from coil.struct import Node class BasicTestCase(unittest.TestCase): def testInit(self): r = Node() a = Node(r, "a") b = Node(a, "b") self.assertEquals(b.node_name, "b") self.assertEquals(b.node_path,...
Python
0.000001
942b7c519a07a84c7f26077b78c23c60174e1141
Add VCF precalculator
scripts/precalc.py
scripts/precalc.py
# -*- coding: utf-8 -*- ''' Earth Engine precalculator for CLASlite Requires Python 2.6+ Public Domain where allowed, otherwise: Copyright 2010 Michael Geary - http://mg.to/ Use under MIT, GPL, or any Open Source license: http://www.opensource.org/licenses/ ''' import cgi, json, os, sys, time, urllib2 sys.pat...
Python
0.000001
8b9a8f6443c1a5e184ececa4ec03baabca0973de
Add support for Pocket
services/pocket.py
services/pocket.py
from werkzeug.urls import url_decode import requests import foauth.providers class Pocket(foauth.providers.OAuth2): # General info about the provider provider_url = 'http://getpocket.com/' docs_url = 'http://getpocket.com/developer/docs/overview' category = 'News' # URLs to interact with the API ...
Python
0
8244d71a41032e41bd79741ec649fa78c6317efa
add mixins for tweaking smartmin behavior more easily
smartmin/mixins.py
smartmin/mixins.py
# simple mixins that keep you from writing so much code class PassRequestToFormMixin(object): def get_form_kwargs(self): kwargs = super(PassRequestToFormMixin, self).get_form_kwargs() kwargs['request'] = self.request return kwargs
Python
0
32dd2099f97add61cb31df7af796876a95695bb1
Add a sample permission plugin for illustrating the check on realm resources, related to #6211.
sample-plugins/public_wiki_policy.py
sample-plugins/public_wiki_policy.py
from fnmatch import fnmatchcase from trac.config import Option from trac.core import * from trac.perm import IPermissionPolicy class PublicWikiPolicy(Component): """Sample permission policy plugin illustrating how to check permission on realms. Don't forget to integrate that plugin in the appropriate pl...
Python
0.000003
1c39eb113be409ff304a675ef8a85e96a97b1d87
Add files via upload
basicTwitter.py
basicTwitter.py
''' RIT SPEX: Twitter posting basic. Basic python script for posting to twitter. Pre-Req: Python3 Tweepy library twitter Contributors: Evan Putnam Henry Yaeger John LeBrun Helen O'Connell ''' import tweepy #Tweet a picutre def tweetPicture(api ,picUrl): api.update_with_media(picUrl) ...
Python
0
eb170653e64c5a874a773dc37c99dccb4dd42608
Add tools.color module (#41, #36))
xentica/tools/color.py
xentica/tools/color.py
"""A collection of color conversion helpers.""" def hsv2rgb(hue, sat, val): """ Convert HSV color to RGB format. :param hue: Hue value [0, 1] :param sat: Saturation value [0, 1] :param val: Brightness value [0, 1] :returns: tuple (red, green, blue) """ raise NotImplementedError de...
Python
0
1d5f1576a5f92c1917fa29c457e4b7ad055f41ca
Add info for mono@5.4.0.167 (#5405)
var/spack/repos/builtin/packages/mono/package.py
var/spack/repos/builtin/packages/mono/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-6...
############################################################################### # 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-6...
Python
0
d03edd6670c130925fa8b947ebde03f2026602c3
remove redundant verbose prints
dj/scripts/mk_public.py
dj/scripts/mk_public.py
#!/usr/bin/python # mk_public.py - flip state on hosts from private to public # private = not listed, can be seen if you know the url # the presenters have been emaild the URL, # they are encouraged to advertise it. # public = advertised, it is ready for the world to view. # It will be tweeted at @NextD...
#!/usr/bin/python # mk_public.py - flip state on hosts from private to public # private = not listed, can be seen if you know the url # the presenters have been emaild the URL, # they are encouraged to advertise it. # public = advertised, it is ready for the world to view. # It will be tweeted at @NextD...
Python
0.956212
197fb6ec004c0bf47ec7e2fd25b75564a3ecf6c4
Add tests for logging of rest requests
test/audit_logs/test_audit_log.py
test/audit_logs/test_audit_log.py
import datetime import pytest from girder import auditLogger @pytest.fixture def recordModel(): from girder.plugins.audit_logs import Record yield Record() @pytest.fixture def resetLog(): yield auditLogger for handler in auditLogger.handlers: auditLogger.removeHandler(handler) @pytest.mar...
Python
0
9e96a7ff9ad715f58d07341bd571e63ef233ffdb
Create fizzbuzz.py
job_interview_algs/fizzbuzz.py
job_interview_algs/fizzbuzz.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- ''' Created on 24 02 2016 @author: vlad ''' def multiple_of_3(number): return number % 3 == 0 def multiple_of_5(number): return number % 5 == 0 for i in range(1, 100): if not multiple_of_3(i) and not multiple_of_5(i): print i continue ...
Python
0.00001
8089750d5dccadb0603068eefec869df4f8360cc
Add fizzbuzz.py in strings folder
strings/fizzbuzz.py
strings/fizzbuzz.py
""" Wtite a function that returns an array containing the numbers from 1 to N, where N is the parametered value. N will never be less than 1. Replace certain values however if any of the following conditions are met: If the value is a multiple of 3: use the value 'Fizz' instead If the value is a multiple of 5: use t...
Python
0.000001
9ea3c14983c7b2e32132f1ffe6bbbe7b4d19000c
Add Flyweight.py
Python/Flyweight/Flyweight.py
Python/Flyweight/Flyweight.py
#! /usr/bin/python # -*- coding: utf-8 -*- ''' Flyweight Pattern Author: Kei Nakata Data: Oct.14.2014 ''' class FlyweightFactory(object): def __init__(self): self.instances = dict() def getInstance(self, a, b): if (a, b) not in self.instances: self.instances[(a,b)] = Flyweight(a, b...
Python
0.000005
868a771e0ba049edd55ddf38db852c4d34824297
Add pod env tests
tests/test_spawner/test_pod_environment.py
tests/test_spawner/test_pod_environment.py
from unittest import TestCase from scheduler.spawners.templates.pod_environment import ( get_affinity, get_node_selector, get_tolerations ) class TestPodEnvironment(TestCase): def test_pod_affinity(self): assert get_affinity(None, None) is None assert get_affinity({'foo': 'bar'}, None...
Python
0
d5b95c31cb50762a6aee1b460b377a200b34e249
Create createCW_readtxt.py
createCW_readtxt.py
createCW_readtxt.py
def readtext(f): with open(f.loc,encoding="ISO-8859-1") as k: content = k.read().splitlines() i=0 width=0 height=0 acc=0 across=[] dwn=0 down=[] solnblock=[] title="" author="" cpyrt="" notes="" Encoding_2 = "ISO-8859-1" while(content[i]!="<TITLE>"): ...
Python
0.000004
9ea17a6d3eb5f9af246be964651f5bef522f2d95
Map out the TrustChain data structure
src/trustchain.py
src/trustchain.py
class TrustChain: """ Node maintains one TrustChain object and interacts with it either in in the reactor process or some other process. If it's the latter, there needs to be some communication mechanism. type System = Map<Node, Chain>; // height (sequence number) should match the index type C...
Python
0.999389
1c1e933fa9c6af1aa9d73f276ac7b79c2b86bdc3
add svn-clean-external-file.py
scripts/svn-clean-external-file.py
scripts/svn-clean-external-file.py
# written by Thomas Watnedal # http://stackoverflow.com/questions/239340/automatically-remove-subversion-unversioned-files import os import re def removeall(path): if not os.path.isdir(path): os.remove(path) return files=os.listdir(path) for x in files: fullpath=os.path.join(path, ...
Python
0.000002
3ef1e39d476a8b3e41ff0b06dcd6f700c083682d
Add an ABC for all sub classes of `DataController`
data_controller/abc.py
data_controller/abc.py
from typing import Dict, Optional from data_controller.enums import Medium, Site from utils.helpers import await_func class DataController: """ An ABC for all classes that deals with database read write. """ __slots__ = () def get_identifier(self, query: str, medium: Mediu...
Python
0.000003
2ce67897ade1ce8ae8b0fd00671fe61f4164a2bc
Add missing migration
oidc_apis/migrations/0002_add_multiselect_field_ad_groups_option.py
oidc_apis/migrations/0002_add_multiselect_field_ad_groups_option.py
# Generated by Django 2.0.9 on 2018-10-15 08:08 from django.db import migrations import multiselectfield.db.fields class Migration(migrations.Migration): dependencies = [ ('oidc_apis', '0001_initial'), ] operations = [ migrations.AlterField( model_name='api', nam...
Python
0.0002
785a5767ee3482fddee37327b4bf3edeed94ff46
Add shootout attempt item definition
db/shootout_attempt.py
db/shootout_attempt.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import uuid from db.common import Base from db.specific_event import SpecificEvent from db.player import Player from db.team import Team class ShootoutAttempt(Base, SpecificEvent): __tablename__ = 'shootout_attempts' __autoload__ = True STANDARD_ATTRS = [ ...
Python
0
1dcf698a286dcdf0f2c5a70d3e9bb2b32d046604
add TestBEvents, currently skipped
tests/unit/Events/test_BEvents.py
tests/unit/Events/test_BEvents.py
from AlphaTwirl.Events import BEvents as Events from AlphaTwirl.Events import Branch import unittest import ROOT ##____________________________________________________________________________|| inputPath = '/Users/sakuma/work/cms/c150130_RA1_data/c150130_01_PHYS14/20150331_SingleMu/TTJets/treeProducerSusyAlphaT/tree.r...
Python
0
05a8129787d32bb605fee9b85c1c11e8c582c43e
Add messages utility tests
tests/unit/utils/test_messages.py
tests/unit/utils/test_messages.py
import mock import sys import unittest from bin.commands.utils import messages class TestMessages(unittest.TestCase): def setUp(self): # store private methods so they can be restored after tests that mock them self._print = messages._print def tearDown(self): messages._print = self....
Python
0
adf65027521124ea89e9c6c5ee2baf7366b2da46
Add example settings file for makam extractors
compmusic/extractors/makam/settings.example.py
compmusic/extractors/makam/settings.example.py
token = "" # Dunya API Token
Python
0
9722bc3fc0a3cf8c95e91571b4b085e07e5a124c
Create 6kyu_message_from_aliens.py
Solutions/6kyu/6kyu_message_from_aliens.py
Solutions/6kyu/6kyu_message_from_aliens.py
import re from collections import Counter d={ '|-|':'h', '[-':'e', '()':'o', '3]':'b', '_|':'l', '|':'i', '^|':'p', '/`':'y', ')(':'o', '?/':'r', '\/':'a', '|\|':'n', '</':'k', '~|~':'t', '=/':'f', ')|':'d', '|_|':'u', '(':'c', '-[':'e', '~\_':'s', '-[':'e', ']3':'b', '_/~':'z', '/\\/\\':'w', '<>':'x', '/\\':'v', '|/\...
Python
0.000027
125c75ea246c2d95f0addbb31b2d82dde588f21d
Add a unit test for KaggleKernelCredentials.
tests/test_kaggle_kernel_credentials.py
tests/test_kaggle_kernel_credentials.py
import unittest from kaggle_secrets import GcpTarget from kaggle_gcp import KaggleKernelCredentials class TestKaggleKernelCredentials(unittest.TestCase): def test_default_target(self): creds = KaggleKernelCredentials() self.assertEqual(GcpTarget.BIGQUERY, creds.target)
Python
0
5e7f29a66e440e440b1f7a4848d17bb7ae01139b
Update from template.
ci/bootstrap.py
ci/bootstrap.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals import os import sys from os.path import exists from os.path import join if __name__ == "__main__": base_path = join(".tox", "configure") if sys.platform == "win32": bin_path = join(...
Python
0
db76495b4f41021e2613d79b6f5cb30c96fb4290
Add PriorityStore and PriorityItem
desmod/prioritystore.py
desmod/prioritystore.py
from collections import namedtuple from heapq import heappush, heappop from simpy import Store class PriorityItem(namedtuple('PriorityItem', 'priority item')): def __lt__(self, other): return self.priority < other.priority class PriorityStore(Store): def _do_put(self, event): if len(self.it...
Python
0
c74170968b3a200f17af083f027fe3b657cf6041
Add giveup function (#12)
singer/requests.py
singer/requests.py
def giveup_on_http_4xx_except_429(error): response = error.response if response is None: return False return not (response.status_code == 429 or response.status_code >= 500)
Python
0
b59745e72a3c0a98da517f00e95fbafcff0cee3d
Remove unnecessary import.
tests/test_charts_snep_input.py
tests/test_charts_snep_input.py
from __future__ import unicode_literals, division, absolute_import from tests import FlexGetBase, use_vcr class TestChartsSnepInput(FlexGetBase): __yaml__ = """ tasks: test: charts_snep_input: radio """ @use_vcr def test_input(self): self.execute_task('test') ...
Python
0
f8f28580df477ec353e5faf7b1da2404c3691a7f
test ddns module
tests/unit/modules/ddns_test.py
tests/unit/modules/ddns_test.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Rupesh Tare <rupesht@saltstack.com>` ''' # Import Salt Testing Libs from salttesting import TestCase, skipIf from salttesting.mock import ( mock_open, MagicMock, patch, NO_MOCK, NO_MOCK_REASON ) # Import Salt Libs from salt.modules import ddns ...
Python
0
ce01cc61ea62c717503d991826e6b9915b23900b
Fix usage print
check-bugs.py
check-bugs.py
#!/usr/bin/python import sys import re import pprint import collections Head = collections.namedtuple("Head", "file line") def parse(pn): ans = collections.defaultdict(str) head = None for l in open(pn): # ignore comments if l.startswith("#"): continue # found a head...
#!/usr/bin/python import sys import re import pprint import collections Head = collections.namedtuple("Head", "file line") def parse(pn): ans = collections.defaultdict(str) head = None for l in open(pn): # ignore comments if l.startswith("#"): continue # found a head...
Python
0.000255
d6fa7713556582bab54efc3ba53d27b411d8e23c
update import statements
tamil/__init__.py
tamil/__init__.py
# -*- coding: utf-8 -*- # # (C) 2013 Muthiah Annamalai <ezhillang@gmail.com> # Library provides various encoding services for Tamil libraries # import utf8 import tscii import txt2unicode import txt2ipa def printchar( letters ): for c in letters: print(c, u"\\u%04x"%ord(c)) P = lambda x: u" ".join(x)
# -*- coding: utf-8 -*- # # (C) 2013 Muthiah Annamalai <ezhillang@gmail.com> # Library provides various encoding services for Tamil libraries # from . import utf8 from . import tscii from . import txt2unicode from . import txt2ipa def printchar( letters ): for c in letters: print(c, u"\\u%04x"%ord(c)) ...
Python
0
97a8c8c2baffdeaf6b710cf875d2f8641b999338
Create adapter_16mers.py
select_random_subset/adapter_16mers.py
select_random_subset/adapter_16mers.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sat Oct 21 14:15:18 2017 @author: nikka.keivanfar """ #see also: adapters.fa P5 = 'AATGATACGGCGACCACCGA' P7 = 'CAAGCAGAAGACGGCATACGAGAT' read1 = 'GATCTACACTCTTTCCCTACACGACGCTC' read2 = 'GTGACTGGAGTTCAGACGTGT' adapters = [P5, P7, read1, read2] #to do: s...
Python
0.000001
7c6d3e65b21431e61093b76d52efb9af68ae5f36
initialize final model
code/final.py
code/final.py
# # Test set predictions using best final model (using all training data) from sklearn.model_selection import TimeSeriesSplit, train_test_split from keras.utils.visualize_util import plot from keras.models import Sequential from keras.layers import GRU, Dense, Masking, Dropout, Activation from keras.callbacks import E...
Python
0.000016
faf10aa246414e4f5be735da6b1c058ec7d546b9
remove like indexes from smsbillables
corehq/apps/smsbillables/migrations/0011_remove_like_indexes.py
corehq/apps/smsbillables/migrations/0011_remove_like_indexes.py
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): db.execute("DROP INDEX IF EXISTS smsbillables_smsbillable_direction_like") db.execute("DROP INDEX IF EXISTS smsbill...
Python
0.000097
b405264320f258d4ea41cf32ef5f4956faa82f3f
Add subfigure
sphinxpp/subfig.py
sphinxpp/subfig.py
""" Adds subfigure functionality """ from docutils import nodes import docutils.parsers.rst.directives as directives from sphinx.util.compat import Directive from sphinx import addnodes class subfig(nodes.General, nodes.Element): pass def skip_visit(self, node): raise nodes.SkipNode def visit_subfig_tex(sel...
Python
0.000002
cfabe41b0d2f0cea143360fa1610baaaa87f8946
add python wrapper for network builder
side_project/network_builder/MNM_nb.py
side_project/network_builder/MNM_nb.py
import os import numpy as np import networkx as nx DLINK_ENUM = ['CTM', 'LQ', 'LTM', 'PQ'] DNODE_ENUM = ['FWJ', 'GRJ', 'DMOND', 'DMDND'] class MNM_dlink(): def __init__(self): self.ID = None self.len = None self.typ = None self.ffs = None self.cap = None self.rhoj = None self.lanes = No...
Python
0.000001
8a4931dd810079c1f78858c5058df74b0e696f72
Correct IrFilters_eval_domain when the third item starts with 'object.'
smile_action_rule/models/ir_filters.py
smile_action_rule/models/ir_filters.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2014 Smile (<http://www.smile.fr>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Aff...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2014 Smile (<http://www.smile.fr>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Aff...
Python
0
ca043c2d3fe5fbdd37f372e8a3ad8bfd1b501c89
Correct Workitem._execute monkeypatch
smile_action_rule/workflow/workitem.py
smile_action_rule/workflow/workitem.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2014 Smile (<http://www.smile.fr>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Aff...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2014 Smile (<http://www.smile.fr>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Aff...
Python
0.000004
107e33ab3982f3f7fb56a1a2ac2b0eec0b67091b
Use universal newlines in gyp_helper.
build/gyp_helper.py
build/gyp_helper.py
# Copyright (c) 2012 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. # This file helps gyp_chromium and landmines correctly set up the gyp # environment from chromium.gyp_env on disk import os SCRIPT_DIR = os.path.dirnam...
# Copyright (c) 2012 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. # This file helps gyp_chromium and landmines correctly set up the gyp # environment from chromium.gyp_env on disk import os SCRIPT_DIR = os.path.dirnam...
Python
0.000007
e6b9b471dba3d7ef0bac94454136b07ef3247093
Add 'tools/translation/' from commit '83e3aa43dd35a8c0ef0658303806e355204c7100'
tools/translation/nb_code_sync.py
tools/translation/nb_code_sync.py
#!/usr/bin/env python3 # Copyright 2019 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 # # Unl...
Python
0.000036
fbbaa3fc5b99eed88e039c232f129aaeab0a6f54
Bring table test coverage to 100%
tests/test_table.py
tests/test_table.py
#!/usr/bin/env python3 import nose.tools as nose from table import Table def test_init_default(): """should initialize table with required parameters and default values""" table = Table(num_cols=5, width=78) nose.assert_equal(table.num_cols, 5) nose.assert_equal(table.width, 78) nose.assert_equal...
Python
0
f392a90ae12a5f9aab04b22e82d493d0f93db9fd
Add first test
tests/test_utils.py
tests/test_utils.py
def test_ok(): assert True
Python
0.000029
e56a9781f4e7e8042c29c9e54966659c87c5c05c
Add a test for our more general views.
tests/test_views.py
tests/test_views.py
import pytest from django.core.urlresolvers import reverse def test_site_view(client): response = client.get(reverse('site-home')) assert response.status_code == 200 assert 'landings/home_site.html' in [template.name for template in response.templates]
Python
0
675b7fc917b5f99120ca4d6dcb79b3e821dbe72a
add Olin specific script
downloadOlin.py
downloadOlin.py
import os from downloadMailmanArchives import main class Struct: def __init__(self, **entries): self.__dict__.update(entries) if __name__ == '__main__': args = { 'archive_root_url': ['https://lists.olin.edu/mailman/private/carpediem/', 'https://lists.olin.edu/mailman/private/helpme/'], 'passwo...
Python
0
53e0bb6c88d64cd1ee1717e19f51c8aed1ba5cdd
implement expect column values valid MBTI (#4702)
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_mbti.py
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_mbti.py
import re from typing import Optional from great_expectations.core.expectation_configuration import ExpectationConfiguration from great_expectations.execution_engine import PandasExecutionEngine from great_expectations.expectations.expectation import ColumnMapExpectation from great_expectations.expectations.metr...
Python
0.000109
a46f0a709747dbe90f0495e7e6b12c7b511baa7f
Delete duplicate wapp images
dupe_deleter.py
dupe_deleter.py
""" # Install QPython3 for android # https://github.com/qpython-android/qpython3/releases # Execute the below script in QPython3 """ import os, hashlib from operator import itemgetter from itertools import groupby image_list = [] folder_list = [r'/storage/emulated/0/whatsapp/media/whatsapp images/', r'...
Python
0.000001
9f4452983e38d002e141ed0d2a9c865656a553ce
add todo stuff
main.py
main.py
#!/usr/bin/env python # __author__ = 'Dmitry Shihaleev' # __version__= '0.2' # __email__ = 'padavankun@gmail.com' # __license__ = 'MIT License'
Python
0
ab7c0d05a6bcf8be83409ccd96f2ed4a6fe65a73
Create main.py
main.py
main.py
#!/usr/bin/env python3 import sys import socket import string HOST = "chat.freenode.net" # You can change this to whatever you want PORT = 6667 NICK = "Your Nick Name" IDENT = "Your Identity" REALNAME = "Your REAL Name" MASTER = "The Master of this particular Slave" CHANNEL = "The Channel To join" readbuffer = "" ...
Python
0
12490fa92e54becca77c70d124d807b19d71afa1
Create main.py
main.py
main.py
# waypointviewer.py Waypoint Viewer Google Maps/Google AppEngine application # Copyright (C) 2011 Tom Payne # # 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 versi...
Python
0.000001
7e4cfdbdb6bcfd385bcbf9ddcca99b4e9800efaf
Create musy.py
musy.py
musy.py
import os def crear_carpeta(carpeta): if not os.path.exists(carpeta): os.makedirs(carpeta) def generar_datos_post(plantilla,post): return (plantilla.replace("*t",post["titulo"]) .replace("*d",post["resumen"]) .replace("*e",post["enlace"]) .replace("*c",post["contenido"]) ) def gr...
Python
0.000001
34847fbe0e04a2da8957a0ba5de92856ca73c8cc
Add missing migration
osf/migrations/0054_auto_20170823_1555.py
osf/migrations/0054_auto_20170823_1555.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-08-23 20:55 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('osf', '0053_add_quickfiles'), ] operations = [ migrations.AlterField( ...
Python
0.0002
08df517cad06279120dc2ee9a4942bf86afc8323
add plot.py
plot.py
plot.py
#!/usr/bin/env python # a bar plot with errorbars import numpy as np import matplotlib.pyplot as plt import csv bar_width = 0.6 xstick_offset = 0.3 def to_float(str): return float(str.replace(',', '')) def plot_wc_time(algebras, time, std, output_name): """ Plot wall clock time """ assert len(a...
Python
0.000012
4102ab8fc24265aaee1ecbf673bec260b3b3e5df
add max sub arr impl
bioinformatics/dynamic_programming/max_sum_sub_arr1.py
bioinformatics/dynamic_programming/max_sum_sub_arr1.py
def max_sum_sub_arr(arr): score_vector = [0 for _ in range(len(arr))] def max_sum_sub_arr_detail(beg_idx): if beg_idx >= len(arr): return 0 elif arr[beg_idx] >= 0: score_vector[beg_idx] = arr[beg_idx] + max_sum_sub_arr_detail(beg_idx + 1) return score_vector[...
Python
0.000001
1043acdfe324e02bc2a8629ef8a47d6ae9befd7c
Add python script to get ECC608 Public Key
src/aiy/_drivers/_ecc608_pubkey.py
src/aiy/_drivers/_ecc608_pubkey.py
#!/usr/bin/env python3 import base64 import ctypes import sys CRYPTO_ADDRESS_DICT = { 'Vision Bonnet': 0x60, 'Voice Bonnet': 0x62, } class AtcaIfaceCfgLong(ctypes.Structure): _fields_ = ( ('iface_type', ctypes.c_ulong), ('devtype', ctypes.c_ulong), ('slave_address', ctypes.c_ubyte...
Python
0.000001
b04503bddfa3b0d737308ac8ecb7f06ac866e6eb
Create __init__.py
__init__.py
__init__.py
Python
0.000429
0b891e401bf0e671d3bc6f0347a456f1cc5b07b3
add __init__.py for root package
__init__.py
__init__.py
import sysdic
Python
0.000018
14f175c294ec6b5dcd75887a031386c1c9d7060d
add __main__
__main__.py
__main__.py
from . import parser import sys if len(sys.argv) == 1: print("compile yarh to html") print("usage: yarh [YARH_FILE]...") print(" yarh -- [YARH_STRING]") print(" yarh [YARH_FILE]... -- [YARH_STRING]") sys.exit(1) fromfile = True for arg in sys.argv[1:]: if arg == "--": from...
Python
0.000247
e29c8e2d55464ac765db60a5cc213bb943b60742
add [[Portal:Beer]] and [[Portal:Wine]] tagging request script
trunk/portalbeer.py
trunk/portalbeer.py
#!usr/bin/python import sys, os, re sys.path.append(os.environ['HOME'] + '/stuffs/pywiki/pywikipedia') import wikipedia as wiki site = wiki.getSite() page = 'Portal:Beer/Selected picture/' #get page list pages = [] num = 0 content = """\ {{Selected picture | image = | size = | caption = | text = | credi...
Python
0.000001
b56525d084ccbf1fe569900338f00a37e763d7dd
Add test_runtime_performance test
congress/tests/policy/test_runtime_performance.py
congress/tests/policy/test_runtime_performance.py
# Copyright (c) 2015 VMware, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
Python
0.000016
525a6d214d3f6f9731c16bbf10ed150d1fa24021
Create betweenness.py
src/betweenness.py
src/betweenness.py
''' Created on Feb 20, 2019 @author: Victor ''' from neo4j.v1 import GraphDatabase, basic_auth driver = GraphDatabase.driver("bolt://localhost") session = driver.session() query = '''CALL algo.betweenness.sampled.stream(null, null, {strategy:'random', probability:1.0, maxDepth:1, direction: 'both'}) YIELD nodeId,...
Python
0.000139