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
bf0408024d5ebaeca25d263d0d2f4f12b8a01aa5
Create configparser.py
configparser.py
configparser.py
#!/usr/bin/env python # encoding=utf-8 class IrregualrConfigParser(object): COMMENT_FLAGS = ("#", ";") def __init__(self): super(IrregualrConfigParser, self).__init__() self.__content = [] def read(self, fn_or_fp): content = [] if isinstance(fn_or_fp, file): co...
Python
0.000002
29ec4f28abf535a179e77f938092b7c20974847d
Create LSBSteg.py
LSBSteg.py
LSBSteg.py
#!/usr/bin/python # Stego Dropper For Pentesters v0.1 # Pulled from https://github.com/RobinDavid/LSB-Steganography import cv2.cv as cv import sys class SteganographyException(Exception): pass class LSBSteg(): def __init__(self, im): self.image = im self.width = im.width self.height =...
Python
0
8a7fda2acf57c135e7f401ebdd8f71c3609c0eca
Create tries.py
Python/tries.py
Python/tries.py
def make_trie(*args): trie={} for word in args: if type(word)!= str: raise TypeError("Trie work only on strings") # temp_trie and trie refer to the same dictionary object. temp_trie=trie for letter in word: # here setdefault sets the letter to {}({'y':{}}) and then returns {} to temp_trie. # So now t...
Python
0.000001
23cf747a3ff24f75d3300547f4bfdecf10c4a325
Add next traversal util function
scrapple/utils/config.py
scrapple/utils/config.py
""" scrapple.utils.config ~~~~~~~~~~~~~~~~~~~~~ Functions related to traversing the configuration file """ from __future__ import print_function def traverse_next(page, next, results): for link in page.extract_links(next['follow_link']): print("Loading page", link.url) r = results for at...
Python
0.000935
56b3cf07fff4d3794dcdbf99f6d7faa629fa243e
fix string manipulation in render_templatefile()
scrapy/utils/template.py
scrapy/utils/template.py
"""Helper functions for working with templates""" import os import re import string def render_templatefile(path, **kwargs): with open(path, 'rb') as file: raw = file.read() content = string.Template(raw).substitute(**kwargs) render_path = path[:-len('.tmpl')] if path.endswith('.tmpl') else path...
"""Helper functions for working with templates""" import os import re import string def render_templatefile(path, **kwargs): with open(path, 'rb') as file: raw = file.read() content = string.Template(raw).substitute(**kwargs) with open(path.rstrip('.tmpl'), 'wb') as file: file.write(cont...
Python
0.000007
cefdd80e7cd9e4ce007e60c08114e89a46b15de7
Truncate a protein sequence to remove signal peptide.
RemoveSignal.py
RemoveSignal.py
#!/usr/bin/python # Copyright (c) 2014 Khoa Tran. All rights reserved. from CalFord import * import argparse import sys,os import re signalFile = None configPath = "calford.conf" noSignalOutputFile = None removedSignalOutputFile = None def argsSanityCheck(): isOk = True if not os.path.isfile(signalFile): ...
Python
0
fd8b325bb6423c2f56d84006763ec8f6696a2745
Test basic paths
tests/test_draw/svg/test_paths.py
tests/test_draw/svg/test_paths.py
""" weasyprint.tests.test_draw.svg.test_paths ------------------------------------------ Test how SVG simple paths are drawn. """ from ...testing_utils import assert_no_logs from .. import assert_pixels @assert_no_logs def test_path_Hh(): assert_pixels('path_Hh', 10, 10, ''' BBBBBBBB__ ...
Python
0.000001
cc0ef22d0fb122b2c28e6004843978a0ee9e255f
Create Pinject.py
Pinject.py
Pinject.py
import socket import struct import sys from optparse import OptionParser def checksum(data): s = 0 n = len(data) % 2 for i in range(0, len(data)-n, 2): s+= ord(data[i]) + (ord(data[i+1]) << 8) if n: s+= ord(data[i+1]) while (s >> 16): s = (s & 0xFFFF) + (s >> 16) s = ~s & 0xffff return s class ip(...
Python
0
b0330c5243a326cda18a5b2d9167b0ace302bc13
Add the SolveHR.py script
SolveHR.py
SolveHR.py
#!/usr/bin/env python3 """ |-------------+----------------------------------------------------------| | TITLE | SolveHR.py | | DESCRIPTION | Fetches problem statement and initializes an answer file | | | with a template code for selected programming langu...
Python
0.000202
ec484a404752c60a7c88ae84f79b4792c777dfd4
Define ESCO ua and eu tender models
openprocurement/tender/esco/models.py
openprocurement/tender/esco/models.py
from zope.interface import implementer from schematics.types import StringType from openprocurement.api.models import ITender from openprocurement.tender.openua.models import ( Tender as BaseTenderUA, ) from openprocurement.tender.openeu.models import ( Tender as BaseTenderEU, ) @implementer(ITender) class...
Python
0
82b9a66ea826b4463d82c69ba1703eab213efe83
Add test for stack outputs
heat_integrationtests/functional/test_stack_outputs.py
heat_integrationtests/functional/test_stack_outputs.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.00006
78df4f45ea4b8c04ba8f34d8fc356345998c616b
Add TelnetServer.py under version control.
TelnetServer.py
TelnetServer.py
#!/usr/bin/env python # coding: utf-8 import socket import threading welcome_slogan = '''Welcome novice!\r\n\ Type something and hit enter to see what happens.\r\n\ Be bold!\r\n\r\n''' help_message = '''Command Description\r\n\ =============================================================\r\n\ HELP ...
Python
0
8b2eb3bece67a1eb81a6165238205b05361f2ec3
fix key case
corehq/apps/ota/tasks.py
corehq/apps/ota/tasks.py
from celery.task import task from couchdbkit.exceptions import ResourceNotFound from casexml.apps.case.xml import V1 from casexml.apps.phone.restore import RestoreConfig from corehq.apps.users.models import CommCareUser from soil import DownloadBase @task def prime_restore(domain, usernames_or_ids, version=V1, cache_...
from celery.task import task from couchdbkit.exceptions import ResourceNotFound from casexml.apps.case.xml import V1 from casexml.apps.phone.restore import RestoreConfig from corehq.apps.users.models import CommCareUser from soil import DownloadBase @task def prime_restore(domain, usernames_or_ids, version=V1, cache_...
Python
0.999689
eaeb02839913136909cccc9a99612a1eb7145b97
support state hash in ota restore if specified
corehq/apps/ota/views.py
corehq/apps/ota/views.py
from corehq.apps.users.models import CouchUser from django_digest.decorators import * from casexml.apps.phone.restore import generate_restore_response @httpdigest def restore(request, domain): """ We override restore because we have to supply our own user model (and have the domain in the url) """ ...
from corehq.apps.users.models import CouchUser from django_digest.decorators import * from casexml.apps.phone.restore import generate_restore_payload @httpdigest def restore(request, domain): """ We override restore because we have to supply our own user model (and have the domain in the url) """ ...
Python
0
dca0404e6f14194be3a5926e522bbeea375e8456
add net spider rokic's version
crawler/discount_info.py
crawler/discount_info.py
import json import requests from bs4 import BeautifulSoup DOMAIN = "" API = "http://%s/api/" % (DOMAIN) STEAMDB_SALE_URL = "https://steamdb.info/sales/?merged=true&cc=cn" headers = { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Charset': 'UTF-8,*;q=0.5', 'Accept-Enc...
Python
0
1602513f2ee508ed70ec08af90a94cf150d14189
Add grep_token_logs.py
skolo/grep_token_logs.py
skolo/grep_token_logs.py
#!/usr/bin/env python # Copyright 2018 Google LLC. # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Search the syslog on a jumphost to determine when auth tokens changed.""" import sys SYSLOG = '/var/log/syslog' WHITELIST_LINES = [ # (process-name, ...
Python
0.000297
04270ab58f88302f7b0fcd314ae29258c1c9a043
create mi matrix
data/build_probe_data.py
data/build_probe_data.py
import tensorflow.compat.v1 as tf from tqdm import tqdm from collections import defaultdict import sklearn import numpy as np import json with tf.io.gfile.GFile("gs://e2e_central/data/ml-sequences-train.tsv", 'r') as f: sequence_list = list(f) data = [] for sequence_str in tqdm(sequence_list): data.append([x...
Python
0.000001
1f40c23eedc638c1e398a23b4d12c78aff93c6da
Implement a method for the Authenticator to extract the authenticated user from the token cookie.
authenticator_test.py
authenticator_test.py
"""Unit test for the AncientAuth authenticator class.""" from datetime import datetime from Crypto.PublicKey.RSA import importKey import authenticator import calendar import token_cookie import token_pb2 import unittest _TEST_KEY = """-----BEGIN PRIVATE KEY----- MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMgTw...
Python
0
417ff63118c967205ee630c5183b19a949a6c157
Add migrations for indicadores.
indicadores/migrations/0002_auto_20170224_1535.py
indicadores/migrations/0002_auto_20170224_1535.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2017-02-24 15:35 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('indicadores', '0001_initial'), ] operations = [ migrations.AlterField( ...
Python
0
b7bf4586fea207453225a87fb85df59ccfc94e80
Add missing migration related to django-simple-history update
jarbas/core/migrations/0032_auto_20170613_0641.py
jarbas/core/migrations/0032_auto_20170613_0641.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-06-13 09:41 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0031_add_index_together_for_reimbursement'), ] operations = [ migra...
Python
0.000001
60f051590a61ec4435f9bc5d46e430c5feb36f16
Add agent
agent/agent.py
agent/agent.py
#!/usr/bin/env python #http://www.acmesystems.it/python_httpd from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import json, subprocess, os, time HELLO_MESSAGE = {'message':'hello, please use JSON via POST!'} ERROR_JSON_MESSAGE = {'message':'POST content type must be application/json!'} ERROR_BADJSON_MESSA...
Python
0.000001
7082f80d5be56073d9d2a66653188b2cee248a8e
add basic tests of search and matrix views
src/encoded/tests/test_search.py
src/encoded/tests/test_search.py
# Use workbook fixture from BDD tests (including elasticsearch) from .features.conftest import app_settings, app, workbook def test_search_view(workbook, testapp): res = testapp.get('/search/').json assert res['@type'] == ['Search'] assert res['@id'] == '/search/' assert res['@context'] == '/terms/' ...
Python
0
2cd1da31b099cbf37552b2a049c3df6619e0e64f
Add helper enums for type encodings
rma/redis_types.py
rma/redis_types.py
REDIS_ENCODING_ID_RAW = 0 REDIS_ENCODING_ID_INT = 1 REDIS_ENCODING_ID_EMBSTR = 2 REDIS_ENCODING_ID_HASHTABLE = 3 REDIS_ENCODING_ID_ZIPLIST = 4 REDIS_ENCODING_ID_LINKEDLIST = 5 REDIS_ENCODING_ID_QUICKLIST =6 REDIS_ENCODING_ID_INTSET = 7 REDIS_ENCODING_ID_SKIPLIST = 8 REDIS_ENCODING_STR_TO_ID_LIB = { b'raw': REDIS_E...
Python
0
6e577ecf55c107254816055ea810183b66e734b6
Add management command to tag older icds sms with indicator metadata
custom/icds/management/commands/tag_icds_sms.py
custom/icds/management/commands/tag_icds_sms.py
from corehq.apps.sms.models import SMS from corehq.messaging.smsbackends.icds_nic.models import SQLICDSBackend from datetime import datetime from django.core.management.base import BaseCommand SUBSTRINGS = { 'hin': { 'aww_1': u'\u0906\u0901\u0917\u0928\u0935\u093e\u095c\u0940 \u0915\u0947\u0902\u0926\u094d...
Python
0
ea522fc3cdcec3d7e774cdaa93a36ef22c221432
Add file for parsing eyelink data
moss/eyelink.py
moss/eyelink.py
import os import subprocess import tempfile import shutil import numpy as np import pandas as pd class EyeData(object): def __init__(self, edf_file=None, asc_file=None): if edf_file is None and asc_file is None: raise ValueError("Must pass either EDF or ASCII file") self.settings =...
Python
0
901046879338b1bc19de59675c7eb513bbc2c517
add problem 19
euler019.py
euler019.py
#!/usr/bin/env python firsts = [1] jan = 31 mar_dec = [31, 30, 31, 30, 31, 31, 30, 31, 30, 31] for year in range(1901,2001): firsts.append(firsts[-1] + jan) if year % 4 == 0 and year % 100 != 0 or year % 400 == 0: feb = 29 else: feb = 28 firsts.append(firsts[-1] + feb) for mon in mar_dec: firsts...
Python
0.001255
dfa5bee0720f8d4b5f3ac2309915090239780045
Test Flask file
flaskweb.py
flaskweb.py
from flask import Flask, request, jsonify app = Flask(__name__) @app.route("/hello/<name>") def hello(name): return "Hello World! %s" % name @app.route("/data/") def temptime(): arr = {"temp": [20, 21, 21],"time":[10,20,30],"unit":"s"} return jsonify(arr) @app.route("/add", methods = ['POST']) def sum():...
Python
0.000001
02f84b8cf3c3dd77b6d84d9ccea979c8de23eaa5
Add Awesome renderers
src/common/renderers.py
src/common/renderers.py
import time from rest_framework.renderers import JSONRenderer from django.shortcuts import resolve_url from django.template.loader import render_to_string from django.utils.encoding import force_str from django.utils.functional import Promise from rest_framework.renderers import BaseRenderer, JSONRenderer, TemplateHTML...
Python
0
80a435e3e382791b5615755d05c5353114650ecc
test only
hello.py
hello.py
#!/usr/bin/python print "Content-type:text/html\r\n\r\n" print '<html>' print '<head>' print '<title>Hello Word - First CGI Program</title>' print '</head>' print '<body>' print '<h2>Hello Word! This is my first CGI program</h2>' print '</body>' print '</html>'
Python
0
101f378fb536cdaf8f2c681f5b1fba669bf70631
Add hex xor
hexor.py
hexor.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # xor 2 hex strings import string def isHex(s): '''Check if it is a hex string''' if (len(s) == 0 or len(s) % 2 != 0 or not all(c in string.hexdigits for c in s)): return False return True def hexor(s1, s2): '''xor 2 hex stri...
Python
0.000083
6a9d60a6e48b3231675e465c1a837c909a9e652a
Add forward2
forward2.py
forward2.py
from convert import print_prob, load_image, checkpoint_fn, meta_fn import tensorflow as tf import resnet import os layers = 50 img = load_image("data/cat.jpg") sess = tf.Session() filename = checkpoint_fn(layers) filename = os.path.realpath(filename) if layers == 50: num_blocks = [3, 4, 6, 3] elif layers == ...
Python
0.999904
c794fbf00c5ba5b661f01fcbd0652105ed4c3904
Add missing migration.
mc2/controllers/base/migrations/0005_field_defaults.py
mc2/controllers/base/migrations/0005_field_defaults.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('base', '0004_marathonlabel'), ] operations = [ migrations.AlterField( model_name='envvariable', name...
Python
0.000002
46a9c3789b86631258d881dacf6ae529ec277d70
Add stats262.py
ielex/lexicon/management/commands/stats262.py
ielex/lexicon/management/commands/stats262.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.core.management import BaseCommand from ielex.lexicon.models import Language, \ Meaning, \ Lexeme, \ CognateJudgementCitation class Command(B...
Python
0.000001
6f27af536f9421c2b73def505648a039d4f0ad1f
Manage Rackes Code
ManageRacks.py
ManageRacks.py
import sqlite3 import gi import json gi.require_version('Gtk', '3.0') from gi.repository import Gtk con = sqlite3.connect('SaedRobot.db') cur = con.cursor() cur.execute("SELECT VOLSER from inventory") software_list = cur.fetchall() class ManageRack(Gtk.Window): builder =None window= None box = None def __...
Python
0
a7728b466f5cacb662566e9e71ebc661ae40271a
Create max_end3.py
Python/CodingBat/max_end3.py
Python/CodingBat/max_end3.py
# http://codingbat.com/prob/p135290 def max_end3(nums): max = nums[0] if (nums[0] > nums[-1]) else nums[-1] # or use max(arg1, arg2) for i in range(3): nums[i] = max return nums
Python
0.000011
6ae82ecdd749b936289b496a10faa2caf1aa94c6
Add first version of the code
bibsort.py
bibsort.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import re from collections import OrderedDict import codecs class BibEntry: def __init__(self, **kwargs): self.data = {} for key, value in kwargs.iteritems(): self.data[key] = value def entry(self): data = OrderedDict(...
Python
0.000002
2428467d8c0d9c70a4931e1bd1b5971c9f45a0b7
add function
function.py
function.py
def foo(x,y): print(x+y) foo(3,4)
Python
0.000355
cdc2347e1c06608db78a9cb0ac871c3aac455081
Add beta-python3
clients/python3/debug_client.py
clients/python3/debug_client.py
''' Python client for visualizer plugin for Russian AI Cup ''' import socket import collections Color = collections.namedtuple('Color', 'r g b') class DebugClient(object): ''' Main class for controlling the plugin ''' DEFAULT_HOST = '127.0.0.1' DEFAULT_PORT = 13579 MODE_PRE, MODE_POST, MODE_...
Python
0.000033
d26c014be8194a25b546c06a54efd15dbc5123a1
create youtube_japi.py
mopidy_youtube/youtube_japi.py
mopidy_youtube/youtube_japi.py
# JSON based scrAPI class jAPI(scrAPI): # search for videos and playlists # @classmethod def search(cls, q): query = { # get videos only # 'sp': 'EgIQAQ%253D%253D', 'search_query': q.replace(' ', '+') } cls.session.headers = { 'us...
Python
0.000001
9873891a9f26edc51a22e51b5910615a7e08d410
Create WaterLevel.py
device/src/WaterLevel.py
device/src/WaterLevel.py
#Water level sensor. #VCC #GND #AO <--> ADC Port(A7) Analog data #AO is the specific value. import pyb adc = pyb.ADC(Pin('A7')) # create an analog object from a pin adc = pyb.ADC(pyb.Pin.board.A7) # read an analog value def getWaterLevel(): print('WaterLevel Ao') return adc.read()
Python
0.000001
d48a2c7bf3e1f7eb1604ce69c8af4878d8814167
Add pygments template for Oceanic Next
oceanic_next.py
oceanic_next.py
# -*- coding: utf-8 -*- """ Base16 Oceanic Next Dark by Dmitri Voronianski (http://pixelhunter.me) Pygments template by Jan T. Sott (https://github.com/idleberg) Created with Base16 Builder by Chris Kempson (https://github.com/chriskempson/base16-builder) """ from pygments.style import Style from pygments.token import...
Python
0
bc6826769bf117c5d6e692f4e975b035aafbb76f
Add shared neutron constants
neutron_lib/constants.py
neutron_lib/constants.py
# Copyright (c) 2012 OpenStack Foundation., 2015 A10Networks, 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 appl...
Python
0.000001
d43d4f29752bfae8a4d2e337f5523cd5fc7888d8
add Trimplementation of Kadane's algorithm
dp/kadane-_algorithm/py/TrieToSucceed_kadane.py
dp/kadane-_algorithm/py/TrieToSucceed_kadane.py
#!/usr/bin/python3 """ This module contains an implementation of Kadane's algorithm to determine the maximum sum of a subarray. """ def kadane(list_obj=None): """ Find maximum sum of a subarray :param list list_int: list of objs :return: maximum sum of subarray :rtype: int DOCTESTS ------...
Python
0
3b1b708b739f43bdac86784b27838c80d179572b
solved day 17
17/main.py
17/main.py
import collections import unittest def gen_valid_combinations(liters, container_sizes): first_container_capacity = container_sizes[0] if len(container_sizes) == 1: if liters == first_container_capacity: yield [1] elif liters == 0: yield [0] elif liters == 0: yield [0 for _ in xrange(len(...
Python
0.999067
4d196f4f897ac6d2c590803d491192e340ec475e
fetch option order example
examples/py/async-binance-fetch-option-order.py
examples/py/async-binance-fetch-option-order.py
# -*- coding: utf-8 -*- import asyncio import os import sys from pprint import pprint root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(root + '/python') import ccxt.async_support as ccxt # noqa: E402 async def main(): exchange = ccxt.binance({ 'apiKey...
Python
0.999999
08e43e8bfd150252b3e05ff62ee25cdf0e519f20
Revert #830 because it broke the case when the main script is not in path.
meson.py
meson.py
#!/usr/bin/env python3 # Copyright 2016 The Meson development team # 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 appl...
#!/usr/bin/env python3 # Copyright 2016 The Meson development team # 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 appl...
Python
0
27b2e87a8653961fbba45962e9e6ec1d20904a03
Create demo_lcd.py
20x4LCD/demo_lcd.py
20x4LCD/demo_lcd.py
import lcddriver from time import * lcd = lcddriver.lcd() lcd.lcd_display_string("Hello world", 1) lcd.lcd_display_string("My name is", 2) lcd.lcd_display_string("picorder", 3) lcd.lcd_display_string("I am a Raspberry Pi", 4)
Python
0.000001
2c345f2927cba033908020b97c33064bbfce5fbd
Add 38-count-and-say.py
38-count-and-say.py
38-count-and-say.py
""" Count and Say The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11. 11 is read off as "two 1s" or 21. 21 is read off as "one 2, then one 1" or 1211. Given an integer n, generate the nth sequence. N...
Python
0.998619
e4a4e8d43c1b4c63ac32467a8e49a5b81f8f2fa3
Create roundrobin.py
roundrobin.py
roundrobin.py
import string from game import Game class RoundRobin(object): def __init__(self, teams_count): self.teams = generateTeams(teams_count) self.current_round = 0 def getRound(self): games = [] teams_count = len(self.teams) home_away_index = self.current_round // (t...
Python
0.000369
d1eac9803adbf9b91b22ce62a4bdf5db790b6265
Create ShodanToCSV.py
ShodanToCSV.py
ShodanToCSV.py
#!/usr/bin/env python # # Search shodan, output to CSV # To ensure comma as seperator, all comma's in os and header field (if any) are replaced for ;;; # To ensure row integrity all newlines (\n) are replaced by #NWLN # Author: Jeroen import shodan import sys import os from optparse import OptionParser #Initialize us...
Python
0
9be177007ce95f2b9e47225a46effe7b7682ba38
Create StockReader.py
StockReader.py
StockReader.py
#econogee, 1/28/2016 #Stock Data Retrieval Script import os import numpy as np import urllib2 startday = str(0) startmonth = str(1) startyear = str(2005) endday = str(30) endmonth = str(1) endyear = str(2016) symbols = [] with open('stocklist.csv') as f: content = f.readlines() for l in content: sy...
Python
0
706da9008e8101c03bb2c7754b709209897cd952
Add Organization Administrator model.
app/soc/models/org_admin.py
app/soc/models/org_admin.py
#!/usr/bin/python2.5 # # Copyright 2008 the Melange authors. # # 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 applicab...
Python
0
2e3349b75fffb9a9f3906d065bc8f141eef02d38
Add run_wsgi
run_wsgi.wsgi
run_wsgi.wsgi
#!/usr/bin/env python import os import sys sys.stdout = sys.stderr INTELLIDATA_DIR = os.path.dirname(__file__) sys.path.insert(0, INTELLIDATA_DIR) os.chdir(INTELLIDATA_DIR) import config from intellidata import app as application application.config.from_object('config')
Python
0.000005
a086e7328ca920f269812a87be095ce638467f95
Add youtube-dl library sample of operation
crawler/youtube_dl_op_sample.py
crawler/youtube_dl_op_sample.py
#!/usr/bin/env python2 #-*- coding: utf-8 -*- import sys import youtube_dl def main(): if len(sys.argv) < 2: print("Usage: youtube_dl_op_sample.py URL") return opts = { 'forceurl': True, 'quiet': True, 'simulate': True, } url = sys.argv[1...
Python
0
70927650139a94b1c7be5557e47340ccda609d36
Create UnicommWlan.py
UnicommWlan.py
UnicommWlan.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Auto login the unicomm wlan # By Lu CHAO(me@chao.lu) ,2013 10 12. from urllib2 import build_opener,HTTPCookieProcessor from urllib import urlencode from cookielib import CookieJar import time,sys from random import random global loop global count loop=True count=0 de...
Python
0
a083baddd853514a5697e3a98eea4251c2ce5487
Create __openerp__.py
__openerp__.py
__openerp__.py
{ "name": "Product price based on margin with formula sale_price=cost_price/margin", "version": "8.0.0.1", "author": "3nodus", 'category': 'Product', "website": "http://www.3nodus.com/", "license": "AGPL-3", "depends": [ "product", ], "demo": [ ], "data": [ ...
Python
0.005291
22a3a6aa70c2960983887717b98cab2149a18d89
Fix #121: don't accept tells to bot
plugins/tell.py
plugins/tell.py
" tell.py: written by sklnd in July 2009" " 2010.01.25 - modified by Scaevolus" import time from util import hook, timesince def db_init(db): "check to see that our db has the tell table and return a dbection." db.execute("create table if not exists tell" "(user_to, user_from, message, ...
" tell.py: written by sklnd in July 2009" " 2010.01.25 - modified by Scaevolus" import time from util import hook, timesince def db_init(db): "check to see that our db has the tell table and return a dbection." db.execute("create table if not exists tell" "(user_to, user_from, message, ...
Python
0
ca83457b4a003527cad9c9d57402c53e4571299c
add python opt and logging boilerplate code
sandbox/python/boilerplate_code/python_opt_log.py
sandbox/python/boilerplate_code/python_opt_log.py
#!/usr/bin/env python import argparse import logging import os import sys import re logger = None def my_function(blah): return if __name__ == "__main__": FORMAT = '%(levelname)s %(asctime)-15s %(name)-20s %(message)s' parser = argparse.ArgumentParser(description="program name", formatter_class=argparse....
Python
0
1058a9cb6e667c850f56b6003038496b77c359c5
Add tool to fix links.
website/tools/append_index_html_to_internal_links.py
website/tools/append_index_html_to_internal_links.py
"""Script to fix the links in the staged website. Finds all internal links which do not have index.html at the end and appends index.html in the appropriate place (preserving anchors, etc). Usage: From root directory, after running the jekyll build, execute 'python tools/append_index_html_to_internal_links.py'. D...
Python
0
ede7a61e1c1a77438bc027b41a5a9cb03eb6328c
raise a timeout in nrpe_poller test, so windows connect() has enought time
test/test_modules_nrpe_poller.py
test/test_modules_nrpe_poller.py
#!/usr/bin/env python # Copyright (C) 2009-2010: # Gabes Jean, naparuba@gmail.com # Gerhard Lausser, Gerhard.Lausser@consol.de # # This file is part of Shinken. # # Shinken 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 F...
#!/usr/bin/env python # Copyright (C) 2009-2010: # Gabes Jean, naparuba@gmail.com # Gerhard Lausser, Gerhard.Lausser@consol.de # # This file is part of Shinken. # # Shinken 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 F...
Python
0
8bf248f304e7188e279a37ff06c8fc41f54e1df8
Add console log
Logging.py
Logging.py
from GulpServer.Settings import Settings user_settings = None def plugin_loaded(): global user_settings user_settings = Settings() class Console(object): def log(self, *args): if user_settings.get('dev'): print(*args)
Python
0.000003
9451bfccaf9e2782dc0b1e7670f61ce765b8e7c2
Update for Issue #163
tamper/nonrecursivereplacement.py
tamper/nonrecursivereplacement.py
#!/usr/bin/env python """ Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ import random import re from lib.core.common import singleTimeWarnMessage from lib.core.enums import PRIORITY __priority__ = PRIORITY.NORMAL def tamper(payload, headers): ...
Python
0
ec07c74852eaf9bc6ec7d4abb0e5bb3a740501a4
Add BoundingBox tests
photutils/aperture/tests/test_bounding_box.py
photutils/aperture/tests/test_bounding_box.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) from numpy.testing import assert_allclose from astropy.tests.helper import pytest from ..bounding_box import BoundingBox try: import matplot...
Python
0
eef0cb0ff41ec35d92e3d76e1e15c1d6edd5b786
Add ICC(2,1) and ICC(3,1) calculation
analise/icc.py
analise/icc.py
def icc(data, icc_type): ''' Calculate intraclass correlation coefficient for data within Brain_Data class ICC Formulas are based on: Shrout, P. E., & Fleiss, J. L. (1979). Intraclass correlations: uses in assessing rater reliability. Psychological bulletin, 86(2), 420. icc1: x_ij = mu + ...
Python
0.004858
ae3005089da6edc4d4488b8619dcbee9e556fc22
Fix typo
pylxd/client.py
pylxd/client.py
# Copyright (c) 2015 Canonical Ltd # # 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...
# Copyright (c) 2015 Canonical Ltd # # 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...
Python
0.999189
43ccd46f3319f6afe154c5ed663143742c229074
add voronoi_follower
tms_rc/tms_rc_double/scripts/voronoi_follower.py
tms_rc/tms_rc_double/scripts/voronoi_follower.py
# -*- coding:utf-8 -*- import rospy from geometry_msgs.msg import Pose2D, Twist from tms_msg_rc_srv import rc_robot_control, rc_robot_controlResponse from tms_msg_db.srv import TmsdbGetData, TmsdbGetDataRequest import datetime import pymongo from math import sin, cos, atan2, pi, radians, degrees, sqrt pub = rospy.Pub...
Python
0.000001
9e090675765a2c0c6412ee51d1e0e007404a30fd
Create k-diff-pairs-in-an-array.py
Python/k-diff-pairs-in-an-array.py
Python/k-diff-pairs-in-an-array.py
# Time: O(n) # Space: O(n) # Total Accepted: 5671 # Total Submissions: 20941 # Difficulty: Easy # Contributors: murali.kf370 # Given an array of integers and an integer k, # you need to find the number of unique k-diff pairs in the array. # Here a k-diff pair is defined as an integer pair (i, j), # where i and j are...
Python
0.002165
586e7745f8ed76985f28a391dcf451c06af61903
add sphinx helper functions
src/rstcheck/_sphinx.py
src/rstcheck/_sphinx.py
"""Sphinx helper functions.""" import contextlib import pathlib import tempfile import typing from . import _docutils, _extras if _extras.SPHINX_INSTALLED: import sphinx.application import sphinx.domains.c import sphinx.domains.cpp import sphinx.domains.javascript import sphinx.domains.python ...
Python
0.000001
9f66f31d42a16d8b9536a9cb160e454118ff4369
Add tests for UninstallPathSet
tests/unit/test_req_uninstall.py
tests/unit/test_req_uninstall.py
import os import shutil import sys import tempfile import pytest from mock import Mock from pip.locations import running_under_virtualenv from pip.req.req_uninstall import UninstallPathSet class TestUninstallPathSet(object): def setup(self): if running_under_virtualenv(): # Construct tempdir ...
Python
0
8d8f89c82511b86fb87cef5db3bad633283283cc
Add missing migrations in develop branch
modelview/migrations/0044_auto_20191007_1227.py
modelview/migrations/0044_auto_20191007_1227.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.25 on 2019-10-07 10:27 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('modelview', '0043_merge_20190425_1036'), ] operations = [ migrations.Remov...
Python
0.000001
4a25572283448a820cf55008e81405f3eb84a072
Add test for unicode in env (#345)
tests/system/verbs/catkin_build/test_unicode_in_env.py
tests/system/verbs/catkin_build/test_unicode_in_env.py
import os from ....utils import catkin_success from ...workspace_factory import workspace_factory def test_catkin_build_with_unicode_in_env(): with workspace_factory() as wf: wf.create_package('foo', depends=['bar']) wf.create_package('bar') wf.build() print('Workspace: {0}'.for...
Python
0
38c091464179b5d015fd84457a4b3e242d8a3faf
Use binary color scheme for heatmap network images.
Network.py
Network.py
#!/usr/bin/env python # Network representation and basic operations # Daniel Klein, 5/10/2012 import numpy as np import scipy.sparse as sparse import networkx as nx import matplotlib.pyplot as plt from Covariate import NodeCovariate, EdgeCovariate class Network: def __init__(self, N = None): if N: ...
Python
0
53f91164ce93a01c2ad628fd49109a5fa8917ecb
Extend datasource model schema (#2342)
timesketch/migrations/versions/180a387da650_extend_datasource_model_with_total_file_.py
timesketch/migrations/versions/180a387da650_extend_datasource_model_with_total_file_.py
"""Extend datasource model with total file events field Revision ID: 180a387da650 Revises: 75af34d75b1e Create Date: 2022-09-26 13:04:10.336534 """ # This code is auto generated. Ignore linter errors. # pylint: skip-file # revision identifiers, used by Alembic. revision = '180a387da650' down_revision = '75af34d75b1...
Python
0
63dc7fb2586824b6a6de52b1ba80e6196d80ff42
Create credentials.py
credentials.py
credentials.py
# add your primary statsnz key here # available from https://statisticsnz.portal.azure-api.net/ statsnz_key = "MY_SECRET_KEY"
Python
0.000001
2aadd55510684c4065c1bed1c1387ee57b18fd77
Add a prototype of Simulated Annealing Algorithm, and a TSP example.
OpenCLGA/sa.py
OpenCLGA/sa.py
#!/usr/bin/python3 from abc import ABCMeta from utils import calc_linear_distance, plot_tsp_result import math import random class SAImpl(metaclass = ABCMeta): def __init__(self): pass ## Calculate the cost of the solution def cost(self, solution): pass ## Return a new neighbor solution...
Python
0
41e21884418cdd2b525b4f02d1cfa4ed9ea2c000
Add bug test for 9268 (#65)
bugs/issue_9268.py
bugs/issue_9268.py
# RUN: %PYTHON %s # XFAIL: * import iree.compiler.tools.tflite as iree_tflite # https://github.com/iree-org/iree/issues/9268 ir = ''' func.func @main(%a : tensor<f32>, %b : tensor<f32>) -> tensor<*xf32> { %val = "tfl.add"(%a, %b) {fused_activation_function = "NONE"} : (tensor<f32>, tensor<f32>) -> tensor<*xf32> r...
Python
0
8c401af5bb7c3678de4091b88d81e04ddf248705
Remove unused 'fahrenheit' config option
src/collectors/lmsensors/lmsensors.py
src/collectors/lmsensors/lmsensors.py
# coding=utf-8 """ This class collects data from libsensors. It should work against libsensors 2.x and 3.x, pending support within the PySensors Ctypes binding: [http://pypi.python.org/pypi/PySensors/](http://pypi.python.org/pypi/PySensors/) Requires: 'sensors' to be installed, configured, and the relevant kernel mod...
# coding=utf-8 """ This class collects data from libsensors. It should work against libsensors 2.x and 3.x, pending support within the PySensors Ctypes binding: [http://pypi.python.org/pypi/PySensors/](http://pypi.python.org/pypi/PySensors/) Requires: 'sensors' to be installed, configured, and the relevant kernel mod...
Python
0.000004
f3e1b1404f32cd0195aa8148d1ab4285cf9ad352
Add class BaseSpider
Spiders.py
Spiders.py
''' Created on 2 сент. 2016 г. @author: garet ''' class BaseSpider(): def __init__(self): pass def AddUrls(self, urls): pass def Routing(self, url): pass def SaveCache(self, url, data=None): pass def GetCache(self, url): pass ...
Python
0.000001
e5be29bc3c5a77493fe64bb3fc8b52611cc13469
Add tests for Generic Interface.
zerver/tests/test_outgoing_webhook_interfaces.py
zerver/tests/test_outgoing_webhook_interfaces.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function from typing import Any import mock import json from requests.models import Response from zerver.lib.test_classes import ZulipTestCase from zerver.outgoing_webhooks.generic import GenericOutgoingWebhookService class T...
Python
0
14d99c3d697c069abf188dac5d53a7169010160b
Add migration for version 2 tables
migrations/versions/8c431c5e70a8_v2_tables.py
migrations/versions/8c431c5e70a8_v2_tables.py
"""v2 tables Revision ID: 8c431c5e70a8 Revises: 4ace74bc8168 Create Date: 2021-07-05 21:59:13.575188 """ # revision identifiers, used by Alembic. revision = "8c431c5e70a8" down_revision = "4ace74bc8168" import sqlalchemy as sa from alembic import op def upgrade(): # ### commands auto generated by Alembic - pl...
Python
0
48d38c28212c0b3ac8bb8ee324221d94b07e84ee
Add initial Domain Tools module
misp_modules/modules/expansion/domaintools.py
misp_modules/modules/expansion/domaintools.py
import json import logging import sys from domaintools import API log = logging.getLogger('domaintools') log.setLevel(logging.DEBUG) ch = logging.StreamHandler(sys.stdout) ch.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) log.a...
Python
0
1f80f3cc606d9c42e41e30108e97f776b02803c5
Create abcprob.py
abcprob.py
abcprob.py
# by beepingmoon, 2014-07-22 # abc problem, http://rosettacode.org/wiki/ABC_Problem import time class Blok: def __init__(self, znaki, czyDostepny = True): self.znaki = znaki self.czyDostepny = czyDostepny def sprawdzZnaki(self, znak): for z in self.znaki: if z == znak: return True return False blok...
Python
0.99997
b7b29a00b1a2e448d78c8f3c4333753668589e16
Create __init__.py
etc/__init__.py
etc/__init__.py
Python
0.000429
e1ea3859b08a14c80ccd65fc5551336bdc760f96
add biggan projukti blog
corpus_builder/spiders/public_blog/biggan_projukti.py
corpus_builder/spiders/public_blog/biggan_projukti.py
# -*- coding: utf-8 -*- import scrapy from scrapy.linkextractors import LinkExtractor from scrapy.spiders import Rule from corpus_builder.templates.spider import CommonSpider class BigganProjuktiSpider(CommonSpider): name = 'biggan_projukti' allowed_domains = ['www.bigganprojukti.com', 'bigganprojukti.com'] ...
Python
0
204e6fc49bcc739f1e5c53bfbfc3eb7e86a7640c
Add windows autostart.
StartAtBoot.py
StartAtBoot.py
import sys if sys.platform.startswith('win'): from PyQt4.QtCore import QSettings RUN_PATH = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run" settings = QSettings(RUN_PATH, QSettings.NativeFormat) settings.setValue("Anki", sys.argv[0]) # to remove that: # self.settings.re...
Python
0
7919fa239e597c0358b518740aa2657b49caddbf
add oop_advance
src/python27/oop_advance/slots.py
src/python27/oop_advance/slots.py
# -*- coding: utf-8 -*- class Student(object): pass s = Student() s.name = 'Tim Ho' print s.name def set_age(self, age): self.age = age from types import MethodType s.set_age = MethodType(set_age, s, Student) s.set_age(25) print s.age s2 = Student() # s2.set_age(25) def set_score(self, score): self.s...
Python
0.000133
d19f92ef1bb97407607c588db86a0b55a60ebb2f
Create Auditor.py
auditor.py
auditor.py
import Tkinter import string import subprocess from Tkinter import * from subprocess import call from collections import defaultdict #Requires whois by Mark Russinovich: #http://technet.microsoft.com/en-us/sysinternals/bb897435.aspx #using the documentation from: #http://www.tutorialspoint.com/python/python_gui_pro...
Python
0
f576b7b151c6c74eea668e66fff54ab2c33f39d6
add 100
Volume2/100.py
Volume2/100.py
if __name__ == "__main__": b, n, L = 85, 120, 10 ** 12 while n <= L: b, n = 3 * b + 2 * n - 2, 4 * b + 3 * n - 3 print b, n
Python
0.999998
68efa8a0fb206da8cd1410d74572520f558ebded
Create apriori.py
apriori.py
apriori.py
def preprocessing(data): """ preprocesses data to be applicable to apriori Parameters ---------- data : tbd Returns --------- list of sets """ pass class apriori(): """ Frequent Itemsets using the apriori algorithm Parameters ---------- baskets : list...
Python
0.000006
8adf39f011d8290c07f01e807b65373e40b4c314
Create score.py
score.py
score.py
""" Requires sox and text2wave (via festival) """ from pippi import dsp from pippi import tune import subprocess import os def sox(cmd, sound): path = os.getcwd() filename_in = '/proc-in' filename_out = '/proc-out.wav' dsp.write(sound, filename_in) cmd = cmd % (path + filename_in + '.wav', path ...
Python
0.000008
0ac53ef31a47c61382557b9fb3ba588fd4e1ae67
Add first working setup.py script
setup.py
setup.py
from setuptools import setup, find_packages setup(name='pygame_maker', version='0.1', description='ENIGMA-like pygame-based game engine', classifiers=[ 'Development Status :: 2 - Pre-Alpha', 'License :: OSI Approved :: GNU Lesser General Public License v2 (LGPGv2)', 'Progamming Lang...
Python
0
1c608e69ecf61484ea1210fe0d6dc8d116c583d3
Update homepage in setup.py
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup, find_packages setup( name='linaro-django-pagination', version=version, description="linaro-django-pagination", long_description=open("README").read(), classifiers=[ "Programming Language :: Python", "Topic :: Software Development :...
#!/usr/bin/env python from setuptools import setup, find_packages setup( name='linaro-django-pagination', version=version, description="linaro-django-pagination", long_description=open("README").read(), classifiers=[ "Programming Language :: Python", "Topic :: Software Development :...
Python
0
3693c5696da5bb96fc242d276f0d1a0a983a9c5d
Add setup.py script
setup.py
setup.py
import os from setuptools import setup def read(file): return open(os.path.join(os.path.dirname(__file__), file)).read() setup( name="vsut", version="1.5.2", author="Alex Egger", author_email="alex.egger96@gmail.com", description="A simple unit testing framework for Python 3.", license="MI...
Python
0.000001
565ff051cabe9eaec6f24df6e8c31115e0a4eed8
Add setup.py
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup setup(name='VSTools', version='0.1', description='Easy use Visual Studio msbuild with python. ', author='eternnoir', author_email='eternnoir@gmail.com', url='https://github.com/eternnoir/VSTools', packages=['VSTools'], )
Python
0.000001
b164ec6fae6ea9a6734ac58ddd8c3b89f73713fe
Add setup.py
setup.py
setup.py
from distutils.core import setup setup( name='django-classy-settings', version='0.1', description='Simple class-based settings for Django', author='Curtis Maloney', author_email='curtis@tinbrain.net', packages=['cbs',], )
Python
0.000001
69f9f090cfa5c9ca5d7dde70cfcdd3327147bdb7
Create setup.py
setup.py
setup.py
import cx_Oracle ''' - This is to drop all pervious tables and create new tables - Call setup(curs, connection) in main function - setup(curs, connection) returns nothing - Do not call dropTable() and createTable() in main unless you really want to do so ''' def dropTable(curs): droplst = [] droplst.appen...
Python
0.000001
fa4ce6dc15e8b47c5978c476db7801473820af0d
add setup.py
setup.py
setup.py
# -*- coding: utf-8 -*-
Python
0.000001
8e8fbf8b63239915736b788b7f1c8ac21a48c190
Add a basic setup.py script
setup.py
setup.py
from distutils.core import setup from coil import __version__ as VERSION setup( name = 'coil', version = VERSION, author = 'Michael Marineau', author_email = 'mike@marineau.org', description = 'A powerful configuration language', license = 'MIT', packages = ['coil', 'coil.test'], script...
Python
0.000001
d074995f8ce5a62104525b1f3cfed10ace12c3bc
add setup.py
setup.py
setup.py
from setuptools import setup setup(name="feature", version="0.1", url="https://github.com/slyrz/feature", description="Easy feature engineering.", long_description=open('README.md').read(), packages=['feature', 'feature.plugin'], license='MIT')
Python
0.000001
699ac33eec57fa49e2c1917d2bf17950bd6e6474
Create setup script
setup.py
setup.py
"""Setup script of mots-vides""" from setuptools import setup from setuptools import find_packages import mots_vides setup( name='mots-vides', version=mots_vides.__version__, description='Python library for managing stop words in many languages.', long_description=open('README.rst').read(), keywo...
Python
0.000001