commit stringlengths 40 40 | old_file stringlengths 4 150 | new_file stringlengths 4 150 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 501 | message stringlengths 15 4.06k | lang stringclasses 4
values | license stringclasses 13
values | repos stringlengths 5 91.5k | diff stringlengths 0 4.35k |
|---|---|---|---|---|---|---|---|---|---|---|
971570b4288c9ac7131a1756e17574acbe6d1b9a | python/misc/solarized-dark-high-contrast.py | python/misc/solarized-dark-high-contrast.py | #!/usr/bin/env python
import sys
if sys.version_info < (3, 4):
sys.exit('ERROR: Requires Python 3.4')
from enum import Enum
def main():
Cases = Enum('Cases', 'lower upper')
infile_case = None
if len(sys.argv) < 2:
sys.stderr.write('ERROR: Must provide a file to modify\n')
sys.ex... | Add script for converting a solarized dark file to solarized dark high contrast | Add script for converting a solarized dark file to solarized dark high contrast
| Python | mit | bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile | ---
+++
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+
+import sys
+
+if sys.version_info < (3, 4):
+ sys.exit('ERROR: Requires Python 3.4')
+
+from enum import Enum
+
+def main():
+ Cases = Enum('Cases', 'lower upper')
+ infile_case = None
+
+ if len(sys.argv) < 2:
+ sys.stderr.write('ERROR: Must p... | |
b72c421696b5714d256b7ac461833bc692ca5354 | robot/robot/src/autonomous/hot_aim_shoot.py | robot/robot/src/autonomous/hot_aim_shoot.py |
try:
import wpilib
except ImportError:
from pyfrc import wpilib
import timed_shoot
class HotShootAutonomous(timed_shoot.TimedShootAutonomous):
'''
Based on the TimedShootAutonomous mode. Modified to allow
shooting based on whether the hot goal is enabled or not.
'''
... | Add an autonomous mode to strafe and shoot. Doesn't work | Add an autonomous mode to strafe and shoot. Doesn't work
| Python | bsd-3-clause | frc1418/2014 | ---
+++
@@ -0,0 +1,93 @@
+
+try:
+ import wpilib
+except ImportError:
+ from pyfrc import wpilib
+
+import timed_shoot
+
+class HotShootAutonomous(timed_shoot.TimedShootAutonomous):
+ '''
+ Based on the TimedShootAutonomous mode. Modified to allow
+ shooting based on whether the hot goal is ena... | |
17e2b9ecb67c8b1f3a6f71b752bc70b21584092e | tests/test_scriptserver.py | tests/test_scriptserver.py | import unittest
from mock import patch, Mock
import sys
sys.path.append(".")
from scriptserver import ZoneScriptRunner
class TestZoneScriptRunner(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.mongoengine_patch = patch('scriptserver.me')
cls.mongoengine_patch.start()
@classmeth... | Add initial tests for scriptserver. | Add initial tests for scriptserver.
Covers ZoneScriptRunner.__init__ and ZoneScriptRunner.load_scripts.
| Python | agpl-3.0 | cnelsonsic/SimpleMMO,cnelsonsic/SimpleMMO,cnelsonsic/SimpleMMO | ---
+++
@@ -0,0 +1,57 @@
+import unittest
+from mock import patch, Mock
+
+import sys
+sys.path.append(".")
+from scriptserver import ZoneScriptRunner
+
+class TestZoneScriptRunner(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.mongoengine_patch = patch('scriptserver.me')
+ cls.mo... | |
b63e65b1a41f809caf1c2dcd689955df76add20f | test/test_delta.py | test/test_delta.py | import matplotlib.pyplot as plt
import numpy as np
import scattering
import scipy.constants as consts
def plot_csec(scatterer, d, var, name):
plt.plot(d / consts.centi, var,
label='%.1f cm' % (scatterer.wavelength / consts.centi))
plt.xlabel('Diameter (cm)')
plt.ylabel(name)
def plot_csecs(d, ... | Add a plot just of backscatter phase vs. diameter. | Add a plot just of backscatter phase vs. diameter.
This (mostly) reproduces a figure in Matrosov et al. 2002 in JAM.
| Python | bsd-2-clause | dopplershift/Scattering | ---
+++
@@ -0,0 +1,37 @@
+import matplotlib.pyplot as plt
+import numpy as np
+import scattering
+import scipy.constants as consts
+
+def plot_csec(scatterer, d, var, name):
+ plt.plot(d / consts.centi, var,
+ label='%.1f cm' % (scatterer.wavelength / consts.centi))
+ plt.xlabel('Diameter (cm)')
+ ... | |
da2a4fa9e618b212ddbb2fcbc079fa37970ae596 | tfd/loggingutil.py | tfd/loggingutil.py |
'''
Utilities to assist with logging in python
'''
import logging
class ConcurrentFileHandler(logging.Handler):
"""
A handler class which writes logging records to a file. Every time it
writes a record it opens the file, writes to it, flushes the buffer, and
closes the file. Perhaps this could cre... | Add handler for concurrently logging to a file | Add handler for concurrently logging to a file
| Python | mit | todddeluca/tfd | ---
+++
@@ -0,0 +1,56 @@
+
+'''
+Utilities to assist with logging in python
+'''
+
+import logging
+
+
+class ConcurrentFileHandler(logging.Handler):
+ """
+ A handler class which writes logging records to a file. Every time it
+ writes a record it opens the file, writes to it, flushes the buffer, and
+ ... | |
700db5c742be8a893b1c362ae0955a934b88c39b | test_journal.py | test_journal.py | # -*- coding: utf-8 -*-
from contextlib import closing
import pytest
from journal import app
from journal import connect_db
from journal import get_database_connection
from journal import init_db
TEST_DSN = 'dbname=test_learning_journal'
def clear_db():
with closing(connect_db()) as db:
db.cursor().exec... | Add test_learning_journal.py with test_app() for configuring the app for testing | Add test_learning_journal.py with test_app() for configuring the app for testing
| Python | mit | sazlin/learning_journal | ---
+++
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+from contextlib import closing
+import pytest
+
+from journal import app
+from journal import connect_db
+from journal import get_database_connection
+from journal import init_db
+
+TEST_DSN = 'dbname=test_learning_journal'
+
+
+def clear_db():
+ with closing(conn... | |
eb1c7d1c2bfaa063c98612d64bbe35dedf217143 | tests/test_alerter.py | tests/test_alerter.py | import unittest
import datetime
import Alerters.alerter
class TestAlerter(unittest.TestCase):
def test_groups(self):
config_options = {'groups': 'a,b,c'}
a = Alerters.alerter.Alerter(config_options)
self.assertEqual(['a', 'b', 'c'], a.groups)
def test_times_always(self):
conf... | Add initial tests for alerter class | Add initial tests for alerter class
| Python | bsd-3-clause | jamesoff/simplemonitor,jamesoff/simplemonitor,jamesoff/simplemonitor,jamesoff/simplemonitor,jamesoff/simplemonitor | ---
+++
@@ -0,0 +1,29 @@
+import unittest
+import datetime
+import Alerters.alerter
+
+
+class TestAlerter(unittest.TestCase):
+
+ def test_groups(self):
+ config_options = {'groups': 'a,b,c'}
+ a = Alerters.alerter.Alerter(config_options)
+ self.assertEqual(['a', 'b', 'c'], a.groups)
+
+ d... | |
33658163b909073aae074b5b2cdae40a0e5c44e8 | tests/test_asyncio.py | tests/test_asyncio.py | from trollius import test_utils
from trollius import From, Return
import trollius
import unittest
try:
import asyncio
except ImportError:
from trollius.test_utils import SkipTest
raise SkipTest('need asyncio')
# "yield from" syntax cannot be used directly, because Python 2 should be able
# to execute thi... | Add unit tests for asyncio coroutines | Add unit tests for asyncio coroutines
| Python | apache-2.0 | overcastcloud/trollius,overcastcloud/trollius,overcastcloud/trollius | ---
+++
@@ -0,0 +1,72 @@
+from trollius import test_utils
+from trollius import From, Return
+import trollius
+import unittest
+
+try:
+ import asyncio
+except ImportError:
+ from trollius.test_utils import SkipTest
+ raise SkipTest('need asyncio')
+
+
+# "yield from" syntax cannot be used directly, because ... | |
1ffdfc3c7ae11c583b2ea4d45b50136996bcf3e3 | tests/mocks.py | tests/mocks.py | from http.server import BaseHTTPRequestHandler, HTTPServer
import json
import socket
from threading import Thread
import requests
# https://realpython.com/blog/python/testing-third-party-apis-with-mock-servers/
class MockHTTPServerRequestHandler(BaseHTTPRequestHandler):
def do_OPTIONS(self):
# add respo... | Add mock HTTP server to respond to requests from web UI | Add mock HTTP server to respond to requests from web UI
| Python | mpl-2.0 | jmlong1027/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,mitre/multiscanner,mitre/multiscanner,jmlong1027/multiscanner,MITRECND/multiscanner,MITRECND/multiscanner,jmlong1027/multiscanner | ---
+++
@@ -0,0 +1,62 @@
+from http.server import BaseHTTPRequestHandler, HTTPServer
+import json
+import socket
+from threading import Thread
+
+import requests
+
+# https://realpython.com/blog/python/testing-third-party-apis-with-mock-servers/
+
+class MockHTTPServerRequestHandler(BaseHTTPRequestHandler):
+
+ de... | |
744d7971926bf7672ce01388b8617be1ee35df0e | xunit-autolabeler-v2/ast_parser/core/test_data/parser/exclude_tags/exclude_tags_main.py | xunit-autolabeler-v2/ast_parser/core/test_data/parser/exclude_tags/exclude_tags_main.py | # Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Add missing test data folder | Add missing test data folder
| Python | apache-2.0 | GoogleCloudPlatform/repo-automation-playground,GoogleCloudPlatform/repo-automation-playground,GoogleCloudPlatform/repo-automation-playground,GoogleCloudPlatform/repo-automation-playground,GoogleCloudPlatform/repo-automation-playground,GoogleCloudPlatform/repo-automation-playground,GoogleCloudPlatform/repo-automation-pl... | ---
+++
@@ -0,0 +1,24 @@
+# Copyright 2020 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
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by appl... | |
24baf3e5e7a608d0b34d74be25f96f1b74b7622e | web/social/tasks.py | web/social/tasks.py | from celery.task import PeriodicTask
from datetime import timedelta
from social.utils import FeedUpdater, UpdateError
class UpdateFeedsTask(PeriodicTask):
run_every = timedelta(minutes=15)
def run(self, **kwargs):
logger = self.get_logger()
updater = FeedUpdater(logger)
print "Updatin... | Add feed update task for social app | Add feed update task for social app
| Python | agpl-3.0 | kansanmuisti/datavaalit,kansanmuisti/datavaalit | ---
+++
@@ -0,0 +1,14 @@
+from celery.task import PeriodicTask
+from datetime import timedelta
+
+from social.utils import FeedUpdater, UpdateError
+
+class UpdateFeedsTask(PeriodicTask):
+ run_every = timedelta(minutes=15)
+
+ def run(self, **kwargs):
+ logger = self.get_logger()
+ updater = Feed... | |
3fb4d7b630fb7a4b34dcc4e1b72947e61f73a80f | TestData/download_test_data.py | TestData/download_test_data.py | def set_test_db():
from sys import path
path.insert(0, "..")
from MyEdgarDb import get_list_sec_filings, get_cik_ticker_lookup_db, lookup_cik_ticker
get_list_sec_filings (7, 'test_idx.db')
get_cik_ticker_lookup_db ('test_idx.db')
def download_test_data():
import sqlite3
from datetime import... | Create script to dowload requisite test urls. | Create script to dowload requisite test urls.
| Python | agpl-3.0 | cielling/jupyternbs | ---
+++
@@ -0,0 +1,49 @@
+def set_test_db():
+ from sys import path
+ path.insert(0, "..")
+ from MyEdgarDb import get_list_sec_filings, get_cik_ticker_lookup_db, lookup_cik_ticker
+ get_list_sec_filings (7, 'test_idx.db')
+ get_cik_ticker_lookup_db ('test_idx.db')
+
+def download_test_data():
+ imp... | |
3ebb2731d6389170e0bef0dab66dc7c4ab41152e | thread_pool_test.py | thread_pool_test.py | import thread_pool
import unittest
from six.moves import queue
class TestThreadPool(unittest.TestCase):
def _producer_thread(self, results):
for i in range(10):
results.put(i)
def _consumer_thread(self, results):
for i in range(10):
self.assertEqual(results.get(), i)
def testContextManager... | Add a unit-test for thread_pool.py. | Add a unit-test for thread_pool.py.
| Python | mit | graveljp/smugcli | ---
+++
@@ -0,0 +1,26 @@
+import thread_pool
+import unittest
+from six.moves import queue
+
+class TestThreadPool(unittest.TestCase):
+
+ def _producer_thread(self, results):
+ for i in range(10):
+ results.put(i)
+
+ def _consumer_thread(self, results):
+ for i in range(10):
+ self.assertEqual(res... | |
19712e8e7b9423d4cb4bb22c37c7d8d2ea0559c5 | examples/list-usb.py | examples/list-usb.py | #!/usr/bin/env python2
#
# This file is Public Domain and provided only for documentation purposes.
#
# Run : python2 ./list-usb.py
#
# Note: This will happily run with Python3 too, I just picked a common baseline
#
import gi
gi.require_version('Ldm', '0.1')
from gi.repository import Ldm, GObject
class PretendyPlugin... | Add example to show listing of USB devices | examples: Add example to show listing of USB devices
Also we add a quick example of how to implement a custom plugin to provide
runtime plugin support for LdmManager.
Signed-off-by: Ikey Doherty <d8d992cf0016e35c2a8339d5e7d44bebd12a2d77@solus-project.com>
| Python | lgpl-2.1 | solus-project/linux-driver-management,solus-project/linux-driver-management | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python2
+#
+# This file is Public Domain and provided only for documentation purposes.
+#
+# Run : python2 ./list-usb.py
+#
+# Note: This will happily run with Python3 too, I just picked a common baseline
+#
+
+import gi
+gi.require_version('Ldm', '0.1')
+from gi.repository im... | |
b56690d046021e036b5b15c484d86c92f3519600 | scikits/learn/common/myfunctools.py | scikits/learn/common/myfunctools.py | # Last Change: Mon Aug 20 01:00 PM 2007 J
# Implement partial application (should only be used if functools is not
# available (eg python < 2.5)
class partial:
def __init__(self, fun, *args, **kwargs):
self.fun = fun
self.pending = args[:]
self.kwargs = kwargs.copy()
def __call__(self,... | Add partial evaluation tool to replace functools module for python < 2.5 | Add partial evaluation tool to replace functools module for python < 2.5
From: cdavid <cdavid@cb17146a-f446-4be1-a4f7-bd7c5bb65646>
git-svn-id: a2d1b0e147e530765aaf3e1662d4a98e2f63c719@236 22fbfee3-77ab-4535-9bad-27d1bd3bc7d8
| Python | bsd-3-clause | shikhardb/scikit-learn,ClimbsRocks/scikit-learn,bthirion/scikit-learn,samuel1208/scikit-learn,sinhrks/scikit-learn,OshynSong/scikit-learn,ky822/scikit-learn,treycausey/scikit-learn,TomDLT/scikit-learn,RomainBrault/scikit-learn,zuku1985/scikit-learn,icdishb/scikit-learn,arabenjamin/scikit-learn,sarahgrogan/scikit-learn,... | ---
+++
@@ -0,0 +1,18 @@
+# Last Change: Mon Aug 20 01:00 PM 2007 J
+# Implement partial application (should only be used if functools is not
+# available (eg python < 2.5)
+
+class partial:
+ def __init__(self, fun, *args, **kwargs):
+ self.fun = fun
+ self.pending = args[:]
+ self.kwargs = k... | |
51e04ff17bccb4b71b8d5db4057a782fd2f8520c | tools/touch_all_files.py | tools/touch_all_files.py | #!/usr/bin/python
"""
This script touches all files known to the database, creating a skeletal
mirror for local development.
"""
import sys, os
import store
def get_paths(cursor, prefix=None):
store.safe_execute(cursor, "SELECT python_version, name, filename FROM release_files")
for type, name, filename in c... | Add script to synthesize all uploaded files. Patch by Dan Callahan. | Add script to synthesize all uploaded files.
Patch by Dan Callahan.
| Python | bsd-3-clause | techtonik/pydotorg.pypi,techtonik/pydotorg.pypi | ---
+++
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+"""
+This script touches all files known to the database, creating a skeletal
+mirror for local development.
+"""
+
+import sys, os
+import store
+
+def get_paths(cursor, prefix=None):
+ store.safe_execute(cursor, "SELECT python_version, name, filename FROM release_file... | |
533559e20e377ce042591709e53d7dc7031d6205 | tests/test_directives.py | tests/test_directives.py | """tests/test_directives.py.
Tests to ensure that directives interact in the etimerpected mannor
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without... | """tests/test_directives.py.
Tests to ensure that directives interact in the etimerpected mannor
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without... | Add test for timer automatically inserted due to directive | Add test for timer automatically inserted due to directive
| Python | mit | giserh/hug,STANAPO/hug,MuhammadAlkarouri/hug,janusnic/hug,MuhammadAlkarouri/hug,janusnic/hug,gbn972/hug,MuhammadAlkarouri/hug,STANAPO/hug,shaunstanislaus/hug,yasoob/hug,jean/hug,philiptzou/hug,philiptzou/hug,jean/hug,shaunstanislaus/hug,origingod/hug,giserh/hug,yasoob/hug,timothycrosley/hug,alisaifee/hug,timothycrosley... | ---
+++
@@ -19,7 +19,10 @@
OTHER DEALINGS IN THE SOFTWARE.
"""
+import sys
import hug
+
+api = sys.modules[__name__]
def test_timer():
@@ -30,3 +33,9 @@
timer = hug.directives.timer('Time: {0}')
assert isinstance(timer.taken(), str)
assert isinstance(timer.start, float)
+
+ @hug.get()
+ ... |
a3939b572c51b7a721b758cb5b93364e4b156c13 | dev_tools/syspath.py | dev_tools/syspath.py | #!/usr/bin/env python
import sys
# path[0], is the directory containing the script that was used to invoke the Python interpreter
for s in sorted(sys.path[1:]):
print s
| Add script that dumps the python path | Add script that dumps the python path
| Python | apache-2.0 | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | ---
+++
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+import sys
+
+# path[0], is the directory containing the script that was used to invoke the Python interpreter
+for s in sorted(sys.path[1:]):
+ print s | |
f06a71a87daaaf0bc4b1f5701ce4c59805b70f6b | usr/bin/json_readable.py | usr/bin/json_readable.py | #!/usr/bin/env python
import json, os
for filename in os.listdir('.'):
if os.path.isfile(filename) and os.path.splitext(filename)[1].lower() == '.json':
with open(filename) as in_file:
data = json.load(in_file)
with open(filename, 'w') as out_file:
json.dump(data, out_file,... | Format all local .json files for human readability | Format all local .json files for human readability | Python | apache-2.0 | cclauss/Ten-lines-or-less | ---
+++
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+
+import json, os
+
+for filename in os.listdir('.'):
+ if os.path.isfile(filename) and os.path.splitext(filename)[1].lower() == '.json':
+ with open(filename) as in_file:
+ data = json.load(in_file)
+ with open(filename, 'w') as out_file:
+... | |
ed4d07fb2a7fa8f1dd30a2b7982940a5fe78275b | dakota_run_driver.py | dakota_run_driver.py | #! /usr/bin/env python
# Brokers communication between Dakota and SWASH through files.
#
# Arguments:
# $1 is 'params.in' from Dakota
# $2 is 'results.out' returned to Dakota
import sys
import os
import shutil
from subprocess import call
def driver():
"""Broker communication between Dakota and SWASH through ... | Add the analysis driver for the run step of the study | Add the analysis driver for the run step of the study
| Python | mit | mdpiper/dakota-swash-parameter-study,mdpiper/dakota-swash-parameter-study | ---
+++
@@ -0,0 +1,45 @@
+#! /usr/bin/env python
+# Brokers communication between Dakota and SWASH through files.
+#
+# Arguments:
+# $1 is 'params.in' from Dakota
+# $2 is 'results.out' returned to Dakota
+
+import sys
+import os
+import shutil
+from subprocess import call
+
+
+def driver():
+ """Broker commu... | |
dab192db863fdd694bb0adbce10fa2dd6c05353b | jrnl/__init__.py | jrnl/__init__.py | #!/usr/bin/env python
# encoding: utf-8
"""
jrnl is a simple journal application for your command line.
"""
__title__ = 'jrnl'
__version__ = '1.0.3'
__author__ = 'Manuel Ebert'
__license__ = 'MIT License'
__copyright__ = 'Copyright 2013 Manuel Ebert'
from . import Journal
from . import jrnl
| #!/usr/bin/env python
# encoding: utf-8
"""
jrnl is a simple journal application for your command line.
"""
__title__ = 'jrnl'
__version__ = '1.0.3'
__author__ = 'Manuel Ebert'
__license__ = 'MIT License'
__copyright__ = 'Copyright 2013 Manuel Ebert'
from . import Journal
from . import jrnl
from .jrnl import cli
| Make the cli work again. | Make the cli work again.
| Python | mit | rzyns/jrnl,philipsd6/jrnl,notbalanced/jrnl,flight16/jrnl,maebert/jrnl,MSylvia/jrnl,dzeban/jrnl,nikvdp/jrnl,cloudrave/jrnl-todos,MinchinWeb/jrnl,beni55/jrnl,zdravi/jrnl,Shir0kamii/jrnl | ---
+++
@@ -14,3 +14,4 @@
from . import Journal
from . import jrnl
+from .jrnl import cli |
8a668efbc266802a4f4e23c936d3589b230d9528 | nanpy/examples/blink_2boards.py | nanpy/examples/blink_2boards.py | #!/usr/bin/env python
# Author: Andrea Stagi <stagi.andrea@gmail.com>
# Description: keeps your led blinking on 2 boards
# Dependencies: None
from nanpy import (ArduinoApi, SerialManager)
from time import sleep
device_1 = '/dev/tty.usbmodem1411'
device_2 = '/dev/tty.usbmodem1431'
connection_1 = SerialManager(devic... | Add blink example on two different boards | Add blink example on two different boards
| Python | mit | joppi/nanpy,nanpy/nanpy | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+# Author: Andrea Stagi <stagi.andrea@gmail.com>
+# Description: keeps your led blinking on 2 boards
+# Dependencies: None
+
+from nanpy import (ArduinoApi, SerialManager)
+from time import sleep
+
+
+device_1 = '/dev/tty.usbmodem1411'
+device_2 = '/dev/tty.usbmodem14... | |
61a005ffbc988b6a20441841112890bb397f8ca3 | 2016_player_picks.py | 2016_player_picks.py |
stone = {"firstname": "chris", "lastname": "stone", "timestamp": "9/6/2016", "email": "stone@usisales.com",
"afc_east_1": "Patriots", "afc_east_2": "Jets", "afc_east_last": "Bills", "afc_north_1": "Steelers",
"afc_north_2": "Bengals", "afc_north_last": "Browns", "afc_south_1": "Colts", "afc_south_2"... | Create stub for 2016 NFLPool player picks | Create stub for 2016 NFLPool player picks
| Python | mit | prcutler/nflpool,prcutler/nflpool | ---
+++
@@ -0,0 +1,22 @@
+
+
+stone = {"firstname": "chris", "lastname": "stone", "timestamp": "9/6/2016", "email": "stone@usisales.com",
+ "afc_east_1": "Patriots", "afc_east_2": "Jets", "afc_east_last": "Bills", "afc_north_1": "Steelers",
+ "afc_north_2": "Bengals", "afc_north_last": "Browns", "afc_... | |
893e4292f6b1799bf5f1888fcbad41ec8b5a5951 | examples/tic_ql_tabular_selfplay_all.py | examples/tic_ql_tabular_selfplay_all.py | '''
In this example we use Q-learning via self-play to learn
the value function of all Tic-Tac-Toe positions.
'''
from capstone.environment import Environment
from capstone.game import TicTacToe
from capstone.mdp import GameMDP
from capstone.rl import QLearningSelfPlay
from capstone.rl.tabularf import TabularF
from cap... | Use Q-learning to learn all state-action values via self-play | Use Q-learning to learn all state-action values via self-play
| Python | mit | davidrobles/mlnd-capstone-code | ---
+++
@@ -0,0 +1,22 @@
+'''
+In this example we use Q-learning via self-play to learn
+the value function of all Tic-Tac-Toe positions.
+'''
+from capstone.environment import Environment
+from capstone.game import TicTacToe
+from capstone.mdp import GameMDP
+from capstone.rl import QLearningSelfPlay
+from capstone.... | |
a8419c46ceed655a276dad00a24e21f300fda543 | py/find-bottom-left-tree-value.py | py/find-bottom-left-tree-value.py | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def findBottomLeftValue(self, root):
"""
:type root: TreeNode
:rtype: int
"""
q =... | Add py solution for 513. Find Bottom Left Tree Value | Add py solution for 513. Find Bottom Left Tree Value
513. Find Bottom Left Tree Value: https://leetcode.com/problems/find-bottom-left-tree-value/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,20 @@
+# Definition for a binary tree node.
+# class TreeNode(object):
+# def __init__(self, x):
+# self.val = x
+# self.left = None
+# self.right = None
+
+class Solution(object):
+ def findBottomLeftValue(self, root):
+ """
+ :type root: TreeNode
+ ... | |
3dcf737fa6a6467e1c96d31325e26ecf20c50320 | test/test_logger.py | test/test_logger.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import print_function
from __future__ import unicode_literals
import logbook
import pytest
from sqliteschema import (
set_logger,
set_log_level,
)
class Test_set_logger(object):
@pytest.mark.param... | Add test cases for the logger | Add test cases for the logger
| Python | mit | thombashi/sqliteschema | ---
+++
@@ -0,0 +1,49 @@
+# encoding: utf-8
+
+"""
+.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
+"""
+
+from __future__ import print_function
+from __future__ import unicode_literals
+
+import logbook
+import pytest
+from sqliteschema import (
+ set_logger,
+ set_log_level,
+)
+
+
+class Tes... | |
8b0b7c19d2e2c015fd8ba7d5408b23334ee8874f | test/Configure/VariantDir2.py | test/Configure/VariantDir2.py | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | Add test case for configure failure. | Add test case for configure failure.
TryRun fails to find the executable when VariantDir is set up from
SConscript/SConstruct.
| Python | mit | Distrotech/scons,Distrotech/scons,Distrotech/scons,Distrotech/scons,Distrotech/scons | ---
+++
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to ... | |
1fd09e7328b1ebf41bc0790f2a96c18207b10077 | tests/test-sweep.py | tests/test-sweep.py | #!/usr/bin/env python
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
class Makefile(object):
def __init__(self):
self._fp = StringIO()
self._all = set()
self._targets = set()
def add_default(self, x):
self._all.add(x)
def build(self, ... | Add sine wave sweep test | Add sine wave sweep test
This test produces spectrograms like those available on the SRC
Comparisons web site.
http://src.infinitewave.ca/
| Python | bsd-2-clause | depp/libfresample,depp/libfresample,depp/libfresample,h6ah4i/libfresample,h6ah4i/libfresample | ---
+++
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+try:
+ from cStringIO import StringIO
+except ImportError:
+ from io import StringIO
+
+class Makefile(object):
+ def __init__(self):
+ self._fp = StringIO()
+ self._all = set()
+ self._targets = set()
+ def add_default(self, x):
+ ... | |
1165673d784eab36edcdc4ed4caf22dbd222874a | whois-scraper.py | whois-scraper.py | from lxml import html
from PIL import Image
import requests
def enlarge_image(image_file):
image = Image.open(image_file)
enlarged_size = map(lambda x: x*2, image.size)
enlarged_image = image.resize(enlarged_size)
return enlarged_image
def extract_text(image_file):
image = enlarge_image(image_file)
# Use Tess... | Add some preliminary code and function to enlarge image | Add some preliminary code and function to enlarge image
| Python | mit | SkullTech/whois-scraper | ---
+++
@@ -0,0 +1,20 @@
+from lxml import html
+from PIL import Image
+import requests
+
+def enlarge_image(image_file):
+ image = Image.open(image_file)
+ enlarged_size = map(lambda x: x*2, image.size)
+ enlarged_image = image.resize(enlarged_size)
+
+ return enlarged_image
+
+def extract_text(image_file):
+ image ... | |
1d1f9d5d8f4873d6a23c430a5629eaeddfd50d2a | subiquity/ui/views/network_default_route.py | subiquity/ui/views/network_default_route.py | # Copyright 2015 Canonical, Ltd.
#
# 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 distribute... | Add network set default route view | Add network set default route view
Signed-off-by: Adam Stokes <0a364f4bf549cc82d725fa7fd7ed34404be64079@ubuntu.com>
| Python | agpl-3.0 | CanonicalLtd/subiquity,CanonicalLtd/subiquity | ---
+++
@@ -0,0 +1,70 @@
+# Copyright 2015 Canonical, Ltd.
+#
+# 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 versio... | |
2c57f2143e21fa3d006d4e4e2737429fb60b4797 | tornado/setup_pg.py | tornado/setup_pg.py | from os.path import expanduser
from os import kill
import subprocess
import sys
import time
python = expanduser('~/FrameworkBenchmarks/installs/py2/bin/python')
cwd = expanduser('~/FrameworkBenchmarks/tornado')
def start(args, logfile, errfile):
subprocess.Popen(
python + " server.py --port=8080 --postg... | import os
import subprocess
import sys
import time
bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin')
python = os.path.expanduser(os.path.join(bin_dir, 'python'))
pip = os.path.expanduser(os.path.join(bin_dir, 'pip'))
cwd = os.path.expanduser('~/FrameworkBenchmarks/tornado')
def start(args, logf... | Call pip install before running server. | Call pip install before running server.
| Python | bsd-3-clause | knewmanTE/FrameworkBenchmarks,PermeAgility/FrameworkBenchmarks,circlespainter/FrameworkBenchmarks,raziel057/FrameworkBenchmarks,saturday06/FrameworkBenchmarks,circlespainter/FrameworkBenchmarks,sanjoydesk/FrameworkBenchmarks,ashawnbandy-te-tfb/FrameworkBenchmarks,markkolich/FrameworkBenchmarks,stefanocasazza/FrameworkB... | ---
+++
@@ -1,25 +1,29 @@
-from os.path import expanduser
-from os import kill
+import os
import subprocess
import sys
import time
-python = expanduser('~/FrameworkBenchmarks/installs/py2/bin/python')
-cwd = expanduser('~/FrameworkBenchmarks/tornado')
+bin_dir = os.path.expanduser('~/FrameworkBenchmarks/instal... |
9ec957af0c3d57dff4c05c1b7ed3e66e1c033f6b | nagios/check_idot_snowplows.py | nagios/check_idot_snowplows.py | """
Nagios check to see how much snowplow data we are currently ingesting
"""
import sys
import os
import psycopg2
POSTGIS = psycopg2.connect(database='postgis', host='iemdb', user='nobody')
pcursor = POSTGIS.cursor()
pcursor.execute("""
select count(*) from idot_snowplow_current WHERE
valid > now() - '30 minutes... | Add nagios check for idot snowplow ingest | Add nagios check for idot snowplow ingest | Python | mit | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | ---
+++
@@ -0,0 +1,26 @@
+"""
+ Nagios check to see how much snowplow data we are currently ingesting
+"""
+import sys
+import os
+import psycopg2
+
+POSTGIS = psycopg2.connect(database='postgis', host='iemdb', user='nobody')
+pcursor = POSTGIS.cursor()
+
+pcursor.execute("""
+ select count(*) from idot_snowplow_curr... | |
717b20e298547685ed0685bd09a4fac541034910 | example/map_flows.py | example/map_flows.py | from taskin import task
def get_servers(data):
return [
'foo.example.com',
'bar.example.com',
]
def create_something(data):
servers, name = data
for server in servers:
print('Creating: https://%s/%s' % (server, name))
def main():
flow = [
get_servers,
ta... | Add an example map flow | Add an example map flow
| Python | bsd-3-clause | ionrock/taskin | ---
+++
@@ -0,0 +1,26 @@
+from taskin import task
+
+
+def get_servers(data):
+ return [
+ 'foo.example.com',
+ 'bar.example.com',
+ ]
+
+
+def create_something(data):
+ servers, name = data
+ for server in servers:
+ print('Creating: https://%s/%s' % (server, name))
+
+
+def main():
... | |
61139332ce1bcfd145f16b8f3c411e178db4054c | numpy/core/tests/test_dtype.py | numpy/core/tests/test_dtype.py | import numpy as np
from numpy.testing import *
class TestBuiltin(TestCase):
def test_run(self):
"""Only test hash runs at all."""
for t in [np.int, np.float, np.complex, np.int32, np.str, np.object,
np.unicode]:
dt = np.dtype(t)
hash(dt)
class TestRecord(Tes... | Add some unit tests for the hashing protocol of dtype (fail currently). | Add some unit tests for the hashing protocol of dtype (fail currently).
git-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@6666 94b884b6-d6fd-0310-90d3-974f1d3f35e1
| Python | bsd-3-clause | teoliphant/numpy-refactor,efiring/numpy-work,efiring/numpy-work,Ademan/NumPy-GSoC,teoliphant/numpy-refactor,jasonmccampbell/numpy-refactor-sprint,teoliphant/numpy-refactor,jasonmccampbell/numpy-refactor-sprint,Ademan/NumPy-GSoC,teoliphant/numpy-refactor,illume/numpy3k,jasonmccampbell/numpy-refactor-sprint,chadnetzer/nu... | ---
+++
@@ -0,0 +1,66 @@
+import numpy as np
+from numpy.testing import *
+
+class TestBuiltin(TestCase):
+ def test_run(self):
+ """Only test hash runs at all."""
+ for t in [np.int, np.float, np.complex, np.int32, np.str, np.object,
+ np.unicode]:
+ dt = np.dtype(t)
+ ... | |
c3e7b563c3eeb24aa269f23672b8f469470908b7 | onetime/views.py | onetime/views.py | from datetime import datetime
from django.http import HttpResponseRedirect, HttpResponseGone
from django.shortcuts import get_object_or_404
from django.contrib.auth import login
from django.conf import settings
from onetime import utils
from onetime.models import Key
def cleanup(request):
utils.cleanup()
def lo... | from datetime import datetime
from django.http import HttpResponseRedirect, HttpResponseGone
from django.shortcuts import get_object_or_404
from django.contrib.auth import login
from django.conf import settings
from onetime import utils
from onetime.models import Key
def cleanup(request):
utils.cleanup()
def lo... | Add an option to redirect user to a page if the key is already expired. | Add an option to redirect user to a page if the key is already expired.
| Python | agpl-3.0 | ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,uploadcare/django-loginurl,ISIFoundation/influenzanet-website,vanschelven/cmsplugin-journal,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,fajran/django-loginurl,ISIFoundation/influenzanet-web... | ---
+++
@@ -11,13 +11,20 @@
def cleanup(request):
utils.cleanup()
-def login(request, key):
+def login(request, key, redirect_expired_to=None):
data = get_object_or_404(Key, key=key)
+ expired = False
if data.usage_left is not None and data.usage_left == 0:
- return HttpResponseGone()
+ ... |
a136eeefdd6cf276a0d4815fa39453737ed04727 | py/next-greater-element-iii.py | py/next-greater-element-iii.py | class Solution(object):
def nextGreaterElement(self, n):
"""
:type n: int
:rtype: int
"""
s = str(n)
for i, n in enumerate(reversed(s[:-1]), 1):
if n < s[-i]:
x, j = min((x, k) for k, x in enumerate(s[-i:]) if x > n)
ans = s... | Add py solution for 556. Next Greater Element III | Add py solution for 556. Next Greater Element III
556. Next Greater Element III: https://leetcode.com/problems/next-greater-element-iii/
Approach:
Observe the first item remaining in each step. The value will be added
1 << step either the remaining count is odd or it's a left-to-right
step. Hence the n | ... | Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,21 @@
+class Solution(object):
+ def nextGreaterElement(self, n):
+ """
+ :type n: int
+ :rtype: int
+ """
+ s = str(n)
+ for i, n in enumerate(reversed(s[:-1]), 1):
+ if n < s[-i]:
+ x, j = min((x, k) for k, x in enumerate(s[-i... | |
32d46fe3e080b13ab9ae9dc3d868e9a724cccda9 | tools/telemetry/telemetry/core/backends/chrome/ios_browser_finder_unittest.py | tools/telemetry/telemetry/core/backends/chrome/ios_browser_finder_unittest.py | # Copyright 2014 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 unittest
from telemetry.core import browser_options
from telemetry.core.backends.chrome import ios_browser_finder
from telemetry.unittest import test
... | Add unit test for IosBrowserFinder. | Add unit test for IosBrowserFinder.
This test checks if Chrome on iOS is running. It only
runs on iOS platforms.
BUG=None
Review URL: https://codereview.chromium.org/350583002
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@279143 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | krieger-od/nwjs_chromium.src,Fireblend/chromium-crosswalk,ltilve/chromium,axinging/chromium-crosswalk,jaruba/chromium.src,ltilve/chromium,Fireblend/chromium-crosswalk,dednal/chromium.src,mohamed--abdel-maksoud/chromium.src,Jonekee/chromium.src,Just-D/chromium-1,Pluto-tv/chromium-crosswalk,M4sse/chromium.src,M4sse/chrom... | ---
+++
@@ -0,0 +1,24 @@
+# Copyright 2014 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 unittest
+
+from telemetry.core import browser_options
+from telemetry.core.backends.chrome import ios_browser_finder
+f... | |
bc35e89d04e541f75fc12788893b21a3b876aaf9 | tail/tests/test_tail.py | tail/tests/test_tail.py | """
Tests for the tail implementation
"""
from tail import FileTail
def test_tail_from_file():
"""Tests that tail works as advertised from a file"""
from unittest.mock import mock_open, patch
# The mock_data we are using for our test
mock_data = """A
B
C
D
E
F
"""
mocked_open = mock_open(read_da... | Create test case for tail from file | Create test case for tail from file
| Python | mit | shuttle1987/tail,shuttle1987/tail | ---
+++
@@ -0,0 +1,33 @@
+"""
+Tests for the tail implementation
+"""
+
+from tail import FileTail
+
+def test_tail_from_file():
+ """Tests that tail works as advertised from a file"""
+
+ from unittest.mock import mock_open, patch
+
+ # The mock_data we are using for our test
+ mock_data = """A
+B
+C
+D
... | |
d21743f2543f8d953a837d75bff0fcdb0105f4db | feincms/module/page/extensions/changedate.py | feincms/module/page/extensions/changedate.py | """
Track the modification date for pages.
"""
from datetime import datetime
from django.db import models
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
def register(cls, admin_cls):
cls.add_to_class('creation_date', models.DateTimeField(_... | Add page extension for tracking page creation and modification dates. | Add page extension for tracking page creation and modification dates.
This can be used in conjunction with a response processor to set the "last-modified" or "etag" response headers.
| Python | bsd-3-clause | feincms/feincms,hgrimelid/feincms,pjdelport/feincms,joshuajonah/feincms,nickburlett/feincms,matthiask/django-content-editor,joshuajonah/feincms,matthiask/django-content-editor,matthiask/django-content-editor,nickburlett/feincms,michaelkuty/feincms,joshuajonah/feincms,mjl/feincms,michaelkuty/feincms,hgrimelid/feincms,jo... | ---
+++
@@ -0,0 +1,25 @@
+"""
+Track the modification date for pages.
+"""
+
+from datetime import datetime
+
+from django.db import models
+from django.db.models import Q
+from django.utils.translation import ugettext_lazy as _
+from django.conf import settings
+
+
+def register(cls, admin_cls):
+ cls.add_to_clas... | |
06e4fd4b7d4cc4c984a05887fce00f7c8bbdc174 | tests/notifiers/test_messaging.py | tests/notifiers/test_messaging.py | # Copyright 2014 Mirantis 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | Add missing tests for messaging notifer plugin | Add missing tests for messaging notifer plugin
Change-Id: I1a206fdbbb89c03b04eafe0ad850441094e363e5
| Python | apache-2.0 | stackforge/osprofiler,openstack/osprofiler,stackforge/osprofiler,openstack/osprofiler,stackforge/osprofiler,openstack/osprofiler | ---
+++
@@ -0,0 +1,52 @@
+# Copyright 2014 Mirantis 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.apache.org/licenses/LI... | |
387b5732c0b2231580ae04bf5088ef7ce59b0d84 | normalize_dataset.py | normalize_dataset.py | """Create multilabel data set with normalized spelling.
The input consists of a directory of text files containing the dataset in
historic spelling.
The data set consists of:
<sentence id>\t<sentence>\tEmotie_Liefde (embodied emotions labels separated by
_)
<sentence id>\t<sentence>\tNone ('None' if no words were tagg... | Add script to normalize the spelling in a dataset | Add script to normalize the spelling in a dataset
Added a script that normalizes the spelling in a dataset consisting of
files containing <sentence_id> \t <sentence> \t <label(s)>
| Python | apache-2.0 | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | ---
+++
@@ -0,0 +1,67 @@
+"""Create multilabel data set with normalized spelling.
+The input consists of a directory of text files containing the dataset in
+historic spelling.
+
+The data set consists of:
+<sentence id>\t<sentence>\tEmotie_Liefde (embodied emotions labels separated by
+_)
+<sentence id>\t<sentence>\... | |
65e689dd66124fcaa0ce8ab9f5029b727fba18e2 | src/compare_version_numbers.py | src/compare_version_numbers.py | """
Source : https://oj.leetcode.com/problems/compare-version-numbers/
Author : Changxi Wu
Date : 2015-01-23
Compare two version numbers version1 and version2.
if version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0.
You may assume that the version strings are non-empty and contain on... | Add solution for compare version numbers | Add solution for compare version numbers
| Python | mit | chancyWu/leetcode | ---
+++
@@ -0,0 +1,53 @@
+"""
+Source : https://oj.leetcode.com/problems/compare-version-numbers/
+Author : Changxi Wu
+Date : 2015-01-23
+
+Compare two version numbers version1 and version2.
+
+if version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0.
+
+You may assume that the version... | |
2dd5afae12dc7d58c3349f2df2694eeb77ca0298 | examples/test_spinn_tracks4.py | examples/test_spinn_tracks4.py | import nengo
import nengo_pushbot
import numpy as np
model = nengo.Network()
with model:
input = nengo.Node(lambda t: [0.5*np.sin(t), 0.5*np.cos(t)])
a = nengo.Ensemble(nengo.LIF(100), dimensions=2)
#b = nengo.Ensemble(nengo.LIF(100), dimensions=2)
#c = nengo.Ensemble(nengo.LIF(100), dimensions=2)
... | Test driving robot via serial input | Test driving robot via serial input
| Python | mit | ctn-waterloo/nengo_pushbot,ctn-waterloo/nengo_pushbot | ---
+++
@@ -0,0 +1,43 @@
+import nengo
+
+import nengo_pushbot
+import numpy as np
+
+model = nengo.Network()
+with model:
+ input = nengo.Node(lambda t: [0.5*np.sin(t), 0.5*np.cos(t)])
+
+ a = nengo.Ensemble(nengo.LIF(100), dimensions=2)
+ #b = nengo.Ensemble(nengo.LIF(100), dimensions=2)
+ #c = nengo.En... | |
d777a19bb804ae1a4268702da00d3138b028b386 | contrib/dump_docs.py | contrib/dump_docs.py | #!/usr/bin/env python
"""
Start the process and dump the documentation to the doc dir
"""
import socket, subprocess, time,os
env = os.environ
env['L1FWD_BTS_HOST'] = '127.0.0.1'
bts_proc = subprocess.Popen(["./src/osmo-bts-sysmo/sysmobts-remote",
"-c", "./doc/examples/osmo-bts.cfg"], env = env,
stdin=None, stdo... | Add a python script to start sysmobts-remote and dump docs | contrib: Add a python script to start sysmobts-remote and dump docs
This starts sysmobts-remote and dumps the documentation about the
VTY to the doc/ directory.
$ ./contrib/dump_docs.py
this writes doc/vty_reference.xml
| Python | agpl-3.0 | osmocom/osmo-bts,telenoobie/osmo-bts,shimaore/osmo-bts,geosphere/osmo-bts,telenoobie/osmo-bts,shimaore/osmo-bts,osmocom/osmo-bts,shimaore/osmo-bts,geosphere/osmo-bts,geosphere/osmo-bts,telenoobie/osmo-bts,shimaore/osmo-bts,geosphere/osmo-bts,telenoobie/osmo-bts,osmocom/osmo-bts | ---
+++
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+"""
+Start the process and dump the documentation to the doc dir
+"""
+
+import socket, subprocess, time,os
+
+env = os.environ
+env['L1FWD_BTS_HOST'] = '127.0.0.1'
+
+bts_proc = subprocess.Popen(["./src/osmo-bts-sysmo/sysmobts-remote",
+ "-c", "./doc/examples/osmo-... | |
89c17110f9d17e99ea7686e884cfba91b4762d57 | pybaseball/lahman.py | pybaseball/lahman.py | ################################################
# WORK IN PROGRESS: ADD LAHMAN DB TO PYBASEBALL
# TODO: Make a callable function that retrieves the Lahman db
# Considerations: users should have a way to pull just the parts they want
# within their code without having to write / save permanently. They should
# also ha... | Add starter code for Lahman db | Add starter code for Lahman db
| Python | mit | jldbc/pybaseball | ---
+++
@@ -0,0 +1,18 @@
+################################################
+# WORK IN PROGRESS: ADD LAHMAN DB TO PYBASEBALL
+# TODO: Make a callable function that retrieves the Lahman db
+# Considerations: users should have a way to pull just the parts they want
+# within their code without having to write / save pe... | |
0e9e63a48c5f3e02fb49d0068363ac5442b39e37 | discussion/models.py | discussion/models.py | from django.contrib.auth.models import User
from django.db import models
class Discussion(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=255)
slug = models.SlugField()
def __unicode__(self):
return self.name
class Post(models.Model):
discussion = models... | from django.contrib.auth.models import User
from django.db import models
class Discussion(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=255)
slug = models.SlugField()
def __unicode__(self):
return self.name
class Post(models.Model):
discussion = models... | Add a body to posts | Add a body to posts
| Python | bsd-2-clause | incuna/django-discussion,lehins/lehins-discussion,lehins/lehins-discussion,incuna/django-discussion,lehins/lehins-discussion | ---
+++
@@ -16,6 +16,7 @@
user = models.ForeignKey(User)
name = models.CharField(max_length=255)
slug = models.SlugField()
+ body = models.TextField()
posts_file = models.FileField(upload_to='uploads/posts',
blank=True, null=True)
|
20d77f66e0287b3aab08b4cf14f23e7e5672aefd | db_setup/nflpool_picks.py | db_setup/nflpool_picks.py | import sqlite3
conn = sqlite3.connect('nflpool.sqlite')
cur = conn.cursor()
# Do some setup
cur.executescript('''
DROP TABLE IF EXISTS Player;
CREATE TABLE Picks (
firstname TEXT NOT NULL,
lastname TEXT NOT NULL,
id INTEGER NOT NULL PRIMARY KEY UNIQUE,
season TEXT NOT NULL UNIQUE,
email TE... | Create database import script for the Picks table (each NFLPool Player's picks for a given season) | Create database import script for the Picks table (each NFLPool Player's picks for a given season)
| Python | mit | prcutler/nflpool,prcutler/nflpool | ---
+++
@@ -0,0 +1,83 @@
+import sqlite3
+
+conn = sqlite3.connect('nflpool.sqlite')
+cur = conn.cursor()
+
+# Do some setup
+cur.executescript('''
+DROP TABLE IF EXISTS Player;
+
+CREATE TABLE Picks (
+ firstname TEXT NOT NULL,
+ lastname TEXT NOT NULL,
+ id INTEGER NOT NULL PRIMARY KEY UNIQUE,
+ ... | |
8ad4627973db344e228a9170aef030ab58efdeb9 | src/ggrc/converters/__init__.py | src/ggrc/converters/__init__.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
from ggrc.converters.sections import SectionsConverter
all_converters = [('sectio... | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
from ggrc.converters.sections import SectionsConverter
from ggrc.models import (
... | Add column order and importable objects lists | Add column order and importable objects lists
| Python | apache-2.0 | edofic/ggrc-core,hasanalom/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,NejcZupec/ggrc-core,selahssea/ggrc-core,jmakov/ggrc-core,j0gurt/ggrc-core,NejcZupec/ggrc-core,NejcZupec/ggrc-core,josthkko/ggrc-core,jmakov/ggrc-core,VinnieJohns/ggrc-core,edofic/ggrc-core,selahssea/ggrc-core,hyperNURb/ggrc-... | ---
+++
@@ -4,10 +4,58 @@
# Maintained By: dan@reciprocitylabs.com
from ggrc.converters.sections import SectionsConverter
+from ggrc.models import (
+ Audit, Control, ControlAssessment, DataAsset, Directive, Contract,
+ Policy, Regulation, Standard, Facility, Market, Objective, Option,
+ OrgGroup, Vendor... |
8141d6cafb4a1c8986ec7065f27d536d98cc9916 | Modules/Biophotonics/python/iMC/script_plot_one_spectrum.py | Modules/Biophotonics/python/iMC/script_plot_one_spectrum.py | '''
Created on Oct 12, 2015
@author: wirkert
'''
import pickle
import logging
import numpy as np
import matplotlib.pyplot as plt
import luigi
import tasks_regression as rt
from msi.plot import plot
from msi.msi import Msi
import msi.normalize as norm
import scriptpaths as sp
sp.ROOT_FOLDER = "/media/wirkert/data/D... | Add little script calculate sample spectra. | Add little script calculate sample spectra.
| Python | bsd-3-clause | RabadanLab/MITKats,MITK/MITK,MITK/MITK,RabadanLab/MITKats,MITK/MITK,MITK/MITK,fmilano/mitk,fmilano/mitk,fmilano/mitk,iwegner/MITK,RabadanLab/MITKats,iwegner/MITK,RabadanLab/MITKats,iwegner/MITK,RabadanLab/MITKats,MITK/MITK,fmilano/mitk,iwegner/MITK,fmilano/mitk,iwegner/MITK,fmilano/mitk,fmilano/mitk,RabadanLab/MITKats,... | ---
+++
@@ -0,0 +1,70 @@
+'''
+Created on Oct 12, 2015
+
+@author: wirkert
+'''
+
+import pickle
+import logging
+
+import numpy as np
+import matplotlib.pyplot as plt
+import luigi
+
+import tasks_regression as rt
+from msi.plot import plot
+from msi.msi import Msi
+import msi.normalize as norm
+import scriptpaths a... | |
6be3e0c5264ca2750a77ac1dbd4175502e51fd3c | ceph_deploy/tests/parser/test_admin.py | ceph_deploy/tests/parser/test_admin.py | import pytest
from ceph_deploy.cli import get_parser
class TestParserAdmin(object):
def setup(self):
self.parser = get_parser()
def test_admin_help(self, capsys):
with pytest.raises(SystemExit):
self.parser.parse_args('admin --help'.split())
out, err = capsys.readouterr(... | Add argparse tests for ceph-deploy admin | [RM-11742] Add argparse tests for ceph-deploy admin
Signed-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>
| Python | mit | Vicente-Cheng/ceph-deploy,ceph/ceph-deploy,codenrhoden/ceph-deploy,shenhequnying/ceph-deploy,branto1/ceph-deploy,ghxandsky/ceph-deploy,imzhulei/ceph-deploy,isyippee/ceph-deploy,trhoden/ceph-deploy,zhouyuan/ceph-deploy,Vicente-Cheng/ceph-deploy,zhouyuan/ceph-deploy,ceph/ceph-deploy,osynge/ceph-deploy,SUSE/ceph-deploy-to... | ---
+++
@@ -0,0 +1,32 @@
+import pytest
+
+from ceph_deploy.cli import get_parser
+
+
+class TestParserAdmin(object):
+
+ def setup(self):
+ self.parser = get_parser()
+
+ def test_admin_help(self, capsys):
+ with pytest.raises(SystemExit):
+ self.parser.parse_args('admin --help'.split(... | |
2523d34d4f3e26a408c7ec0e43708efea77f03a9 | workflow/cndic_naver_search.py | workflow/cndic_naver_search.py | # Naver Search Workflow for Alfred 2
# Copyright (C) 2013 Jinuk Baek
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later versi... | Add to support the chinese library | Add to support the chinese library
| Python | mit | Kuniz/alfnaversearch,Kuniz/alfnaversearch | ---
+++
@@ -0,0 +1,76 @@
+# Naver Search Workflow for Alfred 2
+# Copyright (C) 2013 Jinuk Baek
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or... | |
1e7b84155623691fb9fc1cec4efa6386938f3e72 | core/migrations/0055_update_username_validators.py | core/migrations/0055_update_username_validators.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-22 22:03
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0054_add_provider__cloud_config_and_timezone'),
]
... | Add missing migration (updating validators=) | Add missing migration (updating validators=)
| Python | apache-2.0 | CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend | ---
+++
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-22 22:03
+from __future__ import unicode_literals
+
+import django.core.validators
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('core', '0054_add_provide... | |
48217e5317412a9b5fb8181b6915963783efeaf2 | tests/test_historical_klines.py | tests/test_historical_klines.py | #!/usr/bin/env python
# coding=utf-8
from binance.client import Client
import pytest
import requests_mock
client = Client('api_key', 'api_secret')
def test_exact_amount():
"""Test Exact amount returned"""
first_res = []
row = [1519892340000,"0.00099400","0.00099810","0.00099400","0.00099810","4806.040... | Add test for kline result of exact amount | Add test for kline result of exact amount
| Python | mit | sammchardy/python-binance | ---
+++
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# coding=utf-8
+
+from binance.client import Client
+import pytest
+import requests_mock
+
+
+client = Client('api_key', 'api_secret')
+
+
+def test_exact_amount():
+ """Test Exact amount returned"""
+
+ first_res = []
+ row = [1519892340000,"0.00099400","0.00... | |
c663f6b6e31832fae682c2c527955b13682b701e | course_discovery/apps/course_metadata/migrations/0127_remove_courserun_learner_testimonials.py | course_discovery/apps/course_metadata/migrations/0127_remove_courserun_learner_testimonials.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-07 17:16
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('course_metadata', '0126_course_has_ofac_restrictions'),
]
operations = [
migration... | Remove learner_testimonials column from course_metadata course run table | Remove learner_testimonials column from course_metadata course run table
| Python | agpl-3.0 | edx/course-discovery,edx/course-discovery,edx/course-discovery,edx/course-discovery | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.15 on 2018-11-07 17:16
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('course_metadata', '0126_course_has_ofac_restrictions'),
+ ... | |
b75e10f3235e9215458071279b67910627a95180 | ceam/framework/celery_tasks.py | ceam/framework/celery_tasks.py | import os
from time import time
import logging
import pandas as pd
from celery import Celery
from billiard import current_process
app = Celery()
@app.task(autoretry_for=(Exception,), max_retries=2)
def worker(draw_number, component_config, branch_config, logging_directory):
worker = current_process().index
... | Add celery based job runner | Add celery based job runner
| Python | bsd-3-clause | ihmeuw/vivarium | ---
+++
@@ -0,0 +1,42 @@
+import os
+from time import time
+import logging
+
+import pandas as pd
+
+from celery import Celery
+from billiard import current_process
+
+
+app = Celery()
+
+@app.task(autoretry_for=(Exception,), max_retries=2)
+def worker(draw_number, component_config, branch_config, logging_directory):... | |
164f43f902b89b84b4f0d474f4d3e0a18924110d | selection_test.py | selection_test.py | import quicksort.quicksort
import random_selection.random_selection
import sys
import time
from random import randint
def main(max_len, check):
for n in [2**(n+1) for n in range(max_len)]:
arr = [randint(0, 2**max_len) for n in range(n)]
median = int((len(arr)+1)/2) - 1
current_time = time.time()
result = r... | Add test of randomized select algorithm | Add test of randomized select algorithm
Similar to the sorting algorithm tests, selection_test.py checks
the runtime and correctness of the randomized selection algorithm
for exponentially increasing n.
Because it checks for correctness with quicksort, it can't test for
very large n (sorting runtime grows a lot faste... | Python | mit | timpel/stanford-algs,timpel/stanford-algs | ---
+++
@@ -0,0 +1,29 @@
+import quicksort.quicksort
+import random_selection.random_selection
+import sys
+import time
+from random import randint
+
+def main(max_len, check):
+ for n in [2**(n+1) for n in range(max_len)]:
+ arr = [randint(0, 2**max_len) for n in range(n)]
+
+ median = int((len(arr)+1)/2) - 1
+
+ ... | |
82d34111295fdfa35d0e9815053498e935d415af | examples/store_datetimes.py | examples/store_datetimes.py | import h5py
import numpy as np
arr = np.array([np.datetime64('2019-09-22T17:38:30')])
with h5py.File('datetimes.h5', 'w') as f:
# Create dataset
f['data'] = arr.astype(h5py.opaque_dtype(arr.dtype))
# Read
print(f['data'][:])
| Add example script to store & read datetime | Add example script to store & read datetime
| Python | bsd-3-clause | h5py/h5py,h5py/h5py,h5py/h5py | ---
+++
@@ -0,0 +1,11 @@
+import h5py
+import numpy as np
+
+arr = np.array([np.datetime64('2019-09-22T17:38:30')])
+
+with h5py.File('datetimes.h5', 'w') as f:
+ # Create dataset
+ f['data'] = arr.astype(h5py.opaque_dtype(arr.dtype))
+
+ # Read
+ print(f['data'][:]) | |
52236b1ad285683d828b248e462a7b984d31e636 | examples/world.py | examples/world.py | import ogr
import pylab
from numpy import asarray
from shapely.wkb import loads
source = ogr.Open("/var/gis/data/world/world_borders.shp")
borders = source.GetLayerByName("world_borders")
fig = pylab.figure(1, figsize=(4,2), dpi=300)
while 1:
feature = borders.GetNextFeature()
if not feature:
break
... | Add example of connecting OGR to matplotlib through shapely and numpy | Add example of connecting OGR to matplotlib through shapely and numpy
git-svn-id: 30e8e193f18ae0331cc1220771e45549f871ece9@749 b426a367-1105-0410-b9ff-cdf4ab011145
| Python | bsd-3-clause | jdmcbr/Shapely,mindw/shapely,jdmcbr/Shapely,mouadino/Shapely,abali96/Shapely,abali96/Shapely,mouadino/Shapely,mindw/shapely | ---
+++
@@ -0,0 +1,21 @@
+import ogr
+import pylab
+from numpy import asarray
+
+from shapely.wkb import loads
+
+source = ogr.Open("/var/gis/data/world/world_borders.shp")
+borders = source.GetLayerByName("world_borders")
+
+fig = pylab.figure(1, figsize=(4,2), dpi=300)
+
+while 1:
+ feature = borders.GetNextFeat... | |
fd33fadc260cda2bd2395f027457f990ab05480b | registration/migrations/0008_auto_20160418_2250.py | registration/migrations/0008_auto_20160418_2250.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-18 13:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registration', '0007_auto_20160416_1217'),
]
operations = [
migrations.Alter... | Add migration for Registration changed | Add migration for Registration changed
| Python | mit | pythonkr/pyconapac-2016,pythonkr/pyconapac-2016,pythonkr/pyconapac-2016 | ---
+++
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.4 on 2016-04-18 13:50
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('registration', '0007_auto_20160416_1217'),
+ ]
+
+ ... | |
9f6f6b727458eb331d370443074a58d1efa6d755 | kolibri/logger/migrations/0003_auto_20170531_1140.py | kolibri/logger/migrations/0003_auto_20170531_1140.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2017-05-31 18:40
from __future__ import unicode_literals
import kolibri.core.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('logger', '0002_auto_20170518_1031'),
]
operations = [
mig... | Add migration for blank true. | Add migration for blank true.
| Python | mit | mrpau/kolibri,benjaoming/kolibri,indirectlylit/kolibri,benjaoming/kolibri,christianmemije/kolibri,lyw07/kolibri,benjaoming/kolibri,learningequality/kolibri,rtibbles/kolibri,indirectlylit/kolibri,indirectlylit/kolibri,jonboiser/kolibri,MingDai/kolibri,DXCanas/kolibri,rtibbles/kolibri,benjaoming/kolibri,rtibbles/kolibri,... | ---
+++
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2017-05-31 18:40
+from __future__ import unicode_literals
+
+import kolibri.core.fields
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('logger', '0002_auto_20170518_1031')... | |
b04e3787de29d4bee68854e15a7e783cbe3c3bd0 | pymks/tests/test_microstructure_generator.py | pymks/tests/test_microstructure_generator.py | import pytest
import numpy as np
from pymks.datasets import make_microstructure
@pytest.mark.xfail
def test_size_and_grain_size_failure():
make_microstructure(n_samples=1, size=(7, 7), grain_size=(8, 1))
@pytest.mark.xfail
def test_volume_fraction_failure():
make_microstructure(n_samples=1, volume_fraction=... | Add test for microstructure generator | Add test for microstructure generator
address #242
Add tests for microstructure generator to test new functionality. These
tests change that correct quantities of the volume fraction are
generated and that in appropriate sets of parameters fail.
| Python | mit | awhite40/pymks,davidbrough1/pymks,davidbrough1/pymks | ---
+++
@@ -0,0 +1,46 @@
+import pytest
+import numpy as np
+from pymks.datasets import make_microstructure
+
+
+@pytest.mark.xfail
+def test_size_and_grain_size_failure():
+ make_microstructure(n_samples=1, size=(7, 7), grain_size=(8, 1))
+
+
+@pytest.mark.xfail
+def test_volume_fraction_failure():
+ make_micr... | |
77e980157f51af421eceb7c7b7a84945d8d33a91 | scripts/caffe_to_chainermodel.py | scripts/caffe_to_chainermodel.py | #!/usr/bin/env python
from __future__ import print_function
import argparse
import os.path as osp
import caffe
import chainer.functions as F
import chainer.serializers as S
import fcn
from fcn.models import FCN8s
data_dir = fcn.get_data_dir()
caffemodel = osp.join(data_dir, 'voc-fcn8s/fcn8s-heavy-pascal.caffemodel... | Convert caffemodel of FCN8s to chainer model | Convert caffemodel of FCN8s to chainer model
| Python | mit | wkentaro/fcn | ---
+++
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+import argparse
+import os.path as osp
+
+import caffe
+import chainer.functions as F
+import chainer.serializers as S
+
+import fcn
+from fcn.models import FCN8s
+
+
+data_dir = fcn.get_data_dir()
+caffemodel = osp.join(data_di... | |
b0d699066799d0309e7af3f8892f56a6feaac778 | new_tests.py | new_tests.py | from numpy import testing
import unittest
import numpy as np
from numpy import pi
from robot_arm import RobotArm
class TestRobotArm(unittest.TestCase):
def setUp(self):
self.lengths = (3, 2, 2,)
self.destinations = (
(5, 0,),
(4, 2,),
(6, 0.5),
... | Write tests for new functionality; several destinations | Write tests for new functionality; several destinations
| Python | mit | JakobGM/robotarm-optimization | ---
+++
@@ -0,0 +1,50 @@
+from numpy import testing
+import unittest
+import numpy as np
+from numpy import pi
+
+from robot_arm import RobotArm
+
+
+class TestRobotArm(unittest.TestCase):
+
+ def setUp(self):
+ self.lengths = (3, 2, 2,)
+ self.destinations = (
+ (5, 0,),
+ ... | |
50f698c2fdd90bc4b3e60a583c196381fc23e099 | lltk-restful/base.py | lltk-restful/base.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import lltk
import lltk.generic
import lltk.caching
import lltk.exceptions
from flask import Flask
from flask import jsonify, request
__author__ = 'Markus Beuckelmann'
__author_email__ = 'email@markus-beuckelmann.de'
__version__ = '0.1.0'
DEBUG = True
CACHING = True
NAME = ... | Implement a rudimentary API for LLTK | Implement a rudimentary API for LLTK
| Python | agpl-3.0 | lltk/lltk-restful | ---
+++
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+# -*- coding: UTF-8 -*-
+
+import lltk
+import lltk.generic
+import lltk.caching
+import lltk.exceptions
+
+from flask import Flask
+from flask import jsonify, request
+
+__author__ = 'Markus Beuckelmann'
+__author_email__ = 'email@markus-beuckelmann.de'
+__version__ = '0.... | |
4f404a71cb7ee912bca8184fe94c97d6cfba1186 | preprocessing_tools/solid_rotation_y.py | preprocessing_tools/solid_rotation_y.py | '''
Rotates the protein by a solid angle on the plane xz
'''
import numpy
import os
from argparse import ArgumentParser
from move_prot_helper import (read_vertex, read_pqr, rotate_y,
modify_pqr)
def read_inputs():
"""
Parse command-line arguments to run move_protein.
User s... | Add script to rotate a solid angle in the xz plane | Add script to rotate a solid angle in the xz plane
| Python | bsd-3-clause | barbagroup/pygbe,barbagroup/pygbe,barbagroup/pygbe | ---
+++
@@ -0,0 +1,78 @@
+'''
+Rotates the protein by a solid angle on the plane xz
+'''
+
+import numpy
+import os
+
+from argparse import ArgumentParser
+
+from move_prot_helper import (read_vertex, read_pqr, rotate_y,
+ modify_pqr)
+
+def read_inputs():
+ """
+ Parse command-line ... | |
116babc38e2e4023eb0b45eabc02050ed433e240 | scripts/mod_info.py | scripts/mod_info.py | # mod_info.py
#
# Display information about a Protracker module.
#
# Written & released by Keir Fraser <keir.xen@gmail.com>
#
# This is free and unencumbered software released into the public domain.
# See the file COPYING for more details, or visit <http://unlicense.org>.
import struct, sys
with open(sys.argv[1],... | Include a helpful MOD analyser script | scripts: Include a helpful MOD analyser script
| Python | unlicense | keirf/Amiga-Stuff,keirf/Amiga-Stuff | ---
+++
@@ -0,0 +1,48 @@
+# mod_info.py
+#
+# Display information about a Protracker module.
+#
+# Written & released by Keir Fraser <keir.xen@gmail.com>
+#
+# This is free and unencumbered software released into the public domain.
+# See the file COPYING for more details, or visit <http://unlicense.org>.
+
+impor... | |
07467664b699612e10b51bbeafdce79a9d1e0127 | test/test_util.py | test/test_util.py | from __future__ import unicode_literals
try:
import io
StringIO = io.StringIO
except ImportError:
import StringIO
StringIO = StringIO.StringIO
import os
import shutil
import sys
import tempfile
import unittest
import cudnnenv
class TestSafeTempDir(unittest.TestCase):
def test_safe_temp_dir(self... | Write unit test for utility functions | Write unit test for utility functions
| Python | mit | unnonouno/cudnnenv | ---
+++
@@ -0,0 +1,74 @@
+from __future__ import unicode_literals
+
+try:
+ import io
+ StringIO = io.StringIO
+except ImportError:
+ import StringIO
+ StringIO = StringIO.StringIO
+import os
+import shutil
+import sys
+import tempfile
+import unittest
+
+import cudnnenv
+
+
+class TestSafeTempDir(unittes... | |
256648ad4effd9811d7c35ed6ef45de67f108926 | tests/conftest.py | tests/conftest.py | import sys
def pytest_addoption(parser):
parser.addoption('--typing', action='store', default='typing')
def pytest_configure(config):
if config.option.typing == 'no':
sys.modules['typing'] = None
elif config.option.typing != 'typing':
sys.modules['typing'] = __import__(config.option.typi... | Add pytest option for specifying the typing module to use | Add pytest option for specifying the typing module to use
| Python | mit | bintoro/overloading.py | ---
+++
@@ -0,0 +1,13 @@
+import sys
+
+
+def pytest_addoption(parser):
+ parser.addoption('--typing', action='store', default='typing')
+
+
+def pytest_configure(config):
+ if config.option.typing == 'no':
+ sys.modules['typing'] = None
+ elif config.option.typing != 'typing':
+ sys.modules['t... | |
1d8cbf94f127571358aee97677a09f7cea3bf3a7 | p23serialize/util.py | p23serialize/util.py | from . import str_mode
if str_mode == 'bytes':
unicode_type = unicode
else: # str_mode == 'unicode'
unicode_type = str
def recursive_unicode(obj):
if isinstance(obj, bytes):
return obj.decode('latin1')
elif isinstance(obj, list):
return [recursive_unicode(_) for _ in obj]
else:
... | Add helper functions for to/from bytes/unicode | Add helper functions for to/from bytes/unicode
| Python | mit | rh314/p23serialize | ---
+++
@@ -0,0 +1,22 @@
+from . import str_mode
+
+if str_mode == 'bytes':
+ unicode_type = unicode
+else: # str_mode == 'unicode'
+ unicode_type = str
+
+def recursive_unicode(obj):
+ if isinstance(obj, bytes):
+ return obj.decode('latin1')
+ elif isinstance(obj, list):
+ return [recursiv... | |
01f21a16e4bcecccf51a565b51222ab18b79adb4 | st2common/tests/unit/test_util_shell.py | st2common/tests/unit/test_util_shell.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | Add tests for shell utils. | Add tests for shell utils.
| Python | apache-2.0 | tonybaloney/st2,pixelrebel/st2,Plexxi/st2,emedvedev/st2,pixelrebel/st2,grengojbo/st2,armab/st2,StackStorm/st2,StackStorm/st2,lakshmi-kannan/st2,Itxaka/st2,emedvedev/st2,punalpatel/st2,alfasin/st2,punalpatel/st2,dennybaa/st2,pinterb/st2,dennybaa/st2,StackStorm/st2,peak6/st2,armab/st2,tonybaloney/st2,Plexxi/st2,Plexxi/st... | ---
+++
@@ -0,0 +1,101 @@
+# Licensed to the StackStorm, Inc ('StackStorm') under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (t... | |
b40512e834e88f24c20885cddb220188fce11339 | accounts/migrations/0004_auto_20150227_2347.py | accounts/migrations/0004_auto_20150227_2347.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0003_auto_20150227_2158'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
... | Add verbose names to UserProfile fields. | Add verbose names to UserProfile fields.
| Python | bsd-3-clause | ugoertz/django-familio,ugoertz/django-familio,ugoertz/django-familio,ugoertz/django-familio | ---
+++
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('accounts', '0003_auto_20150227_2158'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ ... | |
008625fef55f8f58ab80b883d34ae5d40e55c721 | test_binheap.py | test_binheap.py | import pytest
from binheap import Binheap
def test_init_bh():
b = Binheap()
assert b.binlist is []
c = Binheap([1, 2])
assert c.binlist == [1, 2]
| Add initial test for binheap | Add initial test for binheap
| Python | mit | constanthatz/data-structures | ---
+++
@@ -0,0 +1,9 @@
+import pytest
+from binheap import Binheap
+
+
+def test_init_bh():
+ b = Binheap()
+ assert b.binlist is []
+ c = Binheap([1, 2])
+ assert c.binlist == [1, 2] | |
80e80bff7603e852710df6c9de613b1781877b2d | tests/python/typeinference/same_name.py | tests/python/typeinference/same_name.py | class A(object):
def method(self):
return 1
A().method() ## type int
class A(object):
def method(self):
return "test"
A().method() ## type str
| Test case for two classes with the same name in one module. | Test case for two classes with the same name in one module.
| Python | lgpl-2.1 | retoo/pystructure,retoo/pystructure,retoo/pystructure,retoo/pystructure | ---
+++
@@ -0,0 +1,12 @@
+class A(object):
+ def method(self):
+ return 1
+
+A().method() ## type int
+
+
+class A(object):
+ def method(self):
+ return "test"
+
+A().method() ## type str | |
542bc508b587a39a6e709d469c1cb166dee9eef4 | app/grandchallenge/retina_api/renderers.py | app/grandchallenge/retina_api/renderers.py | import base64
from rest_framework import renderers
class Base64Renderer(renderers.BaseRenderer):
media_type = "image/png;base64"
format = "base64"
charset = "utf-8"
render_style = "text"
def render(self, data, media_type=None, renderer_context=None):
return base64.b64encode(data)
| Add renderer for base64 content | Add renderer for base64 content
| Python | apache-2.0 | comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django | ---
+++
@@ -0,0 +1,13 @@
+import base64
+
+from rest_framework import renderers
+
+
+class Base64Renderer(renderers.BaseRenderer):
+ media_type = "image/png;base64"
+ format = "base64"
+ charset = "utf-8"
+ render_style = "text"
+
+ def render(self, data, media_type=None, renderer_context=None):
+ ... | |
e8832b5f126f39672cfc48159148b490c1e3c6c7 | tests/import_time.py | tests/import_time.py | import subprocess
import sys
import pytest
AVG_ITERATIONS = 15
# Maximum expected import time for rasa module when running on a Travis VM.
# Keep in mind the hardware configuration where tests are run:
# https://docs.travis-ci.com/user/reference/overview/
MAX_IMPORT_TIME_S = 0.3
def average_import_time(n, module):
... | Add test for import time. | Add test for import time.
| Python | apache-2.0 | RasaHQ/rasa_nlu,RasaHQ/rasa_nlu,RasaHQ/rasa_nlu | ---
+++
@@ -0,0 +1,49 @@
+import subprocess
+import sys
+import pytest
+
+AVG_ITERATIONS = 15
+
+# Maximum expected import time for rasa module when running on a Travis VM.
+# Keep in mind the hardware configuration where tests are run:
+# https://docs.travis-ci.com/user/reference/overview/
+MAX_IMPORT_TIME_S = 0.3
+... | |
1a311415c007bebcb2c6f042816a86a7cc32ec36 | src/foobar/tests/test_admin.py | src/foobar/tests/test_admin.py | from django.apps import apps
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.test import TestCase
class TestAdminViews(TestCase):
def setUp(self):
User = get_user_model()
self.user = User.objects.create_superu... | Test admin views in order to catch stupid errors | Test admin views in order to catch stupid errors | Python | mit | uppsaladatavetare/foobar-api,uppsaladatavetare/foobar-api,uppsaladatavetare/foobar-api | ---
+++
@@ -0,0 +1,44 @@
+from django.apps import apps
+from django.contrib import admin
+from django.contrib.auth import get_user_model
+from django.core.urlresolvers import reverse
+from django.test import TestCase
+
+
+class TestAdminViews(TestCase):
+ def setUp(self):
+ User = get_user_model()
+ ... | |
353df423343688f206c0f3628092608d1a95f5c2 | mopidy/backends/__init__.py | mopidy/backends/__init__.py | import logging
import time
from mopidy.exceptions import MpdNotImplemented
from mopidy.models import Playlist
logger = logging.getLogger('backends.base')
class BaseBackend(object):
current_playlist = None
library = None
playback = None
stored_playlists = None
uri_handlers = []
class BasePlayback... | import logging
import time
from mopidy.exceptions import MpdNotImplemented
from mopidy.models import Playlist
logger = logging.getLogger('backends.base')
class BaseBackend(object):
current_playlist = None
library = None
playback = None
stored_playlists = None
uri_handlers = []
class BasePlayback... | Use textual defaults for status constants | Use textual defaults for status constants
| Python | apache-2.0 | SuperStarPL/mopidy,liamw9534/mopidy,glogiotatidis/mopidy,mopidy/mopidy,hkariti/mopidy,tkem/mopidy,hkariti/mopidy,jcass77/mopidy,bencevans/mopidy,pacificIT/mopidy,jodal/mopidy,jmarsik/mopidy,woutervanwijk/mopidy,kingosticks/mopidy,hkariti/mopidy,jodal/mopidy,mokieyue/mopidy,pacificIT/mopidy,mokieyue/mopidy,vrs01/mopidy,... | ---
+++
@@ -14,9 +14,9 @@
uri_handlers = []
class BasePlaybackController(object):
- PAUSED = 1
- PLAYING = 2
- STOPPED = 3
+ PAUSED = 'paused'
+ PLAYING = 'playing'
+ STOPPED = 'stopped'
def __init__(self, backend):
self.backend = backend |
112dcd24d9888c8376afa36535870eb861982d9c | create_review.py | create_review.py | import sys
import os
import subprocess
initial_layout = [
"---",
"layout: default",
"permalink: 'reviews/{}.html'",
"title: '{}'",
"---\n",
"# {}",
"---\n",
"## Idea\n\n",
"## Method\n\n",
"## Observations\n\n"
]
def main():
paper_name = sys.argv[1]
formatted_name = su... | Add script to automate review markdown file creation | Add script to automate review markdown file creation
| Python | cc0-1.0 | v1n337/research-review-notes,v1n337/research-review-notes,v1n337/research-review-notes | ---
+++
@@ -0,0 +1,30 @@
+import sys
+import os
+import subprocess
+
+initial_layout = [
+ "---",
+ "layout: default",
+ "permalink: 'reviews/{}.html'",
+ "title: '{}'",
+ "---\n",
+ "# {}",
+ "---\n",
+ "## Idea\n\n",
+ "## Method\n\n",
+ "## Observations\n\n"
+]
+
+
+def main():
+ p... | |
7594e2b4405be3fb8b5b07fc9b5fd79ecc5a5aec | py/maximum-binary-tree.py | py/maximum-binary-tree.py | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def constructMaximumBinaryTree(self, nums, start=None, end=None):
"""
:type nums: List[int]
:rtyp... | Add py solution for 654. Maximum Binary Tree | Add py solution for 654. Maximum Binary Tree
654. Maximum Binary Tree: https://leetcode.com/problems/maximum-binary-tree/
Approach 1:
1. Modify the method to accept (nums, start, end), and the method
will return the subtree of nums[start:end]
2. Find the maximum and split the array into left, right pa... | Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,25 @@
+# Definition for a binary tree node.
+# class TreeNode(object):
+# def __init__(self, x):
+# self.val = x
+# self.left = None
+# self.right = None
+
+class Solution(object):
+ def constructMaximumBinaryTree(self, nums, start=None, end=None):
+ """
+ ... | |
01acf59474ac2ccd5612bba9b7fa925ebec1e5c5 | py/valid-palindrome-ii.py | py/valid-palindrome-ii.py | class Solution(object):
def validPalindromeIdx(self, s, i, j, todelete):
while i < j:
if s[i] == s[j]:
i += 1
j -= 1
else:
return bool(todelete) and (self.validPalindromeIdx(s, i + 1, j, todelete - 1) or self.validPalindromeIdx(s, i, j ... | Add py solution for 680. Valid Palindrome II | Add py solution for 680. Valid Palindrome II
680. Valid Palindrome II: https://leetcode.com/problems/valid-palindrome-ii/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,16 @@
+class Solution(object):
+ def validPalindromeIdx(self, s, i, j, todelete):
+ while i < j:
+ if s[i] == s[j]:
+ i += 1
+ j -= 1
+ else:
+ return bool(todelete) and (self.validPalindromeIdx(s, i + 1, j, todelete - 1) ... | |
01d848f77690bfafff1fdc28efb09b6c0e9e11bc | AutoUpdateProxy.py | AutoUpdateProxy.py | import json
import time
import traceback
import requests
from lxml import etree
def updateProxy():
with open('F:\liuming\Shadowsocks\gui-config.json', encoding='utf-8', mode='r') as file:
proxyInfo = json.load(file)
while 1:
requestHeaders = {
'Accept-Encoding': 'gzip, deflate, sd... | Add an utility getting the free proxy from the certain site. | Add an utility getting the free proxy from the certain site.
| Python | mit | i2it/XYWYCrawler | ---
+++
@@ -0,0 +1,68 @@
+import json
+import time
+import traceback
+
+import requests
+from lxml import etree
+
+
+def updateProxy():
+ with open('F:\liuming\Shadowsocks\gui-config.json', encoding='utf-8', mode='r') as file:
+ proxyInfo = json.load(file)
+ while 1:
+ requestHeaders = {
+ ... | |
27f0b6481675fcc07ec2ce09acbd2bd1ac8cf197 | testing/test_main.py | testing/test_main.py | import os.path
mainfile = os.path.join(
os.path.dirname(__file__), "..", "setuptools_scm", "__main__.py")
with open(mainfile) as f:
code = compile(f.read(), "__main__.py", 'exec')
exec(code)
| Test 'python -m setuptools_scm' invocation (__main__.py). | Test 'python -m setuptools_scm' invocation (__main__.py).
| Python | mit | esben/setuptools_scm,pypa/setuptools_scm,RonnyPfannschmidt/setuptools_scm,pypa/setuptools_scm,RonnyPfannschmidt/setuptools_scm | ---
+++
@@ -0,0 +1,7 @@
+import os.path
+
+mainfile = os.path.join(
+ os.path.dirname(__file__), "..", "setuptools_scm", "__main__.py")
+with open(mainfile) as f:
+ code = compile(f.read(), "__main__.py", 'exec')
+ exec(code) | |
2f3b3a34cfed77fea3c48ec17b8c2e40603bbcc0 | app/src/visualizer.py | app/src/visualizer.py | '''
Created on Sep 6, 2017
@author: Hossein
This file handles all the visualizations. It assumes that the status are ready and it
contains the function to generate the jpg's
'''
import os
from utils import get_visual_data_path
import numpy as np
import matplotlib.pyplot as plt
from turtledemo.__main__ import font... | Add a library for data visualization and add a dummy function | Add a library for data visualization and add a dummy function
| Python | apache-2.0 | TeMedy/DaViL,TeMedy/DaViL | ---
+++
@@ -0,0 +1,61 @@
+'''
+Created on Sep 6, 2017
+
+@author: Hossein
+
+This file handles all the visualizations. It assumes that the status are ready and it
+contains the function to generate the jpg's
+'''
+import os
+from utils import get_visual_data_path
+import numpy as np
+import matplotlib.pyplot as p... | |
f57ac6c3c7935d44956fac1295e417e34039c703 | bin/historical/migrations/move_trips_places_sections_stops_to_analysis_timeseries_db.py | bin/historical/migrations/move_trips_places_sections_stops_to_analysis_timeseries_db.py | import logging
import arrow
import emission.core.get_database as edb
import emission.core.wrapper.entry as ecwe
def convert_wrapper_to_entry(key, wrapper):
logging.debug("found user_id in wrapper %s" % wrapper["user_id"])
wrapper_entry = ecwe.Entry.create_entry(wrapper["user_id"], key, wrapper)
wrapper_en... | Add a new script to move existing entries to their correct location | Add a new script to move existing entries to their correct location
Now that we have moved it out of the usercache into its own class
| Python | bsd-3-clause | e-mission/e-mission-server,shankari/e-mission-server,sunil07t/e-mission-server,sunil07t/e-mission-server,yw374cornell/e-mission-server,e-mission/e-mission-server,yw374cornell/e-mission-server,shankari/e-mission-server,sunil07t/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,yw374cornell/e-mission-... | ---
+++
@@ -0,0 +1,44 @@
+import logging
+import arrow
+
+import emission.core.get_database as edb
+import emission.core.wrapper.entry as ecwe
+
+def convert_wrapper_to_entry(key, wrapper):
+ logging.debug("found user_id in wrapper %s" % wrapper["user_id"])
+ wrapper_entry = ecwe.Entry.create_entry(wrapper["use... | |
5159dcdbdb1b73a57a550b239b9a92ae7a98e73f | bindings/python/tests/runner.py | bindings/python/tests/runner.py | import summer
import unittest
class TestDataTypes (unittest.TestCase):
def testitem(self):
i = summer.ItemData ()
i['title'] = 'hello world'
self.assertEqual (i['title'], 'hello world') #first
# Make sure strings aren't freed
self.assertEqual (i['title'], 'hello world') #sec... | Add test case for last commit (should probably be squashed) | python-bindings: Add test case for last commit (should probably be squashed)
| Python | lgpl-2.1 | ozamosi/summer,ozamosi/summer,ozamosi/summer,ozamosi/summer | ---
+++
@@ -0,0 +1,13 @@
+import summer
+import unittest
+
+class TestDataTypes (unittest.TestCase):
+ def testitem(self):
+ i = summer.ItemData ()
+ i['title'] = 'hello world'
+ self.assertEqual (i['title'], 'hello world') #first
+ # Make sure strings aren't freed
+ self.assertE... | |
665e0ef301ca91eaa715c236e1db7e5566959b57 | impschedules/usermanagement.py | impschedules/usermanagement.py | from flask import Flask, render_template, flash, request, Markup, session, redirect, url_for, escape, Response, current_app, send_file
from werkzeug.security import generate_password_hash, check_password_hash
from functools import wraps
def login_required(fn):
@wraps(fn)
def decorated_function(*args, **kwargs)... | Move user management to a new file | Move user management to a new file
| Python | agpl-3.0 | pwyf/IATI-Implementation-Schedules,pwyf/IATI-Implementation-Schedules,pwyf/IATI-Implementation-Schedules,pwyf/IATI-Implementation-Schedules | ---
+++
@@ -0,0 +1,18 @@
+from flask import Flask, render_template, flash, request, Markup, session, redirect, url_for, escape, Response, current_app, send_file
+from werkzeug.security import generate_password_hash, check_password_hash
+from functools import wraps
+
+def login_required(fn):
+ @wraps(fn)
+ def d... | |
a7aa9301daeff4c93bd907f51114af68b36669df | redd/tests/test_api_data.py | redd/tests/test_api_data.py | #!/usr/bin/env python
from django.conf import settings
from django.test import TestCase
from django.test.client import Client
from django.utils import simplejson as json
from redd.models import Dataset
from redd.tests import utils
class TestAPIData(TestCase):
def setUp(self):
settings.CELERY_ALWAYS_EAGER... | Add test_get for api data (and missing file). | Add test_get for api data (and missing file).
| Python | mit | ibrahimcesar/panda,PalmBeachPost/panda,datadesk/panda,datadesk/panda,newsapps/panda,datadesk/panda,PalmBeachPost/panda,PalmBeachPost/panda,pandaproject/panda,ibrahimcesar/panda,NUKnightLab/panda,pandaproject/panda,pandaproject/panda,newsapps/panda,NUKnightLab/panda,ibrahimcesar/panda,newsapps/panda,NUKnightLab/panda,da... | ---
+++
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+
+from django.conf import settings
+from django.test import TestCase
+from django.test.client import Client
+from django.utils import simplejson as json
+
+from redd.models import Dataset
+from redd.tests import utils
+
+class TestAPIData(TestCase):
+ def setUp(self... | |
9eab96f40634c81ed53d54d2c9df126a445dfd56 | registry/spec_tools/util.py | registry/spec_tools/util.py | """Utility functions not closely tied to other spec_tools types."""
# Copyright (c) 2018-2019 Collabora, Ltd.
# Copyright (c) 2013-2019 The Khronos Group Inc.
#
# 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... | Add new local dependency of scripts. | Add new local dependency of scripts.
| Python | apache-2.0 | KhronosGroup/Vulkan-Headers,KhronosGroup/Vulkan-Headers,KhronosGroup/Vulkan-Headers | ---
+++
@@ -0,0 +1,68 @@
+"""Utility functions not closely tied to other spec_tools types."""
+# Copyright (c) 2018-2019 Collabora, Ltd.
+# Copyright (c) 2013-2019 The Khronos Group Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the Li... | |
1d7165dc88be1aea9a233c8e794ee66b99f1c70e | tools/rsyslog-cdn.py | tools/rsyslog-cdn.py | #!/usr/bin/python -u
import sys
import redis
import csv
import posixpath
import datetime
import logging
import logging.handlers
from email.utils import parsedate
PRECISIONS = [
("hour", "%y-%m-%d-%H", datetime.timedelta(days=2)),
("daily", "%y-%m-%d", datetime.timedelta(days=32)),
]
logger = logging.getLog... | Add a script to parse incoming CDN log entries | Add a script to parse incoming CDN log entries
| Python | bsd-3-clause | pydotorg/pypi,pydotorg/pypi,pydotorg/pypi,pydotorg/pypi | ---
+++
@@ -0,0 +1,74 @@
+#!/usr/bin/python -u
+import sys
+import redis
+import csv
+import posixpath
+import datetime
+import logging
+import logging.handlers
+
+from email.utils import parsedate
+
+
+PRECISIONS = [
+ ("hour", "%y-%m-%d-%H", datetime.timedelta(days=2)),
+ ("daily", "%y-%m-%d", datetime.timede... | |
2d3d63adac30db637cedd0280679db1100c39525 | tests/pool_connection_tests.py | tests/pool_connection_tests.py | """
Tests for Connection class in the pool module
"""
import mock
try:
import unittest2 as unittest
except ImportError:
import unittest
import weakref
from queries import pool
class ConnectionTests(unittest.TestCase):
def setUp(self):
self.handle = mock.Mock()
self.handle.close = mock.M... | Move pool.Connection tests into own file | Move pool.Connection tests into own file
| Python | bsd-3-clause | gmr/queries,gmr/queries | ---
+++
@@ -0,0 +1,80 @@
+"""
+Tests for Connection class in the pool module
+
+"""
+import mock
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
+import weakref
+
+from queries import pool
+
+
+class ConnectionTests(unittest.TestCase):
+
+ def setUp(self):
+ self.handle = m... | |
67cc1656a7d075c1136c6e18b63167792b8747c3 | assignment2/my_client.py | assignment2/my_client.py | import argparse
import ReplicatorClient
PORT = 3000
def main():
parser = argparse.ArgumentParser()
parser.add_argument("host", help="the ip of the host")
args = parser.parse_args()
print("Client is connecting to Server at {}:{}...".format(args.host, PORT))
client = ReplicatorClient(host=args.host,... | Add external client for pushing values | Add external client for pushing values
| Python | mit | rimpybharot/CMPE273 | ---
+++
@@ -0,0 +1,25 @@
+import argparse
+import ReplicatorClient
+
+PORT = 3000
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("host", help="the ip of the host")
+ args = parser.parse_args()
+ print("Client is connecting to Server at {}:{}...".format(args.host, PORT))
+ cli... | |
09099ab106ae4c0695502e3632e4ac1c2f459566 | apps/teams/bulk_actions.py | apps/teams/bulk_actions.py | from django.contrib.contenttypes.models import ContentType
from subtitles.models import SubtitleLanguage
from teams.signals import api_subtitles_approved
from utils.csv_parser import UnicodeReader
from videos.tasks import video_changed_tasks
def complete_approve_tasks(tasks):
lang_ct = ContentType.objects.get_for_... | from django.contrib.contenttypes.models import ContentType
from subtitles.models import SubtitleLanguage
from subtitles.signals import subtitles_published
from teams.signals import api_subtitles_approved
from utils.csv_parser import UnicodeReader
from videos.tasks import video_changed_tasks
def complete_approve_tasks(... | Send subtitles_published signal for bulk approvals | Send subtitles_published signal for bulk approvals
This fixes pculture/amara-enterprise#608
| Python | agpl-3.0 | pculture/unisubs,pculture/unisubs,wevoice/wesub,pculture/unisubs,wevoice/wesub,wevoice/wesub,pculture/unisubs,wevoice/wesub | ---
+++
@@ -1,5 +1,6 @@
from django.contrib.contenttypes.models import ContentType
from subtitles.models import SubtitleLanguage
+from subtitles.signals import subtitles_published
from teams.signals import api_subtitles_approved
from utils.csv_parser import UnicodeReader
from videos.tasks import video_changed_ta... |
dc038e9b0da446e4d8b3f3e5964d6d6b4ec82d8e | snowrunner/transfer_save.py | snowrunner/transfer_save.py | """Automate Snowrunner save file renaming described in https://steamcommunity.com/sharedfiles/filedetails/?id=2530914231"""
import argparse
import csv
import os
import shutil
def load_csv(csv_path):
save_dict = {}
with open(csv_path) as csvfile:
csv_reader = csv.reader(csvfile, delimiter=",", quotechar... | Add automated Snowrunner save file renaming | Add automated Snowrunner save file renaming
| Python | mit | esabouraud/scripts,esabouraud/scripts | ---
+++
@@ -0,0 +1,49 @@
+"""Automate Snowrunner save file renaming described in https://steamcommunity.com/sharedfiles/filedetails/?id=2530914231"""
+import argparse
+import csv
+import os
+import shutil
+
+def load_csv(csv_path):
+ save_dict = {}
+ with open(csv_path) as csvfile:
+ csv_reader = csv.rea... | |
3468794db82e020bc40c54a9399269169fbb37a8 | CodeFights/concatenateArrays.py | CodeFights/concatenateArrays.py | #!/usr/local/bin/python
# Code Fights Concatenate Arrays Problem
def concatenateArrays(a, b):
return a + b
def main():
tests = [
[[2, 2, 1], [10, 11], [2, 2, 1, 10, 11]],
[[1, 2], [3, 1, 2], [1, 2, 3, 1, 2]],
[[1], [], [1]],
[
[2, 10, 3, 9, 5, 11, 11],
... | Solve Code Fights concatenate arrays problem | Solve Code Fights concatenate arrays problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,38 @@
+#!/usr/local/bin/python
+# Code Fights Concatenate Arrays Problem
+
+
+def concatenateArrays(a, b):
+ return a + b
+
+
+def main():
+ tests = [
+ [[2, 2, 1], [10, 11], [2, 2, 1, 10, 11]],
+ [[1, 2], [3, 1, 2], [1, 2, 3, 1, 2]],
+ [[1], [], [1]],
+ [
+ ... | |
9116776bd62e6b7ae7a018fa2c2c0b3964c3fa7d | py/maximum-binary-tree.py | py/maximum-binary-tree.py | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def findMax(self, start, end):
bit_length = (end - start).bit_length() - 1
d = 1 << bit_length
re... | Add py solution for 654. Maximum Binary Tree | Add py solution for 654. Maximum Binary Tree
654. Maximum Binary Tree: https://leetcode.com/problems/maximum-binary-tree/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,35 @@
+# Definition for a binary tree node.
+# class TreeNode(object):
+# def __init__(self, x):
+# self.val = x
+# self.left = None
+# self.right = None
+
+class Solution(object):
+ def findMax(self, start, end):
+ bit_length = (end - start).bit_length() - 1
+... | |
e9c851ac5a328ed43c61df29b9a3b6129e08c7c5 | pylua/tests/test_while.py | pylua/tests/test_while.py | from .helpers import codetest
class TestWhile(object):
"""
tests for the lua if then else and various comparisons
"""
def test_simple_while(self):
ret = codetest("""
x = 0
while x < 10 do
x = x + 1
end
return ... | Implement simple for loop and SUBVN | Implement simple for loop and SUBVN
| Python | bsd-3-clause | fhahn/luna,fhahn/luna | ---
+++
@@ -0,0 +1,44 @@
+from .helpers import codetest
+
+
+class TestWhile(object):
+ """
+ tests for the lua if then else and various comparisons
+ """
+
+ def test_simple_while(self):
+ ret = codetest("""
+ x = 0
+ while x < 10 do
+ x = x + 1
+ ... | |
f659f773b7713fab2bb02a4a26eefc9e002145ca | test/tests/python-imports/container.py | test/tests/python-imports/container.py | import curses
import readline
import bz2
assert(bz2.decompress(bz2.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')
import zlib
assert(zlib.decompress(zlib.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')
| import curses
import readline
import bz2
assert(bz2.decompress(bz2.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')
import platform
if platform.python_implementation() != 'PyPy' and platform.python_version_tuple()[0] != '2':
# PyPy and Python 2 don't support lzma
import lzma
asse... | Add "lzma" to "python-imports" test | Add "lzma" to "python-imports" test
| Python | apache-2.0 | chorrell/official-images,docker-flink/official-images,docker-library/official-images,nodejs-docker-bot/official-images,jperrin/official-images,docker-library/official-images,chorrell/official-images,pesho/docker-official-images,benbc/docker-official-images,mattrobenolt/official-images,docker-flink/official-images,31z4/... | ---
+++
@@ -4,5 +4,11 @@
import bz2
assert(bz2.decompress(bz2.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')
+import platform
+if platform.python_implementation() != 'PyPy' and platform.python_version_tuple()[0] != '2':
+ # PyPy and Python 2 don't support lzma
+ import lzma
+ ... |
4308a409ea970a59be5965cce2617c7cecf8b5b6 | src/player.py | src/player.py | # card-fight-thingy - Simplistic battle card game... thingy
#
# The MIT License (MIT)
#
# Copyright (c) 2015 The Underscores
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restrict... | Add beginnings of Player class implementation | Add beginnings of Player class implementation
| Python | mit | TheUnderscores/card-fight-thingy | ---
+++
@@ -0,0 +1,43 @@
+# card-fight-thingy - Simplistic battle card game... thingy
+#
+# The MIT License (MIT)
+#
+# Copyright (c) 2015 The Underscores
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal... | |
5ed3bc5627b8dc3643f6a4d0d6ee782b701bdfd1 | InterleavePdf.py | InterleavePdf.py | import PyPDF2
from formlayout import fedit
paths = [('Input', ''), ('Output', '')]
pathsRead = fedit(paths,
title="Interleave pdf",
comment="Enter the full path to the source pdf and a path to output the result."
)
# Full path to files should be specified eg C:\U... | Add source file to repository. | Add source file to repository.
| Python | mit | sproberts92/interleave-pdf | ---
+++
@@ -0,0 +1,21 @@
+import PyPDF2
+from formlayout import fedit
+
+paths = [('Input', ''), ('Output', '')]
+
+pathsRead = fedit(paths,
+ title="Interleave pdf",
+ comment="Enter the full path to the source pdf and a path to output the result."
+ )
+# Full path... | |
b373bfeaaf9017b9c16b21adb495155e0345a05a | tests/testrepos/FoodRelations/combineCooccurrences.py | tests/testrepos/FoodRelations/combineCooccurrences.py | import argparse
import os
import codecs
from collections import Counter
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Merges cooccurrences files down to a single file')
parser.add_argument('--inDir',type=str,required=True,help='Directory containing cooccurrence files. Expected to be tab-de... | Add combine cooccurrence script for Food project | Add combine cooccurrence script for Food project
| Python | mit | jakelever/pubrunner,jakelever/pubrunner | ---
+++
@@ -0,0 +1,30 @@
+import argparse
+import os
+import codecs
+from collections import Counter
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser(description='Merges cooccurrences files down to a single file')
+ parser.add_argument('--inDir',type=str,required=True,help='Directory containing cooccu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.