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
c84e3394ed4829ff9a66167864a11a4ef6a2b62c
Add script to get certificate expiration date
scripts/get_saml_cert_expiration.py
scripts/get_saml_cert_expiration.py
from cryptography import x509 from cryptography.hazmat.backends import default_backend from bluebottle.clients import properties from bluebottle.clients.models import Client from bluebottle.clients.utils import LocalTenant def run(*args): for client in Client.objects.all(): with LocalTenant(client): ...
Python
0
3f685e3873c18e1eb28b7a4121c552bbb697e0a4
Add script for generate events.
scripts/generator.py
scripts/generator.py
#!/usr/bin/python3 from random import randint output = "" filename = "data" class Generator: def gen_date(self): return str(randint(2013, 2015)) + "-" \ + str(randint(1, 12)) + "-" \ + str(randint(1, 31)) def gen_price(self): return str(10 * randint(10, 100)) d...
Python
0
8be49481990096c7a4735807cc3d9611b4ce0780
add migration script
scripts/update_metatable_columns.py
scripts/update_metatable_columns.py
from plenario.settings import DATABASE_CONN from plenario.database import Base from plenario.models import MetaTable from sqlalchemy import create_engine, Table from sqlalchemy.orm import sessionmaker from sqlalchemy.exc import NoSuchTableError def main(): # establish connection to provided database engine =...
Python
0.000001
f5284cc7da9166a43e3cfbd901205f4446295f7a
Add Consumer Product Safety Commission.
inspectors/cpsc.py
inspectors/cpsc.py
#!/usr/bin/env python import datetime import logging import os from urllib.parse import urljoin from bs4 import BeautifulSoup from utils import utils, inspector # https://www.cpsc.gov/en/about-cpsc/inspector-general/ # Oldest report: 2003 # options: # standard since/year options for a year range to fetch from. # ...
Python
0
79a81b2d1936cd44caabf5f4e38abdee88a8821a
add missing proxy for kiva.agg.plat_support
enthought/kiva/agg/plat_support.py
enthought/kiva/agg/plat_support.py
# proxy module from kiva.agg.plat_support import *
Python
0
f25a1484892d7b60fb9ffaba033cfb467e1b34f5
Update random-point-in-non-overlapping-rectangles.py
Python/random-point-in-non-overlapping-rectangles.py
Python/random-point-in-non-overlapping-rectangles.py
# Time: ctor: O(n) # pick: O(logn) # Space: O(n) # Given a list of non-overlapping axis-aligned rectangles rects, # write a function pick which randomly and uniformily picks # an integer point in the space covered by the rectangles. # # Note: # - An integer point is a point that has integer coordinates. # - A...
# Time: O(logn) # Space: O(n) # Given a list of non-overlapping axis-aligned rectangles rects, # write a function pick which randomly and uniformily picks # an integer point in the space covered by the rectangles. # # Note: # - An integer point is a point that has integer coordinates. # - A point on the perimeter of...
Python
0.000007
eb8eabd44764dc26fdbd08ef35b3ea8fc0dd7c54
Add mutt display script
bin/mutt-display.py
bin/mutt-display.py
#!/usr/bin/env python2 """ Copyright 2011 by Brian C. Lane """ import sys import email raw_msg = sys.stdin.read() msg = email.message_from_string(raw_msg) date = msg.get('Date', None) if date: from email.utils import mktime_tz, parsedate_tz, formatdate try: # Convert to local TZ tz_tuple =...
Python
0
2957a0331654a22c6f62544b6ec1ca4a4ee86be9
Tweak metainfo_series series name detection.
flexget/plugins/metainfo_series.py
flexget/plugins/metainfo_series.py
import logging from flexget.plugin import * from flexget.utils.titles import SeriesParser import re log = logging.getLogger('metanfo_series') class MetainfoSeries(object): """ Check if entry appears to be a series, and populate series info if so. """ def validator(self): from flexget imp...
import logging from flexget.plugin import * from flexget.utils.titles import SeriesParser import re log = logging.getLogger('metanfo_series') class MetainfoSeries(object): """ Check if entry appears to be a series, and populate series info if so. """ def validator(self): from flexget imp...
Python
0.000012
00cc43b3e7a848c17272928f6469beb128e278b4
add linear_regression
projects/NLR_MEG/linear_regression.py
projects/NLR_MEG/linear_regression.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Jun 26 12:08:31 2018 @author: sjjoo """ #%% import numpy as np from sklearn import linear_model as lm import statsmodels.api as sm import statsmodels.formula.api as smf import pandas as pd X = np.column_stack((temp_read,temp_raw, temp_age,temp_meg1, t...
Python
0.999885
f20aef828bb7e3a7206cd239ff95c3234391c11c
Add Example 5.1.
Kane1985/Chapter5/Example5.1.py
Kane1985/Chapter5/Example5.1.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Example 5.1 from Kane 1985.""" from __future__ import division from sympy import Dummy, Matrix from sympy import expand, solve, symbols, trigsimp from sympy.physics.mechanics import ReferenceFrame, Point, dot, dynamicsymbols from util import msprint, subs, partial_veloc...
Python
0
bc691d415d32836f8354582294c6ae11413b0a6a
change version to .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.000001
9012cb2aa34d6df32e780555b74581b29cd309b8
add forgotten new module
flexx/ui/_iframe.py
flexx/ui/_iframe.py
from .. import react from . import Widget class IFrame(Widget): """ An iframe element, i.e. a container to show web-content. Note that some websites do not allow themselves to be rendered in a cross-source iframe. """ CSS = '.flx-iframe {border: none;}' @react.input def url(v=''...
Python
0
76c7add3a57810d42e6584ddf22acc027f641a0a
Create classes.py
classes.py
classes.py
from tkinter import * class myClass: def hello(self): self.label.config(text='HelloO!') def __init__(self,master): # this function is always called when object is instantiated frame=Frame(master) frame.pack() self.printBtn = Button(frame, text='click', command=self.hello) ...
Python
0.000001
2ccefe090305e815633f92a6f3d13155e46e7711
Update migrations
app/timetables/migrations/0002_auto_20171005_2209.py
app/timetables/migrations/0002_auto_20171005_2209.py
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-10-05 22:09 from __future__ import unicode_literals import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('timetables', '0001_initial'), ] operations = [ ...
Python
0.000001
7f2f0dca532ce3cbcf33720e56a639f78b82e771
add console utility
multivac/console.py
multivac/console.py
import sys from termcolor import colored from multivac.version import version from multivac.models import JobsDB from multivac.util import format_time class Console(object): def __init__(self): self.prompt = colored('multivac> ','cyan',attrs=['bold']) self.db = JobsDB('localhost', 6379) ...
Python
0.000001
f4202292570eb51e52629ad09280175b42598d52
Add Divider class
murasame/divider.py
murasame/divider.py
import os import pandas as pd from . import CONFIG conf = CONFIG["divider"] class Divider(object): def __init__(self, df, files, base): self.data = df self.files = files self.base = base self.writers = {} def _setup_writer(self, outdir): assert self.files os...
Python
0.000001
7d987220474d76286c49b5378861854a09798a16
create project folder
PowerOutagePredictor/Tree/_init_.py
PowerOutagePredictor/Tree/_init_.py
Python
0.000001
43d9582172cb268f9c2f38f3cd211bbca06b0741
Create php_webshell.py
php/php_webshell.py
php/php_webshell.py
import random #author: pureqh #github: https://github.com/pureqh/webshell shell = '''<?php class {0}{3} public ${1} = null; public ${2} = null; public ${6} = null; function __construct(){3} $this->{1} = 'ZXZhbCgkX1BPU'; $this->{6} = '1RbYV0pOw=='; $this->{2} =...
Python
0
87b597fd5363ca14a8e491ba84bedb4486c6676b
Test __bytes__ special method
python3/jute/test/test_jute_bytes.py
python3/jute/test/test_jute_bytes.py
import unittest from jute import Interface, Dynamic class BytesLike(Interface): def __iter__(self): """bytes-like object must be iterable.""" def __bytes__(self): """Return bytes representation.""" class BytesTestMixin: def get_test_object(self): return object() def test...
Python
0.000469
0b20df518e66e3763a05ca796880c96d8e1d291d
compute covariance of multiple objects
cov_obs.py
cov_obs.py
import numpy as np import matplotlib.pyplot as plt from astropy import constants as c, units as u, table as t from astropy.io import fits from astropy import coordinates as coords import os import spec_tools import ssp_lib import manga_tools as m from itertools import izip, product from glob import glob def extrac...
Python
0.99999
d7484f8008bd5e717a137b3e076fb1d6d067d400
Rewrite of bittorrent-console to work with Kamaelia as a threadedcomponent.
Sketches/RJL/bittorrent/BitTorrent/BitTorrentKamaelia.py
Sketches/RJL/bittorrent/BitTorrent/BitTorrentKamaelia.py
#!/usr/bin/env python # The contents of this file are subject to the BitTorrent Open Source License # Version 1.1 (the License). You may not copy or use this file, in either # source code or executable form, except in compliance with the License. You # may obtain a copy of the License at http://www.bittorrent.com/li...
Python
0
5e398ae0d8074a3caf11997884d9f719ef047b15
Define exception for incorrect arguments
soccer/exceptions.py
soccer/exceptions.py
class IncorrectParametersException(Exception): pass
Python
0.005016
d7020ccb328747922942c56872bcfbec47d451ae
Add cli command class for delete
quilt/cli/delete.py
quilt/cli/delete.py
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80: # python-quilt - A Python implementation of the quilt patch system # # Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as ...
Python
0
304c408535edc28ef3258bef2a511584d2b1b6e6
Implement the PLS2 method
regressions/pls2.py
regressions/pls2.py
# regressions.pls2 """A package which implements the Partial Least Squares 2 algorithm.""" import random from . import * class PLS2: """Regression using the PLS2 algorithm.""" def __init__(self, X, Y, g, max_iterations=DEFAULT_MAX_ITERATIONS, iteration_convergence=DEFAUL...
Python
0.999027
8dfd59a639bcf540ea4c5a52e91c5f8a7a198554
Initialize affineKeyTest
books/CrackingCodesWithPython/Chapter14/affineKeyTest.py
books/CrackingCodesWithPython/Chapter14/affineKeyTest.py
# This program proves that the keyspace of the affine cipher is limited # to less than len(SYMBOLS) ^ 2. import affineCipher, cryptomath message = 'Make things as simple as possible, but not simpler.' for keyA in range(2, 80): key = keyA * len(affineCipher.SYMBOLS) + 1 if cryptomath.gcd(keyA, len(affineCiphe...
Python
0.000001
77094bb723d35fd23d909e0c59b712eeb7612495
Add fibonacci HW
training/level-1-the-zen-of-python/dragon-warrior/Fibonacci/stapp_Fibtest.py
training/level-1-the-zen-of-python/dragon-warrior/Fibonacci/stapp_Fibtest.py
""" Compute Fibonacci sequence and learn python. Steve Tapp """ import sys import timeit fib_seq = [0, 1] fib_even_sum = 0 for fibnum in range (2, 50): fib_seq.append(fib_seq[-2] + fib_seq[-1]) print (fibnum, fib_seq[fibnum]) if fib_seq[-1] >= 4000000: break if not fib_seq[fibnum] % 2: ...
Python
0.999987
b1a851d6f5dd47790459564a55405627d9b7a9e4
Add news date and title scrapper from ist's news page.
scripts/webscraping/ist_news_titles.py
scripts/webscraping/ist_news_titles.py
from urllib.request import urlopen from bs4 import BeautifulSoup import sys, io sys.stdout = io.TextIOWrapper(sys.stdout.buffer,'cp437','backslashreplace') html = urlopen("http://tecnico.ulisboa.pt/pt/noticias/") bsObj = BeautifulSoup(html, "html.parser") for news_wrapper in bsObj.find("div", {"id":"content_wrapper...
Python
0
bd9496bf726aff0472a52d6c5e2a0db96f2af8e2
Add allow_skipped_files option to DJANGO_DEFAULTS
djangae/core/management/__init__.py
djangae/core/management/__init__.py
import os import sys import argparse import djangae.sandbox as sandbox from djangae.utils import find_project_root # Set some Django-y defaults DJANGO_DEFAULTS = { "storage_path": os.path.join(find_project_root(), ".storage"), "port": 8000, "admin_port": 8001, "api_port": 8002, "automatic_restart"...
import os import sys import argparse import djangae.sandbox as sandbox from djangae.utils import find_project_root # Set some Django-y defaults DJANGO_DEFAULTS = { "storage_path": os.path.join(find_project_root(), ".storage"), "port": 8000, "admin_port": 8001, "api_port": 8002, "automatic_restart"...
Python
0.000003
6317a43baed719bddd84863b750018a6ef1287b0
add new test
test/test_canvas.py
test/test_canvas.py
import sequana.resources.canvas.bar as bar def test_bar(): data = [ {"name":"A", "data":{"R1":10, "R2":90}}, {"name":"B", "data":{"R1":90, "R2":10}}] bar.stacked_bar("title", "ACGT", datalist=data)
Python
0.000001
2d9712f5b1fecb8a1f6c989ed835a9476b5cdab5
Create MeshTextureCoordinates.py
MeshTextureCoordinates.py
MeshTextureCoordinates.py
#***********************************************************************************************************# #********* Get normalized 2-D texture coordinates of a mesh object *****************************************# #********* by Djordje Spasic ***********************************************************************...
Python
0.000001
ed56dc3fc8411baa5d2948591e9e24fc31b7444d
Add files via upload
src/processLabels.py
src/processLabels.py
""" Copyright (c) 2016, Jose Dolz .All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the fol...
Python
0
0301a96b8c9592c58fe41eded24a39d503f4fcb2
Create ExtendedJsonRpcApi.py
neo/api/JSONRPC/ExtendedJsonRpcApi.py
neo/api/JSONRPC/ExtendedJsonRpcApi.py
from neo.Core.Blockchain import Blockchain from neo.api.JSONRPC.JsonRpcApi import JsonRpcApi, JsonRpcError from neo.Implementations.Wallets.peewee.UserWallet import UserWallet from neocore.UInt256 import UInt256 import datetime class ExtendedJsonRpcApi: """ Extended JSON-RPC API Methods """ def get_n...
Python
0
04e7a43c9516fc9834727c3087863c6282da2dbf
Add tests.py to app skeleton.
lib/rapidsms/skeleton/app/tests.py
lib/rapidsms/skeleton/app/tests.py
from rapidsms.tests.scripted import TestScript from app import App class TestApp (TestScript): apps = (App,) # define your test scripts here. # e.g.: # # testRegister = """ # 8005551212 > register as someuser # 8005551212 < Registered new user 'someuser' for 8005551212! # 8005551...
Python
0
d358bf3f103069c2f5a85da15331f808df746064
Bump version
oi/version.py
oi/version.py
VERSION = '0.3.0'
VERSION = '0.2.1'
Python
0
19beca7e8166cbab42937ccbd8e9c705ca4913dd
Bump version
oi/version.py
oi/version.py
VERSION = '0.1.0'
VERSION = '0.0.1'
Python
0
6f2a9cbf9e571855074e898d22480d61277a3eda
Add experimental polling DB backend.
django_lightweight_queue/backends/db.py
django_lightweight_queue/backends/db.py
import time import datetime from django.db import connection, models, ProgrammingError from ..job import Job class DatabaseBackend(object): TABLE = 'django_lightweight_queue' FIELDS = ( models.AutoField(name='id', primary_key=True), models.CharField(name='queue', max_length=255), mod...
Python
0
2498e40294cf56f40fb869d30844c3a8223267a0
Create initdb command
initdb.py
initdb.py
#!/usr/bin/env python from app import db db.create_all()
Python
0.000001
fa89b4307578a18ee59154c99a45d0b1c68b29e4
Add test_regex.py.
test_natsort/test_regex.py
test_natsort/test_regex.py
# -*- coding: utf-8 -*- """These test the splitting regular expressions.""" from __future__ import unicode_literals import pytest from natsort.utils import NumericalRegularExpressions as NumRegex regex_names = { NumRegex.int_nosign(): "int_nosign", NumRegex.int_sign(): "int_sign", NumRegex.float_nosign_n...
Python
0
3c8eb0563f3997fc068d039b18452eaa98da3122
Add a script useful for downloading large avatar images from Atom feeds
download_avatars.py
download_avatars.py
#!/usr/bin/env python3 import PIL.Image import io import json import requests import post_list import web_cache # Split this file into two modules, because we need to move web_cache out of # the way between the two steps. (We want to isolate the avatar HTTP requests) # into its own thing. def _make_avatar_url_lis...
Python
0
7e1ea3516aa6b4d41748a9ae63464a32ff16e018
Test variable module
extenteten/variable_test.py
extenteten/variable_test.py
from .util import static_shape, static_rank from .variable import variable def test_variable(): shape = [123, 456] assert static_shape(variable(shape)) == shape initial = [float(n) for n in shape] assert static_rank(variable(initial)) == 1
Python
0.000001
b7e24eaa9dae42bc2af56e58c503258859227558
Create coordination_ldos.py
scripts/qmflows/coordination_ldos.py
scripts/qmflows/coordination_ldos.py
#!/usr/bin/env python """Performs a molecular optimization using CP2K and prints local PDOS projected on subsets of atoms based on the atom type and coordination number.""" import argparse import itertools import logging import os from typing import Dict, List import pkg_resources from nanoCAT.recipes import coordina...
Python
0.000009
1d5d76f0166619f3004adb02a902b0739dc55bd6
Create balanceamento.py
balanceamento.py
balanceamento.py
import unittest class Pilha(): def __init__(self): self._lista = [] def vazia(self): return not bool(self._lista) def topo(self): if self._lista: return self._lista[-1] raise PilhaVaziaErro() def empilhar(self, valor): self._lista.append(valor) ...
Python
0.000002
58f85213c72b194fe44da36972436c4e7bbdd681
add sina http util
server/crawler/sinawb/SinaHttpUtil.py
server/crawler/sinawb/SinaHttpUtil.py
# -*- coding:utf-8 -*- """ Author: AsherYang Email : ouyangfan1991@gmail.com Date : 2017/11/22 Desc : Sina Http Util 参考 Shserver 微店 OpenRequest.py """ try: from cStringIO import StringIO except ImportError: from StringIO import StringIO import gzip, json, urllib, urllib2, collections,time,logging def http_...
Python
0.000002
54285887dc96e3d5d98ca4c02df2a04d49ac69f7
Add TeamPermission tests
tests/sentry/api/bases/test_team.py
tests/sentry/api/bases/test_team.py
from __future__ import absolute_import from mock import Mock from sentry.api.bases.team import TeamPermission from sentry.models import ApiKey, OrganizationMemberType, ProjectKey from sentry.testutils import TestCase class TeamPermissionBase(TestCase): def setUp(self): self.org = self.create_organizatio...
Python
0
aeabc254a09047a58ea5b5c16fb2c5e7e9008691
Test generator expressions
tests/samples/generator_expression.py
tests/samples/generator_expression.py
import snoop @snoop(depth=2) def main(): return list(x * 2 for x in [1, 2]) if __name__ == '__main__': main() expected_output = """ 12:34:56.78 >>> Call to main in File "/path/to_file.py", line 5 12:34:56.78 5 | def main(): 12:34:56.78 6 | return list(x * 2 for x in [1, 2]) 12:34:56.78 >>> St...
Python
0.000001
8e049c956045b3d5cc37db0041e71b637f556408
add DB migration
migrations/versions/2316c9808a5_.py
migrations/versions/2316c9808a5_.py
"""empty message Revision ID: 2316c9808a5 Revises: 26fbbffb991 Create Date: 2015-04-16 13:46:41.849087 """ # revision identifiers, used by Alembic. revision = '2316c9808a5' down_revision = '26fbbffb991' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - plea...
Python
0
0ca24ff03f6382c23995f662b678e457a8394140
Add script to bump symbol versions
debian/bump-symbols.py
debian/bump-symbols.py
#!/usr/bin/python # # Bump symbol versions of libvirt0 # Usage: ./bump-symbol-versions 1.2.16~rc2 import os import re import sys import shutil import subprocess #import gbp.git.GitRepository symbols_file = 'debian/libvirt0.symbols' symbols_new_file = symbols_file + '.new' symbols = open(symbols_file) symbols_new =...
Python
0
4435eb504b10855088f006456dfface89a4a8798
create first easy mixin
easy/admin/mixin.py
easy/admin/mixin.py
# coding: utf-8 from django.conf.urls import url from django.contrib import messages from django.core.urlresolvers import reverse from django.http.response import HttpResponseRedirect class MixinEasyViews(object): def get_urls(self): urls = super(MixinEasyViews, self).get_urls() info = self.mode...
Python
0
27640acedbd945d22db1f26dce75c107c21e988d
Add tests suite for web oriented tags.
tests/tests_tags/tests_webspecials.py
tests/tests_tags/tests_webspecials.py
""" SkCode web oriented tag test code. """ import unittest from skcode.etree import TreeNode from skcode.tags import (HorizontalLineTagOptions, LineBreakTagOptions, DEFAULT_RECOGNIZED_TAGS) class HorizontalLineTagTestCase(unittest.TestCase): """ Tests suite for ...
Python
0
a5950853ae7cfe9ac4fce7f297722231feae2f44
switch if/else per David's review comments
plaid/http.py
plaid/http.py
############################################################################## # Helper module that encapsulates the HTTPS request so that it can be used # with multiple runtimes. PK Mar. 14 ############################################################################## import os import urllib # Command line def _reque...
############################################################################## # Helper module that encapsulates the HTTPS request so that it can be used # with multiple runtimes. PK Mar. 14 ############################################################################## import os import urllib # Command line def _reque...
Python
0
a5c99fe8e37079a2663fe90644d3925d6dc7a5d0
Add another example that works offline
examples/offline_examples/test_request_fixture.py
examples/offline_examples/test_request_fixture.py
import pytest @pytest.mark.offline def test_request_fixture(request): sb = request.getfixturevalue('sb') sb.open("data:text/html,<p>Hello<br><input></p>") sb.assert_element("html > body") sb.assert_text("Hello", "body p") sb.type("input", "Goodbye") sb.click("body p") sb.tearDow...
Python
0.000001
f31fb6a06c9f0126f43e7b1208502f67f7605d33
Add the-love-letter-mistery
the-love-letter-mystery/solution.py
the-love-letter-mystery/solution.py
from math import fabs def solve(string): """ abc -> abb -> aba (2) abcba (0) abcd -> abcc -> abcb -> abca -> abba (4) cba -> bba -> aba (2) """ if len(string) == 1: return True ords = [ord(each) for each in string] length = len(ords) diffs = sum([fabs(ords[i] - ords[...
Python
0.999996
1de0266e3612ed7888e21692e4ef191c9effbd1d
add db2 plugin test
tests/unit/test_app_db2.py
tests/unit/test_app_db2.py
import mock from unittest import TestCase from plugins.applications.db2 import db2_crawler from plugins.applications.db2.feature import DB2Feature from plugins.applications.db2.db2_container_crawler \ import DB2ContainerCrawler from plugins.applications.db2.db2_host_crawler \ import DB2HostCrawler from utils.cr...
Python
0
01589a78cbe3bcabd116b9943f23ab3e8bc6a158
Create irrigate.py
device/src/irrigate.py
device/src/irrigate.py
#!/usr/bin/env python #In this project, I use a servo to simulate the water tap. #Roating to 90 angle suggest that the water tap is open, and 0 angle means close. from pyb import Servo servo=Servo(1) # X1 def irrigate_start(): servo.angle(90) def irrigate_stop(): servo.angle(0)
Python
0.000001
a2296ae2165b60ba182d540f729a099183169c92
Add problem 40, decimal fraction digits
problem_40.py
problem_40.py
from time import time def main(): fractional_part = '' i = 1 while len(fractional_part) < 1000000: fractional_part += str(i) i += 1 prod = 1 for i in [1, 10, 100, 1000, 10000, 100000, 1000000]: prod *= int(fractional_part[i-1]) print 'Product:', prod if __name__ == ...
Python
0.999999
e9b6a27a423e765033d04801762f9f0356cd992a
Add urls.py ,placeholder for urls mappings in the plots app
plots/urls.py
plots/urls.py
__author__ = 'ankesh' from django.conf.urls import patterns, url
Python
0.000001
1545c195c65e96e55bf5432538ff3141c60f5149
bits required to convert A to B
bitsToConvert.py
bitsToConvert.py
def bit_req(A,B): """ Bits required to convert int A to int B """ c=A^B return countOnes(c) def countOnes(c): count=0 if c == 1: return 1 while(c>=1): b=c%2 if b == 1: count+=1 c=c//2 return count print bit_req(4,7)
Python
0.999491
dc1bcdfed7439e1e00fdcad058fd9acbc1fac466
add initadmin to management base commands
fiduswriter/base/management/commands/initadmin.py
fiduswriter/base/management/commands/initadmin.py
# code adapted by github.com/jobdiogenes from https://github.com/dkarchmer/aws-eb-docker-django/blob/master/authentication/manage # used to help automation install like in docker. # Create admins accounts if no users exists. # Password 'admin' is used unless defined by ADMIN_PASSWORD from django.conf import settings f...
Python
0.000001
dba312802cbf73f54c7cc347d45430ac0d8f016c
add TicketFactory
tickets/tests/factories.py
tickets/tests/factories.py
from django.contrib.auth.models import User import factory from tickets.models import Ticket class UserFactory(factory.Factory): FACTORY_FOR = User class TicketFactory(factory.Factory): FACTORY_FOR = Ticket creator = factory.LazyAttribute(lambda a: UserFactory())
Python
0
9d77092729e534b19d75b38dd700df25a009fa49
Add script to convexify the energies of a conservation tracking JSON model
toolbox/convexify_costs.py
toolbox/convexify_costs.py
import sys import commentjson as json import os import argparse import numpy as np def listify(l): return [[e] for e in l] def convexify(l): features = np.array(l) if features.shape[1] != 1: raise InvalidArgumentException('This script can only convexify feature vectors with one feature per state!') bestStat...
Python
0.000002
a4bbf6744231ebc2243e07426512d9956b374d4f
add untested wordvec fns
treeano/sandbox/nodes/word_vectors.py
treeano/sandbox/nodes/word_vectors.py
import theano import theano.tensor as T import treeano def pointwise_mutual_information(counts_both, row_counts=None, col_counts=None, count_total=None): """ pmi calculation with optional row, column, and total ...
Python
0.999941
9090f48b5abb5c60c8629613724ff7309dee07f5
Fix restructured text rendering in simple_osmesa.py
examples/offscreen/simple_osmesa.py
examples/offscreen/simple_osmesa.py
# -*- coding: utf-8 -*- # vispy: testskip # Copyright (c) 2015, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. """ This is a simple osmesa example that produce an image of a cube If you have both osmesa and normal (X) OpenGL installed, execute with something like the ...
# -*- coding: utf-8 -*- # vispy: testskip # Copyright (c) 2015, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. """ This is a simple osmesa example that produce an image of a cube If you have both osmesa and normal (X) OpenGL installed, execute with something like the ...
Python
0.000424
a951a29062f1fb7946b4d227f6fa0b3b3d5b9a04
Add a bindings.gyp file for use with node-gyp.
bindings.gyp
bindings.gyp
{ 'targets': [ { 'target_name': 'serialport_native', 'sources': [ 'serialport_native/serialport_native.cc' ] } ] }
Python
0
2a9e403d154870e29fa751bf598b5fb9d8662668
Create send_sensor_data.py
send_sensor_data.py
send_sensor_data.py
#!/usr/bin/env python # # GrovePi Example for using the Grove Temperature Sensor (http://www.seeedstudio.com/wiki/Grove_-_Temperature_Sensor) # # The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi # # Have a question about this examp...
Python
0.000004
34f7d76cb1f56280b636f4b98968c17a8b9a2c14
Create TestRSS.py
TestRSS.py
TestRSS.py
''' Created on Jul 17, 2014 @author: ALLWINLEOPRAKASH ''' import RssFeedCollector as rs import datetime rs.OPFileCheck() var = 1 # Continuous active loop to retrieve real time data while var == 1: sec = datetime.datetime.now().second # Check and append the new entries every 20 seconds if sec % 20 ==...
Python
0
3024ff0fe1343dac11adba82ec28d3a27f4e0d70
add TXT
gallery/file_modules/txt.py
gallery/file_modules/txt.py
import os from gallery.file_modules import FileModule from gallery.util import hash_file class TXTFile(FileModule): def __init__(self, file_path): FileModule.__init__(self, file_path) self.mime_type = "text/plain"
Python
0.00004
1a8bfc882e22c7f665260cf6d5c43ed450887ba0
add expect_column_values_to_be_valid_ismn (#4747)
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_ismn.py
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_ismn.py
""" This is a template for creating custom ColumnMapExpectations. For detailed instructions on how to use it, please see: https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_column_map_expectations """ import json from typing import Optional from stdnum impo...
Python
0.000001
35da1d5dd86fd597f31c2fb816b2b7e3f89ab021
Revert "removing settings.py, since it's ignored by .gitignore"
csc_new/csc_new/settings.py
csc_new/csc_new/settings.py
""" Django settings for csc_new project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) im...
Python
0
8bdc5c69ef2a45ca4eaeef6f096e1ddf688801b4
Create Weather.py
Weather.py
Weather.py
#Import all the libraries we need import unirest import json import os #Assign X to 1 for our loop (We can use a While True Loop too) x = 1 #Prints Welcome Screen os.system('cls') print('================================') print('Welcome to the Weather App!') print('Press Enter to Continue!') print('====================...
Python
0.000001
d4c30f4e70dabe18c73eeb0feaa49ee4dcead2ff
Create groceries.py
groceries.py
groceries.py
groceries = ["banana", "orange", "apple"] stock = { "banana": 6, "apple": 0, "orange": 32, "pear": 15 } prices = { "banana": 4, "apple": 2, "orange": 1.5, "pear": 3 } # Write your code below! def compute_bill(food): total = 0 for item in food: if stock[item] > 0: ...
Python
0.002157
a8dc3e1143290495ab56b30660e7fbe58fcaa36c
add analysis script
v01/analyse_data.py
v01/analyse_data.py
# this analysis script finds the photons with the highest energy for the crab nebula from the 2FHL event list from numpy import * from astropy.io import fits hdulist=fits.open('gll_psch_v08.fit.gz') print hdulist.info() datalist=hdulist[1] #hdu=1 is the source catalog, found using "ftlist" or "hdulist.info()" ...
Python
0.000001
52a83fa5fc6ca029c87b50c64e0e3d08bdf1d081
Create pyton_test.py
pyton_test.py
pyton_test.py
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(2, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(7, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(17, GPIO.OUT) GPIO.setup(22, GPIO.OUT) def verantavalo(channel): time.sleep(0.1) if GPIO.input(2) != GPIO.HIGH: return if(GPIO.input(17) == ...
Python
0.000002
338470581269d645c7bdd908ea6e17f2246bad12
Move the backend path in the deploy script
fabfile.py
fabfile.py
# fabricfile to deploy build # # depends on installation of fabric - pip install fabric virtualenv # # example invocation # $ fab -H jenkins@uf04.seedscientific.com deploy # $ fab -H ubuntu@52.0.138.67 deploy # $ fab -H ubuntu@uf04.seedscientific.com deploy from fabric.api import local, run, cd, put ## global variabl...
# fabricfile to deploy build # # depends on installation of fabric - pip install fabric virtualenv # # example invocation # $ fab -H jenkins@uf04.seedscientific.com deploy # $ fab -H ubuntu@52.0.138.67 deploy # $ fab -H ubuntu@uf04.seedscientific.com deploy from fabric.api import local, run, cd, put ## global variabl...
Python
0
74f7f2aa7b51144f34156ed49490dae4edaa5cb7
add new expectation on validating hexadecimals (#5188)
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_hexadecimal.py
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_hexadecimal.py
""" This is a template for creating custom ColumnMapExpectations. For detailed instructions on how to use it, please see: https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_column_map_expectations """ from typing import Optional from great_expectations.cor...
Python
0
096ea11231668e0fd03c1628c255cf0b08c0bfc3
Create HouseCupBot.py
HouseCupBot.py
HouseCupBot.py
import praw, time, sqlite3, operator, re #Bot setup username = 'HouseCupBot' password = '' userAgent = 'HouseCupBot. Keeps a running score for Hogwarts houses. Author: u/d_web' houses = ['gryffindor','hufflepuff','ravenclaw','slytherin'] tagLine = 'HouseCupBot by u/D_Web. Type "HouseCupBot !help" for more info....
Python
0
f6cf0dad787365d9f401e0d5e66e699fc7b93938
Move fabfile
fabfile.py
fabfile.py
#!/usr/bin/python # # Copyright 2011 Friday Film Club. All Rights Reserved. """Deploy the Friday Film Club application.""" from __future__ import with_statement __author__ = 'adamjmcgrath@gmail.com (Adam McGrath)' import functools import os import sys from fabric.api import * from fabric.colors import green, red, y...
Python
0.000001
5411224e9683c9ee6a8b06ff9b666a93948e6a69
Create example.py
example.py
example.py
#TABLE LOAD self.table_data = QtGui.QTableView() cols=['rowid','data'] data = [(1,'data1'),(2,'data2'),] table.load(self.table_data,data,cols,order=0,col=0) #TABLE SORT def context(self,pos): mainmenu = QtGui.QMenu("Menu", self) mainmenu.addAction("Sort") C = self.mapFromGlobal(QCursor.pos()) pos.setY(C....
Python
0.000001
8e1e905f5dbdaccc396ec74fb7c05a93d79c35ff
Add example to show failure for #62.
examples/example_blueprint.py
examples/example_blueprint.py
from flask import Blueprint, Flask, jsonify from flasgger import Swagger from flasgger.utils import swag_from app = Flask(__name__) example_blueprint = Blueprint("example_blueprint", __name__) @example_blueprint.route('/usernames', methods=['GET', 'POST']) @swag_from('username_specs.yml', methods=['GET']) @swag_f...
Python
0
158d3c6478f4d9d83d166504febc2ba1ba4e58f7
Add example.
example.py
example.py
# Licensed to Tomaz Muraus under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # Tomaz muraus licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in...
Python
0.000001
7c87974c862184df8df40595ba26f5ff7082c4a6
Add a CIB routing fuzzer
fuzzers/LIFCL/002-cib-routing/fuzzer.py
fuzzers/LIFCL/002-cib-routing/fuzzer.py
from fuzzconfig import FuzzConfig from interconnect import fuzz_interconnect import re configs = [ ((1, 18), FuzzConfig(job="CIBTROUTE", device="LIFCL-40", sv="../shared/route_40.v", tiles=["CIB_R1C18:CIB_T"]), set(["TAP_CIBT_R1C14:TAP_CIBT"])), ((18, 1), FuzzConfig(job="CIBLRROUTE", device="LIFCL-40", sv="../...
Python
0
bbbdaed24390b7c5808cc7233b6ad0566c09f188
add python C wrapper; mostly empty for now
galpy/orbit_src/integratePlanarOrbit.py
galpy/orbit_src/integratePlanarOrbit.py
def integratePlanarOrbit_leapfrog(pot,yo,t,rtol=None,atol=None): """ NAME: integratePlanarOrbit_leapfrog PURPOSE: leapfrog integrate an ode for a planarOrbit INPUT: pot - Potential or list of such instances yo - initial condition [q,p] t - set of times at which one wan...
Python
0
7b560ea31ad4e308d01926f1e73cb6deb6b24a6a
Clarify location of settings/local.py-dist
airmozilla/settings/__init__.py
airmozilla/settings/__init__.py
from .base import * try: from .local import * except ImportError, exc: exc.args = tuple(['%s (did you rename airmozilla/settings/local.py-dist?)' % exc.args[0]]) raise exc
from .base import * try: from .local import * except ImportError, exc: exc.args = tuple(['%s (did you rename settings/local.py-dist?)' % exc.args[0]]) raise exc
Python
0.000287
b9304bb17a3d81b0bdc1da08727a1d4001c54450
Add script for populating db with results (only 2009 national).
rebuild_db.py
rebuild_db.py
import json import csv from api.models import * from api import db db.drop_all() db.create_all() def read_data(filename): """ Read election data from CSV file, downloaded at http://www.elections.org.za/content/Elections/National-and-provincial-elections-results/ """ with open(filename, 'Ur') as f...
Python
0
70b21201df3c1b6e476f8dbfee53490bd16a6d00
Add Fabric fabfile for project management
fabfile.py
fabfile.py
""" Fabric fabfile for Davies cave survey package. Run `pip install fabric` to install, then `fab --list` to see available commands. """ from fabric.api import local, lcd, with_settings def test(): """Run project unit tests.""" local('python -m unittest discover -v -s tests') unittest = test @with_setting...
Python
0
609784dc106e01800eed0a7ccf88f82d6977d408
Add missed language update migrations
babybuddy/migrations/0008_auto_20200120_0622.py
babybuddy/migrations/0008_auto_20200120_0622.py
# Generated by Django 3.0.2 on 2020-01-20 14:22 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('babybuddy', '0007_auto_20190607_1422'), ] operations = [ migrations.AlterField( model_name='settings', name='languag...
Python
0
ce21eafe126407229ae81d926fccd311035eb7cc
Add local fnmatch module (from Python 2.6)
fnmatch.py
fnmatch.py
"""Filename matching with shell patterns. fnmatch(FILENAME, PATTERN) matches according to the local convention. fnmatchcase(FILENAME, PATTERN) always takes case in account. The functions operate by translating the pattern into a regular expression. They cache the compiled regular expressions for speed. The function...
Python
0
13a45b0b1ab811d6e0ba131380961fba59e8963c
Create w3_1.py
w3_1.py
w3_1.py
print("test")
Python
0.000482
5b456b6cdbd76b1e51548775ec0118a28db98ef2
add test-backend script
sample/RiceBookServer/test-backend.py
sample/RiceBookServer/test-backend.py
#!/usr/bin/env python import requests, json, sys, pprint pp = pprint.PrettyPrinter(indent=4) class cc: HEADER = '\033[95m' BLUE = '\033[94m' GREEN = '\033[92m' YELLOW = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' def get(endpoint): url = co...
Python
0.000001
ce344f340682f81837ae5b71e7c9e17e276c953d
Create nxn.py
nxn/nxn.py
nxn/nxn.py
N = int(input()) liste = [] for i in range(0,N): liste.append(list(map(int, input().split(" ")))) prisum = 0 secsum = 0 for i in range(0,N): prisum += liste[i][i] j = 0 for i in range(N-1,-1,-1): secsum += liste[i][j] j += 1 print(abs(prisum-secsum))
Python
0.000005
257bc9e6538d8320603b29465a02000646833805
Add a script to choose randomly from a list. I needed it to choose a random desktop background.
choose_random.py
choose_random.py
#!/usr/bin/env python3 import random import sys if __name__ == "__main__": options = list(sys.stdin) # list of lines of text print(random.choice(options), end='')
Python
0
271999dae2cd7f736b66c68f5e2454aac995a10d
Call `process()` from Python
embed.py
embed.py
from ctypes import cdll lib = cdll.LoadLibrary("target/release/libembed.dylib") lib.process()
Python
0.000004
8ba799bccb479c757070104649d60819e627b507
Add a search plugin for PtN
flexget/plugins/search_ptn.py
flexget/plugins/search_ptn.py
from __future__ import unicode_literals, division, absolute_import import logging from flexget import plugin from flexget.entry import Entry from flexget.event import event from flexget.utils import requests from flexget.utils.imdb import extract_id from flexget.utils.soup import get_soup from flexget.utils.search imp...
Python
0
9416747193dfd597bf15d855d4673cb5b16ce76e
Add python methods to handle api end-points
api/api.py
api/api.py
from connexion.resolver import RestyResolver from flask import current_app, request, abort, jsonify, g, url_for from flask_httpauth import HTTPAuth __all__ = ["login", "register", "add_bucket_list", "get_bucket_lists", "get_bucket_list","put_bucket_list","delete_bucket_list", "create_item_in_buck...
Python
0.000001
23d313aff58a34f44fc5addeffd015ac36b1c1be
Add a script that makes generating tests easier.
gentest.py
gentest.py
import os import re import subprocess import sys import threading # Note that PS2HOSTNAME is expected to be set in env. PS2CLIENT = "ps2client" MAKE = "make" TEST_ROOT = "tests/" TIMEOUT = 10 RECONNECT_TIMEOUT = 10 tests_to_generate = [ "cpu/ee/alu", "cpu/ee/branch", "cpu/ee/branchdelay", ] class Comman...
Python
0
b0dfbb63a306255bc08eae2e7dd9360ca56a366f
Add default value of access requests enabled to exsisting projects made before model added
osf/migrations/0100_set_access_request_enabled.py
osf/migrations/0100_set_access_request_enabled.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.11 on 2018-04-30 18:34 from __future__ import unicode_literals from django.db import migrations, models ,connection from osf.models import AbstractNode class Migration(migrations.Migration): dependencies = [ ('osf', '0099_merge_20180427_1109'), ] ...
Python
0
1c511dcc4156d68f84b97067433ca151f549df1b
Add test for protocol.
flowirc/tests/test_IRCClientProtocol.py
flowirc/tests/test_IRCClientProtocol.py
from unittest import TestCase from unittest.mock import Mock, patch, call, MagicMock from flowirc.client import IRCClientProtocol __author__ = 'olle.lundberg' class TestIRCClientProtocol(TestCase): def setUp(self): self.proto = IRCClientProtocol() self.transport = Mock() def tearDown(self):...
Python
0.000002
2af3b158f1bc4f528f3d4aa7efb8cd595caca0a5
Add dump/html add-on #69 (dump/html)
jumeaux/addons/dump/html.py
jumeaux/addons/dump/html.py
# -*- coding:utf-8 -*- from bs4 import BeautifulSoup from owlmixin import OwlMixin, TList from jumeaux.addons.dump import DumpExecutor from jumeaux.logger import Logger from jumeaux.models import DumpAddOnPayload logger: Logger = Logger(__name__) LOG_PREFIX = "[dump/html]" class Config(OwlMixin): default_encod...
Python
0
575fd05ace28ed392591228bfdb01f6e739eeff4
Create RobotMemory.py
RobotMemory.py
RobotMemory.py
#------------------------------------------------------------------------------- # Name: Robot Memory # Purpose: Stores memory about where robot has been # # Author: Liam McInory # # Created: 06/03/2014 # Copyright: (c) Liam 2014 # Licence: GNU #------------------------------------------------...
Python
0
5579100489031b941617a93baef398212db23d6e
Update openerp
__openerp__.py
__openerp__.py
{ 'name': "Gantt Improvement", 'author' : 'Stéphane Codazzi @ TeMPO-Consulting', 'category': 'Project', 'sequence': 1, 'description': """ Gantt Improvement ================= """, 'version': '0.3', 'depends': ['web', 'web_gantt'], 'js': [ 'static/src/js/gantt.js', 'sta...
{ 'name': "Gantt Improvement", 'author' : 'Stéphane Codazzi @ TeMPO-consulting', 'category': 'Project', 'sequence': 1, 'description': """ Gantt Improvement ================= """, 'version': '0.3', 'depends': ['web', 'web_gantt'], 'js': [ 'static/src/js/gantt.js', 'sta...
Python
0.000001
718c31a54ce1637ef1ce9d2969a055f621c6dc7f
add MPPT benchmark
src/CADRE/benchmark/benchmark_mppt.py
src/CADRE/benchmark/benchmark_mppt.py
""" Optimization of the CADRE MDP.""" import os import pickle import numpy as np from openmdao.components.indep_var_comp import IndepVarComp from openmdao.core.component import Component from openmdao.core.group import Group from openmdao.core.problem import Problem from openmdao.core.parallel_group import ParallelGro...
Python
0