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
479f04ae23227ebb8a3a298d875b73cb1b6de3b6
ceph_deploy/tests/parser/test_rgw.py
ceph_deploy/tests/parser/test_rgw.py
import pytest from ceph_deploy.cli import get_parser class TestParserRGW(object): def setup(self): self.parser = get_parser() def test_rgw_help(self, capsys): with pytest.raises(SystemExit): self.parser.parse_args('rgw --help'.split()) out, err = capsys.readouterr() ...
Add argparse tests for rgw module
[RM-11742] Add argparse tests for rgw module Signed-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>
Python
mit
branto1/ceph-deploy,Vicente-Cheng/ceph-deploy,shenhequnying/ceph-deploy,imzhulei/ceph-deploy,Vicente-Cheng/ceph-deploy,trhoden/ceph-deploy,SUSE/ceph-deploy-to-be-deleted,ceph/ceph-deploy,SUSE/ceph-deploy,zhouyuan/ceph-deploy,imzhulei/ceph-deploy,osynge/ceph-deploy,isyippee/ceph-deploy,ghxandsky/ceph-deploy,shenhequnyin...
--- +++ @@ -0,0 +1,35 @@ +import pytest + +from ceph_deploy.cli import get_parser + + +class TestParserRGW(object): + + def setup(self): + self.parser = get_parser() + + def test_rgw_help(self, capsys): + with pytest.raises(SystemExit): + self.parser.parse_args('rgw --help'.split()) + ...
56ab983036bcb5c78eee91483c1e610da69216d1
kubernetes/client/apis/__init__.py
kubernetes/client/apis/__init__.py
from __future__ import absolute_import import warnings # flake8: noqa # alias kubernetes.client.api package and print deprecation warning from kubernetes.client.api import * warnings.filterwarnings('default', module='kubernetes.client.apis') warnings.warn( "The package kubernetes.client.apis is renamed and depre...
Add kubernetes.client.apis as an alias to kubernetes.client.api
Add kubernetes.client.apis as an alias to kubernetes.client.api Reference: https://github.com/kubernetes-client/python/issues/974 Signed-off-by: Nabarun Pal <46a782cbd1e9f752958998187886c2b51fda054c@gmail.com>
Python
apache-2.0
kubernetes-client/python,kubernetes-client/python
--- +++ @@ -0,0 +1,13 @@ +from __future__ import absolute_import +import warnings + +# flake8: noqa + +# alias kubernetes.client.api package and print deprecation warning +from kubernetes.client.api import * + +warnings.filterwarnings('default', module='kubernetes.client.apis') +warnings.warn( + "The package kuber...
ad2b0447afbee92684ab0b4f14dc0d45a28f3ba2
tests/foomodulegen-auto.py
tests/foomodulegen-auto.py
#! /usr/bin/env python import sys import re import pybindgen from pybindgen.typehandlers import base as typehandlers from pybindgen import (ReturnValue, Parameter, Module, Function, FileCodeSink) from pybindgen import (CppMethod, CppConstructor, CppClass, Enum) from pybindgen.gccxmlparser import ModuleParser from pyb...
#! /usr/bin/env python import sys import re import pybindgen from pybindgen.typehandlers import base as typehandlers from pybindgen import (ReturnValue, Parameter, Module, Function, FileCodeSink) from pybindgen import (CppMethod, CppConstructor, CppClass, Enum) from pybindgen.gccxmlparser import ModuleParser from pyb...
Add a debug switch (-d) to enable debugger
Add a debug switch (-d) to enable debugger
Python
lgpl-2.1
cawka/pybindgen,caramucho/pybindgen,caramucho/pybindgen,cawka/pybindgen,cawka/pybindgen,caramucho/pybindgen,cawka/pybindgen,caramucho/pybindgen
--- +++ @@ -25,12 +25,21 @@ module.generate(out) -if __name__ == '__main__': - try: - import cProfile as profile - except ImportError: +def main(): + if sys.argv[1] == '-d': + del sys.argv[1] + import pdb + pdb.set_trace() my_module_gen() else: - prin...
cec400d28be8a3868f3a52fb5cbd27d63b31bbea
tests/test_nowallet.py
tests/test_nowallet.py
import pytest import nowallet.nowallet as nowallet @pytest.fixture def dummy_connection(event_loop): server, port = 'hsmithsxurybd7uh.onion', 53011 return nowallet.Connection(event_loop, server, port) @pytest.fixture def dummy_wallet(event_loop, dummy_connection): salt = "CORRECT HORSE" password = "BA...
Add initial fixtures for testing nowallet.py.
Add initial fixtures for testing nowallet.py.
Python
mit
metamarcdw/nowallet
--- +++ @@ -0,0 +1,18 @@ +import pytest +import nowallet.nowallet as nowallet + +@pytest.fixture +def dummy_connection(event_loop): + server, port = 'hsmithsxurybd7uh.onion', 53011 + return nowallet.Connection(event_loop, server, port) + +@pytest.fixture +def dummy_wallet(event_loop, dummy_connection): + sal...
8008a05fe59503d99a2141f14fcbb89f0d80322c
tests/test_selected.py
tests/test_selected.py
from tests.base import IntegrationTest from time import sleep class TestAnnotateAction(IntegrationTest): viminput = """ * [ ] test task 1 #{uuid} * [ ] test task 2 #{uuid} """ tasks = [ dict(description="test task 1"), dict(description="test task 2"), ] def execute(sel...
Add tests for TaskWikiAnnotation command
test: Add tests for TaskWikiAnnotation command
Python
mit
phha/taskwiki,Spirotot/taskwiki
--- +++ @@ -0,0 +1,82 @@ +from tests.base import IntegrationTest +from time import sleep + + +class TestAnnotateAction(IntegrationTest): + + viminput = """ + * [ ] test task 1 #{uuid} + * [ ] test task 2 #{uuid} + """ + + tasks = [ + dict(description="test task 1"), + dict(description="...
5b18671bfe64ab6a6f29465a40ffcdb372633ea6
data/migrations/update-wof-l10n.py
data/migrations/update-wof-l10n.py
# This expects a local checkout of whos on first data. It will fetch # the data from the on disk location for all existing neighbourhoods # in the database, and generate updates for all neighbourhoods that # have other local names. from tilequeue.wof import make_wof_filesystem_neighbourhood_fetcher from tilequeue.wof ...
Add migration for wof l10n names
Add migration for wof l10n names
Python
mit
mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource
--- +++ @@ -0,0 +1,51 @@ +# This expects a local checkout of whos on first data. It will fetch +# the data from the on disk location for all existing neighbourhoods +# in the database, and generate updates for all neighbourhoods that +# have other local names. + +from tilequeue.wof import make_wof_filesystem_neighbou...
f2afa4c6666b1dc5105bd575d2e93ff691fe1f4c
compare_patches.py
compare_patches.py
import re import sys def ParsePatch(filename): lines = [line.rstrip('\n') for line in open(filename, 'r')] def MatchChar(char): def M(line): if line.startswith(char): return line[1:] return None return M def Matches(i, func): got = [] while i < len(lines): m = func(l...
Add initial version of tool to compare two patches
Add initial version of tool to compare two patches This doesn't track the filenames that patch hunks apply to yet. It also ignores patch hunks' contexts.
Python
bsd-3-clause
mseaborn/compare-patches
--- +++ @@ -0,0 +1,77 @@ + +import re +import sys + + +def ParsePatch(filename): + lines = [line.rstrip('\n') for line in open(filename, 'r')] + + def MatchChar(char): + def M(line): + if line.startswith(char): + return line[1:] + return None + return M + + def Matches(i, func): + got = [...
353a4c4758339b559fcfe70c5fdc7659f9f13560
examples/find-duplicated-contacts.py
examples/find-duplicated-contacts.py
#! /usr/bin/env python # -*- coding: utf-8 -*- """ Find components defining more than one contact with the same role. In older versions of PDC, it was possible to have multiple contacts with the same role. When limits for cardinality of this relationship were introduced, we need to find all components that would not ...
Add example script to find components with duplicate contacts
Add example script to find components with duplicate contacts While this script is not terribly useful for day-to-day life, it can serve as an example on how to use the client. JIRA: PDC-1105
Python
mit
xychu/product-definition-center,product-definition-center/product-definition-center,product-definition-center/product-definition-center,lao605/product-definition-center,lao605/product-definition-center,lao605/product-definition-center,xychu/product-definition-center,xychu/product-definition-center,tzhaoredhat/automatio...
--- +++ @@ -0,0 +1,35 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Find components defining more than one contact with the same role. + +In older versions of PDC, it was possible to have multiple contacts with the +same role. When limits for cardinality of this relationship were introduced, we +need to...
60e879d37f691132c23efb12f9709223f69354f5
examples/ideal-helices/test_cases.py
examples/ideal-helices/test_cases.py
#!/usr/bin/env ccp4-python ''' Created on 29 Dec 2015 @author: jmht ''' import cPickle import os import sys AMPLE_DIR = os.sep.join(os.path.abspath(os.path.dirname(__file__)).split(os.sep)[ :-2 ]) sys.path.append(os.path.join(AMPLE_DIR,'python')) import test_funcs test_dict = {} ###################################...
Test case for ideal helices
Test case for ideal helices
Python
bsd-3-clause
linucks/ample,rigdenlab/ample,rigdenlab/ample,linucks/ample
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/env ccp4-python +''' +Created on 29 Dec 2015 + +@author: jmht +''' + +import cPickle +import os +import sys + +AMPLE_DIR = os.sep.join(os.path.abspath(os.path.dirname(__file__)).split(os.sep)[ :-2 ]) +sys.path.append(os.path.join(AMPLE_DIR,'python')) +import test_funcs + +test_dic...
9342e0f699c97f94274d30040b178484bbafff94
mpld3/test_plots/test_date_ticks.py
mpld3/test_plots/test_date_ticks.py
"""Plot to test custom date axis tick locations and labels""" from datetime import datetime import matplotlib.pyplot as plt import mpld3 def create_plot(): times = [datetime(2013, 12, i) for i in range(1,9)] ticks = [times[2],times[3],times[-2]] labels = [t.strftime("%Y-%m-%d") for t in ticks] plt.plo...
Add test plot for custom date ticks
Add test plot for custom date ticks
Python
bsd-3-clause
jakevdp/mpld3,aflaxman/mpld3,jakevdp/mpld3,etgalloway/mpld3,e-koch/mpld3,kdheepak89/mpld3,etgalloway/mpld3,aflaxman/mpld3,e-koch/mpld3,kdheepak89/mpld3,mpld3/mpld3,mpld3/mpld3
--- +++ @@ -0,0 +1,25 @@ +"""Plot to test custom date axis tick locations and labels""" +from datetime import datetime +import matplotlib.pyplot as plt +import mpld3 + +def create_plot(): + times = [datetime(2013, 12, i) for i in range(1,9)] + ticks = [times[2],times[3],times[-2]] + labels = [t.strftime("%Y-...
845cc0cb8acc28d328a89af77cddb59af666f2d0
examples/plot_implied_timescales.py
examples/plot_implied_timescales.py
""" Implied Timescales Plot =============== """ from msmbuilder.example_datasets import FsPeptide from msmbuilder.featurizer import DihedralFeaturizer from msmbuilder.decomposition import tICA from msmbuilder.cluster import MiniBatchKMeans from msmbuilder.msm import MarkovStateModel import numpy as np import msmexplo...
Add example of Implied Timescales Plot
Add example of Implied Timescales Plot
Python
mit
msmexplorer/msmexplorer,msmexplorer/msmexplorer
--- +++ @@ -0,0 +1,44 @@ +""" +Implied Timescales Plot +=============== +""" +from msmbuilder.example_datasets import FsPeptide +from msmbuilder.featurizer import DihedralFeaturizer +from msmbuilder.decomposition import tICA +from msmbuilder.cluster import MiniBatchKMeans +from msmbuilder.msm import MarkovStateModel ...
79a1f426e22f3c213bbb081f4ca23ccf1a6f61d7
openedx/core/djangoapps/content/block_structure/migrations/0005_trim_leading_slashes_in_data_path.py
openedx/core/djangoapps/content/block_structure/migrations/0005_trim_leading_slashes_in_data_path.py
""" Data migration to convert absolute paths in block_structure.data to be relative. This has only been tested with MySQL, though it should also work for Postgres as well. This is necessary to manually correct absolute paths in the "data" field of the block_structure table. For S3 storage, having a path that starts wi...
Convert block_structure.data to relative paths (TNL-8335)
fix: Convert block_structure.data to relative paths (TNL-8335) In order to upgrade to Django > 2.2.20, we can't continue to use absolute paths in the block_structure's data FileField. This used to work for S3, but it will not work going forward due to a security fix in Django 2.2.21. This data migration will remove t...
Python
agpl-3.0
eduNEXT/edunext-platform,eduNEXT/edunext-platform,eduNEXT/edunext-platform,eduNEXT/edunext-platform
--- +++ @@ -0,0 +1,46 @@ +""" +Data migration to convert absolute paths in block_structure.data to be relative. + +This has only been tested with MySQL, though it should also work for Postgres as +well. This is necessary to manually correct absolute paths in the "data" field +of the block_structure table. For S3 stor...
079b9f0856e7574c3df10ad5e847b5812f6a2ca8
filter-dictionary/exclude-words.py
filter-dictionary/exclude-words.py
#!/usr/bin/env python3 # # Reads a dictionary and a file that contains a list of words that should be # removed. Then prints the dictionary with those words excluded. import argparse import sys import codecs from pronunciationdictionary import PronunciationDictionary from filetypes import TextFileType, BinaryFileType ...
Remove listed files from a pronunciation dictionary.
Remove listed files from a pronunciation dictionary.
Python
apache-2.0
senarvi/senarvi-speech
--- +++ @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 +# +# Reads a dictionary and a file that contains a list of words that should be +# removed. Then prints the dictionary with those words excluded. + +import argparse +import sys +import codecs +from pronunciationdictionary import PronunciationDictionary +from filetypes...
197e6d0270803b8f32ae934def4cade29afab997
metpy/plots/tests/test_wx_symbols.py
metpy/plots/tests/test_wx_symbols.py
# Copyright (c) 2008-2015 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause from metpy.plots.wx_symbols import current_weather def test_mapper(): 'Test for symbol mapping functionality' assert current_weather(0) == '' assert current_weathe...
Add tests for weather symbol mapping.
Add tests for weather symbol mapping.
Python
bsd-3-clause
Unidata/MetPy,jrleeman/MetPy,ahill818/MetPy,ahaberlie/MetPy,jrleeman/MetPy,ahaberlie/MetPy,dopplershift/MetPy,Unidata/MetPy,ShawnMurd/MetPy,dopplershift/MetPy,deeplycloudy/MetPy
--- +++ @@ -0,0 +1,18 @@ +# Copyright (c) 2008-2015 MetPy Developers. +# Distributed under the terms of the BSD 3-Clause License. +# SPDX-License-Identifier: BSD-3-Clause +from metpy.plots.wx_symbols import current_weather + + +def test_mapper(): + 'Test for symbol mapping functionality' + assert current_weathe...
0e8a1ce04d230d04cb36098fe53ccd5c239bbd54
mnist/tensorflow/fgsm_adversarial.py
mnist/tensorflow/fgsm_adversarial.py
from tensorflow.examples.tutorials.mnist import input_data import tensorflow as tf import argparse import matplotlib.pyplot as pyplot import random from feedforward_ann import neural_network, SAVE_PATH def fgsm(x, y_true, y_hat, epsilon=0.075): loss = tf.nn.softmax_cross_entropy_with_logits( labels=y_...
Add simple FGSM adversarial example crafting
Add simple FGSM adversarial example crafting
Python
apache-2.0
BrandonLMorris/ml-examples
--- +++ @@ -0,0 +1,60 @@ +from tensorflow.examples.tutorials.mnist import input_data +import tensorflow as tf +import argparse +import matplotlib.pyplot as pyplot +import random + +from feedforward_ann import neural_network, SAVE_PATH + +def fgsm(x, y_true, y_hat, epsilon=0.075): + loss = tf.nn.softmax_cross_entro...
d812af8535605ff963c3d3e3be1528dc615d5987
tests/test_async.py
tests/test_async.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com> # # This file is part of subliminal. # # subliminal is free software; you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by # the Free Software Foundatio...
Add a unittest for async
Add a unittest for async
Python
mit
t4lwh/subliminal,hpsbranco/subliminal,neo1691/subliminal,goll/subliminal,Diaoul/subliminal,juanmhidalgo/subliminal,SickRage/subliminal,Elettronik/subliminal,nvbn/subliminal,pums974/subliminal,oxan/subliminal,fernandog/subliminal,bogdal/subliminal,ofir123/subliminal,kbkailashbagaria/subliminal,ravselj/subliminal,ratoaq2...
--- +++ @@ -0,0 +1,37 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com> +# +# This file is part of subliminal. +# +# subliminal is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as publish...
03188fe77f895b918dbbf3903a5eea8eb5256cd0
evaluation/packages/primitive.py
evaluation/packages/primitive.py
"""@package Primitive This module is the Python counterpart of the C++ LinePrimitive and and PlanePrimitive classes See C++ GlobOpt project for more details on Primitives """ import numpy as np class Primitive(object): def __init__(self, uid, did, pos=np.zeros(...
Add new Primitive class + loading function to load Primitive arrays from file
Add new Primitive class + loading function to load Primitive arrays from file
Python
apache-2.0
amonszpart/globOpt,amonszpart/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,NUAAXXY/globOpt,NUAAXXY/globOpt,NUAAXXY/globOpt
--- +++ @@ -0,0 +1,40 @@ +"""@package Primitive +This module is the Python counterpart of the C++ LinePrimitive and and PlanePrimitive classes + +See C++ GlobOpt project for more details on Primitives +""" +import numpy as np + +class Primitive(object): + + def __init__(self, + uid, + ...
139db56d67ff7f0e1761c303e0074d713f25d646
gpi/Poisson_GPI.py
gpi/Poisson_GPI.py
# Author: Ashley Anderson III <aganders3@gmail.com> # Date: 2015-10-10 19:37 # Copyright (C) 2015 Dignity Health from __future__ import absolute_import, division, print_function, unicode_literals import os # gpi, future import gpi from bart.gpi.borg import IFilePath, OFilePath, Command # bart import bart base_path ...
Add Poission node - generates Poisson-disc sampling pattern
Add Poission node - generates Poisson-disc sampling pattern
Python
bsd-3-clause
nckz/bart,nckz/bart,nckz/bart,nckz/bart,nckz/bart
--- +++ @@ -0,0 +1,79 @@ +# Author: Ashley Anderson III <aganders3@gmail.com> +# Date: 2015-10-10 19:37 +# Copyright (C) 2015 Dignity Health + +from __future__ import absolute_import, division, print_function, unicode_literals + +import os + +# gpi, future +import gpi +from bart.gpi.borg import IFilePath, OFilePath, ...
393309ed43fbf852a698fe7dcd763d282a761590
src/pluggy/_result.py
src/pluggy/_result.py
""" Hook wrapper "result" utilities. """ import sys import warnings _py3 = sys.version_info > (3, 0) if not _py3: exec( """ def _reraise(cls, val, tb): raise cls, val, tb """ ) def _raise_wrapfail(wrap_controller, msg): co = wrap_controller.gi_code raise RuntimeError( "wrap_cont...
Move wrapper "result" types into new module
Move wrapper "result" types into new module
Python
mit
RonnyPfannschmidt/pluggy,RonnyPfannschmidt/pluggy,hpk42/pluggy,pytest-dev/pluggy,pytest-dev/pluggy
--- +++ @@ -0,0 +1,81 @@ +""" +Hook wrapper "result" utilities. +""" +import sys +import warnings + +_py3 = sys.version_info > (3, 0) + + +if not _py3: + exec( + """ +def _reraise(cls, val, tb): + raise cls, val, tb +""" + ) + + +def _raise_wrapfail(wrap_controller, msg): + co = wrap_controller.gi_...
50e588ff368ce3ccd269f432ee543bd022a4ab22
polyaxon/auditor/events/superuser.py
polyaxon/auditor/events/superuser.py
import auditor from libs.event_manager import event_types from libs.event_manager.event import Event class SuperUserRoleGrantedEvent(Event): type = event_types.SUPERUSER_ROLE_GRANTED class SuperUserRoleRevokedEvent(Event): type = event_types.SUPERUSER_ROLE_REVOKED auditor.register(SuperUserRoleGrantedEven...
Add auditor super user's events
Add auditor super user's events
Python
apache-2.0
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
--- +++ @@ -0,0 +1,15 @@ +import auditor +from libs.event_manager import event_types +from libs.event_manager.event import Event + + +class SuperUserRoleGrantedEvent(Event): + type = event_types.SUPERUSER_ROLE_GRANTED + + +class SuperUserRoleRevokedEvent(Event): + type = event_types.SUPERUSER_ROLE_REVOKED + + +...
1d7660282be42d96d912855eeb3bd4dfe830f224
bitvault/test/scripts/client_usage.py
bitvault/test/scripts/client_usage.py
import time import bitvault current_milli_time = lambda: int(round(time.time())) email = '{0}@bitvault.io'.format(current_milli_time()) password = u'incredibly_secure' ## API discovery # # The BitVault server provides a JSON description of its API that allows # the client to generate all necessary resource classes ...
Add high-level client usage script
Add high-level client usage script
Python
mit
GemHQ/round-py
--- +++ @@ -0,0 +1,108 @@ +import time + +import bitvault + + +current_milli_time = lambda: int(round(time.time())) +email = '{0}@bitvault.io'.format(current_milli_time()) +password = u'incredibly_secure' + +## API discovery +# +# The BitVault server provides a JSON description of its API that allows +# the client to...
bda490f0e27b49d54ca7fa71e8725dcdf9da0861
registration/tests/test_provision.py
registration/tests/test_provision.py
# -*- coding: utf-8 -*- # # OpenCraft -- tools to aid developing and hosting free software projects # Copyright (C) 2015 OpenCraft <xavier@opencraft.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Soft...
Add unit test for beta test instance provisioning.
Add unit test for beta test instance provisioning.
Python
agpl-3.0
open-craft/opencraft,open-craft/opencraft,open-craft/opencraft,open-craft/opencraft,open-craft/opencraft
--- +++ @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# +# OpenCraft -- tools to aid developing and hosting free software projects +# Copyright (C) 2015 OpenCraft <xavier@opencraft.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public Licen...
dc09ffa8abd791af99dfc28bced6aa33c46308f8
Python_Data/smpl3.py
Python_Data/smpl3.py
from random import randint as rndInt def main(): l = list([rndInt(1,100) for x in range(rndInt(5,900))]) # min_1(l) # min_2(l) # Simple O(n²) def min_1(list): minOut = list[0] for i in list: minLoc = i for j in list: if j < minLoc: minLoc = j if ...
Add very simple algorithm for teaching purposes about the big O notation
Add very simple algorithm for teaching purposes about the big O notation
Python
unlicense
robotenique/RandomAccessMemory,robotenique/RandomAccessMemory,robotenique/RandomAccessMemory
--- +++ @@ -0,0 +1,29 @@ +from random import randint as rndInt + +def main(): + l = list([rndInt(1,100) for x in range(rndInt(5,900))]) + # min_1(l) + # min_2(l) + +# Simple O(n²) +def min_1(list): + minOut = list[0] + for i in list: + minLoc = i + for j in list: + if j < minLo...
6c7d6881751784e30324795394abfb8fc3eb75a8
demo/amqp_clock.py
demo/amqp_clock.py
#!/usr/bin/env python """ AMQP Clock Fires off simple messages at one-minute intervals to a topic exchange named 'clock', with the topic of the message being the local time as 'year.month.date.dow.hour.minute', for example: '2007.11.26.1.12.33', where the dow (day of week) is 0 for Sunday, 1 for Monday, and so on (sim...
Add another demo program, one that spits out messages at regular intervals.
Add another demo program, one that spits out messages at regular intervals.
Python
lgpl-2.1
kmonsoor/py-amqplib,ebin123456/py-amqplib,jaknight/py-amqplib,barryp/py-amqplib
--- +++ @@ -0,0 +1,70 @@ +#!/usr/bin/env python +""" +AMQP Clock + +Fires off simple messages at one-minute intervals to a topic +exchange named 'clock', with the topic of the message being +the local time as 'year.month.date.dow.hour.minute', +for example: '2007.11.26.1.12.33', where the dow (day of week) +is 0 for ...
4f4636a04b01ee0ebe45c55c98328540be13e990
napper_memaslap.py
napper_memaslap.py
import sys, socket, time, logging import shlex, subprocess from kazoo.client import KazooClient from kazoo.exceptions import NodeExistsError def zkConnect(conn_str): zk = KazooClient(hosts=conn_str) zk.start() return zk def zkCreateJobDir(zk, job_name): zk.ensure_path("/napper/memaslap/%s" % (job_name)) def ...
Add wrapper for memaslap load tester.
Add wrapper for memaslap load tester.
Python
mit
ms705/napper
--- +++ @@ -0,0 +1,55 @@ +import sys, socket, time, logging +import shlex, subprocess +from kazoo.client import KazooClient +from kazoo.exceptions import NodeExistsError + +def zkConnect(conn_str): + zk = KazooClient(hosts=conn_str) + zk.start() + return zk + +def zkCreateJobDir(zk, job_name): + zk.ensure_path("/...
9c307606152fc28a7d017c39d8621433e6485034
scripts/contrib/inject_s2s_config.py
scripts/contrib/inject_s2s_config.py
#!/usr/bin/env python from __future__ import print_function import sys import argparse import numpy as np import json import yaml DESC = "Adds special node including s2s options to Nematus model.npz file." S2S_SPECIAL_NODE = "special:model.yml" def main(): args = parse_args() print("Loading config {}".fo...
Add script injecting s2s options to nematus .npz models
Add script injecting s2s options to nematus .npz models
Python
mit
marian-nmt/marian-train,emjotde/amunmt,emjotde/amunmt,marian-nmt/marian-train,emjotde/amunn,emjotde/amunmt,amunmt/marian,emjotde/amunmt,emjotde/amunn,marian-nmt/marian-train,marian-nmt/marian-train,emjotde/amunn,amunmt/marian,emjotde/amunn,amunmt/marian,marian-nmt/marian-train,emjotde/Marian,emjotde/Marian
--- +++ @@ -0,0 +1,75 @@ +#!/usr/bin/env python + +from __future__ import print_function + +import sys +import argparse +import numpy as np +import json +import yaml + + +DESC = "Adds special node including s2s options to Nematus model.npz file." +S2S_SPECIAL_NODE = "special:model.yml" + + +def main(): + args = pa...
9ed64ddd0f5ca8ec035b53b0a699ec721e6206d9
screen_manager_test.py
screen_manager_test.py
from kivy.app import App from kivy.lang import Builder from kivy.uix.floatlayout import FloatLayout # Example from http://robertour.com/category/kivy/page/2/ Builder.load_string(""" #:import FadeTransition kivy.uix.screenmanager.FadeTransition <Phone>: AnchorLayout: anchor_x: 'right' anchor_y: ...
Add test-app which uses screen-manager
Add test-app which uses screen-manager
Python
apache-2.0
ThomasHangstoerfer/pyHomeCtrl
--- +++ @@ -0,0 +1,109 @@ + +from kivy.app import App +from kivy.lang import Builder +from kivy.uix.floatlayout import FloatLayout + +# Example from http://robertour.com/category/kivy/page/2/ + +Builder.load_string(""" + +#:import FadeTransition kivy.uix.screenmanager.FadeTransition + +<Phone>: + AnchorLayout: + ...
f928624343e04d1010bb7429a47a8f13032a9fea
cli.py
cli.py
#!/bin/python import argparse def parse_args(): parser = argparse.ArgumentParser() group_actions = parser.add_mutually_exclusive_group() group_actions.add_argument( "-r", "--remove", help="removes a note", action="store_true") group_actions.add_argument( "-m", "--modify", help="modif...
Add argument parser to takenote
Add argument parser to takenote
Python
mit
nocternology/takenote
--- +++ @@ -0,0 +1,27 @@ +#!/bin/python + +import argparse + + +def parse_args(): + parser = argparse.ArgumentParser() + group_actions = parser.add_mutually_exclusive_group() + + group_actions.add_argument( + "-r", "--remove", help="removes a note", action="store_true") + group_actions.add_argument...
181e8e9375c13e8759539bb84171fce015fff66e
tools/text2stercus.py
tools/text2stercus.py
#!/usr/bin/env python import argparse def parse(text): stercus = '' for char in text: stercus += str(ord(char)) + ' . ' return stercus def main(): parser = argparse.ArgumentParser() parser.add_argument('text') args = parser.parse_args() print parse(args.text) if __name__ == '__ma...
Add convenience tool for converting string to stercus.
Add convenience tool for converting string to stercus.
Python
mit
adamheins/stercus
--- +++ @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +import argparse + +def parse(text): + stercus = '' + for char in text: + stercus += str(ord(char)) + ' . ' + return stercus + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('text') + args = parser.parse_args() + pr...
4e876b59745a67cf1fbcbaacf1ca1675c3e1946a
onetime/models.py
onetime/models.py
from django.db import models from django.contrib.auth.models import User class Key(models.Model): user = models.ForeignKey(User) key = models.CharField(max_length=40) created = models.DateTimeField(auto_now_add=True) usage_left = models.IntegerField(null=True, default=1) expires = models.DateTimeFi...
from datetime import datetime from django.db import models from django.contrib.auth.models import User class Key(models.Model): user = models.ForeignKey(User) key = models.CharField(max_length=40) created = models.DateTimeField(auto_now_add=True) usage_left = models.IntegerField(null=True, default=1) ...
Add validation and usage logics into the model
Add validation and usage logics into the model
Python
agpl-3.0
ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,uploadcare/django-loginurl,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,fajran/django-loginurl,vanschelven/cmsplugin-journal,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-web...
--- +++ @@ -1,3 +1,5 @@ +from datetime import datetime + from django.db import models from django.contrib.auth.models import User @@ -9,3 +11,18 @@ expires = models.DateTimeField(null=True) next = models.CharField(null=True, max_length=200) + def __unicode__(self): + return '%s (%s)' % (self...
5c2c1deacaa4a237e20d30ca4040a537a6381b9b
person/migrations/0009_auto_20200501_1504.py
person/migrations/0009_auto_20200501_1504.py
# Generated by Django 2.2.12 on 2020-05-01 13:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('person', '0008_person_datetime_updated'), ] operations = [ migrations.AlterField( model_name='person', name='forena...
Add migration for updated person fields
Add migration for updated person fields
Python
mit
openkamer/openkamer,openkamer/openkamer,openkamer/openkamer,openkamer/openkamer
--- +++ @@ -0,0 +1,23 @@ +# Generated by Django 2.2.12 on 2020-05-01 13:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('person', '0008_person_datetime_updated'), + ] + + operations = [ + migrations.AlterField( + mode...
82a377e3d531543d4640bd595745e91b7f8f5c3f
sparqllib/querycomponent/tests/test_group.py
sparqllib/querycomponent/tests/test_group.py
import unittest import sparqllib from rdflib import BNode, Literal class TestGroup(unittest.TestCase): def setUp(self): self.group = sparqllib.querycomponent.Group() def test_add(self): self.assertEqual(self.group.components, []) triple = (BNode("subject"), BNode("relation"), Literal(...
Add tests for Group query component
Add tests for Group query component
Python
mit
ALSchwalm/sparqllib
--- +++ @@ -0,0 +1,23 @@ + +import unittest +import sparqllib +from rdflib import BNode, Literal + +class TestGroup(unittest.TestCase): + def setUp(self): + self.group = sparqllib.querycomponent.Group() + + def test_add(self): + self.assertEqual(self.group.components, []) + triple = (BNode(...
f28e380b504596aa41245cb10eebebceae67d831
bin/brut-net.py
bin/brut-net.py
#!/usr/bin/env python3 """Converti un salaire brut annuel en un salaire net mensuel.""" import optparse def main(): p = optparse.OptionParser(description=__doc__) options, arguments = p.parse_args() annuel_brut = int(arguments[0]) mensuel_net = (annuel_brut - (annuel_brut * 23 / 100)) / 12 print(...
Add new program to convert gross to net salary
Add new program to convert gross to net salary
Python
mit
mlcdf/dotfiles,mlcdf/dotfiles,mlcdf/dotfiles
--- +++ @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +"""Converti un salaire brut annuel en un salaire net mensuel.""" + +import optparse + + +def main(): + p = optparse.OptionParser(description=__doc__) + options, arguments = p.parse_args() + annuel_brut = int(arguments[0]) + mensuel_net = (annuel_brut - (an...
ccdb1b2f87c700e283b2ca51aa94408027561b0d
api.py
api.py
import json from django.conf.urls import url from django.db.models import ObjectDoesNotExist from django.http import Http404, HttpResponse from django.utils.decorators import classonlymethod from django.views import generic from django.views.decorators.csrf import csrf_exempt class Resource(generic.View): """ ...
Add a really simple resource as beginning of a custom API implementation
Add a really simple resource as beginning of a custom API implementation
Python
bsd-3-clause
matthiask/towel,matthiask/towel,matthiask/towel,matthiask/towel
--- +++ @@ -0,0 +1,100 @@ +import json + +from django.conf.urls import url +from django.db.models import ObjectDoesNotExist +from django.http import Http404, HttpResponse +from django.utils.decorators import classonlymethod +from django.views import generic +from django.views.decorators.csrf import csrf_exempt + + +c...
8461b21cf4b538f2ec46a9a9b6674eff9072e84d
cli.py
cli.py
#!/usr/bin/env python import sys from pprint import pprint from argparse import ArgumentParser from minecraft_query import MinecraftQuery def main(): parser = ArgumentParser(description="Query status of Minecraft multiplayer server", epilog="Exit status: 0 if the server can be reached...
Add friendly and scriptable CLI
Add friendly and scriptable CLI
Python
apache-2.0
CloudBotIRC/mcstatus,Trax-/mcstatus
--- +++ @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +import sys +from pprint import pprint +from argparse import ArgumentParser + +from minecraft_query import MinecraftQuery + +def main(): + parser = ArgumentParser(description="Query status of Minecraft multiplayer server", + epilog="Exit ...
cd2f9ec0c8ffbdfda4620b9edf57ab839b286ddf
bluebottle/funding_stripe/migrations/0004_auto_20200318_1504.py
bluebottle/funding_stripe/migrations/0004_auto_20200318_1504.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2020-03-18 14:04 from __future__ import unicode_literals from django.db import migrations from bluebottle.funding_stripe.models import get_specs def set_eventually_due(apps, schema_editor): Account = apps.get_model('funding_stripe', 'StripePayoutAccount') ...
Add eventually_due fields in migration
Add eventually_due fields in migration
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
--- +++ @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.15 on 2020-03-18 14:04 +from __future__ import unicode_literals + +from django.db import migrations +from bluebottle.funding_stripe.models import get_specs + + +def set_eventually_due(apps, schema_editor): + Account = apps.get_model('fun...
46883c5c0de8cf00e75654ae2e577ddc404c8b27
api/bots/giphy/test_giphy.py
api/bots/giphy/test_giphy.py
#!/usr/bin/env python from __future__ import absolute_import from __future__ import print_function import os import sys import json our_dir = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, os.path.normpath(os.path.join(our_dir))) # For dev setups, we can find the API in the repo itself. if os.path.exi...
Add test file for 'giphy' bot.
bots: Add test file for 'giphy' bot. This bot replies with different gif for the same query that is provided. Mocked a definite response from requests.get function.
Python
apache-2.0
hackerkid/zulip,jackrzhang/zulip,eeshangarg/zulip,brainwane/zulip,vaidap/zulip,timabbott/zulip,vabs22/zulip,shubhamdhama/zulip,mahim97/zulip,eeshangarg/zulip,brockwhittaker/zulip,vaidap/zulip,showell/zulip,rht/zulip,eeshangarg/zulip,brainwane/zulip,rht/zulip,showell/zulip,dhcrzf/zulip,rishig/zulip,verma-varsha/zulip,sh...
--- +++ @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +from __future__ import absolute_import +from __future__ import print_function + +import os +import sys +import json + +our_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.normpath(os.path.join(our_dir))) +# For dev setups, we can find the...
7ac056c7db746f397c58cfa6ba4924830bf8b624
aplpy/tests/test_wcs_util.py
aplpy/tests/test_wcs_util.py
import os import numpy as np from astropy.io import fits from astropy.tests.helper import pytest from ..wcs_util import WCS, celestial_pixel_scale, non_celestial_pixel_scales from .helpers import generate_wcs HEADER_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data') HEADER_2D = fits.Header.fromt...
Add regression tests for pixel scale
Add regression tests for pixel scale
Python
mit
allisony/aplpy,mwcraig/aplpy
--- +++ @@ -0,0 +1,49 @@ +import os + +import numpy as np +from astropy.io import fits +from astropy.tests.helper import pytest + +from ..wcs_util import WCS, celestial_pixel_scale, non_celestial_pixel_scales + +from .helpers import generate_wcs + +HEADER_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)),...
7a3c95e5e2db3555664c0e9737032768df4940b2
phantomas/test/test_format_args.py
phantomas/test/test_format_args.py
""" Set of unit tests for helper functions """ import unittest from phantomas import Phantomas class FormatArgsTestClass(unittest.TestCase): def test_format_args(self): self.assertEqual(Phantomas.format_args(dict()), []) self.assertEqual(Phantomas.format_args(dict(foo="bar")), ['--foo=bar']) ...
Add unit tests for Phantomas.format_args
Add unit tests for Phantomas.format_args
Python
bsd-3-clause
macbre/phantomas-python,macbre/phantomas-python
--- +++ @@ -0,0 +1,15 @@ +""" +Set of unit tests for helper functions +""" +import unittest + +from phantomas import Phantomas + + +class FormatArgsTestClass(unittest.TestCase): + def test_format_args(self): + self.assertEqual(Phantomas.format_args(dict()), []) + self.assertEqual(Phantomas.format_arg...
f7aa9e986abd9fb55cb72ac4661f319a867e059d
scripts/ms_jsfs.py
scripts/ms_jsfs.py
#!/usr/bin/env python """ Convert the output of ms to an N-dimensional frequency spectrum. """ import sys import dadi if __name__ == '__main__': average = ('-av' in sys.argv) input = sys.stdin output = sys.stdout sfs,header = dadi.Spectrum.from_ms_file(input, average, mask_corners=True, ...
Rename so we can import it and thus get useful epydoc documentation.
Rename so we can import it and thus get useful epydoc documentation. git-svn-id: 4c7b13231a96299fde701bb5dec4bd2aaf383fc6@132 979d6bd5-6d4d-0410-bece-f567c23bd345
Python
bsd-3-clause
beni55/dadi,cheese1213/dadi,paulirish/dadi,yangjl/dadi,ChenHsiang/dadi,cheese1213/dadi,RyanGutenkunst/dadi,paulirish/dadi,niuhuifei/dadi,beni55/dadi,ChenHsiang/dadi,yangjl/dadi,niuhuifei/dadi,RyanGutenkunst/dadi
--- +++ @@ -0,0 +1,17 @@ +#!/usr/bin/env python +""" +Convert the output of ms to an N-dimensional frequency spectrum. +""" +import sys + +import dadi + +if __name__ == '__main__': + average = ('-av' in sys.argv) + + input = sys.stdin + output = sys.stdout + sfs,header = dadi.Spectrum.from_ms_file(inp...
ae07dc1cd72caf7aa04b76ef4c9377b26eec1730
telemetry/catapult_base/__init__.py
telemetry/catapult_base/__init__.py
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # All files in this directory should be moved to catapult/base/ after moving # to the new repo.
Add catapult_base folder to tools/telemetry to make the refactor easier.
Add catapult_base folder to tools/telemetry to make the refactor easier. This will make some of the refactoring more obvious and easy to review, as well as making the needed reafctoring after moving to the catapult repo easier. BUG=473414 Review URL: https://codereview.chromium.org/1168263002 Cr-Commit-Position: 97...
Python
bsd-3-clause
SummerLW/Perf-Insight-Report,catapult-project/catapult,benschmaus/catapult,catapult-project/catapult-csm,catapult-project/catapult-csm,SummerLW/Perf-Insight-Report,SummerLW/Perf-Insight-Report,sahiljain/catapult,catapult-project/catapult,sahiljain/catapult,benschmaus/catapult,catapult-project/catapult-csm,catapult-proj...
--- +++ @@ -0,0 +1,6 @@ +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# All files in this directory should be moved to catapult/base/ after moving +# to the new repo.
cfa98dfb045b8130add85366215b26a6bf04d5ec
cogs/pandentia/tempvoice.py
cogs/pandentia/tempvoice.py
from discord.ext import commands from cogs.utils import checks from cogs.utils.dataIO import dataIO import discord import asyncio class TemporaryVoice: """A cog to create TeamSpeak-like voice channels.""" def __init__(self, liara): self.liara = liara self.config = dataIO.load_json('pandentia.t...
Add a temporary voice channel cog
Add a temporary voice channel cog
Python
mit
Thessia/Liara
--- +++ @@ -0,0 +1,83 @@ +from discord.ext import commands +from cogs.utils import checks +from cogs.utils.dataIO import dataIO +import discord +import asyncio + + +class TemporaryVoice: + """A cog to create TeamSpeak-like voice channels.""" + def __init__(self, liara): + self.liara = liara + self...
4b8a7e3506982cf155bb7f51ef1779799f4e3b85
name/validators.py
name/validators.py
from django.core.exceptions import ValidationError def follow_merged_with(name): """A generator to get the merged_with relationship of a Name object. This will return a Name object until it reaches a Name that does not have a merged_with relationship. """ while name: merged_into = nam...
Rework the validator so it is aware of the model instance and the merged with model.
Rework the validator so it is aware of the model instance and the merged with model.
Python
bsd-3-clause
damonkelley/django-name,damonkelley/django-name,unt-libraries/django-name,unt-libraries/django-name,unt-libraries/django-name,damonkelley/django-name
--- +++ @@ -0,0 +1,55 @@ +from django.core.exceptions import ValidationError + + +def follow_merged_with(name): + """A generator to get the merged_with relationship + of a Name object. + + This will return a Name object until it reaches a Name that + does not have a merged_with relationship. + """ + ...
0f6f829120d7ccca1803e74a7620aef3e8bfa73f
__init__.py
__init__.py
# Copyright 2022 DeepMind Technologies 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 law or agr...
Make XManager a regular package rather than a namespace package.
Make XManager a regular package rather than a namespace package. PiperOrigin-RevId: 426942901 Change-Id: I9fae90c19996755abbca4f87dad38254aa2e174e GitOrigin-RevId: 7ca0daad14db366fe4610488539d37fc08e78dc9
Python
apache-2.0
deepmind/xmanager,deepmind/xmanager
--- +++ @@ -0,0 +1,14 @@ +# Copyright 2022 DeepMind Technologies 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 +# +# Unle...
e9eb2f37b3972cc840525682d9b607b160859d8e
tests/sc_utils_test.py
tests/sc_utils_test.py
import unittest import context class TestEssStates(unittest.TestCase): def test_safe_add(self): from sc_utils import safeadd self.assertTrue(safeadd() is None) self.assertTrue(safeadd(None, None) is None) self.assertTrue(safeadd(1, None) == 1) self.assertTrue(safeadd(1, 2, 3) == 6) self.assertTrue(safead...
Add unit test module for sc_utils (to be expanded over time).
Add unit test module for sc_utils (to be expanded over time).
Python
mit
victronenergy/dbus-systemcalc-py
--- +++ @@ -0,0 +1,14 @@ +import unittest +import context + +class TestEssStates(unittest.TestCase): + def test_safe_add(self): + from sc_utils import safeadd + + self.assertTrue(safeadd() is None) + self.assertTrue(safeadd(None, None) is None) + self.assertTrue(safeadd(1, None) == 1) + self.assertTrue(safeadd(1...
3e718763a00aa7055d6e4c6b2f0fcbff853d6d0d
dbaas/workflow/steps/util/region_migration/update_zabbix_host.py
dbaas/workflow/steps/util/region_migration/update_zabbix_host.py
# -*- coding: utf-8 -*- import logging from util import full_stack from dbaas_credentials.credential import Credential from dbaas_credentials.models import CredentialType from dbaas_zabbix import factory_for from workflow.steps.util.base import BaseStep from workflow.exceptions.error_codes import DBAAS_0012 LOG = logg...
Add step to update zabbix host
Add step to update zabbix host
Python
bsd-3-clause
globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service
--- +++ @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +import logging +from util import full_stack +from dbaas_credentials.credential import Credential +from dbaas_credentials.models import CredentialType +from dbaas_zabbix import factory_for +from workflow.steps.util.base import BaseStep +from workflow.exceptions.error_...
0705d32787a1e9eba49ddc514161c505be572622
web/premises/migrations/0018_premise_supporters.py
web/premises/migrations/0018_premise_supporters.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 = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('premises', '0017_auto_20141030_0353'), ...
Add migration file for supporting functionality
Add migration file for supporting functionality
Python
mit
beratdogan/arguman.org,Arthur2e5/arguman.org,arguman/arguman.org,bahattincinic/arguman.org,arguman/arguman.org,omeripek/arguman.org,donkawechico/arguman.org,taiansu/arguman.org,Arthur2e5/arguman.org,taiansu/arguman.org,donkawechico/arguman.org,taiansu/arguman.org,arguman/arguman.org,donkawechico/arguman.org,omeripek/ar...
--- +++ @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('pr...
a2fda40514a499f9980300276ec84e7065cd39b5
mistral/db/sqlalchemy/migration/alembic_migrations/versions/038_delete_delayed_calls_with_empty_key.py
mistral/db/sqlalchemy/migration/alembic_migrations/versions/038_delete_delayed_calls_with_empty_key.py
# Copyright 2020 Nokia Software. # # 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 writin...
Add a migration that deletes redundant delayed calls
Add a migration that deletes redundant delayed calls * Due to the bug https://bugs.launchpad.net/mistral/+bug/1861988 some Mistral installations may have redundant delayed calls with the empty "key" column. This patch adds a DB migration that cleans them up. Change-Id: Ic46d3d711a03fbd6364809a0fddcbb48f3e28d2a ...
Python
apache-2.0
openstack/mistral,openstack/mistral
--- +++ @@ -0,0 +1,47 @@ +# Copyright 2020 Nokia Software. +# +# 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 a...
943d258bdbd86940d259d3b288968645814ff91f
Lib/fontTools/pens/ttGlyphPen_test.py
Lib/fontTools/pens/ttGlyphPen_test.py
from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * import os import unittest from fontTools import ttLib from fontTools.pens.ttGlyphPen import TTGlyphPen class TTGlyphPenTest(unittest.TestCase): def setUp(self): #self.font = ttLib.TTFont(recalcBBoxes=False...
Add a test using existing test data
[TTGlyphPen] Add a test using existing test data
Python
mit
fonttools/fonttools,googlefonts/fonttools
--- +++ @@ -0,0 +1,38 @@ +from __future__ import print_function, division, absolute_import +from fontTools.misc.py23 import * + +import os +import unittest + +from fontTools import ttLib +from fontTools.pens.ttGlyphPen import TTGlyphPen + + +class TTGlyphPenTest(unittest.TestCase): + def setUp(self): + #sel...
7b5625a722a9b3e69636ffe3a89b9d314a1ce8e3
netbox/extras/management/commands/clearcache.py
netbox/extras/management/commands/clearcache.py
from django.core.cache import cache from django.core.management.base import BaseCommand class Command(BaseCommand): """Command to clear the entire cache.""" help = 'Clears the cache.' def handle(self, *args, **kwargs): cache.clear() self.stdout.write('Cache has been cleared.', ending="\n"...
Add management command for clearing cache
Add management command for clearing cache
Python
apache-2.0
digitalocean/netbox,digitalocean/netbox,digitalocean/netbox,digitalocean/netbox
--- +++ @@ -0,0 +1,11 @@ +from django.core.cache import cache +from django.core.management.base import BaseCommand + + +class Command(BaseCommand): + """Command to clear the entire cache.""" + help = 'Clears the cache.' + + def handle(self, *args, **kwargs): + cache.clear() + self.stdout.write(...
10070529a5b5954095deca0a7653ab46c83d10c4
numba/typesystem/exttypes/vtabtype.py
numba/typesystem/exttypes/vtabtype.py
# -*- coding: utf-8 -*- """ Virtual method table types and ordering. """ from numba import error from numba.typesystem import * #------------------------------------------------------------------------ # Virtual Method Ordering #------------------------------------------------------------------------ def unordered(...
Add virtual method table type and ordering
Add virtual method table type and ordering
Python
bsd-2-clause
shiquanwang/numba,sklam/numba,IntelLabs/numba,stefanseefeld/numba,GaZ3ll3/numba,ssarangi/numba,sklam/numba,stonebig/numba,sklam/numba,numba/numba,seibert/numba,pitrou/numba,numba/numba,ssarangi/numba,pitrou/numba,jriehl/numba,numba/numba,seibert/numba,stonebig/numba,pombredanne/numba,cpcloud/numba,seibert/numba,gmarkal...
--- +++ @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- + +""" +Virtual method table types and ordering. +""" + +from numba import error +from numba.typesystem import * + +#------------------------------------------------------------------------ +# Virtual Method Ordering +#-------------------------------------------------...
faea42e32ddcaaa398214d6775fc521c67a3a0f8
dev-tools/get-bwc-version.py
dev-tools/get-bwc-version.py
# Licensed to Elasticsearch under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use this file except...
Add script to grab ES version for BWC tests.
Tools: Add script to grab ES version for BWC tests. closes #7653
Python
apache-2.0
fubuki/elasticsearch,fubuki/elasticsearch,aparo/elasticsearch,fubuki/elasticsearch,fubuki/elasticsearch,aparo/elasticsearch,fubuki/elasticsearch,aparo/elasticsearch,fubuki/elasticsearch,aparo/elasticsearch,aparo/elasticsearch,aparo/elasticsearch
--- +++ @@ -0,0 +1,83 @@ +# Licensed to Elasticsearch under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch licenses this file to you under +# the Apache License, Version 2.0 (the "License"); yo...
047e7c017f40b7c23b80151db137ed73230911ce
Proxmox/commands.py
Proxmox/commands.py
from django.http import HttpResponse def runcommand(request, proxmox): command = request.GET.get('command', 'none') if command == 'addcomplete': nodeLocation = request.POST.get('node', '') vmid = request.POST.get('vmid', '') template = request.POST.get('template', '') hostname = request.POST.get('hostname', ...
Add Server wizard now working
Add Server wizard now working
Python
mit
Tomcuzz/OctaHomeAutomation,Tomcuzz/OctaHomeAutomation,Tomcuzz/OctaHomeAutomation,Tomcuzz/OctaHomeAutomation
--- +++ @@ -0,0 +1,40 @@ +from django.http import HttpResponse + +def runcommand(request, proxmox): + command = request.GET.get('command', 'none') + if command == 'addcomplete': + nodeLocation = request.POST.get('node', '') + vmid = request.POST.get('vmid', '') + template = request.POST.get('template', '') + host...
420ec092626d72ea465ee33115ff6635b39f0cd3
src/julia/tests/test_runtests.py
src/julia/tests/test_runtests.py
import subprocess import sys from textwrap import dedent from julia.core import _enviorn from .test_compatible_exe import run def test_runtests_failure(tmp_path): testfile = tmp_path / "test.py" testcode = u""" def test_THIS_TEST_MUST_FAIL(): assert False """ testfile.write_text(dedent(t...
Test julia.runtests can fail properly
Test julia.runtests can fail properly
Python
mit
JuliaPy/pyjulia,JuliaLang/pyjulia,JuliaPy/pyjulia
--- +++ @@ -0,0 +1,35 @@ +import subprocess +import sys +from textwrap import dedent + +from julia.core import _enviorn + +from .test_compatible_exe import run + + +def test_runtests_failure(tmp_path): + testfile = tmp_path / "test.py" + testcode = u""" + def test_THIS_TEST_MUST_FAIL(): + assert False...
b7af7aa6cb15421b140adea41c4436d1960367f9
bin/validate_file.py
bin/validate_file.py
#!/usr/bin/env python3 import argparse import validator.validator as vv parser = argparse.ArgumentParser() parser.add_argument('--config', help="configuration file for file validator") parser.add_argument('--file', help="file to validate") args = parser.parse_args() v = vv.Validate() v.validate_file(args.config, arg...
Add validator scripts which use the validator class
Add validator scripts which use the validator class
Python
mit
iestynpryce/file-validator
--- +++ @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +import argparse +import validator.validator as vv + +parser = argparse.ArgumentParser() +parser.add_argument('--config', help="configuration file for file validator") +parser.add_argument('--file', help="file to validate") +args = parser.parse_args() + +v = vv.Valid...
150248cbcdcc114f996ef6746e74f8cd8294190f
setup.py
setup.py
from setuptools import setup, find_packages # import os, sys def parse_requirements(requirements): # load from requirements.txt with open(requirements) as f: lines = [l for l in f] # remove spaces stripped = map((lambda x: x.strip()), lines) # remove comments nocomments...
from setuptools import setup, find_packages # import os, sys def parse_requirements(requirements): # load from requirements.txt with open(requirements) as f: lines = [l for l in f] # remove spaces stripped = map((lambda x: x.strip()), lines) # remove comments nocomments...
Update project name from dejavu to PyDejavu
Update project name from dejavu to PyDejavu
Python
mit
IskrenStanislavov/dejavu,worldveil/dejavu,shantanoo/dejavu,thanhquanky/dejavu,nicktimko/dejavu,VikramTiwari/dejavu,nmerad/dejavu,karthiks1995/dejavu,vasanthkalingeri/dejavu,snd/dejavu,davidmashburn/dejavu,midroid/dejavu,davidmashburn/dejavu,nmtoan91/dejavu,thanhquanky/dejavu,snd/dejavu,VikramTiwari/dejavu,karthiks1995/...
--- +++ @@ -14,7 +14,7 @@ reqs = filter((lambda x: x), nocomments) return reqs -PACKAGE_NAME = "dejavu" +PACKAGE_NAME = "PyDejavu" PACKAGE_VERSION = "0.1" SUMMARY = 'Dejavu Audio Fingerprinting' DESCRIPTION = """Dejavu Audio Fingerprinting"""
bb79b0a66a41106db220b1a0fb0e3bb8db9b5072
utils.py
utils.py
from keras.preprocessing.sequence import pad_sequences import numpy as np def to_one_hot_sequences(x, nb_classes=None, seq_len=30, start=0, stop=None, step=0): if nb_classes is None: nb_classes = _guess_nb_classes(x) if stop is None: stop = len(x) - seq_len if step...
Add an utility to transform an integer sequence into one hot sequence and sequences
Add an utility to transform an integer sequence into one hot sequence and sequences
Python
mit
xiongliyang219/physics_music
--- +++ @@ -0,0 +1,31 @@ +from keras.preprocessing.sequence import pad_sequences +import numpy as np + + +def to_one_hot_sequences(x, nb_classes=None, seq_len=30, + start=0, stop=None, step=0): + if nb_classes is None: + nb_classes = _guess_nb_classes(x) + if stop is None: + ...
a61a9ab1182eedefcf594f1966272d04f66f41da
webcomictocbz/tests/test_search.py
webcomictocbz/tests/test_search.py
from webcomictocbz.search import search from webcomictocbz.comic import Comic def test_search_searchable_website(): searchable_website = search("https://xkcd.com/1/") assert searchable_website.url == "https://xkcd.com/1/" assert searchable_website.next_page_selector == "//*[@*[contains(., '{}')]]//@href".f...
Add tests for search function
Add tests for search function
Python
mit
J-CPelletier/webcomix,J-CPelletier/WebComicToCBZ,J-CPelletier/webcomix
--- +++ @@ -0,0 +1,13 @@ +from webcomictocbz.search import search +from webcomictocbz.comic import Comic + +def test_search_searchable_website(): + searchable_website = search("https://xkcd.com/1/") + assert searchable_website.url == "https://xkcd.com/1/" + assert searchable_website.next_page_selector == "//...
770e732d76f5e4f4dbb9f2d2d87c3b49440d906b
tests/unit/doc_test.py
tests/unit/doc_test.py
# -*- coding: utf-8 -*- ''' tests.unit.doc_test ~~~~~~~~~~~~~~~~~~~~ ''' # Import Python libs from __future__ import absolute_import import os # Import Salt Testing libs from salttesting import TestCase from salttesting.helpers import ensure_in_syspath # Import Salt libs import salt.modules.cmdmod ensure_in...
Add a unit test to search for new doc markup refs
Add a unit test to search for new doc markup refs
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +''' + tests.unit.doc_test + ~~~~~~~~~~~~~~~~~~~~ +''' + +# Import Python libs +from __future__ import absolute_import +import os + +# Import Salt Testing libs +from salttesting import TestCase +from salttesting.helpers import ensure_in_syspath + +# Import Salt ...
8d548b31905b79f324bffff43b876b96d95a3525
cli.py
cli.py
#!/usr/bin/env python import argparse import requests import sys URL = 'https://r1d2.herokuapp.com' def get_json(url): return requests.get(url).json() def get_menu(json): return json['menu'] def format_item(name, price): return '{} (CHF {:.2f})'.format(name, price) def print_menu(menu, day=None): ...
Add example CLI program that uses the API.
Add example CLI program that uses the API.
Python
mit
kdungs/R1D2
--- +++ @@ -0,0 +1,71 @@ +#!/usr/bin/env python + +import argparse +import requests +import sys + +URL = 'https://r1d2.herokuapp.com' + + +def get_json(url): + return requests.get(url).json() + + +def get_menu(json): + return json['menu'] + + +def format_item(name, price): + return '{} (CHF {:.2f})'.format(n...
83a5e3ea71a263718c9c5e43936e7426629e4e85
src/mmw/apps/modeling/migrations/0039_override_sedaadjust_for_old_scenarios.py
src/mmw/apps/modeling/migrations/0039_override_sedaadjust_for_old_scenarios.py
# Generated by Django 3.2.10 on 2021-12-27 19:26 import json from django.db import migrations def override_sedaadjust_for_old_projects(apps, schema_editor): """ The default value of SedAAdjust is being changed from 1.5 to 1.25 for all new projects, which will use the high resolution "nhdhr" stream data. F...
Use old SedAAdjust in all existing NHD projects
Use old SedAAdjust in all existing NHD projects The new SedAAdjust value applies to those projects using the NHD Hi Res dataset. For older projects using NHD Medium Res, the old value is more appropriate. This migration sets that value to all old projects, unless that had already been overridden by a user.
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,49 @@ +# Generated by Django 3.2.10 on 2021-12-27 19:26 +import json +from django.db import migrations + + +def override_sedaadjust_for_old_projects(apps, schema_editor): + """ + The default value of SedAAdjust is being changed from 1.5 to 1.25 for all + new projects, which will use the hi...
808d8deebc154822473316cea7838bab41c4daf1
CodeFights/secondRightmostZeroBit.py
CodeFights/secondRightmostZeroBit.py
#!/usr/local/bin/python # Code Second Right-most Zero Bit (Core) Problem def secondRightmostZeroBit(n): # print('Number: {}\nBinary: {}'.format(n, bin(n))) # Solution: # return (((((n + 1) | n) + 1) | n) - n) return [2**i for i in range(len(bin(n)[2:])) if (n >> i) % 2 == 0][1] def main(): tests...
Solve Code Fights second rightmost zero bit problem
Solve Code Fights second rightmost zero bit problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,32 @@ +#!/usr/local/bin/python +# Code Second Right-most Zero Bit (Core) Problem + + +def secondRightmostZeroBit(n): + # print('Number: {}\nBinary: {}'.format(n, bin(n))) + # Solution: + # return (((((n + 1) | n) + 1) | n) - n) + return [2**i for i in range(len(bin(n)[2:])) if (n >> i) ...
4ad05d8e05c115ed5f881351752f7c25fd611bdd
test/test_basic.py
test/test_basic.py
from __future__ import nested_scopes from twisted.internet import reactor import unittest from twistedsnmp.test import basetestcase from twistedsnmp import tableretriever, agentproxy from twistedsnmp.pysnmpproto import v2c,v1, error class BasicProxyTests( basetestcase.BaseTestCase ): version = 'v2c' def testBulkRequ...
Test for very basic operations
Test for very basic operations
Python
bsd-3-clause
mmattice/TwistedSNMP
--- +++ @@ -0,0 +1,35 @@ +from __future__ import nested_scopes +from twisted.internet import reactor +import unittest +from twistedsnmp.test import basetestcase +from twistedsnmp import tableretriever, agentproxy +from twistedsnmp.pysnmpproto import v2c,v1, error + +class BasicProxyTests( basetestcase.BaseTestCase ):...
d111aeb7270b68b0dc845f0a7e32a41e687920b9
test/test_board.py
test/test_board.py
import unittest import board class BoardTest(unittest.TestCase): def setUp(self): self.board_size = 9 self.testBoard = board.Board(self.board_size) #self.testBoard.place_piece(2, 3) def test_create_board(self): self.assertEqual(self.board_size, self.testBoard.board_size) ...
Add frame for unit test on board
Add frame for unit test on board
Python
mit
jonbrohauge/pySudokuSolver
--- +++ @@ -0,0 +1,24 @@ +import unittest +import board + + +class BoardTest(unittest.TestCase): + + def setUp(self): + self.board_size = 9 + self.testBoard = board.Board(self.board_size) + #self.testBoard.place_piece(2, 3) + + def test_create_board(self): + self.assertEqual(self.boa...
4a99f17a80da11655bc97372572220f1f0bb0d15
tools/reformat.py
tools/reformat.py
#!/usr/bin/python3 # Searches the assets/bibs/ directory and reformat all json files import json import os DIR = 'opacclient/opacapp/src/main/assets/bibs/' for filename in os.listdir(DIR): f = os.path.join(DIR, filename) data = json.load(open(f)) json.dump(data, open(f, 'w'), indent=4, sort_keys=True)
Add tool for re-indenting JSON files
Add tool for re-indenting JSON files
Python
mit
ruediger-w/opacclient,johan12345/opacclient,raphaelm/opacclient,raphaelm/opacclient,ruediger-w/opacclient,opacapp/opacclient,simon04/opacclient,ruediger-w/opacclient,simon04/opacclient,johan12345/opacclient,johan12345/opacclient,ruediger-w/opacclient,opacapp/opacclient,hurzl/opacclient,ruediger-w/opacclient,thesebas/op...
--- +++ @@ -0,0 +1,11 @@ +#!/usr/bin/python3 +# Searches the assets/bibs/ directory and reformat all json files +import json +import os + +DIR = 'opacclient/opacapp/src/main/assets/bibs/' + +for filename in os.listdir(DIR): + f = os.path.join(DIR, filename) + data = json.load(open(f)) + json.dump(data, open(...
a65187bebdec6ec99a9b5e967e818948ffb70969
test_pcalg.py
test_pcalg.py
# -*- coding: utf-8 -*- ''' Test suite for pcalg ''' import networkx as nx import numpy as np from gsq.ci_tests import ci_test_bin, ci_test_dis from gsq.gsq_testdata import bin_data, dis_data import pytest from pcalg import estimate_cpdag from pcalg import estimate_skeleton @pytest.mark.parametrize(('indep_test_fun...
Add test to verify fixed_edges option
test: Add test to verify fixed_edges option Signed-off-by: limjcst <a207579da1956e43e71ded4d0c18bba514713a1d@163.com>
Python
bsd-2-clause
keiichishima/pcalg
--- +++ @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +''' +Test suite for pcalg +''' +import networkx as nx +import numpy as np + +from gsq.ci_tests import ci_test_bin, ci_test_dis +from gsq.gsq_testdata import bin_data, dis_data + +import pytest + +from pcalg import estimate_cpdag +from pcalg import estimate_skeleton +...
ed08bb7cb943c6299c97d44b1c4bd0c53d581cfb
omftools/cli/enumize_translation.py
omftools/cli/enumize_translation.py
import argparse import re from omftools.pyshadowdive.language import LanguageFile re_non_alphanumeric = re.compile(r'[\W]+') def txt(text: str) -> str: o = text.replace(' ', '_') o = re.sub(re_non_alphanumeric, '', o) o = o.upper() return o def generate_enum(in_file: str, out_file: str): langu...
Add tool for generating transtions enum
Add tool for generating transtions enum
Python
mit
omf2097/pyomftools,omf2097/pyomftools
--- +++ @@ -0,0 +1,43 @@ +import argparse +import re + +from omftools.pyshadowdive.language import LanguageFile + +re_non_alphanumeric = re.compile(r'[\W]+') + + +def txt(text: str) -> str: + o = text.replace(' ', '_') + o = re.sub(re_non_alphanumeric, '', o) + o = o.upper() + return o + + +def generate_e...
b7a6463313c46d5d4545b17d49a3eca2e58fa2d3
benchmark/mini_bench.py
benchmark/mini_bench.py
# -*- coding: utf-8 -*- # Copyright 2015 moco_beta # # 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...
Add a tiny benchmark script.
Add a tiny benchmark script.
Python
apache-2.0
mocobeta/janome,mocobeta/janome,nakagami/janome,nakagami/janome
--- +++ @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +# Copyright 2015 moco_beta +# +# 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 +# +# Un...
c7895f0c799bc57e106c7e2f532af05609142f1b
helusers/management/commands/sync_helusers.py
helusers/management/commands/sync_helusers.py
from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.management.base import BaseCommand from django.contrib.sites.models import Site from allauth.socialaccount.models import SocialApp from helusers.providers.helsinki.provider import HelsinkiProvider class Command(B...
Add management command for keeping helsinki SocialApp in sync
Add management command for keeping helsinki SocialApp in sync
Python
bsd-2-clause
City-of-Helsinki/django-helusers,City-of-Helsinki/django-helusers
--- +++ @@ -0,0 +1,52 @@ +from django.conf import settings +from django.core.exceptions import ImproperlyConfigured +from django.core.management.base import BaseCommand +from django.contrib.sites.models import Site +from allauth.socialaccount.models import SocialApp +from helusers.providers.helsinki.provider import H...
b589e6791ffdb85dfb7f11b331f090e6a9a0d874
senlin/db/sqlalchemy/migrate_repo/versions/006_node_cluster_dependents_column.py
senlin/db/sqlalchemy/migrate_repo/versions/006_node_cluster_dependents_column.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 # distributed unde...
Add dependents column to node and cluster tables
Add dependents column to node and cluster tables This patch adds a new column 'dependents' to node and cluster tables. 'dependents' column will be used to store the relationship between vm node/cluster and container node/cluster. Change-Id: Ib4ebb3eafb986ed776dead5f616062606631190c
Python
apache-2.0
stackforge/senlin,openstack/senlin,openstack/senlin,stackforge/senlin,openstack/senlin
--- +++ @@ -0,0 +1,28 @@ +# 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 wr...
3c627a70c53488526d11911b612ce524c3799092
src/dashboard/src/main/migrations/0052_correct_extract_packages_fallback_link.py
src/dashboard/src/main/migrations/0052_correct_extract_packages_fallback_link.py
# -*- coding: utf-8 -*- """0052_correct_extact_packages_fallback_link.py Migration to ensure that if extract contents from compressed archives fails that the workflow doesn't continue to trudge along to completion where there is a likelihood of other errors. """ from __future__ import unicode_literals from django.db ...
Update defaultNextChainLink for extract packages
Update defaultNextChainLink for extract packages There are two extract packages microservices which continue to process data even if they have failed to extract content, or the service itself has failed for some other reason. Make sure that the Task falls back to 'Failed Transfer' so that the user knows and a decision...
Python
agpl-3.0
artefactual/archivematica,artefactual/archivematica,artefactual/archivematica,artefactual/archivematica
--- +++ @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +"""0052_correct_extact_packages_fallback_link.py + +Migration to ensure that if extract contents from compressed archives +fails that the workflow doesn't continue to trudge along to completion where +there is a likelihood of other errors. +""" +from __future__ impor...
1ba2365678c3118b8b3e7629767bf2bfa4ec04e6
editorconfig.py
editorconfig.py
import os from ini import EditorConfigParser def get_filenames(path, filename): """Yield full filepath for filename in each directory in and above path""" while True: yield os.path.join(path, filename) newpath = os.path.dirname(path) if path == newpath: break path ...
Add class to locate and parse EditorConfig files
Add class to locate and parse EditorConfig files
Python
bsd-2-clause
dublebuble/editorconfig-gedit,dublebuble/editorconfig-gedit,pocke/editorconfig-vim,benjifisher/editorconfig-vim,johnfraney/editorconfig-vim,benjifisher/editorconfig-vim,johnfraney/editorconfig-vim,VictorBjelkholm/editorconfig-vim,VictorBjelkholm/editorconfig-vim,pocke/editorconfig-vim,VictorBjelkholm/editorconfig-vim,d...
--- +++ @@ -0,0 +1,58 @@ +import os + +from ini import EditorConfigParser + + +def get_filenames(path, filename): + """Yield full filepath for filename in each directory in and above path""" + while True: + yield os.path.join(path, filename) + newpath = os.path.dirname(path) + if path == ne...
8e195ab55be87cdd300c71b00d2dc64bb0d6c3ca
app/admin/forms.py
app/admin/forms.py
from flask.ext.wtf import Form from wtforms import StringField, TextAreaField, SubmitField from wtforms.validators import Required, Length, Email, Optional class ProfileForm(Form): name = StringField('Nafn', validators=[Optional(), Length(1,64)]) location = Strin...
Add a ProfileForm to modify the user profile
Add a ProfileForm to modify the user profile
Python
mit
finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is
--- +++ @@ -0,0 +1,13 @@ +from flask.ext.wtf import Form +from wtforms import StringField, TextAreaField, SubmitField +from wtforms.validators import Required, Length, Email, Optional + +class ProfileForm(Form): + name = StringField('Nafn', validators=[Optional(), + ...
a8d8027b8610d5f710638511cd0adb277de381c2
solutions/uppg2.py
solutions/uppg2.py
# coding: utf-8 def load_book(path): d = {} for rad in open('bok.txt'): (namn, _, nummer) = rad.partition(';') d[namn] = nummer.strip() return d def save_book(book, path): f = open('bok.txt', 'w') for name in book: f.write('%s;%s\n' % (name, book[name])) def print_menu(...
Add solution to problem 2
Add solution to problem 2
Python
mit
objarni/telefonboken
--- +++ @@ -0,0 +1,63 @@ +# coding: utf-8 + + +def load_book(path): + d = {} + for rad in open('bok.txt'): + (namn, _, nummer) = rad.partition(';') + d[namn] = nummer.strip() + return d + + +def save_book(book, path): + f = open('bok.txt', 'w') + for name in book: + f.write('%s;%s\...
f486504e4ae3758fee37ac2f94dc289c861ebcdd
data/.scripts/parse_foreign_languages_listing.py
data/.scripts/parse_foreign_languages_listing.py
#!/usr/bin/env python3 import bs4 from bs4 import BeautifulSoup from collections import defaultdict def get_table_tbody(soup): return soup.body.table.tbody.contents def extract_course_from_tr(tr): tds = tr.find_all('td') if tds[0].a is None: return None return { 'courseNumber': tds[...
Add script for parsing foreign language listing
Add script for parsing foreign language listing
Python
bsd-2-clause
mDibyo/berkeley-scheduler,mDibyo/berkeley-scheduler,mDibyo/berkeley-scheduler,mDibyo/berkeley-scheduler,mDibyo/berkeley-scheduler
--- +++ @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 + +import bs4 +from bs4 import BeautifulSoup +from collections import defaultdict + + +def get_table_tbody(soup): + return soup.body.table.tbody.contents + + +def extract_course_from_tr(tr): + tds = tr.find_all('td') + if tds[0].a is None: + return None...
5d2f96836d0d63c68eb3acd5b8477cef231c5746
json2csv_business.py
json2csv_business.py
import json def main(): # print the header of output csv file print 'business_id,city,latitude,longitude' # for each entry in input json file print one csv row for line in open("data/yelp_academic_dataset_business.json"): input_json = json.loads(line) business_id = input_json['busines...
Add conversion from json to csv format for businesses
Add conversion from json to csv format for businesses
Python
mit
aysent/yelp-photo-explorer
--- +++ @@ -0,0 +1,18 @@ +import json + +def main(): + + # print the header of output csv file + print 'business_id,city,latitude,longitude' + + # for each entry in input json file print one csv row + for line in open("data/yelp_academic_dataset_business.json"): + input_json = json.loads(line) + ...
fed96a269df3f36deb1f37b80e0eb85f6abbb030
extract-patterns.py
extract-patterns.py
#!/usr/bin/env python """ Usage: extract-patterns.py FILE Print patterns in the structure of parse trees in FILE """ from sexp import sexps, tokenize, isterminal import re import sys filename = sys.argv[1] def remove_coindex(s): return re.sub('-\d+$', '', s) def get_verb(sexp): if isterminal(sexp): ...
Add improved script for extracting sentence patts
Add improved script for extracting sentence patts
Python
cc0-1.0
cordarei/ptb.py
--- +++ @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +""" +Usage: extract-patterns.py FILE + +Print patterns in the structure of parse trees in FILE +""" + +from sexp import sexps, tokenize, isterminal + +import re +import sys + +filename = sys.argv[1] + +def remove_coindex(s): + return re.sub('-\d+$', '', s) + +def ...
14d6748e26c86c887cddc2ff0eb716c9db63a766
kNN.py
kNN.py
""" The program to classify the randomly generated data using the k-Nearest Neighbours algorithm """ import sys import numpy as np import math def loadData(fname='train.txt'): """ Function to load the randomly generated data Keyword arguments: fname -- The file name to load the data in to the nump...
Add the initial skeleton of the classifier
Add the initial skeleton of the classifier
Python
mit
Anirudh-Swaminathan/kNN_py
--- +++ @@ -0,0 +1,60 @@ +""" The program to classify the randomly generated data using the k-Nearest + Neighbours algorithm +""" +import sys +import numpy as np +import math + +def loadData(fname='train.txt'): + """ Function to load the randomly generated data + + Keyword arguments: + fname -- The fi...
e3728beb16dfb72a7be71cdf8ea53adb730827ad
examples/share-amis-boto3.py
examples/share-amis-boto3.py
import os import boto3 import botocore from boto3.core.session import Session os.environ['AWS_CONFIG_FILE'] = "/etc/profiles.cfg" orig_owner = "" shared_owner = "" region = "us-west-2" session = botocore.session.get_session() session.profile = 'beta' session = Session(session=session) ec2_conn = session.connect_to(...
Update the example via boto3
Update the example via boto3
Python
apache-2.0
henrysher/kamboo,henrysher/kamboo
--- +++ @@ -0,0 +1,54 @@ +import os +import boto3 +import botocore +from boto3.core.session import Session + +os.environ['AWS_CONFIG_FILE'] = "/etc/profiles.cfg" + +orig_owner = "" +shared_owner = "" + +region = "us-west-2" +session = botocore.session.get_session() +session.profile = 'beta' + +session = Session(sessi...
8b7941e488bc902f7fa831b8c020b3eb07a154c0
flexget/tests/test_serialization.py
flexget/tests/test_serialization.py
import datetime from flexget import entry from flexget.utils import qualities class TestSerialization: def test_entry_serialization(self): entry1 = entry.Entry({ 'title': 'blah', 'url': 'http://blah', 'listfield': ['a', 'b', 1, 2], 'dictfield': {'a': 1, 'b'...
Add a test for serialization functionality
Add a test for serialization functionality
Python
mit
ianstalk/Flexget,Flexget/Flexget,malkavi/Flexget,malkavi/Flexget,crawln45/Flexget,Flexget/Flexget,ianstalk/Flexget,Flexget/Flexget,crawln45/Flexget,malkavi/Flexget,crawln45/Flexget,Flexget/Flexget,malkavi/Flexget,ianstalk/Flexget,crawln45/Flexget
--- +++ @@ -0,0 +1,23 @@ +import datetime + +from flexget import entry +from flexget.utils import qualities + + +class TestSerialization: + def test_entry_serialization(self): + entry1 = entry.Entry({ + 'title': 'blah', + 'url': 'http://blah', + 'listfield': ['a', 'b', 1, 2]...
0d210930c48cf490435e2ff310955650e8f606aa
db/player_game.py
db/player_game.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from .common import Base from .player import Player class PlayerGame(Base): __tablename__ = 'player_games' __autoload__ = True STANDARD_ATTRS = [ "position", "no", "goals", "assists", "primary_assists", "secondary_assists", "points", "plus_mi...
Introduce initial version of player game item
Introduce initial version of player game item
Python
mit
leaffan/pynhldb
--- +++ @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from .common import Base +from .player import Player + + +class PlayerGame(Base): + __tablename__ = 'player_games' + __autoload__ = True + + STANDARD_ATTRS = [ + "position", "no", "goals", "assists", "primary_assists", + ...
b7b30695022314a28a8d14878ce13566b8dd9522
code2html/tests/unit/test_util.py
code2html/tests/unit/test_util.py
# -*- coding: utf-8 -*- import unittest from code2html.util import get_subdir_name, included class GetSubdirNameTest(unittest.TestCase): def test_root_starts_with_dot(self): root = '.' dir_name = './first/second' self.assertEqual(get_subdir_name(root, dir_name), 'first/second') def ...
Add unit tests for utils
Add unit tests for utils
Python
mit
kfei/code2html
--- +++ @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +import unittest + +from code2html.util import get_subdir_name, included + + +class GetSubdirNameTest(unittest.TestCase): + def test_root_starts_with_dot(self): + root = '.' + dir_name = './first/second' + self.assertEqual(get_subdir_name(roo...
2baaa4d754838cfc8196c678f86a8419ca139c12
test/single_test.py
test/single_test.py
import sys import unittest from unittest import TestSuite def suite(test_name): suite = unittest.TestSuite() suite.addTest(unittest.defaultTestLoader.loadTestsFromName(test_name)) return suite if __name__ == "__main__": if len(sys.argv) < 2: print("Usage {test_name}") sys.exit(1) ...
Add utility that allows debugging of single test
Add utility that allows debugging of single test
Python
mit
JakubPetriska/poker-cfr,JakubPetriska/poker-cfr
--- +++ @@ -0,0 +1,18 @@ +import sys +import unittest +from unittest import TestSuite + + +def suite(test_name): + suite = unittest.TestSuite() + suite.addTest(unittest.defaultTestLoader.loadTestsFromName(test_name)) + return suite + + +if __name__ == "__main__": + if len(sys.argv) < 2: + print("Us...
33be10064a7f2eb80b826e0d26fa9856f1c5f231
tests/test_model.py
tests/test_model.py
import unittest from gb import db,app from gb.models import (Wig, WigValue, BasePair, Bed, Annotation, Fasta, User, Track, View, ViewTrack) import logging logging.basicConfig() LOG = logging.getLogger(__name__) class TestSetUp(unittest.TestCase): def setUp(self): app...
Add beginnings of tests for model
Add beginnings of tests for model
Python
mit
mbiokyle29/geno-browser,mbiokyle29/geno-browser,mbiokyle29/geno-browser
--- +++ @@ -0,0 +1,59 @@ +import unittest +from gb import db,app +from gb.models import (Wig, + WigValue, + BasePair, + Bed, + Annotation, + Fasta, + User, + Track, + View, + ViewTrack) + +import logging +logging.basicConfig() + +LOG = logging.getLogger(__name__) + + +class TestSetUp(unitte...
5303ad1f603d2d357d20f270f6342edf7b05cb9d
pylp/utils/paths.py
pylp/utils/paths.py
""" Some useful functions for using paths. Copyright (C) 2017 The Pylp Authors. This file is under the MIT License. """ import os.path # Make a path more "readable" def make_readable_path(path): home = os.path.expanduser("~") if path.startswith(home): path = "~" + path[len(home):] return path...
Make pylpfile path more readable
Make pylpfile path more readable
Python
mit
pylp/pylp
--- +++ @@ -0,0 +1,19 @@ +""" + +Some useful functions for using paths. + +Copyright (C) 2017 The Pylp Authors. +This file is under the MIT License. + +""" + +import os.path + + +# Make a path more "readable" +def make_readable_path(path): + home = os.path.expanduser("~") + if path.startswith(home): + pa...
5781c36567aac9bd41d126d641be1e7cafdac1de
inselect/tests/test_basic.py
inselect/tests/test_basic.py
from inselect.image_viewer import ImageViewer import os import sys from PySide import QtGui import numpy as np from skimage import data_dir def test_main(): app = QtGui.QApplication(sys.argv) window = ImageViewer() window.open(os.path.join(data_dir, 'chelsea.png')) window.segment()
Add basic GUI instantiation test
Add basic GUI instantiation test
Python
bsd-3-clause
NaturalHistoryMuseum/inselect,NaturalHistoryMuseum/inselect
--- +++ @@ -0,0 +1,16 @@ +from inselect.image_viewer import ImageViewer + +import os +import sys + +from PySide import QtGui + +import numpy as np +from skimage import data_dir + + +def test_main(): + app = QtGui.QApplication(sys.argv) + window = ImageViewer() + window.open(os.path.join(data_dir, 'chelsea.pn...
1019631b883c00550b6d3344de3649d7e9a98ef1
tests/test_irc_formatter.py
tests/test_irc_formatter.py
# -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import print_function import io import os import re import unittest import tempfile fr...
Add basic test for irc formatter
Add basic test for irc formatter
Python
bsd-2-clause
pygments/pygments,dscorbett/pygments,pygments/pygments,dscorbett/pygments,dscorbett/pygments,dscorbett/pygments,dscorbett/pygments,pygments/pygments,dscorbett/pygments,dscorbett/pygments,pygments/pygments,pygments/pygments,pygments/pygments,pygments/pygments,pygments/pygments,dscorbett/pygments,dscorbett/pygments,dscor...
--- +++ @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +""" + Pygments HTML formatter tests + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from __future__ import print_function + +import io +import os +imp...
1a5f1431886b3b7517db7180fa0f53d71c779901
tests/test_indentxml.py
tests/test_indentxml.py
from unittest import TestCase import sublime class IndentXmlBase(TestCase): src = "" def set_text(self, string): self.view.run_command("insert", {"characters": string}) def get_text(self): return self.view.substr(sublime.Region(0, self.view.size())) def setUp(self): self.v...
Add unit-tests for the plugin
Add unit-tests for the plugin Unit-tests are using https://github.com/randy3k/UnitTesting
Python
mit
alek-sys/sublimetext_indentxml,alek-sys/sublimetext_indentxml
--- +++ @@ -0,0 +1,38 @@ +from unittest import TestCase + +import sublime + + +class IndentXmlBase(TestCase): + + src = "" + + def set_text(self, string): + self.view.run_command("insert", {"characters": string}) + + def get_text(self): + return self.view.substr(sublime.Region(0, self.view.size...
4a81ee90a39c4831dca186ae269184c703ddbf2e
src/autobot/src/udpRemote.py
src/autobot/src/udpRemote.py
#!/usr/bin/env python import rospy import socket from autobot.msg import drive_param """ Warning: This code has not been tested at all Protocol could be comma delimited Vaa.aa;Abb.bb TODO - [ ] Unit test - [ ] Define protocol - [ ] Use select() for non-blocking operation - [ ] Use a timeout for setting drive/angle ...
Add code for udp remote
Add code for udp remote This code is untested and is still WIP.
Python
mit
atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot
--- +++ @@ -0,0 +1,73 @@ +#!/usr/bin/env python + +import rospy +import socket +from autobot.msg import drive_param + +""" +Warning: This code has not been tested at all + +Protocol could be comma delimited +Vaa.aa;Abb.bb + +TODO +- [ ] Unit test +- [ ] Define protocol +- [ ] Use select() for non-blocking operation +...
c5546da1d84c7969f51d186bb84298a4fea8bef6
bindings/python/examples/return_region.py
bindings/python/examples/return_region.py
#!/usr/bin/env python # Copyright 2019 Stanford University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
Test returning regions from tasks.
python: Test returning regions from tasks.
Python
apache-2.0
StanfordLegion/legion,StanfordLegion/legion,StanfordLegion/legion,StanfordLegion/legion,StanfordLegion/legion,StanfordLegion/legion,StanfordLegion/legion,StanfordLegion/legion
--- +++ @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +# Copyright 2019 Stanford University +# +# 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-...
0ca5e2fa612687533c4a60dd1e2463fde6fc0bd6
Utilities/ConvertLanguage.py
Utilities/ConvertLanguage.py
#!/usr/bin/env python ################################################################################ # ConvertLanguage.py - converts an old 3RVX version 2.X language file to the new # 3.X format. A 'template' file is used to provide the missing strings that # didn't exist in the old 2.X translations. # # Matthew Male...
Add script to convert old language files
Add script to convert old language files
Python
bsd-2-clause
malensek/3RVX,Soulflare3/3RVX,Soulflare3/3RVX,malensek/3RVX,malensek/3RVX,Soulflare3/3RVX
--- +++ @@ -0,0 +1,56 @@ +#!/usr/bin/env python +################################################################################ +# ConvertLanguage.py - converts an old 3RVX version 2.X language file to the new +# 3.X format. A 'template' file is used to provide the missing strings that +# didn't exist in the old 2....
ff92928b063ff36bb71945b6ff1c75d149411bc7
helloTurtle.py
helloTurtle.py
# drawing out a hello world with the python turtle library! # extension: different modules for each turtle so letter color, etc. can be easily changed. # TODO: fix angle errors, draw the rest of the letters import turtle wn = turtle.Screen() h = turtle.Turtle() # move module to the left side of the screen h.penup() ...
Add the .py file to the repo.
Add the .py file to the repo. This file is where the actual program is!
Python
cc0-1.0
slohmes/Hello-Turtle
--- +++ @@ -0,0 +1,55 @@ +# drawing out a hello world with the python turtle library! +# extension: different modules for each turtle so letter color, etc. can be easily changed. + +# TODO: fix angle errors, draw the rest of the letters + +import turtle +wn = turtle.Screen() +h = turtle.Turtle() + +# move module to t...
6886dc54980b5c2c66bac585a36f0d24e7cc9eb0
tests/test_tools.py
tests/test_tools.py
"""Test the functions in the tools file.""" import bibpy.tools def test_version_format(): assert bibpy.tools.version_format().format('0.1.0') == '%(prog)s v0.1.0' program_name = dict(prog='tool_name') assert (bibpy.tools.version_format() % program_name).format('2.3') ==\ 'tool_name v2.3' def t...
Add initial tests for bibpy tools
Add initial tests for bibpy tools
Python
mit
MisanthropicBit/bibpy,MisanthropicBit/bibpy
--- +++ @@ -0,0 +1,36 @@ +"""Test the functions in the tools file.""" + +import bibpy.tools + + +def test_version_format(): + assert bibpy.tools.version_format().format('0.1.0') == '%(prog)s v0.1.0' + + program_name = dict(prog='tool_name') + assert (bibpy.tools.version_format() % program_name).format('2.3')...
81a77ec5e354448f328fa4d65154cea65709eac0
backend/scripts/fixdrafts.py
backend/scripts/fixdrafts.py
#!/usr/bin/env python import rethinkdb as r import optparse if __name__ == "__main__": parser = optparse.OptionParser() parser.add_option("-P", "--port", dest="port", type="int", help="rethinkdb port", default=30815) (options, args) = parser.parse_args() conn = r.connect('localho...
Add script to fix Emmanuelle's messed up drafts.
Add script to fix Emmanuelle's messed up drafts.
Python
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +import rethinkdb as r +import optparse + +if __name__ == "__main__": + parser = optparse.OptionParser() + parser.add_option("-P", "--port", dest="port", type="int", + help="rethinkdb port", default=30815) + (options, args) = parser.parse...
4890ec7d794918cb642a27778ac48ecdc28e02ab
pyfermod/ferfmrc.py
pyfermod/ferfmrc.py
''' Represents a forecast-model-run collection in Ferret ''' from __future__ import print_function import pyferret class FerFMRC(pyferret.FerAggDSet): ''' A forecast-model-run collection dataset in Ferret. Variables in this dataset (FerFMRCVar objects) have restrictions on the time and forecast axes, an...
Add initial FerFMRC object - very incomplete
Add initial FerFMRC object - very incomplete git-svn-id: 77c6ae948ca0f9b1480c5330e5e23bcf0afa938f@23147 fdbf22ae-c210-0410-be80-ca943da6b8f8
Python
unlicense
NOAA-PMEL/PyFerret,NOAA-PMEL/PyFerret,NOAA-PMEL/PyFerret,NOAA-PMEL/PyFerret,NOAA-PMEL/PyFerret
--- +++ @@ -0,0 +1,28 @@ +''' Represents a forecast-model-run collection in Ferret ''' + +from __future__ import print_function + +import pyferret + +class FerFMRC(pyferret.FerAggDSet): + ''' + A forecast-model-run collection dataset in Ferret. Variables in this dataset + (FerFMRCVar objects) have restricti...
35e9088db9c47ab9e59489c23d6975c5747c43b8
studygroups/migrations/0107_auto_20181115_1004.py
studygroups/migrations/0107_auto_20181115_1004.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2018-11-15 10:04 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('studygroups', '0106_studygroup_country_en'), ] operations = [ migrations.Al...
Add migration for remove blank=True on country_en field
Add migration for remove blank=True on country_en field
Python
mit
p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2018-11-15 10:04 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('studygroups', '0106_studygroup_country_en'), + ] + ...
3b3c3c68c52f586db0be44e22fe5ba9400c5e53c
familias/migrations/0008_auto_20170303_2331.py
familias/migrations/0008_auto_20170303_2331.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2017-03-03 23:31 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('familias', '0007_merge_20170228_1344'), ] operations = [ migrations.AlterFi...
Create appropriate migrations for changes in models
Create appropriate migrations for changes in models
Python
mit
erikiado/jp2_online,erikiado/jp2_online,erikiado/jp2_online
--- +++ @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.2 on 2017-03-03 23:31 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('familias', '0007_merge_20170228_1344'), + ] + + ...
479275674916e45c0a2b70a372962f3d0c271e4f
SatNOGS/base/management/commands/update_all_tle.py
SatNOGS/base/management/commands/update_all_tle.py
from orbit import satellite from django.core.management.base import BaseCommand from base.utils import update_all_satellites from base.models import Satellite class Command(BaseCommand): help = 'Create initial fixtures' def handle(self, *args, **options): satellites = Satellite.objets.all() ...
Add management command to update all existing satellite tle data
Add management command to update all existing satellite tle data
Python
agpl-3.0
cshields/satnogs-network,cshields/satnogs-network,cshields/satnogs-network,cshields/satnogs-network
--- +++ @@ -0,0 +1,31 @@ +from orbit import satellite + +from django.core.management.base import BaseCommand + +from base.utils import update_all_satellites +from base.models import Satellite + + +class Command(BaseCommand): + help = 'Create initial fixtures' + + def handle(self, *args, **options): + + s...
9baf9ede15fa988b5da711605b67cc5bbbbc5b36
wanorlan/wanorlan.py
wanorlan/wanorlan.py
import time import datetime import subprocess import json import sys import re PING_RTT_REGEX = re.compile('rtt.+=\s*([\d.]+)') def get_status(ip, timeout): t0 = time.time() error = subprocess.call(['ping', '-c', '1', '-W', str(timeout), ip], stdout=sys.stderr.fileno(), ...
Add simple script for logging to diagnose WAN vs LAN connection issues
Add simple script for logging to diagnose WAN vs LAN connection issues
Python
mit
DouglasOrr/Snippets,DouglasOrr/Snippets,DouglasOrr/Snippets,DouglasOrr/Snippets,DouglasOrr/Snippets,DouglasOrr/Snippets,DouglasOrr/Snippets,DouglasOrr/Snippets
--- +++ @@ -0,0 +1,47 @@ +import time +import datetime +import subprocess +import json +import sys +import re + + +PING_RTT_REGEX = re.compile('rtt.+=\s*([\d.]+)') + + +def get_status(ip, timeout): + t0 = time.time() + error = subprocess.call(['ping', '-c', '1', '-W', str(timeout), ip], + ...
28067277adb659465f1762bd1437a45404fe15e6
cobs2/_cobspy.py
cobs2/_cobspy.py
""" Consistent Overhead Byte Stuffing (COBS) This version is for Python 2.x. """ class DecodeError(Exception): pass def encode(in_bytes): """Encode a string using Consistent Overhead Byte Stuffing (COBS). Input is any byte string. Output is also a byte string. Encoding guarantees no zero ...
Add Python 2.x pure Python implementation.
Add Python 2.x pure Python implementation.
Python
mit
cmcqueen/cobs-python,cmcqueen/cobs-python
--- +++ @@ -0,0 +1,78 @@ +""" +Consistent Overhead Byte Stuffing (COBS) + +This version is for Python 2.x. +""" + + +class DecodeError(Exception): + pass + + +def encode(in_bytes): + """Encode a string using Consistent Overhead Byte Stuffing (COBS). + + Input is any byte string. Output is also a byte str...