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
959580ea313e4445374e8ee9f32e1a8822dd5beb
add setup script for install
setup.py
setup.py
from setuptools import setup setup(name='hlm_gibbs', version='0.0.1', description='Fit spatial multilevel models and diagnose convergence', url='https://github.com/ljwolf/hlm_gibbs', author='Levi John Wolf', author_email='levi.john.wolf@gmail.com', license='3-Clause BSD', pack...
Python
0
dca7a5f766b7e2fd5cfc346cbc358faafa1ec9f1
add setup.py file
setup.py
setup.py
try: from setuptools import setup except ImportError: from distutils.core import setup from distutils.extension import Extension libname="vgdl" setup( name = libname, version="1.0", description='A video game description language (VGDL) built on top pf pygame', author='Tom Schaul', url='https://github.com/scha...
Python
0
1618d8afeca1b667b4439d62b3727528dcba9159
Add setup.py
setup.py
setup.py
from setuptools import setup setup( name='django-filebased-email-backend-ng', packages=( 'django_filebased_email_backend_ng', ) )
Python
0.000001
95d1f63ce4d9698f8ab4b64757e3669c75accbbd
throw on some more setup.py pypi classifiers
setup.py
setup.py
from distutils.core import setup setup( name='django-object-actions', version='0.0.1', author="The Texas Tribune", author_email="cchang@texastribune.org", maintainer="Chris Chang", # url packages=['django_object_actions'], include_package_data=True, # automatically include things from...
from distutils.core import setup setup( name='django-object-actions', version='0.0.1', author="The Texas Tribune", author_email="cchang@texastribune.org", maintainer="Chris Chang", # url packages=['django_object_actions'], include_package_data=True, # automatically include things from...
Python
0
591b9be8d03cf2ecd12eed1bd36f9d762e91195c
Add setup.py for package installation
setup.py
setup.py
from setuptools import setup setup( name='simplio', version='0.1', description='Simplest-case command-line input/output', long_description=( 'Simplio is a Python function decorator that applies an input file ' 'object and an output file object as arguments to the decorated ' 'f...
Python
0
0abe1e173b73770b5f2ee81f57f21c41466e5c61
Add setup script
setup.py
setup.py
#!/usr/bin/env python import os.path from setuptools import find_packages, setup setup( name = 'technic-solder-client', version = '1.0', description = 'Python implementation of a Technic Solder client', author = 'Cadyyan', url = 'https://github.com/cadyyan/technic...
Python
0.000001
af49ecf6ce12b2fa909733c17569c7231c343190
add simple sql shell
shell.py
shell.py
# simple interactive shell for MSSQL server import pytds import os def main(): conn = pytds.connect(dsn=os.getenv("HOST", "localhost"), user=os.getenv("SQLUSER", "sa"), password=os.getenv("SQLPASSWORD")) while True: try: sql = input("sql> ") except KeyboardInterrupt: re...
Python
0.000003
93e2d3d72099b854f854abc44a79b2c4edb74af8
add basic file splitter
split.py
split.py
#!/usr/bin/python # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # Echo all output starting with the line after the line that starts with splitStart. import sys ...
Python
0
3d44701308fe1c32d8ae2efab609d5e7bcd563c0
Create ajastin.py
ajastin.py
ajastin.py
def downloader(): #import downloader #downloader.main() return 0 def lampotila(): Tnow = 15 #import lampotila #lampotila.main() return Tnow def main(): import time from datetime import datetime n = 0 ret1 = 0 t0 = time.time() try: while ret1 == 0: time.sleep...
Python
0.000115
c45da8544bd3e4f85073e61cfba417862ce66fc2
add 'Appeaser' strategy
axelrod/strategies/appeaser.py
axelrod/strategies/appeaser.py
from axelrod import Player class Appeaser(Player): """ A player who tries to guess what the opponent wants, switching his behaviour every time the opponent plays 'D'. """ def strategy(self, opponent): """ Start with 'C', switch between 'C' and 'D' when opponent plays 'D'. "...
Python
0.004212
d29a94809f6f58e053a646d796fe9e55a51b334e
Initialize Ch. 1 caesarHacker
books/CrackingCodesWithPython/Chapter01/caesarHacker.py
books/CrackingCodesWithPython/Chapter01/caesarHacker.py
# Caesar Hacker improved # Rewritten as function for importing # SPOILERS: Chapter 6 (caesarHacker), Chapter 7 (functions) import books.CrackingCodesWithPython.Chapter01.config def hackCaesar(message): # Loop through every possible key: for key in range(len(books.CrackingCodesWithPython.Chapter01.config.SYM...
Python
0.00232
cfdbfd30f41ea4a0dc5fb693e896c6e24ae78e05
Create pipeline.py
toxicity_ml/toxicBERT/pipeline.py
toxicity_ml/toxicBERT/pipeline.py
# coding=utf-8 # Copyright 2020 Google LLC import tensorflow_model_analysis as tfma from tfx.components import (Evaluator, ExampleValidator, ImportExampleGen, ModelValidator, Pusher, ResolverNode, SchemaGen, StatisticsGen, Trainer, Transform) from tfx.proto impor...
Python
0.000004
03fce72b60eb8cad2368447cf23f72f8084f4a4b
Add py solution for 575. Distribute Candies
py/distribute-candies.py
py/distribute-candies.py
class Solution(object): def distributeCandies(self, candies): """ :type candies: List[int] :rtype: int """ return min(len(candies) / 2, len(set(candies)))
Python
0.000002
d34dcf1179e6e5c2b864627266ae1788d10142aa
Add Chuanping Yu's solutions to Problem02
Week01/Problem02/cyu_02.py
Week01/Problem02/cyu_02.py
#!/usr/bin/env python3 """This script is written by Chuanping Yu, on Jul 24, 2017, for the Assignment#1 in IDEaS workshop""" #Problem 2 FIB = [] F = 1 S = 0 FIB.append(F) FIB.append(F) while F <= 4000000: F = FIB[-1] + FIB[-2] FIB.append(F) if F%2 == 0 and F <= 4000000: S = S + F print(S)
Python
0
40ca566b6cf45c1e62da98536e8ad35516c8326d
update pod versions in repo
scripts/update_pod_versions.py
scripts/update_pod_versions.py
import argparse import logging import os import pprint import re import subprocess import sys import tempfile from collections import defaultdict from pkg_resources import packaging PODSPEC_REPOSITORY = 'https://github.com/CocoaPods/Specs.git' PODS = ( 'FirebaseCore', 'FirebaseAdMob', 'FirebaseAnalytics', 'Fi...
Python
0
5eb9a910096f3e0000499390541a83bc50fb73ce
add binheap
binheap.py
binheap.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals class BinHeap(object): def __init__(self, iterable=None): self.list = [] if iterable: for item in iterable: self.push(item) def push(self, value): self.list.append(value) self._bubble_...
Python
0.000841
4f0e9a14286f21d835e36e549ebee80419e46cec
test game
blocker.py
blocker.py
#!/usr/bin/env python class Blocker: def __init__(self): print 'Blocker v1.0' return def run(self): return game = Blocker() game.run()
Python
0.000006
769019be1331fa58e363fba37957ec90ab6f8163
add code for more precise arbtirage math (WiP)
arbmath.py
arbmath.py
import decimal from decimal import Decimal class ExchangeModel(object); def __init__(self, depths, tradeApi): self.depths = depths; self.tradeApi = tradeApi self.symbols = [key[:3] for key, value in depths] + [key[3:] for key, value in depths] self.symbols = list(set(self.symbols)) # returns (ba...
Python
0
22ee1754a1409fb40bf2bb31cb565bfe914c9c38
Create comparison charts from two summary.csv files
distribution/scripts/jmeter/create-comparison-charts.py
distribution/scripts/jmeter/create-comparison-charts.py
#!/usr/bin/env python3.6 # Copyright 2017 WSO2 Inc. (http://wso2.org) # # 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...
Python
0.000005
cd5e6a14bb0a67d6558b691f6b55f7918c4d4970
Create new package (#6384)
var/spack/repos/builtin/packages/r-fnn/package.py
var/spack/repos/builtin/packages/r-fnn/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
f68175870692d128fb2a01795d20605bb2e17aa9
Add initial functional tests
functional_tests/test_evexml.py
functional_tests/test_evexml.py
"""Functional tests for the xml api part of aniauth project. This is a temporary app as EVE Online's xml api is deprecated and will be disabled March 2018. """ from django.contrib.staticfiles.testing import StaticLiveServerTestCase from django.test import tag from django.shortcuts import reverse from selenium import ...
Python
0.000001
6a7b32e271a264aad763fbd28749ac1258cf041f
Add dialplan filestring module
wirecurly/dialplan/filestring.py
wirecurly/dialplan/filestring.py
import logging from wirecurly.exc import * from wirecurly.dialplan.expression import * import os log = logging.getLogger(__name__) __all__ = ['FileString'] class FileString(object): ''' Filestring oject to use with playback app in dialplan. ''' def __init__(self,*argv): super(FileString, self).__init__() s...
Python
0
6ce84d454ef18f7b7dfc988195bfacb4e69e8c3f
add CRUD test cases for Snippet
hackathon_starter/hackathon/unittests/testsnippets.py
hackathon_starter/hackathon/unittests/testsnippets.py
from hackathon.models import Snippet from rest_framework import status from rest_framework.test import APITestCase class SnippetViewTestCase(APITestCase): def setUp(self): self.s1 = Snippet.objects.create(title='t1', code="""print("Hello, World.")""") self.s2 = Snippet.objects.create(title='t2', c...
Python
0
f59749db263291f481c4bdc9f6ede2f6de6cb6d4
Create foundation for input file generation (csv for connectivity table, etc.)
create_input_files.py
create_input_files.py
import csv import argparse import itertools from thermo_utils import csv_row_writer, read_csv_rows # Read input/output arguments parser = argparse.ArgumentParser() parser.add_argument('-o','--output',required=True) parser.add_argument('-d','--dof',required=True) # parser.add_argument('-v','--version',required=False) ...
Python
0
9f6df0b93a7a6911d9e7eee0e4fe87e34ea52832
Create main entrypoint of cli
shub_cli/cli.py
shub_cli/cli.py
""" Scrapinghub CLI Usage: shub-cli jobs shub-cli jobs [-t TAG1,TAG2] [-l LACK1,LACK2] [-s SPIDER] [-e STATE] [-c COUNT] shub-cli job -id <id> Options: -t TAG1,TAG2 Description. -l LACK1,LACK2 Description. -s SPIDER Description. -e STATE Description. -c COUNT Description. Exam...
Python
0
53c7233d0ecf7e3f807da9112d1c5eecb75c9ae2
Add a new moderation-style cog
cogs/moderation.py
cogs/moderation.py
from discord.ext import commands import discord import datetime class Moderation: def __init__(self, liara): self.liara = liara @commands.command(pass_context=True, no_pm=True) async def userinfo(self, ctx, user: discord.Member=None): if user is None: user = ctx.message.author...
Python
0.000057
6bce6ca2ae91b2eebad1d32ed970969ea5e423a2
String reverse done
Text/reverse.py
Text/reverse.py
# -*- coding: cp1252 -*- """ Reverse a String Enter a string and the program will reverse it and print it out. """ string = raw_input("Whatchu wanna say to me? ") print "You say %s, I say %s" % (string, string[::-1])
Python
0.999408
087829b024ea9c5b2028c3f13786578be6dfd702
fix the bug of loading all cifar data
load_data.py
load_data.py
# encoding: utf-8 """ @author: ouwj @position: ouwj-win10 @file: load_data.py @time: 2017/4/26 14:33 """ from tensorflow.examples.tutorials.mnist import input_data import numpy as np def unpickle(file): import pickle with open(file, 'rb') as fo: dict = pickle.load(fo, encoding='bytes') return dic...
# encoding: utf-8 """ @author: ouwj @position: ouwj-win10 @file: load_data.py @time: 2017/4/26 14:33 """ from tensorflow.examples.tutorials.mnist import input_data import numpy as np def unpickle(file): import pickle with open(file, 'rb') as fo: dict = pickle.load(fo, encoding='bytes') return dic...
Python
0.000001
c55d1a9709f26fee18ac880bf66dfac048d742a7
change method argument to immutable
pykintone/application.py
pykintone/application.py
import requests import json from pykintone.account import kintoneService import pykintone.result as pykr class Application(object): API_ROOT = "https://{0}.cybozu.com/k/v1/{1}" def __init__(self, account, app_id, api_token="", app_name="", requests_options=()): self.account = account self.app...
Python
0.000004
54404541913185a54fea75353d9fffc72ddc2ff6
Create discovery_diag.py
python/discovery_diag.py
python/discovery_diag.py
import requests import json requests.packages.urllib3.disable_warnings() s = requests.Session() def netmriLogin( temp, querystring ): username = "admin" password = "infioblox" url = "https://demo-netmri.infoblox.com/api/3.3" + temp response = s.request("GET", url, params=querystring, verify=False, ...
Python
0
b3c408845a6aba2e5bc15509f7d06800fb9e6c8b
multiples of 3 or 5
1-10/1.py
1-10/1.py
def sum_of_multiples_of_three_or_five(n): result = sum([x for x in range(1, n) if x % 3 == 0 or x % 5 == 0]) return result def main(): n = 10**3 print(sum_of_multiples_of_three_or_five(n)) if __name__ == "__main__": main()
Python
0.999834
35f4f5bbea5b291b8204a2ca30acddebfad86d3e
Create 2004-4.py
2004-4.py
2004-4.py
times = input() i = 0 while i < times: length = input() ascents = 0 descents = 0 plateaus = 0 maxA = 0 maxD = 0 maxP = 0 sequence = [] j = 0 while j < length: currentNum = input() sequence.append(currentNum) if j != 0: if currentNum < sequence[j-1]: ...
Python
0.000009
f228b0d76a5c619e45d40d4d0da12059cb2668e9
Create warlock.py
hsgame/cards/minions/warlock.py
hsgame/cards/minions/warlock.py
import hsgame.targeting from hsgame.constants import CHARACTER_CLASS, CARD_RARITY, MINION_TYPE from hsgame.game_objects import MinionCard, Minion, Card #from hsgame.cards.battlecries import __author__ = 'randomflyingtaco' #let the train wreck begin
Python
0.000001
97fcef753647bfbdab0381b30d1533bdce36aeb9
fix admin
django-pyodbc/contrib/admin/models/models.py
django-pyodbc/contrib/admin/models/models.py
from django.db import models from django.contrib.contenttypes.models import ContentType from django.contrib.auth.models import User from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import smart_unicode from django.utils.safestring import mark_safe ADDITION = 1 CHANGE = 2 DELETION = 3 ...
Python
0
0ace48790374ea75ba2c6cbc51678e3240c22a88
Create Differ.py
Differ.py
Differ.py
file1 = raw_input('[file1:] ') modified = open(file1,"r").readlines()[0] file2 = raw_input('[file2:] ') pi = open(file2, "r").readlines()[0] # [:len(modified)] resultado = "".join( x for x,y in zip(modified, pi) if x != y) resultado2 = "".join( x for x,y in zip(pi, modified) if x != y) print "[Differ:] print '\n---...
Python
0
60de63d2fc53c020649bc21576765366f310cf56
fix by adding migration
src/polls/migrations/0006_auto_20171114_1128.py
src/polls/migrations/0006_auto_20171114_1128.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-11-14 10:28 from __future__ import unicode_literals import django.contrib.postgres.fields.jsonb import django.core.serializers.json from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('polls', '0005_poll_t...
Python
0.000001
a5d5dde8c523aa28452d790e7f0291c1cf52aacb
Make sure setUpModule is called by the test framework. We brought in pytest-2.4.0.dev8 for that specific functionality. However, one time we regressed, and our tests started misbehaving. So, this test is here to keep us honest.
tests/external/py2/testfixture_test.py
tests/external/py2/testfixture_test.py
#!/usr/bin/env python # ---------------------------------------------------------------------- # Copyright (C) 2013 Numenta Inc. All rights reserved. # # The information and source code contained herein is the # exclusive property of Numenta Inc. No part of this software # may be used, reproduced, stored or distributed...
Python
0
b0c74bcf7dd4120684a944a7cd8cc005bee039f5
Create BogoBogo.py
Challenge-175/01-Easy/BogoBogo.py
Challenge-175/01-Easy/BogoBogo.py
import random def bogosort(n, m): i = 0 while n != m: n = ''.join(random.sample(n,len(n))) i += 1 print(i, 'iterations') return i def bogobogosort(n, m): i = 0 #number of iterations j = 2 #number of elements while n[:j] != m: n = ''.join(random.sample(n,len(n))) while n[:j] != m[:j]: n = ''.join(ran...
Python
0.000001
84b932df5520901645c6d999abddea1191654a34
create skeleton of a proper in place quicksort
algorithms/sorting/quicksort_ip.py
algorithms/sorting/quicksort_ip.py
from random import randint def partition(unsorted, start, end, pivot): pass def choose_pivot(start, end): pass def quicksort(unsorted, start=0, end=None): pass if __name__ == '__main__': unsorted = [3,345,456,7,879,970,7,4,23,123,45,467,578,78,6,4,324,145,345,3456,567,5768,6589,69,69] sorted...
Python
0.00004
60002062970a2f83725355911dde73673c5875a5
Add a snippet.
python/pyqt/pyqt5/button_clic_event_as_class.py
python/pyqt/pyqt5/button_clic_event_as_class.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.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 witho...
Python
0.000002
b7fa44bed363b32dfced05fce538502f7684bb6c
Add a first pass at Mercurial changegroup (hg push) integration.
api/integrations/hg/zulip-changegroup.py
api/integrations/hg/zulip-changegroup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Zulip hook for Mercurial changeset pushes. # Copyright © 2012-2013 Zulip, Inc. # # 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 rest...
Python
0.000001
6f5843fb04cfa2ed2082b340f282223ec374f9f6
copy group descriptions to text table
alembic/versions/49ed2a435cf_group_description.py
alembic/versions/49ed2a435cf_group_description.py
revision = '49ed2a435cf' down_revision = '5927719682b' import uuid from datetime import datetime from alembic import op import sqlalchemy as sa from sqlalchemy import sql import jinja2 def random_uuid(): return str(uuid.uuid4()) def upgrade(): text = sql.table('text', sql.column('id'), sql....
Python
0
f18fd5c4ad61adb56ac7524a006ce9977aa06a31
Add worker to send queue mails
mailing/management/commands/send_queued_mails_worker.py
mailing/management/commands/send_queued_mails_worker.py
# -*- coding: utf-8 -*- # Copyright (c) 2016 Aladom SAS & Hosting Dvpt SAS from django.core.management.base import BaseCommand from ...utils import send_queued_mails import time class Command(BaseCommand): help = """Send mails with `status` Mail.STATUS_PENDING and having `scheduled_on` set on a past date. In ...
Python
0
5a7081c5c46a050566477adda19d30844192ceb2
Add migration to add authtokens for existing users
src/mmw/apps/user/migrations/0002_auth_tokens.py
src/mmw/apps/user/migrations/0002_auth_tokens.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings from django.contrib.auth.models import User from rest_framework.authtoken.models import Token def add_auth_tokens_to_users(apps, schema_editor): for user in User.objects.all()...
Python
0
31b309c1f5981a10207e85950ef8139018afd37c
add roles urls
src/python/expedient/clearinghouse/roles/urls.py
src/python/expedient/clearinghouse/roles/urls.py
''' Created on Jul 29, 2010 @author: jnaous ''' from django.conf.urls.defaults import patterns, url urlpatterns = patterns("expedient.clearinghouse.roles.views", url(r"^confirm/(?P<proj_id>\d+)/(?P<req_id>\d+)/(?P<allow>\d)/(?P<delegate>\d)/$", "confirm_request", name="roles_confirm_request"), )
Python
0.000001
abb72a3a248efd1b244798f91cbca09af01ebb3e
Fix CloneManga modules.
dosagelib/plugins/clonemanga.py
dosagelib/plugins/clonemanga.py
# -*- coding: utf-8 -*- # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2017 Tobias Gruetzmacher from __future__ import absolute_import, division, print_function from ..helpers import indirectStarter, xpath_class from ..scraper import _...
# -*- coding: utf-8 -*- # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2016 Tobias Gruetzmacher from __future__ import absolute_import, division, print_function from re import compile from ..scraper import _BasicScraper from ..util im...
Python
0
14e55d45428c617507c5c161f4d33154849f63a5
Create Endings.py
Edabit/Endings.py
Edabit/Endings.py
#!/usr/bin/env python3 ''' Create a function that adds a string ending to each member in a list. ''' def add_ending(lst, ending): return [i + ending for i in lst]
Python
0.000002
ab53993b708b3f9cf3b5762664fef58bae99ea20
Add some code to auto-remove Ltac
recursive_remove_ltac.py
recursive_remove_ltac.py
import re __all__ = ["recursively_remove_ltac"] LTAC_REG = re.compile(r'^\s*(?:Local\s+|Global\s+)?Ltac\s+([^\s]+)', re.MULTILINE) def recursively_remove_ltac(statements, exclude_n=3): """Removes any Ltac statement which is not used later in statements. Does not remove any code in the last exclude_n sta...
Python
0.000001
cd6eebfecab9b93863e7e20acec1ba0481f6b95f
Fix benchmark naming in reporting
tensorflow/python/eager/benchmarks_test_base.py
tensorflow/python/eager/benchmarks_test_base.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Python
0.000478
dccb0f292c86da942c5e4493a5e117e5f3047a05
add aiohttp exercise
aiohttp_ext.py
aiohttp_ext.py
import asyncio from aiohttp import web async def index(request): await asyncio.sleep(0.5) return web.Response(body=b'<h1>Index</h1>',content_type='text/html') async def hello(request): await asyncio.sleep(0.5) text = '<h1>hello, %s</h1>' % request.match_info['name'] return web.Response(body=text....
Python
0
5788864141c2b635a3c0b8358d868fa7e2b5e789
Create Pedido_Cadastrar.py
backend/Models/Turma/Pedido_Cadastrar.py
backend/Models/Turma/Pedido_Cadastrar.py
from Framework.Pedido import Pedido from Framework.ErroNoHTTP import ErroNoHTTP class PedidoCadastrar(Pedido): def __init__(self,variaveis_do_ambiente): super(PedidoCadastrar, self).__init__(variaveis_do_ambiente) try: self.letra = self.corpo['letra'] self.id_disciplina = self.corpo['id_dsciplin...
Python
0
44e3876d76c7d7b3571c82030ff78260e4ec7e65
Add PCA.py template
ML/PCA.py
ML/PCA.py
""" Exact principal component analysis (PCA) """ class PCA(object): """ Exact principal component analysis (PCA) """ def __init__(self): return def fit(self, X): return
Python
0
cd2c959674043fcc3b6261129f57f266539a8658
Add a Python snippet.
Python.py
Python.py
#!/usr/bin/env python # coding: utf-8 """Python snippet """ import os import sys if __name__ == '__main__': if len (sys.argv) == 1: print ("Hi there!") else: print ("Hello, %s!" % sys.argv[1])
Python
0.000043
65449c60f357eeab5ddc9eb91a468ab1e3719de7
Add dismiss_recommendation example (#35)
examples/v0/recommendations/dismiss_recommendation.py
examples/v0/recommendations/dismiss_recommendation.py
# Copyright 2019 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Python
0
8d6ca433d33551cc1fe5c08edcf68ec65e5447b0
Add solution to exercise 3.3.
exercises/chapter_03/exercise_03_03/exercies_03_03.py
exercises/chapter_03/exercise_03_03/exercies_03_03.py
# 3-3 Your Own List transportation = ["mountainbike", "teleportation", "Citroën DS3"] print("A " + transportation[0] + " is good when exercising in the woods.\n") print("The ultimate form of trarsportation must be " + transportation[1] + ".\n") print("Should I buy a " + transportation[2] + "?\n")
Python
0.000054
d82ecab372ed22da0b00512294ee6cd3f5fcb012
Add script to reindex datasets.
ckanofworms/scripts/reindex.py
ckanofworms/scripts/reindex.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # CKAN-of-Worms -- A logger for errors found in CKAN datasets # By: Emmanuel Raviart <emmanuel@raviart.com> # # Copyright (C) 2013 Etalab # http://github.com/etalab/ckan-of-worms # # This file is part of CKAN-of-Worms. # # CKAN-of-Worms is free software; you can redistri...
Python
0
3a5df951bb9d12843d46107d0fbca9bd3d9105b3
Change the name of GUI.py to main_window.py, and change the __init__ function, so that board object and the size of the window can be passed when a frame object is created.
src/main_window.py
src/main_window.py
import wx import wx.lib.stattext as ST import board class My2048_wx(wx.Frame): def __init__(self, parent, id, title, size, board_object): super(My2048_wx, self).__init__(parent, title = title, size = size) board_object = board.Board self.Construct() def Construct(self): SIZE = 4; '''panel_box is the ...
Python
0
ab99892d974503f2e0573a8937dc8f1b085b0014
Add stringbuilder module
modules/pipestrconcat.py
modules/pipestrconcat.py
# pipestrconcat.py #aka stringbuilder # from pipe2py import util def pipe_strconcat(context, _INPUT, conf, **kwargs): """This source builds a string and yields it forever. Keyword arguments: context -- pipeline context _INPUT -- not used conf: part -- parts Yields (_OUTPUT):...
Python
0.000001
e7053da76c14f12bfc02992ab745aac193e7c869
Create compareLists.py
compareLists.py
compareLists.py
def unique(a): """ return the list with duplicate elements removed """ return list(set(a)) def intersect(a, b): """ return the intersection of two lists """ return list(set(a) & set(b)) def union(a, b): """ return the union of two lists """ return list(set(a) | set(b)) if __name__ == "__main_...
Python
0.000001
f347e84d4488d635d6b4a1eaf93855631f42c410
Add simple ant system based solver
solvers/AntSystem.py
solvers/AntSystem.py
#!/usr/bin/env python # encoding: utf-8 from random import shuffle, random from itertools import permutations from base_solver import BaseSolver INF = float('inf') class Ant(object): route = [] score = INF def __init__(self, route): self.route = route def evaluate(self, task): st...
Python
0.000004
0ca69bd8c29d123702e1934863d5d8a8c0d1703b
Create parse.py
parse.py
parse.py
# Parse the Essential Script def parse(source): parsedScript = [[]] word = '' prevChar = '' inArgs = False inList = False inString = False inQuote = False for char in source: if char == '(' and not inString and not inQuote: parsedScript.append([]) parsedSc...
Python
0.00002
c4b7bd5b74aaba210a05f946d59c98894b60b21f
Add test for pixel CLI
tests/cli/test_pixel.py
tests/cli/test_pixel.py
""" Test ``yatsm line`` """ import os from click.testing import CliRunner import pytest from yatsm.cli.main import cli @pytest.mark.skipif("DISPLAY" not in os.environ, reason="requires display") def test_cli_pixel_pass_1(example_timeseries): """ Correctly run for one pixel """ runner = CliRunner() r...
Python
0
a0b71bb07956832fdaf5491ebd177418f0c7363d
add test to use two cameras and calculate distance from target based on FOV and IPD
Laptop/cvtest3.py
Laptop/cvtest3.py
import numpy as np import cv2 import math import time capA = cv2.VideoCapture(1) capB = cv2.VideoCapture(2) #print capA.get(cv2.CAP_PROP_FRAME_WIDTH) 640 #print capA.get(cv2.CAP_PROP_FRAME_HEIGHT) 480 #capA.release() #capB.release() #time.sleep(100) def findBiggestContour(contours): biggestContourIndex = 0 ...
Python
0
26dd65a282ada1e79309c4ff35cee4e49b086b66
Create part3.py
part3.py
part3.py
import pygame pygame.init() display_width = 800 display_height = 600 black = (0,0,0) white = (255,255,255) red = (255,0,0) gameDisplay = pygame.display.set_mode((display_width,display_height)) pygame.display.set_caption('A bit Racey') clock = pygame.time.Clock() carImg = pygame.image.load('racecar.png') def car(x...
Python
0.000002
98663d644b90e0e4c6188555501bcbc2b42d391a
Create part4.py
part4.py
part4.py
import pygame pygame.init() display_width = 800 display_height = 600 black = (0,0,0) white = (255,255,255) red = (255,0,0) car_width = 73 gameDisplay = pygame.display.set_mode((display_width,display_height)) pygame.display.set_caption('A bit Racey') clock = pygame.time.Clock() carImg = pygame.image.load('racecar....
Python
0.000001
4727d86e5207dac3f53018b4ff2d1d0ade97d4e6
Add http_json external pillar (#32741)
salt/pillar/http_json.py
salt/pillar/http_json.py
# -*- coding: utf-8 -*- """ A module that adds data to the Pillar structure retrieved by an http request Configuring the HTTP_JSON ext_pillar ==================================== Set the following Salt config to setup Foreman as external pillar source: .. code-block:: json ext_pillar: - http_json: ur...
Python
0
d2e5c2d20cf7e07f2dc8288d303e8f4088d5877a
Update module!
Modules/Update.py
Modules/Update.py
from ModuleInterface import ModuleInterface from IRCResponse import IRCResponse, ResponseType import GlobalVars import re import subprocess class Module(ModuleInterface): triggers = ["update"] help = "update - pulls the latest code from GitHub" def onTrigger(self, Hubbot, message): if message.Use...
Python
0
555cfbb827532c54598cecde01ef4e6e5e07714d
Create a test for re-evaluating external tasks while a workflow is running.
test/worker_external_task_test.py
test/worker_external_task_test.py
# Copyright (c) 2015 # # 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
6232295511ee780a6438c9cdfdcf576cb4f3d8e8
Add python script to convert .OBJ data for import
obj2json.py
obj2json.py
# obj2json: Convert OBJ export from polyHedronisme to Slitherlink3D JSON data import sys, json faces = [] vertices = [] name = "unknown" num_edges = 0 class ParseError(SyntaxError): """Raised when there's trouble parsing the input.""" pass def process(line): # print("Processing", line) if line.start...
Python
0.000001
7edcf7e1aa4824dc18584b88f21b2dc4ff9cab98
Use the requests.session() helper to get a Session() object.
rightscale/httpclient.py
rightscale/httpclient.py
from functools import partial import requests DEFAULT_ROOT_RES_PATH = '/' class HTTPResponse(object): """ Wrapper around :class:`requests.Response`. Parses ``Content-Type`` header and makes it available as a list of fields in the :attr:`content_type` member. """ def __init__(self, raw_respo...
from functools import partial import requests DEFAULT_ROOT_RES_PATH = '/' class HTTPResponse(object): """ Wrapper around :class:`requests.Response`. Parses ``Content-Type`` header and makes it available as a list of fields in the :attr:`content_type` member. """ def __init__(self, raw_respo...
Python
0
d10505678fd5624e5e88f72ac7852109f149b264
Add new kcov package (#14574)
var/spack/repos/builtin/packages/kcov/package.py
var/spack/repos/builtin/packages/kcov/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 Kcov(CMakePackage): """Code coverage tool for compiled programs, Python and Bash which use...
Python
0
303ff96b42b7eb41bb56f8a7f1d03a5319b6ba64
Create configurator.py
configurator.py
configurator.py
#!/usr/bin/python3 import os import sys import json from http.server import BaseHTTPRequestHandler, HTTPServer from urllib.parse import urlparse, parse_qs BASEDIR = "." LISTENIP = "0.0.0.0" LISTENPORT = 3218 INDEX = """<!DOCTYPE html> <html> <head> <title>HASS-PoC-Configurator</title> <meta charset...
Python
0.000001
a6e65ac7378b12cc6889199cac602a8fbee4b6e8
add nagios check on autoplot metrics
nagios/check_autoplot.py
nagios/check_autoplot.py
"""Check autoplot stats""" from __future__ import print_function import sys import psycopg2 def main(): """Go Main Go""" pgconn = psycopg2.connect(database='mesosite', host='iemdb', user='nobody') cursor = pgconn.cursor() cursor.execute(""" select count(*), avg(t...
Python
0
81b713d69408f6b5712f67d7707bbb17f9588ef6
Update __init__.py
tendrl/node_agent/manager/__init__.py
tendrl/node_agent/manager/__init__.py
import signal import threading from tendrl.commons.event import Event from tendrl.commons import manager as commons_manager from tendrl.commons.message import Message from tendrl.commons import TendrlNS from tendrl.node_agent.provisioner.gluster.manager import \ ProvisioningManager as GlusterProvisioningManager f...
import signal import threading from tendrl.commons.event import Event from tendrl.commons import manager as commons_manager from tendrl.commons.message import Message from tendrl.commons import TendrlNS from tendrl.node_agent.provisioner.gluster.manager import \ ProvisioningManager as GlusterProvisioningManager f...
Python
0.000072
b39eeea0b25e1e5bcec1d762a041e5ecf465885c
add solution for Reorder List
src/reorderList.py
src/reorderList.py
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a ListNode # @return nothing def reorderList(self, head): if head is None or head.next is None: return slow = fa...
Python
0
68e056459dd3818ebb0c5dbdc8b4f1089bec9f07
Add a few behavior tests for selection
tests/selection_test.py
tests/selection_test.py
import os import pytest import yaml from photoshell.selection import Selection @pytest.fixture def sidecar(tmpdir): tmpdir.join("test.sidecar").write(yaml.dump({ 'developed_path': os.path.join(tmpdir.strpath, "test.jpeg"), 'datetime': '2014-10-10 00:00' }, default_flow_style=False)) retur...
Python
0
63a34000402f4253f16221b11d620e65e1786447
add solution for Reverse Bits
src/reverseBits.py
src/reverseBits.py
class Solution: # @param n, an integer # @return an integer def reverseBits(self, n): return int(bin(n)[2:].zfill(32)[::-1], 2)
Python
0.000001
f81a612eabf5972d15a5b3f11d12897530cbf155
Add dump-tree command (wip)
cvsgit/command/dump-tree.py
cvsgit/command/dump-tree.py
"""Command to dump the full state of the source tree at a certain point in time.""" import re import subprocess from subprocess import PIPE import sys from cvsgit.cvs import split_cvs_source from cvsgit.i18n import _ from cvsgit.main import Command, Conduit from cvsgit.utils import Tempdir, stripnl class dump_tree(C...
Python
0.000003
ff2c4b68a5eace4451eeef4fd6ca84d37435c556
Add fields to privatemessage for network invitations.
project/editorial/migrations/0087_auto_20180226_1409.py
project/editorial/migrations/0087_auto_20180226_1409.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-02-26 22:09 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('editorial', '0086_auto_20180102_2145'), ] operatio...
Python
0
457e94d21e7bf237fc0b3e43e1154e948177a418
Add ipadm_addrprop module (#19415)
lib/ansible/modules/network/illumos/ipadm_addrprop.py
lib/ansible/modules/network/illumos/ipadm_addrprop.py
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2016, Adam Števko <adam.stevko@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the L...
Python
0
136dd3f0b5dd9d8eecb6e7bc20c25d4d2c131ad6
add new tool to list shared libraries deps
cerbero/tools/depstracker.py
cerbero/tools/depstracker.py
# cerbero - a multi-platform build system for Open Source software # Copyright (C) 2013 Andoni Morales Alastruey <ylatuya@gmail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; eit...
Python
0
e23b53a6326dbdb9df1e0f8d6711be1a9563c885
Add tests for processes
tests/test_processes.py
tests/test_processes.py
from wallace import processes, networks, agents, db class TestProcesses(object): def setup(self): self.db = db.init_db(drop_all=True) def teardown(self): self.db.rollback() self.db.close() def test_random_walk_from_source(self): net = networks.Network(self.db) ...
Python
0.000001
73084b964f964c05cb948be3acaa6ba68d62dc30
test plotting particles
ws/CSUIBotClass2014/test/test_plot_particles.py
ws/CSUIBotClass2014/test/test_plot_particles.py
#!/usr/bin/python # @author: vektor dewanto # @obj: demonstrate how to plot particles in an occupancy grid map, _although_, for now, all positions are valid import matplotlib.pyplot as plt import numpy as np import math import matplotlib.cm as cmx from matplotlib import colors # Construct the occupancy grid map grid...
Python
0
6342c6cab9b5dd0b34ca5de575ef82592474e1d5
add mvnsite.py to build site without javadocs or test run
bin/mvnsite.py
bin/mvnsite.py
#!/usr/bin/env python # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "Lice...
Python
0
598d937f3f180e22a1b4793644ffdb1b9a26f261
update crawler_main.py
crawler_main.py
crawler_main.py
""" crawler study code Author: smilexie1113@gmail.com """ import urllib.request import os import re from collections import deque ERROR_RETURN = "ERROR: " def retrun_is_error(return_str): return return_str[0 : len(ERROR_RETURN)] == ERROR_RETURN def python_cnt(str): return str.count("python") de...
""" crawler study code Author: smilexie1113@gmail.com """ import urllib.request import os import re from collections import deque from filecmp import cmp ERROR_RETURN = "ERROR:" def retrun_is_error(return_str): return return_str[0 : len(ERROR_RETURN)] == ERROR_RETURN def python_cnt(str): return s...
Python
0.000001
e904341eb7b426ea583e345689249d7f13451dc9
Add biome types.
biome_types.py
biome_types.py
biome_types = { -1: "Will be computed", 0: "Ocean", 1: "Plains", 2: "Desert", 3: "Extreme Hills", 4: "Forest", 5: "Taiga", 6: "Swampland", 7: "River", 8: "Hell", 9: "Sky", 10: "FrozenOcean", 11: "FrozenRiver", 12: "Ice Plains", 13: "Ice Mountains", 14: "Mu...
Python
0
0a0b322ca7d42d28ba495b7786cd2bd92c0bfd34
Add test_register.py
tests/test_assembler/test_register.py
tests/test_assembler/test_register.py
'Test of videocore.Register' from nose.tools import raises from videocore.assembler import Register, AssembleError, REGISTERS def test_register_names(): for name in REGISTERS: assert name == REGISTERS[name].name assert name == str(REGISTERS[name]) @raises(AssembleError) def test_pack_of_accumula...
Python
0.000003
12266ffcb7fcb809ec0e0a3102077581e64eb9e0
Update migrations
server/adventures/migrations/0002_auto_20160909_1901.py
server/adventures/migrations/0002_auto_20160909_1901.py
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-09-09 19:01 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('adventures', '0001_initial'), ] operations = [ ...
Python
0.000001
6dc1abdb92d1226071ea84e6352389ad01d21fe6
Create sequencer_scripting.py
examples/sequencer_scripting.py
examples/sequencer_scripting.py
import unreal_engine as ue from unreal_engine.classes import MovieSceneAudioTrack, LevelSequenceFactoryNew, MovieSceneSkeletalAnimationTrack, Character, SkeletalMesh, MovieScene3DTransformTrack, CineCameraActor import time from unreal_engine.structs import FloatRange, FloatRangeBound from unreal_engine import FTransfo...
Python
0.000001
360d4cd867f1ddd56a8487bea776e454d5954caf
Add textcat from config example
examples/textcat_from_config.py
examples/textcat_from_config.py
import random from typing import Optional from pathlib import Path import thinc from thinc.api import Config, fix_random_seed from wasabi import msg import typer import numpy as np import csv from ml_datasets import loaders from ml_datasets.util import get_file from ml_datasets._registry import register_loader from syn...
Python
0
df9b7cd8d1b34f8c29c372589ad9efd3a5435d0f
Implement TwitchWordsCounterBot class.
twitchbot/twitch_words_counter_bot.py
twitchbot/twitch_words_counter_bot.py
import irc.bot import irc.strings from .words_counter import WordsCounter class TwitchWordsCounterBot(irc.bot.SingleServerIRCBot): def __init__(self, channel, nickname, password, server, port=6667): irc.bot.SingleServerIRCBot.__init__(self, [(server, port, password)], nickname, nickname) self.ser...
Python
0
6136eef341f1ac5ce0be278c3ab78192192d0efa
check if OS is UNIX-y
posix.py
posix.py
#!/bin/py from sys import platform def osCheck(): # Check if OS is UNIX-y if "darwin" or "linux" in platform.lower(): print platform osCheck()
Python
0.999519
2a0724922bde4cdd5219c721cdfd5460a2e5f3ed
Create Timely_Tweeter.py
Timely_Tweeter.py
Timely_Tweeter.py
#-=- Coding: Python UTF-8 -=- import tweepy, time, sys argfile = str(sys.argv[1]) #Twitter Account info #Place Keys and Tokens bewteen the quotes CONSUMER_KEY = '' #The Consumer Key (API Key) CONSUMER_SECRET = '' #The Consumer Secret (API Secret) ACCESS_KEY = '' #The Access Token ACCESS_SECRET = '' #The Access ...
Python
0.000001
9c0750ef401870e0187e3b7f0e4e39cf3d7e3944
Make sure the profile data is unmarshallable as profile data.
test/test_benchmarks.py
test/test_benchmarks.py
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import os import pstats import pytest import six from asv import benchmarks from asv import config from asv import envi...
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import os import pytest import six from asv import benchmarks from asv import config from asv import environment BENCH...
Python
0.000002
d1ecc996269a801c65d3b88791f7f5546c8af1b8
add setup.py
setup.py
setup.py
from setuptools import setup setup( name='daria', version='0.0.1', description='pytorch trainer', author='odanado', author_email='odan3240@gmail.com', url='https://github.com/odanado/daria', license='MIT License', packages=['daria'], tests_require=['mock'], test_suite='tests', )...
Python
0.000001
db92ed5e523eafb7ccba553f1ee25365cc254798
add setup.py
setup.py
setup.py
#!/usr/bin/env python #encoding: utf-8 # # Programa epbdcalc: Cálculo de la eficiencia energética ISO/DIS 52000-1:2015 # # Copyright (C) 2015 Rafael Villar Burke <pachi@ietcc.csic.es> # Daniel Jiménez González <danielj@ietcc.csic.es> # # This program is free software; you can redist...
Python
0.000003
38bf3ce6db844999fe5903dad91e991c6fea57c7
Add setup
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup, find_packages setupconf = dict( name = 'contract', version = '0.3', license = 'BSD', url = 'https://github.com/Deepwalker/contract/', author = 'Barbuza, Deepwalker', author_email = 'krivushinme@gmail.com', description = ('Validation and ...
Python
0.000001
ea7d55fa309d592669e86dae826b7cc08323de16
update setup.py version to 0.2
setup.py
setup.py
from distutils.core import setup setup(name='mpmath', description = 'Python library for arbitrary-precision floating-point arithmetic', version='0.2', url='http://mpmath.googlecode.com', author='Fredrik Johansson', author_email='fredrik.johansson@gmail.com', license = 'BSD',...
from distutils.core import setup setup(name='mpmath', description = 'Python library for arbitrary-precision floating-point arithmetic', version='0.1', url='http://mpmath.googlecode.com', author='Fredrik Johansson', author_email='fredrik.johansson@gmail.com', license = 'BSD',...
Python
0
12ece36bf0355ad619635675b419d9d0e7163cf4
Add setup.py file
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup, find_packages setup( name='django-cache-relation', description="Non-magical object caching for Django.", version='0.1', url='http://code.playfire.com/', author='Playfire.com', author_email='tech@playfire.com', license='BSD', package...
Python
0.000001
30d3f42b4910b84b2a3419e43ea6e5e6da2ab7a0
Add setup
setup.py
setup.py
from setuptools import setup setup(name = 'enzynet', description = 'EnzyNet: enzyme classification using 3D convolutional neural networks on spatial representation', author = 'Afshine Amidi and Shervine Amidi', author_email = '<author1-lastname>@mit.edu, <author2-firstname>@stanford.edu', licen...
Python
0.000001