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 |
|---|---|---|---|---|---|---|---|---|
5a202606450db4705bf4ba82f5a5a88f06e6b1a4 | add basic tests for power command input/output encoding | openmotics/gateway,openmotics/gateway | testing/unittests/power_tests/power_api_test.py | testing/unittests/power_tests/power_api_test.py | # Copyright (C) 2020 OpenMotics BV
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribu... | agpl-3.0 | Python | |
b2f57b6deea494dc4bf239bbb9b9b5c67c552bc5 | Create caesar.py | joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle | code/caesar.py | code/caesar.py | import sys
alphabet = "abcdefghijklmnopqrstuvwxyz"
ciphered = ""
for l in sys.argv[1]:
if l in alphabet:
ciphered += alphabet[26 - alphabet.index(l)]
else:
ciphered += l
print ciphered
| bsd-2-clause | Python | |
33aba6bdcc4908269aa42186dc3afcf31f409716 | add debug to local | JessicaNgo/TeleGiphy,JessicaNgo/TeleGiphy | tele_giphy/tele_giphy/settings/local.py | tele_giphy/tele_giphy/settings/local.py | from .base import *
INSTALLED_APPS = INSTALLED_APPS + [
'debug_toolbar',
]
ALLOWED_HOSTS = ['poenbwu.pythonanywhere.com', 'localhost']
DEBUG = False
| mit | Python | |
45c97836b5728b1894d134db727945b040d06711 | Create hello.py | kaarthikvm/HelloWorld | hello.py | hello.py | #!/usr/bin/python
print 'hello world'
| apache-2.0 | Python | |
6906e0b19ff043c14c38f8c46e581de76cb4df9f | Add util.security module. | hustlzp/Flask-Boost,1045347128/Flask-Boost,1045347128/Flask-Boost,hustlzp/Flask-Boost,hustlzp/Flask-Boost,1045347128/Flask-Boost,hustlzp/Flask-Boost,1045347128/Flask-Boost | flask_boost/project/application/utils/security.py | flask_boost/project/application/utils/security.py | __author__ = 'hustlzp'
| mit | Python | |
83bc29b3dc9162ed4153b271113878e496f39c21 | Add jsonpath utility module | Kitware/cumulus,Kitware/cumulus | cumulus/common/jsonpath.py | cumulus/common/jsonpath.py | from jsonpath_rw import parse
def get_property(path, doc, default=None):
prop = parse(path).find(doc)
if prop:
prop = prop[0].value
else:
prop = default
return prop
| apache-2.0 | Python | |
523f371d79ad9c975bde83e2d6d5900ed21e038c | create new task to load back data removed by housekeeping | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend | cla_backend/apps/cla_butler/management/commands/reverthousekeeping.py | cla_backend/apps/cla_butler/management/commands/reverthousekeeping.py | # -*- coding: utf-8 -*-
import os
from django.conf import settings
from django.contrib.admin.models import LogEntry
from django.core.management.base import BaseCommand
from cla_eventlog.models import Log
from diagnosis.models import DiagnosisTraversal
from legalaid.models import Case, EligibilityCheck, CaseNotesHisto... | mit | Python | |
cb5f3e0d8d16ec86a9ed679273c61ec2d65de3be | add cralwer demo | PegasusWang/articles,PegasusWang/articles,PegasusWang/articles | crawler/thread_pool_spider.py | crawler/thread_pool_spider.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import Queue
import sys
import requests
import os
import threading
import time
class Worker(threading.Thread): # 处理工作请求
def __init__(self, workQueue, resultQueue, **kwds):
threading.Thread.__init__(self, **kwds)... | mit | Python | |
edb397490ee1a200201c78338cbcfeb8203813b1 | make plot of negative binomial | probml/pyprobml,probml/pyprobml,probml/pyprobml,probml/pyprobml | scripts/negbinom_plot.py | scripts/negbinom_plot.py |
import numpy as np
import matplotlib.pyplot as plt
import os
#figdir = os.path.join(os.environ["PYPROBML"], "figures")
figdir = "../figures";
def save_fig(fname): plt.savefig(os.path.join(figdir, fname))
from scipy.stats import nbinom
xs = np.arange(50);
fig, ax = plt.subplots(1,1)
p = 0.5; r = 1;
probabilities ... | mit | Python | |
5dbf65e63d942b78fd1fc28133ba0bc19c429d23 | Use Gravatar default icon | Phoenix1369/site,DMOJ/site,Minkov/site,monouno/site,Minkov/site,monouno/site,DMOJ/site,monouno/site,Minkov/site,DMOJ/site,monouno/site,Phoenix1369/site,Phoenix1369/site,monouno/site,Minkov/site,DMOJ/site,Phoenix1369/site | judge/templatetags/gravatar.py | judge/templatetags/gravatar.py | ### gravatar.py ###############
### place inside a 'templatetags' directory inside the top level of a Django app (not project, must be inside an app)
### at the top of your page template include this:
### {% load gravatar %}
### and to use the url do this:
### <img src="{% gravatar_url 'someone@somewhere.com' %}">
### ... | ### gravatar.py ###############
### place inside a 'templatetags' directory inside the top level of a Django app (not project, must be inside an app)
### at the top of your page template include this:
### {% load gravatar %}
### and to use the url do this:
### <img src="{% gravatar_url 'someone@somewhere.com' %}">
### ... | agpl-3.0 | Python |
8d64e192dc17bd09e21ec952ff73fab8efaf5db6 | Create new package. (#6479) | iulian787/spack,iulian787/spack,mfherbst/spack,tmerrick1/spack,iulian787/spack,matthiasdiener/spack,iulian787/spack,krafczyk/spack,matthiasdiener/spack,matthiasdiener/spack,mfherbst/spack,mfherbst/spack,LLNL/spack,krafczyk/spack,tmerrick1/spack,krafczyk/spack,EmreAtes/spack,matthiasdiener/spack,EmreAtes/spack,tmerrick1... | var/spack/repos/builtin/packages/r-topgo/package.py | var/spack/repos/builtin/packages/r-topgo/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 | |
50d7467715b4dd87ac055bba1c6d63d11638eb19 | Add new package: tengine (#18305) | LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/tengine/package.py | var/spack/repos/builtin/packages/tengine/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 Tengine(AutotoolsPackage):
"""A distribution of Nginx with some advanced features."""
... | lgpl-2.1 | Python | |
a829da656fa637ed8516993ea7df477ac28eda9a | Add basic NICKNAMEINUSE handling | ayust/kitnirc | kitnirc/contrib/nick_in_use.py | kitnirc/contrib/nick_in_use.py | import logging
from kitnirc.modular import Module
from kitnirc.client import parser
from random import randint
_log = logging.getLogger(__name__)
class NickInUseModule(Module):
"""A KitnIRC module which adds a random number between 0-9
if the configured nick is already in use"""
@Module.handle("NICKNA... | mit | Python | |
14a08483bcdcb5b594f35b5996e5660556f3ac50 | add solution for Search Insert Position | zhyu/leetcode,zhyu/leetcode | src/searchInsertPosition.py | src/searchInsertPosition.py | class Solution:
# @param A, a list of integers
# @param target, an integer to be inserted
# @return integer
def searchInsert(self, A, target):
l, r = 0, len(A)-1
while l <= r:
mid = (l+r)/2
if A[mid] < target:
l = mid+1
elif A[mid] > t... | mit | Python | |
087ba4c6bb7f268eb11584e4dbcf449e08fcaf0b | Add a script for saving paired posture/jacobian arrays. | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment | analysis/10-extract-jacobian-chunks.py | analysis/10-extract-jacobian-chunks.py | import climate
import joblib
import numpy as np
def extract(trial, output, frames):
dirname = os.path.join(output, trial.subject.key)
pattern = '{}-{}-{{}}.npy'.format(trial.block.key, trial.key)
if not os.path.isdir(dirname):
os.makedirs(dirname)
def save(key, arr):
out = os.path.joi... | mit | Python | |
94447b7382d29b8dc995b949a472305f3fcfadce | Add execute_in_main_thread function decorator to make synchronous inter-thread calls. | franekp/ankidict,franekp/millandict,franekp/ankidict,franekp/ankidict,franekp/millandict,franekp/ankidict | ankidict/addon/main_thread_executor.py | ankidict/addon/main_thread_executor.py | """Helper module delivering function decorator 'executes_in_main_thread'.
Functions decorated with this decorators may be called from any thread except
the main thread (in which case the main thread blocks forever). The calling
thread DON'T HAVE TO be a QThread, can be a vanilla python thread.
Any function decorated ... | unknown | Python | |
854155a6d6ed8ad82f84c161704b4bbb78e04da5 | add support for 'auth' option for geolytica driver | DenisCarriere/geocoder,akittas/geocoder | geocoder/geolytica.py | geocoder/geolytica.py | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
from geocoder.base import Base
class Geolytica(Base):
"""
Geocoder.ca
===========
A Canadian and US location geocoder.
API Reference
-------------
http://geocoder.ca/?api=1
"""
provider = 'geolytica'
meth... | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
from geocoder.base import Base
class Geolytica(Base):
"""
Geocoder.ca
===========
A Canadian and US location geocoder.
API Reference
-------------
http://geocoder.ca/?api=1
"""
provider = 'geolytica'
meth... | mit | Python |
4b11769c31a3ff59738fa4db8b63f18498054e58 | Add Python script to create charts | chrishantha/performance-apim,chrishantha/performance-apim,chrishantha/performance-apim | distribution/scripts/jmeter/create-charts.py | distribution/scripts/jmeter/create-charts.py | #!/usr/bin/env python3.6
# Copyright 2017 WSO2 Inc. (http://wso2.org)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | apache-2.0 | Python | |
b57ceafbb91d224ae8ad470c3fdee60357a89b95 | Add test for ResourceLister | rantav/flask-restful-swagger,rantav/flask-restful-swagger,rantav/flask-restful-swagger | tests/test_resource_lister.py | tests/test_resource_lister.py | from unittest.mock import patch
from flask_restful_swagger.swagger import ResourceLister
@patch("flask_restful_swagger.swagger.render_page")
@patch("flask_restful_swagger.swagger._get_current_registry")
def test_get_valid_content_renders(registry, render_page):
expected_result = {
"apiVersion": "mock_ve... | mit | Python | |
5990db09f2a41e23ca6d107737f468d2b01c56a9 | Update ale_run_watch.py to use restricted_action_set | udibr/deep_q_rl,gogobebe2/deep_q_rl,udibr/deep_q_rl,jcatw/deep_q_rl,npow/deep_q_rl,jleni/deep_q_rl,sygi/deep_q_rl,spragunr/deep_q_rl,codeaudit/deep_q_rl,sygi/deep_q_rl,aaannndddyyy/deep_q_rl,gogobebe2/deep_q_rl,jleni/deep_q_rl,r0k3/deep_q_rl,r0k3/deep_q_rl,omnivert/deep_q_rl,alito/deep_q_rl,aaannndddyyy/deep_q_rl,vvw/d... | deep_q_rl/ale_run_watch.py | deep_q_rl/ale_run_watch.py | """ This script runs a pre-trained network with the game
visualization turned on.
Usage:
ale_run_watch.py NETWORK_PKL_FILE
"""
import subprocess
import os
import sys
my_env = os.environ.copy()
my_env["RLGLUE_PORT"] = "4097"
# Put your binaries under the directory 'deep_q_rl/roms'
ROM_PATH = "../roms/breakout.bin"
... | """ This script runs a pre-trained network with the game
visualization turned on.
Usage:
ale_run_watch.py NETWORK_PKL_FILE
"""
import subprocess
import os
import sys
my_env = os.environ.copy()
my_env["RLGLUE_PORT"] = "4097"
ROM_PATH = "/home/spragunr/neural_rl_libraries/roms/breakout.bin"
p1 = subprocess.Popen(['r... | bsd-3-clause | Python |
cc341fdc25d2bcd08d8a291f82e62126adc1090e | add missing file | Distrotech/libkate,Distrotech/libkate | tools/KateDJ/kdj/constants.py | tools/KateDJ/kdj/constants.py | #!/usr/bin/env python
kdj_name='KateDJ'
kdj_version='0.3.0'
kdj_name_version=kdj_name+' '+kdj_version
| bsd-3-clause | Python | |
c61eba188c76454b9ba3f474b027c4af30c0fee0 | add test for signup process | harisibrahimkv/wye,shankisg/wye,harisibrahimkv/wye,pythonindia/wye,shankisg/wye,harisibrahimkv/wye,DESHRAJ/wye,shankisg/wye,shankig/wye,harisibrahimkv/wye,shankig/wye,DESHRAJ/wye,shankig/wye,shankisg/wye,pythonindia/wye,pythonindia/wye,pythonindia/wye,shankig/wye,DESHRAJ/wye,DESHRAJ/wye | tests/functional/test_signup_process.py | tests/functional/test_signup_process.py | import pytest
import re
pytestmark = pytest.mark.django_db
def test_signup_flow(base_url, browser, outbox):
# Sign-Up option should be present there
browser.visit(base_url)
sign_up_link = browser.find_by_text('Sign Up')[0]
assert sign_up_link
# On Clicking it, it should open a Sign Up Page
... | mit | Python | |
7b6fdafe78a94d7305489fda52c940a6b97d5698 | remove privacy_policy_accepted field migration | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0007_remove_privacy_policy_accepted_fields.py | accelerator/migrations/0007_remove_privacy_policy_accepted_fields.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-05-21 09:54
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accelerator', '0006_add_privacy_notice_legal_check'),
]
operations = [
migrations.R... | mit | Python | |
537859fbcc420fb03d8a23fd848926b31514489a | change version | RDXT/django-userena,RDXT/django-userena,RDXT/django-userena | userena/__init__.py | userena/__init__.py | """
Django accounts management made easy.
"""
default_app_config = 'userena.apps.UserenaConfig'
VERSION = (2, 0, 2)
__version__ = '.'.join((str(each) for each in VERSION[:4]))
def get_version():
"""
Returns string with digit parts only as version.
"""
return '.'.join((str(each) for each in VERSION... | """
Django accounts management made easy.
"""
default_app_config = 'userena.apps.UserenaConfig'
VERSION = (2, 0, 1)
__version__ = '.'.join((str(each) for each in VERSION[:4]))
def get_version():
"""
Returns string with digit parts only as version.
"""
return '.'.join((str(each) for each in VERSION... | bsd-3-clause | Python |
c0bf2e945d0365a061eb39a4cf48463b2f5de381 | Create createfiles.py | ccjj/andropy | createfiles.py | createfiles.py | import cfgtemplate
import subprocess
import os
import errno
import shlex
from shutil import copyfile
import time
def writeFile(content, fpath):
f = open(fpath,"w")
f.write(content)
f.close()
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os... | mit | Python | |
936c1862799ffd76538293d90ea49c5fe7dab728 | reshape parsing in c++ | sony/nnabla,sony/nnabla,sony/nnabla | python/test/cpp/test_nbla.py | python/test/cpp/test_nbla.py | # Copyright (c) 2017 Sony Corporation. 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 applicabl... | apache-2.0 | Python | |
b183cb3222ca4b434f4dfda3d56726a2a0c46cc3 | Add Statusable mixin | plamut/ggrc-core,NejcZupec/ggrc-core,VinnieJohns/ggrc-core,NejcZupec/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core,andrei-karalionak/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,prasannav7/ggrc-core,selahssea/ggrc-core,AleksNeStu/ggrc-core,josthkko/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,Ne... | src/ggrc/models/mixins_statusable.py | src/ggrc/models/mixins_statusable.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: urban@reciprocitylabs.com
# Maintained By: urban@reciprocitylabs.com
"""A mixin for objects with statuses"""
from ggrc import db
class Statusabl... | apache-2.0 | Python | |
f1a4a3a4e701cc6337d4a62e8e287eb4c452af30 | Create chatbot.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/juerg/chatbot.py | home/juerg/chatbot.py | # file : chatbot.py
#aimlPath = "c:\mrl\marvinDialog"
aimlPath = "C:\mrl\mrl_2132\inmoov\inmoovVocal"
aimlBotName = "de"
aimlUserName = "juerg"
botVoice = "dfki-pavoque-neutral-hsmm"
# Start InMoov
i01 = Runtime.createAndStart("i01","InMoov")
######################################################################
# c... | apache-2.0 | Python | |
ccc770a561db6375dd5b8b5fb7fcee574b4a7e7c | add validate-a-roman-number | EdisonAlgorithms/HackerRank,zeyuanxy/hacker-rank,EdisonCodeKeeper/hacker-rank,zeyuanxy/hacker-rank,zeyuanxy/hacker-rank,EdisonCodeKeeper/hacker-rank,EdisonCodeKeeper/hacker-rank,EdisonCodeKeeper/hacker-rank,EdisonAlgorithms/HackerRank,EdisonAlgorithms/HackerRank,zeyuanxy/hacker-rank,EdisonAlgorithms/HackerRank,EdisonCo... | contest/pythonist/validate-a-roman-number/validate-a-roman-number.py | contest/pythonist/validate-a-roman-number/validate-a-roman-number.py | # -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2016-04-14 21:02:15
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2016-04-14 21:02:24
def generate_roman_number(i):
ret = ''
ret += 'M' * (i / 1000)
ret += ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM'][i / 100 % 10]
r... | mit | Python | |
44526c447fc54dac4a06899001a701eb1bb54390 | Create leads.py | SamGriffith3/hot_list | leads.py | leads.py | # Imports
import csv
import OS
import tkinter
# Process Level Variables
username = input("Lead Name")
| mit | Python | |
7b33ea38283c9e9f00a2aacaa17634e50e55e42b | Migrate auth for django 1.8 | kriberg/stationspinner,kriberg/stationspinner | stationspinner/accounting/migrations/0005_auto_20150919_2207.py | stationspinner/accounting/migrations/0005_auto_20150919_2207.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
import django.contrib.auth.models
class Migration(migrations.Migration):
dependencies = [
('accounting', '0004_apikey_brokeness'),
]
operations = [
migr... | agpl-3.0 | Python | |
c4430c857c8f5f8568683695925d49e6e5af8ae2 | add test for database migration | Mushiyo/isso,WQuanfeng/isso,posativ/isso,xuhdev/isso,jelmer/isso,jelmer/isso,janusnic/isso,commentedit/commented.it,commentedit/commented.it,Mushiyo/isso,jiumx60rus/isso,princesuke/isso,mathstuf/isso,commentedit/commented.it,Mushiyo/isso,mathstuf/isso,WQuanfeng/isso,xuhdev/isso,jelmer/isso,posativ/isso,jelmer/isso,xuhd... | isso/tests/test_db.py | isso/tests/test_db.py |
try:
import unittest2 as unittest
except ImportError:
import unittest
import os
import sqlite3
import tempfile
from isso.db import SQLite3
from isso.core import Config
class TestDBMigration(unittest.TestCase):
def setUp(self):
fd, self.path = tempfile.mkstemp()
def tearDown(self):
... | mit | Python | |
c1e9ba79b3bd88de6380c5b908c1c3efc74bb579 | define a simple KalmanFilter class | claymation/lander | src/py/lander/lib/kalman.py | src/py/lander/lib/kalman.py | #!/usr/bin/env python
# vim: set ts=4 sw=4 et:
import numpy
class KalmanFilter(object):
"""
Discretized continuous-time Kalman filter.
"""
def __init__(self, F, B, H, x, P, Q, R):
self.F = F # state transition matrix
self.B = B # control model matrix
self.H = H # measuremen... | mit | Python | |
7213a3098fd785430921cb5fb4a2921cb9beafee | remove caching for now | Ladaniels/censusreporter,4bic/censusreporter,danilito19/censusreporter,Code4SA/censusreporter,qshng522/censusreporter,qshng522/censusreporter,uscensusbureau/censusreporter,qshng522/censusreporter,danilito19/censusreporter,sseguku/simplecensusug,Ladaniels/censusreporter,sseguku/simplecensusug,censusreporter/censusreport... | censusreporter/config/prod/settings.py | censusreporter/config/prod/settings.py | from config.base.settings import *
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ROOT_URLCONF = 'config.prod.urls'
WSGI_APPLICATION = "config.prod.wsgi.application"
ALLOWED_HOSTS = [
'174.129.183.221',
'.censusreporter.org',
]
#CACHES = {
# 'default': {
# 'BACKEND': 'django.core.cache.backends.memcached.Mem... | from config.base.settings import *
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ROOT_URLCONF = 'config.prod.urls'
WSGI_APPLICATION = "config.prod.wsgi.application"
ALLOWED_HOSTS = [
'174.129.183.221',
'.censusreporter.org',
]
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.Memcac... | mit | Python |
23b4ad3b028e674307fdc6cc7a72953150fd0be3 | Add a redis_check management command | bitemyapp/zulip,cosmicAsymmetry/zulip,mahim97/zulip,jessedhillon/zulip,esander91/zulip,Diptanshu8/zulip,JPJPJPOPOP/zulip,akuseru/zulip,RobotCaleb/zulip,m1ssou/zulip,ApsOps/zulip,AZtheAsian/zulip,themass/zulip,vabs22/zulip,zhaoweigg/zulip,wangdeshui/zulip,rishig/zulip,alliejones/zulip,ashwinirudrappa/zulip,Gabriel0402/z... | zephyr/management/commands/check_redis.py | zephyr/management/commands/check_redis.py | from __future__ import absolute_import
from zephyr.models import UserProfile, get_user_profile_by_id
from zephyr.lib.rate_limiter import redis_key, client, max_api_calls, max_api_window
from django.core.management.base import BaseCommand
from django.conf import settings
from optparse import make_option
import os, ti... | apache-2.0 | Python | |
4470576ed7141bf69ee551b014bc8ed286e8c495 | add jsondata plugin | melmothx/jsonbot,melmothx/jsonbot,melmothx/jsonbot | commonplugs/jsondata.py | commonplugs/jsondata.py | # commonplugs/jsondata.py
#
#
"""
expose data through the jsonserver plugin. this is done by adding a
"public" attribute on the data.
"""
## gozerlib imports
from gozerlib.commands import cmnds
from gozerlib.examples import examples
from gozerlib.persist import Persist
from gozerlib.utils.exception impor... | mit | Python | |
29ed484c77ab1c68c5e81f06a527da49713ee427 | Add solution for problem 20 | cifvts/PyEuler | euler020.py | euler020.py | #!/usr/bin/python
from math import factorial
fact = str(factorial(100))
result = 0
for i in range(len(fact)):
result += int(fact[i])
print(result)
| mit | Python | |
0472f5896a7671d53f9ebf6857448d01a9bda01f | add test for sending email | hddn/studentsdb,hddn/studentsdb,hddn/studentsdb | students/tests/test_contact_admin.py | students/tests/test_contact_admin.py | from django.contrib.auth.models import User
from django.core import mail
from django.test import Client, TestCase
from django.urls import reverse
class ContactAdminTest(TestCase):
"""Test for Contact Admin form"""
@classmethod
def setUpTestData(cls):
User.objects.create_user(id=1, username='admin... | mit | Python | |
a69f6677e46c2c97e1231763ed921a91a186e728 | Create ged20cmd.py | digitalbond/Basecamp,digitalbond/Basecamp | ged20cmd.py | ged20cmd.py | #!/usr/bin/python
#
# The GE D20 (and possibly other GE D series) use a backdoor tftp command channel using two special files
# To issue a command, send a file "MONITOR:command.log" to the target.
# To read the command response, retrieve the file "MONITOR:response.log"
# The file command.log must be formatted as follow... | mit | Python | |
073bcb1f6f495305c9d02300646e269fcd2b920e | Add migration (autogenerated via `manage.py makemigrations`) | healthchecks/healthchecks,iphoting/healthchecks,healthchecks/healthchecks,iphoting/healthchecks,healthchecks/healthchecks,iphoting/healthchecks,healthchecks/healthchecks,iphoting/healthchecks | hc/api/migrations/0059_auto_20190314_1744.py | hc/api/migrations/0059_auto_20190314_1744.py | # Generated by Django 2.1.7 on 2019-03-14 17:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0058_auto_20190312_1716'),
]
operations = [
migrations.AlterField(
model_name='channel',
name='kind',
... | bsd-3-clause | Python | |
f6342bcdbaff50254d495e8f502b77a7a68d450b | add migration to update sitetree panels view url | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0076_update_sitetree_panels_view_url.py | accelerator/migrations/0076_update_sitetree_panels_view_url.py | # Generated by Django 2.2.10 on 2021-11-24 16:41
from django.db import migrations
def update_panels_url(apps, schema_editor):
NavTreeItem = apps.get_model('accelerator', 'NavTreeItem')
NavTreeItem.objects.filter(url='/panels/').update(url='/judging/panels/')
class Migration(migrations.Migration):
depen... | mit | Python | |
75f69d02100e4f804fd6e742841c0e5ecb1731d2 | Implement Prim's MST in Python | andreimaximov/algorithms,andreimaximov/algorithms,andreimaximov/algorithms,andreimaximov/algorithms | algorithms/graph-theory/prims-mst-special-subtree/prims-mst.py | algorithms/graph-theory/prims-mst-special-subtree/prims-mst.py | #!/usr/bin/env python
import sys
from queue import PriorityQueue
class Graph(object):
"""
Represents a graph using an adjacency list.
"""
def __init__(self, N):
self.nodes = [None] * N
def add_undir_edge(self, x, y, r):
self.add_dir_edge(x, y, r)
self.add_dir_edge(y, x, r... | mit | Python | |
5b29eaacb363501c9596061a1bd197c49bb00db3 | Add crypto listing management qa test and test listings index. | OpenBazaar/openbazaar-go,gubatron/openbazaar-go,hoffmabc/openbazaar-go,hoffmabc/openbazaar-go,OpenBazaar/openbazaar-go,hoffmabc/openbazaar-go,gubatron/openbazaar-go,OpenBazaar/openbazaar-go,gubatron/openbazaar-go | qa/manage_crypto_listings.py | qa/manage_crypto_listings.py | import requests
import json
import time
from collections import OrderedDict
from test_framework.test_framework import OpenBazaarTestFramework, TestFailure
class ManageCryptoListingsTest(OpenBazaarTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 1
def run_test(self):
... | mit | Python | |
a73cab0b3dec4f0a8ebf4569c0cfcd87220c1667 | Add initial definition of takeaway item | leaffan/pynhldb | db/takeaway.py | db/takeaway.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import uuid
from db.common import Base
from db.specific_event import SpecificEvent
from db.event import Event
from db.player import Player
class Takeaway(Base, SpecificEvent):
__tablename__ = 'takeaways'
__autoload__ = True
STANDARD_ATTRS = [
"team_... | mit | Python | |
b53adee169aec3bb9c6953872ecc51e1b0a4d665 | Create cifar.py | pjavia/GAN | dcgan/cifar.py | dcgan/cifar.py | import cPickle
import numpy as np
import cv2
repository = []
for i in range(1, 6):
name = 'cifar/data_batch_'+str(i)
with open(name, 'rb') as fo:
data = cPickle.load(fo)
collect = data.get('data')
for j in collect:
red = []
green = []
blue = []
image = []
... | mit | Python | |
7bb6080775b53ade52ed7ed69351e1eff173aa43 | add tests for production.api | Fresnoy/kart,Fresnoy/kart | production/tests/test_api.py | production/tests/test_api.py | import pytest
from diffusion.tests.conftest import * # noqa
from utils.tests.conftest import * # noqa
from utils.tests.utils import HelpTestForReadOnlyModelRessource
from .. import api
@pytest.mark.django_db
class TestStaffTaskRessource(HelpTestForReadOnlyModelRessource):
model = api.StaffTaskResource
fi... | agpl-3.0 | Python | |
3f5b3d21d564f6d6d53ee53ee241ff0877db3550 | add merge | jesseklein406/data-structures | merge.py | merge.py |
def merge_sort(lst):
if len(lst) <= 1:
return lst
middle = len(lst) // 2
left = lst[:middle]
right = lst[middle:]
sort_left = merge_sort(left)
sort_right = merge_sort(right)
return merge(sort_left, sort_right)
def merge(left, right):
sort = []
l_index = 0
r_index =... | mit | Python | |
6495689e97f1c3b82f33e0e563128d17f42caf9c | Add migration script | privacyidea/privacyidea,privacyidea/privacyidea,privacyidea/privacyidea,privacyidea/privacyidea,privacyidea/privacyidea,privacyidea/privacyidea | migrations/versions/19f727d285e2_.py | migrations/versions/19f727d285e2_.py | """Add monitoringstats table
Revision ID: 19f727d285e2
Revises: 2c9430cfc66b
Create Date: 2018-07-03 11:45:57.967604
"""
# revision identifiers, used by Alembic.
revision = '19f727d285e2'
down_revision = '2c9430cfc66b'
from alembic import op
import sqlalchemy as sa
def upgrade():
try:
op.create_table(... | agpl-3.0 | Python | |
a29540ea36ab4e73ba3d89fc8ed47022af28b482 | Add tests for the build media storage | rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org | readthedocs/rtd_tests/tests/test_build_storage.py | readthedocs/rtd_tests/tests/test_build_storage.py | import os
import shutil
import tempfile
from django.test import TestCase
from readthedocs.builds.storage import BuildMediaFileSystemStorage
files_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'files')
class TestBuildMediaStorage(TestCase):
def setUp(self):
self.test_media_dir = tempfi... | mit | Python | |
69efe16d07b05bc00f03ee417e7cd393e9bd5cd8 | test for ambiguities | ContinuumIO/blaze,caseyclements/blaze,scls19fr/blaze,scls19fr/blaze,ChinaQuants/blaze,jcrist/blaze,cowlicks/blaze,LiaoPan/blaze,alexmojaki/blaze,mrocklin/blaze,mrocklin/blaze,cowlicks/blaze,ChinaQuants/blaze,nkhuyu/blaze,cpcloud/blaze,maxalbert/blaze,jcrist/blaze,dwillmer/blaze,dwillmer/blaze,caseyclements/blaze,alexmo... | blaze/tests/test_core.py | blaze/tests/test_core.py | from blaze import into, compute_one
from multipledispatch.conflict import ambiguities
def test_into_non_ambiguous():
assert not ambiguities(into.funcs)
def test_compute_one_non_ambiguous():
assert not ambiguities(compute_one.funcs)
| bsd-3-clause | Python | |
7ed7cab1cc41fea7665d9e9c05cbb2eb097486a3 | Add migration for vaccine appointment update. | SaturdayNeighborhoodHealthClinic/clintools,SaturdayNeighborhoodHealthClinic/clintools,SaturdayNeighborhoodHealthClinic/clintools | appointment/migrations/0002_vaccineappointment_20181031_1852.py | appointment/migrations/0002_vaccineappointment_20181031_1852.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2018-10-31 23:52
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('appointment', '0001_initial'),
]
... | mit | Python | |
c8216887be501d4fde548c89b66a3d02e3ccfc05 | work on the new clean c-bridge | bh107/bohrium,bh107/bohrium,bh107/bohrium,madsbk/bohrium,madsbk/bohrium,madsbk/bohrium,madsbk/bohrium,bh107/bohrium | bridge/c/gen_specials.py | bridge/c/gen_specials.py | #!/usr/bin/env python
import json
import os
from os.path import join, exists
import argparse
def main(args):
prefix = os.path.abspath(os.path.dirname(__file__))
# Let's read the opcode and type files
with open(join(prefix,'..','cpp','codegen','element_types.json')) as f:
types = json.loads(f.re... | apache-2.0 | Python | |
ed1e61bcfeb830050b21c470a9ae66ab318d28ee | add logging02.py | devlights/try-python | trypython/stdlib/logging02.py | trypython/stdlib/logging02.py | """
logging モジュールのサンプルです。
最も基本的な使い方について (ファイルへの出力)
"""
import logging
import pathlib
import tempfile
from trypython.common.commoncls import SampleBase
class Sample(SampleBase):
def exec(self):
"""サンプル処理を実行します。"""
# ----------------------------------------------------------------------------------... | mit | Python | |
b334afa763aea80b8c611b5e001331c1394c3c46 | Solve #090 | abawchen/leetcode | 090_subsets_ii.py | 090_subsets_ii.py | # Given a collection of integers that might contain duplicates, nums, return all possible subsets.
# Note:
# Elements in a subset must be in non-descending order.
# The solution set must not contain duplicate subsets.
# For example,
# If nums = [1,2,2], a solution is:
# [
# [2],
# [1],
# [1,2,2],
# [2,2... | mit | Python | |
359bda3c207ce7859818527f34a235234796ec21 | Create solution.py | lilsweetcaligula/Algorithms,lilsweetcaligula/Algorithms,lilsweetcaligula/Algorithms | data_structures/linked_list/problems/count_bobs/py/solution.py | data_structures/linked_list/problems/count_bobs/py/solution.py | import LinkedList
# Problem description: Given a string represented as a linked list of characters, count the occurrence
# of a substring "bob" in the original string.
# Solution time complexity: O(Kn), where K = len(src) = len('bob') = 3
# Comments: Recursive solution.
... | mit | Python | |
694579a39126cb6a5c3008e63a341b7bb2c57779 | Add 258-add-digits.py | mvj3/leetcode | 258-add-digits.py | 258-add-digits.py | """
Question:
Add Digits
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.
For example:
Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it.
Follow up:
Could you do it without any loop/recursion ... | mit | Python | |
5ba6f50cf73b7df9a48f281ca73f1fc411b19094 | add missing migration | unicef/un-partner-portal,unicef/un-partner-portal,unicef/un-partner-portal,unicef/un-partner-portal | backend/unpp_api/apps/partner/migrations/0080_auto_20181008_0845.py | backend/unpp_api/apps/partner/migrations/0080_auto_20181008_0845.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-10-08 08:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('partner', '0079_auto_20180927_0928'),
]
operations = [
migrations.AlterFie... | apache-2.0 | Python | |
c46731098c6a8f26e4de899d2d2e083734f6772f | Test that `numpy.typing` can be imported in the the absence of typing-extensions | pdebuyl/numpy,rgommers/numpy,charris/numpy,anntzer/numpy,numpy/numpy,rgommers/numpy,mhvk/numpy,seberg/numpy,pdebuyl/numpy,endolith/numpy,jakirkham/numpy,mattip/numpy,mhvk/numpy,simongibbons/numpy,numpy/numpy,endolith/numpy,simongibbons/numpy,pdebuyl/numpy,simongibbons/numpy,endolith/numpy,anntzer/numpy,seberg/numpy,num... | numpy/typing/tests/test_typing_extensions.py | numpy/typing/tests/test_typing_extensions.py | """Tests for the optional typing-extensions dependency."""
import sys
import types
import inspect
import importlib
import typing_extensions
import numpy.typing as npt
def _is_sub_module(obj: object) -> bool:
"""Check if `obj` is a `numpy.typing` submodule."""
return inspect.ismodule(obj) and obj.__name__.st... | bsd-3-clause | Python | |
bf4683f87055b5dad78766bd92ac0393e7c5464e | Add repeated choropleth example | jakevdp/altair,altair-viz/altair,ellisonbg/altair | altair/vegalite/v2/examples/choropleth_repeat.py | altair/vegalite/v2/examples/choropleth_repeat.py | """
Repeated Choropleth Map
=======================
Three choropleths representing disjoint data from the same table.
"""
# category: geographic
import altair as alt
from vega_datasets import data
pop_eng_hur = alt.UrlData(data.population_engineers_hurricanes.url)
states = alt.UrlData(data.us_10m.url,
... | bsd-3-clause | Python | |
83ec79e9e1617a115a8b5666264bb80d515042fd | Create ec2sshpanes.py | urjitbhatia/sshall,urjitbhatia/sshall | ec2sshpanes.py | ec2sshpanes.py | #!/usr/bin/python
import yaml
import sys
import subprocess
#############################################
# This currently works with ASG names only. #
#############################################
defaultYaml = r'''
windows:
- name: multi ssh
root: .
layout: tiled
panes:
'''
describe_cmd = '''aws ec2 ... | apache-2.0 | Python | |
dca8d6e1490a311572eeb0f48493eb83952456c5 | Add GlobusResponse and GlobusHTTPResponse tests | globus/globus-sdk-python,aaschaer/globus-sdk-python,globus/globus-sdk-python,globusonline/globus-sdk-python,sirosen/globus-sdk-python | tests/unit/test_response.py | tests/unit/test_response.py | import requests
import json
import six
from globus_sdk.response import GlobusResponse, GlobusHTTPResponse
from tests.framework import CapturedIOTestCase
class GlobusResponseTests(CapturedIOTestCase):
def setUp(self):
"""
Makes GlobusResponses wrapped around known data for testing
"""
... | apache-2.0 | Python | |
ef9334f1279d029752186bc6f4a1ebff6229bf5b | Add AsyncServiceBrowser example (#487) | jstasiak/python-zeroconf | examples/async_browser.py | examples/async_browser.py | #!/usr/bin/env python3
""" Example of browsing for a service.
The default is HTTP and HAP; use --find to search for all available services in the network
"""
import argparse
import asyncio
import logging
from typing import cast
from zeroconf import IPVersion, ServiceStateChange
from zeroconf.asyncio import AsyncSer... | lgpl-2.1 | Python | |
0a6f6db77dd888b810089659100158ed4e8e3cee | Add tests for the object factory with various permutations | richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation | test/test_object_factory.py | test/test_object_factory.py | import unittest
import groundstation.objects.object_factory as object_factory
from groundstation.objects.root_object import RootObject
from groundstation.objects.update_object import UpdateObject
class TestRootObject(unittest.TestCase):
def test_hydrate_root_object(self):
root = RootObject(
... | mit | Python | |
70aedbcbfe247884f795aae66fb4d5fcddb71f4d | Create ProdArrExcSelf_001.py | cc13ny/algo,Chasego/codirit,cc13ny/Allin,cc13ny/algo,Chasego/cod,cc13ny/Allin,Chasego/codi,Chasego/codirit,cc13ny/algo,Chasego/cod,cc13ny/Allin,cc13ny/algo,Chasego/codirit,Chasego/codi,Chasego/codi,Chasego/cod,Chasego/cod,cc13ny/Allin,Chasego/codi,Chasego/codi,cc13ny/Allin,Chasego/cod,Chasego/codirit,Chasego/codirit,cc... | leetcode/238-Product-of-Array-Except-Self/ProdArrExcSelf_001.py | leetcode/238-Product-of-Array-Except-Self/ProdArrExcSelf_001.py | class Solution:
# @param {integer[]} nums
# @return {integer[]}
def productExceptSelf(self, nums):
if len(nums) < 2:
return nums
res = nums[:]
for i in range(1, len(res)):
res[i] *= res[i - 1]
for j in range(len(nums) - 1, 0, -1):
... | mit | Python | |
6e7ebf7ac532340fc995e7986449eef89547cada | Create pdf_textboxes2.py but Not Completed | oniwan/GCI,oniwan/GCI | pdf_textboxes2.py | pdf_textboxes2.py | import sys
import os
from pdfminer.converter import PDFPageAggregator
from pdfminer.layout import LAParams,LTContainer,LTTextBox
from pdfminer.pdfinterp import PDFPageInterpreter, PDFResourceManager
from pdfminer.pdfpage import PDFPage
def find_textboxes_recursively(layout_obj):
if isinstance(layout_obj,LTTextBo... | mit | Python | |
84a195b904ccb3dd5d5d941e9798de92b6fbc7f3 | Add sampling | dribnet/draw,drewlinsley/draw_classify,drewlinsley/draw_classify,drewlinsley/draw_classify,negar-rostamzadeh/draw,mohammadpz/draw,ablavatski/draw,jbornschein/draw,langholz/draw | draw/sample.py | draw/sample.py | #!/usr/bin/env python
from __future__ import print_function, division
import logging
import theano
import theano.tensor as T
import cPickle as pickle
import numpy as np
from PIL import Image
FORMAT = '[%(asctime)s] %(name)-15s %(message)s'
DATEFMT = "%H:%M:%S"
logging.basicConfig(format=FORMAT, datefmt=DATEFMT, l... | mit | Python | |
93bc13af093186b3a74570882135b81ddeeb6719 | Add class for symbolic ranges | tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge | drudge/term.py | drudge/term.py | """Tensor term definition and utility."""
from sympy import sympify
class Range:
"""A symbolic range that can be summed over.
This class is for symbolic ranges that is going to be summed over in
tensors. Each range should have a label, and optionally lower and upper
bounds, which should be both giv... | mit | Python | |
4f8f72b83338853e4f603c313c0461bbe2c3cde4 | add example app | elbow-jason/flask-simple-alchemy | example_app.py | example_app.py | from flask import Flask
#import flask extensions
from flask.ext.sqlalchemy import SQLAlchemy
#config values
SQLALCHEMY_DATABASE_URI ='sqlite:///example.db'
DEBUG = True
SECRET_KEY = 'development key'
#create app
app = Flask(__name__)
#config app
app.config.from_object(__name__)
#init extensitions
db = SQLAlchemy(a... | mit | Python | |
e54dcb3cbb5677e0153f9a316bc14050f85ffaa6 | add script for categories position | Findspire/workflow,Findspire/workflow,Findspire/workflow,Findspire/workflow | scripts/category_position.py | scripts/category_position.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import django
import sys
import argparse
PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(PATH)
django.setup()
from workflow.apps.workflow.models import Workflow, ItemCategory
def assign_category_position():
for w in Wor... | mit | Python | |
49bf2efb84917b32d5ab1e4295819e195e997abd | Add resnet18 with torchdynamo example | iree-org/iree-torch,iree-org/iree-torch | torchdynamo_poc/resnet18.py | torchdynamo_poc/resnet18.py | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python | |
d8b6266432ce2d5cee11f1a54b9ed6711bc8767d | initialize script to generate cpac list files | neurodata/ndmg,neurodata/ndgrutedb,openconnectome/m2g,openconnectome/m2g,openconnectome/m2g,openconnectome/m2g,neurodata/ndgrutedb,neurodata/ndgrutedb,neurodata/ndgrutedb,openconnectome/m2g,openconnectome/m2g,neurodata/ndgrutedb,openconnectome/m2g,openconnectome/m2g,neurodata/ndgrutedb,neurodata/ndgrutedb,neurodata/ndg... | packages/functional/cpac_list_gen.py | packages/functional/cpac_list_gen.py | #!/usr/bin/env python
# Copyright 2015 Open Connectome Project (http://openconnecto.me)
#
# 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
#
#... | apache-2.0 | Python | |
6342cbcc5e756429accf5ac98a728932b9a3d697 | Add glados plugin | thomasleese/smartbot-old,tomleese/smartbot,Muzer/smartbot,Cyanogenoid/smartbot | plugins/glados.py | plugins/glados.py | class Plugin:
def __call__(self, bot):
bot.on_hear(r"bring( your)? daughter( to)? work( day)?", self.on_respond_1)
bot.on_hear(r"(vital )?organ donor", self.on_respond_2)
bot.on_hear(r"(the )?cake is( a)? lie", self.on_respond_3)
bot.on_hear(r"(weighted )?companion cube", self.on_res... | mit | Python | |
1acd25030dda2f7f85a03f3809f747d7f051835b | add parse.py | interrogator/topic-grammar | parse.py | parse.py | import os
import glob
import codecs
import spacy
import spacy.en
nlp = spacy.en.English(parser=True, tagger=True, entity=False)
try:
os.makedirs('parsed-data')
except:
import shutil
shutil.rmtree('parsed-data')
for f in glob.glob('data/*'):
if os.path.basename(f).startswith('.'):
continue
... | mit | Python | |
64b98144c29455cca402ad42fc89d257cb3d236b | add DBF file importer | akrherz/idep,akrherz/idep,akrherz/idep,akrherz/dep,akrherz/dep,akrherz/dep,akrherz/idep,akrherz/idep,akrherz/dep,akrherz/idep,akrherz/dep | scripts/import/huc_import.py | scripts/import/huc_import.py | import psycopg2
import glob
import subprocess
import os
idep = psycopg2.connect(database='idep', host='iemdb')
icursor = idep.cursor()
os.chdir("a")
for fn in glob.glob("*.dbf"):
p = subprocess.Popen("dbfdump %s" % (fn,), stdout=subprocess.PIPE,
shell=True)
data = p.stdout.read()
... | mit | Python | |
fc6133db64107fe5c485c7bd04ca400b3ebe9e81 | Create prep_terrain_data.py | MurphyWan/Python-first-Practice | uda/ml/prep_terrain_data.py | uda/ml/prep_terrain_data.py | #!/usr/bin/python
import random
def makeTerrainData(n_points=1000):
###############################################################################
### make the toy dataset
random.seed(42)
grade = [random.random() for ii in range(0,n_points)]
bumpy = [random.random() for ii in range(0,n_points)]
error... | mit | Python | |
09c57f12aae7a5e05f98cba684d814c76500d492 | Create switch.py | PrinceShaji/StreamBox | TestCodes/switch.py | TestCodes/switch.py | import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
GPIO.setup(5, GPIO.IN)
GPIO.setup(40, GPIO.OUT)
try:
while True:
if GPIO.input(5):
GPIO.output(40, 1)
else:
GPIO.output(40, 0)
sleep (0.1)
finally:
GPIO.cleanup()
| mit | Python | |
7dcccec86ba6551ac163cb4d33a407f03b477dee | Fix ASM unit test (also use setter in constructor) | blackpioter/sendgrid-python,blackpioter/sendgrid-python,sendgrid/sendgrid-python,blackpioter/sendgrid-python,sendgrid/sendgrid-python,sendgrid/sendgrid-python | sendgrid/helpers/mail/asm.py | sendgrid/helpers/mail/asm.py | class ASM(object):
"""An object specifying unsubscribe behavior."""
def __init__(self, group_id=None, groups_to_display=None):
"""Create an ASM with the given group_id and groups_to_display.
:param group_id: ID of an unsubscribe group
:type group_id: int, optional
:param groups... | class ASM(object):
"""An object specifying unsubscribe behavior."""
def __init__(self, group_id=None, groups_to_display=None):
"""Create an ASM with the given group_id and groups_to_display.
:param group_id: ID of an unsubscribe group
:type group_id: int, optional
:param groups... | mit | Python |
53098794867667de3139c57695077d81cc08f6b6 | add cisco_faults under l2network package. | gkotton/vmware-nsx,gkotton/vmware-nsx | quantum/plugins/cisco/common/cisco_faults.py | quantum/plugins/cisco/common/cisco_faults.py | """
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2011 Cisco Systems, Inc. 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.ap... | apache-2.0 | Python | |
d2fbd3a84443dee66b228a2db025401974767da0 | Add cleanup script for audit logs | girder/girder,Kitware/girder,jbeezley/girder,girder/girder,RafaelPalomar/girder,Kitware/girder,manthey/girder,RafaelPalomar/girder,manthey/girder,girder/girder,RafaelPalomar/girder,manthey/girder,RafaelPalomar/girder,jbeezley/girder,girder/girder,jbeezley/girder,Kitware/girder,manthey/girder,jbeezley/girder,Kitware/gir... | plugins/audit_logs/server/cleanup.py | plugins/audit_logs/server/cleanup.py | """
This script is for deleting old audit log entries from the database. Due to the relative
import, it should be run from the parent dir as `python -m server.cleanup`. TODO Pip installable
plugins will allow us to just expose a console entry point for this.
"""
import click
import datetime
from . import Record
@clic... | apache-2.0 | Python | |
7f1dd7eaba2adde8bc44669f5c39f3c38bd8a7a9 | Create frozen_cait.py | ZorbaTheStrange/frozen_cait | frozen_cait.py | frozen_cait.py | #! /usr/bin/python3
'''
frozenCait.py - This is a script for my neice that opens a youtube video for a frozen song.
2016/2/14
by zorba
'''
import webbrowser, sys
def frozen_song():
''' User gets two choices. let it go (we can add in regualr song if that becomes a thing), or the option to search for a new song.... | mit | Python | |
0f72c4bf32986aae7a59b2380c5a314038c7ed61 | Add Queue implementation using two stacks | ueg1990/aids | aids/stack/queue_two_stacks.py | aids/stack/queue_two_stacks.py | '''
Implement Queue data structure using two stacks
'''
from stack import Stack
class QueueUsingTwoStacks(object):
def __init__(self):
'''
Initialize Queue
'''
self.stack1 = Stack()
self.stack2 = Stack()
def __len__(self):
'''
Return number of items in Queue
'''
return len(self.stack1) + len(s... | mit | Python | |
bdcd3b1619ecd736a7cc56290bb4b68679e899b4 | Add additional plot file | kpj/PyWave | extra_plots.py | extra_plots.py | """
Generate nice plots providing additional information
"""
import sys
import numpy as np
import matplotlib.pylab as plt
def neural_spike():
""" Plot various neural spikes
"""
def do_plot(cell_evo):
""" Plot [cAMP] for single cell over time
"""
plt.plot(range(len(cell_evo)), cell... | mit | Python | |
22ba02b22b50107463928878430dbab2b26c39d1 | add gflags package | matthiasdiener/spack,EmreAtes/spack,tmerrick1/spack,tmerrick1/spack,iulian787/spack,TheTimmy/spack,matthiasdiener/spack,LLNL/spack,mfherbst/spack,LLNL/spack,krafczyk/spack,skosukhin/spack,mfherbst/spack,krafczyk/spack,LLNL/spack,iulian787/spack,TheTimmy/spack,skosukhin/spack,krafczyk/spack,EmreAtes/spack,tmerrick1/spac... | var/spack/packages/gflags/package.py | var/spack/packages/gflags/package.py | import os
from spack import *
class Gflags(Package):
"""The gflags package contains a C++ library that implements
commandline flags processing. It includes built-in support for
standard types such as string and the ability to define flags
in the source file in which they are used. Online documentation
... | lgpl-2.1 | Python | |
e561aa763c32f4139b64c9177dd7c52b1c6e3a9f | Add read-depth control calls. | dellytools/delly,dellytools/delly,dellytools/delly | variantFiltering/addControlRegion.py | variantFiltering/addControlRegion.py | #! /usr/bin/env python
from __future__ import print_function
from varpkg.readfq import readfq
import vcf
import argparse
import gzip
import banyan
import re
# Parse command line
parser = argparse.ArgumentParser(description='Add read-depth control region to input VCF.')
parser.add_argument('-v', '--vcf', metavar='vari... | bsd-3-clause | Python | |
fc4a157a06c9a126ef5722687ebb0a76a9f0e028 | Add tests for train_agent_async | toslunar/chainerrl,toslunar/chainerrl | tests/experiments_tests/test_train_agent_async.py | tests/experiments_tests/test_train_agent_async.py | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() # NOQA
import tempfile
import unittest
from chainer import testing
... | mit | Python | |
49c0243d7a0ca565636e01433286297f9d4f0a14 | Create example.py | Codeusa/Shrinkwrap-worker | shrinkwrap-worker/example.py | shrinkwrap-worker/example.py | __author__ = 'Andrew'
import time
import urllib.request
from functions import stdout
import workerpool
class DownloadJob(workerpool.Job):
"Job for downloading a given URL."
def __init__(self, url, poster_id):
self.url = url # The url we'll need to download when the job runs
self.poster_id = ... | mit | Python | |
5dfd6b34a6ee42335f3449680c1a4c88cb746b6c | Return phi value of a number | prateekgulati/numberTheory | phi.py | phi.py | __author__ = 'Prateek'
from sympy import primerange
def phi(n):
value = n
for i in primerange(1, n):
if n % i == 0:
value = value * (1 - i ** -1)
return int(value)
if __author__ == 'Prateek':
print phi(666) | mit | Python | |
d0b6243e2dfcc33b7697a1a0c70abcc225d3d768 | Add migration to backfill external IDs on existing saved searches and set the column as not nullable | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | migrations/versions/1080_backfill_external_ids.py | migrations/versions/1080_backfill_external_ids.py | """Backfill external ID column
Revision ID: 1080
Revises: 1070
Create Date: 2017-12-05 15:00:00.00000
"""
from alembic import op
import json
import random
import sqlalchemy as sa
from sqlalchemy.sql import text
# revision identifiers, used by Alembic.
revision = '1080'
down_revision = '1070'
DIRECT_AWARD_AUDIT_TYPE... | mit | Python | |
b425db851abbb8b122d9c17e30684467f9c3688c | Create solution2.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | leetcode/easy/first_unique_character_in_a_string/py/solution2.py | leetcode/easy/first_unique_character_in_a_string/py/solution2.py | #
# Another solution involves allocating an array of indices and sorting it.
# This will provide us with a way to traverse characters in the string in
# a sorted order while preserving the original string.
#
# We then use itertools.groupby to group up the duplicates. Each group is
# then traversed, if the length of a g... | mit | Python | |
1cc99c8e7c020457034d8ff1a4b85033bbe64353 | Add SAM device data extractor | modm-io/modm-devices | tools/generator/raw-data-extractor/extract-sam.py | tools/generator/raw-data-extractor/extract-sam.py |
import urllib.request
import zipfile
import re, io, os
import shutil
from pathlib import Path
from multiprocessing import Pool
from collections import defaultdict
from distutils.version import StrictVersion
packurl = "http://packs.download.atmel.com/"
shutil.rmtree("../raw-device-data/sam-devices", ignore_errors=T... | mpl-2.0 | Python | |
d6445a9ba8e88a134952d4bcd0bba6f7b03ea6dc | Include editor | kylef/goji | goji/editor.py | goji/editor.py | from os import system, environ
from tempfile import NamedTemporaryFile
import re
class Editor(object):
def __init__(self, prefill):
self.prefill = prefill
@property
def editor(self):
return environ.get('EDITOR', 'vi')
def start(self):
fd = NamedTemporaryFile()
fd.writ... | bsd-2-clause | Python | |
3b519b6ce6319797ef0544ea2567e918fa4df1b3 | Add test module of hangul. | iandmyhand/python-utils | hangul_test.py | hangul_test.py | import hangul
s = 'ㅎㅏㄴㅅㅓㅁㄱㅣ'
print(hangul.conjoin(s))
s = '한섬기'
print(hangul.conjoin(s))
print(ord('ㅎ'))
print(ord(u'\u1112'))
print(chr(12622))
print(chr(4370))
print(hex(12622))
print(hex(4370))
| mit | Python | |
e4a89c39e4ba79d4c3eb5a8032d1547f0c75c323 | Create hashCollect.py | machn1k/TekDefense,1aN0rmus/TekDefense | hashCollect.py | hashCollect.py | '''
hashCollect has been renamed moved to the link below:
https://github.com/1aN0rmus/TekDefense/blob/master/tekCollect.py
'''
| mit | Python | |
025ac7005bde8349b0ee91cdfc62d035b703db92 | Add missing file: microdrop.gui.channel_sweep | wheeler-microfluidics/microdrop | microdrop/gui/channel_sweep.py | microdrop/gui/channel_sweep.py | from flatland import Form, Float
from flatland.validation import ValueAtLeast
from pygtkhelpers.ui.form_view_dialog import create_form_view
from pygtkhelpers.ui.views.select import ListSelect
import gtk
import pandas as pd
import pygtkhelpers.ui.extra_widgets # Include widget for `Float` form fields
def get_channel_... | bsd-3-clause | Python | |
037899b51d42f02dd76296d7551aa8da6df580ea | Add bot control module. | sk89q/Plumeria,sk89q/Plumeria,sk89q/Plumeria | plumeria/plugins/bot_control.py | plumeria/plugins/bot_control.py | from plumeria.command import commands, CommandError
from plumeria.message.lists import build_list
from plumeria.perms import owners_only
from plumeria.transport import transports
@commands.register('accept invite', category='Discord')
@owners_only
async def accept_invite(message):
"""
Accept an invite to join... | mit | Python | |
01d9c2e9b223cabb9196d8aeec4232283a740518 | Create MIME_Type.py | Alumet/Codingame | Easy/MIME_Type.py | Easy/MIME_Type.py |
n = int(input()) # Number of elements which make up the association table.
q = int(input()) # Number Q of file names to be analyzed.
Link_table = {None : 'UNKNOWN'}
# Fill the dic
for i in range(n):
ext, mt = input().split()
Link_table[ext.lower()]=mt
for i in range(q):
fname=(input().lower().spl... | mit | Python | |
31a875e7b58cbd45e9d4d874058cdc3e12c23b5b | add disambiguator | tudarmstadt-lt/sensegram,tudarmstadt-lt/sensegram | egvi/disambiguator.py | egvi/disambiguator.py | """dependencies required to use of this file:
pip install gensim clint requests pandas """
import requests
from clint.textui import progress
from os.path import exists
from gensim.models import KeyedVectors
from pandas import read_csv
def ensure_word_embeddings(language):
""" Ensures that the word vectors exist ... | apache-2.0 | Python | |
fb2f2afd78fb577032430726f948b09e364303d9 | Create convert_to_czml_v2.py | Parthesh/GIS,Parthesh/GIS | convert_to_czml_v2.py | convert_to_czml_v2.py | ##### OGR text file to czml converter (use ogrinfo tool to get shape file info into text file). With building elevation above ellipsoid.
##### Created by Parthesh B.
import os
f = open('hyd_fin_data.txt','r')
g = open('write.czml','a')
p = f.read()
str_len = len(p)
str1 = "ZS_mean (Real) = "
str2 = "Building_h (Real) ... | mit | Python | |
cd3c176294310fd8a0af5f32366759c6eac43d35 | Add test_catchup_with_only_one_available_node | evernym/zeno,evernym/plenum | plenum/test/node_catchup/test_catchup_with_only_one_available_node.py | plenum/test/node_catchup/test_catchup_with_only_one_available_node.py | from random import choice
import pytest
from plenum.common.constants import AUDIT_LEDGER_ID
from plenum.test.delayers import delay_3pc, cqDelay
from plenum.test.helper import sdk_send_random_and_check, max_3pc_batch_limits, assert_eq
from plenum.test.logging.conftest import logsearch
from plenum.test.node_catchup.hel... | apache-2.0 | Python | |
e9321b191090956567d2d7736a6f01e855f30bfd | add script for generating csv of map titles for judges | pdxosgeo/map-gallery-util | gen-map-csv.py | gen-map-csv.py | import urllib2
import simplejson
import unicodecsv
req = urllib2.Request("https://2014.foss4g.org/map-gallery/map-gallery-feed")
opener = urllib2.build_opener()
f = opener.open(req)
j = simplejson.load(f)
titles = []
for rec in j:
titles.append([rec['title']])
print titles
with open('titles.csv', 'wb') as f:
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.