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
89615f5ce8d6433721f5b4e1130de2433c16d0eb
Add candidate.py, with candidate_rules a clone of basic_rules in cdr_matrices.py.
py/linhomy/candidate.py
py/linhomy/candidate.py
''' >>> candidate_matrices.print_C_stats(10) 0 [(1, 1)] 1 [(0, 1), (1, 1)] 2 [(0, 3), (1, 3)] 3 [(0, 11), (1, 4)] 4 [(0, 33), (1, 7)] 5 [(0, 92), (1, 12)] 6 [(0, 254), (1, 19)] 7 [(0, 682), (1, 32)] 8 [(0, 1818), (1, 52)] 9 [(0, 4810), (1, 85)] 10 [(0, 12677), (1, 139)] As expected, all zeros and ones. >>> candidate_m...
Python
0
51b72ace0e0041199c596074718c2f8b22f5de71
Create stripmanager.py
stripmanager.py
stripmanager.py
import time from neopixel import * import datamanager # LED strip configuration: LED_COUNT = 60 # Number of LED pixels. LED_PIN = 18 # GPIO pin connected to the pixels (must support PWM!). LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz) LED_DMA = 5 # DMA cha...
Python
0.000001
a19aff3173a85ca8b0035873c3a6315d3dbedba4
Create main.py
gateway/src/main.py
gateway/src/main.py
#!/usr/bin/env python #Gateway main script. #Communicate with end devices via LoRa. #Communicate with server via MQTT(hbmqtt) and HTTP POST. #Save data in the sqlite database. #Parse JSON from MQTT and LoRa protocol.
Python
0.000001
beabbaecb963ee23e937019b5d74b26656292108
iterate dates first
daily_reuters.py
daily_reuters.py
#!/usr/bin/python import re import urllib2 import csv import os import sys import time import datetime import numpy as np from bs4 import BeautifulSoup # iterate all dates # iterate all tickers # repeatDowdload # save to ./input/data/news_date.csv class news_Reuters: def __init__(self): fi...
Python
0.999941
754a717c8abc0f6b2683071684420240ff0aef17
add heap
ds/heap.py
ds/heap.py
class BinHeap: def __init__(self): self.heap_list = [0] self.size = 0 def siftup(self, i): while i // 2 > 0: if self.heap_list[i] < self.heap_list[i//2]: self.heap_list[i//2], self.heap_list[i] = self.heap_list[i], self.heap_list[i//2] i = i // 2 ...
Python
0.000005
58c604a8574ade75aecbd80314004a9539e80c84
Add ?wv command for encouraging action
plugins/volunteers.py
plugins/volunteers.py
__commands__ = ''' ?wv [name] - congratulates people on their public sprited gesture ''' def plugin(bot): bot.hear(r'^\?wv$', "Well volunteered!") bot.hear(r'^\?wv\s(.+)$', lambda response: "Well volunteered %s!" % response.match.group(1).strip())
Python
0
be29f1a65181eb01515e1c0cf0425a238cd0291d
add file type
main/migrations/0007_auto__add_field_metadata_data_file_type.py
main/migrations/0007_auto__add_field_metadata_data_file_type.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): # Adding field 'MetaData.data_file_type' db.add_column('main_metadata', 'data_file_type', self.gf('django....
Python
0.000002
2d1fd9c81ca9f17270ecef6505830cb798632091
initialize graph test file.
test_simple_graph.py
test_simple_graph.py
#!/usr/bin/env python from __future__ import print_function from __future__ import unicode_literals def test_init(self): return def test_nodes(): return nodes def test_edges(): return edges def test_add_node(value): return def test_add_edge(value1, value2): return def test_del_node(value...
Python
0
0f782c2ade2f58641688742d6fc1030f6259df40
Add code to JSONize the dataset
nadia/jsonize.py
nadia/jsonize.py
# nadia/jsonize.py # # Copyright (c) 2011 Simone Basso <bassosimone@gmail.com> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVI...
Python
0
87eab562e847d7cdde7867c41453b10add376fba
Add test script
test_madoka.py
test_madoka.py
# -*- coding: utf-8 -*- from nose.tools import eq_, ok_ import madoka import os class Test_madoka(object): def test_inc(self): sketch = madoka.Sketch() sketch.inc('mami', 3) eq_(1, sketch.get('mami', 3)) sketch.inc('mami', 3) eq_(2, sketch.get('mami', 3)) def test_add...
Python
0.000001
100c2bb05d002c5b07e0d6ae4a242346e1362c2b
Create condition.py
colino/condition.py
colino/condition.py
from __future__ import (absolute_import, division, print_function, unicode_literals) class Condition(object): def __init__(self, condition_model): # used for holding objects like compiled reges self.init_context = {} # variables referenced by condition self.variables = set() ...
Python
0
cf6172353ad5f73185b8de0d60510a0713aa9895
Transform omorfi tagged text into finnpos format.
bin/omorfi2finnpos.py
bin/omorfi2finnpos.py
from sys import stdin, argv, stderr from re import findall def get_lemma(string, convert_type): if convert_type == 'ftb': word_id_strs = findall('\[WORD_ID=[^\]]*\]', string) lemma_parts = [ word_id_str[9:][:-1] for word_id_str in word_id_strs ] return '#'.join(lemma_parts) else: ...
Python
0
723a7ef13c34bf6e292377db9849753d34b4d0d1
add new helper to display completion on learner dashboard
openedx/core/djangoapps/appsembler/html_certificates/helpers.py
openedx/core/djangoapps/appsembler/html_certificates/helpers.py
""" Appsembler Helpers to improve course info in learner dashboard. We should remove this after Maple, since all the info is in the new course_home_api. """ import beeline from xmodule.modulestore.django import modulestore from common.djangoapps.student.helpers import cert_info from lms.djangoapps.course_blocks.api i...
Python
0.000001
fdb09501038e1be5d22a6f4b4f718eaedc033ee3
Add test for custom scalars (#93)
tests/type/test_custom_scalars.py
tests/type/test_custom_scalars.py
from typing import Any, Dict, NamedTuple from graphql import graphql_sync from graphql.error import GraphQLError from graphql.language import ValueNode from graphql.pyutils import inspect, is_finite from graphql.type import ( GraphQLArgument, GraphQLField, GraphQLFloat, GraphQLObjectType, GraphQLSc...
Python
0
898e1692ed87890cf77a7534e3c51afed112a131
add a top-level __init__.py with imports of the main classes
pyreaclib/__init__.py
pyreaclib/__init__.py
""" pyreaclib is a python module that interprets the nuclear reaction rates cataloged by the JINA ReacLib project: https://groups.nscl.msu.edu/jina/reaclib/db/ It provides both interactive access to the rates, for use in Jupyter notebooks as well as methods for writing python and Fortran nuclear reaction networks, in...
Python
0.000008
e31e1497143485cfdc4554861fac50eff8dcc912
Add messageboard game
python/games/board.py
python/games/board.py
import itertools import threading import datetime import graphics import random import driver import flask from flask import request import game import time import sys from wsgiref import simple_server class Message: def __init__(self, text, priority=5, expiration=None): self.text = text self.prior...
Python
0
a7a20eacc94f1bca2baf5c37632f116e34f2f079
Create data_cleansed.py
data_cleansed.py
data_cleansed.py
# Data Cleansing import pandas as pd df = pd.DataFrame() # 1. Explore data: df.head(), df.tail(), df.info(), df.describe() # Check NULL values totals: df.isna().sum() # 2. Drop NaValues: df.dropna(inplace=True) # 3. Deal with Duplicates: df.duplicated().value_counts() ''' A general rule of thumb is to ignore the du...
Python
0
dcfe128cd1dea5a94f22f58ffa4d82ff97d85482
test commit
sze-the-game.py
sze-the-game.py
#@PydevCodeAnalysisIgnore # This file is part of Ren'Py. The license below applies to Ren'Py only. # Games and other projects that use Ren'Py may use a different license. # Copyright 2004-2017 Tom Rothamel <pytom@bishoujo.us> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this s...
Python
0.000001
d90bb9ddfbac20fa9ae7d7ecf37064cb8a86b26e
add algorithm which choose the node with largest degree to query
degree_largest.py
degree_largest.py
from random import sample,random,choice from core import Algorithm from egraphs import FBEgoGraph class DegreeLargest(Algorithm): def update_graph(self, start_node, new_node): g = self.sampled_graph start_id = g.vs['name'].index(start_node) if new_node['name'] not in g.vs['name']: ...
Python
0.000001
7b4f3784f3c27e861b2b741fe2a02c82a97e8fb9
change storage test file name
blockchain_storage/tests.py
blockchain_storage/tests.py
import hashlib import leveldb database = leveldb.LevelDB('/home/operator/PycharmProjects/CrAB/db', create_if_missing=False) hash = hashlib.sha256('data'.encode()) print('hash: ', hash.digest()) database.Put(hashlib.sha256('data'.encode()).digest(), 'something'.encode()) print(database.Get(hashlib.sha256('data'.encode(...
Python
0.000001
40ad674ae170347ed69b19434241438bb09e473d
Define decorator for requiring login
app/decorators.py
app/decorators.py
from functools import wraps from flask import redirect, session, url_for def login_required(f): @wraps(f) def wrapper(*args, **kwargs): if session.get('logged_in', False): return f(*args, **kwargs) return redirect(url_for('public.login')) return wrapper
Python
0.000001
855a8550c6bd6e1a16700610e07f9192f9907125
move sort to its own module
pyes/sort.py
pyes/sort.py
from .exceptions import InvalidSortOrder from .utils import EqualityComparableUsingAttributeDictionary class SortOrder(EqualityComparableUsingAttributeDictionary): """ Defines sort order """ MODE_MIN = 'min' MODE_MAX = 'max' MODE_SUM = 'sum' # not available for geo sorting MODE_AVG = 'avg...
Python
0
bb90850d95998fec515e6581de049562494fa484
Allow a debug param to be passed that keeps the script from running automatically.
boto/pyami/startup.py
boto/pyami/startup.py
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # 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, modi...
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # 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, modi...
Python
0
789af47e06a559287562affe49d450c27c1d3ed1
handle anonymous users
src/sentry/debug/middleware.py
src/sentry/debug/middleware.py
from __future__ import absolute_import import json import re import threading from debug_toolbar.middleware import DebugToolbarMiddleware from debug_toolbar.toolbar import DebugToolbar from django.utils.encoding import force_text # Inherit from DebugToolbarMiddleware because of DJDT monkey patching class DebugMiddl...
from __future__ import absolute_import import json import re import threading from debug_toolbar.middleware import DebugToolbarMiddleware from debug_toolbar.toolbar import DebugToolbar from django.utils.encoding import force_text # Inherit from DebugToolbarMiddleware because of DJDT monkey patching class DebugMiddl...
Python
0.000004
f608e18aa9fa2d13ce5a08f63ab44b942678ff5d
convert avg_face_maker from ipynb to .py and commit
avg_face_maker.py
avg_face_maker.py
"""Create an average face from a list of faces""" import numpy as np import cv2 import sqlite3 import json conn = sqlite3.connect("face.db") c = conn.cursor() faces_data = c.execute("SELECT * FROM (SELECT * FROM faces) as t1 inner join (select rowid, instagram_id from images) as t2 on t1.image_table_id = t2.rowid")....
Python
0.000004
15dca96debdc04d18ef69e457dc0c41e5288d99b
create fields.py so you don't have to specify trix fields in the admin
trix/fields.py
trix/fields.py
from django.db import models from trix.widgets import TrixEditor class TrixField(models.TextField): def formfield(self, **kwargs): kwargs.update({'widget': TrixEditor}) return super(TrixField, self).formfield(**kwargs)
Python
0
227aba119aeec479282105445f2221fd3f936556
test for utils functions
test_d_utils.py
test_d_utils.py
__author__ = 'volodymyr' from d_utils import * def test_get_field_name_without_underscore(): field_name = '_test_' assert get_field_name_without_underscore(field_name) == 'test_' field_name = '__test_' assert get_field_name_without_underscore(field_name) == 'test_' field_name = '_ _test' asse...
Python
0.000002
2572feea64ee5e4556763132d0663fe4412fe369
Add fixtures to test_journal.py and add test for write_entry method.
test_journal.py
test_journal.py
# -*- coding: utf-8 -*- from contextlib import closing from pyramid import testing import pytest from journal import connect_db from journal import DB_SCHEMA TEST_DSN = 'dbname=test_learning_journal user=mark' def init_db(settings): with closing(connect_db(settings)) as db: db.cursor().execute(DB_SCHEM...
Python
0
7ad1c83776c78e39b47792e6a8240686b04d3726
Create main.v.py
contracts/main.v.py
contracts/main.v.py
Python
0.000001
6cffe1d30c16062e3a0414310aad89e7a04b2df6
add handler-specific tests
tests/test_handler_specific.py
tests/test_handler_specific.py
from pygelf import GelfTlsHandler import pytest def test_tls_handler_creation(): with pytest.raises(ValueError): GelfTlsHandler(host='127.0.0.1', port=12204, validate=True) with pytest.raises(ValueError): GelfTlsHandler(host='127.0.0.1', port=12204, keyfile='/dev/null')
Python
0.000001
e4c834fc1ef5459c0a1f8124deac8fab72e73819
Add a test.
tests/misc/rge-sm.py
tests/misc/rge-sm.py
# evolve the RGEs of the standard model from electroweak scale up # by dpgeorge import math class RungeKutta(object): def __init__(self, functions, initConditions, t0, dh, save=True): self.Trajectory, self.save = [[t0] + initConditions], save self.functions = [lambda *args: 1.0] + list(functi...
Python
0.000088
2069dccb5f1cf5dc4c0dc0ec3cca3daa3e4c87b3
Remove solr.thumbnail from test config.
tests/config.py
tests/config.py
import os import django from django.conf import settings, global_settings import oscar def configure(): if not settings.configured: from oscar.defaults import OSCAR_SETTINGS # Helper function to extract absolute path location = lambda x: os.path.join( os.path.dirname(os.path....
import os import django from django.conf import settings, global_settings import oscar def configure(): if not settings.configured: from oscar.defaults import OSCAR_SETTINGS # Helper function to extract absolute path location = lambda x: os.path.join( os.path.dirname(os.path....
Python
0
4121e3502f10f0ca36f696bf32e2dfe64bb19d0e
Create tibrvlisten.py
examples/api/tibrvlisten.py
examples/api/tibrvlisten.py
import sys import getopt from tibrv.events import * def usage() : print() print("tibrvlisten.py [-service service] [-network network]") print(" [-daemon daemon] <subject> ") print() sys.exit(1) def get_params(argv): try: opts, args = getopt.getopt(argv, '', ['service'...
Python
0.000001
5d8a9223905117e6b01099c318a2294e148f84b4
Add rpmgrill check
coprcheck/checks.py
coprcheck/checks.py
"""Checks to run on fetched builds.""" from contextlib import contextmanager from distutils.spawn import find_executable from functools import wraps import fnmatch import os from shutil import rmtree from subprocess import check_call class MissingBinaryError(OSError): """The binary required for this check is no...
Python
0
df227e598aeda7646a6ae24384a1d9e7f9179dc2
add vcs parsing test
tests/test_vcs_requirements.py
tests/test_vcs_requirements.py
from pundle import parse_vcs_requirement def test_parse_vcs_requirement(): assert parse_vcs_requirement('git+https://github.com/pampam/PKG.git@master#egg=PKG') == \ ('pkg', 'git+https://github.com/pampam/PKG.git@master#egg=PKG', None)
Python
0
5d7e4615657d947ec4a7500433f7008de223b622
Add test
tests/test_dllist.py
tests/test_dllist.py
# Copyright (C) 2016, 2017 Allen Li # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
Python
0.000005
08613bb395b4c964b15307165c7f472b59061da8
Add tests for encode
tests/test_encode.py
tests/test_encode.py
import termformat from unittest import TestCase class LargeMock: def __len__(self): return 4294967296 class LargeAtomMock(LargeMock, str): pass class LargeListMock(LargeMock, list): pass class LargeTupleMock(LargeMock, tuple): pass class LargeStringMock(LargeMock, str): pass class TermFormatEncoderT...
Python
0.000001
722b11eab90c6d532ea96209f7632e17181c0b3e
Test if points are in footprint
tests/test_inpoly.py
tests/test_inpoly.py
import unittest import pcl import numpy as np from patty_registration.conversions import loadLas, loadCsvPolygon from numpy.testing import assert_array_equal, assert_array_almost_equal from matplotlib import path class TestInPoly(unittest.TestCase): def testInPoly(self): fileLas = 'data/footprints/162.las'...
Python
0.000004
01494bfbc15987a2b925ca7990e8704767c9457b
Create secret.py
tests/secret.py
tests/secret.py
public_key = 'xxx' private_key = 'yyy'
Python
0
6b132720c1f7596db34a2fdab3f6ca0134aaabc9
create new model to store uploaded images with id
api/migrations/0001_initial.py
api/migrations/0001_initial.py
# Generated by Django 3.0 on 2020-11-07 13:11 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='UploadedImages', fields=[ ('id', models.AutoF...
Python
0
ca90d083005e1c29b3b394d556296fd8e734c40a
implement top extrapolation module
PyAnalysisTools/AnalysisTools/TopExtrapolationModule.py
PyAnalysisTools/AnalysisTools/TopExtrapolationModule.py
from PyAnalysisTools.base import _logger import ROOT class TopExtrapolationModule(object): def __init__(self, **kwargs): _logger.debug('Initialising TopExtrapolationModule') self.build_functions(**kwargs) self.type = "DataModifier" def build_functions(self, **kwargs): def buil...
Python
0
181ca07d3d7bdb3e07b8f9e608ebd8e42235a38c
test module;
mas_vae/models.py
mas_vae/models.py
from keras import backend as K from keras.models import Model, Sequential from keras.layers import Input, Dense, concatenate from keras.layers import Flatten, Reshape, BatchNormalization from keras.layers import Conv2D, MaxPooling2D, Conv2DTranspose from mas_tools.ml import save_model_arch def deep_conv2d_ae(input_s...
Python
0
0515cdac701b6fbd4bb9281b6412313ad31072cc
Add file to run flask app
app.py
app.py
from flask import Flask, request from twilio import twiml import subprocess from cmd import cmds app = Flask(__name__) import os ACCOUNT_SID = "" #os.environ['ACCOUNT_SID'] AUTH_TOKEN = "" #os.environ['AUTH_TOKEN'] APP_SID = "Twilix" #os.environ['APP_SID'] CALLER_ID = "+14389855700" #os.environ['CALLER_ID'] #CALLER_...
Python
0.000001
ea0ca70187eaadb76e84895a55ce14f8e98c671f
Add git.list_worktrees unit test
tests/unit/modules/git_test.py
tests/unit/modules/git_test.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Erik Johnson <erik@saltstack.com>` ''' # Import Python libs from __future__ import absolute_import import copy import logging import os import subprocess from distutils.version import LooseVersion # Import Salt Testing Libs from salttesting import TestCase, skipIf ...
Python
0
a0ee0998457976aa45b3d3a462f2b2aab1bfb15f
add objects module
crossprocess/objects.py
crossprocess/objects.py
#!/usr/bin/env python # -*- coding: utf-8 -*- class SimpleObject(object): def __init__(self, name): self.__name = name def get_name(self): return self.__name
Python
0
8c276c8c2e45ff0fe634669ea65d0df40c96463c
Add python example using metadata
examples/python/metadata.py
examples/python/metadata.py
from infomap import infomap myInfomap = infomap.Infomap("--two-level --meta-data-rate 0.3") # Add weight as an optional third argument myInfomap.addLink(0, 1) myInfomap.addLink(0, 2) myInfomap.addLink(0, 3) myInfomap.addLink(1, 0) myInfomap.addLink(1, 2) myInfomap.addLink(2, 1) myInfomap.addLink(2, 0) myInfomap.addLi...
Python
0.000059
7115d25c57404a42bc29513eb514073747d876ce
Add platform_map to remap Platform.os and arch based on config
src/rez/utils/platform_mapped.py
src/rez/utils/platform_mapped.py
import re def platform_mapped(func): """ Decorates functions for lookups within a config.platform_map dictionary. The first level key is mapped to the func.__name__ of the decorated function. Regular expressions are used on the second level key, values. Note that there is no guaranteed order withi...
Python
0
904a37589d8ef0f7b69d9b0f83f41c94fbbfcde6
Update 1.7 migrations
aldryn_categories/migrations/0003_auto_20150128_1359.py
aldryn_categories/migrations/0003_auto_20150128_1359.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('aldryn_categories', '0002_auto_20150109_1415'), ] operations = [ migrations.AlterField( model_name='categorytran...
Python
0
8a1448ed3bd426d11f6222d63f77604ec132b2da
Add an example for pre signed URL
examples/signed_url_auth.py
examples/signed_url_auth.py
# Copyright 2016 Catalyst IT 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 ag...
Python
0.000011
59f37975bb06edd38bbcdea6f0ea031f079ba2c3
Add an utility function to load YAML
lib/hawaiibuildbot/common/utils.py
lib/hawaiibuildbot/common/utils.py
# # This file is part of Hawaii. # # Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> # # 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 # (...
Python
0.000003
00ff9761f1b273bc1540d95161e2cd6ae5b6bfb9
Logistic regression model
genderclasslogisticregression.py
genderclasslogisticregression.py
# -*- coding: utf-8 -*- """ Copyright (c) 2016, Cynthia S. Lo 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, mer...
Python
0.999982
aad1d9b63117f9e14654a688edf147eb12e52041
add my bot
tota/heroes/matuu.py
tota/heroes/matuu.py
from tota.utils import closest, distance, sort_by_distance, possible_moves from tota.things import Tower, Ancient, Creep, Hero from tota import settings AUTHOR = "matuu" def media_position(something, default): if len(something) > 0: x = 0 y = 0 for val in something: x += val.p...
Python
0
e5a7f3fec4dc30273e582ac1a4d0374f42175c76
Add rough script to import version data from prod API for an add-on (#13869)
src/olympia/landfill/management/commands/fetch_prod_versions.py
src/olympia/landfill/management/commands/fetch_prod_versions.py
import requests from os.path import basename from urllib.parse import urlparse from django.conf import settings from django.core.files.storage import default_storage as storage from django.core.management.base import BaseCommand, CommandError from django.db.transaction import atomic from olympia import amo from olymp...
Python
0
275bf9c021c032b72c76010116aa05e0994ce631
Add a basic test for loading grading records details overview page.
tests/app/soc/modules/gsoc/views/test_grading_record_details.py
tests/app/soc/modules/gsoc/views/test_grading_record_details.py
# Copyright 2013 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 applicable law or agreed to in wr...
Python
0
8e58bf21cf39892df07d42d650619e2292b8efb5
Create new package (#7796)
var/spack/repos/builtin/packages/perl-statistics-pca/package.py
var/spack/repos/builtin/packages/perl-statistics-pca/package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0.000002
f6fc6960bf44c63fd854455efd3d5eff135d5877
Fix failing build due to missing file
SegmentEditorSplitVolume/SegmentEditorSplitVolumeLib/__init__.py
SegmentEditorSplitVolume/SegmentEditorSplitVolumeLib/__init__.py
from SegmentEditorEffects.AbstractScriptedSegmentEditorEffect import * from SegmentEditorEffects.AbstractScriptedSegmentEditorLabelEffect import * from SegmentEditorEffect import *
Python
0
c81ecdf74f3e668559ed4c257e3cdfb1d95f376c
Add files via upload
myFirstPythonProgram.py
myFirstPythonProgram.py
# Bryan Barrows # CSC 110 - 9830 # January 13th, 2017 # File: myFirstPythonProgram.py # A simple program illustrating chaotic behavior. def main(): print("This program illustrates a chaotic function") x = eval(input("Enter a number between 0 and 1: ")) for i in range(10): x = 3.9 * x * (1 - x) ...
Python
0
f3eb56111c115e65db6e55fcd1c69d695178b33b
Integrate LLVM at llvm/llvm-project@6144fc2da1b8
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "6144fc2da1b87dc64ff887d73b60f7708f5cb0a4" LLVM_SHA256 = "e6fe7c8df75bc1d3fb5f29758431e056406542768dd48333d32675dd4e06f1aa" tf_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "eb03fa1d2c05bad5a5f75a89d47b4b31d84bb90b" LLVM_SHA256 = "53260f7983218c72b07f905694505188695e94e4e68fb9f2959f89073724feac" tf_http_archive( ...
Python
0.000004
62b2c69482d36a7afcdb732dd70a037d2513ba51
Add script to execute a simple command in a remote server over SSH
bh_sshcmd.py
bh_sshcmd.py
import paramiko # pip install paramiko import os def ssh_command(ip, user, command): # you can run this script as # SSH_PRIV_KEY=[your private key path] python bh_sshcmd.py key = paramiko.RSAKey.from_private_key_file(os.getenv('SSH_PRIV_KEY')) client = paramiko.SSHClient() client.set_missing_hos...
Python
0.000001
cb7b286d1aa9fc10669b1b59afe334995a4c1174
add missed migration
taiga/projects/userstories/migrations/0021_auto_20201202_0850.py
taiga/projects/userstories/migrations/0021_auto_20201202_0850.py
# Generated by Django 2.2.14 on 2020-12-02 08:50 from django.db import migrations, models import taiga.base.utils.time class Migration(migrations.Migration): dependencies = [ ('userstories', '0020_userstory_swimlane'), ] operations = [ migrations.AlterField( model_name='user...
Python
0.000003
74d094e1071f4fadffbb5f2351c4e171e528b68e
Update split-array-into-consecutive-subsequences.py
Python/split-array-into-consecutive-subsequences.py
Python/split-array-into-consecutive-subsequences.py
# Time: O(n) # Space: O(1) # You are given an integer array sorted in ascending order (may contain duplicates), # you need to split them into several subsequences, # where each subsequences consist of at least 3 consecutive integers. Return whether you can make such a split. # # Example 1: # Input: [1,2,3,3,4,5] # Ou...
# Time: O(n) # Space: O(1) # You are given an integer array sorted in ascending order (may contain duplicates), # you need to split them into several subsequences, # where each subsequences consist of at least 3 consecutive integers. Return whether you can make such a split. # # Example 1: # Input: [1,2,3,3,4,5] # Ou...
Python
0.000154
cea70bf2f04779376b6db1570e9df0c40944782d
Create linux_x86_custom_encoder_real_world.py
assignment-4/linux_x86_custom_encoder_real_world.py
assignment-4/linux_x86_custom_encoder_real_world.py
#!/usr/bin/python # SLAE - Assignment #4: Custom Shellcode Encoder/Decoder (Linux/x86) # Author: Julien Ahrens (@MrTuxracer) # Website: http://www.rcesecurity.com from random import randint # powered by Metasploit # windows/exec CMD=calc.exe # msfvenom -p windows/exec CMD=calc.exe -f python -e generic/none # ...
Python
0.000626
615cb67e0082b6a2d2ab1c91623e9b2a20ddedec
create milestone migration for Havana release
neutron/db/migration/alembic_migrations/versions/havana_release.py
neutron/db/migration/alembic_migrations/versions/havana_release.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2013 OpenStack Foundation # # 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...
Python
0
e5247e1123ecd2e5ea1d98668ceded22d99c1c42
Create twitter-auth.py
twitter-auth.py
twitter-auth.py
# paste your apps.twitter.com keys in here access_key = "" access_secret = "" consumer_key = "" consumer_secret = ""
Python
0.000012
f63747a7e19b82a59d7ff1435725c3f35a4ba61b
Add contex processor to use cart in any template
apps/cart/context_processors.py
apps/cart/context_processors.py
from .cart import Cart def cart(request): return {'cart': Cart(request)}
Python
0
9f0b46080ff3d8861e5b11527b6490d6e3d918fb
test making sure form edits are atomic
corehq/ex-submodules/couchforms/tests/test_edits.py
corehq/ex-submodules/couchforms/tests/test_edits.py
import os from couchdbkit import ResourceNotFound, RequestFailed from django.test import TestCase from mock import MagicMock from corehq.apps.receiverwrapper import submit_form_locally from couchforms.models import XFormDeprecated, XFormInstance from couchforms.tests.testutils import post_xform_to_couch class EditFor...
import os from django.test import TestCase from couchforms.models import XFormDeprecated from couchforms.tests.testutils import post_xform_to_couch class EditFormTest(TestCase): ID = '7H46J37FGH3' def tearDown(self): try: XFormInstance.get_db().delete_doc(self.ID) except: ...
Python
0.000432
612b6e681201552d46d0887492aed72cf4f008f0
Implement cache driver for Sqlite.
engine/driver/sqlite.py
engine/driver/sqlite.py
# # dp for Tornado # YoungYong Park (youngyongpark@gmail.com) # 2014.10.23 # from engine.cache import CacheDriver as dpCacheDriver from ..model import ModelSingleton as dpModelSingleton from ..engine import Engine as dpEngine class SqliteCacheDriver(dpEngine, dpCacheDriver): @staticmethod def getpool(conf...
Python
0
7c6077e107f40a3fcc3e1414f26071ceab0e0cf6
Create missing migration in taiga.projects.notifications
taiga/projects/notifications/migrations/0006_auto_20151103_0954.py
taiga/projects/notifications/migrations/0006_auto_20151103_0954.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('notifications', '0005_auto_20151005_1357'), ] operations = [ migrations.AlterField( model_name='notifypolicy', ...
Python
0.000001
d9d27733d1885de0723f91558973c038be0386ec
Fix arm/disarm calls. (#17381)
homeassistant/components/alarm_control_panel/spc.py
homeassistant/components/alarm_control_panel/spc.py
""" Support for Vanderbilt (formerly Siemens) SPC alarm systems. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/alarm_control_panel.spc/ """ import logging import homeassistant.components.alarm_control_panel as alarm from homeassistant.helpers.dispatche...
""" Support for Vanderbilt (formerly Siemens) SPC alarm systems. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/alarm_control_panel.spc/ """ import logging import homeassistant.components.alarm_control_panel as alarm from homeassistant.helpers.dispatche...
Python
0.000001
f10209add7513cba71441b410bf3a52a1d1c816c
add new site PyDéfis
tehbot/plugins/challenge/py.py
tehbot/plugins/challenge/py.py
# -*- coding: utf-8 -*- from tehbot.plugins.challenge import * import urllib import urllib2 import urlparse import lxml.html import re class Site(BaseSite): def prefix(self): return u"[PyDéfis]" def siteurl(self): return "https://pydefis.callicode.fr" def userstats(self, user): re...
Python
0
90a22bf70efbc6b14c697305919f6fca3aae39a1
Create __init__.py
__init__.py
__init__.py
Python
0.000429
ad053bd49c0a108ed06df5385a6571b405476bd8
Create web_browser.py
web_browser.py
web_browser.py
from webbrowser import * url="https://www.google.co.in" open(url) ''' This script lets you open the given link from terminal directly. It is made meanwhile learning python. '''
Python
0.000417
a2c702e226074763f78cc49eea30a020853bc6a7
Use `raise SystemError` instead of calling sys.exit().
libexec/windows_shares_discovery_runner.py
libexec/windows_shares_discovery_runner.py
#!/usr/bin/env python # # Copyright (C) 2009-2012: # Gabes Jean, naparuba@gmail.com # Gerhard Lausser, Gerhard.Lausser@consol.de # Gregory Starck, g.starck@gmail.com # # 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 Gene...
#!/usr/bin/env python # # Copyright (C) 2009-2012: # Gabes Jean, naparuba@gmail.com # Gerhard Lausser, Gerhard.Lausser@consol.de # Gregory Starck, g.starck@gmail.com # # 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 Gene...
Python
0
3b29a94a7009c0b652e8eca0b175bb97250e1b33
Add an extract_features(image, measurements) function returning a feature vector
feature_extraction/extraction.py
feature_extraction/extraction.py
import numpy as np """ Given an image as a Numpy array and a set of measurement objects implementing a compute method returning a feature vector, return a combined feature vector. """ def extract_features(image, measurements): # TODO(liam): parallelize multiple measurements on an image by using Celery return np.rave...
Python
0.000018
1ee6e4f99318a065ee6cceaf2ed470bb3513188e
Add py-hstspreload (#19188)
var/spack/repos/builtin/packages/py-hstspreload/package.py
var/spack/repos/builtin/packages/py-hstspreload/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyHstspreload(PythonPackage): """Chromium HSTS Preload list as a Python package and update...
Python
0
6533ac770ffd97ece23dcaba154a31297be76b04
add Steam Store helper
reviews/utils.py
reviews/utils.py
import requests from django.core.cache import cache class SteamException(Exception): pass class SteamStore(object): l = None cc = None def __init__(self, language='en', country='jp'): self.l = language self.cc = country def appdetails(self, app_id: int) -> dict: url = '...
Python
0
d11491d30a2fb418dd40bf7e97d4d35cc84d6f3f
Move Chuck database query function to another file
pyjokes/chuck.py
pyjokes/chuck.py
# -*- coding: utf-8 -*- import json try: from urllib2 import urlopen except: from urllib.request import urlopen def get_chuck_nerd_jokes(): url = 'http://api.icndb.com/jokes/random?limitTo=[nerdy]' response = urlopen(url).readall().decode('utf-8') data = json.loads(response) d = data['value'...
Python
0
46db4860911e687bf5d3beef5f0b2f96ea145cd2
FIX lasso_dense_vs_sparse_data.py example needed update.
examples/linear_model/lasso_dense_vs_sparse_data.py
examples/linear_model/lasso_dense_vs_sparse_data.py
""" ============================== Lasso on dense and sparse data ============================== We show that linear_model.Lasso and linear_model.sparse.Lasso provide the same results and that in the case of sparse data linear_model.sparse.Lasso improves the speed. """ print __doc__ from time import time import nump...
""" ============================== Lasso on dense and sparse data ============================== We show that linear_model.Lasso and linear_model.sparse.Lasso provide the same results and that in the case of sparse data linear_model.sparse.Lasso improves the speed. """ print __doc__ from time import time import nump...
Python
0
53a678ea3459a32f67c7c2192d1f49e487c806aa
Set unix-style file permissons for all files in a directory tree according to a mask, taking into account directories, .sh files and .py files need to have executable permission.
tiki/doc/devtools/set_perms.py
tiki/doc/devtools/set_perms.py
#!/usr/bin/env python # $Header: /cvsroot/tikiwiki/tiki/doc/devtools/set_perms.py,v 1.2 2004-09-21 05:40:45 ggeller Exp $ # Copyright (c) 2004 George G. Geller # All Rights Reserved. See copyright.txt for details and a complete list of authors. # Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt f...
Python
0.000032
35e30faabc3fd7ca68b7b28c9fd5b7a4c15b0e21
add charset compilation script
util/charset.py
util/charset.py
# charset.py - lazy utility script for compiling character svgs, animation data and details into a single .json # # Usage: # python charset.py [charset directory] # # The charset directory should have the following: # - 'base.json' which contains the data and animation timings for each character in an array format,...
Python
0
0d9613a1410aad150ccaf4b828971ec6f9e31520
Create lang.py
lang.py
lang.py
Python
0.000024
2f268173e25bee5d671583bb905829e0ffd4f631
Add management command to clear all matches mostly useful with heroku
match/management/commands/reset-matches.py
match/management/commands/reset-matches.py
from django.core.management.base import BaseCommand, CommandError from match.models import Match import sys class Command(BaseCommand): help = 'Reset all match data' def handle(self, *args, **options): Match.objects.all().delete()
Python
0
732eee568f19ed2e63f357b62fa539ff50a1c046
add program to display light readings in terminal in inf loop
light.py
light.py
#!/usr/bin/python """ light.py Read analog values from the photoresistor ======= run with: sudo ./light.py Copyright 2014 David P. Bradway (dpb6@duke.edu) 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...
Python
0
a35b15cb19abc435b4088ce2c2734ba891954897
add other time integrators integrate with cmepy/solver.py
cmepy/other_solver.py
cmepy/other_solver.py
import numpy import scipy #from cmepy import solver from cmepy.ode_solver import Solver class SolverOther(Solver): """ SolverOther is a wrapper for several other time solvers, in particular: - explicit Euler - implicit Euler - Heun (explicit two step method) - implicit two step method from Deu...
Python
0
591bdcbfb80927d0ffb4922eb684fe7ce17c5456
Add manage.py
web/zoohackathon2016/manage.py
web/zoohackathon2016/manage.py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zoohackathon2016.settings") try: from django.core.management import execute_from_command_line except ImportError: # The above import may fail for some other reason. Ensure ...
Python
0.000001
cb26da63add95ebf9e7aa84a381293dd80f433cb
add test_db, test is OK
www/test_db.py
www/test_db.py
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Haibo-Yu' from models import User, Blog, Comment from transwarp import db db.create_engine(user='www-data', password='www-data', database='awesome') u = User(name='Test', email='test@example.com', password='1234567890', image='about:blank') u.insert() p...
Python
0.998585
ad5b3a334203394792c90b0d1bfe2dda8efe13b3
add admin interface for tracking logs
common/djangoapps/track/admin.py
common/djangoapps/track/admin.py
''' django admin pages for courseware model ''' from track.models import * from django.contrib import admin admin.site.register(TrackingLog)
Python
0
0196d9498644223959b4efae4fc084552bec8393
Add check_tar test.
check_tar.py
check_tar.py
#!/usr/bin/env python3 from argparse import ArgumentParser import logging import os import tarfile from textwrap import dedent import re import sys class TarfileNotFound(Exception): """Raised when specified tarfile cannot be found.""" class TestedDirNotFound(Exception): """Raised when specified tested text ...
Python
0
a0123aad7414ce78be6b0c984f0895bba9568c99
Solve 50.
050/solution.py
050/solution.py
# coding: utf-8 """ Project Euler problem #50. """ import itertools as it def problem(): u""" Solve the problem. The prime 41, can be written as the sum of six consecutive primes: 41 = 2 + 3 + 5 + 7 + 11 + 13 This is the longest sum of consecutive primes that adds to a prime below one-hundred...
Python
0.999992
e3462c036da4030886594082a563b699b296a77c
Test Pool's AddDevs().
tests/dbus/pool/test_add_devs.py
tests/dbus/pool/test_add_devs.py
# Copyright 2016 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
Python
0
643d7e4c20c759e70113d8c4d447e1338da8fd8c
Use cases as documented at https://github.com/ionomy/ion/wiki/
test/functional/token_test-pt1.py
test/functional/token_test-pt1.py
#!/usr/bin/env python3 # Copyright (c) 2014-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the functionality of all CLI commands. """ from test_framework.test_framework import BitcoinTestF...
Python
0
4e7310e8d7485e132c62c85599e2694d228e0747
Add an example
examples/chat.py
examples/chat.py
from zeroservices import BaseService from zeroservices import ZeroMQMedium from time import time class ChatService(BaseService): def __init__(self, username): self.username = username super(ChatService, self).__init__(ZeroMQMedium(self, port_random=True)) def service_info(self): ret...
Python
0
8c4833dbf9f4ae32afbfbe6a3cb8e4630abc3d25
Add test for local login
test/requests/test_login_local.py
test/requests/test_login_local.py
import requests from wqflask import user_manager from parametrized_test import ParametrizedTest class TestLoginLocal(ParametrizedTest): def setUp(self): super(TestLoginLocal, self).setUp() self.login_url = self.gn2_url +"/n/login" data = { "es_connection": self.es, ...
Python
0
008711b6d5506aed60a693c296a7a01180c2ea86
Create dss.py
dss.py
dss.py
from functions import * import multiprocessing import time with open("config.txt") as f: lines = f.readlines() max_instances = int(lines[0].split(' ')[1]) class machine(): 'Class for the instance of a machine' q = [multiprocessing.Queue() for i in range(max_instances + 1)] # q[0] is unused ...
Python
0.000001
c0e7393c5cc3f1095891a35b552e4a69733c83b6
add a simple example
demos/helloworld.py
demos/helloworld.py
#!/usr/bin/env python from __future__ import with_statement import PyV8 class Global(PyV8.JSClass): def writeln(self, arg): print arg with PyV8.JSContext(Global()) as ctxt: ctxt.eval("writeln('Hello World');")
Python
0.999997
5669960952104b811df34fa9229d7e597407c753
add basic unit testing for appliance instances (incomplete)
tests/test_appliance_instance.py
tests/test_appliance_instance.py
import sys sys.path.append('..') import disaggregator as da import unittest import pandas as pd import numpy as np class ApplianceInstanceTestCase(unittest.TestCase): def setUp(self): indices = [pd.date_range('1/1/2013', periods=96, freq='15T'), pd.date_range('1/2/2013', periods=96, fre...
Python
0.000017
54f7cdf15d3fdbd70a5f06ec38aa84dfd828c7e7
Add simple gui
gui.py
gui.py
from tkinter import Tk, LEFT, SUNKEN, X from tkinter.ttk import Frame, Button, Style from PIL import Image, ImageTk def main(): root = Tk() root.geometry("300x300") separator = Frame(root, height=200, relief=SUNKEN) separator.pack(fill=X, padx=10) s = Style() s.configure("Visible.TButton", f...
Python
0.000001
5af36bbe29a8a7a7418fc535c5647c9be511f0b4
Add script to write user counts to csv.
scripts/userCounts.py
scripts/userCounts.py
""" Script to write user counts for each region to CSV. """ import twitterproj def main(): db = twitterproj.connect() filenames = ['grids/counties.user_counts.bot_filtered.csv', 'grids/states.user_counts.bot_filtered.csv', 'grids/squares.user_counts.bot_filtered.csv'] ...
Python
0
fb15c992a286abe066333abfdabbb13646d383d6
Create final_P7_Frob.py
final_P7_Frob.py
final_P7_Frob.py
class Frob(object): def __init__(self, name): self.name = name self.before = None self.after = None def setBefore(self, before): # example: a.setBefore(b) sets b before a self.before = before def setAfter(self, after): # example: a.setAfter(b) sets b after a ...
Python
0.000866
0c18bb0993be77059aa75015cc5433eaacbe8999
Add barebones RFC downloader and renderer.
rfc.py
rfc.py
import pydoc import sys try: from urllib.request import urlopen except ImportError: from urllib2 import urlopen def get_rfc(rfc): url = "http://www.ietf.org/rfc/rfc{0}.txt".format(rfc) f = urlopen(url) data = f.read() if isinstance(data, bytes): data = data.decode('utf-8') return...
Python
0