commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
100e18cf2ce38637456baa093cb51d739370889b | Create __init__.py | odb9402/OPPA,odb9402/OPPA,odb9402/OPPA,odb9402/OPPA | pfc/__init__.py | pfc/__init__.py | """pfc"""
| mit | Python | |
5ca074148dea84a62e51ae99f919fd818637b319 | add deploy-tweak/kvm-hide.py | OpenNebula/addon-storpool,OpenNebula/addon-storpool,OpenNebula/addon-storpool | vmm/kvm/deploy-tweaks.d.example/kvm-hide.py | vmm/kvm/deploy-tweaks.d.example/kvm-hide.py | #!/usr/bin/env python
# -------------------------------------------------------------------------- #
# Copyright 2015-2020, StorPool (storpool.com) #
# #
# Licensed under the Apache License, Version 2.0 (the "Licen... | apache-2.0 | Python | |
e63e85868ed7b63bbe784368b3c1babf0d1f2088 | add tests for marker_regression/rqtl_mapping.py | genenetwork/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2 | wqflask/tests/wqflask/marker_regression/test_rqtl_mapping.py | wqflask/tests/wqflask/marker_regression/test_rqtl_mapping.py | import unittest
from unittest import mock
from wqflask import app
from wqflask.marker_regression.rqtl_mapping import get_trait_data_type
from wqflask.marker_regression.rqtl_mapping import sanitize_rqtl_phenotype
from wqflask.marker_regression.rqtl_mapping import sanitize_rqtl_names
class TestRqtlMapping(unittest.TestC... | agpl-3.0 | Python | |
27bb468f07693d31de7b2b356ebc3df4f954e024 | add prime factors code for Problem 3 | paradigm72/paradigm-euler | primeFactors.py | primeFactors.py | import math
def primeFactors(n):
listSize = int(math.sqrt(n)) + 1
nonPrimes = [0] * listSize
i = 2
while (i * i < n):
# if i is a known non-prime, nothing to do
if nonPrimes[i] == 1:
pass
# otherwise, i is a prime
else:
if (n % i == 0):
... | mit | Python | |
12f1694a03fc3eb05b50395852f36f2087d5a600 | Create cbalusek_03.py | GT-IDEaS/SkillsWorkshop2017,GT-IDEaS/SkillsWorkshop2017,GT-IDEaS/SkillsWorkshop2017 | Week01/Problem03/cbalusek_03.py | Week01/Problem03/cbalusek_03.py | import numpy as np
def isPrime(val):
factorList = [val]
if val <= 20000:
ints = set(range(2,val-1,1))
if val > 20000:
ints = set(range(3,int((val-1)/2),2))
for i in ints:
if val%i == 0 or val%2 == 0:
factorList.append(i)
return 0
break
if ... | bsd-3-clause | Python | |
42e4c4144249939e1ac0730d16c27c99bc561d51 | Add incomplete p1 solution with messed-up tests | robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions | 2015/python/2015-20.py | 2015/python/2015-20.py | def total_presents(house_number, presents_per_elf=10):
"""Calculate how many presents house_number should receive
Each house is visited by numbered elves which match the divisors of
house_number, and each elf delivers a quantity of presents that
match the elf’s number times by presents_per_elf.
For instance, g... | mit | Python | |
32c60ee3fc015093d65eb68d2b4bbf9a166234d4 | Add and update log_filter plugin for loguru. | Flexget/Flexget,Flexget/Flexget,crawln45/Flexget,crawln45/Flexget,Flexget/Flexget,crawln45/Flexget,Flexget/Flexget,crawln45/Flexget | flexget/plugins/operate/log_filter.py | flexget/plugins/operate/log_filter.py | from loguru import logger
from flexget import log, plugin
from flexget.event import event
logger = logger.bind(name='log_filter')
class MyFilter:
def __init__(self, config):
self.config = config
def __call__(self, record):
for plugin_name, filter_strings in self.config.items():
... | mit | Python | |
b5b5d88d90adbba2f6de0c050621fded683c2e63 | Update IDTools to latest versions | artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin | fpr/migrations/0023_update_idtools.py | fpr/migrations/0023_update_idtools.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def data_migration_up(apps, schema_editor):
"""Update identification tools FIDO and Siegfried to current
versions, allowing for integration of PRONOM 94.
"""
idtool = apps.get_model('fpr', 'IDTool')
... | agpl-3.0 | Python | |
b42850c5ef775c20502c6ac09fb252a91945afa7 | rename keyword | joongh/robotframework,synsun/robotframework,ChrisHirsch/robotframework,yahman72/robotframework,alexandrul-ci/robotframework,jorik041/robotframework,yahman72/robotframework,dkentw/robotframework,jaloren/robotframework,yahman72/robotframework,ChrisHirsch/robotframework,yonglehou/robotframework,suvarnaraju/robotframework,... | proto/atdd-tutorial-berlin-2010/atest/libraries/VacalcLibrary.py | proto/atdd-tutorial-berlin-2010/atest/libraries/VacalcLibrary.py | import datetime
from vacalc.employeestore import Employee
def calculate_vacation(startdate, vacation_year, exp_vacation_days):
try:
sdate = datetime.date(*(int(item) for item in startdate.split('-')))
except Exception, err:
raise AssertionError('Invalid time format %s' % err)
actual_days =... | import datetime
from vacalc.employeestore import Employee
def amount_of_vacation_should_be(startdate, vacation_year, exp_vacation_days):
try:
sdate = datetime.date(*(int(item) for item in startdate.split('-')))
except Exception, err:
raise AssertionError('Invalid time format %s' % err)
act... | apache-2.0 | Python |
0d7e1a1ad1d79511afe91bbd34bc2c200dbc1874 | add inspect_record example | williballenthin/python-ntfs,ohio813/python-ntfs | examples/inspect_record/inspect_record.py | examples/inspect_record/inspect_record.py | """
Dump stuff related to a single record.
"""
import logging
from ntfs.BinaryParser import Mmap
from ntfs.mft.MFT import MFTRecord
from ntfs.mft.MFT import Attribute
from ntfs.mft.MFT import ATTR_TYPE
from ntfs.mft.MFT import StandardInformation
from ntfs.mft.MFT import FilenameAttribute
g_logger = logging.getLogge... | apache-2.0 | Python | |
4448f88734a3fb631a02aeb9b84675575226845d | Add a matplotlib example (needs cffi) | lazka/pgi,lazka/pgi | examples/matplotlib/matplotlib_example.py | examples/matplotlib/matplotlib_example.py | # Copyright 2013 Christoph Reiter
#
# This library 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; either
# version 2.1 of the License, or (at your option) any later version.
import sys
sys.path.insert... | lgpl-2.1 | Python | |
cdcc678387d2a2b98a991dcb3bdbe98809f309ce | Add box log matplotlib script to create nice plots. | salkinium/bachelor,salkinium/bachelor,salkinium/bachelor | link_analysis/box_parser.py | link_analysis/box_parser.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Niklas Hauser
# All rights reserved.
#
# The file is part of my bachelor thesis and is released under the 3-clause BSD
# license. See the file `LICENSE` for the full license governing this code.
# -------------------------------------------------------... | bsd-2-clause | Python | |
58fa4f78398b8c26a89fbca122363e57fd6e7726 | Create py_crust_example.py | flailingsquirrel/cmake_scipy_ctypes_example,bthcode/cmake_scipy_ctypes_example,flailingsquirrel/cmake_scipy_ctypes_example,bthcode/cmake_scipy_ctypes_example,flailingsquirrel/cmake_scipy_ctypes_example,bthcode/cmake_scipy_ctypes_example | py_crust_example.py | py_crust_example.py | '''
Demonstrates how to get a python shell in a wx app
'''
import wx
from wx.py.crust import Shell
if __name__ == '__main__':
app = wx.App(0)
parent_frame = wx.Frame( None, title = 'Test Frame' )
pycrust_frame = wx.Frame( parent_frame, title='Type app to access variables' )
app.shell = Shell(pyc... | bsd-3-clause | Python | |
faa6a55f3c1288f91e95d6189d0c6b31b0866317 | Add factorial methods. | doggan/code-dump,doggan/code-dump,doggan/code-dump,doggan/code-dump,doggan/code-dump,doggan/code-dump,doggan/code-dump,doggan/code-dump | random/factorial.py | random/factorial.py | def factorial(n):
if n == 0: return 1
return n * factorial(n - 1)
def factorial_it(n):
result = 1
for i in xrange(1, n):
result *= (i + 1)
return result
count = 10
print "Recursive factorial:"
for i in xrange(0, count):
print "{}! = {}".format(i, factorial(i))
print "Iterative factor... | unlicense | Python | |
bd83be34cfd564bb3418ab90f4692294bd004d0f | Add Practica dummy 2 | AnhellO/DAS_Sistemas,AnhellO/DAS_Sistemas,AnhellO/DAS_Sistemas | Ene-Jun-2021/flores-fernandez-fernando/Practica2.py | Ene-Jun-2021/flores-fernandez-fernando/Practica2.py | print("hola Practica 2") | mit | Python | |
b4c68504e9ac49d9cb7a9813370fd433aa32babb | add shingles jaccard | Falinor/seo-cartographer | cartodup/jaccard.py | cartodup/jaccard.py | #! /usr/bin/env python3
import re
def get_shingles(f, size):
buf = f.read() # Read the whole file
regexp = r'[!@#$%^&*()_+-=,<`~.>/?\[{\]};:\'"\\|§±]'
buf = re.sub(regexp, '', buf) # Remove special chars
buf = buf.split() # Split words using white spaces
for i in range(0, len(buf) - size + 1):... | mit | Python | |
1db685166b5c61d6b887afa11b1e636d5b752b67 | Add tests for settings check performed at GMN startup | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | gmn/src/d1_gmn/tests/test_settings.py | gmn/src/d1_gmn/tests/test_settings.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2016 DataONE
#
# Licensed under the Apache... | apache-2.0 | Python | |
b20f198901add8e40d24710b1209210a37967f55 | Add migration | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | fat/migrations/0075_auto_20160818_1415.py | fat/migrations/0075_auto_20160818_1415.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-18 14:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fat', '0074_claimed_slug'),
]
operations = [
migrations.AlterField(
... | bsd-3-clause | Python | |
8d9eae677ef81ba3dcb000e528985276a920ef05 | Add some tests for the new validation logic | leviroth/bernard | test/test_loader.py | test/test_loader.py | from .helper import BJOTest
from bernard.actors import Locker, Notifier
from bernard.loader import YAMLLoader
from praw.models import Comment, Submission
class TestValidation(BJOTest):
def setUp(self):
super().setUp()
self.loader = YAMLLoader(self.db, self.cur, self.subreddit)
def test_bad_pa... | mit | Python | |
d727758e3db52327e7326b5f8546ecde06d409e7 | Add test cases for the logger | thombashi/DataProperty | test/test_logger.py | test/test_logger.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import print_function
from __future__ import unicode_literals
from dataproperty import (
set_logger,
set_log_level,
)
import logbook
import pytest
class Test_set_logger(object):
@pytest.mark.param... | mit | Python | |
e2781eb0450cbcf25d7c8ca293a238f0d8ae4c0d | Add migration for ticket | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0099_update_program_model.py | accelerator/migrations/0099_update_program_model.py | # Generated by Django 2.2.28 on 2022-04-20 13:05
from django.db import (
migrations,
models,
)
class Migration(migrations.Migration):
dependencies = [
('accelerator', '0098_update_startup_update_20220408_0441'),
]
operations = [
migrations.AddField(
model_name='prog... | mit | Python | |
b1f00f2c93afc814efef4993bae67b7bdca3dbab | Add basic test suite | adambrenecki/vc2xlsx | test_cell_parser.py | test_cell_parser.py | import parser
def do_test(inv, outv):
try:
tree = parser.parse(inv)
actual_output = tree.excel()
except Exception as e:
print("ERROR")
print(e)
else:
if actual_output != outv:
print("FAIL")
print("Input : {}".format(inv))
... | agpl-3.0 | Python | |
15f6d50dd438d3a0a2559f576cd4f6636b7a5efb | add dir python | jiedou/jix,jiedou/jix,jiedou/jix,jiedou/jix | python/decorate.py | python/decorate.py | import os
def f():
print("hello,world")
if __name__=="__main__":
f()
| apache-2.0 | Python | |
d85fe0b7b5f852bf770aa412c42418a432ca949a | Integrate simulatorref. | iamkingmaker/zipline,nborggren/zipline,umuzungu/zipline,StratsOn/zipline,chrjxj/zipline,CarterBain/AlephNull,YuepengGuo/zipline,cmorgan/zipline,wilsonkichoi/zipline,morrisonwudi/zipline,zhoulingjun/zipline,StratsOn/zipline,mattcaldwell/zipline,davidastephens/zipline,ronalcc/zipline,sketchytechky/zipline,gwulfs/zipline,... | zipline/core/simulatorref.py | zipline/core/simulatorref.py | """
The reference simulator for all of Quantopian infastructure.
If a subclass does not conform to the API it will fail at
compiletime.
Subclasses:
- (partial) zipline.devsimulator.Simulator
- ( full ) qexec.executor.simulator.ProcessSimulator
- ( full ) qexec.executor.simulator.ThreadSimulator
- ( ... | apache-2.0 | Python | |
e30cc7acf88f5b902403e1f960a15b3e552cf4e0 | Add alg_strongly_connected_graph.py | bowen0701/algorithms_data_structures | alg_strongly_connected_graph.py | alg_strongly_connected_graph.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def strongly_connected_graph():
pass
def main():
pass
if __name__ == '__main__':
main()
| bsd-2-clause | Python | |
7b6fd3b24db92fa095792377fe0a3da7b0b76d50 | Write migration for rating ceilings and floors; #1021 | DMOJ/site,DMOJ/site,DMOJ/site,DMOJ/site | judge/migrations/0086_rating_ceiling.py | judge/migrations/0086_rating_ceiling.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-06-20 16:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0085_submission_source'),
]
operations = [
migrations.AddField(
... | agpl-3.0 | Python | |
89a37930cfe576932b4b29c2ed2bf1b110cfa8aa | Add SDA serializers | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | radar/radar/sda.py | radar/radar/sda.py | from radar.serializers.core import Serializer
from radar.serializers.fields import StringField, DateTimeField, ListField, FloatField
class CodeSerializer(Serializer):
code = StringField()
description = StringField()
class OrganizationCodeSerializer(CodeSerializer):
pass
class GenderCodeSerializer(Code... | agpl-3.0 | Python | |
0200c03f8f6232965f924a765c5ebb0f9c439f4d | Add email field to sample app. | vishnugonela/flask-bootstrap,BeardedSteve/flask-bootstrap,livepy/flask-bootstrap,suvorom/flask-bootstrap,vishnugonela/flask-bootstrap,JingZhou0404/flask-bootstrap,vishnugonela/flask-bootstrap,BeardedSteve/flask-bootstrap,suvorom/flask-bootstrap,eshijia/flask-bootstrap,JingZhou0404/flask-bootstrap,moha24/flask-bootstrap... | sample_app/forms.py | sample_app/forms.py | from flask_wtf import Form
from wtforms.fields import (TextField, SubmitField, BooleanField, DateField,
DateTimeField)
from wtforms.validators import Required, Email
class SignupForm(Form):
name = TextField(u'Your name', validators=[Required()])
email = TextField(u'Your email addre... | from flask_wtf import Form
from wtforms.fields import (TextField, SubmitField, BooleanField, DateField,
DateTimeField)
from wtforms.validators import Required
class SignupForm(Form):
name = TextField(u'Your name', validators=[Required()])
birthday = DateField(u'Your birthday')
... | apache-2.0 | Python |
8ec68754c9154a4e1f5822ef36a9839e11bf8115 | Add basic gstreamer stub | kingosticks/mopidy,jmarsik/mopidy,mopidy/mopidy,diandiankan/mopidy,diandiankan/mopidy,jodal/mopidy,adamcik/mopidy,swak/mopidy,swak/mopidy,bacontext/mopidy,rawdlite/mopidy,hkariti/mopidy,vrs01/mopidy,tkem/mopidy,ali/mopidy,jmarsik/mopidy,mopidy/mopidy,hkariti/mopidy,tkem/mopidy,pacificIT/mopidy,mokieyue/mopidy,ZenithDK/... | mopidy/backends/gstreamer.py | mopidy/backends/gstreamer.py | import logging
from mopidy import config
from mopidy.backends import BaseBackend
from mopidy.models import Artist, Album, Track, Playlist
logger = logging.getLogger(u'backends.gstreamer')
class GStreamerBackend(BaseBackend):
pass
| apache-2.0 | Python | |
f9011915707dfd0fa10e8c4c488dcfe5455b82e9 | add migration for AdminBoundary new `in_country` field | pulilab/rapidpro,tsotetsi/textily-web,pulilab/rapidpro,pulilab/rapidpro,tsotetsi/textily-web,ewheeler/rapidpro,ewheeler/rapidpro,pulilab/rapidpro,tsotetsi/textily-web,ewheeler/rapidpro,tsotetsi/textily-web,pulilab/rapidpro,tsotetsi/textily-web,ewheeler/rapidpro | temba/locations/migrations/0003_adminboundary_in_country.py | temba/locations/migrations/0003_adminboundary_in_country.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('locations', '0002_auto_20141126_2054'),
]
operations = [
migrations.AddField(
model_name='adminboundary',
... | agpl-3.0 | Python | |
e97649a29a10ecc06eaa33b0898b2c22368e7102 | Add python file with a list of simulation files. | Baaaaam/cycamore,rwcarlsen/cycamore,Baaaaam/cyBaM,gonuke/cycamore,rwcarlsen/cycamore,gonuke/cycamore,cyclus/cycaless,Baaaaam/cyBaM,Baaaaam/cyCLASS,rwcarlsen/cycamore,Baaaaam/cyBaM,Baaaaam/cycamore,rwcarlsen/cycamore,gonuke/cycamore,Baaaaam/cyCLASS,jlittell/cycamore,Baaaaam/cyBaM,jlittell/cycamore,jlittell/cycamore,gonu... | tests/tests_list.py | tests/tests_list.py |
#List of input files and reference databases
sim_files = [("./inputs/physor/1_Enrichment_2_Reactor.xml", "./benchmarks/physor_1_Enrichment_2_Reactor.h5"),
("./inputs/physor/2_Sources_3_Reactors.xml", "./benchmarks/physor_2_Sources_3_Reactors.h5")]
| bsd-3-clause | Python | |
48ffb08670b6665f796e0e2a7a1c32441e0553c0 | Implement `Approx` validator | skylines-project/skylines,skylines-project/skylines,skylines-project/skylines,skylines-project/skylines | tests/voluptuous.py | tests/voluptuous.py | from __future__ import absolute_import
import math
from voluptuous.validators import Range
class Approx(Range):
"""
Similar to the ``approx()`` implementation in pytest
"""
DEFAULT_ABSOLUTE_TOLERANCE = 1e-12
DEFAULT_RELATIVE_TOLERANCE = 1e-6
def __init__(self, expected, abs=None, rel=None,... | agpl-3.0 | Python | |
d0c88b396bc7f52a6fd45c43b09de3d9f3902bca | add (backported) make_template_fragment_key | puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq | dimagi/utils/django/cache.py | dimagi/utils/django/cache.py | from django.utils.hashcompat import md5_constructor
from django.utils.http import urlquote
def make_template_fragment_key(fragment_name, vary_on):
# Build a unicode key for this fragment and all vary-on's.
args = md5_constructor(u':'.join([urlquote(var) for var in vary_on]))
cache_key = 'template.cache.%s... | bsd-3-clause | Python | |
334cbe6c7c431e5237d56c60298d05ca907f38cc | add miniature | TUS-OSK/Desire-AI | Prototype-4/main.py | Prototype-4/main.py | #! /usr/bin/python
class Main:
def start(self):
print 'start'
if __name__ == "__main__":
main = Main()
main.start()
| apache-2.0 | Python | |
9340b67f01dd5915c6577e2eebb639aa8d4ee234 | create simplest scene-based 3D point cloud example. Closes #1028 | sbtlaarzc/vispy,ghisvail/vispy,dchilds7/Deysha-Star-Formation,inclement/vispy,drufat/vispy,kkuunnddaannkk/vispy,jdreaver/vispy,ghisvail/vispy,jay3sh/vispy,julienr/vispy,julienr/vispy,michaelaye/vispy,kkuunnddaannkk/vispy,bollu/vispy,sbtlaarzc/vispy,bollu/vispy,dchilds7/Deysha-Star-Formation,michaelaye/vispy,inclement/v... | examples/basics/scene/point_cloud.py | examples/basics/scene/point_cloud.py | # -*- coding: utf-8 -*-
# vispy: gallery 10
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
""" Demonstrates use of visual.Markers to create a point cloud with a
standard turntable camera to fly around with and a centered 3D Axis.
"""
import nump... | bsd-3-clause | Python | |
8ce21d0d060fcaaea192f002d12c79101f4bc1a2 | Add management command to migrate programs | dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq | corehq/apps/commtrack/management/commands/fix_default_program.py | corehq/apps/commtrack/management/commands/fix_default_program.py | from django.core.management.base import BaseCommand
from corehq.apps.commtrack.models import Program
from corehq.apps.domain.models import Domain
from corehq.apps.commtrack.util import get_or_create_default_program
class Command(BaseCommand):
help = 'Populate default program flag for domains'
def handle(self... | bsd-3-clause | Python | |
a163b679e57ca716c75490e56d2ef5e759d4842e | add reorient workflow | poldracklab/niworkflows,oesteban/niworkflows,oesteban/niworkflows,oesteban/niworkflows,poldracklab/niworkflows | niworkflows/common/orient.py | niworkflows/common/orient.py | # -*- coding: utf-8 -*-
# @Author: oesteban
# @Date: 2016-07-21 14:11:03
# @Last Modified by: oesteban
# @Last Modified time: 2016-07-21 14:13:09
from nipype.pipeline import engine as pe
from nipype.interfaces import utility as niu
from nipype.interfaces.afni import preprocess as afp
def reorient_wf(name='Reorient... | apache-2.0 | Python | |
94f70fe821e6ce1b2fb3b294e1d158536d6bc3fa | Add a module docstring. | enthought/distarray,RaoUmer/distarray,enthought/distarray,RaoUmer/distarray | distarray/tests/ipcluster.py | distarray/tests/ipcluster.py | """
Simple runner for `ipcluster start` or `ipcluster stop` on Python 2 or 3, as
appropriate.
"""
import sys
import six
from subprocess import Popen, PIPE
if six.PY2:
ipcluster_cmd = 'ipcluster'
elif six.PY3:
ipcluster_cmd = 'ipcluster3'
else:
raise NotImplementedError("Not run with Python 2 *or* 3?")
... | import sys
import six
from subprocess import Popen, PIPE
if six.PY2:
ipcluster_cmd = 'ipcluster'
elif six.PY3:
ipcluster_cmd = 'ipcluster3'
else:
raise NotImplementedError("Not run with Python 2 *or* 3?")
def start(n=12):
"""Convenient way to start an ipcluster for testing.
You have to wait for... | bsd-3-clause | Python |
6e27f852fcef8c0131bc7cde790eefaa6b08539c | Add support for box.net | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org | services/box.py | services/box.py | import flask
import requests
import urllib
from xml.dom import minidom
import foauth.providers
class Box(foauth.providers.OAuth1):
# General info about the provider
name = 'Box'
provider_url = 'https://www.box.com/'
docs_url = 'http://developers.box.com/docs/'
category = 'Files'
# URLs to in... | bsd-3-clause | Python | |
9809d70db04d77bc40d819a6172adafe63d7e3a4 | create mapper script | NoRedInk/open-source-mapper | mapper.py | mapper.py | import requests
import json
def main(org):
url = "https://api.github.com/orgs/{org}/repos?page=".format(org=org)
i = 1
repos = []
while True:
r = requests.get(url + str(i))
current_repos = r.json()
if not current_repos:
break
repos.extend(current_repos)
... | bsd-3-clause | Python | |
c603f8e43ee26eb05914584e45a81f2193343812 | add missing migration | DemocracyClub/EveryElection,DemocracyClub/EveryElection,DemocracyClub/EveryElection | every_election/apps/elections/migrations/0027_auto_20170415_1308.py | every_election/apps/elections/migrations/0027_auto_20170415_1308.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-04-15 13:08
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('elections', '0026_set_default_voting_system'),
]
operations = [
migrations.AlterMod... | bsd-3-clause | Python | |
33b7bbfc455d177d012ba6408816f47a570a7b5f | Add required files hook (work in progress) | MarkUsProject/Markus,benjaminvialle/Markus,MarkUsProject/Markus,MarkUsProject/Markus,benjaminvialle/Markus,MarkUsProject/Markus,MarkUsProject/Markus,MarkUsProject/Markus,benjaminvialle/Markus,benjaminvialle/Markus,benjaminvialle/Markus,MarkUsProject/Markus,benjaminvialle/Markus,MarkUsProject/Markus,benjaminvialle/Marku... | lib/repo/git_hooks/update.d/03-check_required_files_master.py | lib/repo/git_hooks/update.d/03-check_required_files_master.py | #!/usr/bin/env python3
import json
import os
import sys
import subprocess
if __name__ == '__main__':
ref_name = sys.argv[1]
old_commit = sys.argv[2]
new_commit = sys.argv[3]
# no need to check if old_commit or new_commit are 0, master can't be deleted or created
if ref_name == 'refs/heads/master'... | mit | Python | |
f8823ea09346aab39a4c77c4c7b5128ed83bd70a | Create Perm2_003.py | cc13ny/algo,cc13ny/Allin,Chasego/cod,cc13ny/Allin,cc13ny/algo,cc13ny/Allin,Chasego/codi,cc13ny/algo,Chasego/cod,Chasego/codi,Chasego/codirit,Chasego/codirit,Chasego/codi,Chasego/codirit,Chasego/cod,Chasego/codi,Chasego/cod,Chasego/codirit,Chasego/cod,Chasego/codirit,cc13ny/Allin,Chasego/codi,cc13ny/algo,cc13ny/algo,cc1... | leetcode/047-Permutations-II/Perm2_003.py | leetcode/047-Permutations-II/Perm2_003.py | class Solution:
# @param {integer[]} nums
# @return {integer[][]}
def permuteUnique(self, nums):
if len(nums) == 1:
return [nums]
nums.sort()
res = []
i = 0
while i < len(nums):
sym = nums[i]
tmp = nums[:i] + nums[i+1:]
... | mit | Python | |
8737ba55a89a113e8880e058fede6c1bbc00290e | Create SimpleRSA.py | ragulbalaji/Random-Cool-Things,ragulbalaji/Random-Cool-Things,ragulbalaji/Random-Cool-Things,ragulbalaji/Random-Cool-Things | toSort/SimpleRSA.py | toSort/SimpleRSA.py | import math
vars = {}
plain = ""
cipher = ""
def makeKeys():
vars['p'] = int(input("Prime P? "))
vars['q'] = int(input("Prime Q? "))
vars['n'] = vars['p'] * vars['q']
vars['z'] = (vars['p'] - 1)*(vars['p'] - 1)
for k in range(2,int(math.floor(math.sqrt(vars['z'])))):
... | mit | Python | |
48454a8e6b5b86f80e89eca1b396480df8960cfd | Create balanced_binary_tree.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | lintcode/easy/balanced_binary_tree/py/balanced_binary_tree.py | lintcode/easy/balanced_binary_tree/py/balanced_binary_tree.py | # Slow. Horrible. Ugly. Don't try this at home.
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
@staticmethod
def computeHeight(root, curHeight=0):
if root == None:
return curHeigh... | mit | Python | |
a5dddd4d118abbe3bd320b4af8fcdebf462109bc | Add outlineOTF_test.py with tests for gasp | googlei18n/ufo2ft,moyogo/ufo2ft,jamesgk/ufo2ft,jamesgk/ufo2fdk,googlefonts/ufo2ft | Lib/ufo2ft/outlineOTF_test.py | Lib/ufo2ft/outlineOTF_test.py | from fontTools.ttLib import TTFont
from defcon import Font
from ufo2ft.outlineOTF import OutlineTTFCompiler
import unittest
import os
def getTestUFO():
dirname = os.path.dirname(__file__)
return Font(os.path.join(dirname, 'testdata', 'TestFont.ufo'))
class TestOutlineTTCompiler(unittest.TestCase):
def ... | mit | Python | |
c308b3ef8a039773ca8152d46d5bdd5392adbc5d | Create stats.py | diekmann/useless_playground_shame,diekmann/useless_playground_shame | win_dns_monitor/stats.py | win_dns_monitor/stats.py | filename = "....txt"
import os
if not os.path.isfile(filename):
print("Error: file not found")
import sys
sys.exit(-1)
print("evaluating file {}".format(filename))
from collections import defaultdict
s = defaultdict(int)
with open(filename, mode='r', encoding='utf-8') as f:
for l in f:
l = l.strip()
tmp = l.sp... | apache-2.0 | Python | |
dbd6e910579a2f0f0ade0c00dacdc331aa818326 | add some channel control command | hellolintong/LinDouFm,hellolintong/LinDouFm,DouFM/wang_fm,DouFM/wang_fm | manager.py | manager.py | #!/usr/bin/env python
#coding:utf8
import random
import datetime
from apscheduler.scheduler import Scheduler
from flask.ext.script import Manager
from fm import app
from model.user import add_user
from spider.douban import login, update_channel_list, update_music_by_channel
from model.channel import get_channel, updat... | #!/usr/bin/env python
#coding:utf8
from apscheduler.scheduler import Scheduler
from flask.ext.script import Manager
from fm import app
from model.user import add_user
from spider.douban import login, update_channel_list, update_music_by_channel
from model.channel import get_channel, update_channel
from tasks.spider_ta... | mit | Python |
6c9b0b50cc9f9ab0f7a1b75f7a846ab0907a9b65 | Add models.py | EthereumWebhooks/blockhooks,EthereumWebhooks/blockhooks,EthereumWebhooks/blockhooks | models.py | models.py | from google.appengine.ext import ndb
class Hook(ndb.Model):
address = ndb.BlobProperty(indexed=True) # Address of the contract sending the event
topic0 = ndb.BlobProperty(indexed=True, required=True) # First log topic, usually event ID
topics = ndb.BlobProperty(indexed=False, repeated=True... | apache-2.0 | Python | |
04e2b0c10571419d7afebf5ef34040d11c5a94ca | Add rostensorlow node | OTL/rostensorflow | rostensorflow.py | rostensorflow.py | import rospy
from sensor_msgs.msg import Image
from std_msgs.msg import String
from cv_bridge import CvBridge, CvBridgeError
import cv2
import numpy as np
import tensorflow as tf
import classify_image
class RosTensorFlow():
def __init__(self):
classify_image.maybe_download_and_extract()
self._sub ... | apache-2.0 | Python | |
f95206313d7004f027334cb964aae3b139d745be | add fibonacci | YcheLanguageStudio/PythonStudy | bioinformatics/dynamic_programming/fibonacci.py | bioinformatics/dynamic_programming/fibonacci.py | import numpy as np
def yche_matrix_pow(a, b):
if b == 1:
return a
else:
return np.dot(yche_matrix_pow(a, b / 2), yche_matrix_pow(a, (b + 1) / 2))
def fib(n):
primitive_matrix = np.matrix([[1, 1], [1, 0]])
if n < 2:
return n
else:
return yche_matrix_pow(primitive_m... | mit | Python | |
5e24a11595607ac136c9b7d77c58a0e4d40177e8 | Use update_search in reindex_elasticsearch for better code reuse | davidfischer/readthedocs.org,techtonik/readthedocs.org,wijerasa/readthedocs.org,istresearch/readthedocs.org,tddv/readthedocs.org,istresearch/readthedocs.org,wijerasa/readthedocs.org,rtfd/readthedocs.org,SteveViss/readthedocs.org,davidfischer/readthedocs.org,stevepiercy/readthedocs.org,espdev/readthedocs.org,pombredanne... | readthedocs/core/management/commands/reindex_elasticsearch.py | readthedocs/core/management/commands/reindex_elasticsearch.py | import logging
from optparse import make_option
from django.core.management.base import BaseCommand
from django.core.management.base import CommandError
from django.conf import settings
from readthedocs.builds.constants import LATEST
from readthedocs.builds.models import Version
from readthedocs.projects.tasks import... | import logging
from optparse import make_option
from django.core.management.base import BaseCommand
from django.core.management.base import CommandError
from django.conf import settings
from readthedocs.builds.constants import LATEST
from readthedocs.builds.models import Version
from readthedocs.search import parse_j... | mit | Python |
688f61915e0d190866372f923b71b19a891ce777 | Create EUConverter.py | Xoin/Europa-Engine-Shield-Converter | EUConverter.py | EUConverter.py | import Image
import argparse
import sys
parser = argparse.ArgumentParser()
parser.add_argument("-t", dest='type', help="Type of shield to use, HOI2 DH Biger V, defaults to HOI2")
parser.add_argument("-f", dest='file', help="File to use, automaically resizes, recommended to use a 70 by 44 px file for best quality")
par... | mit | Python | |
9c2efc9718714176a3b40b86b40d10ec1c73214a | Fix install | terbolous/cloudstack-ec2stack,terbolous/cloudstack-ec2stack,apache/cloudstack-ec2stack,apache/cloudstack-ec2stack | ec2stack/configure.py | ec2stack/configure.py | #!/usr/bin/env python
# encoding: utf-8
import os
from alembic import command
from alembic.config import Config as AlembicConfig
def main():
config_folder = _create_config_folder()
_create_config_file(config_folder)
_create_database()
def _create_config_folder():
config_folder = os.path.join(os.pa... | apache-2.0 | Python | |
2a7796e6616df32614f8f01dc2997323b18763c4 | Add end-to-end tests | sgammon/codeclimate-protobuf,sgammon/codeclimate-protobuf | protolint_tests/test_run.py | protolint_tests/test_run.py | # -*- coding: utf-8 -*-
"""
testsuite: runner
~~~~~~~~~~~~~~~~~
"""
import unittest
import sys
import protolint
from .base import switchout_streams, restore_streams
class RunnerTests(unittest.TestCase):
""" Test the entire `protolint` package. """
def test_run_linter(self):
""" test a full run of ... | mit | Python | |
bed4b42ed598979f8d5cb13e41dfd396bc9eb2ca | Create motornodecontrol.py | ccc395/Robotics,ccc395/Robotics,ccc395/Robotics | catkin_ws/src/added_control/motornodecontrol.py | catkin_ws/src/added_control/motornodecontrol.py | #!/usr/bin/python
# This is a ROS node designed to command the motors of KHAN and read the corresponding encoder data
# Author: Chris Corbett <ccc395@vt.edu>
# Imports
#commented out unecessary imports since we are not implementing encoder
import rospy
from sensor_msgs.msg import JointState
#from std_msgs.msg import S... | bsd-3-clause | Python | |
90c2462794afd1b299ec6bca804a42094e437c0e | Add library for parsing airports data. | dustappeal/cloud-cities,dustappeal/cloud-cities | src/airports.py | src/airports.py | import csv
# columns from http://openflights.org/data.html
columns = ["Airport ID", "Name", "City", "Country", "IATA/FAA", "ICAO",
"Latitude", "Longitude", "Altitude", " Timezone", "DST",
"Tz database time zone"]
def read(filename):
airports = {}
population = 0
skipped = 0
with open(fi... | mit | Python | |
e86d90726b16af863b42a3d046f0016895f77942 | Create pycrack.py | rashidx/PyBrute | pycrack.py | pycrack.py | '''
This was written for educational purposes only.
Make sure you have written permission before using it on any web application.
This script is licensed under the MIT license.
If you would like to make this script better https://github.com/rashidx/PyCrack
''
import urllib
import urllib2
def welcome_msg():
prin... | mit | Python | |
3928bf5e35715f41839a19377c937d04cb0043af | Create JavaDropper.py | kevthehermit/RATDecoders | JavaDropper.py | JavaDropper.py | #!/usr/bin/env python
'''
Java Payload Extractor Decoder
'''
__description__ = 'Java Payload Extractor'
__author__ = 'Kevin Breen http://techanarchy.net http://malwareconfig.com'
__version__ = '0.1'
__date__ = '2015/03/03'
#Standard Imports Go Here
import os
import re
import sys
import string
import hashlib
from optpa... | mit | Python | |
39d0e4017ac63f721488f4f9a5e416a7398574af | Create model.py | madd-games/apocalypse,madd-games/apocalypse,madd-games/apocalypse,madd-games/apocalypse,madd-games/apocalypse | scripts/model.py | scripts/model.py | # model.py
| bsd-2-clause | Python | |
39c51a1eb7c5073997942bd6fde7cfbf5a79945b | Add global parameters. | benigls/spam,benigls/spam | params.py | params.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
DATASET_PATH = 'enron_dataset'
DATASET_SUBDIRS = [
'enron1',
'enron2',
'enron3',
'enron4',
'enron5',
'enron6',
]
| mit | Python | |
dd9eaaabff73d863ff59914d377522e61f922d18 | add migration | praekelt/molo-gem,praekelt/molo-gem,praekelt/molo-gem | gem/migrations/0028_oidc_settings.py | gem/migrations/0028_oidc_settings.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-05-24 12:20
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', ... | bsd-2-clause | Python | |
642dfbf0ba14f8ec1faf73f08a0479fc62494c4b | check in ghetto schema copy-pasted from google docs | sachdevs/rmc,MichalKononenko/rmc,JGulbronson/rmc,shakilkanji/rmc,duaayousif/rmc,rageandqq/rmc,MichalKononenko/rmc,sachdevs/rmc,rageandqq/rmc,ccqi/rmc,rageandqq/rmc,MichalKononenko/rmc,shakilkanji/rmc,rageandqq/rmc,duaayousif/rmc,MichalKononenko/rmc,UWFlow/rmc,sachdevs/rmc,JGulbronson/rmc,sachdevs/rmc,JGulbronson/rmc,UW... | server/schema.py | server/schema.py | """Really really ghetto rough schema definition checked in locally so we don't need to depend on Google Docs.
"""
# TODO(david): Use an ORM or define this in some real format that can be used
# by automated tools or w/e... I'm a mongo noob
"""
users
- implicit ObjectId
- first_name
- last_name
- fb_access_token
-... | mit | Python | |
a9c27728868f25c63d2742b272d16e01fdb09132 | Add initial vehicle detector | shawpan/vehicle-detector | vehicle_detector.py | vehicle_detector.py | class VehicleDetector:
""" Vehicle Detector class
"""
def process_image(self):
pass
| mit | Python | |
973359140a28966040a3f07ffd7862070079b176 | Create 1001_shifted_food.py | boisvert42/npr-puzzle-python | 2017/1001_shifted_food.py | 2017/1001_shifted_food.py | #!/usr/bin/env python
"""
NPR 2017-10-01
http://www.npr.org/2017/10/01/554491213/sunday-puzzle-put-these-stars-on-the-map
Think of a 4-letter food. Move each letter one space later in the alphabet —
so A would become B, B would become C, etc. Insert a U somewhere inside the result.
You'll name a 5-letter food. What... | cc0-1.0 | Python | |
2c9960bbddd53f5f7528952bb6a6f0f1edab08bb | Add files via upload | MDMoll/ModernizeRu | ModernizeRU.py | ModernizeRU.py | import re
with open("file.txt", encoding="utf-8", mode="rt") as infile:
text = infile.read()
words = text.split()
#original = text.split()
original = set(words)
newdict = {'Ѳ': 'Ф', 'ѳ': 'ф', 'І': 'И', 'і': 'и', 'Ѣ': 'Е', 'ѣ': 'е', 'Ъ': '', 'ъ': '', 'Мѣр': 'Мир', 'мѣр': 'мир',
'без': 'бес', 'вз': 'вс', '... | mit | Python | |
a5da5eda3e14f8fdb3afe3cdfcccecd335b27fa7 | Create php2py.py | wannaphongcom/code-python3-blog | php2py.py | php2py.py | # อ่านบทความ https://python3.wannaphong.com/2016/07/หลักการแปลงโค้ด-php-มา-python.html
# python แปลงตัวเลข(ค่าเงิน)ให้เป็นคำอ่านภาษาไทย
import math
def number_format(num, places=0):
return '{:20,.2f}'.format(num)
# fork by http://justmindthought.blogspot.com/2012/12/code-php.html
def ThaiBahtConversion(amount_numbe... | mit | Python | |
a4fb5b8f6175589792fa97d33cd8df7f2999a719 | Add numpy sample | yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program,yukihirai0505/tutorial-program | python/ch01/numpy_sample.py | python/ch01/numpy_sample.py | # numpy <- it is useful to calculate array and matrix
import numpy as np
x = np.array([1.0, 2.0, 3.0])
print(x / 2.0) | mit | Python | |
1f8ef97b88424e724f166c43b8fbd008558e4881 | Add test_internal.py. | cjerdonek/open-rcv,cjerdonek/open-rcv | openrcv/test/formats/test_internal.py | openrcv/test/formats/test_internal.py |
from openrcv.formats.internal import to_internal_ballot
from openrcv.utiltest.helpers import UnitCase
class InternalModuleTest(UnitCase):
def test_to_internal_ballot(self):
cases = [
((1, (2, )), "1 2"),
((1, (2, 3)), "1 2 3"),
((1, ()), "1"),
]
for ba... | mit | Python | |
d51193a1f287100a22adcd8dcc4e911ecbd7e7c2 | test operations | mapbox/rio-color | tests/test_operations.py | tests/test_operations.py | import pytest
import numpy as np
from rio_color.utils import to_math_type
from rio_color.operations import (
sigmoidal, gamma, saturation,
rgb2lch, lch2rgb, simple_atmo, parse_operations)
@pytest.fixture
def arr():
return to_math_type(np.array([
# red
[[1, 2],
[3, 4]],
... | mit | Python | |
060b9f089bbcef23ade49297f59ea7b56ae7aa66 | Create 121_buy_sell_stock.py | jsingh41/algos | 121_buy_sell_stock.py | 121_buy_sell_stock.py | """
https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/
121. Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), desi... | mit | Python | |
870ea23aaaa38a603b4857c2253cf07af6d747a3 | Create wordcloud with Chinese | amueller/word_cloud | examples/ChineseWordCloud.py | examples/ChineseWordCloud.py | # - * - coding: utf - 8 -*-
"""
Wordcloud with chinese
=======================
Wordcloud is a very good tools, but if you want to create
Chinese wordcloud only wordcloud is not enough. The file
shows how to use wordcloud with Chinese. First, you need a
Chinese word segmentation library jieba, jieba is now the
most ele... | mit | Python | |
833fd75ae8f4e9cf9c92af01f4b494910a351077 | Create __init__.py | bigdig/vnpy,bigdig/vnpy,bigdig/vnpy,vnpy/vnpy,vnpy/vnpy,bigdig/vnpy | vnpy/api/xtp/__init__.py | vnpy/api/xtp/__init__.py | from .vnxtpmd import MdApi
from .vnxtptd import TdApi
from .xtp_constant import * | mit | Python | |
526355c263bf7d2834fd8591c9e6337dded038ba | Add test utils module with run_parameter_smoke_tests function | uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged | csunplugged/tests/resources/generators/utils.py | csunplugged/tests/resources/generators/utils.py | import sys
from resources.utils.resource_parameters import (
EnumResourceParameter,
TextResourceParameter,
IntegerResourceParameter,
BoolResourceParameter,
)
def run_parameter_smoke_tests(generator, option_name):
option = generator.options[option_name]
if isinstance(option, EnumResourceParamet... | mit | Python | |
d41d70891fb73b5b84755ad4b9f6f8f7540c66b8 | add oaspectrum deployment Fabric script | CottageLabs/sysadmin,CottageLabs/sysadmin | fabric/oaspectrum/fabfile.py | fabric/oaspectrum/fabfile.py | from fabric.api import env, run, sudo, cd, abort, roles, execute, warn_only
env.use_ssh_config = True # username, identity file (key), hostnames for machines will all be loaded from ~/.ssh/config
# COMMON COMMANDS
# fab update_test - puts newest master on the test server
# fab deploy_live:tag=git_tag_from_repo - roll... | mit | Python | |
6ad306c00da85ea7949cfc3132e1412b82de21a2 | Create primes.py | AverageNormalSchoolBoy/Final-Project | primes.py | primes.py | mit | Python | ||
1d7a960089708b525fc3206f4d3e192334743399 | Add services interface | systemd-commander/systemd-commander | src/services.py | src/services.py | #
# Services control
#
import subprocess
SYSTEMCTL_BINPATH = '/bin/systemctl'
def start(name):
subprocess.check_call([SYSTEMCTL_BINPATH, 'start', name])
def stop(name):
subprocess.check_call([SYSTEMCTL_BINPATH, 'stop', name])
def restart(name):
subprocess.check_call([SYSTEMCTL_BINPATH, 'restart', name... | lgpl-2.1 | Python | |
b4a7e92bb8f3876c12982ef5f63ed1ad56f30ac7 | Add minimal tests for PartHoleDrudge | tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge | tests/parthole_test.py | tests/parthole_test.py | """Tests on the particle-hole model."""
import pytest
from drudge import PartHoleDrudge, CR, AN
from drudge.wick import wick_expand
@pytest.fixture(scope='module')
def parthole(spark_ctx):
"""Initialize the environment for a free algebra."""
dr = PartHoleDrudge(spark_ctx)
return dr
def test_parthole_n... | mit | Python | |
4a00d462925acec642a5de01f2354b2a1483c543 | Add files | askras/pythonintask,fitifit/pythonintask | src/task_5_0.py | src/task_5_0.py | # Задача 5. Вариант 0.
# Напишите программу, которая бы при запуске случайным образом отображала название
# одношо из четырех животных, встреченных Колобком в лесу.
# Krasnikov A. S.
# 02.03.2016
import random
print("Программа случайным образом отображает название одного из четырех животных, встреченных Кол... | apache-2.0 | Python | |
5c592222d1eb36cfb4985aefbba8d8f828d7e972 | Create rgfunc.py | imughal/EmployeeScript | rgfunc.py | rgfunc.py | #!/usr/bin/python
def br():
print ""
def stline():
print "------------------------"
def help():
stline()
print "Help"
stline()
br()
print "'m' or 'M' 'Main Menu'"
print "'q' 'Quit programm'"
def waits():
try:
n = 1
while n<(9999 * 999):
n = n +1
except:
print "print Error"
def get_int(messag... | mit | Python | |
30f25528f5350d8be01f6a3313de90ce24e0882f | Create convert_to_czml_v1.py | Parthesh/GIS,Parthesh/GIS | convert_to_czml_v1.py | convert_to_czml_v1.py | ##### OGR text file to czml converter (use ogrinfo tool to get shape file info into text file). Without building elevation above ellipsoid.
##### Created by Parthesh B.
import os
f = open('file.txt','r')
g = open('write4.txt','a')
p = f.read()
str_len = len(p)
#str1 = "this is string example....wow!!!"
str1 = "Elevati... | mit | Python | |
d701fa2f20099a54557be430f6ec9402eb6b5022 | add __main__.py to use cli w/o installing | open2c/cooltools | cooltools/__main__.py | cooltools/__main__.py | from .cli import cli
if __name__=='__main__':
cli()
| mit | Python | |
2ff14d38266322d3e428c29a01a3de5015269166 | Add minimal feed sourcing example | MrKriss/full-fact-rss-miner | package/src/get_rss_feeds.py | package/src/get_rss_feeds.py | # Chap07/blogs_rss_get_posts.py
import json
from argparse import ArgumentParser
import feedparser
def get_parser():
parser = ArgumentParser()
parser.add_argument('--rss-url')
parser.add_argument('--json')
return parser
if __name__ == '__main__':
parser = get_parser()
args = parser.parse_args... | mit | Python | |
bf3a32714e43fdb4abc226c5c353ccfc10448854 | Add Spark Python word count program | bbengfort/hadoop-fundamentals,bbengfort/hadoop-fundamentals,bbengfort/hadoop-fundamentals,cycuq/hadoop-fundamentals-for-data-scientists,sssllliang/hadoop-fundamentals,nvoron23/hadoop-fundamentals | spark/wordcount.py | spark/wordcount.py | from pyspark import SparkConf, SparkContext
import sys
if __name__ == "__main__":
if len(sys.argv) != 3:
print "Incorrect number of arguments, correct usage: wordcount.py [inputfile] [outputfile]"
sys.exit(-1)
# set input and dictionary from args
input = sys.argv[1]
output = sys.argv[... | mit | Python | |
3f88e37ff5d5e3b7ffe7a39dd6f53a5521f13c86 | Create QR-sequence.py | thezakman/CTF-Scripts,thezakman/CTF-Scripts | QR-sequence.py | QR-sequence.py | # Script to read QR-Codes files in sequence
# 14 fevereiro de 2015
# https://github.com/thezakman
from qrtools import QR
flag = []
i = 48
for x in xrange(9):
i += 1
FILE = QR(filename="QR"+chr(i)+".png") # PNG Sequence
if FILE.decode():
resultado = FILE... | artistic-2.0 | Python | |
39258be1e7151cc2c48646017f567b7123f1f17a | Create CNN_cover_song_NEW.py | thkim107/sim | CNN_cover_song_NEW.py | CNN_cover_song_NEW.py | # 85% accuracy
import numpy as np
import glob
import os
import re
import h5py
import scipy.misc
np.random.seed(777)
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten, Conv2D, pooling, BatchNormalization
from keras.utils import np_utils
from sklearn.model_selection impor... | mit | Python | |
5621523da9c6e1bd5d962944e8466c1c75039ba7 | Create Shadowsocks.py | robotbird/Shadowsocks.py | Shadowsocks.py | Shadowsocks.py | import urllib2
import urllib
import re
import os
import json
res= urllib2.urlopen("http://www.ishadowsocks.net/")
con = res.read().decode("utf-8")
pattern = re.compile('<section id="free">(.*?)</section>',re.S)
result = re.search(pattern,con)
items = re.findall("<h4>(.*?)</h4>",result.group(0))
pwd = items[2][4:12]... | mit | Python | |
3ad3ebdaec39a7931645fc4bf615484670387cdd | set recurring type as Monthly in all old sales invoice | pombredanne/erpnext,Drooids/erpnext,rohitwaghchaure/GenieManager-erpnext,mbauskar/omnitech-demo-erpnext,mbauskar/omnitech-erpnext,indictranstech/focal-erpnext,saurabh6790/medsynaptic-app,mbauskar/alec_frappe5_erpnext,indictranstech/phrerp,rohitwaghchaure/New_Theme_Erp,indictranstech/Das_Erpnext,saurabh6790/OFF-RISAPP,g... | erpnext/patches/june_2012/set_recurring_type.py | erpnext/patches/june_2012/set_recurring_type.py | def execute():
import webnotes
from webnotes.modules import reload_doc
reload_doc('accounts', 'doctype', 'sales_invoice')
webnotes.conn.sql("update `tabSales Invoice` set recurring_type = 'Monthly' where ifnull(convert_into_recurring_invoice, 0) = 1") | agpl-3.0 | Python | |
94648452d655a903c24e63bfeae53af68168ca9e | Add InfoCompound: higher level of information | ronengi/Formar,ronengi/Formar | formar/fdata/InfoCompound.py | formar/fdata/InfoCompound.py | #!/usr/bin/python
"""
Copyright 2017 Ronen Gilead-Raz
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicab... | apache-2.0 | Python | |
0d0ccf085a73e2c00445d4f324c7d6773efda511 | Create story-teller.py | Rinik/story-teller | story-teller.py | story-teller.py | #!/usr/bin/env python3
# import needed classes, random to scramble the dices, time to add waiting time when the dice's are rolled.
import random
import time
# Created Array of dice's number equals one side of the dice. So 1-6 is the first dice, 7-12 second and so one.
dices = {1: "Ladders", 2: "Submarine", 3: "Questi... | mit | Python | |
9d595436813208be85937ad68cbfc45007fb4f7e | implement basic architecture | IEEE-NITK/EaaS | server.py | server.py | #!/usr/bin/env python
import socket, threading
row_format ="{:>20}" * 2
class Cipher():
def cipherGreeting(self):
clientsock.send(row_format.format("Explain", "Encrypt!") + "\n")
clientsock.send(row_format.format("-------", "--------") + "\n")
clientsock.send(row_format.format("a", "b") +... | mit | Python | |
7a48332ac62dcf5e0248f69674a17bd62885d84a | Create server.py | adcomp/raspberrypi-nikko-vaporizr | server.py | server.py | #!/usr/bin/python
###
# Python WebSocket Server for Raspberry Pi
# by David Art <david.madbox@gmail.com>
###
import os
import sys
#import tornado.httpserver
import tornado.websocket
import tornado.ioloop
import tornado.web
import tornado.escape as escape
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
# GPIO 4 - RI... | unlicense | Python | |
244d95937c1fbae6a0f415cbdcbd4ed65cc6d8c4 | Solve Code Fights pref sum problem | HKuz/Test_Code | CodeFights/prefSum.py | CodeFights/prefSum.py | #!/usr/local/bin/python
# Code Fights Pref Sum Problem
from itertools import accumulate
def prefSum(a):
return list(accumulate(a))
def main():
tests = [
[[1, 2, 3], [1, 3, 6]],
[[1, 2, 3, -6], [1, 3, 6, 0]],
[[0, 0, 0], [0, 0, 0]]
]
for t in tests:
res = prefSum(t[0... | mit | Python | |
a39c07f428b9258348514b93ffbdbd8bc7d5c74b | Create boafiHome.py | fnzv/Boafi,fnzv/Boafi,fnzv/Boafi | webGUI/boafiHome.py | webGUI/boafiHome.py | #!/usr/bin/python
####
#### Script for Home\Index page
####
#### -Get wifi AP list
#### -Turn off toggles for some boafi functions
#### -..
##
import os,time,argparse
parser = argparse.ArgumentParser()
parser.add_argument('-wifi', action='store_true', dest='wifi', default=False,
help='Get ne... | mit | Python | |
6c8cdc4460204cf4ffcb9b1a42da3ba7bb469031 | Add unit test of g1.asyncs.kernels public interface | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | py/g1/asyncs/kernels/tests/test_public.py | py/g1/asyncs/kernels/tests/test_public.py | import unittest
from g1.asyncs import kernels
class KernelsTest(unittest.TestCase):
"""Test ``g1.asyncs.kernels`` public interface."""
def test_contexts(self):
self.assertIsNone(kernels.get_kernel())
self.assertEqual(kernels.get_all_tasks(), [])
self.assertIsNone(kernels.get_current... | mit | Python | |
10370fa9ce5713f3568c4b7fbfc5422de3d94aab | Add script to create labeled images. | openmv/openmv,openmv/openmv,iabdalkader/openmv,iabdalkader/openmv,kwagyeman/openmv,kwagyeman/openmv,openmv/openmv,iabdalkader/openmv,kwagyeman/openmv,openmv/openmv,kwagyeman/openmv,iabdalkader/openmv | tools/create_labels.py | tools/create_labels.py | #!/usr/bin/env python2
# This file is part of the OpenMV project.
# Copyright (c) 2017-2018
# Ibrahim Abdelkader <iabdalkader@openmv.io> & Kwabena W. Agyeman <kwagyeman@openmv.io>
# This work is licensed under the MIT license, see the file LICENSE for details.
#
# This script creates test and training label files for ... | mit | Python | |
c0496d83049e02db718941b7cdd6fa0bacd28ce2 | Add raven SSL fix mod. | Mediamoose/python-tools | python-tools/mods/raven/transport/http.py | python-tools/mods/raven/transport/http.py | # See https://github.com/getsentry/raven-python/issues/1109
"""
raven.transport.http
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import requests
from raven.utils.compat import s... | mit | Python | |
5ff70e431d24ed14e2394dc31651f935b780cd5c | add rigging module | josephkirk/PipelineTools,josephkirk/PipelineTools,josephkirk/PipelineTools,josephkirk/PipelineTools | rigging.py | rigging.py | from PipelineTools.utilities import *
| bsd-2-clause | Python | |
9f316daf0d04bf406147acae1b607b190205f470 | add example script to compare reduced data streams | bluesquall/okeanidanalysis | examples/shore-data/compare-reduced-data-streams.py | examples/shore-data/compare-reduced-data-streams.py | #!/usr/bin/env python
#
# An example script to compare reduced data streams sent to shore.
import numpy as np
import matplotlib.pyplot as plt
import okeanidanalysis as oa
expressfile = "/Users/squall/Desktop/daphne-bin-logs/20150310T204202/shore.mat"
priorityfile = "/Users/squall/Desktop/daphne-bin-logs/20150310T20... | mit | Python | |
bdf3ff1f8b3568718cf6c5b3e0ff47310d293e98 | Add main.py for calling from command line | VictorBjelkholm/editorconfig-vim,VictorBjelkholm/editorconfig-vim,VictorBjelkholm/editorconfig-vim,dublebuble/editorconfig-gedit,johnfraney/editorconfig-vim,benjifisher/editorconfig-vim,johnfraney/editorconfig-vim,pocke/editorconfig-vim,pocke/editorconfig-vim,pocke/editorconfig-vim,benjifisher/editorconfig-vim,johnfran... | main.py | main.py | #!/usr/bin/env python
import getopt, sys
from editorconfig import EditorConfigHandler
def version():
print "Version 0.9.0"
def usage(command):
print "%s [OPTIONS] FILENAME" % command
print '-f Specify conf filename other than ".editorconfig".'
print "-h OR --help Print this h... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.