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
bdc04453938366e28ff91b6e16c536eca84d8bef
add summary generator
summary.py
summary.py
#!/usr/bin/env python import os import json import argparse from argparse import ArgumentDefaultsHelpFormatter from time import gmtime, strftime, mktime import datetime class DatetimeConverter(object): TIME_STR_FORMAT = '%Y-%m-%dT%H:%M:%S' @staticmethod def get_UTC(): return gmtime() @stat...
Python
0.000001
d75c519eb4c3b276f04ba58277d03801c8568ff0
Create 4.py
solutions/4.py
solutions/4.py
# A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. # Find the largest palindrome made from the product of two 3-digit numbers. def main(): max =0 for i in range(999,900,-1): for j in range(999,900,-1): prod...
Python
0.000001
21ddecb7804501476d35290b0b0cb2b7311728ab
add hello world tornado
server.py
server.py
import tornado.ioloop import tornado.web class MainHandler(tornado.web.RequestHandler): def data_received(self, chunk): pass def get(self): self.write("Hello, world") def make_app(): return tornado.web.Application([ (r"/", MainHandler), ]) if __name__ == "__main__": ap...
Python
0.999999
19cfaf8534626e5c6b5193da40a17cc092b24758
Use tuple instead of a list for DEFAULT_VIEWPORT_VIRTUAL_TAGS
taskwiki/constants.py
taskwiki/constants.py
DEFAULT_VIEWPORT_VIRTUAL_TAGS = ("-DELETED", "-PARENT") DEFAULT_SORT_ORDER = "due+,pri-,project+"
DEFAULT_VIEWPORT_VIRTUAL_TAGS = ["-DELETED", "-PARENT"] DEFAULT_SORT_ORDER = "due+,pri-,project+"
Python
0.000366
d93dada0fe434cd736d11b9cfb1635146130f24a
Add 031
031/main.py
031/main.py
# Integers avoid having to rely on decimal.Decimal # to handle rounding errors COINS = 1, 2, 5, 10, 20, 50, 100, 200 TARGET = 200 visited = set() solutions = [] stack = [(0, (0,) * len(COINS))] while stack: total, state = stack.pop() for cn, coin in enumerate(COINS): new_total = total + coin ...
Python
0.00051
1d51529add69d2ce43829d0f09f25f2ab897125f
Add info-bar-gtk.
src/info_bar_gtk.py
src/info_bar_gtk.py
# Copyright 2011 Google 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
eaace54d5e7d8d2ebad42cf31cf071a9cf9d3e50
test case for creating a new story
umklapp/test.py
umklapp/test.py
from django.test import TestCase from django.test.utils import override_settings from umklapp.models import * class UmklappTestCase(TestCase): def addUsers(self): self.users = [] for i in range(0,7): u = User.objects.create_user( "user%d" % i, "test@exam...
Python
0.00035
d20e468a32d1f476196525848688ae64845c4dce
Add Python solution
sg-ski.py
sg-ski.py
#!/usr/bin/env python import sys def parse_map_file(path): map_grid = [] with open(path, 'r') as f: width, height = map(int, f.readline().split()) for line in f: row = map(int, line.split()) map_grid.append(row) assert height == len(map_grid) assert width == len...
Python
0.000444
78e0135169d2c53b0b99c7811109eb1da040f14d
add bin2h.py
tools/bin2h.py
tools/bin2h.py
#!/usr/bin/env python # vim: set expandtab ts=4 sw=4 tw=100: import sys from optparse import OptionParser parser = OptionParser() parser.add_option("-b", "--before", dest="before", action="append", help="text to put before, may be specified more than once") parser.add_option("-a", "--after", dest="a...
Python
0
d68cfae0cac869d6676643e33479383bc11b086a
Add najeto.py script.
utils/najeto.py
utils/najeto.py
""" Calculate elapsed distance based on hJOP HV csv output. """ import sys import csv class HV: def __init__(self, addr: int, name: str, owner: str) -> None: self.address: int = addr self.name: str = name self.owner: str = owner self.start_forward: float = 0 self.start_bac...
Python
0
cf8a0105e0c4fc6af04ede6c7ae4fe4f4dac048e
add migrations
accelerator/migrations/0103_update_startupupdate_model.py
accelerator/migrations/0103_update_startupupdate_model.py
# Generated by Django 2.2.28 on 2022-05-09 11:20 from django.db import ( migrations, models, ) class Migration(migrations.Migration): dependencies = [ ('accelerator', '0102_update_program_model'), ] operations = [ migrations.AddField( model_name='startupupdate', ...
Python
0
7014c5affa780044fd46911287d883024bae3fae
Create ipy_custom_hbox.py
basics/layout/ipy_custom_hbox.py
basics/layout/ipy_custom_hbox.py
from PySide import QtCore from PySide import QtGui class MyHBoxLayout(QtGui.QHBoxLayout): def __init__(self, *args, **kwargs): super(MyHBoxLayout, self).__init__(*args, **kwargs) @property def margins(self): return self.contentsMargins() @margins.setter def margins(self, ...
Python
0.000003
29a8a4d6dc125785c450e66bd90239995ba50841
Add clitest.py.
test/clitest.py
test/clitest.py
# -*- coding: utf-8 -*- # Copyright 2014 Jan-Philip Gehrcke. See LICENSE file for details. from __future__ import unicode_literals import os import shutil import logging import subprocess import traceback logging.basicConfig( format='%(asctime)s,%(msecs)-6.1f %(funcName)s# %(message)s', datefmt='%H:%M:%S') ...
Python
0.000005
0454f0aaddb581f172e5a9f5d2f503bd711af86d
Create core framework for 2D truss evaluation
truss_struct.py
truss_struct.py
import numpy as np from scipy.optimize import fsolve from scipy.optimize import minimize numerical_mult = 1e9 class truss: def __init__(self, x1, x2, y1, y2, E, A, node1, node2, stress=None): self.x1 = x1 self.x2 = x2 self.y1 = y1 self.y2 = y2 self.E = E ...
Python
0
6c1b5d91a9119a073eb0d41626d7464b3ff96aee
Add module with IntervalTree class.
typhon/trees.py
typhon/trees.py
""" Module that provides classes for tree creation and handling. Trees are powerful structures to sort a huge amount of data and to speed up performing query requests on them significantly. """ import numpy as np __all__ = [ "IntervalTree" ] class IntervalTreeNode: """Helper class for IntervalTree. ""...
Python
0
17067d5d25c5ce755ba86505ffcf1dd6fd572deb
Initialize version.py
version.py
version.py
"""python-tutorials version.""" __version__ = '1.0.1'
Python
0.000004
bc518732086795c699290d49f30ad5d449b79f9e
add template for settings.py
proyecto_eees/settings-template.py
proyecto_eees/settings-template.py
""" Django settings for proyecto_eees project. Generated by 'django-admin startproject' using Django 1.11.5. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ imp...
Python
0
c95ef4dc0771098e3589721851865f012b652136
add requirements unit test
awx/main/tests/unit/test_python_requirements.py
awx/main/tests/unit/test_python_requirements.py
from pip.operations import freeze from django.conf import settings def test_req(): def check_is_in(src, dests): if src not in dests: src2 = [src[0].replace('_', '-'), src[1]] if src2 not in dests: print("%s not in" % src2) return False el...
Python
0
5f47cf46c82d9a48a9efe5ad11c6c3a55896da12
Implement abstract class for csc and csr matrix
cupy/sparse/compressed.py
cupy/sparse/compressed.py
from cupy import cusparse from cupy.sparse import base from cupy.sparse import data as sparse_data class _compressed_sparse_matrix(sparse_data._data_matrix): def __init__(self, arg1, shape=None, dtype=None, copy=False): if isinstance(arg1, tuple) and len(arg1) == 3: data, indices, indptr = ar...
Python
0.000047
e99af02407edf1424733350a359264c2202b27c3
Add unit test for appending with write_raster_netcdf.
landlab/io/netcdf/tests/test_write_raster_netcdf.py
landlab/io/netcdf/tests/test_write_raster_netcdf.py
import numpy as np import pytest from numpy.testing import assert_array_equal from landlab import RasterModelGrid from landlab.io.netcdf import WITH_NETCDF4, NotRasterGridError, write_raster_netcdf def test_append_with_time(tmpdir): field = RasterModelGrid(4, 3) field.add_field("node", "topographic__elevatio...
Python
0
36333c275f4d3a66c8f14383c3ada5a42a197bea
Add module for displaying RAM usage
bumblebee/modules/memory.py
bumblebee/modules/memory.py
import bumblebee.module import psutil def fmt(num, suffix='B'): for unit in [ "", "Ki", "Mi", "Gi" ]: if num < 1024.0: return "{:.2f}{}{}".format(num, unit, suffix) num /= 1024.0 return "{:05.2f%}{}{}".format(num, "Gi", suffix) class Module(bumblebee.module.Module): def __init_...
Python
0
dd1bface79e3fcc53e9e8b1cc10ea9f467b757f2
update use of AppCommand
django_extensions/management/commands/create_jobs.py
django_extensions/management/commands/create_jobs.py
# -*- coding: utf-8 -*- import os import sys import shutil from django.core.management.base import AppCommand from django.core.management.color import color_style from django_extensions.management.utils import _make_writeable, signalcommand class Command(AppCommand): help = "Creates a Django jobs command direct...
# -*- coding: utf-8 -*- import os import sys import shutil from django.core.management.base import AppCommand from django.core.management.color import color_style from django_extensions.management.utils import _make_writeable, signalcommand class Command(AppCommand): help = "Creates a Django jobs command direct...
Python
0
06b536cdfd684d12ce64670bde50fdcbf7a71bd2
Add a workspace_binary rule to run a binary from the workspace root
defs/run_in_workspace.bzl
defs/run_in_workspace.bzl
# Copyright 2018 The Kubernetes 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 ...
Python
0.000001
eda3e6c005c1115a039f394d6f00baabebd39fee
Add command for full daily build process
calaccess_website/management/commands/updatebuildpublish.py
calaccess_website/management/commands/updatebuildpublish.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Update to the latest available CAL-ACCESS snapshot and publish the files to the website. """ import logging from django.core.management import call_command from calaccess_raw.management.commands.updatecalaccessrawdata import Command as updatecommand logger = logging.get...
Python
0
52637b519ca7e743b913f55c37a2ae952a520d9f
List commands of given apps
django_dev_commands/management/commands/commands.py
django_dev_commands/management/commands/commands.py
# -*- coding: utf-8 -*- """List commands of the specified applications. By passing command line arguments that represents regexs of app names you can list the commands of those apps only. """ import re from django.core.management import get_commands, execute_from_command_line from django.core.management.base import B...
Python
0.99999
056966052d0c23395a205511dce2e9577f376539
Add Sequence
chainerrl/links/sequence.py
chainerrl/links/sequence.py
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from builtins import super from future import standard_library standard_library.install_aliases() import inspect import chainer from chainerrl.recurrent import Recurrent...
Python
0.000048
b8acaf64187f5626ef6755ef00d2b2a1471d4914
Add closure type inference test
numba/tests/closures/test_closure_type_inference.py
numba/tests/closures/test_closure_type_inference.py
import numpy as np from numba import * from numba.tests.test_support import * @autojit def test_cellvar_promotion(a): """ >>> inner = test_cellvar_promotion(10) 200.0 >>> inner.__name__ 'inner' >>> inner() 1000.0 """ b = int(a) * 2 @jit(void()) def inner(): print a...
Python
0.000006
79e3931d1a89fc1423e098b108a78302349c3f04
Add a test scenario for establish of vpn connection
ec2api/tests/functional/scenario/test_vpn_routing.py
ec2api/tests/functional/scenario/test_vpn_routing.py
# Copyright 2014 OpenStack Foundation # 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 requ...
Python
0.000293
3a04bff5a7940463d6429918215429700befb507
add valid-number
valid-number.py
valid-number.py
# Link: https://oj.leetcode.com/problems/valid-number/ class Solution: """ Notes please see https://blog.xiaoba.me/2014/11/10/leetcode-valid-number.html """ # @param s, a string # @return a boolean def isNumber(self, s): stateTable = [ [ 1, 1, 1, 3, 3, 7, 7, 7,-1], ...
Python
0.999993
dec6ea168c68e267f15b74407f8745d242629d30
Create tokens.py
tokens.py
tokens.py
C_KEY = "" C_SECRET = "" A_TOKEN = "" A_TOKEN_SECRET = ""
Python
0.000001
d56c3528ad8058231910fd3d06895f39174eeb6c
Prepare v2.16.2.dev
flexget/_version.py
flexget/_version.py
""" Current FlexGet version. This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by release scripts in continuous integration. Should (almost) never be set manually. The version should always be set to the <next release version>.dev The jenkins release job wi...
""" Current FlexGet version. This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by release scripts in continuous integration. Should (almost) never be set manually. The version should always be set to the <next release version>.dev The jenkins release job wi...
Python
0.000007
502beb022bb7d4e70f44e40411a1af2f7f08c14e
add test version
CexioAPI.py
CexioAPI.py
# # CexioAPI class # # @author zhzhussupovkz@gmail.com # # The MIT License (MIT) # # Copyright (c) 2013 Zhussupov Zhassulan zhzhussupovkz@gmail.com # # 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...
Python
0
111966757a57d929263de342fa8c6a0af2f26869
Add normalize_field processing algorithm
svir/processing/normalize_field.py
svir/processing/normalize_field.py
# -*- coding: utf-8 -*- """ *************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as pub...
Python
0.000009
a475d50d2b7b9febe5fb01bb185b63cbbe25f4d1
add migration to remove fields
hoover/search/migrations/0006_auto_20200303_1309.py
hoover/search/migrations/0006_auto_20200303_1309.py
# Generated by Django 2.2.7 on 2020-03-03 13:09 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('search', '0005_rename_user_hypens_to_dots'), ] operations = [ migrations.RemoveField( model_name='collection', name='loader'...
Python
0.000001
32108ccab67a76a05150e8cfb5bbdf2ff3477346
Create minesweeper.py
game/minesweeper.py
game/minesweeper.py
from tkinter import * root = Tk() root.resizable(0, 0) root.title("Minesweeper") frame = Frame(root) Grid.rowconfigure(root, 0, weight=1) Grid.columnconfigure(root, 0, weight=1) frame.grid(row=0, column=0) class Tiles: def __init__(self, frame, size): self.size = size self.frame = frame self.tiles[] for x ...
Python
0.000001
a75e87fd3b4fc3f370554227cefc4687593621ca
fix merge fup
gdbpool/psyco_ge.py
gdbpool/psyco_ge.py
"""A wait callback to allow psycopg2 cooperation with gevent. Use `make_psycopg_green()` to enable gevent support in Psycopg. """ # Copyright (C) 2010 Daniele Varrazzo <daniele.varrazzo@gmail.com> # and licensed under the MIT license: # # Permission is hereby granted, free of charge, to any person obtaining a copy # ...
Python
0.000001
5f503f0b9ab51ca2b1985fe88d5e84ff63b7d745
Add sample playlists for testing features.
addplaylists.py
addplaylists.py
#!/usr/bin/env python2 from datetime import datetime from datetime import timedelta import random from wuvt.trackman.lib import perdelta from wuvt import db from wuvt.trackman.models import DJSet, DJ today = datetime.now() print("adding dj") dj = DJ(u"Johnny 5", u"John") db.session.add(dj) db.session.commit() print("...
Python
0
1905395783d5a0f5997e6e620ba09d41398840e0
add test_vincia.py
test_vincia.py
test_vincia.py
from deepjets.generate import generate_events for event in generate_events('w_vincia.config', 1, vincia=True): pass
Python
0.000004
4fab31eef9ad80230b36039b66c70d94456e5f9b
Add missing tests file from previous commit.
tests/monad.py
tests/monad.py
'''Test case for monads and monoidic functions ''' import unittest from lighty import monads class MonadTestCase(unittest.TestCase): '''Test case for partial template execution ''' def testNumberComparision(self): monad = monads.ValueMonad(10) assert monad == 10, 'Number __eq__ error: %s...
Python
0
5e4a8e4e90bbf41442a384ab9323822a448c0941
Add Exercises 8.1, 8.15.
Kane1985/Chapter4/Ex8.1_8.15.py
Kane1985/Chapter4/Ex8.1_8.15.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Exercises 8.1, 8.15 from Kane 1985. """ from __future__ import division from collections import OrderedDict from sympy import diff, factor, solve, simplify, symbols from sympy import sin from sympy.physics.mechanics import ReferenceFrame, Point from sympy.physics.mechan...
Python
0.000206
62207985d301dc9a47b0334f02a3f0c942e19d22
Add packetStreamerClient example
example/packetStreamerClientExample.py
example/packetStreamerClientExample.py
#!/usr/bin/python import urllib2 import json import re import sys from optparse import OptionParser sys.path.append('~/floodlight/target/gen-py') sys.path.append('~/floodlight/thrift/lib/py') from packetstreamer import PacketStreamer from packetstreamer.ttypes import * from thrift import Thrift from thrift.transpo...
Python
0
50141a66831d080ecc0791f94d1bd3bfec0aeb65
Add migration for #465
judge/migrations/0046_blogpost_authors.py
judge/migrations/0046_blogpost_authors.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2016-09-08 16:54 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('judge', '0045_organization_access_code'), ] operations = [ migrations.AddFie...
Python
0
364f8fedb492c1eedd317729b05d3bd37c0ea4ad
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
e5931a5837b1574681757e2c6fc7260122b48746
Add minify util
web-app/js/ofm/scripts/utils/minify.py
web-app/js/ofm/scripts/utils/minify.py
#!/usr/bin/python2.6 # Minify Filemanager javascript files # Usage : $ python ./utils/minify.py class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' def disable(self): self.HEADER = '' self.OKBL...
Python
0.002208
348ffbf16fcb67768d72bd18167e6c70c99a27a1
Add Homodyne node
gpi/Homodyne_GPI.py
gpi/Homodyne_GPI.py
# Author: Ashley Anderson III <aganders3@gmail.com> # Date: 2015-10-10 21:13 # Copyright (c) 2015 Dignity Health from __future__ import absolute_import, division, print_function, unicode_literals import os # gpi, future import gpi from bart.gpi.borg import IFilePath, OFilePath, Command # bart import bart base_path ...
Python
0.000022
1a7fa8080d19909ccf8e8e89aa19c92c1413f1c1
Add script to submite jobs again
apps/pyjob_submite_jobs_again.py
apps/pyjob_submite_jobs_again.py
#!/usr/bin/env python3 import os import sys import subprocess right_inputs = False if len(sys.argv) > 2 : tp = sys.argv[1] rms = [int(x) for x in sys.argv[2:]] if tp in ['ma', 'ex', 'xy']: right_inputs = True curdir = os.getcwd() if right_inputs: if curdir.endswith('trackcpp'): flatfile = 'fl...
Python
0
1bf7439c67e2206acb0c6d285014261eeb18097f
Add coverage as single execution
coverage.py
coverage.py
from app import initialization from app.configuration import add from app.check import * initialization.run() add('phpunit-coverage', 'true') phpunit.execute()
Python
0.000009
67f5e4a4ec4606d00fb94139b9c39c7abe0be33b
Add browse queue statistics sample
samples/python/queue_statistics.py
samples/python/queue_statistics.py
''' This sample will read all queue statistic messages from SYSTEM.ADMIN.STATISTICS.QUEUE. MQWeb runs on localhost and is listening on port 8081. ''' import json import httplib import socket import argparse parser = argparse.ArgumentParser( description='MQWeb - Python sample - Browse statistic messages from SYSTEM...
Python
0
884ae74bb75e5a0c60da74791a2e6fad9e4b83e5
Add py solution for 436. Find Right Interval
py/find-right-interval.py
py/find-right-interval.py
from operator import itemgetter # Definition for an interval. # class Interval(object): # def __init__(self, s=0, e=0): # self.start = s # self.end = e class Solution(object): def findRightInterval(self, intervals): """ :type intervals: List[Interval] :rtype: List[int] ...
Python
0.998967
07f8fd56ab366a2d1365278c3310ade4b1d30c57
Add functional test for version negotiation
heat_integrationtests/functional/test_versionnegotiation.py
heat_integrationtests/functional/test_versionnegotiation.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.000058
4b8f7a4c97668b4dbd8634d6b01e30b71737c3bd
fix send_HTML_email to work when no email_from argument is supplied
dimagi/utils/django/email.py
dimagi/utils/django/email.py
from django.conf import settings from django.core.mail import get_connection from django.core.mail.message import EmailMultiAlternatives NO_HTML_EMAIL_MESSAGE = """ Your email client is trying to display the plaintext version of an email that is only supported in HTML. Please set your email client to display this mess...
from django.conf import settings from django.core.mail import get_connection from django.core.mail.message import EmailMultiAlternatives NO_HTML_EMAIL_MESSAGE = """ Your email client is trying to display the plaintext version of an email that is only supported in HTML. Please set your email client to display this mess...
Python
0
f7c4f8d43b30dfee36d4ff46e9133194a15b3e81
Add tests for __unicode__ functions in model. (#1026)
tests/unit/accounts/test_models.py
tests/unit/accounts/test_models.py
from django.contrib.auth.models import User from django.test import TestCase from accounts.models import Profile, UserStatus class BaseTestCase(TestCase): def setUp(self): self.user = User.objects.create( username='user', email='user@test.com', password='password') ...
Python
0
3e5b98c1a79f625fbf9f54af782e459de7fa5b1f
update migration with new filename and parent migration name
accelerator/migrations/0052_cleanup_twitter_urls.py
accelerator/migrations/0052_cleanup_twitter_urls.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations from accelerator.twitter_handle_cleanup import ( clean_entrepreneur_profile_twitter_handles, clean_expert_profile_twitter_handles, clean_organization_twitter_handles ) def clean_up_twitter_handles(apps, sche...
Python
0
c97f648a012c38802d9637d4c573a4ca9c8e1633
Create encoder.py
additional/customencoder/encoder.py
additional/customencoder/encoder.py
#!/usr/bin/python #below is the shellcode for /bin/sh using execve sys call shellcode = ("\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x89\xe2\x53\x89\xe1\xb0\x0b\xcd\x80") t=[] w=[] z=[] ror = lambda val, r_bits, max_bits: \ ((val & (2**max_bits-1)) >> r_bits%max_bits) | \ (val << (max_b...
Python
0.000004
30bb33609d9e22b6999d086196ed622a456d7dc2
Create incomplete_minimal_logger.py
lld_practice/incomplete_minimal_logger.py
lld_practice/incomplete_minimal_logger.py
# just trying to minimize what all it offers # reference python standard logging module snippets CRITICAL = 50 FATAL = CRITICAL ERROR = 40 WARNING = 30 WARN = WARNING INFO = 20 DEBUG = 10 NOTSET = 0 _levelToName = { CRITICAL: 'CRITICAL', ERROR: 'ERROR', WARNING: 'WARNING', INFO: 'INFO', DEBUG: 'DE...
Python
0.000147
fb004f72c27b49ba9661e6a83b8f49be39757d22
add changemath shell
math_change.py
math_change.py
import sys filename = './Deterministic Policy Gradient Algorithms笔记.md' outname = '' def change(filename, outname): f = open(filename, encoding='utf8') data = f.readlines() f.close() out = '' doublenum = 0 for line in data: if line=='$$\n': doublenum += 1 i...
Python
0.000009
79ea8a3a9ac43ba5ab9789e4962b4fb0814dccc0
clean up localsettings example
localsettings.example.py
localsettings.example.py
import os import sys ####### Database config. This assumes Postgres ####### DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'commcarehq', 'USER': 'postgres', 'PASSWORD': '******' } } ####### Couch Config ###### COUCH_SERVER_ROOT = '127.0...
import os # Postgres config DATABASE_ENGINE = 'postgresql_psycopg2' DATABASE_NAME = 'commcarehq' DATABASE_USER = 'postgres' DATABASE_PASSWORD = '*****' DATABASE_HOST = '' DATABASE_PORT = '5432' DJANGO_LOG_FILE = "/var/log/datahq/datahq.django.log" LOG_SIZE = 1000000 LOG_LEVEL = "DEBUG" LOG_FILE = "/var/log/datah...
Python
0.000001
cc6f30cb1c91b321db6bf77496c8b6fe7c56aabb
Add log parser
log_parser/parse_logs.py
log_parser/parse_logs.py
#!/usr/bin/env python ###################################################### # -*- coding: utf-8 -*- # File Name: parse_logs.py # Author: James Hong & Qian Li # Created Date: 2017-10-28 # Description: Parse CloudWatch logs ###################################################### import argparse import json im...
Python
0.000006
f380db268eecec80a5ab12fcc553c0278452b18a
add file ProbModelXML.py along with an example of student model
pgmpy/readwrite/ProbModelXML.py
pgmpy/readwrite/ProbModelXML.py
""" ProbModelXML: http://leo.ugr.es/pgm2012/submissions/pgm2012_submission_43.pdf For the student example the ProbModelXML file should be: <?xml version=“1.0” encoding=“UTF-8”?> <ProbModelXML formatVersion=“1.0”> <ProbNet type=BayesianNetwork > <AdditionalConstraints /> <Comment> Stude...
Python
0
394fed634204ea98afb443ab4574a7cc31c09529
Create and delete objects in workspace context. Refs gh-185, gh-189
tests/GIR/test_412_object_in_workspace_context.py
tests/GIR/test_412_object_in_workspace_context.py
# coding=utf-8 import sys import struct import unittest from test_000_config import TestConfig from test_020_connection import TestConnection from gi.repository import Midgard from gi.repository import GObject from bookstorequery import BookStoreQuery # In this test, we depend on workspace context test, which leave...
Python
0
59b1787f620e4665b17b0cc2283c2363aac92d18
add test class for game
tests/game_test.py
tests/game_test.py
from unittest import TestCase from model.game import Game from model.player import Player from model.card import Card class GameWithThreePlayerTest(TestCase): def setUp(self): self.game = Game([Player("P1"), Player("P2"), Player("P3")]) def test_createDeck_correctSize(self): # then s...
Python
0
209314b65ee960d73ee81baad6b9ced4102d6c0b
Introduce GenericSparseDB() class
lib/generic_sparse_db.py
lib/generic_sparse_db.py
#!/usr/bin/env python # -*- encoding: utf-8 import gzip import scipy.io as sio from utils.utils import Utils class GenericSparseDB(Utils): def init(self): self.data = sio.mmread(gzip.open(self._matrix_fn)).tolil() self.factors = self._load_pickle(self._factors_fn) self.fac_len = len(self.factor...
Python
0
47dff2561be481ff067c22ed98d9ea6a9cf8ae10
Add test to execute notebooks
test/test_notebook.py
test/test_notebook.py
import os import glob import contextlib import subprocess import pytest notebooks = list(glob.glob("*.ipynb", recursive=True)) @contextlib.contextmanager def cleanup(notebook): name, __ = os.path.splitext(notebook) yield fname = name + ".html" if os.path.isfile(fname): os.remove(fname) @py...
Python
0.000001
ec033203d8e82258347eb4f6a6a83ef67bc9171c
Add expr tests
tests/test_Expr.py
tests/test_Expr.py
#!/usr/bin/python3 import pytest import numpy as np def test_nans_in_same_place(testCOB): norm_expr = testCOB.expr(raw=False) raw_expr = testCOB.expr(raw=True).ix[norm_expr.index,norm_expr.columns] assert all(np.isnan(norm_expr) == np.isnan(raw_expr)) def test_inplace_nansort(testCOB): x = np.random....
Python
0.000001
f3c4b7513c49189750ea15b36e561a4e5ed56214
add linear classification back
soccer/gameplay/evaluation/linear_classification.py
soccer/gameplay/evaluation/linear_classification.py
# Classifies a feature into any number of classes # Linear classfication defined is # y = f(x, w, b) where... # x is a vector of input features of an object # w is a vector of weights to apply to the features # b is the bias of the feature-weight system # f() is x dot w + b # y is the final output score #...
Python
0.000342
14c20e35bcfc55cc3c12d94596079fc27a907f94
Add unit tests
tests/test_unit.py
tests/test_unit.py
import unittest from test_utilities import mapTestJsonFiles, mapJsonToYml, testYaml, getImmediateSubdirectories, unidiff_output class TestUnit(unittest.TestCase): def test_input(self): testDirectories = getImmediateSubdirectories('test_input') for directory in testDirectories: json = ma...
Python
0.000001
c2b082ebe95acc24f86fde9cd6875d7de3a9ca40
Set up test_user file
tests/test_user.py
tests/test_user.py
import unittest import settings import requests_mock from util import register_uris from pycanvas.user import User from pycanvas.exceptions import ResourceDoesNotExist from pycanvas import Canvas class TestUser(unittest.TestCase): """ Tests core Account functionality """ @classmethod def setUpCla...
Python
0.000002
39589065b158061c280f68fa730f72bf595428be
Add Stata package (#10189)
var/spack/repos/builtin/packages/stata/package.py
var/spack/repos/builtin/packages/stata/package.py
# Copyright 2018 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 * import os from datetime import datetime class Stata(Package): """STATA is a general-purpose statistic...
Python
0
c5a2d916fa907aa15a425dedc405ecc0ae2ba668
Add script to compare taxa from before and after filter step
compare_taxa.py
compare_taxa.py
#!/usr/bin/env python """Module to compare filtered and unfiltered taxa deduced from their respective trees to assert that they match.""" from divergence import parse_options import logging as log import sys def fail(unfiltered_a, unfiltered_b, filtered_a, filtered_b): """Report error back to the user and exit wi...
Python
0
5ba9feee6195a1f8b488888bf2065a8a5cba94b8
Add countdown written in python
tools/countdown.py
tools/countdown.py
#!/bin/env python3 """ Usage: countdown [options] [<seconds>] Options: """ """ This example uses docopt with the built in cmd module to demonstrate an interactive command application. Usage: my_program tcp <host> <port> [--timeout=<seconds>] my_program serial <port> [--baud=<n>] [--timeout=<seconds>] ...
Python
0.00001
0b8d5794d2c5a1ae46659e02b65d1c21ffe8881d
Implement tests for temperature endpoint
babyonboard/api/tests/test_views.py
babyonboard/api/tests/test_views.py
import json from rest_framework import status from django.test import TestCase, Client from django.urls import reverse from ..models import Temperature from ..serializers import TemperatureSerializer client = Client() class GetCurrentTemperatureTest(TestCase): """ Test class for GET current temperature from API...
Python
0.000002
fa1057d8b9a44bdf2ee0f667184ff5854fd0e8e1
add rds backup
base/docker/scripts/rds-snapshot.py
base/docker/scripts/rds-snapshot.py
#!/usr/bin/env python """ Backup Amazon RDS DBs. Script is expected to be run on EC2 VM within the same Amazon account as RDS. Script reads tags of EC2 and then searches for all matching RDSes. Where matching RDS is the one that shares the same "Stack" tag value. """ import sys import time import argparse import bot...
Python
0
a9d458c0995db80f164f6099b5264f23c1ceffbb
Create 02.py
02/qu/02.py
02/qu/02.py
# Define a procedure, sum3, that takes three # inputs, and returns the sum of the three # input numbers. def sum3(aa, bb, cc): return aa + bb + cc #print sum3(1,2,3) #>>> 6 #print sum3(93,53,70) #>>> 216
Python
0
9a705f58acbcfb2cc7292cb396544f1f8c9b89a1
Add basic web test
tests/baseweb_test.py
tests/baseweb_test.py
from __future__ import with_statement from ass2m.ass2m import Ass2m from ass2m.server import Server from unittest import TestCase from webtest import TestApp from tempfile import mkdtemp import os.path import shutil class BaseWebTest(TestCase): def setUp(self): self.root = mkdtemp(prefix='ass2m_test_roo...
Python
0
56eba00d00e450b5dc8fae7ea8475d418b00e2db
Add problem69.py
euler_python/problem69.py
euler_python/problem69.py
""" problem69.py Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number of numbers less than n which are relatively prime to n. For example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to nine, φ(9)=6. It can be seen that n=6 produces a maximum n/φ...
Python
0.000241
e082435619399051321e7c9ae02540f54e436e5b
Create acr_routerauthenticator.py
Server/integrations/acr_router/acr_routerauthenticator.py
Server/integrations/acr_router/acr_routerauthenticator.py
from org.xdi.model.custom.script.type.auth import PersonAuthenticationType from org.jboss.seam.contexts import Context, Contexts from org.jboss.seam.security import Identity from org.xdi.oxauth.service import UserService, AuthenticationService, SessionStateService, VeriCloudCompromise from org.xdi.util import StringHel...
Python
0.000004
47bdc98a7fb8c030f5beb09ec9bb1b83c100dc9a
Add missing migration
src/users/migrations/0008_auto_20160222_0553.py
src/users/migrations/0008_auto_20160222_0553.py
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-02-22 05:53 from __future__ import unicode_literals import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0007_auto_20160122_1333'), ] operations = [ ...
Python
0.0002
f0cd785688ed04821f0338021e2360b98bd9dd58
add very simple perf test
conform/perf.py
conform/perf.py
#!/usr/bin/env python import sys import barrister trans = barrister.HttpTransport("http://localhost:9233/") client = barrister.Client(trans, validate_request=False) num = int(sys.argv[1]) s = "safasdfasdlfasjdflkasjdflaskjdflaskdjflasdjflaskdfjalsdkfjasldkfjasldkasdlkasjfasld" for i in range(num): client....
Python
0.000001
e88a6a634f600a5ef3ae269fc0d49bcd1e1d58e8
Revert "More accurate info in examples."
examples/svm/plot_iris.py
examples/svm/plot_iris.py
""" ================================================== Plot different SVM classifiers in the iris dataset ================================================== Comparison of different linear SVM classifiers on the iris dataset. It will plot the decision surface and the support vectors. """ import numpy as np import pyl...
""" ================================================== Plot different SVM classifiers in the iris dataset ================================================== Comparison of different linear SVM classifiers on the iris dataset. It will plot the decision surface for four different SVM classifiers. """ import numpy as np...
Python
0
9ba3c840514e765acac2542ee3faf47671824918
add missing source file
moban/buffered_writer.py
moban/buffered_writer.py
from moban import utils, file_system import fs import fs.path class BufferedWriter(object): def __init__(self): self.fs_list = {} def write_file_out(self, filename, content): if "zip://" in filename: self.write_file_out_to_zip(filename, content) else: utils.wr...
Python
0.000001
b573daf86d2bcb5d8dc71e45a65b5f2ffc0866b1
Correct module help
examples/create_events.py
examples/create_events.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from pymisp import PyMISP from keys import misp_url, misp_key import argparse # For python2 & 3 compat, a bit dirty, but it seems to be the least bad one try: input = raw_input except NameError: pass def init(url, key): return PyMISP(url, key, True, 'json') ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from pymisp import PyMISP from keys import misp_url, misp_key import argparse # For python2 & 3 compat, a bit dirty, but it seems to be the least bad one try: input = raw_input except NameError: pass def init(url, key): return PyMISP(url, key, True, 'json') ...
Python
0.000001
23ce1dcedbd8c1204439db7df3d99a5f90b363fa
Add NARR Cross Section Example
examples/cross_section.py
examples/cross_section.py
# Copyright (c) 2018 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ ====================== Cross Section Analysis ====================== The MetPy function `metpy.interpolate.cross_section` can obtain a cross-sectional slice through gridded data...
Python
0
291d882a29981ea6c82c40c8e9a001aa3305e0ae
Create 8kyu_do_I_get_a_bonus.py
Solutions/8kyu/8kyu_do_I_get_a_bonus.py
Solutions/8kyu/8kyu_do_I_get_a_bonus.py
def bonus_time(salary, bonus): return '${}'.format(salary*([1,10][bonus]))
Python
0.000001
7c16172f9ebe65d6928a72001a086637bf4bd725
Fix buggy annotations for stdout/stderr.
scripts/lib/node_cache.py
scripts/lib/node_cache.py
from __future__ import print_function import os import hashlib from os.path import dirname, abspath if False: from typing import Optional, List, IO, Tuple from scripts.lib.zulip_tools import subprocess_text_output, run ZULIP_PATH = dirname(dirname(dirname(abspath(__file__)))) NPM_CACHE_PATH = "/srv/zulip-npm-ca...
from __future__ import print_function import os import hashlib from os.path import dirname, abspath if False: from typing import Optional, List, Tuple from scripts.lib.zulip_tools import subprocess_text_output, run ZULIP_PATH = dirname(dirname(dirname(abspath(__file__)))) NPM_CACHE_PATH = "/srv/zulip-npm-cache"...
Python
0
d36762fcf98774560fe82b32b2d64d2eba1ec72b
Improve logging to debug invalid "extra_specs" entries
cinder/scheduler/filters/capabilities_filter.py
cinder/scheduler/filters/capabilities_filter.py
# Copyright (c) 2011 OpenStack Foundation. # 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...
# Copyright (c) 2011 OpenStack Foundation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
Python
0.000016
d10ec57d6f58a4f96a2f648cac1bc94dc78efc32
Implement identifying to accounts
txircd/modules/extra/services/account_identify.py
txircd/modules/extra/services/account_identify.py
from twisted.plugin import IPlugin from twisted.words.protocols import irc from txircd.module_interface import Command, ICommand, IModuleData, ModuleData from zope.interface import implements irc.ERR_SERVICES = "955" # Custom numeric; 955 <TYPE> <SUBTYPE> <ERROR> class AccountIdentify(ModuleData): implements(IPlugin...
Python
0.000009
166854466771850bda3384b75d0f8d0656c259f6
add predict
gen_predict_res_format.py
gen_predict_res_format.py
# -*- coding: utf-8 -*- ''' Created on Jul 9, 2013 @author: Chunwei Yan @ pkusz @mail: yanchunwei@outlook.com ''' import sys from utils import get_num_lines, args_check class Gen(object): formats = { '1':1, '-1':0, } def __init__(self, fph, test_ph, tph): self.fph, self.test_ph, ...
Python
0.999925
aa6837e14e520f5917cf1c452bd0c9a8ce2a27dd
Add new module for plugin loading
module/others/plugins.py
module/others/plugins.py
from maya import cmds class Commands(object): """ class name must be 'Commands' """ commandDict = {} def _loadObjPlugin(self): if not cmds.pluginInfo("objExport", q=True, loaded=True): cmds.loadPlugin("objExport") commandDict['sampleCommand'] = "sphere.png" # ^ Don't forget t...
Python
0
67350e9ac3f2dc0fceb1899c8692adcd9cdd4213
Add a test case to validate `get_unseen_notes`
frappe/tests/test_boot.py
frappe/tests/test_boot.py
import unittest import frappe from frappe.boot import get_unseen_notes from frappe.desk.doctype.note.note import mark_as_seen class TestBootData(unittest.TestCase): def test_get_unseen_notes(self): frappe.db.delete("Note") frappe.db.delete("Note Seen By") note = frappe.get_doc( { "doctype": "Note", ...
Python
0
15fd5f6ddd3aa79a26b28d5ef4b93eeb12e28956
add an update_users management command
controller/management/commands/update_users.py
controller/management/commands/update_users.py
""" Ensure that the right users exist: - read USERS dictionary from auth.json - if they don't exist, create them. - if they do, update the passwords to match """ import json import logging from django.core.management.base import BaseCommand from django.conf import settings from django.contrib.auth.models import User...
Python
0.000002
3d0f6085bceffc5941e55678da20d8db4a7d5ce2
Create question4.py
huangguolong/question4.py
huangguolong/question4.py
def fib(nums): ''' :param nums: 一个整数,相当于数列的下标 :return: 返回该下标的值 ''' if nums == 0 or nums == 1: return nums else: return fib(nums-2) + fib(nums-1) def createFib(n): ''' :param n: 需要展示前面n个数 :return: 返回一个列表,费波那契数列 ''' list1 = [] for i in range(n): ...
Python
0.00002
448ca2cfb8f7e167b1395e84a4f2b4b4cea57905
add file
crawler/jb51.py
crawler/jb51.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from async_spider import AsySpider class Jb51Spider(AsySpider): def handle_html(self, url, html): print(url) ''' filename = url.rsplit('/', 1)[1] with open(filename, 'w+') as f: f.write(html) ''' if __name__ == '...
Python
0.000001
55b3269f9c2cd22ef75a2632f04e37a9f723e961
add data migration
accelerator/migrations/0033_migrate_gender_data.py
accelerator/migrations/0033_migrate_gender_data.py
# Generated by Django 2.2.10 on 2021-01-22 12:13 import sys from django.contrib.auth import get_user_model from django.db import migrations # gender identity GENDER_MALE = "Male" GENDER_FEMALE = "Female" GENDER_PREFER_TO_SELF_DESCRIBE = "I Prefer To Self-describe" GENDER_PREFER_NOT_TO_SAY = "I Prefer Not To Say" # g...
Python
0
3344bb0a967c4217f6fa1d701b2c4dfb89d578aa
add new package : alluxio (#14143)
var/spack/repos/builtin/packages/alluxio/package.py
var/spack/repos/builtin/packages/alluxio/package.py
# Copyright 2013-2019 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 Alluxio(Package): """ Alluxio (formerly known as Tachyon) is a virtual distributed sto...
Python
0
6dc035051d666707fdc09e63f510dbc4edf1724d
Migrate lab_members
lab_members/migrations/0001_initial.py
lab_members/migrations/0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Position', fields=[ ('id', models.AutoField(pri...
Python
0.000001
f7f25876d3398cacc822faf2b16cc156e88c7fd3
Use this enough, might as well add it.
misc/jp2_kakadu_pillow.py
misc/jp2_kakadu_pillow.py
# This the basic flow for getting from a JP2 to a jpg w/ kdu_expand and Pillow # Useful for debugging the scenario independent of the server. from PIL import Image from PIL.ImageFile import Parser from os import makedirs, path, unlink import subprocess import sys KDU_EXPAND='/usr/local/bin/kdu_expand' LIB_KDU='/usr/l...
Python
0
2f9324f4d073082f47ecd8279d4bd85eaa1cf258
add splits-io api wrapper
modules/apis/splits_io.py
modules/apis/splits_io.py
#! /usr/bin/env python2.7 import modules.apis.api_base as api class SplitsIOAPI(api.API): def __init__(self, session = None): super(SplitsIOAPI, self).__init__("https://splits.io/api/v3", session) def get_user_splits(self, user, **kwargs): endpoint = "/users/{0}/pbs".format(user) suc...
Python
0
d5e67563f23acb11fe0e4641d48b67fe3509822f
Add test migration removing ref to old company image
apps/companyprofile/migrations/0002_auto_20151014_2132.py
apps/companyprofile/migrations/0002_auto_20151014_2132.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('companyprofile', '0001_initial'), ] operations = [ migrations.RenameField( model_name='company', old...
Python
0
a1e2e51c2777107bbc8a20429078638917149b6a
Remove unused import
src/compas/rpc/services/default.py
src/compas/rpc/services/default.py
import os import inspect import json import socket import compas from compas.rpc import Server from compas.rpc import Service class DefaultService(Service): pass if __name__ == '__main__': import sys try: port = int(sys.argv[1]) except: port = 1753 print('Starting default RP...
import os import inspect import json import socket import compas from compas.rpc import Server from compas.rpc import Service class DefaultService(Service): pass if __name__ == '__main__': import sys import threading try: port = int(sys.argv[1]) except: port = 1753 print...
Python
0.000001
f20f286a3c5c6e2b9adf7220ac4426ce783d96b5
Create regressors.py
trendpy/regressors.py
trendpy/regressors.py
# regressors.py # MIT License # Copyright (c) 2017 Rene Jean Corneille # 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...
Python
0.000001