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 |
|---|---|---|---|---|---|---|---|---|---|---|
ee62d6a972e5af72fc9a5e2e36d1a7822a1703af | samples/remote_veh_segv.py | samples/remote_veh_segv.py | import windows
import windows.test
from windows.generated_def.winstructs import *
#c = windows.test.pop_calc_64()
c = windows.test.pop_calc_64(dwCreationFlags=CREATE_SUSPENDED)
python_code = """
import windows
import ctypes
import windows
from windows.vectored_exception import VectoredException
import windows.gen... | Add sample on veh handle setup in remote process | Add sample on veh handle setup in remote process
| Python | bsd-3-clause | hakril/PythonForWindows | ---
+++
@@ -0,0 +1,38 @@
+import windows
+import windows.test
+
+from windows.generated_def.winstructs import *
+
+#c = windows.test.pop_calc_64()
+
+
+c = windows.test.pop_calc_64(dwCreationFlags=CREATE_SUSPENDED)
+
+
+python_code = """
+import windows
+import ctypes
+import windows
+from windows.vectored_exception ... | |
52a8a1cd093f8bdbaf0abfc85eff2d3682e24b12 | scripts/check-questions.py | scripts/check-questions.py | #!/usr/bin/env python3
import os
import sys
import json
import collections
import unicodedata
TEXT_FIELD = "t"
OPTIONS_FIELD = "o"
KIND_FIELD = "k"
CORRECT_FIELD = "c"
MANDATORY_FIELDS = {TEXT_FIELD, OPTIONS_FIELD, CORRECT_FIELD}
def norm(s):
return unicodedata.normalize("NFD", s)
def error(message, *, n):
... | Add Python script for questions linting | Add Python script for questions linting
| Python | bsd-3-clause | PavloKapyshin/rusk,PavloKapyshin/rusk,PavloKapyshin/rusk | ---
+++
@@ -0,0 +1,79 @@
+#!/usr/bin/env python3
+
+
+import os
+import sys
+import json
+import collections
+import unicodedata
+
+
+TEXT_FIELD = "t"
+OPTIONS_FIELD = "o"
+KIND_FIELD = "k"
+CORRECT_FIELD = "c"
+MANDATORY_FIELDS = {TEXT_FIELD, OPTIONS_FIELD, CORRECT_FIELD}
+
+
+def norm(s):
+ return unicodedata.no... | |
3a662b5820ea90c0cd63116a610ede25558c5562 | sourceterm/tests/test_srcequations.py | sourceterm/tests/test_srcequations.py | '''
Created on 25 Aug 2010
@author: ith
'''
import unittest
class Test(unittest.TestCase):
def testName(self):
pass
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testName']
unittest.main() | Add tests directory to sourceterm package and start test module. | Add tests directory to sourceterm package and start test module.
| Python | bsd-3-clause | ihuston/pyflation,ihuston/pyflation | ---
+++
@@ -0,0 +1,18 @@
+'''
+Created on 25 Aug 2010
+
+@author: ith
+'''
+import unittest
+
+
+class Test(unittest.TestCase):
+
+
+ def testName(self):
+ pass
+
+
+if __name__ == "__main__":
+ #import sys;sys.argv = ['', 'Test.testName']
+ unittest.main() | |
3dc9204c80f2f7be5f82200c059a6a62f02bf6c1 | www/pelicanconf.py | www/pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'IPython development team and Enthought, Inc.'
SITENAME = u'DistArray'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/Chicago'
DEFAULT_LANG = u'en'
# Feed generation is usually not desired when developing
FEED_ALL_... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'IPython development team and Enthought, Inc.'
SITENAME = u'DistArray'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/Chicago'
DEFAULT_LANG = u'en'
# Feed generation is usually not desired when developing
FEED_ALL_... | Update blogroll and social links. | Update blogroll and social links.
| Python | bsd-3-clause | enthought/distarray,enthought/distarray,RaoUmer/distarray,RaoUmer/distarray | ---
+++
@@ -18,14 +18,14 @@
TRANSLATION_FEED_ATOM = None
# Blogroll
-LINKS = (('Pelican', 'http://getpelican.com/'),
- ('Python.org', 'http://python.org/'),
- ('Jinja2', 'http://jinja.pocoo.org/'),
- ('You can modify those links in your config file', '#'),)
+LINKS = (('NumPy', 'http://www.... |
c4015ed868b65ce5c7ed660c84e252a950294642 | r1.py | r1.py | from datetime import date
import bs4
import itertools as it
import re
import requests
def grouper(iterable, n, fillvalue=None):
args = [iter(iterable)] * n
return it.izip_longest(fillvalue=fillvalue, *args)
def extract_name(bsitem):
return bsitem.find('span').text
def extract_price(bsitem):
reg = ... | Add basic functionality to query the (horrible) website. | Add basic functionality to query the (horrible) website.
| Python | mit | kdungs/R1D2 | ---
+++
@@ -0,0 +1,52 @@
+from datetime import date
+import bs4
+import itertools as it
+import re
+import requests
+
+
+def grouper(iterable, n, fillvalue=None):
+ args = [iter(iterable)] * n
+ return it.izip_longest(fillvalue=fillvalue, *args)
+
+
+def extract_name(bsitem):
+ return bsitem.find('span').tex... | |
265bedb193f8615f99daa63c921b572408921605 | test_quick_sort.py | test_quick_sort.py | # -*- coding: utf-8 -*-
from quick_sort import quick_sort
def test_sorted():
my_list = list(range(100))
quick_sort(my_list)
assert my_list == list(range(100))
def test_reverse():
my_list = list(range(100))[::-1]
quick_sort(my_list)
assert my_list == list(range(100))
def test_empty():
m... | Add tests for quick sort | Add tests for quick sort
| Python | mit | nbeck90/data_structures_2 | ---
+++
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+from quick_sort import quick_sort
+
+
+def test_sorted():
+ my_list = list(range(100))
+ quick_sort(my_list)
+ assert my_list == list(range(100))
+
+
+def test_reverse():
+ my_list = list(range(100))[::-1]
+ quick_sort(my_list)
+ assert my_list == l... | |
d4c7869d62635eca3108d743c2bc12c9f394d68a | tests/test_item.py | tests/test_item.py | import os, sys
inc_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, inc_path)
import archive
def test_item():
item = archive.Item('stairs')
assert item.metadata['metadata']['identifier'] == 'stairs'
def test_file():
item = archive.Item('stairs')
filename = 'glogo... | Add archive.File class, which allows downloading from archive.org | Add archive.File class, which allows downloading from archive.org
| Python | agpl-3.0 | brycedrennan/internetarchive,JesseWeinstein/internetarchive,dattasaurabh82/internetarchive,jjjake/internetarchive,wumpus/internetarchive | ---
+++
@@ -0,0 +1,21 @@
+import os, sys
+inc_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+sys.path.insert(0, inc_path)
+
+import archive
+
+def test_item():
+ item = archive.Item('stairs')
+ assert item.metadata['metadata']['identifier'] == 'stairs'
+
+
+def test_file():
+ item = arch... | |
fa4b4de37b38f0ff800bbd2ac007ab6521720258 | scripts/tests/test_box_migrate_to_external_account.py | scripts/tests/test_box_migrate_to_external_account.py | from nose.tools import *
from scripts.box.migrate_to_external_account import do_migration, get_targets
from framework.auth import Auth
from tests.base import OsfTestCase
from tests.factories import ProjectFactory, UserFactory
from website.addons.box.model import BoxUserSettings
from website.addons.box.tests.factori... | Add test for box migration script | Add test for box migration script
| Python | apache-2.0 | ticklemepierce/osf.io,haoyuchen1992/osf.io,Nesiehr/osf.io,wearpants/osf.io,zachjanicki/osf.io,acshi/osf.io,chennan47/osf.io,ZobairAlijan/osf.io,cwisecarver/osf.io,njantrania/osf.io,TomHeatwole/osf.io,chrisseto/osf.io,felliott/osf.io,erinspace/osf.io,TomBaxter/osf.io,abought/osf.io,jnayak1/osf.io,rdhyee/osf.io,aaxelb/os... | ---
+++
@@ -0,0 +1,93 @@
+from nose.tools import *
+
+from scripts.box.migrate_to_external_account import do_migration, get_targets
+
+from framework.auth import Auth
+
+from tests.base import OsfTestCase
+from tests.factories import ProjectFactory, UserFactory
+
+from website.addons.box.model import BoxUserSettings
... | |
86cae13f7dde04f7031ae111e596f2d8c03d5420 | tests/test_recorders.py | tests/test_recorders.py | import pytest
from plumbium.processresult import record, pipeline, call
from plumbium.recorders import CSVFile, StdOut
from collections import OrderedDict
@pytest.fixture
def simple_pipeline():
@record()
def recorded_function():
call(['echo', '6.35'])
def a_pipeline():
recorded_function()... | Add tests of CSVFile and StdOut recorders | Add tests of CSVFile and StdOut recorders
| Python | mit | jstutters/Plumbium | ---
+++
@@ -0,0 +1,56 @@
+import pytest
+from plumbium.processresult import record, pipeline, call
+from plumbium.recorders import CSVFile, StdOut
+from collections import OrderedDict
+
+
+@pytest.fixture
+def simple_pipeline():
+ @record()
+ def recorded_function():
+ call(['echo', '6.35'])
+
+ def a... | |
4bd9e4db4af430ae34ed87f695d72ae99ba5bb70 | solver.py | solver.py | from constraint import *
# Empty space is 0
# Brick is a 1
# Block is a 2
# West facing player - 3
# East facing player - 4
# Door - 5
level = [[1,1,1,1,1,1,1,1,1,1],
[1,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,... | Set up first test level, started to create constraints | Set up first test level, started to create constraints
| Python | mit | joeYeager/BlockDudeSolver | ---
+++
@@ -0,0 +1,42 @@
+from constraint import *
+
+# Empty space is 0
+# Brick is a 1
+# Block is a 2
+# West facing player - 3
+# East facing player - 4
+# Door - 5
+level = [[1,1,1,1,1,1,1,1,1,1],
+ [1,0,0,0,0,0,0,0,0,1],
+ [1,0,0,0,0,0,0,0,0,1],
+ [1,0,0,0,0,0,0,0,0,1],
+ [1,0,0,... | |
2fb5557aed14d047d1ae120f0ff91c0e355d779f | ref.py | ref.py | #!/usr/bin/env python2
import sys
import subprocess
"""
Usage:
./ref.py ./main -B 1000000 -t 3 -T 31
"""
system = subprocess.check_output
githash = system("git rev-parse HEAD", shell=True).strip()
date = system("date -Ihours", shell=True).strip()
filename = "reference.%s.%s" % (githash, date)
benchargs = sys.... | Add simple perf measuring tool | Add simple perf measuring tool
| Python | mit | cemeyer/xkcd-skein-brute,cemeyer/xkcd-skein-brute,cemeyer/xkcd-skein-brute | ---
+++
@@ -0,0 +1,27 @@
+#!/usr/bin/env python2
+
+import sys
+import subprocess
+
+"""
+Usage:
+ ./ref.py ./main -B 1000000 -t 3 -T 31
+"""
+
+system = subprocess.check_output
+
+githash = system("git rev-parse HEAD", shell=True).strip()
+date = system("date -Ihours", shell=True).strip()
+
+filename = "reference... | |
e0786c5798b35b911193de1b4e3694b7ad8cad76 | tests/test_generate_admin_metadata.py | tests/test_generate_admin_metadata.py | """Test the generate_admin_metadata helper function."""
def test_generate_admin_metadata():
import dtoolcore
from dtoolcore import generate_admin_metadata
admin_metadata = generate_admin_metadata("ds-name", "creator-name")
assert len(admin_metadata["uuid"]) == 36
assert admin_metadata["dtoolcore_ve... | Add unit test for generate_admin_metadata helper function | Add unit test for generate_admin_metadata helper function
| Python | mit | JIC-CSB/dtoolcore | ---
+++
@@ -0,0 +1,11 @@
+"""Test the generate_admin_metadata helper function."""
+
+def test_generate_admin_metadata():
+ import dtoolcore
+ from dtoolcore import generate_admin_metadata
+ admin_metadata = generate_admin_metadata("ds-name", "creator-name")
+ assert len(admin_metadata["uuid"]) == 36
+ ... | |
724dc6ff77e9494e9519cb507cf43644034d5ca6 | run_2.py | run_2.py | #!/usr/bin/python3
#
# start pytrain
#
import os
import sys
MYDIR = os.path.dirname(sys.argv[0])
os.system(MYDIR+"/run.sh")
if len(sys.argv)==1:
sys.argv.append("10.0.0.6")
os.system("chromium http://%s:8000/index.html"%(sys.argv[1]))
| Integrate switch 10 and introduce couplings. | Integrate switch 10 and introduce couplings.
| Python | apache-2.0 | wglas85/pytrain,wglas85/pytrain,wglas85/pytrain,wglas85/pytrain | ---
+++
@@ -0,0 +1,13 @@
+#!/usr/bin/python3
+#
+# start pytrain
+#
+import os
+import sys
+
+MYDIR = os.path.dirname(sys.argv[0])
+
+os.system(MYDIR+"/run.sh")
+if len(sys.argv)==1:
+ sys.argv.append("10.0.0.6")
+os.system("chromium http://%s:8000/index.html"%(sys.argv[1])) | |
6953c04104eb4cc3eb908026f2420e3978371616 | doc/viewcwl-json.py | doc/viewcwl-json.py | #!/usr/bin/env python
import fnmatch
import requests
import time
import os
import glob
# You can alternatively define these in travis.yml as env vars or arguments
BASE_URL = 'https://view.commonwl.org/workflows'
#get the cwl in l7g/cwl-version
matches = []
for root, dirnames, filenames in os.walk('cwl-version'):
... | Move working view.cwl script to doc folder | Move working view.cwl script to doc folder
Arvados-DCO-1.1-Signed-off-by: Benjamin Carr <ben@curii.com>
| Python | agpl-3.0 | curoverse/l7g,curoverse/l7g,curoverse/l7g,curoverse/l7g,curoverse/l7g,curoverse/l7g,curoverse/l7g | ---
+++
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+
+import fnmatch
+import requests
+import time
+import os
+import glob
+
+# You can alternatively define these in travis.yml as env vars or arguments
+BASE_URL = 'https://view.commonwl.org/workflows'
+
+#get the cwl in l7g/cwl-version
+matches = []
+for root, dirnames,... | |
aee2363f6c6995a124b3c0ad358e83dc815ea808 | alembic/versions/3fc4c97dc6bd_remove_redundant_user_subscription_.py | alembic/versions/3fc4c97dc6bd_remove_redundant_user_subscription_.py | """remove redundant user subscription fields
Revision ID: 3fc4c97dc6bd
Revises: 3d723944025f
Create Date: 2015-01-27 18:11:15.822193
"""
# revision identifiers, used by Alembic.
revision = '3fc4c97dc6bd'
down_revision = '3d723944025f'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy a... | Remove redundant subscription fields from user model. | Remove redundant subscription fields from user model.
| Python | apache-2.0 | Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2 | ---
+++
@@ -0,0 +1,30 @@
+"""remove redundant user subscription fields
+
+Revision ID: 3fc4c97dc6bd
+Revises: 3d723944025f
+Create Date: 2015-01-27 18:11:15.822193
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '3fc4c97dc6bd'
+down_revision = '3d723944025f'
+branch_labels = None
+depends_on = None
+
+... | |
76d2386bfa9e61ac17bca396384772ae70fb4563 | gauss.py | gauss.py | #!/usr/bin/env python3
#Copyright 2015 BRendan Perrine
import random
random.seed()
print (random.gauss(0,1), "Is a normal distribution with mean zero and standard deviation and varience of one")
| Add one liner to add ability to print a normal distribution with mean zero and varience one | Add one liner to add ability to print a normal distribution with mean zero and varience one
| Python | mit | ianorlin/pyrandtoys | ---
+++
@@ -0,0 +1,9 @@
+#!/usr/bin/env python3
+
+#Copyright 2015 BRendan Perrine
+
+import random
+
+random.seed()
+
+print (random.gauss(0,1), "Is a normal distribution with mean zero and standard deviation and varience of one") | |
9fb6d0ea74aacc77f06d36805760270854e53eba | setup.py | setup.py | import os
from setuptools import setup, find_packages
import calendarium
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except IOError:
return ''
setup(
name="django-calendarium",
version=calendarium.__version__,
description=read('DESCRIP... | import os
from setuptools import setup, find_packages
import calendarium
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except IOError:
return ''
setup(
name="django-calendarium",
version=calendarium.__version__,
description=read('DESCRIP... | Add missing django_libs test requirement | Add missing django_libs test requirement
| Python | mit | claudep/django-calendarium,claudep/django-calendarium,bitmazk/django-calendarium,bitmazk/django-calendarium,claudep/django-calendarium,bitmazk/django-calendarium,claudep/django-calendarium | ---
+++
@@ -26,6 +26,7 @@
tests_require=[
'fabric',
'factory_boy<2.0.0',
+ 'django_libs',
'django-nose',
'coverage',
'django-coverage', |
95fdd1f96ad4d54fb75ea134ea2195808d4c1116 | bigO.py | bigO.py | import timeit
import random
for i in range (10000, 100000, 20000):
t = timeit.Timer("random.randrange(%d) in x"%i, "from __main__ import random, x")
x = list(range(i))
list_time = t.timeit(number = 1000)
x = {j:None for j in range(i)}
dict_time = t.timeit(number = 1000)
print "Counter: " + str(i) + " L... | Add python script to check big-O notation | Add python script to check big-O notation
| Python | mit | prabhugs/scripts,prabhugs/scripts | ---
+++
@@ -0,0 +1,13 @@
+import timeit
+import random
+
+for i in range (10000, 100000, 20000):
+ t = timeit.Timer("random.randrange(%d) in x"%i, "from __main__ import random, x")
+
+ x = list(range(i))
+ list_time = t.timeit(number = 1000)
+
+ x = {j:None for j in range(i)}
+ dict_time = t.timeit(number = 1000... | |
a0ae12ddf581eb77af5ce5c6498c26745bd2cfcb | stats.py | stats.py | #!/usr/bin/python
# encoding: utf-8
from __future__ import with_statement
import argparse, re, sys
def filter(args):
bytes_extractor = re.compile(r"([0-9]+) bytes")
with args.output:
with args.input:
for line in args.input:
if line.startswith("avr-size"):
... | Add script to extract code/data size after make examples. | Add script to extract code/data size after make examples.
| Python | lgpl-2.1 | jfpoilpret/fast-arduino-lib,jfpoilpret/fast-arduino-lib,jfpoilpret/fast-arduino-lib,jfpoilpret/fast-arduino-lib | ---
+++
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+# encoding: utf-8
+
+from __future__ import with_statement
+import argparse, re, sys
+
+def filter(args):
+ bytes_extractor = re.compile(r"([0-9]+) bytes")
+ with args.output:
+ with args.input:
+ for line in args.input:
+ if line.sta... | |
7b0005eb7d2b2e05a9fd833a2771573aec69c199 | tests/compare_test_data.py | tests/compare_test_data.py | import os
import sys
import glob
import h5py
from QGL import *
import QGL
BASE_AWG_DIR = QGL.config.AWGDir
BASE_TEST_DIR = './test_data/awg/'
def compare_sequences():
test_subdirs = ['TestAPS1', 'TestAPS2']
for subdir in test_subdirs:
testdirs = glob.glob(os.path.join(BASE_TEST_DIR, subdir, '*'))
... | Add script for comparing test vectors. | Add script for comparing test vectors.
Note: does not yet include the `plot_pulse_files_compare` method because that
needs some cleanup.
| Python | apache-2.0 | BBN-Q/QGL,BBN-Q/QGL | ---
+++
@@ -0,0 +1,51 @@
+import os
+import sys
+import glob
+import h5py
+
+from QGL import *
+import QGL
+
+BASE_AWG_DIR = QGL.config.AWGDir
+BASE_TEST_DIR = './test_data/awg/'
+
+def compare_sequences():
+ test_subdirs = ['TestAPS1', 'TestAPS2']
+ for subdir in test_subdirs:
+ testdirs = glob.glob(os.... | |
514f744bc39129a241e704e4ea282befcd31b1b7 | tests/functional/test_about_page.py | tests/functional/test_about_page.py | from .base import FunctionalTest
class AboutPageTest(FunctionalTest):
def test_about_page_navigation(self):
self.browser.get(self.live_server_url)
self.browser.set_window_size(1024, 768)
about_link = self.browser.find_element_by_link_text('ABOUT US')
about_link.click()
... | Add about page functional test | Add about page functional test
Test the about page navigation and expected content
| Python | bsd-3-clause | andela-kndungu/compshop,kevgathuku/compshop,andela-kndungu/compshop,andela-kndungu/compshop,kevgathuku/compshop,kevgathuku/compshop,kevgathuku/compshop,andela-kndungu/compshop | ---
+++
@@ -0,0 +1,18 @@
+from .base import FunctionalTest
+
+
+class AboutPageTest(FunctionalTest):
+
+ def test_about_page_navigation(self):
+ self.browser.get(self.live_server_url)
+
+ self.browser.set_window_size(1024, 768)
+
+ about_link = self.browser.find_element_by_link_text('ABOUT US'... | |
a45b62ab76324db2ae4a0842b901fec8e463e2f0 | tests/test_vector2_ctor.py | tests/test_vector2_ctor.py | import pytest # type: ignore
from hypothesis import given
from utils import floats, vectors, vector_likes
from ppb_vector import Vector2
class V(Vector2): pass
@pytest.mark.parametrize('cls', [Vector2, V])
@given(x=vectors())
def test_ctor_vector_like(cls, x: Vector2):
for x_like in vector_likes(x):
v... | Add tests for the constructor | tests: Add tests for the constructor
| Python | artistic-2.0 | ppb/ppb-vector,ppb/ppb-vector | ---
+++
@@ -0,0 +1,23 @@
+import pytest # type: ignore
+from hypothesis import given
+from utils import floats, vectors, vector_likes
+
+from ppb_vector import Vector2
+
+
+class V(Vector2): pass
+
+
+@pytest.mark.parametrize('cls', [Vector2, V])
+@given(x=vectors())
+def test_ctor_vector_like(cls, x: Vector2):
+ ... | |
21bee0c5b92d03a4803baf237c460223308ebb9f | examples/fakecode.py | examples/fakecode.py | # Get the hash
# 01/07/2017
# Melissa Hoffman
# Get the current repo
import os
import subprocess
testdir='/Users/melissahoffman1/'
repo = testdir
# Check if the repo is a git repo and get githash
def get_git_hash(path):
os.chdir(path)
try:
sha = subprocess.check_output(['git','rev-parse','HEAD'],... | Add a fake source code so you can embed it in the example | Add a fake source code so you can embed it in the example
| Python | mit | MetaPlot/MetaPlot | ---
+++
@@ -0,0 +1,31 @@
+# Get the hash
+# 01/07/2017
+# Melissa Hoffman
+
+# Get the current repo
+
+import os
+import subprocess
+
+testdir='/Users/melissahoffman1/'
+repo = testdir
+
+# Check if the repo is a git repo and get githash
+
+def get_git_hash(path):
+ os.chdir(path)
+ try:
+ sha = subpro... | |
210f9c6acefdf2f51d33baa1ed7a2c131729fb93 | common/djangoapps/third_party_auth/migrations/0004_auto_20200919_0955.py | common/djangoapps/third_party_auth/migrations/0004_auto_20200919_0955.py | # Generated by Django 2.2.16 on 2020-09-19 09:55
from django.db import migrations, models
import openedx.core.lib.hash_utils
class Migration(migrations.Migration):
dependencies = [
('third_party_auth', '0003_samlconfiguration_is_public'),
]
operations = [
migrations.AlterField(
... | Update migrations to use lms.yml in the help text | refactor(lms): Update migrations to use lms.yml in the help text
| Python | agpl-3.0 | stvstnfrd/edx-platform,eduNEXT/edx-platform,angelapper/edx-platform,angelapper/edx-platform,EDUlib/edx-platform,eduNEXT/edx-platform,arbrandes/edx-platform,edx/edx-platform,arbrandes/edx-platform,eduNEXT/edx-platform,arbrandes/edx-platform,stvstnfrd/edx-platform,eduNEXT/edunext-platform,angelapper/edx-platform,EDUlib/e... | ---
+++
@@ -0,0 +1,34 @@
+# Generated by Django 2.2.16 on 2020-09-19 09:55
+
+from django.db import migrations, models
+import openedx.core.lib.hash_utils
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('third_party_auth', '0003_samlconfiguration_is_public'),
+ ]
+
+ operations = [... | |
b044ba312b126cb17bf906b1984e7b407509fcc6 | Geneagrapher/makedist.py | Geneagrapher/makedist.py | """This tool sets up a distribution of the software by automating
several tasks that need to be done.
The directory should be in pristine condition when this is run (i.e.,
devoid of files that need to be removed before packaging begins). It
is best to run this on a fresh check out of the repository."""
import os
impo... | Add script to assist in packaging. | Add script to assist in packaging.
| Python | mit | davidalber/Geneagrapher,davidalber/Geneagrapher | ---
+++
@@ -0,0 +1,45 @@
+"""This tool sets up a distribution of the software by automating
+several tasks that need to be done.
+
+The directory should be in pristine condition when this is run (i.e.,
+devoid of files that need to be removed before packaging begins). It
+is best to run this on a fresh check out of t... | |
410b354cb0e72ba741439a337aba4ef4c3cda8b1 | src/ossa.py | src/ossa.py | #!/usr/bin/python
import re
import sys
""" Taken from http://stackoverflow.com/questions/2669059/how-to-sort-alpha-numeric-set-in-python"""
def sorted_nicely(l):
""" Sort the given iterable in the way that humans expect."""
convert = lambda text: int(text) if text.isdigit() else text
alphanum_key = lam... | Add existing python file for performing a very crude analysis on a set of lsl files (as taken from an untarred OAR, for example) | Add existing python file for performing a very crude analysis on a set of lsl files (as taken from an untarred OAR, for example)
| Python | bsd-3-clause | justinccdev/opensimulator-tools,justinccdev/opensimulator-tools,justinccdev/opensimulator-tools,justinccdev/opensimulator-tools | ---
+++
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+
+import re
+import sys
+
+""" Taken from http://stackoverflow.com/questions/2669059/how-to-sort-alpha-numeric-set-in-python"""
+def sorted_nicely(l):
+ """ Sort the given iterable in the way that humans expect."""
+ convert = lambda text: int(text) if text.isdigit... | |
71d8ef8a872656df8a2319032855cb2b5ea5ed4b | examples/bench/rlserver.py | examples/bench/rlserver.py | import argparse
import asyncio
import gc
import uvloop
import os.path
import socket as socket_module
from socket import *
PRINT = 0
async def echo_client_streams(reader, writer):
sock = writer.get_extra_info('socket')
try:
sock.setsockopt(IPPROTO_TCP, TCP_NODELAY, 1)
except (OSError, NameError)... | Add a new benchmark - readline server | examples/bench: Add a new benchmark - readline server
| Python | apache-2.0 | MagicStack/uvloop,1st1/uvloop,MagicStack/uvloop | ---
+++
@@ -0,0 +1,94 @@
+import argparse
+import asyncio
+import gc
+import uvloop
+import os.path
+import socket as socket_module
+
+from socket import *
+
+
+PRINT = 0
+
+
+async def echo_client_streams(reader, writer):
+ sock = writer.get_extra_info('socket')
+ try:
+ sock.setsockopt(IPPROTO_TCP, TCP... | |
c1fb3eb548b15ab8049841696b7ae74604c8ed89 | tests/conftest.py | tests/conftest.py | """
Config instructions and test fixtures
"""
import pytest
import os
import sys
# # these are just some fun dividiers to make the output pretty
# # completely unnecessary, I was just playing with autouse fixtures
# @pytest.fixture(scope="function", autouse=True)
# def divider_function(request):
# print('\n ... | Test for pytest.ini as session-scoped fixture | Test for pytest.ini as session-scoped fixture
| Python | agpl-3.0 | opentechinstitute/commotion-router-test-suite | ---
+++
@@ -0,0 +1,38 @@
+"""
+Config instructions and test fixtures
+"""
+
+import pytest
+import os
+import sys
+
+
+# # these are just some fun dividiers to make the output pretty
+# # completely unnecessary, I was just playing with autouse fixtures
+# @pytest.fixture(scope="function", autouse=True)
+# def divider... | |
002e903c978a30f27ed24316bb85958e5c69a259 | CodeFights/countVisitors.py | CodeFights/countVisitors.py | #!/usr/local/bin/python
# Code Fights Count Visitors Problem
class Counter(object):
def __init__(self, value):
self.value = value
def inc(self):
self.value += 1
def get(self):
return self.value
def countVisitors(beta, k, visitors):
counter = Counter(beta)
for visitor in... | Solve Code Fights count visitors problem | Solve Code Fights count visitors problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,45 @@
+#!/usr/local/bin/python
+# Code Fights Count Visitors Problem
+
+
+class Counter(object):
+ def __init__(self, value):
+ self.value = value
+
+ def inc(self):
+ self.value += 1
+
+ def get(self):
+ return self.value
+
+
+def countVisitors(beta, k, visitors):
+ ... | |
f53aef9fdcd01fdb8607984e38b4fb8c5813aacf | CodeFights/fibonacciList.py | CodeFights/fibonacciList.py | #!/usr/local/bin/python
# Code Fights Fibonacci List Problem
from functools import reduce
def fibonacciList(n):
return [[0] * x for x in reduce(lambda x, n: x + [sum(x[-2:])],
range(n - 2), [0, 1])]
def main():
tests = [
[
6,
[[],
... | Solve Code Fights fibonacci list problem | Solve Code Fights fibonacci list problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,67 @@
+#!/usr/local/bin/python
+# Code Fights Fibonacci List Problem
+
+from functools import reduce
+
+
+def fibonacciList(n):
+ return [[0] * x for x in reduce(lambda x, n: x + [sum(x[-2:])],
+ range(n - 2), [0, 1])]
+
+
+def main():
+ tests = [
+ [... | |
11296e24228ee10be009b04a9909504a8e8d5ace | tests/models/character/test_saver.py | tests/models/character/test_saver.py | import unittest
import database.main
from tests.create_test_db import engine, session, Base
database.main.engine = engine
database.main.session = session
database.main.Base = Base
import models.main
from classes import Paladin
from models.characters.saved_character import SavedCharacterSchema
from models.items.item_t... | Test for the save_character() function | Test for the save_character() function
| Python | mit | Enether/python_wow | ---
+++
@@ -0,0 +1,39 @@
+import unittest
+
+import database.main
+from tests.create_test_db import engine, session, Base
+database.main.engine = engine
+database.main.session = session
+database.main.Base = Base
+import models.main
+
+from classes import Paladin
+from models.characters.saved_character import SavedCh... | |
a78d93dbc23d832ca5eaae6535a45bfa478e4e56 | altair/vegalite/v2/examples/us_state_capitals.py | altair/vegalite/v2/examples/us_state_capitals.py | """
U.S. state capitals overlayed on a map of the U.S
================================================-
This is a geographic visualization that shows US capitals
overlayed on a map.
"""
import altair as alt
from vega_datasets import data
states = alt.UrlData(data.us_10m.url,
format=alt.TopoDataFo... | Add US state capitals from vega-lite. | Add US state capitals from vega-lite.
| Python | bsd-3-clause | altair-viz/altair,ellisonbg/altair,jakevdp/altair | ---
+++
@@ -0,0 +1,33 @@
+"""
+U.S. state capitals overlayed on a map of the U.S
+================================================-
+This is a geographic visualization that shows US capitals
+overlayed on a map.
+"""
+
+import altair as alt
+from vega_datasets import data
+
+states = alt.UrlData(data.us_10m.url,
+ ... | |
f22abf2b8a31d9621a891191db84364edb167390 | zephyr/management/commands/knight.py | zephyr/management/commands/knight.py | from __future__ import absolute_import
import sys
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ValidationError
from django.db.utils import IntegrityError
from django.core import validators
from guardian.shortcuts import assign_p... | Add a management command to create realm administrators. | Add a management command to create realm administrators.
(imported from commit ab2dd580a206f29086c0d5a4e717c1bfd65a7435)
| Python | apache-2.0 | wdaher/zulip,xuxiao/zulip,showell/zulip,jonesgithub/zulip,levixie/zulip,Gabriel0402/zulip,ryansnowboarder/zulip,zacps/zulip,rht/zulip,suxinde2009/zulip,hustlzp/zulip,bowlofstew/zulip,sharmaeklavya2/zulip,seapasulli/zulip,SmartPeople/zulip,dxq-git/zulip,sup95/zulip,dhcrzf/zulip,timabbott/zulip,tommyip/zulip,zacps/zulip,... | ---
+++
@@ -0,0 +1,36 @@
+from __future__ import absolute_import
+
+import sys
+from optparse import make_option
+
+from django.core.management.base import BaseCommand, CommandError
+from django.core.exceptions import ValidationError
+from django.db.utils import IntegrityError
+from django.core import validators
+
+f... | |
4f1e1874f3ed9af8922aa26eb20230dbee5e6d73 | examples/partitioning.py | examples/partitioning.py | import logging
import sys
import os
from common import set_up_logging
from common import create_sparse_file
from common import tear_down_disk_images
from common import print_devices
# doing this before importing blivet gets the logging from format class
# registrations and other stuff triggered by the import
set_up_l... | Add some example code for creation of disk partitions. | Add some example code for creation of disk partitions.
| Python | lgpl-2.1 | vpodzime/blivet,dwlehman/blivet,rhinstaller/blivet,vojtechtrefny/blivet,jkonecny12/blivet,vojtechtrefny/blivet,AdamWill/blivet,AdamWill/blivet,rvykydal/blivet,rvykydal/blivet,rhinstaller/blivet,jkonecny12/blivet,dwlehman/blivet,vpodzime/blivet | ---
+++
@@ -0,0 +1,61 @@
+import logging
+import sys
+import os
+
+from common import set_up_logging
+from common import create_sparse_file
+from common import tear_down_disk_images
+from common import print_devices
+
+# doing this before importing blivet gets the logging from format class
+# registrations and other ... | |
a0c23d3fc448f916ffdd668a2daf56408dd9c0c0 | mothermayi/pre_commit.py | mothermayi/pre_commit.py | import mothermayi.entryway
import mothermayi.git
def handle_plugins(entries):
for entry in entries:
result = entry()
def run():
with mothermayi.git.stash():
entries = mothermayi.entryway.get_entries('pre-commit')
handle_plugins(entries)
| Add simple implementation for a pre-commit hook | Add simple implementation for a pre-commit hook
This will be routed via the main entryway, mothermayi
| Python | mit | EliRibble/mothermayi | ---
+++
@@ -0,0 +1,11 @@
+import mothermayi.entryway
+import mothermayi.git
+
+def handle_plugins(entries):
+ for entry in entries:
+ result = entry()
+
+def run():
+ with mothermayi.git.stash():
+ entries = mothermayi.entryway.get_entries('pre-commit')
+ handle_plugins(entries) | |
16615d7794b127e9752b1a2b0bd8e70adfb0954c | anndata/tests/test_inplace_subset.py | anndata/tests/test_inplace_subset.py | import numpy as np
import pytest
from sklearn.utils.testing import (
assert_array_equal
)
from scipy import sparse
from anndata.tests.helpers import (
gen_adata,
subset_func,
asarray
)
@pytest.fixture(
params=[np.array, sparse.csr_matrix, sparse.csc_matrix],
ids=["np_array", "scipy_csr", "scip... | Add tests for inplace subset | Add tests for inplace subset
| Python | bsd-3-clause | theislab/anndata | ---
+++
@@ -0,0 +1,58 @@
+import numpy as np
+import pytest
+from sklearn.utils.testing import (
+ assert_array_equal
+)
+from scipy import sparse
+
+from anndata.tests.helpers import (
+ gen_adata,
+ subset_func,
+ asarray
+)
+
+@pytest.fixture(
+ params=[np.array, sparse.csr_matrix, sparse.csc_matrix... | |
eb87d38a65620c7e4a716dca8a8b9488b3a338d3 | src/collectors/numa/test/testnuma.py | src/collectors/numa/test/testnuma.py | #!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import patch
from diamond.collector import Collector
from numa import NumaCollector
##########... | #!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import patch
from diamond.collector import Collector
from numa import NumaCollector
##########... | Fix syntax error in collector test | Fix syntax error in collector test
| Python | mit | tellapart/Diamond,socialwareinc/Diamond,python-diamond/Diamond,works-mobile/Diamond,tuenti/Diamond,Ensighten/Diamond,TinLe/Diamond,sebbrandt87/Diamond,actmd/Diamond,Nihn/Diamond-1,EzyInsights/Diamond,bmhatfield/Diamond,zoidbergwill/Diamond,jaingaurav/Diamond,krbaker/Diamond,TAKEALOT/Diamond,thardie/Diamond,thardie/Diam... | ---
+++
@@ -29,7 +29,7 @@
self.collector.collect()
metrics = {
- 'node_0_free_MB': 42
+ 'node_0_free_MB': 42,
'node_0_size_MB': 402
}
|
412828bea81f5aad917188881c1e7e4d6ce52400 | usingnamespace/tests/test_views_management.py | usingnamespace/tests/test_views_management.py | import unittest
from pyramid import testing
class ManagementViewsTest(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
def tearDown(self):
testing.tearDown()
def makeOne(self, context, request):
from usingnamespace.views.management import Management
retu... | Add tests for the management views | Add tests for the management views
| Python | isc | usingnamespace/usingnamespace | ---
+++
@@ -0,0 +1,65 @@
+import unittest
+from pyramid import testing
+
+class ManagementViewsTest(unittest.TestCase):
+ def setUp(self):
+ self.config = testing.setUp()
+
+ def tearDown(self):
+ testing.tearDown()
+
+ def makeOne(self, context, request):
+ from usingnamespace.views.man... | |
430b5daebbd5385551203c2a0cf23bb355a2c027 | doc/source/scripts/06-cat-of-cats.py | doc/source/scripts/06-cat-of-cats.py | import os
import photomosaic as pm
import photomosaic.flickr
import matplotlib.pyplot as plt
# For these published examples we use os.environ to keep our API key private.
# Just set your own Flickr API key here.
FLICKR_API_KEY = os.environ['FLICKR_API_KEY']
# Get a pool of cat photos from Flickr.
pm.set_options(flic... | Add a script that uses the Flickr API. | DOC: Add a script that uses the Flickr API.
| Python | bsd-3-clause | danielballan/photomosaic | ---
+++
@@ -0,0 +1,20 @@
+import os
+import photomosaic as pm
+import photomosaic.flickr
+import matplotlib.pyplot as plt
+
+
+# For these published examples we use os.environ to keep our API key private.
+# Just set your own Flickr API key here.
+FLICKR_API_KEY = os.environ['FLICKR_API_KEY']
+
+# Get a pool of cat p... | |
b66b02be95e7b0c36a9ced53b07d91298190ca4a | test/test_dl.py | test/test_dl.py | from mpi4py import dl
import mpiunittest as unittest
import sys
import os
class TestDL(unittest.TestCase):
def testDL1(self):
if sys.platform == 'darwin':
libm = 'libm.dylib'
else:
libm = 'libm.so'
handle = dl.dlopen(libm, dl.RTLD_LOCAL|dl.RTLD_LAZY)
self.a... | Add tests for mpi4py.dl module | test: Add tests for mpi4py.dl module
| Python | bsd-2-clause | mpi4py/mpi4py,mpi4py/mpi4py,pressel/mpi4py,pressel/mpi4py,mpi4py/mpi4py,pressel/mpi4py,pressel/mpi4py | ---
+++
@@ -0,0 +1,58 @@
+from mpi4py import dl
+import mpiunittest as unittest
+import sys
+import os
+
+class TestDL(unittest.TestCase):
+
+ def testDL1(self):
+ if sys.platform == 'darwin':
+ libm = 'libm.dylib'
+ else:
+ libm = 'libm.so'
+
+ handle = dl.dlopen(libm, d... | |
cf3cae6493a369173244e05d190cceae41b9abbd | bluesky/tests/test_olog_cb.py | bluesky/tests/test_olog_cb.py | from bluesky import Msg
from bluesky.callbacks.olog import logbook_cb_factory
text = []
def f(**kwargs):
text.append(kwargs['text'])
def test_default_template(fresh_RE):
text.clear()
fresh_RE.subscribe('start', logbook_cb_factory(f))
fresh_RE([Msg('open_run', plan_args={}), Msg('close_run')])
a... | Add some coverage for olog callback. | TST: Add some coverage for olog callback.
| Python | bsd-3-clause | ericdill/bluesky,ericdill/bluesky | ---
+++
@@ -0,0 +1,44 @@
+from bluesky import Msg
+from bluesky.callbacks.olog import logbook_cb_factory
+
+text = []
+
+
+def f(**kwargs):
+ text.append(kwargs['text'])
+
+
+def test_default_template(fresh_RE):
+ text.clear()
+ fresh_RE.subscribe('start', logbook_cb_factory(f))
+ fresh_RE([Msg('open_run'... | |
e3d92ce2cd17a967ac19aecad2998c4094f2ae11 | run.py | run.py | #!/usr/bin/env python
"""
This script generates a force and velocity vector diagram for a cross-flow
turbine.
"""
import gizeh as gz
import numpy as np
import matplotlib.pyplot as plt
def gen_naca_points(naca="0020", c=100, npoints=100):
"""Generate points for a NACA foil."""
x = np.linspace(0, 1, npoints)*c... | Add script to draw NACA foil | Add script to draw NACA foil
| Python | mit | petebachant/CFT-vectors | ---
+++
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+"""
+This script generates a force and velocity vector diagram for a cross-flow
+turbine.
+"""
+
+import gizeh as gz
+import numpy as np
+import matplotlib.pyplot as plt
+
+
+def gen_naca_points(naca="0020", c=100, npoints=100):
+ """Generate points for a NACA foil.... | |
d6120537ec982f50d08fa188e91c68c023809db3 | txircd/modules/rfc/response_error.py | txircd/modules/rfc/response_error.py | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
class ErrorResponse(ModuleData):
implements(IPlugin, IModuleData)
name = "errorResponse"
core = True
def actions(self):
return [("quit", 10, self.sendEr... | Send ERROR when the user disconnects | Send ERROR when the user disconnects
| Python | bsd-3-clause | Heufneutje/txircd,ElementalAlchemist/txircd | ---
+++
@@ -0,0 +1,17 @@
+from twisted.plugin import IPlugin
+from txircd.module_interface import IModuleData, ModuleData
+from zope.interface import implements
+
+class ErrorResponse(ModuleData):
+ implements(IPlugin, IModuleData)
+
+ name = "errorResponse"
+ core = True
+
+ def actions(self):
+ ... | |
ac44a041e3e7808305b025e1087f48b7d4a9234a | tools/bitly/delete_bitly_blobs.py | tools/bitly/delete_bitly_blobs.py | #!/usr/bin/env python3
import argparse
import boto3
import os
from typing import List
from mediawords.util.log import create_logger
l = create_logger(__name__)
def delete_bitly_blobs(story_ids: List[int]):
session = boto3.Session(profile_name='mediacloud')
s3 = session.resource('s3')
bucket = s3.Bucket... | Add script to delete Bit.ly raw results from S3 | Add script to delete Bit.ly raw results from S3
| Python | agpl-3.0 | berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud | ---
+++
@@ -0,0 +1,56 @@
+#!/usr/bin/env python3
+
+import argparse
+import boto3
+import os
+from typing import List
+
+from mediawords.util.log import create_logger
+
+l = create_logger(__name__)
+
+
+def delete_bitly_blobs(story_ids: List[int]):
+ session = boto3.Session(profile_name='mediacloud')
+ s3 = ses... | |
37c0257fcc5e65b67fabfd17c2bf884ad8fe03e1 | recipe-server/normandy/recipes/migrations/0038_remove_invalid_signatures.py | recipe-server/normandy/recipes/migrations/0038_remove_invalid_signatures.py | """
Removes signatures, so they can be easily recreated during deployment.
This migration is intended to be used between "eras" of signatures. As
the serialization format of recipes changes, the signatures need to
also change. This could be handled automatically, but it is easier to
deploy if we just remove everything... | Add migration to reset signatures | recipe-server: Add migration to reset signatures
Fixes #452
| Python | mpl-2.0 | Osmose/normandy,mozilla/normandy,mozilla/normandy,Osmose/normandy,Osmose/normandy,mozilla/normandy,mozilla/normandy,Osmose/normandy | ---
+++
@@ -0,0 +1,41 @@
+"""
+Removes signatures, so they can be easily recreated during deployment.
+
+This migration is intended to be used between "eras" of signatures. As
+the serialization format of recipes changes, the signatures need to
+also change. This could be handled automatically, but it is easier to
+d... | |
c87f42579826cf236953bc955d15a9cc98c67d05 | applications/migrations/0029_application_proposed_development_description.py | applications/migrations/0029_application_proposed_development_description.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-30 05:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('applications', '0028_auto_20170329_1445'),
]
operations = [
migrations.AddF... | Add Migration File this time. | Add Migration File this time.
| Python | apache-2.0 | ropable/statdev,xzzy/statdev,xzzy/statdev,brendanc-dpaw/statdev,parksandwildlife/statdev,ropable/statdev,parksandwildlife/statdev,xzzy/statdev,parksandwildlife/statdev,brendanc-dpaw/statdev | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.6 on 2017-03-30 05:56
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('applications', '0028_auto_20170329_1445'),
+ ]
+
+ ... | |
0a610a44f0d20170ba9c3e6f9ec4eafaac937be1 | test/unit/filterer/test_pattern.py | test/unit/filterer/test_pattern.py | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
import pytest
from bark.log import Log
from bark.filterer.pattern import Pattern
def test_missing_key_passes():
'''Test log record with missing key passes.'''
log = Log()
filterer = Pattern('bark\.tes... | Add unit test for Pattern filterer. | Add unit test for Pattern filterer.
| Python | apache-2.0 | 4degrees/mill,4degrees/sawmill | ---
+++
@@ -0,0 +1,62 @@
+# :coding: utf-8
+# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
+# :license: See LICENSE.txt.
+
+import pytest
+
+from bark.log import Log
+from bark.filterer.pattern import Pattern
+
+
+def test_missing_key_passes():
+ '''Test log record with missing key passes.'''
+ log =... | |
f09ee3772d6e15a104af284ed6864005cf8450ef | ch11/radix_sort8.py | ch11/radix_sort8.py | """
Listing 11.4: An eight-element radix sort
"""
from io import open
import numpy as np
import pyopencl as cl
import utility
NUM_SHORTS = 8
kernel_src = '''
__kernel void radix_sort8(__global ushort8 *global_data) {
typedef union {
ushort8 vec;
ushort array[8];
} vec_array;
uint one_count, ze... | Add example from listing 11.4 | Add example from listing 11.4
| Python | mit | oysstu/pyopencl-in-action | ---
+++
@@ -0,0 +1,89 @@
+"""
+Listing 11.4: An eight-element radix sort
+"""
+
+from io import open
+import numpy as np
+import pyopencl as cl
+import utility
+
+NUM_SHORTS = 8
+
+kernel_src = '''
+__kernel void radix_sort8(__global ushort8 *global_data) {
+
+ typedef union {
+ ushort8 vec;
+ ushort arra... | |
e7faa99d9816745338ada38d1a7d974bf3a739ae | s5v3.py | s5v3.py | from s5v2 import *
from prettytable import PrettyTable
def my_table(): # no arguments are passed in, which seems a bit weird. We're hard-coding a function that only does one thing.
x = PrettyTable(['Style', 'Average Price']) # setup a new pretty table list and give and give it two list items
x.add_row(['Print', pret... | Create pretty table of tie averages + function for pretty averages | Create pretty table of tie averages + function for pretty averages
| Python | mit | alexmilesyounger/ds_basics | ---
+++
@@ -0,0 +1,17 @@
+from s5v2 import *
+from prettytable import PrettyTable
+
+def my_table(): # no arguments are passed in, which seems a bit weird. We're hard-coding a function that only does one thing.
+ x = PrettyTable(['Style', 'Average Price']) # setup a new pretty table list and give and give it two list... | |
fe5100f5d13ed7461619c8beff791d40306f83ff | addons/document/migrations/8.0.2.1/pre-migration.py | addons/document/migrations/8.0.2.1/pre-migration.py | # -*- coding: utf-8 -*-
##############################################################################
#
# 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... | Remove annoying SQL view that prevents some operations | [IMP] document: Remove annoying SQL view that prevents some operations
| Python | agpl-3.0 | blaggacao/OpenUpgrade,kirca/OpenUpgrade,csrocha/OpenUpgrade,bwrsandman/OpenUpgrade,Endika/OpenUpgrade,grap/OpenUpgrade,bwrsandman/OpenUpgrade,pedrobaeza/OpenUpgrade,sebalix/OpenUpgrade,mvaled/OpenUpgrade,pedrobaeza/OpenUpgrade,OpenUpgrade/OpenUpgrade,sebalix/OpenUpgrade,OpenUpgrade/OpenUpgrade,mvaled/OpenUpgrade,blagga... | ---
+++
@@ -0,0 +1,23 @@
+ # -*- coding: utf-8 -*-
+##############################################################################
+#
+# 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, ... | |
935115215259ce011f3f0b46781655119413e720 | pelican/rstdirectives.py | pelican/rstdirectives.py | # -*- coding: utf-8 -*-
from docutils import nodes
from docutils.parsers.rst import directives, Directive
from pygments.formatters import HtmlFormatter
from pygments import highlight
from pygments.lexers import get_lexer_by_name, TextLexer
INLINESTYLES = False
DEFAULT = HtmlFormatter(noclasses=INLINESTYLES)
VARIANTS =... | Add a directives file for pygments support. | Add a directives file for pygments support.
| Python | agpl-3.0 | btnpushnmunky/pelican,koobs/pelican,garbas/pelican,JeremyMorgan/pelican,jo-tham/pelican,lazycoder-ru/pelican,crmackay/pelican,iurisilvio/pelican,btnpushnmunky/pelican,TC01/pelican,douglaskastle/pelican,Summonee/pelican,51itclub/pelican,number5/pelican,koobs/pelican,levanhien8/pelican,florianjacob/pelican,zackw/pelican,... | ---
+++
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+from docutils import nodes
+from docutils.parsers.rst import directives, Directive
+from pygments.formatters import HtmlFormatter
+from pygments import highlight
+from pygments.lexers import get_lexer_by_name, TextLexer
+
+INLINESTYLES = False
+DEFAULT = HtmlFormatte... | |
312bbdefa256413b4891cd0e13e6ccf3c614541f | util.py | util.py | """
util
===
Common utilities across the Crank system.
"""
from datetime import datetime
DATETIME_FORMAT = '%Y %b %d @ %H%M'
def get_timestamp_header():
return datetime.now().strftime(DATETIME_FORMAT)
| Add datetime header to Crank | Add datetime header to Crank
| Python | mit | jad-b/Crank | ---
+++
@@ -0,0 +1,13 @@
+"""
+util
+===
+Common utilities across the Crank system.
+"""
+from datetime import datetime
+
+
+DATETIME_FORMAT = '%Y %b %d @ %H%M'
+
+
+def get_timestamp_header():
+ return datetime.now().strftime(DATETIME_FORMAT) | |
10c83fbc01dee9d95290466338f262abffc12a3e | samples/create_folder_in_datacenter.py | samples/create_folder_in_datacenter.py | #!/usr/bin/env python
"""
Written by Chinmaya Bharadwaj
Github: https://github.com/chinmayb/
Email: acbharadwaj@gmail.com
Create a folder in a datacenter
"""
from __future__ import print_function
from pyVmomi import vim
from pyVim.connect import SmartConnect, Disconnect
import argparse
import atexit
import getpass
... | Create a folder in a datacenter if not exists | Example: Create a folder in a datacenter if not exists
| Python | apache-2.0 | vmware/pyvmomi-community-samples,pfitzer/pyvmomi-community-samples,jm66/pyvmomi-community-samples,ddcrjlalumiere/pyvmomi-community-samples,prziborowski/pyvmomi-community-samples,pathcl/pyvmomi-community-samples | ---
+++
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+"""
+Written by Chinmaya Bharadwaj
+Github: https://github.com/chinmayb/
+Email: acbharadwaj@gmail.com
+
+Create a folder in a datacenter
+"""
+from __future__ import print_function
+
+from pyVmomi import vim
+
+from pyVim.connect import SmartConnect, Disconnect
+
+imp... | |
f78a485000ef8dacb584db1f03b7157b79bd5fe7 | d1_libclient_python/src/d1_client/tests/mock_get.py | d1_libclient_python/src/d1_client/tests/mock_get.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2016 DataONE
#
# Licensed under the Apache... | Add module for mocking node.get() with Responses | Add module for mocking node.get() with Responses
| Python | apache-2.0 | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | ---
+++
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# This work was created by participants in the DataONE project, and is
+# jointly copyrighted by participating institutions in DataONE. For
+# more information on DataONE, see our web site at http://dataone.org.
+#
+# Copyright 2009-2016 Da... | |
8223e9ffa61a2772a7a6f52244c5f1bbde4956b8 | py/longest-palindrome.py | py/longest-palindrome.py | from collections import Counter
class Solution(object):
def longestPalindrome(self, s):
"""
:type s: str
:rtype: int
"""
counter = Counter(s)
odd = 0
ans = 0
for char, cnt in counter.iteritems():
if cnt % 2 == 0:
ans += cnt
... | Add py solution for 409. Longest Palindrome | Add py solution for 409. Longest Palindrome
409. Longest Palindrome: https://leetcode.com/problems/longest-palindrome/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,17 @@
+from collections import Counter
+class Solution(object):
+ def longestPalindrome(self, s):
+ """
+ :type s: str
+ :rtype: int
+ """
+ counter = Counter(s)
+ odd = 0
+ ans = 0
+ for char, cnt in counter.iteritems():
+ if cn... | |
8223d62c22d4c4f7a66e1e468de53556796a03a9 | src/functions/exercise7.py | src/functions/exercise7.py | """Module docstring.
This serves as a long usage message.
"""
import sys
import getopt
def main():
# parse command line options
try:
opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])
except getopt.error, msg:
print msg
print "for help use --help"
sys.exit(2)
# pro... | Write a function that print something n times including relatives spaces | Write a function that print something n times including relatives spaces
| Python | mit | let42/python-course | ---
+++
@@ -0,0 +1,26 @@
+"""Module docstring.
+
+This serves as a long usage message.
+"""
+import sys
+import getopt
+
+def main():
+ # parse command line options
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])
+ except getopt.error, msg:
+ print msg
+ print "for help ... | |
98c07739702fbf3951ccd0359d04be80a303d9ce | run_time/src/gae_server/font_mapper.py | run_time/src/gae_server/font_mapper.py | """
Copyright 2014 Google 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 applicable law or ... | Add a fontname to TachyFont Jar file mapper. | Add a fontname to TachyFont Jar file mapper. | Python | apache-2.0 | bstell/TachyFont,bstell/TachyFont,moyogo/tachyfont,bstell/TachyFont,moyogo/tachyfont,bstell/TachyFont,googlei18n/TachyFont,googlefonts/TachyFont,moyogo/tachyfont,googlefonts/TachyFont,googlei18n/TachyFont,googlefonts/TachyFont,googlei18n/TachyFont,googlefonts/TachyFont,bstell/TachyFont,googlefonts/TachyFont,googlei18n/... | ---
+++
@@ -0,0 +1,37 @@
+"""
+ Copyright 2014 Google 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
+
+ ... | |
4074c4fae998ac1bb6f49bb47b34f4890dc90532 | test_pylast.py | test_pylast.py | #!/usr/bin/env python
"""
Integration (not unit) tests for pylast.py
"""
import datetime
import time
import unittest
import pylast
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
self.username = "TODO"
password_hash = "TODO"
API_KEY = "TODO"
API_SECRET = "TODO"
... | Add integration tests for pylast.py | Add integration tests for pylast.py
| Python | apache-2.0 | knockoutMice/pylast,hugovk/pylast,pylast/pylast,yanggao1119/pylast,knockoutMice/pylast,yanggao1119/pylast | ---
+++
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+"""
+Integration (not unit) tests for pylast.py
+"""
+import datetime
+import time
+import unittest
+
+import pylast
+
+class TestSequenceFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.username = "TODO"
+ password_hash = "TODO"
+
+ AP... | |
3def1498495e0abf230a3deb3873f6c502f3c6ad | molo/core/management/commands/remove_content_rotation_settings_from_sections.py | molo/core/management/commands/remove_content_rotation_settings_from_sections.py | from __future__ import absolute_import, unicode_literals
from django.core.management.base import BaseCommand
from molo.core.models import SectionPage
class Command(BaseCommand):
def handle(self, **options):
SectionPage.objects.all().update(
content_rotation_start_date=None,
conten... | Add management command for removing content rotation's settings on sections | Add management command for removing content rotation's settings on sections
| Python | bsd-2-clause | praekelt/molo,praekelt/molo,praekelt/molo,praekelt/molo | ---
+++
@@ -0,0 +1,19 @@
+from __future__ import absolute_import, unicode_literals
+
+from django.core.management.base import BaseCommand
+from molo.core.models import SectionPage
+
+
+class Command(BaseCommand):
+ def handle(self, **options):
+ SectionPage.objects.all().update(
+ content_rotatio... | |
a610154749d081e613b8bf58acf62af55958de9c | rev.py | rev.py | import fileinput
import re
import sys
pattern = re.compile("\s*version='([0-9.]+)',")
line = ""
maj = ""
min = ""
ver = ""
for line in fileinput.FileInput("setup.py", inplace=1):
m = pattern.match(line)
if m:
version = m.groups()[0]
maj, min, rev = version.split('.')
line = line.re... | Automate the update of the version number in setup.py. | Automate the update of the version number in setup.py.
| Python | apache-2.0 | jeffreydwalter/arlo | ---
+++
@@ -0,0 +1,18 @@
+import fileinput
+import re
+import sys
+
+pattern = re.compile("\s*version='([0-9.]+)',")
+line = ""
+maj = ""
+min = ""
+ver = ""
+
+for line in fileinput.FileInput("setup.py", inplace=1):
+ m = pattern.match(line)
+ if m:
+ version = m.groups()[0]
+ maj, min, rev =... | |
4e2172b8bd0953fd706f6c11029f9e4cfeb55407 | tests/registryd/test_root_component.py | tests/registryd/test_root_component.py | import pytest
import dbus
COMPONENT_IFACE = 'org.a11y.atspi.Component'
COORD_TYPE_WINDOW = 1
LAYER_WIDGET = 3
def test_contains(registry_root, session_manager):
assert registry_root.Contains(0, 0, COORD_TYPE_WINDOW, dbus_interface=COMPONENT_IFACE) == False
def test_get_accessible_at_point(registry_root, session... | Add tests for the registry's root object's Component interface | Add tests for the registry's root object's Component interface
Not much to test, really, just characterizing what the implementation
does. All the methods are no-ops that return hardcoded values.
| Python | lgpl-2.1 | GNOME/at-spi2-core,GNOME/at-spi2-core,GNOME/at-spi2-core | ---
+++
@@ -0,0 +1,35 @@
+import pytest
+import dbus
+
+COMPONENT_IFACE = 'org.a11y.atspi.Component'
+
+COORD_TYPE_WINDOW = 1
+LAYER_WIDGET = 3
+
+def test_contains(registry_root, session_manager):
+ assert registry_root.Contains(0, 0, COORD_TYPE_WINDOW, dbus_interface=COMPONENT_IFACE) == False
+
+def test_get_acc... | |
f7a1595e39eeb754290c62e9194868d98d9755f4 | tests/symbols/test_symbol_selection.py | tests/symbols/test_symbol_selection.py | import pytest
from tests.symbols import get_symbols
from thinglang.compiler.errors import NoMatchingOverload
from thinglang.compiler.references import Reference
from thinglang.lexer.values.identifier import Identifier
from thinglang.parser.values.named_access import NamedAccess
from thinglang.symbols.argument_selector... | Add test for symbol selection | Add test for symbol selection
| Python | mit | ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang | ---
+++
@@ -0,0 +1,92 @@
+import pytest
+
+from tests.symbols import get_symbols
+from thinglang.compiler.errors import NoMatchingOverload
+from thinglang.compiler.references import Reference
+from thinglang.lexer.values.identifier import Identifier
+from thinglang.parser.values.named_access import NamedAccess
+from ... | |
aa5c4fde763467cae63c205df8e4aaf7328ab713 | device/PRESUBMIT.py | device/PRESUBMIT.py | # Copyright 2015 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.
"""Presubmit script.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into depot_t... | Add 'git cl format' presubmit check to src/device | Add 'git cl format' presubmit check to src/device
Review URL: https://codereview.chromium.org/1097743004
Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#325940}
| Python | bsd-3-clause | chuan9/chromium-crosswalk,Just-D/chromium-1,Pluto-tv/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Pluto-tv/chromium-crosswalk,chuan9/chromium-crosswalk,Just-D/chromium-1,PeterWangIntel/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,Just-D/chromium-1,hgl888/chromium-crosswalk,Just-D/chromium-1,Pluto-tv/chromium-c... | ---
+++
@@ -0,0 +1,14 @@
+# Copyright 2015 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.
+
+"""Presubmit script.
+
+See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
+for more details about t... | |
fb3b3d2f9798872742541f7eae2d7b3e2a8a95ab | pygraphc/abstraction/AutoAbstractionRecursion.py | pygraphc/abstraction/AutoAbstractionRecursion.py | import networkx as nx
import os
from pygraphc.preprocess.CreateGraphModel import CreateGraphModel
from pygraphc.clustering.Louvain import Louvain
class AutoAbstraction(object):
def __init__(self, log_file):
self.log_file = log_file
self.clusters = []
def __prepare_graph(self, cluster=None):
... | Add new abstraction with recursion | Add new abstraction with recursion
| Python | mit | studiawan/pygraphc | ---
+++
@@ -0,0 +1,58 @@
+import networkx as nx
+import os
+from pygraphc.preprocess.CreateGraphModel import CreateGraphModel
+from pygraphc.clustering.Louvain import Louvain
+
+
+class AutoAbstraction(object):
+ def __init__(self, log_file):
+ self.log_file = log_file
+ self.clusters = []
+
+ def... | |
80fd2d73f7a206b5b517cb455da457fed9dc6403 | migrations/versions/0180_another_letter_org.py | migrations/versions/0180_another_letter_org.py | """empty message
Revision ID: 0180_another_letter_org
Revises: 0179_billing_primary_const
Create Date: 2017-06-29 12:44:16.815039
"""
# revision identifiers, used by Alembic.
revision = '0180_another_letter_org'
down_revision = '0179_billing_primary_const'
from alembic import op
NEW_ORGANISATIONS = [
('504', ... | Add Rother District Council logo for letters | Add Rother District Council logo for letters
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,36 @@
+"""empty message
+
+Revision ID: 0180_another_letter_org
+Revises: 0179_billing_primary_const
+Create Date: 2017-06-29 12:44:16.815039
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '0180_another_letter_org'
+down_revision = '0179_billing_primary_const'
+
+from alembic import... | |
16e52502bf55075c58022fa35e1673a8a0d5f4bc | networkx/utils/tests/test_unionfind.py | networkx/utils/tests/test_unionfind.py | from nose.tools import *
import networkx as nx
def test_unionfind():
# Fixed by: 2cddd5958689bdecdcd89b91ac9aaf6ce0e4f6b8
# Previously (in 2.x), the UnionFind class could handle mixed types.
# But in Python 3.x, this causes a TypeError such as:
# TypeError: unorderable types: str() > int()
#
... | Add a test for UnionFind fix. | Add a test for UnionFind fix.
| Python | bsd-3-clause | beni55/networkx,jni/networkx,aureooms/networkx,wasade/networkx,RMKD/networkx,dhimmel/networkx,RMKD/networkx,Sixshaman/networkx,sharifulgeo/networkx,blublud/networkx,jfinkels/networkx,harlowja/networkx,dmoliveira/networkx,kernc/networkx,jakevdp/networkx,ghdk/networkx,aureooms/networkx,blublud/networkx,jni/networkx,ghdk/... | ---
+++
@@ -0,0 +1,13 @@
+from nose.tools import *
+
+import networkx as nx
+
+def test_unionfind():
+ # Fixed by: 2cddd5958689bdecdcd89b91ac9aaf6ce0e4f6b8
+ # Previously (in 2.x), the UnionFind class could handle mixed types.
+ # But in Python 3.x, this causes a TypeError such as:
+ # TypeError: unorde... | |
d168599b9167ede2098aa2fe82375aa95e5ab8b3 | dockerpuller/app.py | dockerpuller/app.py | from flask import Flask
from flask import request
from flask import jsonify
import json
import subprocess
app = Flask(__name__)
config = None
@app.route('/', methods=['POST'])
def hook_listen():
if request.method == 'POST':
token = request.args.get('token')
if token == config['token']:
... | from flask import Flask
from flask import request
from flask import jsonify
import json
import subprocess
app = Flask(__name__)
config = None
@app.route('/', methods=['POST'])
def hook_listen():
if request.method == 'POST':
token = request.args.get('token')
if token == config['token']:
... | Check if hook parameter is passed to the url | Check if hook parameter is passed to the url
| Python | mit | nicocoffo/docker-puller,nicocoffo/docker-puller,glowdigitalmedia/docker-puller,glowdigitalmedia/docker-puller | ---
+++
@@ -13,17 +13,21 @@
token = request.args.get('token')
if token == config['token']:
hook = request.args.get('hook')
- hook_value = config['hooks'].get(hook)
- if hook_value:
- #payload = request.get_json()
- try:
- ... |
0bc0691c7714b7b5885ce2a9c05eb7eb35738c74 | tests/test_decorators.py | tests/test_decorators.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
from webhooks.exceptions import SenderNotCallable
from webhooks import webhook, unhashed_hook
def test_callable_sender():
@webhook(event="example200", sender_callable=123)
def basic(creator="pydanny"):
return {"husband": "Daniel Roy Greenf... | Add test for sender_callable check | Add test for sender_callable check
| Python | bsd-3-clause | pydanny/webhooks | ---
+++
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import pytest
+
+from webhooks.exceptions import SenderNotCallable
+from webhooks import webhook, unhashed_hook
+
+
+def test_callable_sender():
+
+ @webhook(event="example200", sender_callable=123)
+ def basic(creator="pydanny"):
+ ... | |
8c71a177c16762ab50dafe2528d24fab4ccf0925 | py/minimum-moves-to-equal-array-elements-ii.py | py/minimum-moves-to-equal-array-elements-ii.py | class Solution(object):
def minMoves2(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
nums.sort()
median = nums[len(nums) / 2]
return sum(abs(x - median) for x in nums)
| Add py solution for 462. Minimum Moves to Equal Array Elements II | Add py solution for 462. Minimum Moves to Equal Array Elements II
462. Minimum Moves to Equal Array Elements II: https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii/
Could be optimized to O(n) by q-select
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,9 @@
+class Solution(object):
+ def minMoves2(self, nums):
+ """
+ :type nums: List[int]
+ :rtype: int
+ """
+ nums.sort()
+ median = nums[len(nums) / 2]
+ return sum(abs(x - median) for x in nums) | |
b9245a8acf0bed7e19f709490c4ba3788028da93 | server/ec2spotmanager/migrations/0003_auto_20150504_1440.py | server/ec2spotmanager/migrations/0003_auto_20150504_1440.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ec2spotmanager', '0002_instancestatusentry_poolstatusentry'),
]
operations = [
migrations.RemoveField(
model_nam... | Fix error in PoolStatusEntry model | Fix error in PoolStatusEntry model
| Python | mpl-2.0 | MozillaSecurity/FuzzManager,lazyparser/FuzzManager,MozillaSecurity/FuzzManager,sigma-random/FuzzManager,cihatix/FuzzManager,lazyparser/FuzzManager,lazyparser/FuzzManager,sigma-random/FuzzManager,MozillaSecurity/FuzzManager,lazyparser/FuzzManager,cihatix/FuzzManager,sigma-random/FuzzManager,cihatix/FuzzManager,cihatix/F... | ---
+++
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('ec2spotmanager', '0002_instancestatusentry_poolstatusentry'),
+ ]
+
+ operations = [
+ migr... | |
98bd10cdf2c380b17c16a47a8f962dc384b3a18d | python/py-set-discard-remove-pop.py | python/py-set-discard-remove-pop.py | num_elements = int(input())
s = set(map(int, input().split()))
num_operations = int(input())
for _ in range(num_operations):
operation = input().split(" ")
if(operation[0] == "pop"):
s.pop()
else:
op, val = operation
s.discard(int(val))
print(sum(s))
| Solve py set discard remove pop | Solve py set discard remove pop
| Python | mit | rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank | ---
+++
@@ -0,0 +1,12 @@
+num_elements = int(input())
+s = set(map(int, input().split()))
+num_operations = int(input())
+for _ in range(num_operations):
+ operation = input().split(" ")
+ if(operation[0] == "pop"):
+ s.pop()
+ else:
+ op, val = operation
+ s.discard(int(val))
+
+print(s... | |
8e94da2cf788115a1562db253c96b1932b495ef3 | make_chord.py | make_chord.py | from collections import OrderedDict
from itertools import cycle
import sys
# build the pitch table
note_names = ['A', 'A#/Bb', 'B', 'C', 'C#/Db', 'D', 'D#/Eb', 'E', 'F', 'F#/Gb', 'G', 'G#/Ab']
note_cycle = cycle(note_names)
piano = []
onumber = 0
for i in range(1, 89):
note = note_cycle.next()
if note == 'C'... | Add script for generating chords, used to make some of the sounds. | Add script for generating chords, used to make some of the sounds.
| Python | bsd-3-clause | apendleton/valve-installation,apendleton/valve-installation | ---
+++
@@ -0,0 +1,43 @@
+from collections import OrderedDict
+from itertools import cycle
+import sys
+
+# build the pitch table
+note_names = ['A', 'A#/Bb', 'B', 'C', 'C#/Db', 'D', 'D#/Eb', 'E', 'F', 'F#/Gb', 'G', 'G#/Ab']
+note_cycle = cycle(note_names)
+
+piano = []
+onumber = 0
+for i in range(1, 89):
+ note ... | |
c84e3394ed4829ff9a66167864a11a4ef6a2b62c | scripts/get_saml_cert_expiration.py | scripts/get_saml_cert_expiration.py | from cryptography import x509
from cryptography.hazmat.backends import default_backend
from bluebottle.clients import properties
from bluebottle.clients.models import Client
from bluebottle.clients.utils import LocalTenant
def run(*args):
for client in Client.objects.all():
with LocalTenant(client):
... | Add script to get certificate expiration date | Add script to get certificate expiration date
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,22 @@
+from cryptography import x509
+from cryptography.hazmat.backends import default_backend
+
+from bluebottle.clients import properties
+from bluebottle.clients.models import Client
+from bluebottle.clients.utils import LocalTenant
+
+
+def run(*args):
+ for client in Client.objects.all():
+... | |
3f685e3873c18e1eb28b7a4121c552bbb697e0a4 | scripts/generator.py | scripts/generator.py | #!/usr/bin/python3
from random import randint
output = ""
filename = "data"
class Generator:
def gen_date(self):
return str(randint(2013, 2015)) + "-" \
+ str(randint(1, 12)) + "-" \
+ str(randint(1, 31))
def gen_price(self):
return str(10 * randint(10, 100))
d... | Add script for generate events. | Add script for generate events.
| Python | mit | Intey/OhMyBank,Intey/OhMyBank,Intey/OhMyBank,Intey/OhMyBank | ---
+++
@@ -0,0 +1,55 @@
+#!/usr/bin/python3
+
+from random import randint
+
+output = ""
+filename = "data"
+
+
+class Generator:
+
+ def gen_date(self):
+ return str(randint(2013, 2015)) + "-" \
+ + str(randint(1, 12)) + "-" \
+ + str(randint(1, 31))
+
+ def gen_price(self):
+ ... | |
f5284cc7da9166a43e3cfbd901205f4446295f7a | inspectors/cpsc.py | inspectors/cpsc.py | #!/usr/bin/env python
import datetime
import logging
import os
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# https://www.cpsc.gov/en/about-cpsc/inspector-general/
# Oldest report: 2003
# options:
# standard since/year options for a year range to fetch from.
#
... | Add Consumer Product Safety Commission. | Add Consumer Product Safety Commission.
| Python | cc0-1.0 | divergentdave/inspectors-general,lukerosiak/inspectors-general | ---
+++
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+
+import datetime
+import logging
+import os
+from urllib.parse import urljoin
+
+from bs4 import BeautifulSoup
+from utils import utils, inspector
+
+# https://www.cpsc.gov/en/about-cpsc/inspector-general/
+# Oldest report: 2003
+
+# options:
+# standard since/year ... | |
b1a851d6f5dd47790459564a55405627d9b7a9e4 | scripts/webscraping/ist_news_titles.py | scripts/webscraping/ist_news_titles.py | from urllib.request import urlopen
from bs4 import BeautifulSoup
import sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,'cp437','backslashreplace')
html = urlopen("http://tecnico.ulisboa.pt/pt/noticias/")
bsObj = BeautifulSoup(html, "html.parser")
for news_wrapper in bsObj.find("div", {"id":"content_wrapper... | Add news date and title scrapper from ist's news page. | Add news date and title scrapper from ist's news page.
| Python | mit | iluxonchik/python-general-repo | ---
+++
@@ -0,0 +1,14 @@
+from urllib.request import urlopen
+from bs4 import BeautifulSoup
+import sys, io
+
+sys.stdout = io.TextIOWrapper(sys.stdout.buffer,'cp437','backslashreplace')
+
+html = urlopen("http://tecnico.ulisboa.pt/pt/noticias/")
+bsObj = BeautifulSoup(html, "html.parser")
+
+
+for news_wrapper in bs... | |
6f2a9cbf9e571855074e898d22480d61277a3eda | django_lightweight_queue/backends/db.py | django_lightweight_queue/backends/db.py | import time
import datetime
from django.db import connection, models, ProgrammingError
from ..job import Job
class DatabaseBackend(object):
TABLE = 'django_lightweight_queue'
FIELDS = (
models.AutoField(name='id', primary_key=True),
models.CharField(name='queue', max_length=255),
mod... | Add experimental polling DB backend. | Add experimental polling DB backend.
Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@thread.com>
| Python | bsd-3-clause | thread/django-lightweight-queue,thread/django-lightweight-queue,lamby/django-lightweight-queue,prophile/django-lightweight-queue,prophile/django-lightweight-queue | ---
+++
@@ -0,0 +1,79 @@
+import time
+import datetime
+
+from django.db import connection, models, ProgrammingError
+
+from ..job import Job
+
+class DatabaseBackend(object):
+ TABLE = 'django_lightweight_queue'
+
+ FIELDS = (
+ models.AutoField(name='id', primary_key=True),
+ models.CharField(na... | |
3c8eb0563f3997fc068d039b18452eaa98da3122 | download_avatars.py | download_avatars.py | #!/usr/bin/env python3
import PIL.Image
import io
import json
import requests
import post_list
import web_cache
# Split this file into two modules, because we need to move web_cache out of
# the way between the two steps. (We want to isolate the avatar HTTP requests)
# into its own thing.
def _make_avatar_url_lis... | Add a script useful for downloading large avatar images from Atom feeds | Add a script useful for downloading large avatar images from Atom feeds
| Python | mit | squirrel2038/thearchdruidreport-archive,squirrel2038/thearchdruidreport-archive,squirrel2038/thearchdruidreport-archive | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python3
+import PIL.Image
+import io
+import json
+import requests
+
+import post_list
+import web_cache
+
+
+# Split this file into two modules, because we need to move web_cache out of
+# the way between the two steps. (We want to isolate the avatar HTTP requests)
+# into i... | |
0ca24ff03f6382c23995f662b678e457a8394140 | debian/bump-symbols.py | debian/bump-symbols.py | #!/usr/bin/python
#
# Bump symbol versions of libvirt0
# Usage: ./bump-symbol-versions 1.2.16~rc2
import os
import re
import sys
import shutil
import subprocess
#import gbp.git.GitRepository
symbols_file = 'debian/libvirt0.symbols'
symbols_new_file = symbols_file + '.new'
symbols = open(symbols_file)
symbols_new =... | Add script to bump symbol versions | Add script to bump symbol versions
| Python | lgpl-2.1 | agx/libvirt-debian,agx/libvirt-debian,agx/libvirt-debian,agx/libvirt-debian,agx/libvirt-debian | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+#
+# Bump symbol versions of libvirt0
+
+# Usage: ./bump-symbol-versions 1.2.16~rc2
+
+import os
+import re
+import sys
+import shutil
+import subprocess
+
+#import gbp.git.GitRepository
+
+symbols_file = 'debian/libvirt0.symbols'
+symbols_new_file = symbols_file + '.new'
... | |
a5c99fe8e37079a2663fe90644d3925d6dc7a5d0 | examples/offline_examples/test_request_fixture.py | examples/offline_examples/test_request_fixture.py | import pytest
@pytest.mark.offline
def test_request_fixture(request):
sb = request.getfixturevalue('sb')
sb.open("data:text/html,<p>Hello<br><input></p>")
sb.assert_element("html > body")
sb.assert_text("Hello", "body p")
sb.type("input", "Goodbye")
sb.click("body p")
sb.tearDow... | Add another example that works offline | Add another example that works offline
| Python | mit | seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase | ---
+++
@@ -0,0 +1,12 @@
+import pytest
+
+
+@pytest.mark.offline
+def test_request_fixture(request):
+ sb = request.getfixturevalue('sb')
+ sb.open("data:text/html,<p>Hello<br><input></p>")
+ sb.assert_element("html > body")
+ sb.assert_text("Hello", "body p")
+ sb.type("input", "Goodbye")
+ sb.cli... | |
a2296ae2165b60ba182d540f729a099183169c92 | problem_40.py | problem_40.py | from time import time
def main():
fractional_part = ''
i = 1
while len(fractional_part) < 1000000:
fractional_part += str(i)
i += 1
prod = 1
for i in [1, 10, 100, 1000, 10000, 100000, 1000000]:
prod *= int(fractional_part[i-1])
print 'Product:', prod
if __name__ == ... | Add problem 40, decimal fraction digits | Add problem 40, decimal fraction digits
| Python | mit | dimkarakostas/project-euler | ---
+++
@@ -0,0 +1,21 @@
+from time import time
+
+
+def main():
+ fractional_part = ''
+
+ i = 1
+ while len(fractional_part) < 1000000:
+ fractional_part += str(i)
+ i += 1
+
+ prod = 1
+ for i in [1, 10, 100, 1000, 10000, 100000, 1000000]:
+ prod *= int(fractional_part[i-1])
+ ... | |
9d77092729e534b19d75b38dd700df25a009fa49 | toolbox/convexify_costs.py | toolbox/convexify_costs.py | import sys
import commentjson as json
import os
import argparse
import numpy as np
def listify(l):
return [[e] for e in l]
def convexify(l):
features = np.array(l)
if features.shape[1] != 1:
raise InvalidArgumentException('This script can only convexify feature vectors with one feature per state!')
bestStat... | Add script to convexify the energies of a conservation tracking JSON model | Add script to convexify the energies of a conservation tracking JSON model
| Python | mit | chaubold/hytra,chaubold/hytra,chaubold/hytra | ---
+++
@@ -0,0 +1,59 @@
+import sys
+import commentjson as json
+import os
+import argparse
+import numpy as np
+
+def listify(l):
+ return [[e] for e in l]
+
+def convexify(l):
+ features = np.array(l)
+ if features.shape[1] != 1:
+ raise InvalidArgumentException('This script can only convexify feature vectors ... | |
609784dc106e01800eed0a7ccf88f82d6977d408 | babybuddy/migrations/0008_auto_20200120_0622.py | babybuddy/migrations/0008_auto_20200120_0622.py | # Generated by Django 3.0.2 on 2020-01-20 14:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('babybuddy', '0007_auto_20190607_1422'),
]
operations = [
migrations.AlterField(
model_name='settings',
name='languag... | Add missed language update migrations | Add missed language update migrations
This migration should have been included in `2627b1c`.
| Python | bsd-2-clause | cdubz/babybuddy,cdubz/babybuddy,cdubz/babybuddy | ---
+++
@@ -0,0 +1,18 @@
+# Generated by Django 3.0.2 on 2020-01-20 14:22
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('babybuddy', '0007_auto_20190607_1422'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_n... | |
b0dfbb63a306255bc08eae2e7dd9360ca56a366f | osf/migrations/0100_set_access_request_enabled.py | osf/migrations/0100_set_access_request_enabled.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-04-30 18:34
from __future__ import unicode_literals
from django.db import migrations, models ,connection
from osf.models import AbstractNode
class Migration(migrations.Migration):
dependencies = [
('osf', '0099_merge_20180427_1109'),
]
... | Add default value of access requests enabled to exsisting projects made before model added | Add default value of access requests enabled to exsisting projects made before model added
[#PLAT-835]
Also alter permissions on noderequestaction model, since choices were altered from when the original migration was made
| Python | apache-2.0 | aaxelb/osf.io,caseyrollins/osf.io,cslzchen/osf.io,sloria/osf.io,caseyrollins/osf.io,mfraezz/osf.io,mfraezz/osf.io,cslzchen/osf.io,icereval/osf.io,adlius/osf.io,mattclark/osf.io,erinspace/osf.io,felliott/osf.io,cslzchen/osf.io,brianjgeiger/osf.io,saradbowman/osf.io,Johnetordoff/osf.io,baylee-d/osf.io,Johnetordoff/osf.io... | ---
+++
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.11 on 2018-04-30 18:34
+from __future__ import unicode_literals
+
+from django.db import migrations, models ,connection
+
+from osf.models import AbstractNode
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('os... | |
39c50fe7d4713b9d0a8e4618a829d94b4fe7456c | van_der_pol_sync.py | van_der_pol_sync.py |
from __future__ import division
import sys
import numpy as np
sys.path.append('/media/ixaxaar/Steam/src/nest/local/lib/python2.7/site-packages/')
import nest
import nest.raster_plot
import nest.voltage_trace
import uuid
import pylab
nest.SetKernelStatus({"resolution": .001})
u = uuid.uuid4()
nest.CopyModel('ac_gene... | Add code to test van der pol model | Add code to test van der pol model
| Python | mit | synergetics/nest_expermiments,synergetics/nest_expermiments | ---
+++
@@ -0,0 +1,38 @@
+
+from __future__ import division
+
+import sys
+import numpy as np
+sys.path.append('/media/ixaxaar/Steam/src/nest/local/lib/python2.7/site-packages/')
+import nest
+import nest.raster_plot
+import nest.voltage_trace
+import uuid
+import pylab
+
+nest.SetKernelStatus({"resolution": .001})
+... | |
d14130c30f776d9b10ab48c993096dce251aba28 | get_hrs_cc_streamflow_list.py | get_hrs_cc_streamflow_list.py | import pandas as pd
from kiwis_pie import KIWIS
k = KIWIS('http://www.bom.gov.au/waterdata/services')
def get_cc_hrs_station_list(update = False):
"""
Return list of station IDs that exist in HRS and are supplied by providers that license their data under the Creative Commons license.
:param upda... | Add script to get list of HRS station IDs | Add script to get list of HRS station IDs
From providers that license their data as Creative Commons
| Python | bsd-3-clause | amacd31/hydromet-toolkit,amacd31/hydromet-toolkit | ---
+++
@@ -0,0 +1,43 @@
+import pandas as pd
+from kiwis_pie import KIWIS
+
+k = KIWIS('http://www.bom.gov.au/waterdata/services')
+
+def get_cc_hrs_station_list(update = False):
+ """
+ Return list of station IDs that exist in HRS and are supplied by providers that license their data under the Creative Co... | |
aec88e4f9cf2d9ee7f9fe876a7b884028b6c190c | bin/buildHierarchiqueDiagram.py | bin/buildHierarchiqueDiagram.py | #!/usr/bin/env/python
from datetime import datetime
import os
import argparse
import re
from graphviz import Digraph
PATH = os.path.dirname(os.path.abspath(__file__))
FROM_REGEX = re.compile(ur'^FROM\s+(?P<image>[^:]+)(:(?P<tag>.+))?', re.MULTILINE)
CONTAINERS = {}
def get_current_date():
import dat... | Add Script to generate a container schema from DockerFile | Add Script to generate a container schema from DockerFile
| Python | mit | webdevops/Dockerfile,webdevops/Dockerfile,webdevops/Dockerfile,webdevops/Dockerfile,webdevops/Dockerfile,webdevops/Dockerfile | ---
+++
@@ -0,0 +1,57 @@
+#!/usr/bin/env/python
+
+from datetime import datetime
+import os
+import argparse
+import re
+from graphviz import Digraph
+
+PATH = os.path.dirname(os.path.abspath(__file__))
+FROM_REGEX = re.compile(ur'^FROM\s+(?P<image>[^:]+)(:(?P<tag>.+))?', re.MULTILINE)
+CONTAINERS = {}
+
+def get_cur... | |
c4d583966ef1a4d9bdb57715ef5e766ba62fbed6 | jacquard/directory/tests/test_django.py | jacquard/directory/tests/test_django.py | from jacquard.directory.base import UserEntry
from jacquard.directory.django import DjangoDirectory
import pytest
import unittest.mock
try:
import sqlalchemy
except ImportError:
sqlalchemy = None
if sqlalchemy is not None:
test_database = sqlalchemy.create_engine('sqlite://')
test_database.execute("... | Add tests for the Django directory | Add tests for the Django directory
| Python | mit | prophile/jacquard,prophile/jacquard | ---
+++
@@ -0,0 +1,67 @@
+from jacquard.directory.base import UserEntry
+from jacquard.directory.django import DjangoDirectory
+
+import pytest
+import unittest.mock
+
+try:
+ import sqlalchemy
+except ImportError:
+ sqlalchemy = None
+
+
+if sqlalchemy is not None:
+ test_database = sqlalchemy.create_engine... | |
6babb6e64e93ed74a72203fdc67955ae8ca3bfb3 | testing/benchmark.py | testing/benchmark.py | """
Benchmarking and performance tests.
"""
import pytest
from pluggy import _MultiCall, HookImpl
from pluggy import HookspecMarker, HookimplMarker
hookspec = HookspecMarker("example")
hookimpl = HookimplMarker("example")
def MC(methods, kwargs, firstresult=False):
hookfuncs = []
for method in methods:
... | Add a baseline set of _MultiCall performance tests | Add a baseline set of _MultiCall performance tests
This begins an effort to incorporate run-time speed tests using
`pytest-benchmark`. This initial test set audits the `_MultiCall`
loop with hookimpls, hookwrappers and the combination of both.
The intention is to eventually have a reliable set of tests which
enable ma... | Python | mit | RonnyPfannschmidt/pluggy,nicoddemus/pluggy,hpk42/pluggy,pytest-dev/pluggy,pytest-dev/pluggy,RonnyPfannschmidt/pluggy,tgoodlet/pluggy | ---
+++
@@ -0,0 +1,58 @@
+"""
+Benchmarking and performance tests.
+"""
+import pytest
+
+from pluggy import _MultiCall, HookImpl
+from pluggy import HookspecMarker, HookimplMarker
+
+
+hookspec = HookspecMarker("example")
+hookimpl = HookimplMarker("example")
+
+
+def MC(methods, kwargs, firstresult=False):
+ hoo... | |
1831dbd065a8776a77d18e10b44f84c99bca4c75 | spacy/tests/textcat/test_textcat.py | spacy/tests/textcat/test_textcat.py | from __future__ import unicode_literals
from ...language import Language
def test_simple_train():
nlp = Language()
nlp.add_pipe(nlp.create_pipe('textcat'))
nlp.get_pipe('textcat').add_label('is_good')
nlp.begin_training()
for i in range(5):
for text, answer in [('aaaa', 1.), ('bbbb', 0),... | Add test of simple textcat workflow | Add test of simple textcat workflow
| Python | mit | aikramer2/spaCy,aikramer2/spaCy,aikramer2/spaCy,honnibal/spaCy,honnibal/spaCy,aikramer2/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,recognai/spaCy,spacy-io/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,recognai/spaCy,recognai/spaCy,spacy-io/spaCy,recognai/spaCy,spacy-io/spaCy,explosion/spaCy,aikramer2/sp... | ---
+++
@@ -0,0 +1,19 @@
+from __future__ import unicode_literals
+from ...language import Language
+
+def test_simple_train():
+ nlp = Language()
+
+ nlp.add_pipe(nlp.create_pipe('textcat'))
+ nlp.get_pipe('textcat').add_label('is_good')
+
+ nlp.begin_training()
+
+ for i in range(5):
+ for tex... | |
1a1e9123313fdedab14700ead90748d9e6182a42 | migrations/versions/da8b38b5bdd5_add_board_moderator_roles.py | migrations/versions/da8b38b5bdd5_add_board_moderator_roles.py | """Add board moderator roles
Revision ID: da8b38b5bdd5
Revises: 90ac01a2df
Create Date: 2016-05-03 09:32:06.756899
"""
# revision identifiers, used by Alembic.
revision = 'da8b38b5bdd5'
down_revision = '90ac01a2df'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy... | Add revision for new boardmoderator columns | Add revision for new boardmoderator columns
| Python | mit | Floens/uchan,Floens/uchan,Floens/uchan,Floens/uchan,Floens/uchan | ---
+++
@@ -0,0 +1,47 @@
+"""Add board moderator roles
+
+Revision ID: da8b38b5bdd5
+Revises: 90ac01a2df
+Create Date: 2016-05-03 09:32:06.756899
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'da8b38b5bdd5'
+down_revision = '90ac01a2df'
+branch_labels = None
+depends_on = None
+
+from alembic import ... | |
a8b48d9174ce9c30166c0c2a8011c2c40624c4bd | locations/spiders/planned_parenthood.py | locations/spiders/planned_parenthood.py | # -*- coding: utf-8 -*-
import scrapy
import json
import re
from locations.items import GeojsonPointItem
class PlannedParenthoodSpider(scrapy.Spider):
name = "planned_parenthood"
allowed_domains = ["www.plannedparenthood.org"]
start_urls = (
'https://www.plannedparenthood.org/health-center',
... | Add a spider for Planned Parenthood | Add a spider for Planned Parenthood
Fixes #184
| Python | mit | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | ---
+++
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+import re
+
+from locations.items import GeojsonPointItem
+
+
+class PlannedParenthoodSpider(scrapy.Spider):
+ name = "planned_parenthood"
+ allowed_domains = ["www.plannedparenthood.org"]
+ start_urls = (
+ 'https://www.pl... | |
45fea3847e2800a920ccb06e102ebaf9a5f9a4ce | tk/material/migrations/0002_auto_20170704_2155.py | tk/material/migrations/0002_auto_20170704_2155.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-04 19:55
from __future__ import unicode_literals
from django.db import migrations
import localized_fields.fields.field
class Migration(migrations.Migration):
dependencies = [
('material', '0001_initial'),
]
operations = [
m... | Add forgotten migration for newly introduced default ordering | Add forgotten migration for newly introduced default ordering
| Python | agpl-3.0 | GISAElkartea/tresna-kutxa,GISAElkartea/tresna-kutxa,GISAElkartea/tresna-kutxa,GISAElkartea/tresna-kutxa | ---
+++
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.2 on 2017-07-04 19:55
+from __future__ import unicode_literals
+
+from django.db import migrations
+import localized_fields.fields.field
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('material', '0001_initial... | |
1acbad02071a4d1ef953bc2c0643525e5d681d54 | runlint.py | runlint.py | #!/usr/bin/env python
import optparse
import sys
from closure_linter import checker
from closure_linter import error_fixer
from closure_linter import gjslint
USAGE = """%prog [options] [file1] [file2]...
Run a JavaScript linter on one or more files.
This will invoke the linter, and optionally attempt to auto-fix ... | Add in a script to run the linter manually | Add in a script to run the linter manually
Example uses:
$ runlint.py file1.js file2.js
$ runlint.py --autofix file3.js
| Python | apache-2.0 | Khan/khan-linter,Khan/khan-linter,Khan/khan-linter,Khan/khan-linter | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+
+import optparse
+import sys
+
+from closure_linter import checker
+from closure_linter import error_fixer
+from closure_linter import gjslint
+
+
+USAGE = """%prog [options] [file1] [file2]...
+
+Run a JavaScript linter on one or more files.
+
+This will invoke the l... | |
3e5d6e5dd31193f42ebddaeff856bfe53703a19e | models/fallahi_eval/evidence_sources.py | models/fallahi_eval/evidence_sources.py | from util import pklload
from collections import defaultdict
import indra.tools.assemble_corpus as ac
if __name__ == '__main__':
# Load cached Statements just before going into the model
stmts = pklload('pysb_stmts')
# Start a dictionary for source counts
sources_count = defaultdict(int)
# Count ... | Add script to get evidence sources | Add script to get evidence sources
| Python | bsd-2-clause | sorgerlab/indra,sorgerlab/indra,bgyori/indra,pvtodorov/indra,sorgerlab/indra,sorgerlab/belpy,bgyori/indra,johnbachman/belpy,johnbachman/belpy,bgyori/indra,johnbachman/indra,pvtodorov/indra,johnbachman/indra,sorgerlab/belpy,sorgerlab/belpy,pvtodorov/indra,pvtodorov/indra,johnbachman/indra,johnbachman/belpy | ---
+++
@@ -0,0 +1,38 @@
+from util import pklload
+from collections import defaultdict
+import indra.tools.assemble_corpus as ac
+
+
+if __name__ == '__main__':
+ # Load cached Statements just before going into the model
+ stmts = pklload('pysb_stmts')
+
+ # Start a dictionary for source counts
+ sources... | |
ccd1822d65f5565d4881e5a6a32b535e55cc2b50 | zinnia/views/mixins/entry_preview.py | zinnia/views/mixins/entry_preview.py | """Preview mixins for Zinnia views"""
from django.http import Http404
from django.utils.translation import ugettext as _
from zinnia.managers import PUBLISHED
class EntryPreviewMixin(object):
"""
Mixin implementing the preview of Entries.
"""
def get_object(self, queryset=None):
"""
... | Implement preview of entries for restricted users in EntryPreviewMixin | Implement preview of entries for restricted users in EntryPreviewMixin
| Python | bsd-3-clause | 1844144/django-blog-zinnia,ghachey/django-blog-zinnia,petecummings/django-blog-zinnia,marctc/django-blog-zinnia,bywbilly/django-blog-zinnia,ghachey/django-blog-zinnia,Zopieux/django-blog-zinnia,ghachey/django-blog-zinnia,extertioner/django-blog-zinnia,1844144/django-blog-zinnia,ZuluPro/django-blog-zinnia,extertioner/dj... | ---
+++
@@ -0,0 +1,26 @@
+"""Preview mixins for Zinnia views"""
+from django.http import Http404
+from django.utils.translation import ugettext as _
+
+from zinnia.managers import PUBLISHED
+
+
+class EntryPreviewMixin(object):
+ """
+ Mixin implementing the preview of Entries.
+ """
+
+ def get_object(se... | |
7c10150d5e667921450e8663fa9440253a495160 | gem/migrations/0014_convert_recomended_articles.py | gem/migrations/0014_convert_recomended_articles.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from molo.core.models import ArticlePage, ArticlePageRecommendedSections
from wagtail.wagtailcore.blocks import StreamValue
def create_recomended_articles(main_article, article_list):
'''
Creates recommended arti... | Add migration for moving recomended articles recomended section | Add migration for moving recomended articles recomended section
| Python | bsd-2-clause | praekelt/molo-gem,praekelt/molo-gem,praekelt/molo-gem | ---
+++
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations
+from molo.core.models import ArticlePage, ArticlePageRecommendedSections
+from wagtail.wagtailcore.blocks import StreamValue
+
+
+def create_recomended_articles(main_article, article_list):
... | |
abd05378eb6acf742f2deff4228a0bca4492521b | examples/htmlTableParser.py | examples/htmlTableParser.py | #
# htmlTableParser.py
#
# Example of parsing a simple HTML table into a list of rows, and optionally into a little database
#
# Copyright 2019, Paul McGuire
#
import pyparsing as pp
import urllib.request
# define basic HTML tags, and compose into a Table
table, table_end = pp.makeHTMLTags('table')
thead, thead_end ... | Add example showing scraping/parsing of an HTML table into a Python dict | Add example showing scraping/parsing of an HTML table into a Python dict
| Python | mit | pyparsing/pyparsing,pyparsing/pyparsing | ---
+++
@@ -0,0 +1,61 @@
+#
+# htmlTableParser.py
+#
+# Example of parsing a simple HTML table into a list of rows, and optionally into a little database
+#
+# Copyright 2019, Paul McGuire
+#
+
+import pyparsing as pp
+import urllib.request
+
+
+# define basic HTML tags, and compose into a Table
+table, table_end = p... | |
db9b756dbf68fde9930da8ab6b4594fa3f1d361e | migrations/versions/175_fix_recurring_override_cascade.py | migrations/versions/175_fix_recurring_override_cascade.py | """fix recurring override cascade
Revision ID: 6e5b154d917
Revises: 41f957b595fc
Create Date: 2015-05-25 16:23:40.563050
"""
# revision identifiers, used by Alembic.
revision = '6e5b154d917'
down_revision = '4ef055945390'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import text
def upgrade()... | Fix cascades for RecurringEventOverride table | Fix cascades for RecurringEventOverride table
Summary: We weren't defining an `ON DELETE CASCADE` cascade on the RecurringEventOverride table. This made it impossible to run the account reset script for accounts which had recurring event overrides. Fix this.
Test Plan: Ran the migration, checked that the account rese... | Python | agpl-3.0 | gale320/sync-engine,Eagles2F/sync-engine,nylas/sync-engine,nylas/sync-engine,Eagles2F/sync-engine,closeio/nylas,ErinCall/sync-engine,wakermahmud/sync-engine,Eagles2F/sync-engine,jobscore/sync-engine,gale320/sync-engine,jobscore/sync-engine,wakermahmud/sync-engine,gale320/sync-engine,ErinCall/sync-engine,ErinCall/sync-e... | ---
+++
@@ -0,0 +1,35 @@
+"""fix recurring override cascade
+
+Revision ID: 6e5b154d917
+Revises: 41f957b595fc
+Create Date: 2015-05-25 16:23:40.563050
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '6e5b154d917'
+down_revision = '4ef055945390'
+
+from alembic import op
+import sqlalchemy as sa
+from ... | |
730548fe74dda462d7aac1e3c5ee8e8ba47f4371 | scripts/extract_clips_from_hdf5_file.py | scripts/extract_clips_from_hdf5_file.py | from pathlib import Path
import wave
import h5py
DIR_PATH = Path('/Users/harold/Desktop/Clips')
INPUT_FILE_PATH = DIR_PATH / 'Clips.h5'
CLIP_COUNT = 5
def main():
with h5py.File(INPUT_FILE_PATH, 'r') as file_:
clip_group = file_['clips']
for i, clip_id in enumerate(clip_group):
... | Add script that extracts clips from HDF5 file. | Add script that extracts clips from HDF5 file.
| Python | mit | HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper | ---
+++
@@ -0,0 +1,46 @@
+from pathlib import Path
+import wave
+
+import h5py
+
+
+DIR_PATH = Path('/Users/harold/Desktop/Clips')
+INPUT_FILE_PATH = DIR_PATH / 'Clips.h5'
+CLIP_COUNT = 5
+
+
+def main():
+
+ with h5py.File(INPUT_FILE_PATH, 'r') as file_:
+
+ clip_group = file_['clips']
+
+ for i, cl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.