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 |
|---|---|---|---|---|---|---|---|---|
bc4b25b9c24ef0db58acbd1c8e24b3fee319314b | Solve challenge 13 | HKuz/PythonChallenge | Challenges/chall_13.py | Challenges/chall_13.py | #!/Applications/anaconda/envs/Python3/bin
# Python challenge - 13
# http://www.pythonchallenge.com/pc/return/disproportional.html
# http://www.pythonchallenge.com/pc/phonebook.php
import xmlrpc.client
def main():
'''
Hint: phone that evil
<area shape="circle" coords="326,177,45" href="../phonebook.php">
... | mit | Python | |
742c6d47cd542a2c56b50d48c92b817e977da768 | add pgproxy.py | nakagami/minipg | misc/pgproxy.py | misc/pgproxy.py | #!/usr/bin/env python3
##############################################################################
#The MIT License (MIT)
#
#Copyright (c) 2016 Hajime Nakagami
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to dea... | mit | Python | |
78ea9019850dbf9b88d3f65a4a61139f01d2c496 | Add scratch genbank-gff-to-nquads.py which just opens a gff file atm | justinccdev/biolta | src/genbank-gff-to-nquads.py | src/genbank-gff-to-nquads.py | #!/usr/bin/env python
import jargparse
parser = jargparse.ArgParser('Convert Genbank GFF into an n-quad file')
parser.add_argument('gffPath', help='path to the GFF')
args = parser.parse_args()
with open(args.gffPath):
pass
| apache-2.0 | Python | |
48b724d7a2163c50be60d98933132b51347940bd | Create longest-line-of-consecutive-one-in-a-matrix.py | jaredkoontz/leetcode,jaredkoontz/leetcode,kamyu104/LeetCode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamy... | Python/longest-line-of-consecutive-one-in-a-matrix.py | Python/longest-line-of-consecutive-one-in-a-matrix.py | # Time: O(m * n)
# Space: O(n)
class Solution(object):
def longestLine(self, M):
"""
:type M: List[List[int]]
:rtype: int
"""
if not M: return 0
result = 0
dp = [[[0] * 4 for _ in xrange(len(M[0]))] for _ in xrange(2)]
for i in xrange(len(M)):
... | mit | Python | |
23138ab91e5ac0ecf92a0968bf8e4abfa7d0c763 | Remove duplicates in all subdirectories - working raw version. | alprab/utils | removedups.py | removedups.py | import hashlib, csv, os
def md5(fname):
hash_md5 = hashlib.md5()
with open(fname, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return hash_md5.hexdigest()
def process_directory_csv(current_dir_fullpath, sub_dir_list, files, csvwriter):
for file i... | apache-2.0 | Python | |
59736ee4dd82da7f7945723ec1cc89b19359b5c7 | Create LargestPrimeFactor.py | Laserbear/Python-Scripts | LargestPrimeFactor.py | LargestPrimeFactor.py | #! Christian Ng
base = 0
print("Enter an integer:")
base = int(raw_input())
print "Largest Factor is:"
while (base % 2) == 0:
base = base/2
if base == 1 or base == -1:
print "2"
increment = 3
while base != 1 and base != -1:
while base % increment == 0:
base = base/increment
... | apache-2.0 | Python | |
99395e345f74bbedd29fd45eebe0738a3b5f4729 | Test api endpoint for package show | ckan/ckanext-archiver,ckan/ckanext-archiver,ckan/ckanext-archiver | ckanext/archiver/tests/test_api.py | ckanext/archiver/tests/test_api.py | import pytest
import tempfile
from ckan import model
from ckan import plugins
from ckan.tests import factories
import ckan.tests.helpers as helpers
from ckanext.archiver import model as archiver_model
from ckanext.archiver.tasks import update_package
@pytest.mark.usefixtures('with_plugins')
@pytest.mark.ckan_config... | mit | Python | |
070a5192e4473bbbbf25a881080413f771f05801 | Add mockldap.ldap.functions taken from python-ldap | coreos/mockldap | src/mockldap/ldap/functions.py | src/mockldap/ldap/functions.py | import sys
from ldapobject import LDAPObject
def initialize(uri,trace_level=0,trace_file=sys.stdout,trace_stack_limit=None):
"""
Return LDAPObject instance by opening LDAP connection to
LDAP host specified by LDAP URL
Parameters:
uri
LDAP URL containing at least connection scheme and hostport,
... | bsd-2-clause | Python | |
2f93251e77589c0edbb8e560940d29764caac9e0 | Test password update functionality | m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | tests/blueprints/authentication/test_views_password_update.py | tests/blueprints/authentication/test_views_password_update.py | # -*- coding: utf-8 -*-
"""
:Copyright: 2006-2016 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from byceps.services.authentication.password.models import Credential
from byceps.services.authentication.password import service as password_service
from byceps.services.authentication.session.... | bsd-3-clause | Python | |
0c59028a1ef33b3627e65955bafbf9b415c9bc34 | Add 457_Circular_Array_Loop.py (#34) | qiyuangong/leetcode,qiyuangong/leetcode,qiyuangong/leetcode | python/457_Circular_Array_Loop.py | python/457_Circular_Array_Loop.py | class Solution:
def circularArrayLoop(self, nums: List[int]) -> bool:
for i in range(len(nums)):
if nums[i] == 0:
continue
# if slow and fast pointers collide, then there exists a loop
slow = i
fast = self.index(nums, slow)
... | mit | Python | |
ae484c893c9cbef5a80b908ba254885e1db4d0b3 | Create 0015_auto_20200128_1045.py | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/activities/migrations/0015_auto_20200128_1045.py | bluebottle/activities/migrations/0015_auto_20200128_1045.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2020-01-28 09:45
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
... | bsd-3-clause | Python | |
a59aef7c780c4d940ff56fa34ddf38de46056a6f | add package py-flask-compress (#7713) | iulian787/spack,mfherbst/spack,tmerrick1/spack,iulian787/spack,mfherbst/spack,EmreAtes/spack,mfherbst/spack,mfherbst/spack,krafczyk/spack,iulian787/spack,matthiasdiener/spack,krafczyk/spack,tmerrick1/spack,matthiasdiener/spack,mfherbst/spack,iulian787/spack,LLNL/spack,matthiasdiener/spack,krafczyk/spack,LLNL/spack,LLNL... | var/spack/repos/builtin/packages/py-flask-compress/package.py | var/spack/repos/builtin/packages/py-flask-compress/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
d48b17dc82e359aca962449c6df51aaea88a11d3 | add resource manager tests | hgrecco/pyvisa-py,pyvisa/pyvisa-py | pyvisa_py/testsuite/keysight_assisted_tests/test_resource_manager.py | pyvisa_py/testsuite/keysight_assisted_tests/test_resource_manager.py | # -*- coding: utf-8 -*-
"""Test the Resource manager.
"""
from pyvisa.testsuite.keysight_assisted_tests import require_virtual_instr
from pyvisa.testsuite.keysight_assisted_tests.test_resource_manager import (
TestResourceManager as BaseTestResourceManager,
TestResourceParsing as BaseTestResourceParsing,
)
@... | mit | Python | |
d623140b606d7ec9b874419b4414833d669f5677 | add a way to set the last sync date | crate-archive/crate-site,crateio/crate.pypi,crate-archive/crate-site | crate_project/apps/crate/management/commands/set_last_sync.py | crate_project/apps/crate/management/commands/set_last_sync.py | import redis
from django.conf import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **options):
r = redis.StrictRedis(**getattr(settings, "PYPI_DATASTORE_CONFIG", {}))
if args:
r.set("crate:pypi:since", args[0])
| bsd-2-clause | Python | |
ca96e71995c9daa17323a3285bee71c8d334c11e | Add abstract classifier | brainbots/assistant | assisstant/keyboard/classification/abstract_classifier.py | assisstant/keyboard/classification/abstract_classifier.py | from abc import ABC, abstractmethod, abstractproperty
class AbstractClassifier(ABC):
def __init__(self, freqs, duration, data=None):
self.freqs = freqs
self.duration = duration
if data:
self.data = data
self.train(data)
@abstractmethod
def classify(self, sample):
pass
... | apache-2.0 | Python | |
e089107eb52c320309b3ddd2ea2b6e764f74ff09 | Create LeverBox.py | hectorpefo/hectorpefo.github.io,hectorpefo/hectorpefo.github.io,hectorpefo/hectorpefo.github.io,hectorpefo/hectorpefo.github.io | _includes/LeverBox.py | _includes/LeverBox.py | State_Probs = {(9,1,1,1,1,1,1,1,1,1) : 1}
def Modified_State(State,Indexes):
New_State_List = list(State)
for i in Indexes:
New_State_List[i] = 1
New_State = tuple(New_State_List)
return New_State
def Best_Case_Prob_For(State,Sum):
Best_Case_Prob = 0
if Sum < 10 and State[Sum] == 0:
P = Prob_For_State... | mit | Python | |
2eb090b406a341c3b225e59779d0046cf76efc6c | Add download_feeds.py script | ucldc/ucldc-merritt | download_feeds.py | download_feeds.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os
import boto3
bucketname = 'static.ucldc.cdlib.org'
prefix = 'merritt/'
s3 = boto3.resource('s3')
bucket = s3.Bucket(bucketname)
for obj in bucket.objects.filter(Prefix=prefix):
if obj.key.endswith('.atom'):
print "downloading {}".format(obj.ke... | bsd-3-clause | Python | |
494c0603c4aedb83852a008fad2139c469b537fd | Rename histograms in memory_benchmark_unittest. | jaruba/chromium.src,ChromiumWebApps/chromium,ondra-novak/chromium.src,timopulkkinen/BubbleFish,chuan9/chromium-crosswalk,fujunwei/chromium-crosswalk,patrickm/chromium.src,ondra-novak/chromium.src,axinging/chromium-crosswalk,hgl888/chromium-crosswalk,markYoungH/chromium.src,bright-sparks/chromium-spacewalk,chuan9/chromi... | tools/perf/perf_tools/memory_benchmark_unittest.py | tools/perf/perf_tools/memory_benchmark_unittest.py | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from perf_tools import memory_benchmark
from telemetry.page import page_benchmark_unittest_base
class MemoryBenchmarkUnitTest(
page_benchmark_unittest_... | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from perf_tools import memory_benchmark
from telemetry.page import page_benchmark_unittest_base
class MemoryBenchmarkUnitTest(
page_benchmark_unittest_... | bsd-3-clause | Python |
0ea6bab984abee943d93cdfa90273b7a7aabcf8f | add new package : brltty (#15161) | LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/brltty/package.py | var/spack/repos/builtin/packages/brltty/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Brltty(AutotoolsPackage):
"""BRLTTY is a background process (daemon) providing access to t... | lgpl-2.1 | Python | |
a8c7d9a2ed9462506130157ce5eccad9121013a3 | add new package (#24004) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/r-afex/package.py | var/spack/repos/builtin/packages/r-afex/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RAfex(RPackage):
"""Analysis of Factorial Experiments
Convenience functions for analy... | lgpl-2.1 | Python | |
2bc7d87c705b038d699309b25eec7ab3df4e9308 | Add example for training text classifier | explosion/spaCy,aikramer2/spaCy,recognai/spaCy,recognai/spaCy,honnibal/spaCy,recognai/spaCy,aikramer2/spaCy,aikramer2/spaCy,recognai/spaCy,spacy-io/spaCy,honnibal/spaCy,honnibal/spaCy,spacy-io/spaCy,aikramer2/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,recognai/spaCy,spacy-io/spaCy,recognai/spaCy,aikramer2/spaC... | examples/training/train_textcat.py | examples/training/train_textcat.py | from __future__ import unicode_literals
import plac
import random
import tqdm
from thinc.neural.optimizers import Adam
from thinc.neural.ops import NumpyOps
import thinc.extra.datasets
import spacy.lang.en
from spacy.gold import GoldParse, minibatch
from spacy.util import compounding
from spacy.pipeline import TextCa... | mit | Python | |
c8cc7f6fe7c0f59697972602773d67b3fde40360 | Add basic filter classes. | fhirschmann/penchy,fhirschmann/penchy | penchy/filters.py | penchy/filters.py | class Filter(object):
"""
Base class for filters.
Inheriting classes must implement:
- ``run(*inputs)`` to run the filter on inputs which can be Producer or
Filter instances, after executing self.out has to be set to the
path of the produced output file
"""
def run(self, ... | mit | Python | |
de3650503eaf2073817b4d35c116a2c076382441 | Create range-module.py | kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode | Python/range-module.py | Python/range-module.py | # Time: addRange: O(n)
# removeRange: O(n)
# queryRange: O(logn)
# Space: O(n)
# A Range Module is a module that tracks ranges of numbers.
# Your task is to design and implement the following interfaces in an efficient manner.
# - addRange(int left, int right) Adds the half-open interval [left, righ... | mit | Python | |
8b95f442f3e78a5f3de539075379b88fc940e818 | add custom settings for momza | praekelt/casepro,praekelt/casepro,praekelt/casepro | casepro/settings_production_momza.py | casepro/settings_production_momza.py | from __future__ import unicode_literals
import os
# import our default settings
from settings_production import * # noqa
# Pods
PODS = [{
'label': "family_connect_registration_pod",
'title': "Registration Information",
'url': os.environ.get('REGISTRATION_URL', ''),
'token': os.environ.get('REGISTRATI... | bsd-3-clause | Python | |
797249c42c8c1c0d6eda05dbf9e9d16d2706b373 | Add LeNet example with custom scoring and train_samples_per_iteration. | mathemage/h2o-3,h2oai/h2o-3,spennihana/h2o-3,spennihana/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,michalkurka/h2o-3,spennihana/h2o-3,jangorecki/h2o-3,michalkurka/h2o-3,mathemage/h2o-3,h2oai/h2o-dev,mathemage/h2o-3,h2oai/h2o-3,mathemage/h2o-3,h2oai/h2o-dev,h2oai/h2o-dev,michalkurka/h2o-3,jangorecki/h2o-3,michalkurka/h2o-3,spe... | h2o-py/tests/testdir_algos/deepwater/pyunit_lenet_deepwater.py | h2o-py/tests/testdir_algos/deepwater/pyunit_lenet_deepwater.py | from __future__ import print_function
import sys, os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from tests import pyunit_utils
from h2o.estimators.deepwater import H2ODeepWaterEstimator
def deepwater_lenet():
print("Test checks if Deep Water works fine with a multiclass image dataset")
frame = h2... | apache-2.0 | Python | |
26d095d44a02862a4d567537e824170e75930a9a | add email people script | ThePianoDentist/fantasy-dota-heroes,ThePianoDentist/fantasy-dota-heroes,ThePianoDentist/fantasy-dota-heroes | fantasydota/scripts/email_users.py | fantasydota/scripts/email_users.py | from fantasydota import DBSession
from fantasydota.models import User
from pyramid_mailer import Mailer
from pyramid_mailer.message import Message
def email_users():
session = DBSession()
for user in session.query(User).filter(User.email.isnot("")).all():
if user.email:
email = "testemail"... | apache-2.0 | Python | |
8cdbbbaf33cd09bc742761ce8cd5b79b185710cd | Introduce a timer based update of activities | wodo/WebTool3,wodo/WebTool3,wodo/WebTool3,wodo/WebTool3 | webtool/server/management/commands/timer_update.py | webtool/server/management/commands/timer_update.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
import io
import datetime
from django.core.management.base import BaseCommand
from server.models import Instruction, Tour, Talk, Session, Season
from server.views.bulletin impo... | bsd-2-clause | Python | |
eceee762dd3773aacceb52119014dad88e363c8d | Create find_subnets_with_broker.py | infobloxopen/netmri-toolkit,infobloxopen/netmri-toolkit,infobloxopen/netmri-toolkit | python/NetMRI_GUI_Python/find_subnets_with_broker.py | python/NetMRI_GUI_Python/find_subnets_with_broker.py | # BEGIN-SCRIPT-BLOCK
#
# Script-Filter:
# true
#
# END-SCRIPT-BLOCK
from infoblox_netmri.easy import NetMRIEasy
import re
# This values will be provided by NetMRI before execution
defaults = {
"api_url": api_url,
"http_username": http_username,
"http_password": http_password,
"job_id": job_id,
... | mit | Python | |
c96b885d4446db96402d9770d71012dbcafcb8cf | install go-vcf-tools by manage.py command | perGENIE/pergenie-web,perGENIE/pergenie,perGENIE/pergenie-web,perGENIE/pergenie-web,perGENIE/pergenie,perGENIE/pergenie,perGENIE/pergenie-web,perGENIE/pergenie,perGENIE/pergenie-web,perGENIE/pergenie-web,perGENIE/pergenie | pergenie/apps/genome/management/commands/setup_go_vcf_tools.py | pergenie/apps/genome/management/commands/setup_go_vcf_tools.py | import os
import glob
import shutil
import tarfile
import platform
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from lib.utils.io import get_url_content
from lib.utils import clogging
log = clogging.getColorLogger(__name__)
class Command(BaseCommand):
help =... | agpl-3.0 | Python | |
76fbec63667f3844f2763d72e57e61c07209cdad | Create Meh.py | kallerdaller/Cogs-Yorkfield | Meh/Meh.py | Meh/Meh.py | import discord
from discord.ext import commands
class Mycog:
"""My custom cog that does stuff!"""
def __init__(self, bot):
self.bot = bot
@commands.command()
async def mycom(self):
"""This does stuff!"""
#Your code will go here
await self.bot.say("I can do stuff!")
d... | mit | Python | |
6693172856655329d99f038d54b1d8819fc1a9b6 | Add native code emitters example. | kwagyeman/openmv,openmv/openmv,openmv/openmv,iabdalkader/openmv,openmv/openmv,openmv/openmv,iabdalkader/openmv,iabdalkader/openmv,kwagyeman/openmv,kwagyeman/openmv,iabdalkader/openmv,kwagyeman/openmv | scripts/examples/02-Board-Control/native_emitters.py | scripts/examples/02-Board-Control/native_emitters.py | import time
@micropython.asm_thumb
def asm():
movw(r0, 42)
@micropython.viper
def viper(a, b):
return a + b
@micropython.native
def native(a, b):
return a + b
print(asm())
print(viper(1, 2))
print(native(1, 2))
| mit | Python | |
5cb43fbf0efadff7af68836243eb7e1711e7df1c | Add test_object script | pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc | jsk_2015_05_baxter_apc/euslisp/test_object_recognition.py | jsk_2015_05_baxter_apc/euslisp/test_object_recognition.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import rospy
from jsk_2014_picking_challenge.msg import ObjectRecognition
left_result = None
right_result = None
def _cb_left(msg):
global left_result
left_result = dict(zip(msg.candidates, msg.probabilities))
def _cb_right(msg):
global right_result
rig... | bsd-3-clause | Python | |
f56e86ff774a55e7882957a8928bdca98ce4c3e8 | Add missing migration | stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten | features/groups/migrations/0017_auto_20171127_1447.py | features/groups/migrations/0017_auto_20171127_1447.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-27 13:47
from __future__ import unicode_literals
from django.db import migrations, models
import features.stadt.forms
class Migration(migrations.Migration):
dependencies = [
('groups', '0016_auto_20171120_1311'),
]
operations = [
... | agpl-3.0 | Python | |
afedd723ad85b99c2ebd08246b5ed13b37cd62e9 | make psnr.py | piraaa/VideoDigitalWatermarking | src/psnr.py | src/psnr.py | #
# psnr.py
# Created by pira on 2017/08/05.
#
#coding: utf-8
u"""For PSNR(Peak Signal to Noise Ratio).""" | mit | Python | |
6472768e2373b7972db5c3033063fd0f0adb2059 | add example of load with input_type='apache-arrow' | hhatto/poyonga | examples/groonga_microblog_tutorial/2_load_with_pyarrow.py | examples/groonga_microblog_tutorial/2_load_with_pyarrow.py | from poyonga.client import Groonga
import pyarrow as pa
def _call(g, cmd, **kwargs):
ret = g.call(cmd, **kwargs)
print(ret.status)
print(ret.body)
if cmd == "select":
for item in ret.items:
print(item)
print("=*=" * 30)
def load_and_select(table, data, batch):
# use A... | mit | Python | |
5bb154f41f25d8c9bbd9067b29a03a5fc2dff371 | Add functional tests for floating IP. | mtougeron/python-openstacksdk,stackforge/python-openstacksdk,dtroyer/python-openstacksdk,openstack/python-openstacksdk,briancurtin/python-openstacksdk,mtougeron/python-openstacksdk,openstack/python-openstacksdk,briancurtin/python-openstacksdk,dudymas/python-openstacksdk,stackforge/python-openstacksdk,dudymas/python-ope... | openstack/tests/functional/network/v2/test_floating_ip.py | openstack/tests/functional/network/v2/test_floating_ip.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | apache-2.0 | Python | |
a5720071a950185e5afb1992dd4b66b47aefc242 | Bump version 0.2.5 | kenjhim/django-accounting,kenjhim/django-accounting,kenjhim/django-accounting,dulaccc/django-accounting,dulaccc/django-accounting,kenjhim/django-accounting,dulaccc/django-accounting,dulaccc/django-accounting | accounting/__init__.py | accounting/__init__.py | import os
# Use 'final' as the 4th element to indicate
# a full release
VERSION = (0, 2, 5)
def get_short_version():
return '%s.%s' % (VERSION[0], VERSION[1])
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
# Append 3rd digit if > 0
if VERSION[2]:
version = '%s.%s' % (versi... | import os
# Use 'final' as the 4th element to indicate
# a full release
VERSION = (0, 2, 4)
def get_short_version():
return '%s.%s' % (VERSION[0], VERSION[1])
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
# Append 3rd digit if > 0
if VERSION[2]:
version = '%s.%s' % (versi... | mit | Python |
fa6060a21767a0b5b2b3a10e4301e0c1a30134cb | Test the lit0,cmp before bra eliminator | gbenson/i8c | i8c/tests/test_opt_lit0_cmp_before_bra.py | i8c/tests/test_opt_lit0_cmp_before_bra.py | from i8c.tests import TestCase
SOURCE1 = """\
define test::optimize_cmp_bra_const_const returns ptr
argument ptr x
dup
load NULL
beq return_the_null
deref ptr
return
return_the_null:
"""
SOURCE2 = """\
define test::optimize_cmp_bra_const_const returns ptr
argument ptr x
dup
load ... | lgpl-2.1 | Python | |
7be2721bfcbf3376ddce4d58f2cfe9680803f9bb | Create center_dmenu script. | RyanMcG/center_dmenu | center_dmenu.py | center_dmenu.py | #!/usr/bin/env python2
from Xlib import display
import sys
from os import system
def get_dimensions():
current_display = display.Display()
current_screen = current_display.screen()
return (current_screen['width_in_pixels'],
current_screen['height_in_pixels'])
def parse_dmenu_args(args):
... | apache-2.0 | Python | |
a737c7cd26450ac5dfdab23aea6902f53976c538 | fix version in xformhistory for multiple xml versions | awemulya/fieldsight-kobocat,awemulya/fieldsight-kobocat,awemulya/fieldsight-kobocat,awemulya/fieldsight-kobocat | onadata/apps/fsforms/management/commands/fix_xml_version_in_xformhistory.py | onadata/apps/fsforms/management/commands/fix_xml_version_in_xformhistory.py | import os
from onadata.settings.local_settings import XML_VERSION_MAX_ITER
from onadata.apps.fsforms.models import XformHistory
from django.core.management.base import BaseCommand
import re
import datetime
def check_version(instance, n):
for i in range(n, 0, -1):
p = re.compile("""<bind calculate="\'(.*)\'... | bsd-2-clause | Python | |
3837329e0d49796cfe9eabd2aeb026c206c5c4d8 | add admin ui for user upload record | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/user_importer/admin.py | corehq/apps/user_importer/admin.py | import zipfile
from io import BytesIO
from django.contrib import admin
from django.http.response import HttpResponse
from .models import UserUploadRecord
class UserUploadAdmin(admin.ModelAdmin):
list_display = ('domain', 'date_created')
list_filter = ('domain',)
ordering = ('-date_created',)
search... | bsd-3-clause | Python | |
ba5a358ffefb5646a3911fafe2c394c9c52905f7 | add import script for Horsham | DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_horsham.py | polling_stations/apps/data_collection/management/commands/import_horsham.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000227'
addresses_name = 'Democracy_Club__04May2017.tsv'
stations_name = 'Democracy_Club__04May2017.tsv'
elections = ['local.west-sussex.2017-05-04']
... | bsd-3-clause | Python | |
3d4e3be7624f099f9b15c24a9161f474a733ebff | add a script for manual fixing of user profiles. Now I will fix the bug in the code… | 1flow/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow | scripts/20130625_fix_userprofile_data_being_unicode_insteadof_dict.py | scripts/20130625_fix_userprofile_data_being_unicode_insteadof_dict.py |
from oneflow.profiles.models import UserProfile
import ast
for p in UserProfile.objects.all():
if type(p.data) == type(u''):
p.data = {}
if type(p.register_request_data) == type(u''):
p.register_request_data = ast.literal_eval(p.register_request_data)
p.save()
| agpl-3.0 | Python | |
921b0adf8b93ccad54eb0a82e42ff4b742e176db | Add label_wav_dir.py (#14847) | AnishShah/tensorflow,annarev/tensorflow,karllessard/tensorflow,kevin-coder/tensorflow-fork,asimshankar/tensorflow,dancingdan/tensorflow,yanchen036/tensorflow,xodus7/tensorflow,ppwwyyxx/tensorflow,snnn/tensorflow,arborh/tensorflow,kobejean/tensorflow,asimshankar/tensorflow,meteorcloudy/tensorflow,gojira/tensorflow,jenda... | tensorflow/examples/speech_commands/label_wav_dir.py | tensorflow/examples/speech_commands/label_wav_dir.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 | Python | |
a3a48824b36ef62edaf128379f1baec5482166e7 | Save error_message for resources (SAAS-982) | opennode/nodeconductor-saltstack | src/nodeconductor_saltstack/migrations/0005_resource_error_message.py | src/nodeconductor_saltstack/migrations/0005_resource_error_message.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('nodeconductor_saltstack', '0004_remove_useless_spl_fields'),
]
operations = [
migrations.AddField(
model_name='d... | mit | Python | |
bfb51cadc66f34a67686bef3b15e9197c9d0617b | Create ping_help.py | Subh94/Traffic_Analyzer- | ping_help.py | ping_help.py | import time
import subprocess
import os
hostname=raw_input('')
#while 1:
os.system("ping -c 10 -i 5 " + hostname + " >1.txt")
os.system("awk -F'[= ]' '{print $6,$10}' < 1.txt >final.txt")
os.system("grep [0-9] final.txt >final1.txt")
| apache-2.0 | Python | |
dacffcb3e79877e1ea5e71d1a2e67bd4edd865bf | Add SettingOverrideModel that exposes a SettingOverrideDecorator to QML | onitake/Uranium,onitake/Uranium | plugins/Tools/PerObjectSettingsTool/SettingOverrideModel.py | plugins/Tools/PerObjectSettingsTool/SettingOverrideModel.py | # Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
from PyQt5.QtCore import Qt, pyqtSlot, QUrl
from UM.Application import Application
from UM.Qt.ListModel import ListModel
class SettingOverrideModel(ListModel):
KeyRole = Qt.UserRole + 1
LabelRole = Qt.UserRole ... | agpl-3.0 | Python | |
3652f1c666f3bf482862727838f0b4bbc9fea5e9 | fix bug 1076270 - add support for Windows 10 | rhelmer/socorro,linearregression/socorro,Tchanders/socorro,twobraids/socorro,linearregression/socorro,mozilla/socorro,Tayamarn/socorro,luser/socorro,m8ttyB/socorro,yglazko/socorro,yglazko/socorro,pcabido/socorro,Serg09/socorro,pcabido/socorro,KaiRo-at/socorro,Tayamarn/socorro,rhelmer/socorro,twobraids/socorro,rhelmer/s... | alembic/versions/17e83fdeb135_bug_1076270_support_windows_10.py | alembic/versions/17e83fdeb135_bug_1076270_support_windows_10.py | """bug 1076270 - support windows 10
Revision ID: 17e83fdeb135
Revises: 52dbc7357409
Create Date: 2014-10-03 14:03:29.837940
"""
# revision identifiers, used by Alembic.
revision = '17e83fdeb135'
down_revision = '52dbc7357409'
from alembic import op
from socorro.lib import citexttype, jsontype, buildtype
from socorr... | mpl-2.0 | Python | |
f5ada694fae30f15498c775e8c4aa14a08459251 | Add slogan plugin | Muzer/smartbot,thomasleese/smartbot-old,tomleese/smartbot,Cyanogenoid/smartbot | plugins/slogan.py | plugins/slogan.py | import re
import requests
import urllib.parse
class Plugin:
def __call__(self, bot):
bot.on_respond(r"slogan(?:ise)? (.*)$", self.on_respond)
bot.on_help("slogan", self.on_help)
def on_respond(self, bot, msg, reply):
url = "http://www.sloganizer.net/en/outbound.php?slogan={0}".format(u... | mit | Python | |
779fb015913a17fcb8fb290515845e6b47c3ae50 | Create the converter (with span-conversion functionality) | jladan/latex2markdown | latex2markdown.py | latex2markdown.py | """
A Very simple tool to convert latex documents to markdown documents
"""
import re
span_substitutions = [
(r'\\emph\{(.+)\}', r'*\1*'),
(r'\\textbf\{(.+)\}', r'**\1**'),
(r'\\verb;(.+);', r'`\1`'),
(r'\\includegraphics\{(.+)\}', r''),
]
def convert_span_elements(line... | mit | Python | |
2fdabf544c75096efafe2d14988efa28619643ab | add scheme | johntut/MongoDisco,10genNYUITP/MongoDisco,sajal/MongoDisco,mongodb/mongo-disco,dcrosta/mongo-disco | app/scheme_mongodb.py | app/scheme_mongodb.py | import pymongo
import bson
from bson import json_util
import warnings
from cStringIO import StringIO
from pymongo import Connection, uri_parser
import bson.son as son
import json
import logging
def open(url=None, task=None):
#parses a mongodb uri and returns the database
#"mongodb://localhost/test.in?query='{"... | apache-2.0 | Python | |
03ad7302f75ea5de0870c798ec70f1a1912288ca | Add main.py file Description for 'hello! hosvik' | Hosvik/Hosvik | src/main.py | src/main.py | import sys
print(sys.platform);
print('Hello hosvik!')
| apache-2.0 | Python | |
054c75ce1a63732be7a58ec1150e9f8aaff2aedb | Create test.py | WebShark025/TheZigZagProject,WebShark025/TheZigZagProject | plugins/test.py | plugins/test.py | @bot.message_handler(commands=['test', 'toast'])
def send_test(message):
bot.send_message(message.chat.id, TEST_MSG.encode("utf-8"))
| mit | Python | |
5c9ffaaa8e244bb9db627a0408258750cc0e81d6 | Create ping.py | johnbrannstrom/zipato-extension,johnbrannstrom/zipato-extension,johnbrannstrom/zipato-extension | src/ping.py | src/ping.py | nisse
| mit | Python | |
1473e0f4f1949349ef7212e0755fa8ffa6401cbe | Create process_htk_mlf_zh.py | troylee/chinesetextnorm | process_htk_mlf_zh.py | process_htk_mlf_zh.py | #!/usr/bin/env python
#
# This script reads in a HTK MLF format label file and converts the
# encoded contents to GBK encoding.
#
import string, codecs
fin=open('vom_utt_wlab.mlf')
fout=codecs.open('vom_utt_wlab.gbk.mlf', encoding='gbk', mode='w')
while True:
sr=fin.readline()
if sr=='':break
sr=sr.strip(... | apache-2.0 | Python | |
c8c807cfcb4422edc0e2dbe3a4673a62fa37cbfa | Add extra migration triggered by updated django / parler (#501) | nephila/djangocms-blog,nephila/djangocms-blog,nephila/djangocms-blog | djangocms_blog/migrations/0037_auto_20190806_0743.py | djangocms_blog/migrations/0037_auto_20190806_0743.py | # Generated by Django 2.1.11 on 2019-08-06 05:43
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import parler.fields
import taggit_autosuggest.managers
class Migration(migrations.Migration):
dependencies = [
('djangocms_blog', '0036_auto_201809... | bsd-3-clause | Python | |
e082c803bf5ce31c4948d0d512e9ec0366cf0adc | Create politeusersbot.py | kooldawgstar/PoliteUsersBot | politeusersbot.py | politeusersbot.py | #Polite Users Bot created by Kooldawgstar
import praw
from time import sleep
import random
USERNAME = "USERNAME"
PASSWORD = "PASSWORD"
LIMIT = 100
RESPONSES = ["Thanks for being a nice user and thanking people for help!",
"Thank you for being a nice user and thanking people for help!",
]
res... | mit | Python | |
94481f656690956b2a4eb5a1227948d24ba4cc05 | Add actual command line python function (#7) | msimet/Stile,msimet/Stile | bin/CCDSingleEpochStile.py | bin/CCDSingleEpochStile.py | #!/usr/bin/env python
from stile.lsst.base_tasks import CCDSingleEpochStileTask
CCDSingleEpochStileTask.parseAndRun()
| bsd-3-clause | Python | |
225d5232cca6bb42e39959b2330758225a748477 | add little script to retrieve URLs to PS1-DR1 images | legacysurvey/legacypipe,legacysurvey/legacypipe | py/legacyanalysis/get-ps1-skycells.py | py/legacyanalysis/get-ps1-skycells.py | import requests
from astrometry.util.fits import *
from astrometry.util.multiproc import *
def get_cell((skycell, subcell)):
url = 'http://ps1images.stsci.edu/cgi-bin/ps1filenames.py?skycell=%i.%03i' % (skycell, subcell)
print('Getting', url)
r = requests.get(url)
lines = r.text.split('\n')
#assert... | bsd-3-clause | Python | |
0f5ecc42485d4f0e89fbe202b57a2e7735ea69cc | Create product_images.py | lukebranch/product_images | product_images.py | product_images.py | from openerp.osv import osv, fields
class product_template(osv.Model):
_inherit = 'product.template'
_columns = {
'x_secondpicture': fields.binary("Second Image",
help="This field holds the second image used as image for the product, limited to 1024x1024px."),
}
product_template()
| mit | Python | |
e81f6e01ac55723e015c4d7d9d8f61467378325a | Add autoincrement to ZUPC.id | openmaraude/APITaxi,openmaraude/APITaxi | migrations/versions/e187aca7c77a_zupc_id_autoincrement.py | migrations/versions/e187aca7c77a_zupc_id_autoincrement.py | """ZUPC.id autoincrement
Revision ID: e187aca7c77a
Revises: ccd5b0142a76
Create Date: 2019-10-21 14:01:10.406983
"""
# revision identifiers, used by Alembic.
revision = 'e187aca7c77a'
down_revision = '86b41c3dbd00'
from alembic import op
from sqlalchemy.dialects import postgresql
from sqlalchemy.schema import Seque... | agpl-3.0 | Python | |
cc8b3f8a7fb6af29f16d47e4e4caf56f17605325 | Add command handler. | CheeseLord/warts,CheeseLord/warts | src/server/commandHandler.py | src/server/commandHandler.py | from src.shared.encode import decodePosition
class CommandHandler(object):
def __init__(self, gameState, connectionManager):
self.gameState = gameState
self.connectionManager = connectionManager
def broadcastMessage(self, *args, **kwargs):
self.connectionManager.broadcastMessage(*args... | mit | Python | |
be67baac2314408b295bddba3e5e4b2ca9bfd262 | Add ffs.exceptions | davidmiller/ffs,davidmiller/ffs | ffs/exceptions.py | ffs/exceptions.py | """
ffs.exceptions
Base and definitions for all exceptions raised by FFS
"""
class Error(Exception):
"Base Error class for FFS"
class DoesNotExistError(Error):
"Something should have been here"
| apache-2.0 | Python | |
2737e1d46263eff554219a5fa5bad060b8f219d3 | Add CLI script for scoring huk-a-buk. | dhermes/huk-a-buk,dhermes/huk-a-buk,dhermes/huk-a-buk,dhermes/huk-a-buk | score_hukabuk.py | score_hukabuk.py | import json
import os
import time
DATA = {'turns': {}}
class Settings(object):
FILENAME = None
CURRENT_TURN = 0
NAME_CHOICES = None
def set_filename():
filename = raw_input('Set the filename? ').strip()
if not filename:
filename = str(int(time.time()))
Settings.FILENAME = filename ... | apache-2.0 | Python | |
7f64a56a17fc6d73da4ac2987d42931885925db0 | Create server.py | amoffat/Chaos,eamanu/Chaos,chaosbot/Chaos,Chaosthebot/Chaos,amoffat/Chaos,mark-i-m/Chaos,phil-r/chaos,botchaos/Chaos,mpnordland/chaos,mark-i-m/Chaos,mpnordland/chaos,amoffat/Chaos,amoffat/Chaos,hongaar/chaos,Chaosthebot/Chaos,phil-r/chaos,rudehn/chaos,hongaar/chaos,eamanu/Chaos,eukaryote31/chaos,hongaar/chaos,mpnordlan... | server/server.py | server/server.py | import http.server
import socketserver
PORT = 80
Handler = http.server.SimpleHTTPRequestHandler
httpd = socketserver.TCPServer(("", PORT), Handler)
httpd.serve_forever()
| mit | Python | |
d599e5a35d4ac056dbefa8ec8af6c8be242c12f1 | Add test case for input pipeline. | google/flax,google/flax | linen_examples/wmt/input_pipeline_test.py | linen_examples/wmt/input_pipeline_test.py | # Copyright 2021 The Flax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | apache-2.0 | Python | |
be6997772bd7e39dd1f68d96b3d52a82372ad216 | update migartions | rapidpro/tracpro-old,rapidpro/tracpro-old | tracpro/supervisors/migrations/0002_auto_20141102_2231.py | tracpro/supervisors/migrations/0002_auto_20141102_2231.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('supervisors', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='supervisor',
opt... | agpl-3.0 | Python | |
0ccca70cf289fb219768d1a124cacf11396a0ecc | Add files via upload | SeanBeseler/data-structures | src/pque.py | src/pque.py | class Pque(object):
"""make as priority queue priority scale is 0 through -99
0 has greatest priority with ties being first come first pop"""
def __init__(self):
self.next_node = None
self.priority = 0
self.value = None
self.tail = None
self.head = None
s... | mit | Python | |
06235d5913cd5eb54d3767f6a7cf60acb1966b39 | Create prettyrpc.py | yan123/BitBox,yan123/QABox,yan123/QABox | prettyrpc.py | prettyrpc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from xmlrpclib import ServerProxy
class PrettyProxy(object):
def __init__(self, *args, **kwargs):
self._real_proxy = ServerProxy(*args, **kwargs)
def __getattr__(self, name):
return lambda *args, **kwargs: getattr(self._real_proxy, name)(args, kwa... | bsd-2-clause | Python | |
38faa038cbc7b8cedbb2dc13c2760f2a270a5f1a | Create problem-5.py | vnbrs/project-euler | problem-5.py | problem-5.py | n = 0
while True:
n += 1
divisible_list = []
for i in range(1,21):
is_divisible = (n % i == 0)
if is_divisible:
divisible_list.append(is_divisible)
else:
break
if len(divisible_list) == 20:
break
print(n)
| mit | Python | |
d326391f6412afb54ee05a02b3b11e075f703765 | fix value < 0 or higher than max. closes #941 | jegger/kivy,yoelk/kivy,cbenhagen/kivy,cbenhagen/kivy,bliz937/kivy,rnixx/kivy,ehealthafrica-ci/kivy,youprofit/kivy,el-ethan/kivy,viralpandey/kivy,rafalo1333/kivy,tony/kivy,niavlys/kivy,adamkh/kivy,aron-bordin/kivy,thezawad/kivy,inclement/kivy,yoelk/kivy,wangjun/kivy,manthansharma/kivy,matham/kivy,inclement/kivy,manthans... | kivy/uix/progressbar.py | kivy/uix/progressbar.py | '''
Progress Bar
============
.. versionadded:: 1.0.8
.. image:: images/progressbar.jpg
:align: right
The :class:`ProgressBar` widget is used to visualize progress of some task.
Only horizontal mode is supported, vertical mode is not available yet.
The progress bar has no interactive elements, It is a display-o... | '''
Progress Bar
============
.. versionadded:: 1.0.8
.. image:: images/progressbar.jpg
:align: right
The :class:`ProgressBar` widget is used to visualize progress of some task.
Only horizontal mode is supported, vertical mode is not available yet.
The progress bar has no interactive elements, It is a display-o... | mit | Python |
5e2e5eed760fdc40d474e511662cf7c22b1ea29b | add usbwatch.py | esjeon/graveyard,esjeon/graveyard,esjeon/graveyard,esjeon/graveyard,esjeon/graveyard,esjeon/graveyard,esjeon/graveyard,esjeon/graveyard,esjeon/graveyard,esjeon/graveyard | usbwatch.py | usbwatch.py | #!/usr/bin/env python3
# usbwatch.py - monitor addition/removal of USB devices
#
#
import pyudev
class UsbDevice:
@staticmethod
def fromUdevDevice(udev):
attr = lambda name: udev.attributes.asstring(name)
try:
try:
manufacturer = attr('manufacturer')
except KeyError:
manufactur... | mit | Python | |
ac7c3ccfdbd02eed6b2b7070160ef08f725c3578 | test migration | ACLeiChen/personalBlog,ACLeiChen/personalBlog,ACLeiChen/personalBlog,ACLeiChen/personalBlog | migrations/versions/5dc51870eece_initial_migration.py | migrations/versions/5dc51870eece_initial_migration.py | """initial migration
Revision ID: 5dc51870eece
Revises: None
Create Date: 2016-08-19 03:16:41.577553
"""
# revision identifiers, used by Alembic.
revision = '5dc51870eece'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust!... | mit | Python | |
61a4d783f2c16a7b8f4fbf5a79f9588c58c8f618 | Add a serial port emulation module for debug/development use | Robotma-com/candy-iot-service,Robotma-com/candy-iot-service | systemd/emulator_serialport.py | systemd/emulator_serialport.py |
class SerialPortEmurator:
def __init__(self):
self.res = {
'AT+CGDCONT?': [
"(ECHO_BACK)",
"",
"",
"+CGDCONT: 1,\"IPV4V6\",\"access_point_name\",\"0.0.0.0\",0,0",
"",
"OK",
""
],
'AT$QCPDPP?': [
"(ECHO_BACK)",
"",
"... | bsd-3-clause | Python | |
144541a563a4f05a762aea82f39bdd63f33c19d5 | Add tests for new membrane | waltermoreira/tartpy | tartpy/tests/test_membrane2.py | tartpy/tests/test_membrane2.py | import pytest
from tartpy.runtime import SimpleRuntime, behavior
from tartpy.eventloop import EventLoop
from tartpy.membrane2 import Membrane
def test_membrane_protocol():
runtime = SimpleRuntime()
evloop = EventLoop()
m1 = Membrane({'protocol': 'membrane'}, runtime)
m2 = Membrane({'protocol': '... | mit | Python | |
9c2be5533dc14443a67ed22c34e2f059992e43cb | Create camera.py | RoboticaBrasil/-ComputerVision | Camera/camera.py | Camera/camera.py | from SimpleCV import Camera
# Initialize the camera
cam = Camera()
# Loop to continuously get images
while True:
# Get Image from camera
img = cam.getImage()
# Make image black and white
img = img.binarize()
# Draw the text "Hello World" on image
img.drawText("Hello World!")
# Show the image... | apache-2.0 | Python | |
6014dab06ed2275c5703ab9f9e63272656733c69 | Add retrieve_all_pages util method from mtp-cashbook | ministryofjustice/django-utils,ministryofjustice/django-utils | moj_utils/rest.py | moj_utils/rest.py | from django.conf import settings
def retrieve_all_pages(api_endpoint, **kwargs):
"""
Some MTP apis are paginated, this method loads all pages into a single results list
:param api_endpoint: slumber callable, e.g. `[api_client].cashbook.transactions.locked.get`
:param kwargs: additional arguments to pa... | mit | Python | |
8d10e0e2db81023cb435b047f5c1da793e4b992e | Add python/matplotlib_.py | rstebbing/common,rstebbing/common | python/matplotlib_.py | python/matplotlib_.py | # matplotlib_.py
# Imports
from matplotlib import ticker
# label_axis
def label_axis(ax, x_or_y, axis_labels, flip, **props):
axis_ticks = range(0, len(axis_labels))
axis = getattr(ax, '%saxis' % x_or_y)
axis.set_major_locator(ticker.FixedLocator(axis_ticks))
axis.set_minor_locator(ticker.Nu... | mit | Python | |
de6d7c2531f59d407864c737468ae50de38ba9ac | Add some spanish bad words | wiki-ai/revscoring,he7d3r/revscoring,aetilley/revscoring,ToAruShiroiNeko/revscoring,eranroz/revscoring | revscoring/languages/spanish.regex.py | revscoring/languages/spanish.regex.py | # import re
# import warnings
# import enchant
# from nltk.corpus import stopwords
# from nltk.stem.snowball import SnowballStemmer
# from .language import Language, LanguageUtility
# STEMMER = SnowballStemmer("english")
# STOPWORDS = set(stopwords.words('english'))
BAD_REGEXES = set([
'ano',
'bastardo', 'bo... | mit | Python | |
326ef75042fc1d3eeeb6834fd5ff80a2bd1a2be1 | Add incoreect_regex.py solution | byung-u/ProjectEuler | HackerRank/PYTHON/Errors_and_Exceptions/incoreect_regex.py | HackerRank/PYTHON/Errors_and_Exceptions/incoreect_regex.py | #!/usr/bin/env python3
import re
if __name__ == '__main__':
for _ in range(int(input())):
try:
re.compile(input())
print('True')
except:
print('False')
| mit | Python | |
c675fe2a82733ef210bf287df277f8ae956a4295 | Add beginning of main script | jadams/rarbg-get | rarbg-get.py | rarbg-get.py | #!env /usr/bin/python3
import sys
import urllib.parse
import urllib.request
def main():
search = sys.argv[1]
url = 'http://rarbg.to/torrents.php?order=seeders&by=DESC&search='
url = url + search
print(url)
req = urllib.request.Request(url, headers={'User-Agent' : "Magic Browser"})
resp = urlli... | mit | Python | |
480ae590ea1116fdbb5c6601d7466408f274c433 | Implement for GNOME activateAutoLoginCommand | srguiwiz/nrvr-commander | src/nrvr/el/gnome.py | src/nrvr/el/gnome.py | #!/usr/bin/python
"""nrvr.el.gnome - Manipulate Enterprise Linux GNOME
Classes provided by this module include
* Gnome
To be improved as needed.
Idea and first implementation - Leo Baschy <srguiwiz12 AT nrvr DOT com>
Public repository - https://github.com/srguiwiz/nrvr-commander
Copyright (c) Nirvana Research 200... | bsd-2-clause | Python | |
6d12624e094ec58118d39c4340438c4a814d404f | add wildcard, this is just a string contain problem | luozhaoyu/leetcode,luozhaoyu/leetcode | wildcard.py | wildcard.py | class Solution:
# @param s, an input string
# @param p, a pattern string
# @return a boolean
def shrink(self, pattern):
shrinked = []
i = 0
while i < len(pattern):
stars = 0
questions = 0
while i < len(pattern) and pattern[i] in ['*', '?']:
... | mit | Python | |
00c86aff808ecc5b6f015da5977265cfa76826bb | add fixtures that start related worker for tests | moccu/django-livewatch | livewatch/tests/conftest.py | livewatch/tests/conftest.py | import pytest
import time
import django_rq
from celery.signals import worker_ready
from .celery import celery
WORKER_READY = list()
@worker_ready.connect
def on_worker_ready(**kwargs):
"""Called when the Celery worker thread is ready to do work.
This is to avoid race conditions since everything is in one ... | bsd-3-clause | Python | |
275cddfa56501868787abeef10fc515102ffd11d | make setup.py find all packages, now in src | Bengt/AL-FanControl,Bengt/AL-FanControl,Bengt/AL-FanControl | python/setup.py | python/setup.py | from distutils.core import setup
from setuptools import find_packages
setup(name='fancontrol',
version='0.1.0',
modules=['fancontrol'],
packages=find_packages(where="src"),
package_dir={"": "src"},
)
| mit | Python | |
a14ac8fb2f10124a4978db19049bdf932e91c49d | Add avahi based beacon for zeroconf announcement | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/beacons/avahi_announce.py | salt/beacons/avahi_announce.py | # -*- coding: utf-8 -*-
'''
Beacon to announce via avahi (zeroconf)
'''
# Import Python libs
from __future__ import absolute_import
import logging
# Import 3rd Party libs
try:
import avahi
HAS_PYAVAHI = True
except ImportError:
HAS_PYAVAHI = False
import dbus
log = logging.getLogger(__name__)
__virtual... | apache-2.0 | Python | |
9c5de3b667a8e98b0304fb64e30113f551b33404 | Create getTwitterData.py | Sapphirine/StockMarketAssistantApp | getTwitterData.py | getTwitterData.py | from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
import time
ckey = 'dNATh8K9vGwlOSR2phVzaB9fh'
csecret = 'LmBKfyfoZmK1uIu577yFR9jYkVDRC95CXcKZQBZ8jWx9qdS4Vt'
atoken = '2165798475-nuQBGrTDeCgXTOneasqSFZLd3SppqAJDmXNq09V'
asecret = 'FOVzgXM0NJO2lHFydFCiOXCZdkhHlYBkmP... | mit | Python | |
e84640c5c67759be3de1a934d974c250d7b73a0c | Split kernels into their own name space | matthew-brett/draft-statsmodels,matthew-brett/draft-statsmodels | scikits/statsmodels/sandbox/kernel.py | scikits/statsmodels/sandbox/kernel.py | # -*- coding: utf-8 -*-
"""
This models contains the Kernels for Kernel smoothing.
Hopefully in the future they may be reused/extended for other kernel based method
"""
class Kernel(object):
"""
Generic 1D Kernel object.
Can be constructed by selecting a standard named Kernel,
or providing a lambda exp... | bsd-3-clause | Python | |
632056eef0666808d16740f434a305d0c8995132 | Create magooshScraper.py | preeteshjain/vidpy | magooshScraper.py | magooshScraper.py | import scrapy
from bs4 import BeautifulSoup
class magooshSpider(scrapy.Spider):
name = 'magoosh'
start_urls = ['http://gre.magoosh.com/login']
def parse(self, response):
return scrapy.FormRequest.from_response(
response,
'''
Replace the fake text below with your own registered
email and password on h... | mit | Python | |
dbfc033fdfaad5820765a41766a5342831f3c4f9 | add util script to dump twitter oauth tokens | akrherz/iembot,akrherz/iembot | scripts/remove_twuser_oauth.py | scripts/remove_twuser_oauth.py | """Remove a twitter user's oauth tokens and reload iembot"""
from __future__ import print_function
import json
import sys
import psycopg2
import requests
def main(argv):
"""Run for a given username"""
screen_name = argv[1]
settings = json.load(open("../settings.json"))
pgconn = psycopg2.connect(datab... | mit | Python | |
77aa24bbea447d8684614f0d089320d134412710 | Test ini-configured app. | DasAllFolks/CrowdCure | test_app.py | test_app.py | from flask import Flask
from flask.ext.iniconfig import INIConfig
app = Flask(__name__)
INIConfig(app)
with app.app_context():
app.config.from_inifile('settings.ini')
| mit | Python | |
d1df2b573c515d3ea18ce46ccc58c8bc9e788915 | Clean commit | 3juholee/materialproject_ml,bismayan/MaterialsMachineLearning | src/pymatgen_pars.py | src/pymatgen_pars.py | import pymatgen as mg
from pymatgen.matproj.rest import MPRester
import pandas as pd
from pymatgen import Element,Composition
import multiprocessing as mp
import pickle
import json
from monty.json import MontyEncoder,MontyDecoder
import numpy as np
def ret_struct_obj(i):
return mg.Structure.from_str(i,fmt="cif")
... | mit | Python | |
74bde8878aa9b336046374ce75fc4c7bc63eaba7 | add test for VampSimpleHost | Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide | tests/test_vamp_simple_host.py | tests/test_vamp_simple_host.py | #! /usr/bin/env python
from unit_timeside import unittest, TestRunner
from timeside.decoder.file import FileDecoder
from timeside.core import get_processor
from timeside import _WITH_VAMP
from timeside.tools.test_samples import samples
@unittest.skipIf(not _WITH_VAMP, 'vamp-simple-host library is not available')
cla... | agpl-3.0 | Python | |
0d596f8c7148c2ac13c2b64be09ca1e20719cdb9 | add dumper of flowpaths to shapefile | akrherz/dep,akrherz/idep,akrherz/dep,akrherz/dep,akrherz/idep,akrherz/dep,akrherz/idep,akrherz/idep,akrherz/idep,akrherz/dep,akrherz/idep | scripts/util/dump_flowpaths.py | scripts/util/dump_flowpaths.py | """Dump flowpaths to a shapefile."""
from geopandas import read_postgis
from pyiem.util import get_dbconn
def main():
"""Go Main Go."""
pgconn = get_dbconn('idep')
df = read_postgis("""
SELECT f.fpath, f.huc_12, ST_Transform(f.geom, 4326) as geo from
flowpaths f, huc12 h WHERE h.scenario ... | mit | Python | |
345af55938baef0da1f0793d8a109fcee63692dd | Add files via upload | miradel51/preprocess | tokenize.py | tokenize.py | #!/usr/bin/python
#-*-coding:utf-8 -*-
# author: mld
# email: miradel51@126.com
# date : 2017/9/28
import sys
import string
import re
def tokenizestr(original_str):
after_tok = ""
#in order to encoding type, I only do like this and only use replace some special tokens without re.sub
#sym = "[$%#@~... | mit | Python | |
f7768b10df84a4b3bb784ee1d449e380b93d88bb | add a simple scan example | BladeSun/NliWithKnowledge,yang1fan2/nematus,nyu-dl/dl4mt-tutorial,yang1fan2/nematus,EdinburghNLP/nematus,BladeSun/NliWithKnowledge,cshanbo/nematus,yang1fan2/nematus,Proyag/nematus,rsennrich/nematus,vineetm/dl4mt-material,Proyag/nematus,BladeSun/NliWithKnowledge,cshanbo/nematus,cshanbo/nematus,BladeSun/NliWithKnowledge,... | data/scan_example.py | data/scan_example.py | import numpy
import theano
from theano import tensor
# some numbers
n_steps = 10
n_samples = 5
dim = 10
input_dim = 20
output_dim = 2
# one step function that will be used by scan
def oneStep(x_t, h_tm1, W_x, W_h, W_o):
h_t = tensor.tanh(tensor.dot(x_t, W_x) +
tensor.dot(h_tm1, W_h))
... | bsd-3-clause | Python | |
9737f8b1551adb5d3be62b1922de27d867ac2b24 | Add forwarding script for build-bisect.py. | timopulkkinen/BubbleFish,timopulkkinen/BubbleFish,markYoungH/chromium.src,dushu1203/chromium.src,pozdnyakov/chromium-crosswalk,hujiajie/pa-chromium,dednal/chromium.src,mohamed--abdel-maksoud/chromium.src,littlstar/chromium.src,patrickm/chromium.src,littlstar/chromium.src,keishi/chromium,PeterWangIntel/chromium-crosswal... | build/build-bisect.py | build/build-bisect.py | #!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
print "This script has been moved to tools/bisect-builds.py."
print "Please update any docs you're working from!"
sys.exit... | bsd-3-clause | Python | |
4c2663939008285c395ee5959c38fab280f43e58 | Create 03.PracticeCharsAndStrings.py | stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity | TechnologiesFundamentals/ProgrammingFundamentals/DataTypesAndVariables-Exercises/03.PracticeCharsAndStrings.py | TechnologiesFundamentals/ProgrammingFundamentals/DataTypesAndVariables-Exercises/03.PracticeCharsAndStrings.py | print(input())
print(input())
print(input())
print(input())
print(input())
| mit | Python | |
782e4da9d04c656b3e5290269a4f06328ee5d508 | add file | tkoyama010/Fibonacci | main.py | main.py | import numpy as np
@np.vectorize
def F(n):
return 1./np.sqrt(5.)*(((1.+np.sqrt(5))/2.)**n-((1.-np.sqrt(5))/2.)**n)
n = np.arange(10)
F = F(n)
np.savetxt("F.txt", F)
| mit | Python | |
ea0f02d6be95d0d8ef3081d49743702605467b51 | Add toy box | ReginaExMachina/royaltea-word-app,ReginaExMachina/royaltea-word-app | royalword.py | royalword.py | # Public: Toybox verison of W3 program.
#
# w3_dict - dictionary of interesting words.
# w3_defs - dictionary of definitions.
#
# Keys for both dicts are matching integers for word/defintion.
#
# word_display() - Displays a randomly generated word and its definition.
# learning_listed - Removes displayed word from main... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.