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
d0786d711e7fa49afff973d27e0689c3e42ed575
ospan/csv_to_sesame.py
ospan/csv_to_sesame.py
import argparse from collections import namedtuple import csv from itertools import groupby class Loop(object): def __init__(self, name, repeat=1, cycles=None, description="A Loop", item="sequence", order="random", variable_rows=None): self.name = name self.repeat = 1 self...
Add script to turn a CSV file into OpenSesame style Loops
Add script to turn a CSV file into OpenSesame style Loops
Python
mit
sbuss/operation-span-test
--- +++ @@ -0,0 +1,77 @@ +import argparse +from collections import namedtuple +import csv +from itertools import groupby + + +class Loop(object): + def __init__(self, name, repeat=1, cycles=None, description="A Loop", + item="sequence", order="random", variable_rows=None): + self.name = name...
2adcb39fa52e4be6dd800a56747f29ed6d76d9be
corpus_curl_opt_http_auth.py
corpus_curl_opt_http_auth.py
#!/usr/bin/env python # Allow using strings to represent CURLOPT_HTTPAUTH values when # generating corpus files. The original defines live in curl.h. from enum import Enum class CurlOptHttpAuth(Enum): #define CURLAUTH_NONE ((unsigned long)0) CURLAUTH_NONE = 0 #define CURLAUTH_BASIC (((unsig...
Add enum for HTTP auth strings
corpus: Add enum for HTTP auth strings Taken from curl/curl.h and converted to Python, for convenience when writing corpus seed cases.
Python
mit
curl/curl-fuzzer,curl/curl-fuzzer,curl/curl-fuzzer,curl/curl-fuzzer
--- +++ @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# Allow using strings to represent CURLOPT_HTTPAUTH values when +# generating corpus files. The original defines live in curl.h. + +from enum import Enum + +class CurlOptHttpAuth(Enum): + #define CURLAUTH_NONE ((unsigned long)0) + CURLAUTH_NONE = 0 + #...
696c1016284a4930f9df5379a5e01abce21df72c
InvenTree/company/migrations/0020_auto_20200413_0839.py
InvenTree/company/migrations/0020_auto_20200413_0839.py
# Generated by Django 2.2.10 on 2020-04-13 08:39 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('company', '0019_auto_20200413_0642'), ] operations = [ migrations.AlterField( model_name='supp...
Change related name for SuppleirPart.supplier
Change related name for SuppleirPart.supplier (cherry picked from commit 635c4339e06db392f373f46539df38c914683d5a)
Python
mit
inventree/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree
--- +++ @@ -0,0 +1,19 @@ +# Generated by Django 2.2.10 on 2020-04-13 08:39 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('company', '0019_auto_20200413_0642'), + ] + + operations = [ + migrations...
010376704d66e3fadffe50709d479d31a2e8eb14
tool/collect-macaddr4ilo.py
tool/collect-macaddr4ilo.py
#!/usr/bin/python import pexpect import re import sys from optparse import OptionParser macs=[] err=0 op=OptionParser("fancheck [options] ip") op.add_option("-l","--log",action="store_true",dest="log",default=False,help="whole logs to stdout") op.add_option("-u","--user",action="store",dest="user",type="string",defa...
Add collection mac tool for ilo
[Add] Add collection mac tool for ilo
Python
mit
konono/equlipse,konono/equlipse
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/python + +import pexpect +import re +import sys +from optparse import OptionParser + +macs=[] +err=0 + +op=OptionParser("fancheck [options] ip") +op.add_option("-l","--log",action="store_true",dest="log",default=False,help="whole logs to stdout") +op.add_option("-u","--user",actio...
d3bafe885920e7b1d21e6d97456b39c471ed48d0
api/webview/tests.py
api/webview/tests.py
import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.api.settings") import pytest import django from django.test import TestCase from rest_framework.test import APIRequestFactory from api.webview.views import DocumentList django.setup() # TODO - make this work without Django. class APIViewTests(TestCase...
Move api test back to django
Move api test back to django
Python
apache-2.0
CenterForOpenScience/scrapi,mehanig/scrapi,erinspace/scrapi,fabianvf/scrapi,felliott/scrapi,mehanig/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,felliott/scrapi
--- +++ @@ -0,0 +1,29 @@ +import os +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.api.settings") + +import pytest +import django +from django.test import TestCase +from rest_framework.test import APIRequestFactory + +from api.webview.views import DocumentList + +django.setup() + + +# TODO - make this work wit...
dd6287903ccddf24edf600e3d30fba61efd9478f
distarray/core/tests/test_distributed_array_protocol.py
distarray/core/tests/test_distributed_array_protocol.py
import unittest import distarray as da from distarray.mpi.mpibase import create_comm_of_size, InvalidCommSizeError class TestDistributedArrayProtocol(unittest.TestCase): def setUp(self): try: comm = create_comm_of_size(4) except InvalidCommSizeError: raise unittest.SkipTes...
import unittest import distarray as da from distarray.mpi.mpibase import create_comm_of_size, InvalidCommSizeError class TestDistributedArrayProtocol(unittest.TestCase): def setUp(self): try: comm = create_comm_of_size(4) except InvalidCommSizeError: raise unittest.SkipTes...
Modify round-trip test to use new function name.
Modify round-trip test to use new function name. We've temporarily settled on `fromdap()` for importing from `__distarray__` interfaces.
Python
bsd-3-clause
RaoUmer/distarray,enthought/distarray,RaoUmer/distarray,enthought/distarray
--- +++ @@ -29,9 +29,10 @@ export_data = self.larr.__distarray__() memoryview(export_data['buffer']) + @unittest.skip("Import not yet implemented.") def test_round_trip(self): - new_larr = da.localarray(self.larr) - self.assertEqual(new_larr.local_array, self.larr.local_array...
35f9f8ad0aa3b7474aeeb4094ff13b8312b9d326
experiments/reproduce-srcnn/9-1-5/run.py
experiments/reproduce-srcnn/9-1-5/run.py
from toolbox.datasets.sr import load_data from toolbox.models import srcnn from toolbox.training import train (x_train, y_train), (x_test, y_test) = load_data() model = srcnn(x_train.shape[1:], f1=9, f2=1, f3=5) train(model, x_train, y_train, validation_data=(x_test, y_test), nb_epoch=2, resume=True, save_dir='...
Add a simple experiment script
Add a simple experiment script
Python
mit
qobilidop/srcnn,qobilidop/srcnn
--- +++ @@ -0,0 +1,9 @@ +from toolbox.datasets.sr import load_data +from toolbox.models import srcnn +from toolbox.training import train + + +(x_train, y_train), (x_test, y_test) = load_data() +model = srcnn(x_train.shape[1:], f1=9, f2=1, f3=5) +train(model, x_train, y_train, validation_data=(x_test, y_test), + ...
e60d0fd405a93f517fd7478b862dfae5bfb87d4f
demos/mapbox.py
demos/mapbox.py
#!/usr/bin/env python # To run this example, you need to set the GI_TYPELIB_PATH environment # variable to point to the gir directory: # # export GI_TYPELIB_PATH=$GI_TYPELIB_PATH:/usr/local/lib/girepository-1.0/ from gi.repository import GtkClutter from gi.repository import GObject, Gtk, Champlain, GtkChamplain ACCE...
Add python demo demonstrating custom tile source
Add python demo demonstrating custom tile source
Python
lgpl-2.1
GNOME/libchamplain,GNOME/libchamplain
--- +++ @@ -0,0 +1,72 @@ +#!/usr/bin/env python + +# To run this example, you need to set the GI_TYPELIB_PATH environment +# variable to point to the gir directory: +# +# export GI_TYPELIB_PATH=$GI_TYPELIB_PATH:/usr/local/lib/girepository-1.0/ + +from gi.repository import GtkClutter +from gi.repository import GObject...
8ba9f82373ef0995bd3a18d6bc0153a2f7e71bcb
setup.py
setup.py
#!/usr/bin/env python import sys import os from distutils.core import setup sys.path.insert(0, os.path.dirname(__file__)) from wutils import get_version, generate_version_py generate_version_py(force=False) setup(name='pybindgen', version=get_version(), description='Python Bindings Generator', autho...
#!/usr/bin/env python import sys import os from distutils.core import setup sys.path.insert(0, os.path.dirname(__file__)) from wutils import get_version, generate_version_py generate_version_py(force=False) setup(name='PyBindGen', version=get_version(), description='Python Bindings Generator', autho...
Revert back to PyBindGen as package name because it's what is already registered in PyPI.
Revert back to PyBindGen as package name because it's what is already registered in PyPI.
Python
lgpl-2.1
caramucho/pybindgen,caramucho/pybindgen,caramucho/pybindgen,cawka/pybindgen,cawka/pybindgen,cawka/pybindgen,cawka/pybindgen,caramucho/pybindgen
--- +++ @@ -7,7 +7,7 @@ from wutils import get_version, generate_version_py generate_version_py(force=False) -setup(name='pybindgen', +setup(name='PyBindGen', version=get_version(), description='Python Bindings Generator', author='Gustavo Carneiro',
e8339d89a3c69938ddd8ddb7c775edc56c8524ff
asyncpg/encodings.py
asyncpg/encodings.py
'''Map PostgreSQL encoding names to Python encoding names https://www.postgresql.org/docs/current/static/multibyte.html#CHARSET-TABLE ''' _map = { 'abc': 'cp1258', 'alt': 'cp866', 'euc_cn': 'euccn', 'euc_jp': 'eucjp', 'euc_kr': 'euckr', 'koi8r': 'koi8_r', 'koi8u': 'koi8_u', 'shift_jis...
Add a module to map Postgres encoding names to Python
Add a module to map Postgres encoding names to Python
Python
apache-2.0
MagicStack/asyncpg,MagicStack/asyncpg
--- +++ @@ -0,0 +1,57 @@ +'''Map PostgreSQL encoding names to Python encoding names + +https://www.postgresql.org/docs/current/static/multibyte.html#CHARSET-TABLE + +''' + +_map = { + 'abc': 'cp1258', + 'alt': 'cp866', + 'euc_cn': 'euccn', + 'euc_jp': 'eucjp', + 'euc_kr': 'euckr', + 'koi8r': 'koi8_r...
52409670ac2d8f6161cdf884465fa75454280d1a
examples/pi2.py
examples/pi2.py
#!/usr/bin/python from __future__ import division import random import sys import mrs class SamplePi(mrs.MapReduce): """A less numerically-intensive version of the pi calculator.""" def map(self, key, value): inside = 0 outside = 0 for _ in range(int(value)): x = random....
Add a pi example using random.random instead of the halton sequence
Add a pi example using random.random instead of the halton sequence
Python
apache-2.0
byu-aml-lab/mrs-mapreduce,kseppi/mrs-mapreduce
--- +++ @@ -0,0 +1,70 @@ +#!/usr/bin/python + +from __future__ import division + +import random +import sys +import mrs + +class SamplePi(mrs.MapReduce): + """A less numerically-intensive version of the pi calculator.""" + + def map(self, key, value): + inside = 0 + outside = 0 + + for _ in...
8f056d2f0138c3757f55c393a0b81c2959778190
apps/notifications/tests/test_templatetags.py
apps/notifications/tests/test_templatetags.py
""" Test suite for the template tags of the notifications app. """ from django.test import TestCase from django.template import (engines, TemplateSyntaxError) from django.contrib.auth import get_user_model from ..models import Notification class NotificationsViewsTestCase(TestCase): ...
Add tests suite for template tags of notifications app
Add tests suite for template tags of notifications app
Python
agpl-3.0
TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker
--- +++ @@ -0,0 +1,76 @@ +""" +Test suite for the template tags of the notifications app. +""" + +from django.test import TestCase +from django.template import (engines, + TemplateSyntaxError) +from django.contrib.auth import get_user_model + +from ..models import Notification + + +class N...
cff10711c9c613fad39e7a0eec5c37c3c17a7b94
zip2wd_mp/demographics2input.py
zip2wd_mp/demographics2input.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import csv import argparse def parse_command_line(): """Parse command line arguments """ parser = argparse.ArgumentParser(description="Demographics data to Inputs") parser.add_argument('input', type=str, help='Demographics CSV file') parser.add_argum...
Add a simple script to get unique zip codes from demographics file and save as zip2wd inputs.
Add a simple script to get unique zip codes from demographics file and save as zip2wd inputs.
Python
mit
soodoku/get-weather-data,soodoku/get-weather-data
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import csv +import argparse + + +def parse_command_line(): + """Parse command line arguments + """ + parser = argparse.ArgumentParser(description="Demographics data to Inputs") + + parser.add_argument('input', type=str, help='Demo...
46f61c87b8afe586cacc12a91d3f94c89253365f
functional/tests/compute/v2/test_security_group.py
functional/tests/compute/v2/test_security_group.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Add functional tests for security group CRUD
Add functional tests for security group CRUD Change-Id: Ib5bbd46c0454d7dbb541354d515430922569c994
Python
apache-2.0
dtroyer/python-openstackclient,openstack/python-openstackclient,redhat-openstack/python-openstackclient,BjoernT/python-openstackclient,redhat-openstack/python-openstackclient,dtroyer/python-openstackclient,BjoernT/python-openstackclient,openstack/python-openstackclient
--- +++ @@ -0,0 +1,57 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agr...
b46b8cd1a6f31947ccc3a58722147d5d4b7d97e7
test_slashes.py
test_slashes.py
import os import unittest import stack class TestSlashConvert(unittest.TestCase): def test_relative(self): # start with unix-style source = "test/sub \n dir/file.txt" # convert to OS-specific separators; this is a no-op on unix-like systems os_slash = os.path.normpath(source) ...
Add unit test for path conversion.
Add unit test for path conversion.
Python
mit
bbinet/pillarstack
--- +++ @@ -0,0 +1,21 @@ +import os +import unittest + +import stack + + +class TestSlashConvert(unittest.TestCase): + def test_relative(self): + # start with unix-style + source = "test/sub \n dir/file.txt" + + # convert to OS-specific separators; this is a no-op on unix-like systems + ...
8f7fe11bc02c7cadf6f531c064a560968dc2b003
readthedocs/core/management/commands/set_metadata.py
readthedocs/core/management/commands/set_metadata.py
import logging from optparse import make_option from django.core.management.base import BaseCommand from django.conf import settings from projects import tasks from projects.models import Project log = logging.getLogger(__name__) class Command(BaseCommand): def handle(self, *args, **options): queryset ...
Add command to generate metadata
Add command to generate metadata
Python
mit
kenshinthebattosai/readthedocs.org,clarkperkins/readthedocs.org,tddv/readthedocs.org,d0ugal/readthedocs.org,Tazer/readthedocs.org,kenwang76/readthedocs.org,emawind84/readthedocs.org,sils1297/readthedocs.org,fujita-shintaro/readthedocs.org,stevepiercy/readthedocs.org,espdev/readthedocs.org,emawind84/readthedocs.org,Luka...
--- +++ @@ -0,0 +1,21 @@ +import logging +from optparse import make_option + +from django.core.management.base import BaseCommand +from django.conf import settings + +from projects import tasks +from projects.models import Project + +log = logging.getLogger(__name__) + + +class Command(BaseCommand): + def handle(s...
b9dac640d1e715d33354029ebf46ad3387f22bfe
CodeFights/mergingVines.py
CodeFights/mergingVines.py
#!/usr/local/bin/python # Code Fights Merging Vines Problem from functools import reduce import math def compose(functions): return reduce(lambda f, g: lambda x: f(g(x)), functions, lambda x: x) def functionsComposition(functions, x): return compose(map(eval, functions))(x) def mergingVines(vines, n): ...
Set up Code Fights merging vines problem
Set up Code Fights merging vines problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,52 @@ +#!/usr/local/bin/python +# Code Fights Merging Vines Problem + +from functools import reduce +import math + + +def compose(functions): + return reduce(lambda f, g: lambda x: f(g(x)), functions, lambda x: x) + + +def functionsComposition(functions, x): + return compose(map(eval, functio...
52d45a55c61c229f9d99b3f437b76a363a34b481
i8c/tests/test_externals.py
i8c/tests/test_externals.py
from i8c.tests import TestCase SOURCE = """\ define test::externals_test returns int extern ptr a_symbol extern func int, int (ptr) a_function call return """ class TestExternals(TestCase): def test_externals(self): """Check that externals work.""" tree, output = self.compile(SOURC...
Add a basic check for externals
Add a basic check for externals
Python
lgpl-2.1
gbenson/i8c
--- +++ @@ -0,0 +1,15 @@ +from i8c.tests import TestCase + +SOURCE = """\ +define test::externals_test returns int + extern ptr a_symbol + extern func int, int (ptr) a_function + call + return +""" + +class TestExternals(TestCase): + def test_externals(self): + """Check that externals work.""" +...
281695fed73f9aa9eee0a1007388cc5ae4768bc8
examples/translations/spanish_test_1.py
examples/translations/spanish_test_1.py
# Spanish Language Test - Python 3 Only! from seleniumbase.translate.spanish import CasoDePrueba class MiClaseDePrueba(CasoDePrueba): def test_ejemplo_1(self): self.abrir_url("https://es.wikipedia.org/wiki/") self.verificar_texto("Wikipedia") self.verificar_elemento('[title="Visitar la pá...
Add an example test in Spanish
Add an example test in Spanish
Python
mit
mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase
--- +++ @@ -0,0 +1,22 @@ +# Spanish Language Test - Python 3 Only! +from seleniumbase.translate.spanish import CasoDePrueba + + +class MiClaseDePrueba(CasoDePrueba): + + def test_ejemplo_1(self): + self.abrir_url("https://es.wikipedia.org/wiki/") + self.verificar_texto("Wikipedia") + self.veri...
dcb63e9153091052f8bcb253885e2f124ca68f18
vtwt/block.py
vtwt/block.py
import sys from twisted.internet.defer import inlineCallbacks, gatherResults from twisted.plugin import IPlugin from twisted.python import usage from zope.interface import implements from jersey import log from vtwt import cli class BlockOptions(cli.Options): def parseArgs(self, *names): if not names: ...
Add a flag to print debuggy logging info vtwt/cli.py
Add a flag to print debuggy logging info vtwt/cli.py
Python
bsd-3-clause
olix0r/vtwt
--- +++ @@ -0,0 +1,44 @@ +import sys + +from twisted.internet.defer import inlineCallbacks, gatherResults +from twisted.plugin import IPlugin +from twisted.python import usage +from zope.interface import implements + +from jersey import log +from vtwt import cli + + +class BlockOptions(cli.Options): + + def parseA...
576dd4204bb546c1944723742d63687e91099e81
tests/app/test_metrics.py
tests/app/test_metrics.py
import re from tests.helpers import BaseApplicationTest def load_prometheus_metrics(response_bytes): return dict(re.findall(rb"(\w+{.+?}) (\d+)", response_bytes)) class TestMetrics(BaseApplicationTest): def test_metrics_page_accessible(self): metrics_response = self.client.get('/_metrics') ...
Add standard tests for metrics
Add standard tests for metrics
Python
mit
alphagov/digitalmarketplace-search-api,alphagov/digitalmarketplace-search-api
--- +++ @@ -0,0 +1,57 @@ +import re + +from tests.helpers import BaseApplicationTest + + +def load_prometheus_metrics(response_bytes): + return dict(re.findall(rb"(\w+{.+?}) (\d+)", response_bytes)) + + +class TestMetrics(BaseApplicationTest): + + def test_metrics_page_accessible(self): + metrics_respons...
97832925b88406434ba3e4e5c8f4b8870f303816
producerTrump.py
producerTrump.py
from pyspark import SparkConf, SparkContext from pyspark.streaming import StreamingContext from pyspark.streaming.kafka import KafkaUtils from kafka import SimpleProducer, KafkaClient from kafka import KafkaProducer from operator import add import sys import json from twitter import Twitter, OAuth, TwitterHTTPE...
Add new producer to test
Add new producer to test
Python
mit
andresher/bigdata-project2
--- +++ @@ -0,0 +1,47 @@ +from pyspark import SparkConf, SparkContext +from pyspark.streaming import StreamingContext +from pyspark.streaming.kafka import KafkaUtils +from kafka import SimpleProducer, KafkaClient +from kafka import KafkaProducer +from operator import add +import sys +import json +from twitter import ...
dbeca32771b5a3afc419aa3e9e6cf949e669b928
praatio/tgio.py
praatio/tgio.py
class WrongPraatioVersion(Exception): pass raise WrongPraatioVersion( "\n\nWARNING: You've tried to import 'tgio' which was renamed 'textgrid' in praatio 5.x.\n" "Many other, breaking changes were made.\n" "You will need to modify your code to use praatio 5.0.\n" "If you would like to use your cod...
Add upgrade warning for users expecting praatio 4.x
Add upgrade warning for users expecting praatio 4.x
Python
mit
timmahrt/praatIO
--- +++ @@ -0,0 +1,13 @@ +class WrongPraatioVersion(Exception): + pass + + +raise WrongPraatioVersion( + "\n\nWARNING: You've tried to import 'tgio' which was renamed 'textgrid' in praatio 5.x.\n" + "Many other, breaking changes were made.\n" + "You will need to modify your code to use praatio 5.0.\n" + ...
d88006087c7428295dafad5e27aab69c000cb278
pyedgar/form10.py
pyedgar/form10.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Utilities for interacting with edgar forms. """ # import os # import re import logging from . import localstore from . import forms # from . import plaintext # from .htmlparse import RE_HTML_TAGS, convert_html_to_text, html_ent_re_sub # from .. import exceptions as EX...
Add custom date and period to form 10
Add custom date and period to form 10
Python
mit
gaulinmp/pyedgar
--- +++ @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Utilities for interacting with edgar forms. +""" + +# import os +# import re +import logging + +from . import localstore +from . import forms +# from . import plaintext +# from .htmlparse import RE_HTML_TAGS, convert_html_to_text, html_ent...
9dc21af406efca98bd68bdb428c7f563790ed1a2
scripts/crop_raster.py
scripts/crop_raster.py
import subprocess # TODO: Crop from boundaries of raster tiles in a folder def gdal_crop(input_file, output_file, corners): proc_name = 'gdal_translate' # Using 'lanczos' instead of default 'nearest' because of bug (feature?) # in gdal 2.1 regarding subpixel unalignement http://www.gdal.org/gdal_translate...
Add script to crop a raster to some boundaries
Add script to crop a raster to some boundaries
Python
bsd-2-clause
fire-rs-laas/fire-rs-saop,fire-rs-laas/fire-rs-saop,fire-rs-laas/fire-rs-saop,fire-rs-laas/fire-rs-saop
--- +++ @@ -0,0 +1,21 @@ +import subprocess + +# TODO: Crop from boundaries of raster tiles in a folder + +def gdal_crop(input_file, output_file, corners): + proc_name = 'gdal_translate' + # Using 'lanczos' instead of default 'nearest' because of bug (feature?) + # in gdal 2.1 regarding subpixel unalignement...
7be01251c9a98b7756128dd627b5d7be67645387
mapnik/scales.py
mapnik/scales.py
"""Scale helpers functions.""" import math def any_scale(scale): """Scale helper function that allows any scale.""" return scale def sequence_scale(scale, scale_sequence): """Sequence scale helper, this rounds scale to a 'sensible' value.""" factor = math.floor(math.log10(scale)) norm = scale / ...
Move scale helpers into a separate module
Move scale helpers into a separate module No change in behaviour
Python
lgpl-2.1
mapnik/python-mapnik,tomhughes/python-mapnik,tomhughes/python-mapnik,mapnik/python-mapnik,mapnik/python-mapnik,tomhughes/python-mapnik
--- +++ @@ -0,0 +1,46 @@ +"""Scale helpers functions.""" + +import math + + +def any_scale(scale): + """Scale helper function that allows any scale.""" + return scale + +def sequence_scale(scale, scale_sequence): + """Sequence scale helper, this rounds scale to a 'sensible' value.""" + factor = math.floor...
a8b2930754fd4c62f2393e60826c2e089c6761a4
shopify_auth/models.py
shopify_auth/models.py
from django.conf import settings from django.db import models from django.contrib.auth.models import AbstractBaseUser, BaseUserManager class ShopUserManager(BaseUserManager): def create_user(self, myshopify_domain, domain, password = None): """ Creates and saves a ShopUser with the given domains ...
Add an abstract ShopUser base class that other apps can extend for their auth user.
Add an abstract ShopUser base class that other apps can extend for their auth user.
Python
mit
discolabs/django-shopify-auth,RafaAguilar/django-shopify-auth,funkybob/django-shopify-auth,funkybob/django-shopify-auth,discolabs/django-shopify-auth,RafaAguilar/django-shopify-auth
--- +++ @@ -0,0 +1,56 @@ +from django.conf import settings +from django.db import models +from django.contrib.auth.models import AbstractBaseUser, BaseUserManager + + +class ShopUserManager(BaseUserManager): + + def create_user(self, myshopify_domain, domain, password = None): + """ + Creates and sav...
43d1ad2924ba0cf605628ddbfd17eee0e55c08b6
security/migrations/0002_convert_pass_expiry_user_to_one2one.py
security/migrations/0002_convert_pass_expiry_user_to_one2one.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('security', '0001_initial'), ] operations = [ migrations.Al...
Add password expiry user migration
Add password expiry user migration
Python
bsd-3-clause
MartinPetkov/django-security,MartinPetkov/django-security
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('security', '0001_initial'), + ] +...
da59e27fe4176e23ec305f9a7143b288521db6ef
src/ggrc/converters/handlers/request.py
src/ggrc/converters/handlers/request.py
# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com """Handlers for request specific columns.""" from ggrc.converters.handlers impo...
# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com """Handlers for request specific columns.""" from ggrc.converters.handlers impo...
Update Request object import to use statusable attributes
Update Request object import to use statusable attributes
Python
apache-2.0
kr41/ggrc-core,j0gurt/ggrc-core,kr41/ggrc-core,josthkko/ggrc-core,selahssea/ggrc-core,prasannav7/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,josthkko/ggrc-core,selahssea/ggrc-core,prasannav7/ggrc-core,VinnieJohns/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core,AleksNeStu/ggrc...
--- +++ @@ -7,6 +7,7 @@ from ggrc.converters.handlers import handlers from ggrc.converters import errors +from ggrc import models class RequestStatusColumnHandler(handlers.StatusColumnHandler): @@ -15,7 +16,7 @@ def parse_item(self): """Parse raw_value into a valid request status if possible.""" ...
2b2a68191715e37314378b87ccfb30a2cb2a8e13
numba/tests/test_profiler.py
numba/tests/test_profiler.py
import numpy as np import cProfile as profiler import pstats from numba import jit from numba import unittest_support as unittest def dot(a, b): sum=0 for i in range(len(a)): sum += a[i]*b[i] return sum class TestProfiler(unittest.TestCase): def test_profiler(self): """Make sure the ...
Add test to verify that jit-compiled functions show up in the profile stats.
Add test to verify that jit-compiled functions show up in the profile stats.
Python
bsd-2-clause
stefanseefeld/numba,jriehl/numba,seibert/numba,cpcloud/numba,numba/numba,gmarkall/numba,IntelLabs/numba,stefanseefeld/numba,sklam/numba,jriehl/numba,stuartarchibald/numba,seibert/numba,stefanseefeld/numba,IntelLabs/numba,numba/numba,IntelLabs/numba,IntelLabs/numba,stuartarchibald/numba,stuartarchibald/numba,stuartarchi...
--- +++ @@ -0,0 +1,35 @@ +import numpy as np +import cProfile as profiler +import pstats +from numba import jit +from numba import unittest_support as unittest + +def dot(a, b): + sum=0 + for i in range(len(a)): + sum += a[i]*b[i] + return sum + + +class TestProfiler(unittest.TestCase): + + def tes...
229cd1c8dec92010074bad6c6081142f3e551026
py/guess-number-higher-or-lower-ii.py
py/guess-number-higher-or-lower-ii.py
class Solution(object): def getMoneyAmount(self, n, table=dict()): """ :type n: int :rtype: int """ def dp(L, U): if (L, U) not in table: if L + 1 >= U: table[L, U] = 0 else: table[L, U] = min...
Add py solution for 375. Guess Number Higher or Lower II
Add py solution for 375. Guess Number Higher or Lower II 375. Guess Number Higher or Lower II: https://leetcode.com/problems/guess-number-higher-or-lower-ii/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,14 @@ +class Solution(object): + def getMoneyAmount(self, n, table=dict()): + """ + :type n: int + :rtype: int + """ + def dp(L, U): + if (L, U) not in table: + if L + 1 >= U: + table[L, U] = 0 + else:...
609e0b76680156584bb1e06aa10a5425c55f8c01
wagtail/utils/widgets.py
wagtail/utils/widgets.py
from django.forms.widgets import Widget from django.utils.safestring import mark_safe class WidgetWithScript(Widget): def render(self, name, value, attrs=None): widget = super(WidgetWithScript, self).render(name, value, attrs) final_attrs = self.build_attrs(attrs, name=name) id_ = final_a...
from __future__ import absolute_import, unicode_literals from django.forms.widgets import Widget from django.utils.safestring import mark_safe class WidgetWithScript(Widget): def render(self, name, value, attrs=None): widget = super(WidgetWithScript, self).render(name, value, attrs) final_attrs ...
Fix unicode error caused by ascii format string
Fix unicode error caused by ascii format string
Python
bsd-3-clause
JoshBarr/wagtail,zerolab/wagtail,benjaoming/wagtail,takeshineshiro/wagtail,jordij/wagtail,iho/wagtail,chrxr/wagtail,iansprice/wagtail,mayapurmedia/wagtail,janusnic/wagtail,jordij/wagtail,kurtw/wagtail,jordij/wagtail,Klaudit/wagtail,jnns/wagtail,bjesus/wagtail,JoshBarr/wagtail,mikedingjan/wagtail,darith27/wagtail,takefl...
--- +++ @@ -1,3 +1,5 @@ +from __future__ import absolute_import, unicode_literals + from django.forms.widgets import Widget from django.utils.safestring import mark_safe
576d4b27d30f3bd827dfc53bf55ab6f7c95866a5
specchio/utils.py
specchio/utils.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import fnmatch def get_re_from_single_line(line): """Get regular expression from a single line in `.gitignore` The rules of `.gitingore` followed http://git-scm.com/docs/gitignore :param line: str -- single line from `.gitignore` :return: tuple 0...
Add func to get regular expression from a single line in `.gitignore`
Add func to get regular expression from a single line in `.gitignore` The rule of the func followed http://git-scm.com/docs/gitignore
Python
mit
brickgao/specchio
--- +++ @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import fnmatch + + +def get_re_from_single_line(line): + """Get regular expression from a single line in `.gitignore` + The rules of `.gitingore` followed http://git-scm.com/docs/gitignore + + :param line: str -- single line from `.g...
61e002969e63995a1355f51b58a0ec98d7a12532
froide/publicbody/migrations/0022_auto_20180726_1151.py
froide/publicbody/migrations/0022_auto_20180726_1151.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-07-26 09:51 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('publicbody', '0021_proposedpublicbody'), ] operations = [ migrations.AlterModelOpt...
Add order to proposed public bodies
Add order to proposed public bodies
Python
mit
fin/froide,stefanw/froide,fin/froide,fin/froide,stefanw/froide,fin/froide,stefanw/froide,stefanw/froide,stefanw/froide
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.14 on 2018-07-26 09:51 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('publicbody', '0021_proposedpublicbody'), + ] + + operat...
5d404ecd05b46697e90e60775541eff33ac2cb22
functional/tests/network/v2/test_ip_availability.py
functional/tests/network/v2/test_ip_availability.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Add functional tests for IP availability
Add functional tests for IP availability This patch adds functional tests for IP availability Partially-Implements: blueprint neutron-ip-capacity Change-Id: I1c1dc01801707fe8f0dc3c976e5d345d2b0db0ec
Python
apache-2.0
redhat-openstack/python-openstackclient,openstack/python-openstackclient,dtroyer/python-openstackclient,redhat-openstack/python-openstackclient,openstack/python-openstackclient,dtroyer/python-openstackclient
--- +++ @@ -0,0 +1,53 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agr...
8cc5c817115cac86f46d271ba52e1e0af4251bfe
analysis_plot_granule_fig.py
analysis_plot_granule_fig.py
# -*- coding:utf-8 -*- """ Select a specific simulation from a HDF5 file and plot its granule figure. """ import numpy as np import matplotlib.pyplot as plt import tables import h5manager as h5m from plotting import granule_pop_figure from analysis import fftmax plt.ion() DB_FILENAME = "db_two_glom_beta_new_ps_in...
Add a plot script for std figure of choosen simu
Add a plot script for std figure of choosen simu
Python
mit
neuro-lyon/multiglom-model,neuro-lyon/multiglom-model
--- +++ @@ -0,0 +1,62 @@ +# -*- coding:utf-8 -*- + +""" +Select a specific simulation from a HDF5 file and plot its granule figure. + +""" + +import numpy as np +import matplotlib.pyplot as plt +import tables + +import h5manager as h5m +from plotting import granule_pop_figure +from analysis import fftmax + +plt.ion()...
d98d834aaadc49f0f4102f8f4acac96b09ea42b3
mdtraj/tests/test_load.py
mdtraj/tests/test_load.py
############################################################################## # MDTraj: A Python Library for Loading, Saving, and Manipulating # Molecular Dynamics Trajectories. # Copyright 2012-2013 Stanford University and the Authors # # Authors: Robert McGibbon # Contributors: # # MDTraj is free software: y...
Add tests for improved loading functionality.
Add tests for improved loading functionality.
Python
lgpl-2.1
leeping/mdtraj,ctk3b/mdtraj,tcmoore3/mdtraj,mattwthompson/mdtraj,msultan/mdtraj,tcmoore3/mdtraj,msultan/mdtraj,msultan/mdtraj,mdtraj/mdtraj,tcmoore3/mdtraj,ctk3b/mdtraj,tcmoore3/mdtraj,gph82/mdtraj,leeping/mdtraj,rmcgibbo/mdtraj,ctk3b/mdtraj,jchodera/mdtraj,dwhswenson/mdtraj,dwhswenson/mdtraj,rmcgibbo/mdtraj,mattwthomp...
--- +++ @@ -0,0 +1,48 @@ +############################################################################## +# MDTraj: A Python Library for Loading, Saving, and Manipulating +# Molecular Dynamics Trajectories. +# Copyright 2012-2013 Stanford University and the Authors +# +# Authors: Robert McGibbon +# Contributo...
245206b164d1b55aa68a97e88d1e2fe8fec8f7b9
exercises/chapter_08/exercise_08_12/exercise_08_12.py
exercises/chapter_08/exercise_08_12/exercise_08_12.py
# 8-12. Sandwiches def make_sandwich(*ingredients): """Print the ingredients in the sandwich""" print ("Making a sandwich with the following ingredients:") for ingredient in ingredients: print("\t- " + ingredient) print("\n") make_sandwich("Flatbread", "American Cheese", "Green Peppers") make_sandwich("Italian...
Add solution to exercise 8.12.
Add solution to exercise 8.12.
Python
mit
HenrikSamuelsson/python-crash-course
--- +++ @@ -0,0 +1,13 @@ +# 8-12. Sandwiches + +def make_sandwich(*ingredients): + """Print the ingredients in the sandwich""" + print ("Making a sandwich with the following ingredients:") + for ingredient in ingredients: + print("\t- " + ingredient) + print("\n") + + +make_sandwich("Flatbread", "American Cheese", "...
12c2e1bfee2a6a8dae3dd4f38c9a6577f4e40f1a
lms/tests.py
lms/tests.py
"""Tests for the lms module itself.""" from django.test import TestCase from edxmako import add_lookup, LOOKUP from lms import startup class TemplateLookupTests(TestCase): """ Tests for TemplateLookup. """ def test_add_lookup_to_main(self): """Test that any template directories added are not...
Test TemplateLookup dirs are not cleared during lms startup.
Test TemplateLookup dirs are not cleared during lms startup. LMS-2498
Python
agpl-3.0
ahmadiga/min_edx,mushtaqak/edx-platform,ferabra/edx-platform,hastexo/edx-platform,kursitet/edx-platform,kmoocdev/edx-platform,shubhdev/openedx,y12uc231/edx-platform,cecep-edu/edx-platform,mtlchun/edx,Stanford-Online/edx-platform,nanolearningllc/edx-platform-cypress,chudaol/edx-platform,devs1991/test_edx_docmode,ahmedal...
--- +++ @@ -0,0 +1,23 @@ +"""Tests for the lms module itself.""" + +from django.test import TestCase + +from edxmako import add_lookup, LOOKUP +from lms import startup + +class TemplateLookupTests(TestCase): + """ + Tests for TemplateLookup. + """ + + def test_add_lookup_to_main(self): + """Test th...
5dc0061d912bf660c7e7885bd2a42f5b92834b7b
scripts/update_taxonomies.py
scripts/update_taxonomies.py
import os import json from framework.mongo import set_up_storage from website import settings from website.project.taxonomies import Subject from modularodm import Q, storage from modularodm.exceptions import NoResultsFound, MultipleResultsFound def update_taxonomies(): # Flat taxonomy is stored locally, read i...
Add a script that loads the taxonomies as a standalone thing
Add a script that loads the taxonomies as a standalone thing
Python
apache-2.0
acshi/osf.io,aaxelb/osf.io,chrisseto/osf.io,cwisecarver/osf.io,mluo613/osf.io,acshi/osf.io,caneruguz/osf.io,sloria/osf.io,CenterForOpenScience/osf.io,crcresearch/osf.io,mattclark/osf.io,Johnetordoff/osf.io,laurenrevere/osf.io,monikagrabowska/osf.io,felliott/osf.io,saradbowman/osf.io,pattisdr/osf.io,crcresearch/osf.io,b...
--- +++ @@ -0,0 +1,73 @@ +import os +import json +from framework.mongo import set_up_storage + +from website import settings +from website.project.taxonomies import Subject + +from modularodm import Q, storage +from modularodm.exceptions import NoResultsFound, MultipleResultsFound + + +def update_taxonomies(): + #...
a3ffef803d3bde1bb771217f3ed5dd4509a2c82c
tests/test_03_login.py
tests/test_03_login.py
"""Test login to an ICAT server. """ from __future__ import print_function import pytest import icat import icat.config # Try out three different users: root, useroffice, and acord. Normal # users like acord might use a different authentication plugin then # system users as root and useroffice. We want to try out b...
Add test to login to the ICAT server.
Add test to login to the ICAT server.
Python
apache-2.0
icatproject/python-icat
--- +++ @@ -0,0 +1,36 @@ +"""Test login to an ICAT server. +""" + +from __future__ import print_function +import pytest +import icat +import icat.config + +# Try out three different users: root, useroffice, and acord. Normal +# users like acord might use a different authentication plugin then +# system users as root...
0777f77dc2f8a25da7cb572bf4f9e36c7f88fc26
tests/test_validate.py
tests/test_validate.py
"""tests/test_validate.py. Tests to ensure hug's custom validation methods work 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 without rest...
Implement tests for validate module
Implement tests for validate module
Python
mit
timothycrosley/hug,MuhammadAlkarouri/hug,timothycrosley/hug,timothycrosley/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug
--- +++ @@ -0,0 +1,46 @@ +"""tests/test_validate.py. + +Tests to ensure hug's custom validation methods work 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"), t...
da1e46d550669970ce0188d417af3764a046a33f
sara_flexbe_states/src/sara_flexbe_states/WonderlandAddPerson.py
sara_flexbe_states/src/sara_flexbe_states/WonderlandAddPerson.py
#!/usr/bin/env python # encoding=utf8 import json import requests from flexbe_core import EventState, Logger """ Created on 17/05/2018 @author: Lucas Maurice """ class WonderlandAddPerson(EventState): ''' Add a person. ># entity sara_msgs/Entity <= done retur...
Add a step for add a person in Wonderland database.
Add a step for add a person in Wonderland database.
Python
bsd-3-clause
WalkingMachine/sara_behaviors,WalkingMachine/sara_behaviors
--- +++ @@ -0,0 +1,90 @@ +#!/usr/bin/env python +# encoding=utf8 + +import json + +import requests +from flexbe_core import EventState, Logger + +""" +Created on 17/05/2018 + +@author: Lucas Maurice +""" + + +class WonderlandAddPerson(EventState): + ''' + Add a person. + ># entity sara_msgs...
269dbda9c702ddd4809632558a73f4e4eae31d89
scripts/python/light_rpi.py
scripts/python/light_rpi.py
# # IAS Basic device framework. # # Author: Joeri Hermans # import sys import socket import struct import os import RPIO # Global members, which are required for the communication # with the remote IAS controller. gDeviceIdentifier = sys.argv[1] gControllerAddress = sys.argv[2] gControllerPort = int(sys.argv[3]) gPin...
Add script to control lights from Raspberry Pi.
Add script to control lights from Raspberry Pi.
Python
apache-2.0
JoeriHermans/Intelligent-Automation-System,JoeriHermans/Intelligent-Automation-System,JoeriHermans/Intelligent-Automation-System,JoeriHermans/Intelligent-Automation-System
--- +++ @@ -0,0 +1,106 @@ +# +# IAS Basic device framework. +# +# Author: Joeri Hermans +# + +import sys +import socket +import struct +import os +import RPIO + +# Global members, which are required for the communication +# with the remote IAS controller. +gDeviceIdentifier = sys.argv[1] +gControllerAddress = sys.arg...
332015ed4eceaa4eac9869c6e0553ad3beacd30a
test/os_win7.py
test/os_win7.py
#!/usr/bin/env python """ mbed SDK Copyright (c) 2011-2015 ARM Limited Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable ...
Test win 7 with winreg module mock
Test win 7 with winreg module mock
Python
apache-2.0
jupe/mbed-ls,jupe/mbed-ls
--- +++ @@ -0,0 +1,45 @@ +#!/usr/bin/env python +""" +mbed SDK +Copyright (c) 2011-2015 ARM Limited + +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/LICENS...
d2dbe3b863418c10739e94d16e7f2a6f12c52524
problem_builder/migrations/0002_auto_20160121_1525.py
problem_builder/migrations/0002_auto_20160121_1525.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('problem_builder', '0001_initial'), ] ...
Add in Django migration for shares.
Add in Django migration for shares.
Python
agpl-3.0
proversity-org/problem-builder,proversity-org/problem-builder,proversity-org/problem-builder
--- +++ @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('pr...
6536f808ad7cea2970ba5db46c9178dfc8739a1b
tests/unknownlength.py
tests/unknownlength.py
import progressbar def test_unknown_length(): pb = progressbar.ProgressBar(widgets=[progressbar.AnimatedMarker()], max_value=progressbar.UnknownLength) assert pb.max_value is progressbar.UnknownLength
Add failing test on Py3: initialising ProgressBar with UnknownLength
Add failing test on Py3: initialising ProgressBar with UnknownLength
Python
bsd-3-clause
WoLpH/python-progressbar
--- +++ @@ -0,0 +1,7 @@ +import progressbar + + +def test_unknown_length(): + pb = progressbar.ProgressBar(widgets=[progressbar.AnimatedMarker()], + max_value=progressbar.UnknownLength) + assert pb.max_value is progressbar.UnknownLength
7ee4bacff94874a0dd3a82360e4dcbd1ea73bc01
python--learnings/lambda_map_filter_reduce.py
python--learnings/lambda_map_filter_reduce.py
#!/usr/bin/env python # # Topics: Lambdas, Maps, Filters, Reduce # # Background: Lambda examples and functionality, including maps, filters, and reduces. # # Sources: # - https://www.python-course.eu/lambda.php import unittest from functools import reduce # test functionality class TestMethods(unittest.TestCase...
Add Python Lambda, Map, Filter, Reduce Test
Add Python Lambda, Map, Filter, Reduce Test Add simple functionality for Lambda, Map, Filter, and Reduce.
Python
mit
jekhokie/scriptbox,jekhokie/scriptbox,jekhokie/scriptbox,jekhokie/scriptbox,jekhokie/scriptbox,jekhokie/scriptbox,jekhokie/scriptbox,jekhokie/scriptbox
--- +++ @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# +# Topics: Lambdas, Maps, Filters, Reduce +# +# Background: Lambda examples and functionality, including maps, filters, and reduces. +# +# Sources: +# - https://www.python-course.eu/lambda.php + +import unittest +from functools import reduce + +# test functiona...
851631bd98139d4dd45c8fce6a080615d45283f4
thinc/tests/unit/test_sparse_embed.py
thinc/tests/unit/test_sparse_embed.py
from ...neural._classes.sparse_embed import SparseEmbed import numpy def test_create_sparse_embed(): embed = SparseEmbed(300) def test_predict_sparse_embed(): embed = SparseEmbed(300) ids = numpy.ones((10,), dtype='uint64') vectors = embed.predict(ids) assert vectors.shape == (10, 300) asser...
Add test for deprecated sparse_embed module
Add test for deprecated sparse_embed module
Python
mit
spacy-io/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc
--- +++ @@ -0,0 +1,25 @@ +from ...neural._classes.sparse_embed import SparseEmbed +import numpy + + +def test_create_sparse_embed(): + embed = SparseEmbed(300) + + +def test_predict_sparse_embed(): + embed = SparseEmbed(300) + ids = numpy.ones((10,), dtype='uint64') + vectors = embed.predict(ids) + ass...
d9351b85301e701b7054acf57fb3be6b1a6cac01
build_recipes.py
build_recipes.py
import argparse import subprocess parser = argparse.ArgumentParser() parser.add_argument("package_list", help="List of packages for which" + " recipies will be created") args = parser.parse_args() package_names = [package.strip() for package in open(args.package_list, 'r').readlin...
Add script to build conda recipes
Add script to build conda recipes Signed-off-by: Harsh Gupta <c4bd8559369e527b4bb1785ff84e8ff50fde87c0@gmail.com>
Python
bsd-3-clause
ContinuumIO/pypi-conda-builds
--- +++ @@ -0,0 +1,42 @@ +import argparse +import subprocess + +parser = argparse.ArgumentParser() +parser.add_argument("package_list", help="List of packages for which" + + " recipies will be created") +args = parser.parse_args() + +package_names = [package.strip() for package in + ...
eec5e9e5bf467384b77aadf2aaf2a0176d7b3d7b
test.py
test.py
import argcommand import argparse ## class Say( argcommand.Command ): what = argcommand.Argument( "WORD", default = "Something", help = "the text you want to print" ) times = argcommand.Argument( "--times", "-t", type = int, default = 1, metavar = "T", help = "how many times you want to repeat the text" ) ...
Test classes from the README.md file
Test classes from the README.md file
Python
mit
avinoamr/argcommand
--- +++ @@ -0,0 +1,28 @@ +import argcommand +import argparse + +## +class Say( argcommand.Command ): + + what = argcommand.Argument( "WORD", default = "Something", help = "the text you want to print" ) + times = argcommand.Argument( "--times", "-t", type = int, default = 1, metavar = "T", help = "how many times...
756b5fa59d12e67fe2ed4f223ddc77b00f7686b9
www/tests/test_file.py
www/tests/test_file.py
from browser import document, html, window with open('test.html') as f: f.read() with open('files/text-utf8.txt') as f: f.read() with open('compression/du cote de chez swann.txt', 'rb') as f: assert len(f.read()) == 1_056_294 with open('compression/du cote de chez swann.txt', 'r') as f: assert len(f...
Add test for file objects created by open()
Add test for file objects created by open()
Python
bsd-3-clause
brython-dev/brython,brython-dev/brython,brython-dev/brython
--- +++ @@ -0,0 +1,40 @@ +from browser import document, html, window + +with open('test.html') as f: + f.read() + +with open('files/text-utf8.txt') as f: + f.read() + +with open('compression/du cote de chez swann.txt', 'rb') as f: + assert len(f.read()) == 1_056_294 + +with open('compression/du cote de chez ...
034719380206d42a1bc065cb5805d700cd5f2366
pentagon/filters.py
pentagon/filters.py
import re def get_filters(): """Register a function with decorator""" registry = {} def registrar(func): registry[func.__name__] = func return func registrar.all = registry return registrar filter = get_filters() @filter def regex_trim(input, regex, replace=''): """ Trims or replaces the regex match ...
Add a jinja filter and factory
Add a jinja filter and factory
Python
apache-2.0
reactiveops/pentagon,reactiveops/pentagon,reactiveops/pentagon
--- +++ @@ -0,0 +1,34 @@ +import re + + + +def get_filters(): + """Register a function with decorator""" + registry = {} + def registrar(func): + registry[func.__name__] = func + return func + registrar.all = registry + return registrar + + +filter = get_filters() + + +@filter +def regex_trim(input, regex, replace...
20cf65dfc76b097a63b21b1661bf40e01764af71
pybb/management/commands/pybb_delete_invalid_topics.py
pybb/management/commands/pybb_delete_invalid_topics.py
from optparse import make_option from datetime import datetime, timedelta from django.core.management.base import BaseCommand, CommandError from django.db.models import Count from pybb.models import Topic class Command(BaseCommand): help = 'Resave all posts.' def handle(self, *args, **kwargs): check...
Add management command to delete invalid topics
Add management command to delete invalid topics
Python
bsd-3-clause
gpetukhov/pybb,gpetukhov/pybb,gpetukhov/pybb
--- +++ @@ -0,0 +1,27 @@ +from optparse import make_option +from datetime import datetime, timedelta + +from django.core.management.base import BaseCommand, CommandError +from django.db.models import Count + +from pybb.models import Topic + +class Command(BaseCommand): + help = 'Resave all posts.' + + def handl...
d80c5c93d993905a4950bc00dea29096da1de459
src/mmw/apps/modeling/migrations/0021_old_scenarios.py
src/mmw/apps/modeling/migrations/0021_old_scenarios.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def clear_old_scenario_results(apps, schema_editor): Scenario = apps.get_model('modeling', 'Scenario') old_scenarios = Scenario.objects.filter( project__model_package='tr-55' ) fo...
Add migration to flush saved tr-55 results
Add migration to flush saved tr-55 results
Python
apache-2.0
WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed
--- +++ @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +def clear_old_scenario_results(apps, schema_editor): + Scenario = apps.get_model('modeling', 'Scenario') + old_scenarios = Scenario.objects.filter( + project__mo...
0acecb5dd4ee96136b9929a9b1adef953a1a5a63
unittest-build.py
unittest-build.py
#!/usr/bin/python import sys import os if sys.platform == 'win32': os.system ( 'devenv /build libSequantoAutomation.sln' ) else: os.system ( 'make' )
Add python script to build the project using the platforms standard builder (used when we do automatic unit-testing using Bitten at Sequanto)
Add python script to build the project using the platforms standard builder (used when we do automatic unit-testing using Bitten at Sequanto)
Python
apache-2.0
seqzap/sequanto-automation,micronpn/sequanto-automation,seqzap/sequanto-automation,seqzap/sequanto-automation,seqzap/sequanto-automation,micronpn/sequanto-automation,rasmus-toftdahl-olesen/sequanto-automation,micronpn/sequanto-automation,rasmus-toftdahl-olesen/sequanto-automation,rasmus-toftdahl-olesen/sequanto-automat...
--- +++ @@ -0,0 +1,9 @@ +#!/usr/bin/python + +import sys +import os + +if sys.platform == 'win32': + os.system ( 'devenv /build libSequantoAutomation.sln' ) +else: + os.system ( 'make' )
9b05d4fab047be287dcd7c872e6a2a706a06e2f6
libs/build_client.py
libs/build_client.py
# # Build Script by Moloch # Requires Py2Exe for Python 2.7 # from distutils.core import setup import py2exe, sys, os sys.argv.append('py2exe') setup( options = {'py2exe': {'bundle_files': 1,'compressed': 1, 'optimize': 2}}, windows = [{'script': 'RtbClient.py', 'uac_info': 'requireAdministrator', 'icon_resource...
Add build script for client
Add build script for client
Python
apache-2.0
Richard-West/RootTheBox,Und3rf10w/RootTheBox,Richard-West/RootTheBox,Richard-West/RootTheBox,sigma-random/RootTheBox,shanshar06/RootTheBox,Und3rf10w/RootTheBox,sigma-random/RootTheBox,shanshar06/RootTheBox,moloch--/RootTheBox,Richard-West/RootTheBox,moloch--/RootTheBox,Und3rf10w/RootTheBox,sigma-random/RootTheBox,shans...
--- +++ @@ -0,0 +1,14 @@ +# +# Build Script by Moloch +# Requires Py2Exe for Python 2.7 +# +from distutils.core import setup +import py2exe, sys, os + +sys.argv.append('py2exe') + +setup( + options = {'py2exe': {'bundle_files': 1,'compressed': 1, 'optimize': 2}}, + windows = [{'script': 'RtbClient.py', 'uac_info':...
fd059a3f1a971706a45d9ac1f2cc20f73825a520
website/management/commands/jd_pre.py
website/management/commands/jd_pre.py
from django.core.management.base import BaseCommand from django.contrib.sites.models import Site class Command(BaseCommand): def handle(self, *args, **options): site = Site.objects.get() site.domain = 'website.jongedemocraten.nl' site.name = 'Landelijk' site.save()
Add management script to rename the default site
Add management script to rename the default site Django 1.8 automatically names the default website instead of asking for the domain name it should use. Our import script depends on setting the domain name of the default site before importing content. This script can be run to set the domain and name of the default si...
Python
mit
jonge-democraten/website,jonge-democraten/website,jonge-democraten/website,jonge-democraten/website
--- +++ @@ -0,0 +1,9 @@ +from django.core.management.base import BaseCommand +from django.contrib.sites.models import Site + +class Command(BaseCommand): + def handle(self, *args, **options): + site = Site.objects.get() + site.domain = 'website.jongedemocraten.nl' + site.name = 'Landelijk' + ...
44b10d1f941aeed155b869588d4d732fe0881ede
pinger/ext/plugins/stdout.py
pinger/ext/plugins/stdout.py
from pinger.ext import ActionProvider class StdOut(ActionProvider): """ Receives a response and prints it """ title = 'StdOut' def receive(self, name, url, status, errors, elapsed): print 'name={name} url={url} elapsed={elapsed} status={status}'.format(name=name, ...
Add STDout plugin, fix status representation
Add STDout plugin, fix status representation
Python
mit
pedrospdc/pinger
--- +++ @@ -0,0 +1,17 @@ +from pinger.ext import ActionProvider + + +class StdOut(ActionProvider): + """ + Receives a response and prints it + """ + title = 'StdOut' + + def receive(self, name, url, status, errors, elapsed): + print 'name={name} url={url} elapsed={elapsed} status={status}'.forma...
2cbfce0e8620792a7fb8c93711ab6163544213ec
apps/curia_vista/management/commands/update_cantons.py
apps/curia_vista/management/commands/update_cantons.py
from xml.etree import ElementTree from django.core.management.base import BaseCommand, CommandError from django.db import transaction import requests from apps.curia_vista.models import * class Command(BaseCommand): help = 'Import cantons from parlament.ch' @transaction.atomic def handle(self, *args, **...
Add import script for cantons data
Add import script for cantons data
Python
agpl-3.0
rettichschnidi/politkarma,rettichschnidi/politkarma,rettichschnidi/politkarma,rettichschnidi/politkarma
--- +++ @@ -0,0 +1,37 @@ +from xml.etree import ElementTree +from django.core.management.base import BaseCommand, CommandError +from django.db import transaction +import requests + +from apps.curia_vista.models import * + + +class Command(BaseCommand): + help = 'Import cantons from parlament.ch' + + @transactio...
3fcb449325713fa9bfffe737b09dab333675766b
gnowsys-ndf/gnowsys_ndf/ndf/management/commands/update_attribute_type.py
gnowsys-ndf/gnowsys_ndf/ndf/management/commands/update_attribute_type.py
''' imports from installed packages ''' from django.core.management.base import BaseCommand, CommandError from django_mongokit import get_database try: from bson import ObjectId except ImportError: # old pymongo from pymongo.objectid import ObjectId ''' imports from application folders/files ''' from gnowsy...
Update script for updating attribute_type field of GAttribute instances from ObjectId to DBRef (AttributeType)
Update script for updating attribute_type field of GAttribute instances from ObjectId to DBRef (AttributeType)
Python
agpl-3.0
AvadootNachankar/gstudio,supriyasawant/gstudio,gnowledge/gstudio,gnowledge/gstudio,olympian94/gstudio,sunnychaudhari/gstudio,makfire/gstudio,olympian94/gstudio,AvadootNachankar/gstudio,gnowledge/gstudio,makfire/gstudio,AvadootNachankar/gstudio,supriyasawant/gstudio,sunnychaudhari/gstudio,Dhiru/gstudio,makfire/gstudio,s...
--- +++ @@ -0,0 +1,51 @@ +''' imports from installed packages ''' +from django.core.management.base import BaseCommand, CommandError + +from django_mongokit import get_database + +try: + from bson import ObjectId +except ImportError: # old pymongo + from pymongo.objectid import ObjectId + +''' imports from app...
7ef782ff8ff684777516a1e76e3a6c2c937e70cd
geoip/management/commands/save_ballot_coordinates.py
geoip/management/commands/save_ballot_coordinates.py
from django.core.management.base import BaseCommand from geopy.geocoders import get_geocoder_for_service from geopy.exc import GeocoderQuotaExceeded from ballot.models import BallotReturned class Command(BaseCommand): help = 'Populates the latitude and longitude fields of BallotReturned' def populate_latitu...
Add command for populating latitude and longitude
Add command for populating latitude and longitude
Python
mit
wevote/WeVoteServer,wevote/WebAppPublic,jainanisha90/WeVoteServer,wevote/WebAppPublic,jainanisha90/WeVoteServer,wevote/WeVoteServer,wevote/WeVoteServer,jainanisha90/WeVoteServer,wevote/WeVoteServer,wevote/WebAppPublic,wevote/WebAppPublic
--- +++ @@ -0,0 +1,31 @@ +from django.core.management.base import BaseCommand +from geopy.geocoders import get_geocoder_for_service +from geopy.exc import GeocoderQuotaExceeded + +from ballot.models import BallotReturned + + +class Command(BaseCommand): + help = 'Populates the latitude and longitude fields of Ball...
eabbdee7c85c62c93f8f8993041b7f763c36c0dd
count_lines.py
count_lines.py
"""Script to count the lines in a corpus of texts. This information can be used to normalize the results. Input: directory containing text files Output: csv containing <text_id>, <# lines> Usage: python count_lines.py <dir in> <file out> """ import argparse import glob import os import codecs import pandas as pd i...
Add script to count the lines in a corpus
Add script to count the lines in a corpus The results is saved to a csv file.
Python
apache-2.0
NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts
--- +++ @@ -0,0 +1,38 @@ +"""Script to count the lines in a corpus of texts. + +This information can be used to normalize the results. + +Input: directory containing text files +Output: csv containing <text_id>, <# lines> + +Usage: python count_lines.py <dir in> <file out> +""" +import argparse +import glob +import o...
034d0871a87b6929656b163c0c2d65ed09f97520
bin/convert_file.py
bin/convert_file.py
import argparse import os import sys import csv file_path = os.path.join(os.path.dirname(os.path.realpath(__file__))) sys.path.append(os.path.abspath(os.path.join(file_path, os.pardir))) if __name__ == "__main__": parser = argparse.ArgumentParser(description='Convert csv file into correct format') parser.add_...
Add script to reshape attendance data
Add script to reshape attendance data
Python
apache-2.0
Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2
--- +++ @@ -0,0 +1,72 @@ +import argparse +import os +import sys +import csv + +file_path = os.path.join(os.path.dirname(os.path.realpath(__file__))) +sys.path.append(os.path.abspath(os.path.join(file_path, os.pardir))) + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='Convert csv file ...
786fbfe7548b887141d6a3961cc85d8d770c02d6
Sample/Python/Sample.py
Sample/Python/Sample.py
import ctypes import os # Error T_ERROR_SUCCESS = 0 # Success T_ERROR_EMPTY = 1 # Empty expression T_ERROR_DIVZERO = 2 # Division by zero T_ERROR_TOKEN = 3 # Unknown token type T_ERROR_FUNC = 4 # Math function not found T_ERROR_FUNC_FACTORIAL = 5 # Argument to factorial must b...
Create sample file for Python
Create sample file for Python
Python
mit
rchockxm/ExprSolver,rchockxm/ExprSolver,rchockxm/ExprSolver
--- +++ @@ -0,0 +1,27 @@ +import ctypes +import os + +# Error +T_ERROR_SUCCESS = 0 # Success +T_ERROR_EMPTY = 1 # Empty expression +T_ERROR_DIVZERO = 2 # Division by zero +T_ERROR_TOKEN = 3 # Unknown token type +T_ERROR_FUNC = 4 # Math function not found +T_ERROR_FUNC_FACTORI...
3b0d4279aa00dd1c34a617ba40ba1c3700c9b0c7
Cura/Event.py
Cura/Event.py
class Event: MousePressEvent = 1 MouseMoveEvent = 2 MouseReleaseEvent = 3 KeyPressEvent = 4 KeyReleaseEvent = 5 SceneChangeEvent = 6 ToolActivateEvent = 7 ToolDeactivateEvent = 8 def __init__(self, type): super().__init__() self._type = type @property def ty...
Add an event class and several standard subclasses
Add an event class and several standard subclasses
Python
agpl-3.0
onitake/Uranium,onitake/Uranium
--- +++ @@ -0,0 +1,81 @@ +class Event: + MousePressEvent = 1 + MouseMoveEvent = 2 + MouseReleaseEvent = 3 + KeyPressEvent = 4 + KeyReleaseEvent = 5 + SceneChangeEvent = 6 + ToolActivateEvent = 7 + ToolDeactivateEvent = 8 + + def __init__(self, type): + super().__init__() + sel...
b854548b0eca1b90395e257e2878b935846f6d0e
components/lie_graph/lie_graph/graph_io/io_json_format.py
components/lie_graph/lie_graph/graph_io/io_json_format.py
# -*- coding: utf-8 -*- """ file: io_json_format.py Functions for exporting and importing graphs in structured JSON format """ import logging import json from lie_graph.graph_io.io_helpers import open_anything from lie_graph.graph_io.io_dict_format import read_dict, write_dict def read_json(json_file, graph=None,...
Add importer and exporter for JSON files
Add importer and exporter for JSON files Wrapper around read_dict and write_dict
Python
apache-2.0
MD-Studio/MDStudio,MD-Studio/MDStudio,MD-Studio/MDStudio,MD-Studio/MDStudio,MD-Studio/MDStudio
--- +++ @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- + +""" +file: io_json_format.py + +Functions for exporting and importing graphs in structured JSON format +""" + +import logging +import json + +from lie_graph.graph_io.io_helpers import open_anything +from lie_graph.graph_io.io_dict_format import read_dict, write_dic...
eab9ca4d17d67d7c2977d2753c4a2d6be768d1f9
kobo/django/auth/migrations/0002_auto_20220203_1511.py
kobo/django/auth/migrations/0002_auto_20220203_1511.py
# Generated by Django 2.2.24 on 2022-02-03 15:11 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('kobo_auth', '0001_initial'), ] operations = [ migrations.AlterField( model_name='user', ...
Add migration for User model generated by Django 2
Add migration for User model generated by Django 2
Python
lgpl-2.1
release-engineering/kobo,release-engineering/kobo,release-engineering/kobo,release-engineering/kobo
--- +++ @@ -0,0 +1,19 @@ +# Generated by Django 2.2.24 on 2022-02-03 15:11 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('kobo_auth', '0001_initial'), + ] + + operations = [ + migrations.AlterField(...
32bbe90127c573cf69c7c9128e6f0e95756974a9
test/integration/test_api.py
test/integration/test_api.py
import unittest import changeling.api import changeling.fakes class TestChangeAPI(unittest.TestCase): def setUp(self): self.fake_storage = changeling.fakes.FakeStorage([]) self.api = changeling.api.ChangeAPI(self.fake_storage) def test_list_zero_changes(self): self.assertEqual([], l...
Add integration tests for ChangeAPI
Add integration tests for ChangeAPI
Python
apache-2.0
bcwaldon/changeling,bcwaldon/changeling
--- +++ @@ -0,0 +1,14 @@ + +import unittest + +import changeling.api +import changeling.fakes + + +class TestChangeAPI(unittest.TestCase): + def setUp(self): + self.fake_storage = changeling.fakes.FakeStorage([]) + self.api = changeling.api.ChangeAPI(self.fake_storage) + + def test_list_zero_chang...
358d97dd3f2628444899fdd0e5021420014b27a3
scripts/add_kms_secret.py
scripts/add_kms_secret.py
#!/usr/bin/env python # -*- encoding: utf-8 """ Store a config variable in SSM under the key structure /{project_id}/secrets/{label}/{config_key} This script can store a regular config key (unencrypted) or an encrypted key. """ import getpass import sys import boto3 from botocore.exceptions import ClientError ...
Add a script for storing secrets
Add a script for storing secrets
Python
mit
wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api
--- +++ @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 +""" +Store a config variable in SSM under the key structure + + /{project_id}/secrets/{label}/{config_key} + +This script can store a regular config key (unencrypted) or an encrypted key. + +""" + +import getpass +import sys + +import boto3 +f...
94e60ae8057795363c19f69d46c5890372cfa7dd
singleSimulation.py
singleSimulation.py
import os import sys import numpy as np from scripts.Dqn import Learner import time if 'SUMO_HOME' in os.environ: tools = os.path.join(os.environ['SUMO_HOME'], 'tools') sys.path.append(tools) else: sys.exit("Please declare the environment variable 'SUMO_HOME'") sumoBinary = "/usr/bin/sumo-gui" sumoConfig ...
Add program to run single simulation
Add program to run single simulation
Python
mit
Wert1996/Traffic-Optimisation
--- +++ @@ -0,0 +1,78 @@ +import os +import sys +import numpy as np +from scripts.Dqn import Learner +import time + +if 'SUMO_HOME' in os.environ: + tools = os.path.join(os.environ['SUMO_HOME'], 'tools') + sys.path.append(tools) +else: + sys.exit("Please declare the environment variable 'SUMO_HOME'") + +sumo...
2b68847ceb2a440aff89d23479b1b69a74cd6e6b
tools/visual/show_video_matfile_detection.py
tools/visual/show_video_matfile_detection.py
#!/usr/bin/env python import argparse import os import sys import cv2 from vdetlib.vdet.dataset import imagenet_vdet_class_idx from vdetlib.utils.common import imread, imwrite from vdetlib.utils.protocol import proto_load, proto_dump, frame_path_at, frame_top_detections from vdetlib.utils.visual import add_bbox from v...
Add a script to visualize detection matfiles.
Add a script to visualize detection matfiles.
Python
mit
myfavouritekk/TPN
--- +++ @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +import argparse +import os +import sys +import cv2 +from vdetlib.vdet.dataset import imagenet_vdet_class_idx +from vdetlib.utils.common import imread, imwrite +from vdetlib.utils.protocol import proto_load, proto_dump, frame_path_at, frame_top_detections +from vdetli...
a3638f641098b1e713492d1a5fd832c8f9c3da5d
resolwe/flow/migrations/0005_duplicate_data_dependency.py
resolwe/flow/migrations/0005_duplicate_data_dependency.py
# Generated by Django 3.1.7 on 2021-10-12 10:39 from django.db import migrations, models def create_duplicate_dependencies(apps, schema_editor): Data = apps.get_model("flow", "Data") DataDependency = apps.get_model("flow", "DataDependency") duplicates = Data.objects.filter(duplicated__isnull=False) du...
Add missing DataDependency objects for duplicates
Add missing DataDependency objects for duplicates
Python
apache-2.0
genialis/resolwe,genialis/resolwe
--- +++ @@ -0,0 +1,32 @@ +# Generated by Django 3.1.7 on 2021-10-12 10:39 +from django.db import migrations, models + + +def create_duplicate_dependencies(apps, schema_editor): + Data = apps.get_model("flow", "Data") + DataDependency = apps.get_model("flow", "DataDependency") + duplicates = Data.objects.filt...
0a28e4239a7393a9e8e4fa2b57126c7d28ed4bea
astrodb/models.py
astrodb/models.py
""" An attempt to modelize datas with the "peewee" ORM You have to install "peewee" from its repository (this code use ManyToManyField that has been documented but omitted from the last release, so waiting for it we will develop using the unstable version): :: pip install -e git+https://github.com/coleifer/peewee...
Add demo for modelizing using peewee ORM
Add demo for modelizing using peewee ORM
Python
mit
EricDepagne/Astrodb
--- +++ @@ -0,0 +1,77 @@ +""" +An attempt to modelize datas with the "peewee" ORM + +You have to install "peewee" from its repository (this code use ManyToManyField that has been documented but omitted from the last release, so waiting for it we will develop using the unstable version): :: + + pip install -e git+h...
6a36df252e5f7c17cb2dfc63062472c65645ad2f
unleashed/api.py
unleashed/api.py
import requests from auth import UnleashedAuth class UnleashedApi(object): """ Unleashed API client library. """ def __init__(self, api_url, api_id, api_key): self.api_url = api_url self.auth = UnleashedAuth(api_id, api_key) def _get_request(self, method, params=None): p...
Add basic API which can make GET and POST requests
Add basic API which can make GET and POST requests
Python
mit
jsok/unleashed
--- +++ @@ -0,0 +1,40 @@ +import requests + +from auth import UnleashedAuth + + +class UnleashedApi(object): + """ + Unleashed API client library. + """ + + def __init__(self, api_url, api_id, api_key): + self.api_url = api_url + self.auth = UnleashedAuth(api_id, api_key) + + def _get_req...
fbc088bbe3f7a8493c359618b35e6c31d9b7afce
district-court-scraper.py
district-court-scraper.py
import cookielib import os import re import sys import urllib import urllib2 import webbrowser from bs4 import BeautifulSoup from time import sleep user_agent = u"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; " + \ u"rv:1.9.2.11) Gecko/20101012 Firefox/3.6.11" # Get cookie and list of courts cookieJar = ...
Allow user to solve district court captcha
Allow user to solve district court captcha
Python
mit
CodeforNRV/attorney-analysis
--- +++ @@ -0,0 +1,50 @@ +import cookielib +import os +import re +import sys +import urllib +import urllib2 +import webbrowser +from bs4 import BeautifulSoup +from time import sleep + +user_agent = u"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; " + \ + u"rv:1.9.2.11) Gecko/20101012 Firefox/3.6.11" + +# G...
aa55e73c8757772486eec3d4b2f1bf980f7445e0
tools/convert-url-history.py
tools/convert-url-history.py
#!/usr/bin/env python # Copyright 2009 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
Add initial URL history importer
Add initial URL history importer
Python
apache-2.0
mirek2580/namebench
--- +++ @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# Copyright 2009 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licen...
3256d970f1dd8f34a91b6f5161ddcb54da83fb9f
checks/check_polygons_stay_valid_during_augmentation.py
checks/check_polygons_stay_valid_during_augmentation.py
from __future__ import print_function, division import numpy as np import imgaug as ia import imgaug.augmenters as iaa from imgaug.augmentables.polys import Polygon, PolygonsOnImage def main(): nb_checked = 0 augs = iaa.SomeOf((1, None), [ iaa.Resize({"height": (1, 100), "width": (1, 100)}), ...
Add check script for polygon validity during aug
Add check script for polygon validity during aug
Python
mit
aleju/imgaug,aleju/imgaug,aleju/ImageAugmenter
--- +++ @@ -0,0 +1,60 @@ +from __future__ import print_function, division +import numpy as np + +import imgaug as ia +import imgaug.augmenters as iaa +from imgaug.augmentables.polys import Polygon, PolygonsOnImage + + +def main(): + nb_checked = 0 + + augs = iaa.SomeOf((1, None), [ + iaa.Resize({"height"...
dc2074c5759f7ee8b00a9cc48b8a7b49ccdc067e
scripts/add_noise_to_datasets.py
scripts/add_noise_to_datasets.py
#!/usr/bin/env python3 """ Usage: {script_name} INPUT_FILE OUTPUT_FILE Adds noise to the csv file given as input. """ import random import sys from collections import deque def usage(): print(__doc__.format(script_name=sys.argv[0].split("/")[-1])) sys.exit(0) def empty_lines(line_num): empty_count = 50...
Add scripts that adds noise to datasets
Add scripts that adds noise to datasets
Python
mit
CSWR/annotatingCSV,CSWR/annotatingCSV,CSWR/annotatingCSV
--- +++ @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +""" +Usage: {script_name} INPUT_FILE OUTPUT_FILE + +Adds noise to the csv file given as input. +""" +import random +import sys +from collections import deque + + +def usage(): + print(__doc__.format(script_name=sys.argv[0].split("/")[-1])) + sys.exit(0) + + +def...
97f70e4d285a2ce231442f6544927671ca959c38
Graphs/nodes_at_same_level.py
Graphs/nodes_at_same_level.py
import unittest """ Write a function to connect all adjacent nodes at same level in binary tree. """ class Node: def __init__(self, key, left=None, right=None): self.key = key self.left = left self.right = right self.next_right = None def connect_level(root): if root is None...
Connect nodes at same level in binary tree
Connect nodes at same level in binary tree
Python
mit
prathamtandon/g4gproblems
--- +++ @@ -0,0 +1,58 @@ +import unittest +""" +Write a function to connect all adjacent nodes at same level in binary tree. +""" + + +class Node: + def __init__(self, key, left=None, right=None): + self.key = key + self.left = left + self.right = right + self.next_right = None + + +def...
3e97849ce926fa375335227467064b55c4ff594f
scripts/find_existing_results.py
scripts/find_existing_results.py
#!/usr/bin/env python import os import sys import argparse if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('-s', '--samples_file', help="Input list of sample/library names to search for") args = parser.parse_args() samples = list() with open(args.samples_file, 'r...
Add script for finding duplicate results
Add script for finding duplicate results
Python
mit
dgaston/ddbio-ngsflow,dgaston/ddb-ngsflow
--- +++ @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +import os +import sys +import argparse + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument('-s', '--samples_file', help="Input list of sample/library names to search for") + args = parser.parse_args() + + samples = lis...
4ffab859f2798db504d47a98b525aba200e03c7a
imager/ImagerProfile/migrations/0003_auto_20150303_1301.py
imager/ImagerProfile/migrations/0003_auto_20150303_1301.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('ImagerProfile', '0002_auto_20150303_0721'), ] operations = [ migrations.AlterField( ...
Add migration for changes to ImagerProfile user related name
Add migration for changes to ImagerProfile user related name
Python
mit
nbeck90/django-imager,nbeck90/django-imager
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + ('ImagerProfile', '0002_auto_20150303_0721'), + ] + + operations =...
ea27d19cb30b05d66256115753e82156d5a6d69d
openedx/tests/xblock_integration/test_external_xblocks.py
openedx/tests/xblock_integration/test_external_xblocks.py
""" This will run tests on all XBlocks in the `xblock.test.v0` entrypoint. Did you notice something about that entry point? It ends with a v0. That means this is not finished. At some point, we might stop running v0 tests, replacing them with test case failures, and run v1 tests only. That be the dragon here. """ impo...
Allow us to run tests from external XBlock repositories
Allow us to run tests from external XBlock repositories
Python
agpl-3.0
ampax/edx-platform,teltek/edx-platform,chrisndodge/edx-platform,antoviaque/edx-platform,deepsrijit1105/edx-platform,proversity-org/edx-platform,doganov/edx-platform,hastexo/edx-platform,angelapper/edx-platform,naresh21/synergetics-edx-platform,Stanford-Online/edx-platform,msegado/edx-platform,ovnicraft/edx-platform,app...
--- +++ @@ -0,0 +1,53 @@ +""" +This will run tests on all XBlocks in the `xblock.test.v0` +entrypoint. Did you notice something about that entry point? It ends +with a v0. That means this is not finished. At some point, we might +stop running v0 tests, replacing them with test case failures, and +run v1 tests only. +...
3559063b9110aa04b773dfc56db05297e4ce472f
migrations/versions/0249_another_letter_org.py
migrations/versions/0249_another_letter_org.py
"""empty message Revision ID: 0249_another_letter_org Revises: 0248_enable_choose_postage """ # revision identifiers, used by Alembic. revision = '0249_another_letter_org' down_revision = '0248_enable_choose_postage' from alembic import op NEW_ORGANISATIONS = [ ('521', 'North Somerset Council', 'north-somerse...
Add letter logo for North Somerset council
Add letter logo for North Somerset council
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -0,0 +1,35 @@ +"""empty message + +Revision ID: 0249_another_letter_org +Revises: 0248_enable_choose_postage + +""" + +# revision identifiers, used by Alembic. +revision = '0249_another_letter_org' +down_revision = '0248_enable_choose_postage' + +from alembic import op + + +NEW_ORGANISATIONS = [ + ('521...
85f179a4d515801c4cfcb35e198efe268959d0ba
test/trainer_test.py
test/trainer_test.py
import theanets import util class TestTrainer(util.MNIST): def setUp(self): super(TestTrainer, self).setUp() self.exp = theanets.Experiment( theanets.Autoencoder, layers=(self.DIGIT_SIZE, 10, self.DIGIT_SIZE)) def assert_progress(self, algo, **kwargs): trainer...
import theanets import util class TestTrainer(util.MNIST): def setUp(self): super(TestTrainer, self).setUp() self.exp = theanets.Experiment( theanets.Autoencoder, layers=(self.DIGIT_SIZE, 10, self.DIGIT_SIZE)) def assert_progress(self, algo, **kwargs): trainer...
Test 1st training loss improves over 0th validation.
Test 1st training loss improves over 0th validation.
Python
mit
devdoer/theanets,chrinide/theanets,lmjohns3/theanets
--- +++ @@ -12,10 +12,8 @@ def assert_progress(self, algo, **kwargs): trainer = self.exp.itertrain(self.images, optimize=algo, **kwargs) - t0, v0 = next(trainer) - t1, v1 = next(trainer) - t2, v2 = next(trainer) - assert t2['loss'] < t0['loss'] + train, valid = next(...
d67f6e9e96352e54e4b23e1740e90d009dac3b36
scripts/generate_match_message.py
scripts/generate_match_message.py
from django.utils import translation from django.template.loader import get_template from bluebottle.activities.tasks import get_matching_activities from bluebottle.members.models import Member import logging from bluebottle.clients.models import Client from bluebottle.clients.utils import LocalTenant from bluebottl...
Add script that generate a message
Add script that generate a message
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
--- +++ @@ -0,0 +1,33 @@ +from django.utils import translation +from django.template.loader import get_template + +from bluebottle.activities.tasks import get_matching_activities +from bluebottle.members.models import Member +import logging + + +from bluebottle.clients.models import Client +from bluebottle.clients.ut...
67cddb074622343bd48ba4ad75bbdbe2d9b042dc
changeFileNameFromID.py
changeFileNameFromID.py
import os import codecs import re EXT = "usfm" SOURCEDIR = "." PROJECT = "OA-GUJ" bk = {"GEN":1, "EXO":2, "LEV":3, "NUM":4, "DEU":5, "JOS":6, "JDG":7, "RUT":8, "1SA":9, "2SA":10, "1KI":11, "2KI":12, "1CH":13, "2CH":14, "EZR":15, "NEH":16, "EST":17, "JOB":18, "PSA":19, "PRO":20, "ECC":21, "SNG":22, "ISA":23, "JE...
Change the name of usfm file according to ID
Change the name of usfm file according to ID This script will change the name of a usfm file according to the ID information. Quite useful when users gives files with unconventional naming system.
Python
mit
beniza/learningPython
--- +++ @@ -0,0 +1,26 @@ +import os +import codecs +import re + +EXT = "usfm" +SOURCEDIR = "." +PROJECT = "OA-GUJ" +bk = {"GEN":1, "EXO":2, "LEV":3, "NUM":4, "DEU":5, "JOS":6, "JDG":7, "RUT":8, "1SA":9, "2SA":10, "1KI":11, "2KI":12, "1CH":13, "2CH":14, "EZR":15, "NEH":16, "EST":17, "JOB":18, "PSA":19, "PRO":20, "ECC"...
0264308667d2b64dbb089d4758258281b7ccbc1f
nlpdemo/lib_confirm_sample/confirm-openpyxl.py
nlpdemo/lib_confirm_sample/confirm-openpyxl.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # from openpyxl import Workbook wb = Workbook() # grab the active worksheet ws = wb.active # Data can be assigned directly to cells ws['A1'] = 42 # Rows can also be appended ws.append([1, 2, 3]) # Python types will automatically be converted import datetime ws['A2'] = ...
Add lib confirm for openpyxl
Add lib confirm for openpyxl
Python
mit
demonstrationch/nlp-demo
--- +++ @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# + +from openpyxl import Workbook +wb = Workbook() + +# grab the active worksheet +ws = wb.active + +# Data can be assigned directly to cells +ws['A1'] = 42 + +# Rows can also be appended +ws.append([1, 2, 3]) + +# Python types will automatica...
bf138c0f268d470336c5f96b467e319b01303048
app/utils/utc.py
app/utils/utc.py
# UTC implementation borrowed from the Python docs: # http://docs.python.org/2/library/datetime.html#tzinfo-objects # License is the same as the example one. from datetime import ( timedelta, tzinfo, ) ZERO = timedelta(0) class UTC(tzinfo): """UTC""" def utcoffset(self, dt): return ZERO ...
Add a simple UTC tzinfo implementation.
Add a simple UTC tzinfo implementation. * Python 2.x does not have any time zone info implemented. By default we will treat time as UTC time, adjustments should be done by the clients. Here we introduce a very simple UTC Python tzinfo class borrowed from the Python docs.
Python
lgpl-2.1
kernelci/kernelci-backend,joyxu/kernelci-backend,joyxu/kernelci-backend,joyxu/kernelci-backend,kernelci/kernelci-backend
--- +++ @@ -0,0 +1,25 @@ +# UTC implementation borrowed from the Python docs: +# http://docs.python.org/2/library/datetime.html#tzinfo-objects +# License is the same as the example one. + +from datetime import ( + timedelta, + tzinfo, +) + +ZERO = timedelta(0) + + +class UTC(tzinfo): + """UTC""" + + def u...
e58bcd886829cc1b38b5f8383b0553136b709ace
.appveyor.test.py
.appveyor.test.py
from dmoj import judgeenv, executors from dmoj.testsuite import Tester from dmoj.utils.ansi import ansi_style required_executors = ['AWK', 'BF', 'C', 'CPP03', 'CPP11', 'CS', 'GO', 'PERL', 'PY2', 'PY3', 'RUBY19', 'RUBY21', 'SED', 'VB'] def main(): judgeenv.load_env(cli=True, testsuite=True)...
Check that all required executors are loaded on AppVeyor
Check that all required executors are loaded on AppVeyor
Python
agpl-3.0
DMOJ/judge,DMOJ/judge,DMOJ/judge
--- +++ @@ -0,0 +1,35 @@ +from dmoj import judgeenv, executors +from dmoj.testsuite import Tester +from dmoj.utils.ansi import ansi_style + + +required_executors = ['AWK', 'BF', 'C', 'CPP03', 'CPP11', 'CS', 'GO', 'PERL', 'PY2', 'PY3', + 'RUBY19', 'RUBY21', 'SED', 'VB'] + + +def main(): + judge...
b33b919a15f335d93229bc80bd0f834ebab0c03d
scripts/python/plot_signal.py
scripts/python/plot_signal.py
""" A script to plot signals """ import sys import os import getopt import json import matplotlib.pyplot as plt CMD_USAGE = """ """ MAX_PLOT_SIZE = 5000 def plot_signal(signal): with open(signal, "rb") as json_file: json_data = json.load(json_file) beacons = json_data['interestedBeacons'] ...
Add script to plot signal figure.
Add script to plot signal figure.
Python
bsd-3-clause
Wayne82/libsvm-practice,Wayne82/libsvm-practice,Wayne82/libsvm-practice
--- +++ @@ -0,0 +1,74 @@ +""" +A script to plot signals +""" +import sys +import os +import getopt +import json +import matplotlib.pyplot as plt +CMD_USAGE = """ + +""" +MAX_PLOT_SIZE = 5000 + + +def plot_signal(signal): + with open(signal, "rb") as json_file: + json_data = json.load(json_file) + bea...
a9507a8187f72cbf77889ee87b01a54f2ed4ffe9
examples/crawler.py
examples/crawler.py
import guv guv.monkey_patch() import requests def get_url(url): print('get_url()') return requests.get(url) def main(): urls = ['http://httpbin.org/delay/1'] * 10 pool = guv.GreenPool() results = pool.imap(get_url, urls) for i, resp in enumerate(results): print('{}: done, length: {}...
Add simple example web cralwer
Add simple example web cralwer
Python
mit
veegee/guv,veegee/guv
--- +++ @@ -0,0 +1,21 @@ +import guv + +guv.monkey_patch() +import requests + +def get_url(url): + print('get_url()') + return requests.get(url) + +def main(): + urls = ['http://httpbin.org/delay/1'] * 10 + + pool = guv.GreenPool() + + results = pool.imap(get_url, urls) + for i, resp in enumerate(re...
4a6eb1059f2321b2e54edc6bb614dca7d06c186f
CodeFights/isIPv4Address.py
CodeFights/isIPv4Address.py
#!/usr/local/bin/python # Code Fights Is IPv4 Address Problem def isIPv4Address(inputString): import re pattern = re.compile(r'^\d{1,3}(?:\.\d{1,3}){3}$') match = re.search(pattern, inputString) if match: segments = inputString.split(".") return sum([int(x) >= 0 and int(x) <= 255 for x...
Solve Code Fights is IPv4 address problem
Solve Code Fights is IPv4 address problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,47 @@ +#!/usr/local/bin/python +# Code Fights Is IPv4 Address Problem + + +def isIPv4Address(inputString): + import re + pattern = re.compile(r'^\d{1,3}(?:\.\d{1,3}){3}$') + match = re.search(pattern, inputString) + if match: + segments = inputString.split(".") + return su...
7205ca43cfb7576b217f34fefebb288545609926
Test/utiltest.py
Test/utiltest.py
import sys sys.path.append("../") import unittest import Algorithmia from Algorithmia.util import getParentAndBase class UtilTest(unittest.TestCase): def test_getParentAndBase(self): self.assertEqual(('a/b', 'c'), getParentAndBase('a/b/c')) self.assertEqual(('a/b', 'c'), getParentAndBase('a/b/c//...
Add some tests for the util getParentAndBase method
Add some tests for the util getParentAndBase method
Python
mit
algorithmiaio/algorithmia-python
--- +++ @@ -0,0 +1,21 @@ +import sys +sys.path.append("../") + +import unittest + +import Algorithmia +from Algorithmia.util import getParentAndBase + +class UtilTest(unittest.TestCase): + def test_getParentAndBase(self): + self.assertEqual(('a/b', 'c'), getParentAndBase('a/b/c')) + self.assertEqual(...
438c6d0b8bea994e9f57b4c480ebcdfd197a0e28
setup.py
setup.py
from setuptools import setup, find_packages import plaid url = 'https://github.com/plaid/plaid-python' setup( name='plaid-python', version=plaid.__version__, description='Simple Python API client for Plaid', long_description='', keywords='api, client, plaid', author='Chris Forrette', auth...
from setuptools import setup, find_packages import plaid url = 'https://github.com/plaid/plaid-python' setup( name='plaid-python', version=plaid.__version__, description='Simple Python API client for Plaid', long_description='', keywords='api, client, plaid', author='Chris Forrette', auth...
Update "Programming Language" Tag to Indicate Python3 Support
Update "Programming Language" Tag to Indicate Python3 Support
Python
mit
erikbern/plaid-python,qwil/plaid-python,plaid/plaid-python
--- +++ @@ -22,6 +22,10 @@ include_package_data=True, classifiers=[ "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", ...
66cf36dc9803443723c824b246ef8c065aba8d86
utils/CIndex/completion_logger_server.py
utils/CIndex/completion_logger_server.py
#!/usr/bin/env python import sys from socket import * from time import localtime, strftime def main(): if len(sys.argv) < 4: print "completion_logger_server.py <listen address> <listen port> <log file>" exit(1) host = sys.argv[1] port = int(sys.argv[2]) buf = 1024 * 8 addr = (host,port) # Creat...
Add simple python server for recording code completion timings.
Add simple python server for recording code completion timings. git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@101327 91177308-0d34-0410-b5e6-96231b3b80d8
Python
apache-2.0
llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/cl...
--- +++ @@ -0,0 +1,39 @@ +#!/usr/bin/env python +import sys +from socket import * +from time import localtime, strftime + +def main(): + if len(sys.argv) < 4: + print "completion_logger_server.py <listen address> <listen port> <log file>" + exit(1) + + host = sys.argv[1] + port = int(sys.argv[2]) + buf = 10...
31fb276ce27375b40e1ac6fe2fd360802cf65f77
tests/test_pm_imagenet.py
tests/test_pm_imagenet.py
import pytest import torch import torch.nn as nn from torch.autograd import Variable import pretrainedmodels as pm import pretrainedmodels.utils as utils pm_args = [] for model_name in pm.model_names: for pretrained in pm.pretrained_settings[model_name]: if pretrained in ['imagenet', 'imagenet+5k']: ...
Add download/forward tests for imagenet pretrainedmodels
Add download/forward tests for imagenet pretrainedmodels
Python
bsd-3-clause
Cadene/pretrained-models.pytorch
--- +++ @@ -0,0 +1,48 @@ +import pytest +import torch +import torch.nn as nn +from torch.autograd import Variable +import pretrainedmodels as pm +import pretrainedmodels.utils as utils + +pm_args = [] +for model_name in pm.model_names: + for pretrained in pm.pretrained_settings[model_name]: + if pretrained ...
c8c737d3763965543e738225d5d435601c50b9b2
bn.py
bn.py
import sys from time import gmtime year, mon, mday, hour, min, sec, wday, yday, isdst = gmtime() bld = ((year - 2000) * 12 + mon - 1) * 100 + mday rev = hour * 100 + min print 'Your build and revision number for today is %d.%d.' % (bld, rev)
Build and revision number script
Build and revision number script
Python
apache-2.0
vasiliy-vdovichenko/ncrontab,youniss2013/ncrontab,amitapl/ncrontab,xingh/ncrontab,devnarayan/ncrontab,paulgmiller/ncrontab,cyotek/ncrontab,IntranetFactory/ncrontab,jakesays/ncrontab,codesharpdev/ncrontab,DanThiffault/ncrontab,paulgmiller/ncrontab,IntranetFactory/ncrontab,micheltol/ncrontab,bjorskog/ncrontab,xingh/ncron...
--- +++ @@ -0,0 +1,6 @@ +import sys +from time import gmtime +year, mon, mday, hour, min, sec, wday, yday, isdst = gmtime() +bld = ((year - 2000) * 12 + mon - 1) * 100 + mday +rev = hour * 100 + min +print 'Your build and revision number for today is %d.%d.' % (bld, rev)
35778c48ba197803e2688732cf11d346838e7b7f
tests/integration/test_sqs.py
tests/integration/test_sqs.py
import os from asyncaws import SQS from tornado.testing import AsyncTestCase, gen_test aws_key_id = os.environ['AWS_ACCESS_KEY_ID'] aws_key_secret = os.environ['AWS_SECRET_ACCESS_KEY'] aws_region = os.environ['AWS_REGION'] class TestSQS(AsyncTestCase): sqs = SQS(aws_key_id, aws_key_secret, aws_region, async=Fals...
Add first integration test for SQS
Add first integration test for SQS
Python
mit
MA3STR0/AsyncAWS
--- +++ @@ -0,0 +1,27 @@ +import os +from asyncaws import SQS +from tornado.testing import AsyncTestCase, gen_test + +aws_key_id = os.environ['AWS_ACCESS_KEY_ID'] +aws_key_secret = os.environ['AWS_SECRET_ACCESS_KEY'] +aws_region = os.environ['AWS_REGION'] + + +class TestSQS(AsyncTestCase): + sqs = SQS(aws_key_id, ...
c29e89b5e5c448e21354c4d5a0cb55b7ca59c4e0
app.py
app.py
import json import tornado.ioloop import tornado.web class MainHandler(tornado.web.RequestHandler): """Handles post requests by responding with a JSON file.""" @tornado.web.asynchronous def post(self): data = json.loads(self.request.body.decode('utf-8')) self.optimize_portfolio(data) ...
Write a tornado server that responds to POST requests.
Write a tornado server that responds to POST requests.
Python
mit
coshx/portfolio_optimizer,coshx/portfolio_optimizer,coshx/portfolio_optimizer,coshx/portfolio_optimizer
--- +++ @@ -0,0 +1,33 @@ +import json + +import tornado.ioloop +import tornado.web + +class MainHandler(tornado.web.RequestHandler): + """Handles post requests by responding with a JSON file.""" + @tornado.web.asynchronous + def post(self): + data = json.loads(self.request.body.decode('utf-8')) + ...