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 |
|---|---|---|---|---|---|---|---|---|---|---|
fbae1c6af008b8ac48a06f98ee61a8d06bf45736 | reduce_versions.py | reduce_versions.py | #!/usr/bin/env python
import os
import argparse
def _important_revisions(dependency_file):
old_version = None
for line in dependency_file:
# 18438 1.1.2 Biobase,multtest
(rev, version, deps) = line.strip().split('\t')
if version != old_version:
old_version = version
... | Reduce versions to easier requirements.txt style | Reduce versions to easier requirements.txt style
Given an `aRchive_output_path/PACKAGE_versions_full.txt` file, this
reduces it into the component
`aRchive_output_path/PACKAGE_VERSION_dependencies.txt` files, each which
look like:
Biobase 2.26.0 Biobase_2.26.0_dependencies.txt Biobase_2.26.0.tar.gz
# Could n... | Python | mit | bioarchive/aRchive_source_code,bioarchive/aRchive_source_code,bioarchive/aRchive_source_code,bioarchive/aRchive_source_code | ---
+++
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+import os
+import argparse
+
+
+def _important_revisions(dependency_file):
+ old_version = None
+ for line in dependency_file:
+ # 18438 1.1.2 Biobase,multtest
+ (rev, version, deps) = line.strip().split('\t')
+ if version != old_version:
+ ... | |
2c73a41ab78b41da7b6f2ccbd16140fa701d74f2 | gunicorn/app/wsgiapp.py | gunicorn/app/wsgiapp.py | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import os
import sys
import traceback
from gunicorn import util
from gunicorn.app.base import Application
class WSGIApplication(Application):
def init(self, parser, opts, args):
... | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import os
import sys
import traceback
from gunicorn import util
from gunicorn.app.base import Application
class WSGIApplication(Application):
def init(self, parser, opts, args):
... | Load wsgi apps after reading the configuration. | Load wsgi apps after reading the configuration.
| Python | mit | WSDC-NITWarangal/gunicorn,wong2/gunicorn,ccl0326/gunicorn,ephes/gunicorn,tempbottle/gunicorn,zhoucen/gunicorn,prezi/gunicorn,urbaniak/gunicorn,wong2/gunicorn,jamesblunt/gunicorn,gtrdotmcs/gunicorn,alex/gunicorn,keakon/gunicorn,jamesblunt/gunicorn,jamesblunt/gunicorn,gtrdotmcs/gunicorn,1stvamp/gunicorn,elelianghh/gunico... | ---
+++
@@ -20,12 +20,11 @@
self.app_uri = args[0]
sys.path.insert(0, os.getcwd())
+
+ def load(self):
try:
- self.load()
+ return util.import_app(self.app_uri)
except:
print "Failed to import application: %s" % self.app_uri
trac... |
d44f3ca6cecab959aeefe20b32df7e47c84f3828 | molo/core/tests/test_commands.py | molo/core/tests/test_commands.py | from django.test import TestCase
from molo.core.tests.base import MoloTestCaseMixin
from molo.core.management.commands.move_page_links_to_recomended_articles import convert_articles # noqa
body = [
{
"type": "paragraph",
"value": "paragraph 1"
},
{
"type": "page",
"value":... | Create test scaffold for command functions | Create test scaffold for command functions
| Python | bsd-2-clause | praekelt/molo,praekelt/molo,praekelt/molo,praekelt/molo | ---
+++
@@ -0,0 +1,33 @@
+from django.test import TestCase
+
+from molo.core.tests.base import MoloTestCaseMixin
+from molo.core.management.commands.move_page_links_to_recomended_articles import convert_articles # noqa
+
+body = [
+ {
+ "type": "paragraph",
+ "value": "paragraph 1"
+ },
+ {
+ ... | |
a5d07496162d40e23c966f1cb3f340845f638c07 | one_offs/pdf_repair/fix_pdfs.py | one_offs/pdf_repair/fix_pdfs.py | GEVENT = False
from regs_models import Doc
import json
import itertools
def split_seq(iterable, size):
it = iter(iterable)
item = list(itertools.islice(it, size))
while item:
yield item
item = list(itertools.islice(it, size))
all_ids = json.load(open("/tmp/problems.json"))
for ids in spli... | Reset script for incorrectly-extracted PDFs. | Reset script for incorrectly-extracted PDFs.
| Python | bsd-3-clause | sunlightlabs/regulations-scraper,sunlightlabs/regulations-scraper,sunlightlabs/regulations-scraper | ---
+++
@@ -0,0 +1,31 @@
+GEVENT = False
+
+from regs_models import Doc
+import json
+import itertools
+
+def split_seq(iterable, size):
+ it = iter(iterable)
+ item = list(itertools.islice(it, size))
+ while item:
+ yield item
+ item = list(itertools.islice(it, size))
+
+all_ids = json.load(op... | |
c269f2e7a161ee0fdcafed2beb0883cabe1a960f | scripts/fix_system_tags.py | scripts/fix_system_tags.py | # -*- coding: utf-8 -*-
"""Add system tags that weren't added during the Toku->Postgres migration.
Pass a path to a JSON file that has node IDs as keys and lists of system tag names
as values.
"""
import sys
import logging
import json
from website.app import setup_django
setup_django()
from osf.models import AbstractNo... | Add script to add missing system tags | Add script to add missing system tags
| Python | apache-2.0 | CenterForOpenScience/osf.io,caneruguz/osf.io,pattisdr/osf.io,adlius/osf.io,aaxelb/osf.io,laurenrevere/osf.io,baylee-d/osf.io,Johnetordoff/osf.io,caseyrollins/osf.io,felliott/osf.io,chrisseto/osf.io,adlius/osf.io,Nesiehr/osf.io,HalcyonChimera/osf.io,crcresearch/osf.io,mfraezz/osf.io,mfraezz/osf.io,erinspace/osf.io,casey... | ---
+++
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+"""Add system tags that weren't added during the Toku->Postgres migration.
+Pass a path to a JSON file that has node IDs as keys and lists of system tag names
+as values.
+"""
+import sys
+import logging
+import json
+from website.app import setup_django
+setup_djang... | |
d94398d6ce3c6e40735ae3b3b82a3d31a5718d78 | analytics/app.py | analytics/app.py | from flask import Flask
from flask.ext.pymongo import PyMongo
from bson.json_util import dumps
app = Flask('test')
mongo = PyMongo(app)
@app.route('/')
def home_page():
test = mongo.db.events.find({})
view_this_suka = dumps(test)
return str(view_this_suka) | Set up with mongo: working | Set up with mongo: working
| Python | mit | liakhandrii/genetic_cars,liakhandrii/genetic_cars | ---
+++
@@ -0,0 +1,12 @@
+from flask import Flask
+from flask.ext.pymongo import PyMongo
+from bson.json_util import dumps
+
+app = Flask('test')
+mongo = PyMongo(app)
+
+@app.route('/')
+def home_page():
+ test = mongo.db.events.find({})
+ view_this_suka = dumps(test)
+ return str(view_this_suka) | |
95548af426e823687e03fdb3abcd5fb714c96cbe | watcher/db/sqlalchemy/alembic/versions/a86240e89a29_.py | watcher/db/sqlalchemy/alembic/versions/a86240e89a29_.py | """Set name for Audit as part of backward compatibility
Revision ID: a86240e89a29
Revises: 3cfc94cecf4e
Create Date: 2017-12-21 13:00:09.278587
"""
# revision identifiers, used by Alembic.
revision = 'a86240e89a29'
down_revision = '3cfc94cecf4e'
from alembic import op
from sqlalchemy.orm import sessionmaker
from wa... | Fix watcher audit list command | Fix watcher audit list command
This patch set adds data migration version that fills noname audits
with name like strategy.name + '-' + audit.created_at.
Closes-Bug: #1738758
Change-Id: I1d65b3110166e9f64ce5b80a34672d24d629807d
| Python | apache-2.0 | openstack/watcher,stackforge/watcher,stackforge/watcher,openstack/watcher | ---
+++
@@ -0,0 +1,34 @@
+"""Set name for Audit as part of backward compatibility
+
+Revision ID: a86240e89a29
+Revises: 3cfc94cecf4e
+Create Date: 2017-12-21 13:00:09.278587
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'a86240e89a29'
+down_revision = '3cfc94cecf4e'
+
+from alembic import op
+from s... | |
b6ec51bbf0a6d7ccb17e66d78f041594f5a9030d | tests/basics/dict-del.py | tests/basics/dict-del.py | for i in range(100):
d = dict()
for j in range(100):
d[j] = j
del d[i]
for j in range(100):
if j not in d:
print(j, 'not in d')
| Add test for dict delete. It fails. | tests: Add test for dict delete. It fails.
| Python | mit | tralamazza/micropython,mgyenik/micropython,martinribelotta/micropython,adafruit/micropython,tuc-osg/micropython,jmarcelino/pycom-micropython,MrSurly/micropython,puuu/micropython,heisewangluo/micropython,heisewangluo/micropython,feilongfl/micropython,turbinenreiter/micropython,torwag/micropython,MrSurly/micropython,TDAb... | ---
+++
@@ -0,0 +1,8 @@
+for i in range(100):
+ d = dict()
+ for j in range(100):
+ d[j] = j
+ del d[i]
+ for j in range(100):
+ if j not in d:
+ print(j, 'not in d') | |
d4c432f8652b6884fcd02e3b532036a152f58b84 | tests/test_exceptions.py | tests/test_exceptions.py | """tests/test_exceptions.py.
Tests to ensure custom exceptions work and are formatted as expected
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software withou... | Add test to define how new exceptions module should work | Add test to define how new exceptions module should work
| Python | mit | MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,timothycrosley/hug,timothycrosley/hug,timothycrosley/hug | ---
+++
@@ -0,0 +1,48 @@
+"""tests/test_exceptions.py.
+
+Tests to ensure custom exceptions work and are formatted as expected
+
+Copyright (C) 2015 Timothy Edmund Crosley
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+documentation files (the "Softwar... | |
e54232b9cdd9c845f2d9386ed58cd3d4d25db701 | auc_pr.py | auc_pr.py | #!/usr/local/bin/python3
# -*- coding: utf-8 -*-
'''使用real.csv和result.csv表格数据,计算PR曲线的AUC值'''
import sys
import pandas
from pandas import DataFrame
from sklearn.metrics import auc, precision_recall_curve #average_precision_score
REAL_HEADERS = ['Flightno',
'FlightDepcode',
'FlightArrcode... | Add calculate AUC value of PR curve by sklearn | Add calculate AUC value of PR curve by sklearn
| Python | mit | 9468305/script | ---
+++
@@ -0,0 +1,52 @@
+#!/usr/local/bin/python3
+# -*- coding: utf-8 -*-
+'''使用real.csv和result.csv表格数据,计算PR曲线的AUC值'''
+import sys
+import pandas
+from pandas import DataFrame
+from sklearn.metrics import auc, precision_recall_curve #average_precision_score
+
+REAL_HEADERS = ['Flightno',
+ 'FlightDep... | |
70d6a5c67730e17d8d766eb1e8e6f21eeeda7c04 | cptm/folia_party_names.py | cptm/folia_party_names.py | import gzip
from lxml import etree
import logging
import argparse
import glob
from collections import Counter
if __name__ == '__main__':
logger = logging.getLogger(__name__)
logging.basicConfig(format='%(levelname)s : %(message)s',
level=logging.INFO)
logger.setLevel(logging.DEBUG)
... | Add script to check party/speeches data | Add script to check party/speeches data
Added a quick and dirty script to determine additional corpus statistics,
such as
- party names
- number of speeches found
- number of speeches without party
- number of speeches per party
because it seems that the folia data is far from complete.
| Python | apache-2.0 | NLeSC/cptm,NLeSC/cptm | ---
+++
@@ -0,0 +1,60 @@
+import gzip
+from lxml import etree
+import logging
+import argparse
+import glob
+from collections import Counter
+
+if __name__ == '__main__':
+ logger = logging.getLogger(__name__)
+ logging.basicConfig(format='%(levelname)s : %(message)s',
+ level=logging.INF... | |
a9efa21d153faea171c7e916de91ee787e877a69 | pyfibot/util/find_config_opts.py | pyfibot/util/find_config_opts.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Small script to find variables that can be declared in config...
import os
import re
from pprint import pprint
get_rg = re.compile(r'[^\.](config|settings|network_conf)\.get\((.*?),(.*?)\)')
def clean_string(string):
return string.strip().strip('\'"')
def find_... | Add util to find config options | Add util to find config options
| Python | bsd-3-clause | aapa/pyfibot,huqa/pyfibot,lepinkainen/pyfibot,lepinkainen/pyfibot,EArmour/pyfibot,EArmour/pyfibot,aapa/pyfibot,huqa/pyfibot | ---
+++
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+# Small script to find variables that can be declared in config...
+import os
+import re
+from pprint import pprint
+
+get_rg = re.compile(r'[^\.](config|settings|network_conf)\.get\((.*?),(.*?)\)')
+
+
+def clean_string(string):
+ return ... | |
b4421d0fa5a4c8dd509513553939958ee616d46a | msibi/utils/plot_fit.py | msibi/utils/plot_fit.py | import os.path
def plot_pair_fits(pair, fits, use_agg=False):
if use_agg:
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
for state, fit in fits[pair].iteritems():
ax.plot(fit, label=state)
ax.set_xlabel('step')
ax.set_yl... | Add function for plotting fit vs step | Add function for plotting fit vs step
A simple function to plot the fitness function vs. iteration from the
logfile generated by MSIBI.optimize().
This may belong in a different location, but putting it here for now.
| Python | mit | ctk3b/msibi,mosdef-hub/msibi,mosdef-hub/msibi | ---
+++
@@ -0,0 +1,63 @@
+import os.path
+
+
+def plot_pair_fits(pair, fits, use_agg=False):
+ if use_agg:
+ import matplotlib as mpl
+ mpl.use('Agg')
+ import matplotlib.pyplot as plt
+ fig, ax = plt.subplots()
+ for state, fit in fits[pair].iteritems():
+ ax.plot(fit, label=state)
+... | |
efc5fc4c5da18906efb8914364de0ee72fc85a5e | scripts/set-artist-streamable.py | scripts/set-artist-streamable.py | #!/usr/bin/env python
import psycopg2 as ordbms
import urllib, urllib2
import xml.etree.cElementTree as ElementTree
class SetArtistStreamable:
def __init__(self):
self.conn = ordbms.connect ("dbname='librefm'")
self.cursor = self.conn.cursor()
def updateAll(self):
"""Sets artists streamable ... | Add script for updating previously imported artists with the streamable property (so we don't have to query tracks to find out who's streamable) | Add script for updating previously imported artists with the streamable property (so we don't have to query tracks to find out who's streamable)
| Python | agpl-3.0 | foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+import psycopg2 as ordbms
+import urllib, urllib2
+import xml.etree.cElementTree as ElementTree
+
+
+class SetArtistStreamable:
+
+
+ def __init__(self):
+ self.conn = ordbms.connect ("dbname='librefm'")
+ self.cursor = self.conn.cursor()
+
+
+ def upda... | |
0899c6516bd9bf8fdd4bd973106eaa1ffcf67667 | pirate_add_shift_recurrence.py | pirate_add_shift_recurrence.py | #!/usr/bin/python
import sys
import os
from tasklib.task import Task, TaskWarrior
time_attributes = ('wait', 'until', 'scheduled')
def is_new_local_recurrence_child_task(task):
# Do not affect tasks not spun by recurrence
if not task['parent']:
return False
# Newly created recurrence tasks actua... | Add pirate-enabled version of the hook | Add pirate-enabled version of the hook
| Python | mit | tbabej/task.shift-recurrence | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+
+import sys
+import os
+from tasklib.task import Task, TaskWarrior
+
+time_attributes = ('wait', 'until', 'scheduled')
+
+def is_new_local_recurrence_child_task(task):
+ # Do not affect tasks not spun by recurrence
+ if not task['parent']:
+ return False
+
+ ... | |
71cdf03644215ec3032605e6772dc897d0d78b05 | Sensors/testMouse.py | Sensors/testMouse.py | from pymouse import PyMouse
import time
# This script demonstrates the possibility to use a mouse as an unbound sensor.
# To do that the cursor position is brought back to the middle of the screen at each step, and the distance moved by the mouse are integrated
# This script is intended to be used with a second externa... | Add a test to check if an optical mouse can be used as a course sensor | Add a test to check if an optical mouse can be used as a course sensor
| Python | mit | baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite | ---
+++
@@ -0,0 +1,20 @@
+from pymouse import PyMouse
+import time
+# This script demonstrates the possibility to use a mouse as an unbound sensor.
+# To do that the cursor position is brought back to the middle of the screen at each step, and the distance moved by the mouse are integrated
+# This script is intended ... | |
5582e074cc68dc7b97d4b33211b74fb4813e2f17 | Sorting.py | Sorting.py | # Sorting of numbers
# we will stick to acending - read it backwards otherwise :P
def InsertionSort(A):
# As A[0] is sorted by itself we need to take the number to be sorted from 1 to n-1
for i in range(1,len(A)):
key = A[i] # Take the next number in unsorted section
for j in range(0,i): # g... | Add Insertion Sort for float numbers | Add Insertion Sort for float numbers
I am planning to implement all sorting techniques I learn in this script
Also I will try to incoporate time comparison at a later stage.
Signed-off-by: Aditya Prasad <5c5d1de3672d25c1ad997cc5b3c40a32c347e962@gmail.com>
| Python | mit | Aditya8795/Python-Scripts | ---
+++
@@ -0,0 +1,41 @@
+# Sorting of numbers
+# we will stick to acending - read it backwards otherwise :P
+
+def InsertionSort(A):
+ # As A[0] is sorted by itself we need to take the number to be sorted from 1 to n-1
+ for i in range(1,len(A)):
+ key = A[i] # Take the next number in unsorted section... | |
fcab7caa8bfd8a7bb3735aa6b61c226a9ad6426e | exp/alto/tools/filter_width.py | exp/alto/tools/filter_width.py | #!/usr/bin/env python3
import sys
from nltk.tree import Tree
def sort_nps():
with open(sys.argv[1]) as np_doc:
for line in np_doc:
t = Tree.fromstring(line)
width = len(t)
if width <= 3:
print(line, end = "")
sort_nps() | Add script for getting rid of too wide NPs | Add script for getting rid of too wide NPs
| Python | mit | kornai/4lang,kornai/4lang,kornai/4lang,kornai/4lang | ---
+++
@@ -0,0 +1,14 @@
+#!/usr/bin/env python3
+
+import sys
+from nltk.tree import Tree
+
+def sort_nps():
+ with open(sys.argv[1]) as np_doc:
+ for line in np_doc:
+ t = Tree.fromstring(line)
+ width = len(t)
+ if width <= 3:
+ print(line, end = "")
+
+sor... | |
9ddd96bbe727f61c41f73d786b5beea9a85482a9 | project/velkoja/management/commands/check_nordea_overdue.py | project/velkoja/management/commands/check_nordea_overdue.py | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from velkoja.nordeachecker import NordeaOverdueInvoicesHandler
class Command(BaseCommand):
help = 'Check overdue Nordea payments and send emails about them'
def add_arguments(self, parser):
pass
def handle(... | Add management command to run the checks | Add management command to run the checks
| Python | mit | HelsinkiHacklab/asylum,HelsinkiHacklab/asylum,HelsinkiHacklab/asylum,HelsinkiHacklab/asylum | ---
+++
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+from django.core.management.base import BaseCommand, CommandError
+from velkoja.nordeachecker import NordeaOverdueInvoicesHandler
+
+
+class Command(BaseCommand):
+ help = 'Check overdue Nordea payments and send emails about them'
+
+ def add_arguments(self, pa... | |
20c6e2d41e0848fddb3ff3829720ab43a71f41a9 | ideascube/conf/kb_babylab_civ.py | ideascube/conf/kb_babylab_civ.py | # -*- coding: utf-8 -*-
"""KoomBook conf"""
from .kb import * # noqa
from django.utils.translation import ugettext_lazy as _
LANGUAGE_CODE = 'fr'
IDEASCUBE_NAME = 'BabyLab'
HOME_CARDS = STAFF_HOME_CARDS + [
{
'id': 'blog',
},
{
'id': 'mediacenter',
},
{
'id': 'bsfcampus',
... | Add conf file for BabyLab KoomBook | Add conf file for BabyLab KoomBook
| Python | agpl-3.0 | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ---
+++
@@ -0,0 +1,65 @@
+# -*- coding: utf-8 -*-
+"""KoomBook conf"""
+from .kb import * # noqa
+from django.utils.translation import ugettext_lazy as _
+
+LANGUAGE_CODE = 'fr'
+IDEASCUBE_NAME = 'BabyLab'
+HOME_CARDS = STAFF_HOME_CARDS + [
+ {
+ 'id': 'blog',
+ },
+ {
+ 'id': 'mediacenter',
+... | |
8840e38e5d3107564338de4e47bfd65aae5723ee | scripts/git-pre-cloner.py | scripts/git-pre-cloner.py | #!/usr/bin/python
import argparse
import os
import sys
import string
import subprocess
import escapism
safe_chars = set(string.ascii_lowercase + string.digits)
repo = 'https://github.com/data-8/materials-fa17.git'
local_repo = '/export/pool0/homes/_repo'
cwd_tmpl = '/export/pool0/homes/{}'
def safe_username(usernam... | Rename pre-pull and move to scripts/. | Rename pre-pull and move to scripts/.
| Python | bsd-3-clause | berkeley-dsep-infra/datahub,gunjanbaid/datahub,ryanlovett/datahub,ryanlovett/datahub,ryanlovett/datahub,berkeley-dsep-infra/datahub,berkeley-dsep-infra/datahub,gunjanbaid/datahub | ---
+++
@@ -0,0 +1,68 @@
+#!/usr/bin/python
+
+import argparse
+import os
+import sys
+import string
+import subprocess
+
+import escapism
+
+safe_chars = set(string.ascii_lowercase + string.digits)
+repo = 'https://github.com/data-8/materials-fa17.git'
+local_repo = '/export/pool0/homes/_repo'
+cwd_tmpl = '/export/p... | |
27b6b0b62624ccd80345768f664ae2f421f85368 | h2o-py/tests/testdir_misc/pyunit_mean_per_class_error.py | h2o-py/tests/testdir_misc/pyunit_mean_per_class_error.py | import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.gbm import H2OGradientBoostingEstimator
def pyunit_mean_per_class_error():
gbm = H2OGradientBoostingEstimator(nfolds=3, fold_assignment="Random", seed=1234)
## Binomial
cars = h2o.import_file("/users/arno... | Add extra Python test for mean-per-class error. | PUBDEV-2979: Add extra Python test for mean-per-class error.
| Python | apache-2.0 | spennihana/h2o-3,spennihana/h2o-3,jangorecki/h2o-3,h2oai/h2o-dev,spennihana/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,jangorecki/h2o-3,h2oai/h2o-dev,h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3,mathemage/h2o-3,mathemage/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,mathemage/h2o-3,h2oai/h2o-3,h2oai/h2o-3,spennihana/h2o-3,jangorecki/h2o-3... | ---
+++
@@ -0,0 +1,49 @@
+import sys
+sys.path.insert(1,"../../")
+import h2o
+from tests import pyunit_utils
+from h2o.estimators.gbm import H2OGradientBoostingEstimator
+
+
+def pyunit_mean_per_class_error():
+ gbm = H2OGradientBoostingEstimator(nfolds=3, fold_assignment="Random", seed=1234)
+
+ ## Binomial
+... | |
bcd45f883b6442f7a1205979bdc79c69ccd2a623 | migrations/versions/4d5d239d53b4_set_on_delete_cascad.py | migrations/versions/4d5d239d53b4_set_on_delete_cascad.py | """Set ON DELETE CASCADE on TestSuite.*
Revision ID: 4d5d239d53b4
Revises: 501983249c94
Create Date: 2013-12-23 16:14:08.812850
"""
# revision identifiers, used by Alembic.
revision = '4d5d239d53b4'
down_revision = '501983249c94'
from alembic import op
def upgrade():
op.drop_constraint('testsuite_project_id_f... | Add missing TestSuite ON DELETE UPDATE constraints | Add missing TestSuite ON DELETE UPDATE constraints
| Python | apache-2.0 | wfxiang08/changes,wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,bowlofstew/changes,dropbox/changes,dropbox/changes,dropbox/changes,dropbox/changes,bowlofstew/changes,bowlofstew/changes,wfxiang08/changes | ---
+++
@@ -0,0 +1,25 @@
+"""Set ON DELETE CASCADE on TestSuite.*
+
+Revision ID: 4d5d239d53b4
+Revises: 501983249c94
+Create Date: 2013-12-23 16:14:08.812850
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '4d5d239d53b4'
+down_revision = '501983249c94'
+
+from alembic import op
+
+
+def upgrade():
+ ... | |
82f72fe184ecb37049ec7b7b13a8e9c05936ee7a | migrations/versions/5981b26ae993_drop_trackman_tables.py | migrations/versions/5981b26ae993_drop_trackman_tables.py | """Drop Trackman tables
Revision ID: 5981b26ae993
Revises: 804fb3dc434f
Create Date: 2018-05-19 23:57:42.897891
"""
# revision identifiers, used by Alembic.
revision = '5981b26ae993'
down_revision = '804fb3dc434f'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.drop_table('air_log')
op.dr... | Add migration to drop Trackman tables | Add migration to drop Trackman tables
| Python | agpl-3.0 | wuvt/wuvt-site,wuvt/wuvt-site,wuvt/wuvt-site,wuvt/wuvt-site | ---
+++
@@ -0,0 +1,28 @@
+"""Drop Trackman tables
+
+Revision ID: 5981b26ae993
+Revises: 804fb3dc434f
+Create Date: 2018-05-19 23:57:42.897891
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '5981b26ae993'
+down_revision = '804fb3dc434f'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgra... | |
32a9a608a6489528089b68857965afdc4b7c76cc | tests/test_sql_copy.py | tests/test_sql_copy.py | import os
import pytest
import time
from carto.exceptions import CartoException
from carto.sql import SQLClient, BatchSQLClient, CopySQLClient
SETUP_QUERIES = [
'DROP TABLE IF EXISTS carto_python_sdk_copy_test',
"""
CREATE TABLE carto_python_sdk_copy_test (
the_geom geometry(Geometry,4326),
n... | Add test file for COPY client | Add test file for COPY client
| Python | bsd-3-clause | CartoDB/cartodb-python,CartoDB/carto-python | ---
+++
@@ -0,0 +1,45 @@
+import os
+import pytest
+import time
+
+from carto.exceptions import CartoException
+from carto.sql import SQLClient, BatchSQLClient, CopySQLClient
+
+
+SETUP_QUERIES = [
+ 'DROP TABLE IF EXISTS carto_python_sdk_copy_test',
+ """
+ CREATE TABLE carto_python_sdk_copy_test (
+ t... | |
801ea808caa4cde2b1cb84f52d5d516d39b30e88 | tester_alex_10q.py | tester_alex_10q.py | from __future__ import print_function
import pandas as pd
from bs4 import BeautifulSoup as BSoup
from SecFiling10Q import SecFiling10Q
def areEqual(expect, val, eps = 0.01):
try:
diff = abs(float(val) / float(expect) - 1.0)
assert diff < eps, "Values don't match, expected= {:.12f}, found= {:.12f},... | Test the SecFiling10Q for an ALEX 10-q filing. | Test the SecFiling10Q for an ALEX 10-q filing.
| Python | agpl-3.0 | cielling/jupyternbs | ---
+++
@@ -0,0 +1,40 @@
+from __future__ import print_function
+import pandas as pd
+from bs4 import BeautifulSoup as BSoup
+
+from SecFiling10Q import SecFiling10Q
+
+def areEqual(expect, val, eps = 0.01):
+ try:
+ diff = abs(float(val) / float(expect) - 1.0)
+ assert diff < eps, "Values don't matc... | |
244e91021d87a52dc985eedc8f974653f290c4bd | migrations/versions/0225_another_letter_org.py | migrations/versions/0225_another_letter_org.py | """empty message
Revision ID: 0225_another_letter_org
Revises: 0224_returned_letter_status
"""
# revision identifiers, used by Alembic.
revision = '0225_another_letter_org'
down_revision = '0224_returned_letter_status'
from alembic import op
NEW_ORGANISATIONS = [
('512', 'Vale of Glamorgan'),
('513', 'Rot... | Add two new letter logos | Add two new letter logos
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,36 @@
+"""empty message
+
+Revision ID: 0225_another_letter_org
+Revises: 0224_returned_letter_status
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '0225_another_letter_org'
+down_revision = '0224_returned_letter_status'
+
+from alembic import op
+
+
+NEW_ORGANISATIONS = [
+ ('5... | |
730e8b79a8c5c27751cc429f348932bd3638bd85 | tests/test_base.py | tests/test_base.py | """tests/test_base.py.
Tests the base blox to ensure they provide solid functionality for a Python dom representation
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in ... | Add initial test for base block elements | Add initial test for base block elements
| Python | mit | timothycrosley/blox,timothycrosley/blox,timothycrosley/blox | ---
+++
@@ -0,0 +1,27 @@
+"""tests/test_base.py.
+
+Tests the base blox to ensure they provide solid functionality for a Python dom representation
+Copyright (C) 2015 Timothy Edmund Crosley
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+documentation f... | |
d2d4e057b3a1de8f2be917aa5b8b3a4c0f5e1dc5 | tests/unit/test_execeptions.py | tests/unit/test_execeptions.py | #!/usr/bin/env python
from butter import eventfd, _eventfd
from pytest import raises
import pytest
import errno
@pytest.mark.parametrize('path,module,func,errno,exception', [
('butter._eventfd.C.eventfd', _eventfd, _eventfd.eventfd, errno.EINVAL, ValueError),
('butter... | Add testing of behavior when syscall fails | Add testing of behavior when syscall fails
| Python | bsd-3-clause | dasSOZO/python-butter,wdv4758h/butter | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+from butter import eventfd, _eventfd
+from pytest import raises
+import pytest
+import errno
+
+@pytest.mark.parametrize('path,module,func,errno,exception', [
+ ('butter._eventfd.C.eventfd', _eventfd, _eventfd.eventfd, errno.EINVAL, ValueError... | |
612d2e3f749244c00404d97d93982c88538ce8aa | mk_json_query.py | mk_json_query.py | #python mk_json_quert.py & excute it in backgroud
# excute ES query and export it to apache directory for data visulization
import datetime
from elasticsearch import Elasticsearch
from elasticsearch import helpers
import os.path
import time
import json
#JSON export for further data visulization
FILE_PATH_JSON1 = "/var... | Add export data into apache folder script | Add export data into apache folder script
| Python | mit | yuecong/tools,yuecong/tools,yuecong/tools,yuecong/tools | ---
+++
@@ -0,0 +1,123 @@
+#python mk_json_quert.py & excute it in backgroud
+# excute ES query and export it to apache directory for data visulization
+import datetime
+from elasticsearch import Elasticsearch
+from elasticsearch import helpers
+import os.path
+import time
+import json
+
+#JSON export for further dat... | |
637b95a59f740314ea82d8dcced67656d150d8a8 | concept.py | concept.py | import docker
import dronekit
# connect to the Docker daemon
client = docker.client.from_env()
print("AAA")
# provision a container from an ArduPilot image
image_name = "squareslab/ardubugs:base"
container = client.containers.create(image_name, "/bin/bash", stdin_open=True, detach=True, working_dir="/experiment/sourc... | Create container, build the spurce and run ardurover | Create container, build the spurce and run ardurover
| Python | mit | squaresLab/Houston,squaresLab/Houston,squaresLab/Houston | ---
+++
@@ -0,0 +1,34 @@
+import docker
+import dronekit
+
+# connect to the Docker daemon
+client = docker.client.from_env()
+print("AAA")
+
+# provision a container from an ArduPilot image
+image_name = "squareslab/ardubugs:base"
+container = client.containers.create(image_name, "/bin/bash", stdin_open=True, detach... | |
b63dd66a96b503eb10d2eb49162ed4ed99a9e8f2 | apps/domain/tests/test_core/test_manager/test_env_manager.py | apps/domain/tests/test_core/test_manager/test_env_manager.py | from src.main.core.database import *
from src.main.core.database.environment.environment import Environment
from src.main.core.database.environment.user_environment import UserEnvironment
from src.main.core.manager import EnvironmentManager, UserManager
from src.main.core.exceptions import InvalidCredentialsError
impor... | ADD initial environment unit tests | ADD initial environment unit tests
| Python | apache-2.0 | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | ---
+++
@@ -0,0 +1,81 @@
+from src.main.core.database import *
+from src.main.core.database.environment.environment import Environment
+from src.main.core.database.environment.user_environment import UserEnvironment
+from src.main.core.manager import EnvironmentManager, UserManager
+from src.main.core.exceptions impo... | |
0a29c11ca7b2769f993a131b6d9df35b33f3538c | pyrobus/utils.py | pyrobus/utils.py | from __future__ import division
from threading import Thread
from time import time, sleep
from math import sin, pi
class Sinus(object):
update_frequency = 25.0
def __init__(self, motor, frequency, amplitude, offset, phase):
self.motor = motor
self.frequency = frequency
self.amplitud... | Add a sinus utilities for the servo module. | Add a sinus utilities for the servo module.
| Python | mit | pollen/pyrobus | ---
+++
@@ -0,0 +1,44 @@
+from __future__ import division
+
+from threading import Thread
+from time import time, sleep
+from math import sin, pi
+
+
+class Sinus(object):
+ update_frequency = 25.0
+
+ def __init__(self, motor, frequency, amplitude, offset, phase):
+ self.motor = motor
+
+ self.fr... | |
afc9ac087d4d5e31f25542579e5e0ade4d29a3c2 | day-1-2.py | day-1-2.py | with open('day-1-input.txt', 'r') as f:
puzzle_input = f.read()
current_floor = 0
current_position = 0
for paren in puzzle_input:
current_position += 1
if paren == '(':
current_floor += 1
elif paren == ')':
current_floor -= 1
if current_floor < 0:
break
print(current_po... | Complete day 1 part 2 | Complete day 1 part 2
| Python | mit | foxscotch/advent-of-code,foxscotch/advent-of-code | ---
+++
@@ -0,0 +1,22 @@
+with open('day-1-input.txt', 'r') as f:
+ puzzle_input = f.read()
+
+
+current_floor = 0
+current_position = 0
+
+for paren in puzzle_input:
+ current_position += 1
+
+ if paren == '(':
+ current_floor += 1
+ elif paren == ')':
+ current_floor -= 1
+
+ if current... | |
a455c8f667af831b53b10abf998cbcaef2e2e1dd | shuup/testing/migrations/0005_supplierprice.py | shuup/testing/migrations/0005_supplierprice.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import shuup.utils.properties
import shuup.core.fields
class Migration(migrations.Migration):
dependencies = [
('shuup', '0051_supplier_enabled'),
('shuup_testing', '0004_fieldsmodel'),
]... | Add missing migration for unit tests | Add missing migration for unit tests
| Python | agpl-3.0 | shoopio/shoop,shoopio/shoop,shoopio/shoop | ---
+++
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import shuup.utils.properties
+import shuup.core.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('shuup', '0051_supplier_enabled'),
+ ('sh... | |
769d8b85ba9591d5640008dd2812c1db96cd3cef | cube_analysis/cube_utils.py | cube_analysis/cube_utils.py |
from spectral_cube import SpectralCube, VaryingResolutionSpectralCube
from astropy.io import fits
import astropy.units as u
import os
from .io_utils import create_huge_fits
from .progressbar import ProgressBar
def convert_K(cube_name, output_folder, is_huge=True, verbose=False):
'''
Convert a larger-than-me... | Add per channel K conversion function | Add per channel K conversion function
| Python | mit | e-koch/CubeAnalysis | ---
+++
@@ -0,0 +1,65 @@
+
+from spectral_cube import SpectralCube, VaryingResolutionSpectralCube
+from astropy.io import fits
+import astropy.units as u
+import os
+
+from .io_utils import create_huge_fits
+from .progressbar import ProgressBar
+
+
+def convert_K(cube_name, output_folder, is_huge=True, verbose=False)... | |
9ea0dcb8a749461770dfeb7a77c6e3d210afa94e | clipped_loss.py | clipped_loss.py | from chainer import functions as F
def clipped_loss(x, t):
diff = x - t
abs_loss = abs(diff)
squared_loss = diff ** 2
abs_loss = F.expand_dims(abs_loss, 1)
squared_loss = F.expand_dims(squared_loss, 1)
return F.sum(F.min(F.concat((abs_loss, squared_loss), axis=1), axis=1))
| Move clippped_loss into a separate file | Move clippped_loss into a separate file
| Python | mit | toslunar/chainerrl,toslunar/chainerrl | ---
+++
@@ -0,0 +1,9 @@
+from chainer import functions as F
+
+def clipped_loss(x, t):
+ diff = x - t
+ abs_loss = abs(diff)
+ squared_loss = diff ** 2
+ abs_loss = F.expand_dims(abs_loss, 1)
+ squared_loss = F.expand_dims(squared_loss, 1)
+ return F.sum(F.min(F.concat((abs_loss, squared_loss), axis... | |
ac19575d72a78b0c7a6e51a51738209ac7caf26e | extract.py | extract.py | #!/usr/bin/python3
import sys
import os
import subprocess
if len(sys.argv) < 3:
print("Provide reference image and output file.")
exit(1)
reference = sys.argv[1]
output = sys.argv[2]
path = os.getcwd() if len(sys.argv) == 3 else sys.argv[3]
def get_time(path):
result = subprocess.run(["master", "time", path], st... | Add pythons script to make charts. | Add pythons script to make charts.
| Python | mit | ciechowoj/master,ciechowoj/master,ciechowoj/master | ---
+++
@@ -0,0 +1,69 @@
+#!/usr/bin/python3
+
+import sys
+import os
+import subprocess
+
+if len(sys.argv) < 3:
+ print("Provide reference image and output file.")
+ exit(1)
+
+reference = sys.argv[1]
+output = sys.argv[2]
+path = os.getcwd() if len(sys.argv) == 3 else sys.argv[3]
+
+def get_time(path):
+ result = ... | |
a1d2ec80dff63c7e208305207c697e5d3604a8f5 | photutils/aperture/attributes.py | photutils/aperture/attributes.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Descriptor class(es) for aperture attribute validation.
"""
import weakref
from astropy.coordinates import SkyCoord
import astropy.units as u
import numpy as np
class ApertureAttribute:
"""
Base descriptor class for aperture attribute valid... | Add initial aperture descriptor classes | Add initial aperture descriptor classes
| Python | bsd-3-clause | larrybradley/photutils,astropy/photutils | ---
+++
@@ -0,0 +1,61 @@
+# Licensed under a 3-clause BSD style license - see LICENSE.rst
+"""
+Descriptor class(es) for aperture attribute validation.
+"""
+
+import weakref
+
+from astropy.coordinates import SkyCoord
+import astropy.units as u
+import numpy as np
+
+
+class ApertureAttribute:
+ """
+ Base des... | |
8d6c7623539a7109893c10aca0e116bf41b51634 | web/migrations/versions/ad456cec28f4_add_user_name_column.py | web/migrations/versions/ad456cec28f4_add_user_name_column.py | """Add User.name column
Revision ID: ad456cec28f4
Revises: d767d9266a19
Create Date: 2016-11-21 03:03:08.967762
"""
# revision identifiers, used by Alembic.
revision = 'ad456cec28f4'
down_revision = 'd767d9266a19'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Ale... | """Add User.name column
Revision ID: ad456cec28f4
Revises: d767d9266a19
Create Date: 2016-11-21 03:03:08.967762
"""
# revision identifiers, used by Alembic.
revision = 'ad456cec28f4'
down_revision = 'd767d9266a19'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Ale... | Add column default for User.name column | Add column default for User.name column
| Python | mit | usgo/online-ratings,usgo/online-ratings,usgo/online-ratings,Kashomon/online-ratings,Kashomon/online-ratings,Kashomon/online-ratings | ---
+++
@@ -16,7 +16,7 @@
def upgrade():
### commands auto generated by Alembic - please adjust! ###
- op.add_column('myuser', sa.Column('name', sa.String(length=255), nullable=False))
+ op.add_column('myuser', sa.Column('name', sa.String(length=255), nullable=False, server_default=''))
### end Ale... |
b07fcb6cc416c1b8c2a872e054069de218b7f3a5 | accelerator/migrations/0077_update_sitetree_judging_commitment_view_url.py | accelerator/migrations/0077_update_sitetree_judging_commitment_view_url.py | # Generated by Django 2.2.24 on 2021-11-29 12:36
from django.db import migrations
def update_judging_commitment_view_url(apps, schema_editor):
NavTreeItem = apps.get_model('accelerator', 'NavTreeItem')
NavTreeItem.objects.filter(
url='/expert/commitments/').update(url='/judging/commitments/')
class... | Merge remote-tracking branch 'origin' into AC-9265 | [AC-9265] Merge remote-tracking branch 'origin' into AC-9265
| Python | mit | masschallenge/django-accelerator,masschallenge/django-accelerator | ---
+++
@@ -0,0 +1,20 @@
+# Generated by Django 2.2.24 on 2021-11-29 12:36
+
+from django.db import migrations
+
+
+def update_judging_commitment_view_url(apps, schema_editor):
+ NavTreeItem = apps.get_model('accelerator', 'NavTreeItem')
+ NavTreeItem.objects.filter(
+ url='/expert/commitments/').update(... | |
b0cafcf2b4ca61f5d2581c833851f9ac24968a98 | Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Util/Numpy.py | Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Util/Numpy.py | import Axon
class TypeConverter(Axon.Component.component):
type = None
def main(self):
while 1:
if self.dataReady("inbox"):
data = self.recv("inbox")
if self.type != None:
self.send(data.astype(self.type), "outbox")
if not self... | Add component for converting between numpy types | Add component for converting between numpy types
| Python | apache-2.0 | sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia | ---
+++
@@ -0,0 +1,13 @@
+import Axon
+
+class TypeConverter(Axon.Component.component):
+ type = None
+ def main(self):
+ while 1:
+ if self.dataReady("inbox"):
+ data = self.recv("inbox")
+ if self.type != None:
+ self.send(data.astype(self.typ... | |
3e8a16b270c28fb955e1ab3e38da0aae2d0d6128 | src/tmlib/workflow/metaconfig/niselements.py | src/tmlib/workflow/metaconfig/niselements.py | '''Implementation of classes for reading microscope image and metadata files
provided in a format specific to microscopes equipped
with
`Nikon NISElements <https://www.nikoninstruments.com/Products/Software>`_
software.
'''
import os
import re
import logging
import bioformats
from collections import defaultdict
from ... | Implement new microscope type for nikon NISElements | Implement new microscope type for nikon NISElements
| Python | agpl-3.0 | TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary,TissueMAPS/TmLibrary | ---
+++
@@ -0,0 +1,78 @@
+'''Implementation of classes for reading microscope image and metadata files
+provided in a format specific to microscopes equipped
+with
+`Nikon NISElements <https://www.nikoninstruments.com/Products/Software>`_
+software.
+'''
+
+import os
+import re
+import logging
+import bioformats
+fro... | |
95009e638dfa5a20a7277a326607ba7090162fc0 | seleniumbase/common/obfuscate.py | seleniumbase/common/obfuscate.py | """
Obfuscates a string/password into a string that can be decrypted later on.
Usage:
python obfuscate.py
Then enter the password.
The result is an encrypted password.
"""
from seleniumbase.common import encryption
import getpass
import time
def main():
try:
while(1):
print("\nEnter password... | Add the user interface for string/password obfuscation | Add the user interface for string/password obfuscation
| Python | mit | seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/seleniumspot,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/seleniumspot,mdmintz/SeleniumBase | ---
+++
@@ -0,0 +1,34 @@
+"""
+Obfuscates a string/password into a string that can be decrypted later on.
+
+Usage:
+python obfuscate.py
+Then enter the password.
+The result is an encrypted password.
+"""
+
+from seleniumbase.common import encryption
+import getpass
+import time
+
+
+def main():
+ try:
+ w... | |
4cc7d842afbb9ca2f324886de1974e7dacb600dd | dlexperiment.py | dlexperiment.py | class Experiment(object):
def __init__(self, epochs=1):
self.epochs = epochs
def get_epochs(self):
return self.epochs
def train(self):
raise NotImplementedError
def test(self):
raise NotImplementedError
def set_loss(self):
raise NotImplementedError
de... | Add outline parent class for defining experiments | Add outline parent class for defining experiments
| Python | apache-2.0 | sagelywizard/dlex | ---
+++
@@ -0,0 +1,31 @@
+class Experiment(object):
+ def __init__(self, epochs=1):
+ self.epochs = epochs
+
+ def get_epochs(self):
+ return self.epochs
+
+ def train(self):
+ raise NotImplementedError
+
+ def test(self):
+ raise NotImplementedError
+
+ def set_loss(self):
... | |
143500bc7064b05d0ce4a132cce1f48ddb1ecee7 | rwt/tests/test_scripts.py | rwt/tests/test_scripts.py | import textwrap
import sys
import subprocess
def test_pkg_imported(tmpdir):
"""
Create a script that loads cython and ensure it runs.
"""
body = textwrap.dedent("""
import cython
print("Successfully imported cython")
""").lstrip()
script_file = tmpdir / 'script'
script_file.write_text(body, 'utf-8')
pip_... | Add test for basic functionality | Add test for basic functionality
| Python | mit | jaraco/rwt | ---
+++
@@ -0,0 +1,20 @@
+import textwrap
+import sys
+import subprocess
+
+
+def test_pkg_imported(tmpdir):
+ """
+ Create a script that loads cython and ensure it runs.
+ """
+ body = textwrap.dedent("""
+ import cython
+ print("Successfully imported cython")
+ """).lstrip()
+ script_file = tmpdir / 'script'
+ s... | |
83863814795bf2fc6ddf12c1a45aa531afb1662c | tests/backends/events_test.py | tests/backends/events_test.py | import threading
import unittest
from pykka.actor import ThreadingActor
from pykka.registry import ActorRegistry
from mopidy.backends.dummy import DummyBackend
from mopidy.listeners import BackendListener
from mopidy.models import Track
class BackendEventsTest(unittest.TestCase):
def setUp(self):
self.ev... | Test that backend actually sends the events | Test that backend actually sends the events
| Python | apache-2.0 | kingosticks/mopidy,diandiankan/mopidy,glogiotatidis/mopidy,vrs01/mopidy,dbrgn/mopidy,liamw9534/mopidy,SuperStarPL/mopidy,quartz55/mopidy,ZenithDK/mopidy,diandiankan/mopidy,ali/mopidy,kingosticks/mopidy,vrs01/mopidy,pacificIT/mopidy,ali/mopidy,diandiankan/mopidy,rawdlite/mopidy,vrs01/mopidy,bencevans/mopidy,tkem/mopidy,... | ---
+++
@@ -0,0 +1,45 @@
+import threading
+import unittest
+
+from pykka.actor import ThreadingActor
+from pykka.registry import ActorRegistry
+
+from mopidy.backends.dummy import DummyBackend
+from mopidy.listeners import BackendListener
+from mopidy.models import Track
+
+class BackendEventsTest(unittest.TestCase)... | |
48c5e7ce3029ab67c755b6fa0c08412525bd0a0a | mapApp/utils/weather4all.py | mapApp/utils/weather4all.py | from mapApp.models import Incident, Weather
from mapApp.utils.weather import get_weather
import threading
import time
maxconnections = 5
semaphore = threading.Semaphore(maxconnections)
def run():
""" Create Weather instances for all Incidents in the application database if they do not already exist
"""
st... | Write multithreaded script to get all weather for existing incidents in the database | Write multithreaded script to get all weather for existing incidents in the database
| Python | mit | SPARLab/BikeMaps,SPARLab/BikeMaps,SPARLab/BikeMaps | ---
+++
@@ -0,0 +1,56 @@
+from mapApp.models import Incident, Weather
+from mapApp.utils.weather import get_weather
+import threading
+import time
+
+maxconnections = 5
+semaphore = threading.Semaphore(maxconnections)
+
+def run():
+ """ Create Weather instances for all Incidents in the application database if the... | |
c5631d19baecb2884d4dbc98ecaa333c615efbab | fabix/aws/s3.py | fabix/aws/s3.py | import os
import boto
from boto.utils import compute_md5
from fabric.decorators import task
from fabric.utils import puts
def upload_file(bucket, key_name, file_path, policy='public-read'):
key = bucket.new_key(key_name)
fd = open(file_path)
md5 = compute_md5(fd)
fd.close()
key.set_metadata('fabi... | Add task to upload a dir to S3 | Add task to upload a dir to S3
| Python | mit | vmalavolta/fabix | ---
+++
@@ -0,0 +1,48 @@
+import os
+
+import boto
+from boto.utils import compute_md5
+from fabric.decorators import task
+from fabric.utils import puts
+
+
+def upload_file(bucket, key_name, file_path, policy='public-read'):
+ key = bucket.new_key(key_name)
+ fd = open(file_path)
+ md5 = compute_md5(fd)
+ ... | |
4a2be1f9526f66ee9c909bcfa1f987d696dafeac | oneflow/settings/snippets/common_development.py | oneflow/settings/snippets/common_development.py | #
# Include your development machines hostnames here.
#
# NOTE: this is not strictly needed, as Django doesn't enforce
# the check if DEBUG==True. But Just in case you wanted to disable
# it temporarily, this could be a good thing to have your hostname
# here.
#
# If you connect via http://localhost:8000/, everything i... | #
# Include your development machines hostnames here.
#
# NOTE: this is not strictly needed, as Django doesn't enforce
# the check if DEBUG==True. But Just in case you wanted to disable
# it temporarily, this could be a good thing to have your hostname
# here.
#
# If you connect via http://localhost:8000/, everything i... | Fix the devserver default address setting name. | Fix the devserver default address setting name. | Python | agpl-3.0 | WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow | ---
+++
@@ -22,7 +22,7 @@
INSTALLED_APPS += ('django_nose', 'devserver', )
-DEVSERVER_DEFAULT_ADDRESS = '0.0.0.0'
+DEVSERVER_DEFAULT_ADDR = '0.0.0.0'
DEVSERVER_DEFAULT_PORT = 8000
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' |
6c885eb92d7e150e39297d32c45fc8d69aae099f | tools/update-qibuild-cmake.py | tools/update-qibuild-cmake.py | ## Copyright (C) 2011 Aldebaran Robotics
# Update all the qibuild.cmake files in a git repo
# (this will be done automatically by `qibuild configure`,
# but this tool can still be handy)
import os
import argparse
import subprocess
import shutil
def update_qibuild_cmake(template_path, git_repo):
""" Update qibuil... | Add a small too to update qibuild.cmake inside git repos | Add a small too to update qibuild.cmake inside git repos
| Python | bsd-3-clause | dmerejkowsky/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,aldebaran/qibuild | ---
+++
@@ -0,0 +1,60 @@
+## Copyright (C) 2011 Aldebaran Robotics
+
+# Update all the qibuild.cmake files in a git repo
+# (this will be done automatically by `qibuild configure`,
+# but this tool can still be handy)
+
+import os
+import argparse
+import subprocess
+import shutil
+
+def update_qibuild_cmake(template... | |
3bf027eaf2c62ec6fcb3192cfddc5a2aa8b73895 | oneflow/settings/chani.py | oneflow/settings/chani.py | # -*- coding: utf-8 -*-
# Settings for 1flow.net (local development)
import os
from sparks.django.settings import include_snippets
include_snippets(
os.path.dirname(__file__), (
'00_development',
# Activate this to test 404/500…
#'00_production',
'1flow_io',
'common',
... | # -*- coding: utf-8 -*-
# Settings for 1flow.net (local development)
import os
from sparks.django.settings import include_snippets
include_snippets(
os.path.dirname(__file__), (
'00_development',
# Activate this to test 404/500…
#'00_production',
'1flow_io',
'common',
... | Make mail working on my dev machine. | Make mail working on my dev machine. | Python | agpl-3.0 | 1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow | ---
+++
@@ -25,4 +25,8 @@
)
# Override `1flow_net` for local development
-SITE_DOMAIN = 'localhost'
+SITE_DOMAIN = 'localhost:8000'
+
+EMAIL_HOST = 'gurney'
+#EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
+#EMAIL_FILE_PATH = '/tmp/1flow.mail' |
76c2be209e04e38b4730a07a5155e3e22501027a | som_generationkwh/migrations/0.0.1.1/pre-0001_delete_inactive_investments.py | som_generationkwh/migrations/0.0.1.1/pre-0001_delete_inactive_investments.py | # coding=utf-8
from oopgrade import oopgrade
import netsvc
def up(cursor, installed_version):
logger= netsvc.Logger()
print "somenergia-generationkwh_0.0.1.1: Hem entrat al UP"
if not installed_version:
return
logger.notifyChannel('migration', netsvc.LOG_INFO, 'Changing ir_model_data from gis... | Change version terp and move migration folder | Change version terp and move migration folder
| Python | agpl-3.0 | Som-Energia/somenergia-generationkwh,Som-Energia/somenergia-generationkwh | ---
+++
@@ -0,0 +1,39 @@
+# coding=utf-8
+from oopgrade import oopgrade
+import netsvc
+
+
+def up(cursor, installed_version):
+ logger= netsvc.Logger()
+ print "somenergia-generationkwh_0.0.1.1: Hem entrat al UP"
+ if not installed_version:
+ return
+
+ logger.notifyChannel('migration', netsvc.LOG... | |
977fb316f3a27f6516fac2a6323545381fdd7cc0 | sparts/tasks/periodic.py | sparts/tasks/periodic.py | from ..vtask import VTask, TryLater
import time
from ..sparts import option, counter, samples, SampleType
from threading import Event
class PeriodicTask(VTask):
INTERVAL = None
execute_duration = samples(windows=[60, 240],
types=[SampleType.AVG, SampleType.MAX, SampleType.MIN])
n_iterations = coun... | from ..vtask import VTask, TryLater
import time
from ..sparts import option, counter, samples, SampleType
from threading import Event
class PeriodicTask(VTask):
INTERVAL = None
execute_duration = samples(windows=[60, 240],
types=[SampleType.AVG, SampleType.MAX, SampleType.MIN])
n_iterations = coun... | Fix time calculation for TryLater in PeriodicTasks | Fix time calculation for TryLater in PeriodicTasks
| Python | bsd-3-clause | djipko/sparts,pshuff/sparts,fmoo/sparts,bboozzoo/sparts,djipko/sparts,pshuff/sparts,bboozzoo/sparts,facebook/sparts,facebook/sparts,fmoo/sparts | ---
+++
@@ -27,14 +27,14 @@
super(PeriodicTask, self).stop()
def _runloop(self):
+ t0 = time.time()
while not self.service._stop:
- t0 = time.time()
try:
self.execute()
except TryLater:
self.n_try_later.increment()
... |
5cabd890b65102e3a28fa864af45bec19ee0e601 | index_converter.py | index_converter.py | # -*- coding: utf-8 -*-
"""Converting the index from the Archives in a suitable format."""
__authors__ = 'User:Jean-Frédéric'
import codecs
from uploadlibrary import UnicodeCSV
import sys
import re
reload(sys)
sys.setdefaultencoding('utf-8')
def read_csv(csv_file, delimiter):
"""Read the CSV file and return ea... | Add script to convert the archives index | Add script to convert the archives index
The Archives provided us with an index mapping a place
to a range of identifier. This needs some work to be useful.
| Python | mit | JeanFred/TrutatBis | ---
+++
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+
+"""Converting the index from the Archives in a suitable format."""
+
+__authors__ = 'User:Jean-Frédéric'
+
+import codecs
+from uploadlibrary import UnicodeCSV
+import sys
+import re
+reload(sys)
+sys.setdefaultencoding('utf-8')
+
+
+def read_csv(csv_file, delimite... | |
bb3502e96cd4c3636a75dbf5c3156c2b54e54577 | timeside/server/management/commands/timeside-celery-worker.py | timeside/server/management/commands/timeside-celery-worker.py | import shlex
import subprocess
from django.core.management.base import BaseCommand
from django.utils import autoreload
# thanks to https://medium.com/aubergine-solutions/auto-reload-development-mode-for-celery-worker-using-docker-compose-and-django-management-2ba8e313eb37
def restart_celery(*args, **kwargs):
ki... | Add worker celery reload command prototype | Add worker celery reload command prototype
| Python | agpl-3.0 | Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide | ---
+++
@@ -0,0 +1,21 @@
+import shlex
+import subprocess
+
+from django.core.management.base import BaseCommand
+from django.utils import autoreload
+
+# thanks to https://medium.com/aubergine-solutions/auto-reload-development-mode-for-celery-worker-using-docker-compose-and-django-management-2ba8e313eb37
+
+
+def re... | |
953bc05e048cb7e00db540254103ec86664ad1d6 | analysis/11-compress-jacobians.py | analysis/11-compress-jacobians.py | import climate
import logging
import numpy as np
import os
from sklearn.decomposition import PCA
def compress(source, k='mle', key='jac'):
filenames = sorted(fn for fn in os.listdir(source)
if key in fn and fn.endswith('.npy'))
logging.info('%s: found %d jacobians matching %s',
... | Add script for PCA compressing jacobian arrays. | Add script for PCA compressing jacobian arrays.
| Python | mit | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment | ---
+++
@@ -0,0 +1,39 @@
+import climate
+import logging
+import numpy as np
+import os
+
+from sklearn.decomposition import PCA
+
+
+def compress(source, k='mle', key='jac'):
+ filenames = sorted(fn for fn in os.listdir(source)
+ if key in fn and fn.endswith('.npy'))
+ logging.info('%s: f... | |
7b2c082f117a5481823c806af926b812045933e7 | recipy/PatchMultipleWrappers.py | recipy/PatchMultipleWrappers.py | import six
from .PatchImporter import PatchImporter
from recipyCommon.utils import patch_function, create_wrapper
from recipyCommon.config import option_set
class PatchMultipleWrappers(PatchImporter):
"""Sublass of PatchImporter that allows patching input and output functions
using more than two wrappers.
... | Add new patch type that allows for multiple wrappers | Add new patch type that allows for multiple wrappers
PatchSimple allows for exactly one wrapper for input and output functions
respectively. For xarray output function save_mfdataset, the default wrapper
which logs argument 0 does not work, because it should be argument 1
that is logged. So, a second wrapper is requir... | Python | apache-2.0 | recipy/recipy,recipy/recipy | ---
+++
@@ -0,0 +1,76 @@
+import six
+
+from .PatchImporter import PatchImporter
+
+from recipyCommon.utils import patch_function, create_wrapper
+from recipyCommon.config import option_set
+
+
+class PatchMultipleWrappers(PatchImporter):
+ """Sublass of PatchImporter that allows patching input and output function... | |
25cf11421fc3f123e4d623f9736867b3800412ba | python3_tools/get_edx_webservices.py | python3_tools/get_edx_webservices.py | import github
from get_repos import *
webservices = []
for repo in expanded_repos_list(orgs):
try:
metadata = get_remote_yaml(repo, 'openedx.yaml')
except github.GithubException:
continue
if 'tags' in metadata and 'webservice' in metadata['tags']:
print("{}".format(repo.html_url))... | Add tooling to get all of edx's web services. | Add tooling to get all of edx's web services.
| Python | apache-2.0 | edx/repo-tools,edx/repo-tools | ---
+++
@@ -0,0 +1,15 @@
+import github
+from get_repos import *
+
+
+webservices = []
+
+for repo in expanded_repos_list(orgs):
+ try:
+ metadata = get_remote_yaml(repo, 'openedx.yaml')
+ except github.GithubException:
+ continue
+ if 'tags' in metadata and 'webservice' in metadata['tags']:
+ ... | |
1ced12173272a670b001cf17aa0beb08bae2eb8a | scipy/fftpack/realtransforms.py | scipy/fftpack/realtransforms.py | """
Real spectrum tranforms (DCT, DST, MDCT)
"""
__all__ = ['dct1', 'dct2']
import numpy as np
from scipy.fftpack import _fftpack
import atexit
atexit.register(_fftpack.destroy_dct1_cache)
atexit.register(_fftpack.destroy_dct2_cache)
def dct1(x, n=None):
"""
Return Discrete Cosine Transform (type I) of arbi... | Add python wrapper around fftpack dct. | Add python wrapper around fftpack dct.
| Python | bsd-3-clause | ilayn/scipy,ortylp/scipy,kalvdans/scipy,perimosocordiae/scipy,surhudm/scipy,witcxc/scipy,befelix/scipy,pbrod/scipy,minhlongdo/scipy,efiring/scipy,sauliusl/scipy,vanpact/scipy,cpaulik/scipy,sriki18/scipy,endolith/scipy,jjhelmus/scipy,giorgiop/scipy,vigna/scipy,apbard/scipy,WarrenWeckesser/scipy,larsmans/scipy,woodscn/sc... | ---
+++
@@ -0,0 +1,91 @@
+"""
+Real spectrum tranforms (DCT, DST, MDCT)
+"""
+
+__all__ = ['dct1', 'dct2']
+
+import numpy as np
+from scipy.fftpack import _fftpack
+
+import atexit
+atexit.register(_fftpack.destroy_dct1_cache)
+atexit.register(_fftpack.destroy_dct2_cache)
+
+def dct1(x, n=None):
+ """
+ Return... | |
d215b6d00d06ffa9917b7bdf8323f33d83e35cf7 | src/waldur_mastermind/support/management/commands/switching_backend_server.py | src/waldur_mastermind/support/management/commands/switching_backend_server.py | from django.core.management.base import BaseCommand
from waldur_mastermind.support import backend as support_backend
from ... import models
class Command(BaseCommand):
help = ("Backend data update if a server was switched.")
def handle(self, *args, **options):
models.RequestType.objects.all().delet... | Implement management command to switch backend server in JIRA Service Desk plugin. | Implement management command to switch backend server in JIRA Service Desk plugin.
| Python | mit | opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur | ---
+++
@@ -0,0 +1,25 @@
+from django.core.management.base import BaseCommand
+
+from waldur_mastermind.support import backend as support_backend
+
+from ... import models
+
+
+class Command(BaseCommand):
+ help = ("Backend data update if a server was switched.")
+
+ def handle(self, *args, **options):
+ ... | |
4374eb9cf20350f1d5610bfbae358dbb733bb044 | python/subnets-in-cidr.py | python/subnets-in-cidr.py | #!/usr/bin/python
import argparse
import netaddr
import os
import infoblox_netmri
parser = argparse.ArgumentParser()
parser.add_argument("cidr")
args = parser.parse_args()
print("Searching for subnets in %s." % args.cidr)
url = os.environ['NETMRI_API_URL']
user = os.environ['NETMRI_USER']
password = os.environ['N... | Add a sample script for searching subnets in a CIDR | Add a sample script for searching subnets in a CIDR
See request in community:
https://community.infoblox.com/t5/Network-Change-Configuration/Anyone-ha
ve-an-Example-NetMRI-REST-call-using-filters-in-Python/m-p/5021#M1430
| Python | mit | infobloxopen/netmri-toolkit,infobloxopen/netmri-toolkit,infobloxopen/netmri-toolkit | ---
+++
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+
+
+import argparse
+import netaddr
+import os
+
+import infoblox_netmri
+
+parser = argparse.ArgumentParser()
+parser.add_argument("cidr")
+args = parser.parse_args()
+
+print("Searching for subnets in %s." % args.cidr)
+
+url = os.environ['NETMRI_API_URL']
+user = os.env... | |
5df6e6b3ec523376906abeb8a52eb6c5dc5d46ec | openquake/commands/webui.py | openquake/commands/webui.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2016, GEM Foundation
# OpenQuake 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 Licen... | Add a command to start the WebUI using oq | Add a command to start the WebUI using oq
The django development server is started in foreground
on localhost:8800. Meant to be used with multi_user = false
but works also if true.
Former-commit-id: bbfc5549fb632d535ed1934e0d2bd1226ccd4507 | Python | agpl-3.0 | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine | ---
+++
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright (c) 2016, GEM Foundation
+
+# OpenQuake 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 Founda... | |
24478a92ef1218ade7867ba5a2f2d8172aea8c64 | tests/test_load_data.py | tests/test_load_data.py | import unittest
import sys
sys.path.append('soccer')
import leagueproperties
import leagueids
import main
class TestLoadData(unittest.TestCase):
TEAMS_INFO_FILENAME = "teams.json"
def set_up(self):
pass
def tear_down(self):
pass
def test_load_team_data(self):
raised = False
... | Implement simple unit tests for loading data at startup | Implement simple unit tests for loading data at startup
| Python | mit | Saturn/soccer-cli,architv/soccer-cli | ---
+++
@@ -0,0 +1,45 @@
+import unittest
+import sys
+sys.path.append('soccer')
+import leagueproperties
+import leagueids
+import main
+
+class TestLoadData(unittest.TestCase):
+
+ TEAMS_INFO_FILENAME = "teams.json"
+
+ def set_up(self):
+ pass
+
+ def tear_down(self):
+ pass
+
+ def test_... | |
f72f7252808266b8ee9e3f5f46b3c617a4b1f787 | app/tests/model_helpers.py | app/tests/model_helpers.py | import pytest
def test_factory(factory):
try:
factory()
except Exception as e:
pytest.fail(
f"Failed factory initialization for {str(factory)} with exception: {e}"
)
| Refactor factory testing even more | Refactor factory testing even more
| Python | apache-2.0 | comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django | ---
+++
@@ -0,0 +1,10 @@
+import pytest
+
+
+def test_factory(factory):
+ try:
+ factory()
+ except Exception as e:
+ pytest.fail(
+ f"Failed factory initialization for {str(factory)} with exception: {e}"
+ ) | |
ff9519261e73a77733e6b4566dd1666d05bacf3d | display.py | display.py | import Tkinter
import flaggen
class FlagFrame(Tkinter.Frame):
def __init__(self, master, flag, *args, **kwargs):
Tkinter.Frame.__init__(self, master, *args, **kwargs)
self.flag = flag
self.canvas_height = 250
self.canvas_width = 500
self.canvas = Tkinter.Canvas(self, heig... | Add Module for Displaying Flags in Tkinter Window | Add Module for Displaying Flags in Tkinter Window
| Python | mit | Eylrid/flaggen | ---
+++
@@ -0,0 +1,22 @@
+import Tkinter
+import flaggen
+
+class FlagFrame(Tkinter.Frame):
+ def __init__(self, master, flag, *args, **kwargs):
+ Tkinter.Frame.__init__(self, master, *args, **kwargs)
+
+ self.flag = flag
+
+ self.canvas_height = 250
+ self.canvas_width = 500
+
+ ... | |
5d609b104ea892ab96bd72ec6b67148c0b6eb970 | temba/flows/migrations/0068_fix_empty_flow_starts.py | temba/flows/migrations/0068_fix_empty_flow_starts.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.db.models import Q
import json
def fix_empty_starts(apps, schema):
empty_actions = ('[{"msg": {"eng": ""}, "type": "reply"}]', '[{"msg": {"base": ""}, "type": "reply"}]')
from temba.flows.mod... | Add migration to remove empty actionsets | Add migration to remove empty actionsets
| Python | agpl-3.0 | tsotetsi/textily-web,pulilab/rapidpro,tsotetsi/textily-web,pulilab/rapidpro,pulilab/rapidpro,tsotetsi/textily-web,pulilab/rapidpro,pulilab/rapidpro,tsotetsi/textily-web,tsotetsi/textily-web | ---
+++
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+from django.db.models import Q
+import json
+
+
+def fix_empty_starts(apps, schema):
+ empty_actions = ('[{"msg": {"eng": ""}, "type": "reply"}]', '[{"msg": {"base": ""}, "type": ... | |
46852d7ed9a4e03084cbd2c3d296d10946e5190f | ceph_deploy/tests/test_cli_rgw.py | ceph_deploy/tests/test_cli_rgw.py | import pytest
import subprocess
import ceph_deploy.rgw as rgw
def test_help(tmpdir, cli):
with cli(
args=['ceph-deploy', 'rgw', '--help'],
stdout=subprocess.PIPE,
) as p:
result = p.stdout.read()
assert 'usage: ceph-deploy rgw' in result
assert 'positional arguments' in re... | Add tests for RGW daemon naming | Add tests for RGW daemon naming
Signed-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>
| Python | mit | ddiss/ceph-deploy,trhoden/ceph-deploy,shenhequnying/ceph-deploy,ceph/ceph-deploy,imzhulei/ceph-deploy,SUSE/ceph-deploy-to-be-deleted,ceph/ceph-deploy,ghxandsky/ceph-deploy,isyippee/ceph-deploy,isyippee/ceph-deploy,imzhulei/ceph-deploy,ddiss/ceph-deploy,alfredodeza/ceph-deploy,branto1/ceph-deploy,branto1/ceph-deploy,Vic... | ---
+++
@@ -0,0 +1,38 @@
+import pytest
+import subprocess
+
+import ceph_deploy.rgw as rgw
+
+
+def test_help(tmpdir, cli):
+ with cli(
+ args=['ceph-deploy', 'rgw', '--help'],
+ stdout=subprocess.PIPE,
+ ) as p:
+ result = p.stdout.read()
+ assert 'usage: ceph-deploy rgw' in result... | |
eee6b64a46b24f5297940d5b93201ebd5bd71959 | cerbero/commands/debugpackages.py | cerbero/commands/debugpackages.py | # cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | Add command to debug packages | Add command to debug packages
| Python | lgpl-2.1 | jackjansen/cerbero-2013,sdroege/cerbero,freedesktop-unofficial-mirror/gstreamer-sdk__cerbero,flexVDI/cerbero,nzjrs/cerbero,ylatuya/cerbero,brion/cerbero,ikonst/cerbero,ramaxlo/cerbero,EricssonResearch/cerbero,shoreflyer/cerbero,ikonst/cerbero,ylatuya/cerbero,shoreflyer/cerbero,ramaxlo/cerbero,freedesktop-unofficial-mir... | ---
+++
@@ -0,0 +1,73 @@
+# cerbero - a multi-platform build system for Open Source software
+# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by ... | |
96e782563564af0291d8e536a5adc0b20caf1648 | tests/test_dbgp_eval_property.py | tests/test_dbgp_eval_property.py | if __name__ == "__main__":
import sys
sys.path.append('../plugin/python/')
import unittest2 as unittest
import vdebug.dbgp
import xml.etree.ElementTree as ET
class EvalPropertyTest(unittest.TestCase):
def __get_eval_property(self,xml_string,code,lang):
xml = ET.fromstring(xml_string)
firstn... | Add failing test for eval'd numeric array keys | Add failing test for eval'd numeric array keys
| Python | mit | paprykarz/vdebug,joonty/vdebug,joonty/vdebug,Taluu/vdebug,paprykarz/vdebug,joonty/vdebug,Taluu/vdebug,Taluu/vdebug,paprykarz/vdebug | ---
+++
@@ -0,0 +1,42 @@
+if __name__ == "__main__":
+ import sys
+ sys.path.append('../plugin/python/')
+import unittest2 as unittest
+import vdebug.dbgp
+import xml.etree.ElementTree as ET
+
+class EvalPropertyTest(unittest.TestCase):
+ def __get_eval_property(self,xml_string,code,lang):
+ xml = ET.... | |
8bc64c7e0d461ba51459f927f54822cbacf8404f | Surface/rotate.py | Surface/rotate.py | import sys
import os
import subprocess
import re
status = subprocess.check_output(["xrandr", "-q"])
print (status)
lines = status.split("\n")
print (lines)
stat = ""
for line in lines:
if "eDP-1" in line:
stat = line
orientation = stat.split(" ")[4]
if len(sys.argv) < 2:
exit()
elif (sys.argv[1] == ... | Add screen rotation script for surface | Add screen rotation script for surface
| Python | apache-2.0 | NickTGraham/PythonPack,NickTGraham/PythonPack | ---
+++
@@ -0,0 +1,37 @@
+import sys
+import os
+import subprocess
+import re
+
+status = subprocess.check_output(["xrandr", "-q"])
+print (status)
+
+lines = status.split("\n")
+print (lines)
+stat = ""
+for line in lines:
+ if "eDP-1" in line:
+ stat = line
+
+orientation = stat.split(" ")[4]
+
+if len(sy... | |
cfe18ca2fb113379af33f7172c8bb67787c82a1d | test_valid_object_file.py | test_valid_object_file.py | from astropy.table import Table
TABLE_NAME = 'feder_object_list.csv'
def test_table_can_be_read():
objs = Table.read(TABLE_NAME, format='ascii', delimiter=',')
columns = ['object', 'ra', 'dec']
for col in columns:
assert col in objs.colnames
| Add simple test that table is readable | Add simple test that table is readable
| Python | bsd-2-clause | mwcraig/feder-object-list | ---
+++
@@ -0,0 +1,10 @@
+from astropy.table import Table
+
+TABLE_NAME = 'feder_object_list.csv'
+
+
+def test_table_can_be_read():
+ objs = Table.read(TABLE_NAME, format='ascii', delimiter=',')
+ columns = ['object', 'ra', 'dec']
+ for col in columns:
+ assert col in objs.colnames | |
1b42dc4d49ccbef9b2ed4bd31e8bb32b597a3575 | oscar/agent/scripted/minigame/nicolas_mineralshard.py | oscar/agent/scripted/minigame/nicolas_mineralshard.py | import numpy
from pysc2.agents import base_agent
from pysc2.lib import actions
from pysc2.lib import features
_PLAYER_RELATIVE = features.SCREEN_FEATURES.player_relative.index
_PLAYER_FRIENDLY = 1
_PLAYER_NEUTRAL = 3 # beacon/minerals
_PLAYER_HOSTILE = 4
_NO_OP = actions.FUNCTIONS.no_op.id
_MOVE_SCREEN = actions.FUN... | Create a new scripted agent: copy from the deepmind one but do not select the two marins, only one | Create a new scripted agent: copy from the deepmind one but do not select the two marins, only one
| Python | apache-2.0 | Xaxetrov/OSCAR,Xaxetrov/OSCAR | ---
+++
@@ -0,0 +1,41 @@
+import numpy
+
+from pysc2.agents import base_agent
+from pysc2.lib import actions
+from pysc2.lib import features
+
+_PLAYER_RELATIVE = features.SCREEN_FEATURES.player_relative.index
+_PLAYER_FRIENDLY = 1
+_PLAYER_NEUTRAL = 3 # beacon/minerals
+_PLAYER_HOSTILE = 4
+_NO_OP = actions.FUNCTIO... | |
89d6ce60906bf619bea8cb5c8d0d51c9269fc781 | tools/stats/box_recall.py | tools/stats/box_recall.py | #!/usr/bin/env python
from vdetlib.utils.protocol import proto_load, proto_dump, track_box_at_frame, boxes_at_frame
from vdetlib.utils.common import iou
import argparse
import numpy as np
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('vid_file')
parser.add_argument('ann... | Add script to calculate box proto recall. | Add script to calculate box proto recall.
| Python | mit | myfavouritekk/TPN | ---
+++
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+
+from vdetlib.utils.protocol import proto_load, proto_dump, track_box_at_frame, boxes_at_frame
+from vdetlib.utils.common import iou
+import argparse
+import numpy as np
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument('vi... | |
46a0acede9dbbb1e751f5197a22be545e291d042 | src/ggrc/migrations/versions/20170219221807_4e7fda17abc7_fix_assessment_contexts.py | src/ggrc/migrations/versions/20170219221807_4e7fda17abc7_fix_assessment_contexts.py | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Fix Assessment contexts
Create Date: 2017-02-19 22:18:07.518997
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name
from alembic import op... | Fix missing contexts for assessment evidence | Fix missing contexts for assessment evidence
| Python | apache-2.0 | AleksNeStu/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core | ---
+++
@@ -0,0 +1,69 @@
+# Copyright (C) 2017 Google Inc.
+# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
+
+"""
+Fix Assessment contexts
+
+Create Date: 2017-02-19 22:18:07.518997
+"""
+# disable Invalid constant name pylint warning for mandatory Alembic variables.
+# pylint: disable... | |
fcddd7145bf7ab33cf90f8d4d39cfc9bb927e26d | ws-tests/test_invalid_merge.py | ws-tests/test_invalid_merge.py | #!/usr/bin/env python
from opentreetesting import test_http_json_method, config
import sys
DOMAIN = config('host', 'apihost')
SUBMIT_URI = DOMAIN + '/merge/v1/master/master'
data = {
'auth_token': 'bogus'
}
if test_http_json_method(SUBMIT_URI,
'PUT',
data=dat... | Add a test for an invalid merge | Add a test for an invalid merge
| Python | bsd-2-clause | leto/new_opentree_api,leto/new_opentree_api | ---
+++
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+from opentreetesting import test_http_json_method, config
+import sys
+
+DOMAIN = config('host', 'apihost')
+SUBMIT_URI = DOMAIN + '/merge/v1/master/master'
+
+data = {
+ 'auth_token': 'bogus'
+}
+if test_http_json_method(SUBMIT_URI,
+ '... | |
e17e436b7671b3c6834d286c91f541ee768fadac | script/gen-iana-rclasses.py | script/gen-iana-rclasses.py | import enumgen
from pprint import pprint
import os
import os.path
data = enumgen.fetch_csv(
"http://www.iana.org/assignments/dns-parameters/dns-parameters-2.csv")
data_dict = []
for row in data:
if '-' in row[0]: continue
if ' ' in row[2]:
row[2] = row[2].split(' ')[-1].strip('()')
if row[2] in [i['name'] for i... | Add RRClass generation script to git | Add RRClass generation script to git
| Python | bsd-2-clause | oko/rust-dns | ---
+++
@@ -0,0 +1,29 @@
+import enumgen
+from pprint import pprint
+import os
+import os.path
+
+data = enumgen.fetch_csv(
+ "http://www.iana.org/assignments/dns-parameters/dns-parameters-2.csv")
+
+data_dict = []
+for row in data:
+ if '-' in row[0]: continue
+ if ' ' in row[2]:
+ row[2] = row[2].split(' ')[-1].st... | |
919f8bb14ae91e37e42ff08192df24b60135596f | python_programming/what_is_my_name.py | python_programming/what_is_my_name.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
###############################################################################
# Author: Quincey Sun
# Mail: zeroonegit@gmail.com
# Created Time: 2016-06-21 23:25:24
###############################################################################
name = 'roger'
x = 0
wh... | Write a program that has a user guess your name, but they only get 3 chances to do so until the program quits. | Write a program that has a user guess your name, but they only get 3 chances to do so until the program quits.
| Python | mit | zeroonegit/python,QuinceySun/Python,QuinceySun/Python,zeroonegit/python | ---
+++
@@ -0,0 +1,22 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+###############################################################################
+# Author: Quincey Sun
+# Mail: zeroonegit@gmail.com
+# Created Time: 2016-06-21 23:25:24
+########################################################################... | |
5ef92912ca5d4a3bd3469aae7cfd5f4eca1055f7 | cibopath/templates.py | cibopath/templates.py | # -*- coding: utf-8 -*-
import json
import logging
import pathlib
GITHUB_URL = 'https://github.com/{user}/{repo}'
TEMPLATE_DIR = pathlib.Path.home() / '.cibopath'
TEMPLATE_DIR.mkdir(exist_ok=True)
JSON_STORE = TEMPLATE_DIR / 'templates.json'
logger = logging.getLogger('cibopath')
class Template:
def __init__... | Create Template class and implement json handler | Create Template class and implement json handler
| Python | bsd-3-clause | hackebrot/cibopath | ---
+++
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+
+import json
+import logging
+import pathlib
+
+GITHUB_URL = 'https://github.com/{user}/{repo}'
+
+TEMPLATE_DIR = pathlib.Path.home() / '.cibopath'
+TEMPLATE_DIR.mkdir(exist_ok=True)
+
+JSON_STORE = TEMPLATE_DIR / 'templates.json'
+
+logger = logging.getLogger('cibo... | |
d9302fab69d16f556adf27248c0fa7f7d12dc2ec | python/opencv/opencv_2/videos/play_video_from_file.py | python/opencv/opencv_2/videos/play_video_from_file.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
"""
OpenCV - Play video: play videos from files
Required: opencv library (Debian: aptitude install python-opencv)
See: https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_video_display... | Add a snippet (Python OpenCV). | Add a snippet (Python OpenCV).
| Python | mit | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | ---
+++
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
+
+"""
+OpenCV - Play video: play videos from files
+
+Required: opencv library (Debian: aptitude install python-opencv)
+
+See: https://opencv-python-tutroals.readthedocs.org/en/lates... | |
a5c723b589699fdf80c42a4186c2fdc0c8d84bb4 | tests/sentry/app/tests.py | tests/sentry/app/tests.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import mock
from sentry import app
from sentry.testutils import TestCase
class AppTest(TestCase):
def test_buffer_is_a_buffer(self):
from sentry.buffer.base import Buffer
self.assertEquals(type(app.buffer), Buffer)
class GetBuffer... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from sentry import app
from sentry.testutils import TestCase
class AppTest(TestCase):
def test_buffer_is_a_buffer(self):
from sentry.buffer.base import Buffer
self.assertEquals(type(app.buffer), Buffer)
| Remove test that is probably more trouble than it's worth. | Remove test that is probably more trouble than it's worth.
| Python | bsd-3-clause | JackDanger/sentry,mvaled/sentry,BuildingLink/sentry,alexm92/sentry,alexm92/sentry,mvaled/sentry,gencer/sentry,JamesMura/sentry,ifduyue/sentry,zenefits/sentry,jean/sentry,fotinakis/sentry,gencer/sentry,zenefits/sentry,gencer/sentry,JamesMura/sentry,zenefits/sentry,mvaled/sentry,mvaled/sentry,BuildingLink/sentry,gencer/s... | ---
+++
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
-
-import mock
from sentry import app
from sentry.testutils import TestCase
@@ -12,17 +10,3 @@
def test_buffer_is_a_buffer(self):
from sentry.buffer.base import Buffer
self.assertEquals(type(app.buffe... |
eef6bac6cf333b1df874381b6140c5737d5f8c57 | pycon/dev-settings.py | pycon/dev-settings.py | from pycon.settings import *
DEFAULT_URL_PREFIX='http://localhost:8000'
DEBUG=True
PAYPAL_TEST = True
TEMPLATES[0]['OPTIONS']['debug'] = True | Add a basic dev config | Add a basic dev config
| Python | bsd-2-clause | artcz/epcon,EuroPython/epcon,artcz/epcon,artcz/epcon,artcz/epcon,artcz/epcon,artcz/epcon,EuroPython/epcon,EuroPython/epcon,EuroPython/epcon | ---
+++
@@ -0,0 +1,8 @@
+from pycon.settings import *
+
+DEFAULT_URL_PREFIX='http://localhost:8000'
+DEBUG=True
+
+PAYPAL_TEST = True
+
+TEMPLATES[0]['OPTIONS']['debug'] = True | |
6fc5e78136285370d7606f31816b0fdf3a58606e | print_bot_id.py | print_bot_id.py | import os
from slackclient import SlackClient
# Update with your bot's name
BOT_NAME = 'watsonbot'
slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN'))
if __name__ == "__main__":
api_call = slack_client.api_call("users.list")
if api_call.get('ok'):
# retrieve all users so we can find our bo... | Add script to print bot id | Add script to print bot id
| Python | apache-2.0 | kostickm/watsonbot | ---
+++
@@ -0,0 +1,19 @@
+import os
+from slackclient import SlackClient
+
+# Update with your bot's name
+BOT_NAME = 'watsonbot'
+
+slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN'))
+
+
+if __name__ == "__main__":
+ api_call = slack_client.api_call("users.list")
+ if api_call.get('ok'):
+ # ... | |
44de127d69cd00dfc636e2f8f2cdf42f0e85b7d4 | remoting/PRESUBMIT.py | remoting/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 for remoting.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built... | Print out a note, during change upload, on running Remoting browser-tests before commiting changes under $src/remoting. | Print out a note, during change upload, on running Remoting browser-tests before commiting changes under $src/remoting.
BUG=
Review URL: https://codereview.chromium.org/1166123004
Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#333390}
| Python | bsd-3-clause | axinging/chromium-crosswalk,chuan9/chromium-crosswalk,hgl888/chromium-crosswalk,Pluto-tv/chromium-crosswalk,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Chilledheart/chromium,hgl888/chromium-crosswalk,chuan9/chromium-crosswalk,hgl888/chromium-cross... | ---
+++
@@ -0,0 +1,26 @@
+# 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 for remoting.
+
+See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
+for more de... | |
89f6654f921d2a373a3cbb0f521f2dbbb31f3de8 | research/test_diff.py | research/test_diff.py |
# use time() instead on unix
import sys
if sys.platform=='win32':
from time import clock
else:
from time import time as clock
from sympycore import profile_expr
def time1(n=5):
from sympycore import Symbol, sin
x,y,z = map(Symbol,'xyz')
f = (x / (1+sin(x**(y+x**2)))**2)
t1 = clock()
while... | Add diff bench test script. | Add diff bench test script. | Python | bsd-3-clause | pearu/sympycore,pearu/sympycore | ---
+++
@@ -0,0 +1,55 @@
+
+# use time() instead on unix
+import sys
+if sys.platform=='win32':
+ from time import clock
+else:
+ from time import time as clock
+
+from sympycore import profile_expr
+
+def time1(n=5):
+ from sympycore import Symbol, sin
+ x,y,z = map(Symbol,'xyz')
+ f = (x / (1+sin(x**... | |
7794500c352b0a2f536bbac7be07837d8fa0efef | tests/test_Projection.py | tests/test_Projection.py | import unittest
import numpy
import dadi
class ProjectionTestCase(unittest.TestCase):
def test_project_up(self):
"""
Saving spectrum to file.
"""
fixed_params = [0.1,None,None]
params_up = dadi.Inference._project_params_up([0.2,0.3], fixed_params)
self.assertTrue(num... | Add test for projecting parameters upward. | Add test for projecting parameters upward.
git-svn-id: 4c7b13231a96299fde701bb5dec4bd2aaf383fc6@489 979d6bd5-6d4d-0410-bece-f567c23bd345
| Python | bsd-3-clause | RyanGutenkunst/dadi,niuhuifei/dadi,beni55/dadi,beni55/dadi,yangjl/dadi,cheese1213/dadi,ChenHsiang/dadi,cheese1213/dadi,paulirish/dadi,niuhuifei/dadi,paulirish/dadi,ChenHsiang/dadi,yangjl/dadi,RyanGutenkunst/dadi | ---
+++
@@ -0,0 +1,23 @@
+import unittest
+import numpy
+import dadi
+
+class ProjectionTestCase(unittest.TestCase):
+ def test_project_up(self):
+ """
+ Saving spectrum to file.
+ """
+ fixed_params = [0.1,None,None]
+ params_up = dadi.Inference._project_params_up([0.2,0.3], fix... | |
c95d352e16a7638d037a831fcc55a9145f6c9162 | tests/test_twr_search.py | tests/test_twr_search.py | #!/usr/bin/env python
#
# Copyright (c) 2013 Martin Abente Lahaye. - tch@sugarlabs.org
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the righ... | Add TwrSearch class basic test | Add TwrSearch class basic test
| Python | lgpl-2.1 | tchx84/twitter-gobject | ---
+++
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2013 Martin Abente Lahaye. - tch@sugarlabs.org
+
+#Permission is hereby granted, free of charge, to any person obtaining a copy
+#of this software and associated documentation files (the "Software"), to deal
+#in the Software without restriction, inc... | |
934a7d166eb74fcd2ee3eaef79b63fabd61dc45c | buildscripts/run_benchmarks.py | buildscripts/run_benchmarks.py | # *****************************************************************************
# Copyright (c) 2020, Intel Corporation All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of sou... | Add simple script for benchmark execution | Add simple script for benchmark execution
| Python | bsd-2-clause | IntelLabs/hpat,IntelLabs/hpat,IntelLabs/hpat,IntelLabs/hpat | ---
+++
@@ -0,0 +1,62 @@
+# *****************************************************************************
+# Copyright (c) 2020, Intel Corporation All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met... | |
c0ba8348f614f2ef6c14db9335ba3d1a6f3d29af | p3/management/commands/create_bulk_coupons.py | p3/management/commands/create_bulk_coupons.py |
""" Create a batch of single use discount coupons from a CSV file.
Parameters: <conference> <csv-file>
Creates coupons based on the CSV file contents:
code - coupon code
max_usage - max. number of uses
items_per_usage - max number of items per use
value - value of the coupon in percent
de... | Add new coupon script to generate coupons using a CSV file. | Add new coupon script to generate coupons using a CSV file.
| Python | bsd-2-clause | EuroPython/epcon,EuroPython/epcon,EuroPython/epcon,EuroPython/epcon | ---
+++
@@ -0,0 +1,92 @@
+
+""" Create a batch of single use discount coupons from a CSV file.
+
+ Parameters: <conference> <csv-file>
+
+ Creates coupons based on the CSV file contents:
+
+ code - coupon code
+ max_usage - max. number of uses
+ items_per_usage - max number of items per use
+ value... | |
d4840c794f9d9de252028a7899d470753615d3d5 | eve_neo4j/structures.py | eve_neo4j/structures.py | # -*- coding: utf-8 -*-
from eve_neo4j.utils import node_to_dict, count_selection
class Neo4jResultCollection(object):
"""
Collection of results. The object holds onto a py2neo-NodeSelection
object and serves a generator off it.
:param selection: NodeSelection object for the requested resource.
"... | Create Node holder for Eve. | Create Node holder for Eve.
| Python | mit | Grupo-Abraxas/eve-neo4j,Abraxas-Biosystems/eve-neo4j | ---
+++
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+from eve_neo4j.utils import node_to_dict, count_selection
+
+
+class Neo4jResultCollection(object):
+ """
+ Collection of results. The object holds onto a py2neo-NodeSelection
+ object and serves a generator off it.
+
+ :param selection: NodeSelection obj... | |
d9bcab7e07ef4d9c44e0dfa0bcf49510b954ae71 | examples/test_mirror.py | examples/test_mirror.py | import pypiv
import numpy as np
import matplotlib.pyplot as plt
from glob import glob
def main():
imgs = ['images/finger1.png', 'images/finger2.png']
frames = [plt.imread(x) for x in imgs]
frame_a, frame_b = frames[0], frames[1]
frame_a_inv = np.copy(frame_a[::-1,::-1])
frame_b_inv = np.copy(frame... | Add example for inverted image comparison. | Add example for inverted image comparison.
An additional example which tests if
a rotation of the testimages along both axis still
yields the same results after a PIV evaluation.
Please note that this works, except for the outlier detection
which is probably due to an asymmetry in the
CloughTocherInterpolator function... | Python | bsd-3-clause | jr7/pypiv | ---
+++
@@ -0,0 +1,63 @@
+import pypiv
+import numpy as np
+import matplotlib.pyplot as plt
+from glob import glob
+
+def main():
+ imgs = ['images/finger1.png', 'images/finger2.png']
+ frames = [plt.imread(x) for x in imgs]
+ frame_a, frame_b = frames[0], frames[1]
+
+ frame_a_inv = np.copy(frame_a[::-1,... | |
f8b2760d1bd218a7be5abfdb489f6afe53d85277 | tools/setup_server_binding.py | tools/setup_server_binding.py | # Useful to launch an interactive debugging session in ipython with %ed or %run
from nxdrive.controller import Controller
from nxdrive.model import ServerBinding
c = Controller('~/.nuxeo-drive')
s = c.get_session()
sb = s.query(ServerBinding).one()
| Add useful python script to launch an interactive debugging session in ipython | Add useful python script to launch an interactive debugging session in ipython
| Python | lgpl-2.1 | arameshkumar/nuxeo-drive,IsaacYangSLA/nuxeo-drive,IsaacYangSLA/nuxeo-drive,rsoumyassdi/nuxeo-drive,rsoumyassdi/nuxeo-drive,loopingz/nuxeo-drive,loopingz/nuxeo-drive,loopingz/nuxeo-drive,loopingz/nuxeo-drive,rsoumyassdi/nuxeo-drive,rsoumyassdi/nuxeo-drive,IsaacYangSLA/nuxeo-drive,DirkHoffmann/nuxeo-drive,ssdi-drive/nuxe... | ---
+++
@@ -0,0 +1,8 @@
+# Useful to launch an interactive debugging session in ipython with %ed or %run
+from nxdrive.controller import Controller
+from nxdrive.model import ServerBinding
+c = Controller('~/.nuxeo-drive')
+s = c.get_session()
+sb = s.query(ServerBinding).one()
+
+ | |
1ff3735aec0473009c82444d024804fd1579a98f | solutions/p7.py | solutions/p7.py | # 10001st prime
# Find the 10001st prime number
#
import math
def generate_primes(n):
p = 2
primes = [p]
p += 1
primes.append(p)
while len(primes) != n:
p += 2
test_prime = True
# Limit should only be up to the square root of current p, because nothing will exceed that.
sqrt_limit = math.sqrt(p)
fo... | Add Solution to Problem 7. | Add Solution to Problem 7.
| Python | unlicense | iheanyi/ProjectEuler | ---
+++
@@ -0,0 +1,33 @@
+# 10001st prime
+# Find the 10001st prime number
+#
+import math
+def generate_primes(n):
+ p = 2
+ primes = [p]
+ p += 1
+ primes.append(p)
+
+ while len(primes) != n:
+
+ p += 2
+
+ test_prime = True
+
+
+ # Limit should only be up to the square root of current p, because nothing will ... | |
a3352bb43c0c9b696e09fbb3dfed2c70e9bb5f12 | replace_imports.py | replace_imports.py | from __future__ import with_statement
import os
file_contents = {}
file_imports = {}
def get_file(file_name):
if file_name[-2:] != '.v': file_name += '.v'
if file_name not in file_contents.keys():
print(file_name)
try:
with open(file_name, 'r', encoding='UTF-8') as f:
... | Add a python script for combining imports | Add a python script for combining imports
| Python | mit | JasonGross/coq-tools,JasonGross/coq-tools | ---
+++
@@ -0,0 +1,65 @@
+from __future__ import with_statement
+import os
+
+file_contents = {}
+file_imports = {}
+
+def get_file(file_name):
+ if file_name[-2:] != '.v': file_name += '.v'
+ if file_name not in file_contents.keys():
+ print(file_name)
+ try:
+ with open(file_name, 'r'... | |
3ea10a12026341f692e0bb6abfebdb1b96aa41b2 | examples/list-public-addresses.py | examples/list-public-addresses.py | import openshift3.endpoints as endpoints
import openshift3.resources as resources
client = endpoints.Client()
projects = client.oapi.v1.projects.get()
#print(projects)
#print(resources.dumps(projects, indent=4, sort_keys=True))
#print()
def public_address(route):
host = route.spec.host
path = route.spec.pat... | Add example of listing exposed URLs for services. | Add example of listing exposed URLs for services.
| Python | bsd-2-clause | getwarped/powershift | ---
+++
@@ -0,0 +1,30 @@
+import openshift3.endpoints as endpoints
+import openshift3.resources as resources
+
+client = endpoints.Client()
+
+projects = client.oapi.v1.projects.get()
+
+#print(projects)
+#print(resources.dumps(projects, indent=4, sort_keys=True))
+#print()
+
+def public_address(route):
+ host = r... | |
600432490f78e1ed74ea334a5a46a30edd384a11 | process_test.py | process_test.py | import argparse, time
from pycompss.api.task import task
from pycompss.api.parameter import *
#class process_test:
#
# def __init__(self):
# self.ready = True
@task(x = IN)
def main(x):
print time.time(), x
y = range(1)
#pt = process_test()
map(main, y)
| Test process for running on COMPSs | Test process for running on COMPSs
| Python | apache-2.0 | Multiscale-Genomics/mg-process-fastq,Multiscale-Genomics/mg-process-fastq,Multiscale-Genomics/mg-process-fastq | ---
+++
@@ -0,0 +1,17 @@
+import argparse, time
+from pycompss.api.task import task
+from pycompss.api.parameter import *
+
+#class process_test:
+#
+# def __init__(self):
+# self.ready = True
+
+@task(x = IN)
+def main(x):
+ print time.time(), x
+
+y = range(1)
+
+#pt = process_test()
+map(main,... | |
af566e0cd0958dadd0de55d51b50ad026a8f2b99 | build_android_prepare.py | build_android_prepare.py | """Configuration for the Caffe2 installation.
"""
from build import Config
import sys
Config.USE_SYSTEM_PROTOBUF = False
Config.PROTOC_BINARY = 'gen/third_party/google/protoc'
Config.USE_OPENMP = False
if __name__ == '__main__':
from brewtool.brewery import Brewery
Brewery.Run(
Config,
['buil... | Add a simple script to help build android. | Add a simple script to help build android.
| Python | apache-2.0 | davinwang/caffe2,sf-wind/caffe2,davinwang/caffe2,bwasti/caffe2,pietern/caffe2,xzturn/caffe2,davinwang/caffe2,sf-wind/caffe2,bwasti/caffe2,davinwang/caffe2,bwasti/caffe2,bwasti/caffe2,sf-wind/caffe2,caffe2/caffe2,pietern/caffe2,pietern/caffe2,Yangqing/caffe2,xzturn/caffe2,Yangqing/caffe2,davinwang/caffe2,Yangqing/caffe2... | ---
+++
@@ -0,0 +1,19 @@
+"""Configuration for the Caffe2 installation.
+"""
+
+from build import Config
+import sys
+
+Config.USE_SYSTEM_PROTOBUF = False
+Config.PROTOC_BINARY = 'gen/third_party/google/protoc'
+Config.USE_OPENMP = False
+
+if __name__ == '__main__':
+ from brewtool.brewery import Brewery
+ Bre... | |
153fe45973f2299f14d6c444f93a34ca82ea7aa4 | tensorflow/examples/speech_commands/conv_only.py | tensorflow/examples/speech_commands/conv_only.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Add conv to tflite script for conv_actions. | Add conv to tflite script for conv_actions.
| Python | apache-2.0 | aselle/tensorflow,aselle/tensorflow,aselle/tensorflow,aselle/tensorflow,aselle/tensorflow,aselle/tensorflow,aselle/tensorflow,aselle/tensorflow,aselle/tensorflow,aselle/tensorflow,aselle/tensorflow | ---
+++
@@ -0,0 +1,59 @@
+# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-... | |
86241da03ecab6b540944004b8bcbb4f3c577bdc | numba/cuda/tests/cudapy/test_dispatcher.py | numba/cuda/tests/cudapy/test_dispatcher.py | from numba import cuda, float32, int32
from numba.cuda.testing import skip_on_cudasim, unittest, CUDATestCase
@skip_on_cudasim('Dispatcher objects not used in the simulator')
class TestDispatcher(CUDATestCase):
def _test_no_double_specialize(self, dispatcher):
with self.assertRaises(RuntimeError) as e:
... | Add Dispatcher specialization cache tests | CUDA: Add Dispatcher specialization cache tests
| Python | bsd-2-clause | stonebig/numba,stuartarchibald/numba,seibert/numba,seibert/numba,IntelLabs/numba,sklam/numba,gmarkall/numba,gmarkall/numba,cpcloud/numba,sklam/numba,stonebig/numba,numba/numba,IntelLabs/numba,gmarkall/numba,stuartarchibald/numba,numba/numba,seibert/numba,seibert/numba,stuartarchibald/numba,stonebig/numba,gmarkall/numba... | ---
+++
@@ -0,0 +1,54 @@
+from numba import cuda, float32, int32
+from numba.cuda.testing import skip_on_cudasim, unittest, CUDATestCase
+
+
+@skip_on_cudasim('Dispatcher objects not used in the simulator')
+class TestDispatcher(CUDATestCase):
+ def _test_no_double_specialize(self, dispatcher):
+
+ with sel... | |
277ec688d7f92c415446e700db42386620d9b418 | satnogsclient/settings.py | satnogsclient/settings.py | from os import environ
DEMODULATION_COMMAND = environ.get('DEMODULATION_COMMAND', None)
ENCODING_COMMAND = environ.get('ENCODING_COMMAND', None)
DECODING_COMMAND = environ.get('DECODING_COMMAND', None)
| Add configuration file for client | Add configuration file for client
| Python | agpl-3.0 | adamkalis/satnogs-client,cshields/satnogs-client,adamkalis/satnogs-client,cshields/satnogs-client | ---
+++
@@ -0,0 +1,5 @@
+from os import environ
+
+DEMODULATION_COMMAND = environ.get('DEMODULATION_COMMAND', None)
+ENCODING_COMMAND = environ.get('ENCODING_COMMAND', None)
+DECODING_COMMAND = environ.get('DECODING_COMMAND', None) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.