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
f6fcd5324993a6804b8ec5b17e63b8235ca4b730
check_cuda_version.py
check_cuda_version.py
#!/usr/bin/env python """ Simple script for checking installed CUDA version. """ import ctypes try: _libcudart = ctypes.cdll.LoadLibrary('libcudart.so') except: print 'CUDA runtime library not found' else: _libcudart.cudaDriverGetVersion.restype = int _libcudart.cudaDriverGetVersion.argtypes = [ctype...
Add script for checking installed CUDA version.
Add script for checking installed CUDA version.
Python
bsd-3-clause
cerrno/neurokernel
--- +++ @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +""" +Simple script for checking installed CUDA version. +""" + +import ctypes + +try: + _libcudart = ctypes.cdll.LoadLibrary('libcudart.so') +except: + print 'CUDA runtime library not found' +else: + _libcudart.cudaDriverGetVersion.restype = int + _libcud...
5e31b9bc0817047c1e63f69ad38a4a9e9dbd29ec
fiasco/generator.py
fiasco/generator.py
from . import model class Connection(object): def __init__(self, left, right, relationship, detail): self.left = left self.right = right self.relationship = relationship self.detail = detail class ConnectionModel(object): """The build method should yield a tuple of every po...
Build a connection model system which will help with generating new Fiascos based on a playset and a set of characters.
Build a connection model system which will help with generating new Fiascos based on a playset and a set of characters.
Python
mit
RemyPorter/FiascoGenerator
--- +++ @@ -0,0 +1,43 @@ +from . import model + +class Connection(object): + def __init__(self, left, right, relationship, detail): + self.left = left + self.right = right + self.relationship = relationship + self.detail = detail + +class ConnectionModel(object): + """The build metho...
a817600e1b30544a0244e76c414244b5182cdf08
Python/makeBarcode.py
Python/makeBarcode.py
import argparse def makeBarcode(label): print("^XA") #start of label print("^DFFORMAT^FS") #download and store format, name of format, end of field data (FS = field stop) print("^LH0,0") # label home position (label home = LH) print("^FO400,20^AFN,60,20^FN1^FS") #AF = assign font F, field number 1 (FN1...
Add script to generate plate barcodes for the Zebra printer
Add script to generate plate barcodes for the Zebra printer
Python
apache-2.0
jgruselius/misc,jgruselius/misc,jgruselius/misc,jgruselius/misc,jgruselius/misc
--- +++ @@ -0,0 +1,23 @@ +import argparse + +def makeBarcode(label): + print("^XA") #start of label + print("^DFFORMAT^FS") #download and store format, name of format, end of field data (FS = field stop) + print("^LH0,0") # label home position (label home = LH) + print("^FO400,20^AFN,60,20^FN1^FS") #AF = ...
84b1d56be22320a21bc4a0b100bd1ac488b72711
tekka/helper/history.py
tekka/helper/history.py
""" provide functions for history handling. note that history stuff is only possible if maki is not running remote. """ import os from ..com import sushi from ..typecheck import types FILEPATTERN= re.compile('[0-9]+-[0-9]+\.txt') def get_log_dir(): return sushi.config_get("directories","logs") def get_available_...
Add helper for log retrieval
Add helper for log retrieval
Python
bsd-2-clause
sushi-irc/tekka
--- +++ @@ -0,0 +1,53 @@ +""" provide functions for history handling. + note that history stuff is only possible + if maki is not running remote. +""" +import os +from ..com import sushi +from ..typecheck import types + +FILEPATTERN= re.compile('[0-9]+-[0-9]+\.txt') + +def get_log_dir(): + return sushi.config_get("di...
c8bb2fdf3a3e48945c2bed100c1856c14a75e8f7
tests/test_issue_410.py
tests/test_issue_410.py
"""Test for issue `#410`_. This tests for at least one of the bugs reported in `#410`_, namely that paginated pages were not being built if they had no children. .. _#410: https://github.com/lektor/lektor/issues/410 """ import os import pytest @pytest.fixture( params=[ pytest.param(True, id="paginate...
Test that childless pages get built, even if paginated
Test that childless pages get built, even if paginated
Python
bsd-3-clause
lektor/lektor,lektor/lektor,lektor/lektor,lektor/lektor
--- +++ @@ -0,0 +1,45 @@ +"""Test for issue `#410`_. + +This tests for at least one of the bugs reported in `#410`_, namely + that paginated pages were not being built if they had no children. + +.. _#410: https://github.com/lektor/lektor/issues/410 + +""" +import os + +import pytest + + +@pytest.fixture( + params...
3316b3fdde76125515e056abf403f509a6b7c454
lookup_from_filesystem.py
lookup_from_filesystem.py
from __future__ import print_function import os import sys from movie_util import filenames_to_search_strings, print_movies from filmtipset_util import get_grades def is_proper_movie_file(filename): FILE_ENDINGS = [".mkv", ".mp4", ".avi", ".iso", "mpeg", ] if filename[-4:] in FILE_ENDINGS: return True ...
Add utility for looking up grades for files in a directory.
Add utility for looking up grades for files in a directory.
Python
mit
EmilStenstrom/nephele
--- +++ @@ -0,0 +1,38 @@ +from __future__ import print_function +import os +import sys +from movie_util import filenames_to_search_strings, print_movies +from filmtipset_util import get_grades + +def is_proper_movie_file(filename): + FILE_ENDINGS = [".mkv", ".mp4", ".avi", ".iso", "mpeg", ] + if filename[-4:] i...
9bffaf3054960b88daec22e1206fe15e345716fc
tests/terminal_tests/TerminalCreationTest.py
tests/terminal_tests/TerminalCreationTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import TestCase from grammpy import Terminal class TempClass: pass class TerminalCreationTest(TestCase): def test_createWithSymbol(self): ter = Terminal('a', None) se...
Add creation tests for Terminal
Add creation tests for Terminal
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -0,0 +1,33 @@ +#!/usr/bin/env python +""" +:Author Patrik Valkovic +:Created 23.06.2017 16:39 +:Licence GNUv3 +Part of grammpy + +""" +from unittest import TestCase +from grammpy import Terminal + + +class TempClass: + pass + + +class TerminalCreationTest(TestCase): + def test_createWithSymbol(self):...
28e9129a71cac0ab60071d6e2a6bd258312703a8
example_script3.py
example_script3.py
""" Usage: python -m recipy example_script3.py OUTPUT.npy """ from __future__ import print_function import sys import numpy if len(sys.argv) < 2: print(__doc__, file=sys.stderr) sys.exit(1) arr = numpy.arange(10) arr = arr + 500 # We've made a fairly big change here! numpy.save(sys.argv[1], arr)
Add example script for python -m recipy usage
Add example script for python -m recipy usage
Python
apache-2.0
github4ry/recipy,musically-ut/recipy,github4ry/recipy,MBARIMike/recipy,MichielCottaar/recipy,MBARIMike/recipy,recipy/recipy,recipy/recipy,MichielCottaar/recipy,musically-ut/recipy
--- +++ @@ -0,0 +1,18 @@ +""" +Usage: python -m recipy example_script3.py OUTPUT.npy +""" + +from __future__ import print_function +import sys + +import numpy + +if len(sys.argv) < 2: + print(__doc__, file=sys.stderr) + sys.exit(1) + +arr = numpy.arange(10) +arr = arr + 500 +# We've made a fairly big change her...
46c241e7cfae717d5dfd5352846c2568079280a4
b_spline.py
b_spline.py
''' Module provides functions for points interpolation using b-splines of 2nd order ''' import numpy as np from matplotlib import pyplot as plt def b_spline_2(x): n = len(x) x = np.hstack([np.linspace(0, n-1, n)[np.newaxis].T, x]) M0 = np.array([[2, -4, 2], [0, 4, -3], [0, 0, 1]]) M1 = np.array([[1,...
Create module for points interpolation using B-spline of 2nd degree.
Create module for points interpolation using B-spline of 2nd degree.
Python
mit
petroolg/robo-spline
--- +++ @@ -0,0 +1,47 @@ +''' Module provides functions for points interpolation using b-splines of 2nd order ''' + +import numpy as np +from matplotlib import pyplot as plt + + +def b_spline_2(x): + + n = len(x) + x = np.hstack([np.linspace(0, n-1, n)[np.newaxis].T, x]) + M0 = np.array([[2, -4, 2], [0, 4, -...
62bef762a3d999e1d9f3b551320e22619d83b7ca
src/etc/latest-unix-snaps.py
src/etc/latest-unix-snaps.py
#!/usr/bin/env python import os, tarfile, hashlib, re, shutil, sys from snapshot import * f = open(snapshotfile) date = None rev = None platform = None snap = None i = 0 newestSet = {} for line in f.readlines(): i += 1 parsed = parse_line(i, line) if (not parsed): continue if parsed["type"] == "sn...
Add a Python script which downloads only the latest Linux snapshots (derived from other scripts here)
Add a Python script which downloads only the latest Linux snapshots (derived from other scripts here)
Python
apache-2.0
pshc/rust,TheNeikos/rust,AerialX/rust,jroesch/rust,reem/rust,rprichard/rust,mahkoh/rust,LeoTestard/rust,jroesch/rust,philyoon/rust,P1start/rust,P1start/rust,pythonesque/rust,zachwick/rust,ebfull/rust,mvdnes/rust,pshc/rust,aepsil0n/rust,robertg/rust,carols10cents/rust,emk/rust,sarojaba/rust-doc-korean,rohitjoshi/rust,se...
--- +++ @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +import os, tarfile, hashlib, re, shutil, sys +from snapshot import * + +f = open(snapshotfile) +date = None +rev = None +platform = None +snap = None +i = 0 + +newestSet = {} + + +for line in f.readlines(): + i += 1 + parsed = parse_line(i, line) + if (not p...
e46f171f87d756bcd2f25dbc5d5a56422e1bcbd8
kufpybio/gorestapi.py
kufpybio/gorestapi.py
# https://www.ebi.ac.uk/QuickGO/WebServices.html import os import csv import restapi class GORESTAPI(restapi.RESTAPI): def __init__(self, download_folder="go_files"): self._download_folder = download_folder self._base_url = "https://www.ebi.ac.uk/QuickGO/GTerm?" if not os.path.exists(sel...
Add a REST API for GO
Add a REST API for GO
Python
isc
konrad/kufpybio
--- +++ @@ -0,0 +1,20 @@ +# https://www.ebi.ac.uk/QuickGO/WebServices.html + +import os +import csv + +import restapi + +class GORESTAPI(restapi.RESTAPI): + + def __init__(self, download_folder="go_files"): + self._download_folder = download_folder + self._base_url = "https://www.ebi.ac.uk/QuickGO/GT...
d59103daa62897996b3585c2a826b092caf95a76
non_deterministic.py
non_deterministic.py
# Non-Deterministic Turing Machine Simulator class Queue(): def __init__(self): self.queue = [] def enqueue(self, state, head, string, iter_count): self.queue.append((state, head, string, iter_count)) def dequeue(self): item = self.queue[0] self.queue = self.queue[1:] ...
Implement non-deterministic turing machine in Python
Implement non-deterministic turing machine in Python
Python
mit
yedhukrishnan/turing-machine,yedhukrishnan/turing-machine
--- +++ @@ -0,0 +1,94 @@ +# Non-Deterministic Turing Machine Simulator + +class Queue(): + def __init__(self): + self.queue = [] + + def enqueue(self, state, head, string, iter_count): + self.queue.append((state, head, string, iter_count)) + + def dequeue(self): + item = self.queue[0] + ...
61be745b641689addc9f009311d28a5775d5a18b
ctconfig.py
ctconfig.py
import logging import json from tornado.options import define, options _CONFIG_FILENAME = "cutthroat.conf" def define_options(): """Define defaults for most custom options""" # Log file and config file paths options.log_file_prefix = "/var/log/cutthroat/cutthroat.log" define( "conf_file_path...
import logging import json from tornado.options import define, options _CONFIG_FILENAME = "cutthroat.conf" def define_options(): """Define defaults for most custom options""" # Log file and config file paths options.log_file_prefix = "/var/log/cutthroat/cutthroat.log" define( "conf_file_path...
Set `output_routes` to True by default
Set `output_routes` to True by default
Python
agpl-3.0
hfaran/LivesPool,hfaran/LivesPool,hfaran/LivesPool,hfaran/LivesPool
--- +++ @@ -31,10 +31,9 @@ default="cutthroat.db" ) - # Options for testing define( "output_routes", - default=False, + default=True, type=bool, help="If enabled, outputs all application routes to `routes.json`" )
8c20a2c570aac422106e866d63a8c1e40cc2a98f
components/google-cloud/google_cloud_pipeline_components/container/experimental/__init__.py
components/google-cloud/google_cloud_pipeline_components/container/experimental/__init__.py
# Copyright 2022 The Kubeflow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
Add init file to container/experimental directory to recognize as a python module.
Add init file to container/experimental directory to recognize as a python module. PiperOrigin-RevId: 447585056
Python
apache-2.0
kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines,kubeflow/pipelines
--- +++ @@ -0,0 +1,14 @@ +# Copyright 2022 The Kubeflow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2....
b9093b09b1bfa1e7bb50a41d03eab61c3a3d9fc5
test/test_commonsdowloader.py
test/test_commonsdowloader.py
#!/usr/bin/env python # -*- coding: latin-1 -*- """Unit tests.""" import unittest import commonsdownloader class TestCommonsDownloader(unittest.TestCase): """Testing methods from commonsdownloader.""" def test_clean_up_filename(self): """Test clean_up_filename.""" values = [('Example.jpg',...
Add unittests for the commonsdownloader module
Add unittests for the commonsdownloader module Add a unittest module to test the methods in the commonsdownloader module. Add test for method clean_up_filename()
Python
mit
Commonists/CommonsDownloader
--- +++ @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: latin-1 -*- + +"""Unit tests.""" + +import unittest +import commonsdownloader + + +class TestCommonsDownloader(unittest.TestCase): + + """Testing methods from commonsdownloader.""" + + def test_clean_up_filename(self): + """Test clean_up_file...
90a0ed45ed56467f3083b262708f81434aa9aaa9
tests/test_pipeline_rnaseq.py
tests/test_pipeline_rnaseq.py
""" .. Copyright 2017 EMBL-European Bioinformatics Institute 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 applic...
Test the pipeline code for the RNA-seq pipeline
Test the pipeline code for the RNA-seq pipeline
Python
apache-2.0
Multiscale-Genomics/mg-process-fastq,Multiscale-Genomics/mg-process-fastq,Multiscale-Genomics/mg-process-fastq
--- +++ @@ -0,0 +1,64 @@ +""" +.. Copyright 2017 EMBL-European Bioinformatics Institute + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENS...
e9c0aaf5434f30d66e9b3827261c8576e16e7083
get_data.py
get_data.py
#!/usr/bin/env python from rajab_roza import RajabRoza lat = 51.0 + 32.0/60.0 lng = -22.0/60.0 start_year = 1435 end_year = 1436 filename = "1435-1436.yml" if __name__ == '__main__': rajab_roza = RajabRoza(lat, lng, start_year, end_year) rajab_roza.get_roza_durations() rajab_roza.save_to_yaml(filename)
Add basic script to get roza durations for assigned parameters.
Add basic script to get roza durations for assigned parameters.
Python
mit
mygulamali/rajab_roza
--- +++ @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +from rajab_roza import RajabRoza + +lat = 51.0 + 32.0/60.0 +lng = -22.0/60.0 +start_year = 1435 +end_year = 1436 +filename = "1435-1436.yml" + +if __name__ == '__main__': + rajab_roza = RajabRoza(lat, lng, start_year, end_year) + rajab_roza.get_roza_durations()...
934cafa73a15705c4d7c33733c61f8c272b9971e
profile_basic_test.py
profile_basic_test.py
from pyresttest import resttest from pyresttest.benchmarks import Benchmark from pyresttest.binding import Context from pyresttest.contenthandling import ContentHandler from pyresttest.generators import factory_generate_ids import cProfile cProfile.run('resttest.command_line_run(["http://localhost:8000","pyresttest/c...
Add script that profiles basic test run
Add script that profiles basic test run
Python
apache-2.0
svanoort/pyresttest,suvarnaraju/pyresttest,suvarnaraju/pyresttest,alazaro/pyresttest,satish-suradkar/pyresttest,MorrisJobke/pyresttest,netjunki/pyresttest,wirewit/pyresttest,janusnic/pyresttest,TimYi/pyresttest,wirewit/pyresttest,MorrisJobke/pyresttest,TimYi/pyresttest,sunyanhui/pyresttest,netjunki/pyresttest,janusnic/...
--- +++ @@ -0,0 +1,11 @@ +from pyresttest import resttest +from pyresttest.benchmarks import Benchmark +from pyresttest.binding import Context +from pyresttest.contenthandling import ContentHandler +from pyresttest.generators import factory_generate_ids + +import cProfile + +cProfile.run('resttest.command_line_run(["...
11f2470adb5b52e32e08a041bf868591e858e4ed
doggunk4.py
doggunk4.py
import curses # -*- coding: utf-8 -*- dogdance1=[ ' ▄','▄', '▄', #3 '▄▄▄▄', '▄', '▄', #6 '▄\n', ' ', ' ', ' ', '▄', '▄\n',#12 ' ', ' ' , '▄',#15 ' ', '▄', ' ',#18 '▄▄', '▄▄\n', ' ',#21 ' ', '▄', ' ',#24 ' ', '▄', ' ',#27 '▄', ' ', '▄▄▄▄▄▄',#30 '▄\n', ' ', ' ',#33 '▄▄▄▄',' ',' ',#36 '▀\...
WORK WORK WOKR ROWK KROW
WORK WORK WOKR ROWK KROW
Python
mit
David-OC/dancingdog,David-OC/dancingdog
--- +++ @@ -0,0 +1,72 @@ +import curses +# -*- coding: utf-8 -*- + +dogdance1=[ +' ▄','▄', '▄', #3 +'▄▄▄▄', '▄', '▄', #6 +'▄\n', ' ', ' ', +' ', '▄', '▄\n',#12 +' ', ' ' , '▄',#15 +' ', '▄', ' ',#18 +'▄▄', '▄▄\n', ' ',#21 +' ', '▄', ' ',#24 +' ', '▄', ' ',#27 +'▄', ' ', '▄▄▄▄▄▄',#30 +'▄\n', ' ', ...
2fa1e73c44b03ab81e72d14863fd80cff010f0d7
tests/test_comparisons.py
tests/test_comparisons.py
from itertools import combinations from unittest import TestCase from ordering import Ordering class TestComparisons(TestCase): def setUp(self) -> None: self.ordering = Ordering[int]() self.ordering.insert_start(0) self.ordering.insert_after(0, 1) self.ordering.insert_before(0, 2...
Add unit test for complicated comparisons
Add unit test for complicated comparisons
Python
mit
madman-bob/python-order-maintenance
--- +++ @@ -0,0 +1,30 @@ +from itertools import combinations +from unittest import TestCase + +from ordering import Ordering + + +class TestComparisons(TestCase): + def setUp(self) -> None: + self.ordering = Ordering[int]() + + self.ordering.insert_start(0) + self.ordering.insert_after(0, 1) +...
5fa0ad818cbb1afd17d819ec6649430d16726f7c
euler029.py
euler029.py
#!/usr/bin/python power_list = set() for a in range(2, 101): for b in range(2, 101): power_list.add(a ** b) print(len(power_list))
Add solution for problem 29
Add solution for problem 29
Python
mit
cifvts/PyEuler
--- +++ @@ -0,0 +1,9 @@ +#!/usr/bin/python + +power_list = set() + +for a in range(2, 101): + for b in range(2, 101): + power_list.add(a ** b) + +print(len(power_list))
09ff9e9967ad53b6ee2bff5cb38874d3b2e6d35a
build/unix/rootmapcat.py
build/unix/rootmapcat.py
#! /usr/bin/env python ''' An utility to smartly "cat" rootmap files. ''' from __future__ import print_function import argparse import sys #------------------------------------------------------------------------------- def getParser(): parser = argparse.ArgumentParser(description='Get input rootmaps and output r...
Concatenate rootmaps in a smart way
Concatenate rootmaps in a smart way - Avoid duplicates in the fwd declaration section - Reduce keys sections if the library is the same Merging rootmaps speeds up ROOT startup, especially on file systems like afs or cvmfs.
Python
lgpl-2.1
thomaskeck/root,CristinaCristescu/root,karies/root,buuck/root,CristinaCristescu/root,agarciamontoro/root,gganis/root,veprbl/root,zzxuanyuan/root,root-mirror/root,abhinavmoudgil95/root,olifre/root,gbitzes/root,mhuwiler/rootauto,buuck/root,bbockelm/root,karies/root,karies/root,sawenzel/root,CristinaCristescu/root,gganis/...
--- +++ @@ -0,0 +1,84 @@ +#! /usr/bin/env python + +''' +An utility to smartly "cat" rootmap files. +''' +from __future__ import print_function +import argparse +import sys + +#------------------------------------------------------------------------------- +def getParser(): + parser = argparse.ArgumentParser(descr...
0125d6a8617d6ebc95c74f923ce3107ec538a297
test_hacks_monkeypatching.py
test_hacks_monkeypatching.py
import sys import io import hacks def test_stdout_monkeypatching(): # Let's first patch stdout manually: real_stdout = sys.stdout fake_stdout = io.StringIO() sys.stdout = fake_stdout # While it is monkey-patched, other users print('Hello') # may write something else into out fake...
Add new illustrative test: monkeypatching stdout
Add new illustrative test: monkeypatching stdout
Python
mit
t184256/hacks
--- +++ @@ -0,0 +1,46 @@ +import sys +import io + +import hacks + + +def test_stdout_monkeypatching(): + + # Let's first patch stdout manually: + real_stdout = sys.stdout + fake_stdout = io.StringIO() + sys.stdout = fake_stdout # While it is monkey-patched, other users + print('Hello') ...
8656688c82334dcb1bf064687bc05b1ea9b6a9d0
mechanize.py
mechanize.py
#!/usr/bin/env import mechanize def test_agent(url, user_agent): browser = mechanize.Browser() browser.addheaders = user_agent page = browser.open(url) source_code = page.read() print source_code user_agent = [('User-agent','Mozilla/5.0 (X11; U; Linux 2.4.2-2 i586; en-US; m18) Gecko/20010131 Nets...
Create basic user agent spoofer with Mechanize
Create basic user agent spoofer with Mechanize
Python
mit
jwarren116/network-tools-deux
--- +++ @@ -0,0 +1,15 @@ +#!/usr/bin/env +import mechanize + + +def test_agent(url, user_agent): + browser = mechanize.Browser() + browser.addheaders = user_agent + page = browser.open(url) + source_code = page.read() + print source_code + +user_agent = [('User-agent','Mozilla/5.0 (X11; U; Linux 2.4.2-...
66c5e80afc4f520ddc239e6f458a4a2e2142fab1
tests/test_hdf5_adjacency.py
tests/test_hdf5_adjacency.py
""" .. Copyright 2017 EMBL-European Bioinformatics Institute 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 applic...
Test script stub for testing the adjacency reader
Test script stub for testing the adjacency reader
Python
apache-2.0
Multiscale-Genomics/mg-dm-api,Multiscale-Genomics/mg-dm-api
--- +++ @@ -0,0 +1,30 @@ +""" +.. Copyright 2017 EMBL-European Bioinformatics Institute + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENS...
c7c72c2221109b6fd7b9bf7e18c6a6c3a0e65c1b
scripts/utils.py
scripts/utils.py
"""Helper script that contains many utilities. """ __authors__ = [ '"Madhusudan.C.S" <madhusudancs@gmail.com>', ] from tagging.managers import TaggedItem from pytask.taskapp.models import Task def remove_textbook_from_chapter(): """Removes the tag Textbook from Chapter. """ tasks = TaggedItem.ob...
Add a utility script with a function to remove Textbook from current textbook chapter tasks.
Add a utility script with a function to remove Textbook from current textbook chapter tasks.
Python
agpl-3.0
madhusudancs/pytask,madhusudancs/pytask,madhusudancs/pytask
--- +++ @@ -0,0 +1,27 @@ +"""Helper script that contains many utilities. +""" + + +__authors__ = [ + '"Madhusudan.C.S" <madhusudancs@gmail.com>', + ] + + +from tagging.managers import TaggedItem + +from pytask.taskapp.models import Task + + +def remove_textbook_from_chapter(): + """Removes the tag Textbook from ...
23ee1e71fd7811789c5425b6fc2cfcde2057b57f
examples/convert_samples.py
examples/convert_samples.py
#!\usr\bin\env python """A test script to parse the existing samples and convert them to JSON. Not all of the examples currently work. Example usage: python convert_samples.py /path/to/cybox_v2.0_samples """ import os import sys import cybox.bindings.cybox_core as core_binding from cybox.core import Observable...
Add test script for existing samples
Add test script for existing samples
Python
bsd-3-clause
CybOXProject/python-cybox
--- +++ @@ -0,0 +1,54 @@ +#!\usr\bin\env python + +"""A test script to parse the existing samples and convert them to JSON. + +Not all of the examples currently work. + +Example usage: + python convert_samples.py /path/to/cybox_v2.0_samples +""" + +import os +import sys + +import cybox.bindings.cybox_core as core_...
6b3424f3cc33574c825b7c41d9d848e9d6b002a1
src/run_similarity.py
src/run_similarity.py
import argparse import datetime from os import getcwd from os.path import isdir, exists from project import corpus, knn_corpus, lda_corpus, word2vec_corpus algorithms = {"lda": lda_corpus.LDACorpus, "knn": knn_corpus.KNNCorpus, "w2v": word2vec_corpus.W2VCorpus} base_dir = getcwd() output_l...
Add structure for query harness
Add structure for query harness
Python
mit
PinPinIre/Final-Year-Project,PinPinIre/Final-Year-Project,PinPinIre/Final-Year-Project
--- +++ @@ -0,0 +1,46 @@ +import argparse +import datetime +from os import getcwd +from os.path import isdir, exists +from project import corpus, knn_corpus, lda_corpus, word2vec_corpus + +algorithms = {"lda": lda_corpus.LDACorpus, + "knn": knn_corpus.KNNCorpus, + "w2v": word2vec_corpus.W2VC...
94c481fc17968030d7c25072985d70eb7b4413e1
tests/test_api.py
tests/test_api.py
from bmi_tester.api import check_bmi def test_bmi_check(tmpdir): with tmpdir.as_cwd(): with open("input.yaml", "w") as fp: pass assert ( check_bmi( "bmi_tester.bmi:Bmi", input_file="input.yaml", extra_args=["-vvv"] ) == 0 ) ...
Add unit tests for check_bmi.
Add unit tests for check_bmi.
Python
mit
csdms/bmi-tester
--- +++ @@ -0,0 +1,45 @@ +from bmi_tester.api import check_bmi + + +def test_bmi_check(tmpdir): + with tmpdir.as_cwd(): + with open("input.yaml", "w") as fp: + pass + assert ( + check_bmi( + "bmi_tester.bmi:Bmi", input_file="input.yaml", extra_args=["-vvv"] + ...
cc14698280f5982c472c51185d57d5f5292ce518
byceps/blueprints/ticketing/views.py
byceps/blueprints/ticketing/views.py
""" byceps.blueprints.ticketing.views ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2017 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from flask import abort, g from ...services.ticketing import ticket_service from ...util.framework.blueprint import create_blueprint from ...util.ite...
""" byceps.blueprints.ticketing.views ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2017 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from flask import abort, g from ...services.ticketing import ticket_service from ...util.framework.blueprint import create_blueprint from ...util.ite...
Rename variable, prefix private function
Rename variable, prefix private function
Python
bsd-3-clause
homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps
--- +++ @@ -21,12 +21,13 @@ @templated def index_mine(): """List tickets related to the current user.""" - me = get_current_user_or_403() + current_user = _get_current_user_or_403() tickets = ticket_service.find_tickets_related_to_user_for_party( - me.id, g.party.id) + current_user.i...
fba35ea4fdaf3a9076bcd9eefdcf1dce3d41b05a
src/templates.py
src/templates.py
import os from . import reporting def create_section(title, desc, props, subsects, figures_list): assert isinstance(title, str) assert isinstance(desc, str) assert isinstance(props, list) assert isinstance(figures_list, list) section = reporting.Section(title, []) section.add(reporting.BlockL...
Add a template to readily generate PDF report from properties and dimensions
Add a template to readily generate PDF report from properties and dimensions
Python
mit
iwob/evoplotter,iwob/evoplotter
--- +++ @@ -0,0 +1,54 @@ +import os +from . import reporting + + +def create_section(title, desc, props, subsects, figures_list): + assert isinstance(title, str) + assert isinstance(desc, str) + assert isinstance(props, list) + assert isinstance(figures_list, list) + + section = reporting.Section(title...
79a83a46f788814d186267eeea640bcb9127be6f
problem3.py
problem3.py
""" In DNA strings, symbols 'A' and 'T' are complements of each other, as are 'C' and 'G'. The reverse complement of a DNA string s is the string sc formed by reversing the symbols of s, then taking the complement of each symbol (e.g., the reverse complement of "GTCA" is "TGAC"). Given: A DNA string s of length at mo...
Add solution to complementing a strand of DNA
Add solution to complementing a strand of DNA
Python
mit
MichaelAquilina/rosalind-solutions
--- +++ @@ -0,0 +1,29 @@ +""" +In DNA strings, symbols 'A' and 'T' are complements of each other, as are 'C' and 'G'. + +The reverse complement of a DNA string s is the string sc formed by reversing the symbols of s, then +taking the complement of each symbol (e.g., the reverse complement of "GTCA" is "TGAC"). + +Giv...
9f88afa75279a6accd859a521afb2ec311874032
spiral_out.py
spiral_out.py
size = 7 m = [[0] * size for _ in range(size)] start = size // 2 total = size * size current = 1 i = j = start direction = 0 current_leg_length = 1 leg_length_now = 0 current_leg_count = 0 while current <= total: m[i][j] = current current += 1 leg_length_now += 1 if direction == 0: j -= 1 ...
Add program populating matrix with numbers starting with 1 in the matrix center and then spiralling out
Add program populating matrix with numbers starting with 1 in the matrix center and then spiralling out
Python
mit
dnl-blkv/algorithms
--- +++ @@ -0,0 +1,38 @@ +size = 7 +m = [[0] * size for _ in range(size)] +start = size // 2 +total = size * size +current = 1 + +i = j = start +direction = 0 +current_leg_length = 1 +leg_length_now = 0 +current_leg_count = 0 + +while current <= total: + m[i][j] = current + current += 1 + leg_length_now += 1...
74a624b57e1f5ccc0f62665d3ff52eef38ca9192
tests/test_robot.py
tests/test_robot.py
import time import unittest from unittest import mock from robot import game_specific from robot.board import Board from robot.robot import Robot from tests.mock_robotd import MockRobotDFactoryMixin class RobotTest(MockRobotDFactoryMixin, unittest.TestCase): def mock_kill_after_delay(self): return mock.p...
Test Robot interactions with wait_start
Test Robot interactions with wait_start
Python
mit
sourcebots/robot-api,sourcebots/robot-api
--- +++ @@ -0,0 +1,70 @@ +import time +import unittest +from unittest import mock + +from robot import game_specific +from robot.board import Board +from robot.robot import Robot +from tests.mock_robotd import MockRobotDFactoryMixin + + +class RobotTest(MockRobotDFactoryMixin, unittest.TestCase): + def mock_kill_a...
1a11007938fbe2964fc121b57aadef8a9d9cb1a0
note/migrations/0004_auto_20150305_1003.py
note/migrations/0004_auto_20150305_1003.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations, transaction import django.utils.timezone # the function that will be used by the migration operation @transaction.atomic def copy_old_users(apps, schema_editor): # the default user class User = apps.get_m...
Migrate to a custom User class (4)
Migrate to a custom User class (4) step4: create an empty migration script python manage.py makemigrations --empty note Then edit the script and add a function that will copy the users from the old users table to the new one.
Python
bsd-2-clause
LeMeteore/boomer2
--- +++ @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations, transaction +import django.utils.timezone + +# the function that will be used by the migration operation +@transaction.atomic +def copy_old_users(apps, schema_editor): + # the def...
b4a35dc750ca1b9defd955c239fb43cb9a322732
print_xsl.py
print_xsl.py
import logging import os from settings import CONVERSIONS, XSL_PATH logger = logging.getLogger(__name__) def print_xsl_files(): for parts in CONVERSIONS: file_path = os.path.join(XSL_PATH, parts[0]) print(file_path) if '__main__' == __name__: logging.basicConfig(level=logging.DEBUG) print_xsl_files()
Add print XSL files script
Add print XSL files script
Python
mit
AustralianAntarcticDataCentre/metadata_xml_convert,AustralianAntarcticDataCentre/metadata_xml_convert
--- +++ @@ -0,0 +1,19 @@ +import logging +import os + +from settings import CONVERSIONS, XSL_PATH + + +logger = logging.getLogger(__name__) + + +def print_xsl_files(): + for parts in CONVERSIONS: + file_path = os.path.join(XSL_PATH, parts[0]) + print(file_path) + + +if '__main__' == __name__: + logging.basicConfig(...
368ade3641c017d534bb42b8c448a9bbdbb39631
quilt/pop.py
quilt/pop.py
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80: # python-quilt - A Python implementation of the quilt patch system # # Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as ...
Implement a Pop class to unapply patches
Implement a Pop class to unapply patches
Python
mit
vadmium/python-quilt,bjoernricks/python-quilt
--- +++ @@ -0,0 +1,80 @@ +# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80: + +# python-quilt - A Python implementation of the quilt patch system +# +# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU ...
ea4294761482d5cf1c6f7c5aeab452f43bfcd1fa
tools/detect_stuff.py
tools/detect_stuff.py
# Ported From: http://docs.opencv.org/3.1.0/d7/d8b/tutorial_py_face_detection.html import os import cv2 cascade = cv2.CascadeClassifier('/home/matt/Projects/opencv-junk/classifier/run_two/cascade_xmls/cascade.xml') img_dir = '/mnt/jam-gui/smb-share:server=jamstation,share=gopro/2017-02-17/HERO4 Session 1/testing_frame...
Add simple script to display positive detections
Add simple script to display positive detections
Python
mit
mattmakesmaps/opencv-junk
--- +++ @@ -0,0 +1,35 @@ +# Ported From: http://docs.opencv.org/3.1.0/d7/d8b/tutorial_py_face_detection.html +import os +import cv2 + +cascade = cv2.CascadeClassifier('/home/matt/Projects/opencv-junk/classifier/run_two/cascade_xmls/cascade.xml') +img_dir = '/mnt/jam-gui/smb-share:server=jamstation,share=gopro/2017-02...
6a2313efdf440e0c73d4c40898e9d36c5949d044
museum_site/migrations/0003_auto_20211028_1858.py
museum_site/migrations/0003_auto_20211028_1858.py
# Generated by Django 3.2.7 on 2021-10-28 18:58 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('museum_site', '0002_upload_announced'), ] operations = [ migrations.AlterField( model_name='file', name='author', ...
Increase max length of author and genre fields
Increase max length of author and genre fields
Python
mit
DrDos0016/z2,DrDos0016/z2,DrDos0016/z2
--- +++ @@ -0,0 +1,23 @@ +# Generated by Django 3.2.7 on 2021-10-28 18:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('museum_site', '0002_upload_announced'), + ] + + operations = [ + migrations.AlterField( + model_n...
b36eb09bb85bb4eee0db9669745e0c1adc244980
pavement.py
pavement.py
from paver.easy import * config = """# replace pass with values you would like to overwrite from DefaultConfig in # default_config.py. Values you do not explicitly overwrite will be inherited # from DefaultConfig. At the very least, you must set secret_key and # tmdb_api_key. from default_config import DefaultConfig...
Write default config with paver.
Write default config with paver.
Python
mit
simon-andrews/movieman2,simon-andrews/movieman2
--- +++ @@ -0,0 +1,23 @@ +from paver.easy import * + + +config = """# replace pass with values you would like to overwrite from DefaultConfig in +# default_config.py. Values you do not explicitly overwrite will be inherited +# from DefaultConfig. At the very least, you must set secret_key and +# tmdb_api_key. + +from...
460db2ca2fb55adc5ae67516f0e1af4c42898080
tests/test_frames.py
tests/test_frames.py
from . import TheInternetTestCase from helium.api import click, Text class FramesTest(TheInternetTestCase): def get_page(self): return "http://the-internet.herokuapp.com/frames" def test_nested_frames(self): click("Nested Frames") self.assertTrue(Text("LEFT").exists()) self.assertTrue(Text("MIDDLE").exists()...
Add test case for frames.
Add test case for frames.
Python
mit
bugfree-software/the-internet-solution-python
--- +++ @@ -0,0 +1,15 @@ +from . import TheInternetTestCase +from helium.api import click, Text + +class FramesTest(TheInternetTestCase): + def get_page(self): + return "http://the-internet.herokuapp.com/frames" + def test_nested_frames(self): + click("Nested Frames") + self.assertTrue(Text("LEFT").exists()) + se...
a5f380db22e20265b4d543827f052300b2fb3fa4
tests/test_choose.py
tests/test_choose.py
from tests.base import IntegrationTest from time import sleep class TestChooseProject(IntegrationTest): viminput = """ * [ ] test task 1 #{uuid} * [ ] test task 2 #{uuid} """ vimoutput = """ * [ ] test task 1 #{uuid} * [ ] test task 2 #{uuid} """ tasks = [ dict(descr...
Add tests for TaskWikiChooseProject command
tests: Add tests for TaskWikiChooseProject command
Python
mit
Spirotot/taskwiki,phha/taskwiki
--- +++ @@ -0,0 +1,111 @@ +from tests.base import IntegrationTest +from time import sleep + + +class TestChooseProject(IntegrationTest): + + viminput = """ + * [ ] test task 1 #{uuid} + * [ ] test task 2 #{uuid} + """ + + vimoutput = """ + * [ ] test task 1 #{uuid} + * [ ] test task 2 #{uuid}...
b30644799afb03ba6985b3e6d135d08e0db3d697
register.py
register.py
# -*- coding: utf-8 -*- # # register.py # # purpose: Automagically creates a Rst README.txt # author: Filipe P. A. Fernandes # e-mail: ocefpaf@gmail # web: http://ocefpaf.github.io/ # created: 10-Apr-2014 # modified: Fri 11 Apr 2014 12:10:43 AM BRT # # obs: https://coderwall.com/p/qawuyq # import os import ...
Convert README from Markdown to rst.
Convert README from Markdown to rst.
Python
bsd-3-clause
pyoceans/python-oceans,ocefpaf/python-oceans
--- +++ @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# +# register.py +# +# purpose: Automagically creates a Rst README.txt +# author: Filipe P. A. Fernandes +# e-mail: ocefpaf@gmail +# web: http://ocefpaf.github.io/ +# created: 10-Apr-2014 +# modified: Fri 11 Apr 2014 12:10:43 AM BRT +# +# obs: https://code...
5a59094e58e3389bd2f182b080e065c4a709f8f9
tests/test_turing.py
tests/test_turing.py
from unittest import TestCase, expectedFailure class TuringTests(TestCase): def setUp(self): from chatterbot import ChatBot self.chatbot = ChatBot('Agent Jr.') @expectedFailure def test_ask_name(self): response = self.chatbot.get_response( 'What is your name?' ...
Add very basic turing tests
Add very basic turing tests
Python
bsd-3-clause
vkosuri/ChatterBot,gunthercox/ChatterBot
--- +++ @@ -0,0 +1,55 @@ +from unittest import TestCase, expectedFailure + + +class TuringTests(TestCase): + + def setUp(self): + from chatterbot import ChatBot + + self.chatbot = ChatBot('Agent Jr.') + + @expectedFailure + def test_ask_name(self): + response = self.chatbot.get_response(...
dceae6725d10a5d1af6287e1b684c651683d1750
runtests.py
runtests.py
#!/usr/bin/env python import sys from os.path import dirname, abspath from django.conf import settings if len(sys.argv) > 1 and 'postgres' in sys.argv: sys.argv.remove('postgres') db_engine = 'postgresql_psycopg2' db_name = 'test_main' else: db_engine = 'sqlite3' db_name = '' if not settings.con...
#!/usr/bin/env python import sys from os.path import dirname, abspath import django from django.conf import settings if len(sys.argv) > 1 and 'postgres' in sys.argv: sys.argv.remove('postgres') db_engine = 'django.db.backends.postgresql_psycopg2' db_name = 'test_main' else: db_engine = 'django.db.bac...
Allow tests to be run on 1.4
Allow tests to be run on 1.4
Python
mit
jayfk/django-generic-m2m,jayfk/django-generic-m2m,coleifer/django-generic-m2m,coleifer/django-generic-m2m,coleifer/django-generic-m2m
--- +++ @@ -2,21 +2,21 @@ import sys from os.path import dirname, abspath +import django from django.conf import settings if len(sys.argv) > 1 and 'postgres' in sys.argv: sys.argv.remove('postgres') - db_engine = 'postgresql_psycopg2' + db_engine = 'django.db.backends.postgresql_psycopg2' db...
08fe04425cfb92a65bfededc85ed372188c6042e
python/tests/test_ctypes.py
python/tests/test_ctypes.py
from ctypes import CDLL, sizeof, create_string_buffer def test_hello_world(workspace): workspace.src('greeting.c', r""" #include <stdio.h> void greet(char *somebody) { printf("Hello, %s!\n", somebody); } """) workspace.src('hello.py', r""" import ctypes lib = ctypes.CDLL('./g...
Call functions in C library, mutable buffer
[python] Call functions in C library, mutable buffer
Python
mit
imsardine/learning,imsardine/learning,imsardine/learning,imsardine/learning,imsardine/learning,imsardine/learning,imsardine/learning
--- +++ @@ -0,0 +1,48 @@ +from ctypes import CDLL, sizeof, create_string_buffer + +def test_hello_world(workspace): + workspace.src('greeting.c', r""" + #include <stdio.h> + + void greet(char *somebody) { + printf("Hello, %s!\n", somebody); + } + """) + + workspace.src('hello.py', r""" + i...
97f0326bc5ab5ce5601b72eb3e2196dd85588705
19/Solution.py
19/Solution.py
class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def removeNthFromEnd(self, head, n): """ :type head: ListNode :type n: int :rtype: ListNode """ count = 0 node = head while node is not None: ...
Add my two pass solution
Add my two pass solution
Python
mit
xliiauo/leetcode,xiao0720/leetcode,xliiauo/leetcode,xiao0720/leetcode,xliiauo/leetcode
--- +++ @@ -0,0 +1,36 @@ +class ListNode: + def __init__(self, x): + self.val = x + self.next = None + +class Solution: + def removeNthFromEnd(self, head, n): + """ + :type head: ListNode + :type n: int + :rtype: ListNode + """ + count = 0 + node = ...
040a86941e20db4976850c3cfb046c58ff48d559
examples/pywapi-example.py
examples/pywapi-example.py
#!/usr/bin/env python import pywapi weather_com_result = pywapi.get_weather_from_weather_com('10001') yahoo_result = pywapi.get_weather_from_yahoo('10001') noaa_result = pywapi.get_weather_from_noaa('KJFK') print "Weather.com says: It is " + string.lower(weather_com_result['current_conditions']['text']) + " and " + ...
#!/usr/bin/env python import pywapi weather_com_result = pywapi.get_weather_from_weather_com('10001') yahoo_result = pywapi.get_weather_from_yahoo('10001') noaa_result = pywapi.get_weather_from_noaa('KJFK') print "Weather.com says: It is " + weather_com_result['current_conditions']['text'].lower() + " and " + weathe...
Fix error in example script
Fix error in example script
Python
mit
nmbryant/python-weather-api,bethany1/python-weather-api,lorenzosaino/python-weather-api,littleboss/python-weather-api,tmw25/python-weather-api,ExtraordinaryBen/python-weather-api,n0012/python-weather-api,tectronics/python-weather-api,dubwoc/python-weather-api,prasadsidda107/python-weather-api,hdiwan/python-weather-api
--- +++ @@ -6,7 +6,7 @@ yahoo_result = pywapi.get_weather_from_yahoo('10001') noaa_result = pywapi.get_weather_from_noaa('KJFK') -print "Weather.com says: It is " + string.lower(weather_com_result['current_conditions']['text']) + " and " + weather_com_result['current_conditions']['temperature'] + "C now in New Yo...
d4789ddbfbcd889d80690cb0d4f735a7d094141c
experimental/directshow.py
experimental/directshow.py
#!/usr/bin/python # $Id:$ # Play an audio file with DirectShow. Tested ok with MP3, WMA, MID, WAV, AU. # Caveats: # - Requires a filename (not from memory or stream yet). Looks like we need # to manually implement a filter which provides an output IPin. Lot of # work. # - Theoretically can traverse the ...
Move win32 audio experiment to trunk.
Move win32 audio experiment to trunk.
Python
bsd-3-clause
google-code-export/pyglet,odyaka341/pyglet,cledio66/pyglet,cledio66/pyglet,shaileshgoogler/pyglet,odyaka341/pyglet,gdkar/pyglet,Alwnikrotikz/pyglet,Austin503/pyglet,google-code-export/pyglet,mpasternak/pyglet-fix-issue-552,Alwnikrotikz/pyglet,gdkar/pyglet,odyaka341/pyglet,kmonsoor/pyglet,Alwnikrotikz/pyglet,mpasternak/...
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/python +# $Id:$ + +# Play an audio file with DirectShow. Tested ok with MP3, WMA, MID, WAV, AU. +# Caveats: +# - Requires a filename (not from memory or stream yet). Looks like we need +# to manually implement a filter which provides an output IPin. Lot of +# work. +# - The...
365d61ee5620f0743ffcdeb9c6b09f2b4d66940c
grab.py
grab.py
#!/usr/bin/python3 import json import requests import argparse from typing import Tuple from os.path import exists BASE_URL = 'https://leetcode.com/problems/' GRAPHQL_API_URL = 'https://leetcode.com/graphql' QUERY = '''query questionData($titleSlug: String!) { question(titleSlug: $titleSlug) { ...
Create program that fethes code from leetcode.
Create program that fethes code from leetcode.
Python
mit
pisskidney/leetcode
--- +++ @@ -0,0 +1,104 @@ +#!/usr/bin/python3 + + +import json +import requests +import argparse +from typing import Tuple +from os.path import exists + + +BASE_URL = 'https://leetcode.com/problems/' +GRAPHQL_API_URL = 'https://leetcode.com/graphql' +QUERY = '''query questionData($titleSlug: String!) { + ...
afc5b02f2520382fc0ebb3370538ca2baeb04dd4
planetstack/core/models/__init__.py
planetstack/core/models/__init__.py
from .plcorebase import PlCoreBase from .planetstack import PlanetStack from .project import Project from .singletonmodel import SingletonModel from .service import Service from .service import ServiceAttribute from .tag import Tag from .role import Role from .site import Site,Deployment, DeploymentRole, DeploymentPriv...
from .plcorebase import PlCoreBase from .planetstack import PlanetStack from .project import Project from .singletonmodel import SingletonModel from .service import Service from .service import ServiceAttribute from .tag import Tag from .role import Role from .site import Site,Deployment, DeploymentRole, DeploymentPriv...
Add credentials module to core list
Add credentials module to core list
Python
apache-2.0
cboling/xos,zdw/xos,open-cloud/xos,open-cloud/xos,open-cloud/xos,zdw/xos,cboling/xos,opencord/xos,opencord/xos,cboling/xos,zdw/xos,cboling/xos,zdw/xos,cboling/xos,opencord/xos
--- +++ @@ -18,6 +18,7 @@ from .serviceresource import ServiceResource from .slice import SliceRole from .slice import SlicePrivilege +from .credential import UserCredential,SiteCredential,SliceCredential from .site import SiteRole from .site import SitePrivilege from .planetstack import PlanetStackRole
9f91a62afb313684215987a54ddb043bdbc46fde
mots_vides/constants.py
mots_vides/constants.py
""" Constants for mots-vides """ import os DATA_DIRECTORY = os.path.join( os.path.dirname( os.path.abspath(__file__)), 'datas/' )
Create constant module with DATA_DIRECTORY
Create constant module with DATA_DIRECTORY
Python
bsd-3-clause
Fantomas42/mots-vides,Fantomas42/mots-vides
--- +++ @@ -0,0 +1,10 @@ +""" +Constants for mots-vides +""" +import os + +DATA_DIRECTORY = os.path.join( + os.path.dirname( + os.path.abspath(__file__)), + 'datas/' +)
2a59a06880e8e382aee3452be19a9ac2b193df8e
tests/api.py
tests/api.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import unittest try: from unittest import mock except ImportError: import mock from requests.structures import CaseInsensitiveDict from gyazo.api import Api from gyazo.error import GyazoError class TestApi(unittest.TestCase): def setUp(sel...
Add more unit test cases
Add more unit test cases
Python
mit
ymyzk/python-gyazo
--- +++ @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- + +from __future__ import unicode_literals +import unittest +try: + from unittest import mock +except ImportError: + import mock + +from requests.structures import CaseInsensitiveDict + +from gyazo.api import Api +from gyazo.error import GyazoError + + +class Te...
e50490d9bcce4604a4b30212611f1550da2604e1
elpiwear/pycon.py
elpiwear/pycon.py
import time import Edison.i2c as I2C import Edison.gpio as GPIO import Edison.spi as SPI import ads1015 import sharp2y0a21 import screen import ILI9341 as TFT import watchout_screen import proximity_warning import twitter_screen import tag_screen import gplus_screen class pycon(): def __init__(self): self...
Add the basic main program for the Pycon
Add the basic main program for the Pycon
Python
mit
fjacob21/pycon2015
--- +++ @@ -0,0 +1,41 @@ +import time +import Edison.i2c as I2C +import Edison.gpio as GPIO +import Edison.spi as SPI +import ads1015 +import sharp2y0a21 +import screen +import ILI9341 as TFT +import watchout_screen +import proximity_warning +import twitter_screen +import tag_screen +import gplus_screen + +class pyco...
9af2c07a21e426d52abccb6cc92afcd8cef9e340
glowing-lines2.py
glowing-lines2.py
from PIL import Image, ImageDraw import random W = 500 im = Image.new('RGB', (W, W)) NCOLORS = 19 NLINES = 15 def make_line_mask(im): mask = Image.new('L', im.size, color=0) grays = [] v = 255.0 for i in range(NCOLORS): grays.append(int(v)) v *= 0.91 grays.reverse() draw=ImageDraw.Draw(mask) ...
Add better glowing line script; uses alpha to create the line out of solid green; handles intersections well
Add better glowing line script; uses alpha to create the line out of solid green; handles intersections well
Python
mit
redpig2/pilhacks
--- +++ @@ -0,0 +1,50 @@ +from PIL import Image, ImageDraw + +import random + +W = 500 +im = Image.new('RGB', (W, W)) +NCOLORS = 19 +NLINES = 15 + +def make_line_mask(im): + mask = Image.new('L', im.size, color=0) + + grays = [] + v = 255.0 + for i in range(NCOLORS): + grays.append(int(v)) + v *= 0.91 + gr...
2d617ac87df76a6191f393e77c7f2330948cb0cc
tests/test_twitter.py
tests/test_twitter.py
import os import sys import unittest sys.path.insert(0, os.path.abspath('./situation')) sys.path.insert(0, os.path.abspath('./')) from situation import settings, tweeter, tweepy from tweepy import TweepError from google.appengine.ext import testbed class TestTwitter(unittest.TestCase): def setUp(self): ...
Test fetching tweets from twitter works.
Test fetching tweets from twitter works.
Python
mit
chriskuehl/kloudless-status,chriskuehl/kloudless-status,balanced/status.balancedpayments.com,chriskuehl/kloudless-status,balanced/status.balancedpayments.com,balanced/status.balancedpayments.com
--- +++ @@ -0,0 +1,38 @@ +import os +import sys +import unittest + +sys.path.insert(0, os.path.abspath('./situation')) +sys.path.insert(0, os.path.abspath('./')) + +from situation import settings, tweeter, tweepy +from tweepy import TweepError +from google.appengine.ext import testbed + + +class TestTwitter(unittest....
f2a049f918c9753e88699e0cb1574e7b10c0cb82
tests/test_unicode.py
tests/test_unicode.py
# -*- coding: utf-8 -*- from dynmen import Menu, MenuResult from functools import partial import unittest class TestFirstItem(unittest.TestCase): @classmethod def setUpClass(cls): cls.head = Menu(('head', '-n1')) def assertMenuResultEqual(self, menu_result, selected, value=None, returncode=0): ...
Add some unicode tests for Menu()
Add some unicode tests for Menu()
Python
mit
frostidaho/dynmen
--- +++ @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +from dynmen import Menu, MenuResult +from functools import partial +import unittest + + +class TestFirstItem(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.head = Menu(('head', '-n1')) + + def assertMenuResultEqual(self, menu_result, ...
de1cc61e9b88d50b4b54a2ec81607ab4c33b3053
core/migrations/0002_auto_20170423_0441.py
core/migrations/0002_auto_20170423_0441.py
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-04-23 08:41 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0001_initial'), ] operations = [ migrations.AlterModelOptions( ...
Update meta data for core models
Update meta data for core models
Python
bsd-2-clause
Leahelisabeth/timestrap,Leahelisabeth/timestrap,overshard/timestrap,Leahelisabeth/timestrap,muhleder/timestrap,Leahelisabeth/timestrap,cdubz/timestrap,overshard/timestrap,overshard/timestrap,muhleder/timestrap,muhleder/timestrap,cdubz/timestrap,cdubz/timestrap
--- +++ @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2017-04-23 08:41 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0001_initial'), + ] + + operations = [ + ...
d24e6930966d66939583be44e33dc4e75f35a6bf
utest/controller/test_backup.py
utest/controller/test_backup.py
import unittest from robotide.controller.chiefcontroller import Backup class BackupTestCase(unittest.TestCase): def setUp(self): self._backupper = _MyBackup() def test_backup_is_restored_when_save_raises_exception(self): try: with self._backupper: raise AssertionE...
Add tests for backup mechanism
Add tests for backup mechanism
Python
apache-2.0
HelioGuilherme66/RIDE,fingeronthebutton/RIDE,caio2k/RIDE,HelioGuilherme66/RIDE,HelioGuilherme66/RIDE,fingeronthebutton/RIDE,robotframework/RIDE,robotframework/RIDE,fingeronthebutton/RIDE,robotframework/RIDE,robotframework/RIDE,caio2k/RIDE,caio2k/RIDE,HelioGuilherme66/RIDE
--- +++ @@ -0,0 +1,45 @@ +import unittest +from robotide.controller.chiefcontroller import Backup + + +class BackupTestCase(unittest.TestCase): + + def setUp(self): + self._backupper = _MyBackup() + + def test_backup_is_restored_when_save_raises_exception(self): + try: + with self._back...
aef89cffbb3be71206e5822d079993feafdbf96a
callbacks.py
callbacks.py
from __future__ import print_function import time import numpy as np from keras.callbacks import Callback class BatchTiming(Callback): """ It measure robust stats for timing of batches and epochs. Useful for measuring the training process. For each epoch it prints median batch time and total epoch t...
Implement a BatchTiming callback for Keras.
Implement a BatchTiming callback for Keras. It measure robust stats for timing of batches and epochs. Useful for measuring the training process.
Python
mit
rossumai/keras-multi-gpu,rossumai/keras-multi-gpu
--- +++ @@ -0,0 +1,49 @@ +from __future__ import print_function + +import time + +import numpy as np +from keras.callbacks import Callback + +class BatchTiming(Callback): + """ + It measure robust stats for timing of batches and epochs. + Useful for measuring the training process. + + For each epoch it pr...
aa7c14f5c93cc03137c4939d348a21ee2255ea00
scripts/cmt/deform/np_mesh.py
scripts/cmt/deform/np_mesh.py
"""Efficient mesh processing using numpy""" import numpy as np import json import maya.api.OpenMaya as OpenMaya import cmt.shortcuts as shortcuts class Mesh(object): @classmethod def from_obj(cls, file_path): with open(file_path, "r") as fh: lines = fh.readlines() points = [] ...
Add efficient mesh processing class using numpy
Add efficient mesh processing class using numpy
Python
mit
chadmv/cmt,chadmv/cmt,chadmv/cmt
--- +++ @@ -0,0 +1,60 @@ +"""Efficient mesh processing using numpy""" + +import numpy as np +import json +import maya.api.OpenMaya as OpenMaya +import cmt.shortcuts as shortcuts + + +class Mesh(object): + @classmethod + def from_obj(cls, file_path): + with open(file_path, "r") as fh: + lines =...
3cde2060825449ae91e2e7172bde8c47680c42c7
tests/baseapi/test_query.py
tests/baseapi/test_query.py
import pytest from pypuppetdb.errors import APIError, ExperimentalDisabledError pytestmark = pytest.mark.unit def test_query_endpoint(api2, stub_get): stub_get('http://localhost:8080/v2/nodes', body='[]') response = api2._query('nodes') assert response == [] def test_query_endpoint_path(api2, stub_get...
Add tests for _query in baseapi.
tests: Add tests for _query in baseapi. These tests check that _query ends up generating and querying the right url depending on the different options passed to it.
Python
apache-2.0
jcastillocano/pypuppetdb,jorik041/pypuppetdb,voxpupuli/pypuppetdb,amwilson/pypuppetdb,jcastillocano/pypuppetdb,puppet-community/pypuppetdb,dforste/pypuppetdb,vicinus/pypuppetdb
--- +++ @@ -0,0 +1,52 @@ +import pytest +from pypuppetdb.errors import APIError, ExperimentalDisabledError + + +pytestmark = pytest.mark.unit + + +def test_query_endpoint(api2, stub_get): + stub_get('http://localhost:8080/v2/nodes', body='[]') + response = api2._query('nodes') + assert response == [] + + +de...
29f7dcbe4f3469d051d92344963821a4199644cb
examples/on_startup.py
examples/on_startup.py
"""Provides an example of attaching an action on hug server startup""" import hug data = [] @hug.startup() def add_data(api): '''Adds initial data to the api on startup''' data.append("It's working") @hug.startup() def add_more_data(api): '''Adds initial data to the api on startup''' data.append("E...
Add an example of the intended implementation of the feature
Add an example of the intended implementation of the feature
Python
mit
timothycrosley/hug,timothycrosley/hug,timothycrosley/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug
--- +++ @@ -0,0 +1,22 @@ +"""Provides an example of attaching an action on hug server startup""" +import hug + +data = [] + + +@hug.startup() +def add_data(api): + '''Adds initial data to the api on startup''' + data.append("It's working") + + +@hug.startup() +def add_more_data(api): + '''Adds initial data t...
0ee9372ee9034314853d6215d6b3c0be48796ca6
scripts/response_time_dist.py
scripts/response_time_dist.py
import click import pandas from scipy.stats import lognorm @click.command() @click.argument('filename') @click.option('--column', default='Total_Trav', help='Column to identify shape, location, and scale from.') def response_time_dist(filename, column): """ Returns the lognormal distribution fit of travel time...
Add script to generate lognormal fits of GIS response data.
Add script to generate lognormal fits of GIS response data.
Python
mit
FireCARES/fire-risk,FireCARES/fire-risk
--- +++ @@ -0,0 +1,19 @@ +import click +import pandas +from scipy.stats import lognorm + +@click.command() +@click.argument('filename') +@click.option('--column', default='Total_Trav', help='Column to identify shape, location, and scale from.') +def response_time_dist(filename, column): + """ + Returns the logn...
86b710e87666ff20be8cfd78648eb67a9637dfaf
test/runtest/testargv.py
test/runtest/testargv.py
#!/usr/bin/env python # # __COPYRIGHT__ # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, ...
Add test for "runtest test/somedir" case
Add test for "runtest test/somedir" case
Python
mit
timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons
--- +++ @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to ...
35b9153d1eefb1312d12f69d821cefd0814059d0
resolwe_bio/migrations/0014_star_index2.py
resolwe_bio/migrations/0014_star_index2.py
from django.db import migrations from resolwe.flow.utils.iterators import iterate_schema def migrate_star_downstream_processes(apps, schema_editor): """Migrate schemas of processes that use alignment-star as input.""" Process = apps.get_model("flow", "Process") for process in Process.objects.all(): ...
Migrate inputs of all star-index related processes
Migrate inputs of all star-index related processes
Python
apache-2.0
genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio
--- +++ @@ -0,0 +1,26 @@ +from django.db import migrations + +from resolwe.flow.utils.iterators import iterate_schema + + +def migrate_star_downstream_processes(apps, schema_editor): + """Migrate schemas of processes that use alignment-star as input.""" + Process = apps.get_model("flow", "Process") + + for p...
fcba965521f601d862bfb4968bedad7e2c56123c
models/params.py
models/params.py
""" Parameters and parameterizable objects. """ from __future__ import division from __future__ import absolute_import from __future__ import print_function import numpy as np __all__ = [] class Parameterized(object): def __init__(self): self.nhyper = 0 self.__names = [] self.__hypers =...
Add a base parameterized object class.
Add a base parameterized object class.
Python
bsd-2-clause
mwhoffman/reggie
--- +++ @@ -0,0 +1,53 @@ +""" +Parameters and parameterizable objects. +""" + +from __future__ import division +from __future__ import absolute_import +from __future__ import print_function + +import numpy as np + +__all__ = [] + + +class Parameterized(object): + def __init__(self): + self.nhyper = 0 + ...
caf25fab4495e116303a83d52601da164b13638f
angkot/route/management/commands/export_geojson.py
angkot/route/management/commands/export_geojson.py
import sys import os import json from optparse import make_option from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): help = 'Export Route(s) as GeoJSON' option_list = BaseCommand.option_list + ( make_option('-o', dest='output_directory'), ) def hand...
Add script to export route to GeoJSON data
Add script to export route to GeoJSON data
Python
agpl-3.0
angkot/angkot,angkot/angkot,angkot/angkot,angkot/angkot
--- +++ @@ -0,0 +1,55 @@ +import sys +import os +import json +from optparse import make_option + +from django.core.management.base import BaseCommand, CommandError + +class Command(BaseCommand): + help = 'Export Route(s) as GeoJSON' + + option_list = BaseCommand.option_list + ( + make_option('-o', dest='...
fbf6e40eee370ff5bc61e79334c76e76cd2032e4
fix_int16.py
fix_int16.py
from os import listdir, path import numpy as np from patch_headers import fix_int16_images, compare_data_in_fits from triage_fits_files import ImageFileCollection fix_vol = '/Volumes/FULL BACKUP/processed' #fix_vol = 'foo' raw_vol = '/Volumes/feder_data_originals/ast390/raw' dirs_to_fix = listdir(fix_vol) for curre...
Add script to fix int16 files.
Add script to fix int16 files.
Python
bsd-3-clause
mwcraig/msumastro
--- +++ @@ -0,0 +1,45 @@ +from os import listdir, path +import numpy as np + +from patch_headers import fix_int16_images, compare_data_in_fits +from triage_fits_files import ImageFileCollection + +fix_vol = '/Volumes/FULL BACKUP/processed' +#fix_vol = 'foo' +raw_vol = '/Volumes/feder_data_originals/ast390/raw' + +dir...
bb103cd384702b68e36b4588e679f86568565551
snapshot/upload-dump-to-s3.py
snapshot/upload-dump-to-s3.py
#!/usr/bin/env python import os import sys import json import requests from requests.exceptions import HTTPError def upload_dump_to_s3(): s3_post_data_url = json.loads(os.environ['S3_POST_URL_DATA']) dump_file = os.environ['DUMP_FILE'] url = s3_post_data_url['url'] fields = s3_post_data_url['fields']...
Add script to upload dump to s3
Add script to upload dump to s3 This is a simple python script which uses the signed url previously generated to upload the encrypted dump to s3 using the requets library. If the response from s3 is not successful, an error is raised and we print the error message. Also sets the exit code to be not zero.
Python
mit
alphagov/digitalmarketplace-aws,alphagov/digitalmarketplace-aws,alphagov/digitalmarketplace-aws
--- +++ @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +import os +import sys +import json +import requests +from requests.exceptions import HTTPError + +def upload_dump_to_s3(): + s3_post_data_url = json.loads(os.environ['S3_POST_URL_DATA']) + dump_file = os.environ['DUMP_FILE'] + + url = s3_post_data_url['url']...
8c05529f93dfe4fb3fffbf1d5f46b1d38adc6fce
social_core/tests/backends/test_chatwork.py
social_core/tests/backends/test_chatwork.py
import json from .oauth import OAuth2Test class ChatworkOAuth2Test(OAuth2Test): backend_path = 'social_core.backends.chatwork.ChatworkOAuth2' user_data_url = 'https://api.chatwork.com/v2/me' expected_username = 'hogehoge' access_token_body = json.dumps({ "access_token": "pyopyopyopyopyopyopyo...
Add test for ChatworkOAuth2 backend
Add test for ChatworkOAuth2 backend
Python
bsd-3-clause
python-social-auth/social-core,python-social-auth/social-core
--- +++ @@ -0,0 +1,44 @@ +import json + +from .oauth import OAuth2Test + + +class ChatworkOAuth2Test(OAuth2Test): + backend_path = 'social_core.backends.chatwork.ChatworkOAuth2' + user_data_url = 'https://api.chatwork.com/v2/me' + expected_username = 'hogehoge' + access_token_body = json.dumps({ + ...
0aafd10663f42c02d290949453946afe9f1e2f88
py/fraction-addition-and-subtraction.py
py/fraction-addition-and-subtraction.py
import re class Solution(object): def fractionAddition(self, expression): """ :type expression: str :rtype: str """ expression = expression.replace('-+', '-') expression = expression.replace('+-', '-') matches = re.findall(r'([+-]?)(\d+)/(\d+)', expression) ...
Add py solution for 592. Fraction Addition and Subtraction
Add py solution for 592. Fraction Addition and Subtraction 592. Fraction Addition and Subtraction: https://leetcode.com/problems/fraction-addition-and-subtraction/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,27 @@ +import re +class Solution(object): + def fractionAddition(self, expression): + """ + :type expression: str + :rtype: str + """ + expression = expression.replace('-+', '-') + expression = expression.replace('+-', '-') + matches = re.findall(...
5d2246cac222cd035924d2e68acaddca3a726fb7
list_comprehensions.py
list_comprehensions.py
"""Show how to use list comprehensions and zip""" sunday_temps = [76, 78, 86, 54, 88, 77, 66, 55, 44, 57, 58, 58, 78, 79, 69, 65] monday_temps = [68, 67, 68, 76, 77, 66, 61, 81, 73, 61, 83, 67, 89, 78, 67, 85] tuesday_temps = [78, 79, 70, 76, 75, 74, 73, 72, 63, 64, 65, 58, 59, 85, 59, 85] def show_temp_tuples(): ...
Add list comprehensions with zips
Add list comprehensions with zips
Python
mit
kentoj/python-fundamentals
--- +++ @@ -0,0 +1,19 @@ +"""Show how to use list comprehensions and zip""" + +sunday_temps = [76, 78, 86, 54, 88, 77, 66, 55, 44, 57, 58, 58, 78, 79, 69, 65] +monday_temps = [68, 67, 68, 76, 77, 66, 61, 81, 73, 61, 83, 67, 89, 78, 67, 85] +tuesday_temps = [78, 79, 70, 76, 75, 74, 73, 72, 63, 64, 65, 58, 59, 85, 59, ...
c81d1534084673680ae313296bfae64c13899bcc
crop_logo.py
crop_logo.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import os TRAIN_DIR = 'flickr_logos_27_dataset' TRAIN_IMAGE_DIR = os.path.join(TRAIN_DIR, 'flickr_logos_27_dataset_images') def main(): annot_train = np.loadtxt( os.path.join(TRAIN_DIR, 'flickr_logos_27_dataset_training...
Add a script for cropping logo
Add a script for cropping logo
Python
mit
satojkovic/DeepLogo
--- +++ @@ -0,0 +1,19 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import numpy as np +import os + +TRAIN_DIR = 'flickr_logos_27_dataset' +TRAIN_IMAGE_DIR = os.path.join(TRAIN_DIR, 'flickr_logos_27_dataset_images') + + +def main(): + annot_train = np.loadtxt( + os.path.join(TRAIN_DIR, + ...
07624ba907d66e734c9098149b62d2ea8c76392a
tests/test_coord.py
tests/test_coord.py
import unittest from coral import coord class TestCoord(unittest.TestCase): def test_simplify(self): poly = [(-10, -10), (-10, 10), (0, 15), (10, 10), (10, -10), (0, -5)] poly = coord.simplify(poly, 10) simple = [(-1, -1), (-1, 1), (1, 1), (1, -1)] self.assertEqual(poly, simple) ...
Add a test for coord.simplify().
Add a test for coord.simplify().
Python
mit
lecram/coral
--- +++ @@ -0,0 +1,14 @@ +import unittest + +from coral import coord + +class TestCoord(unittest.TestCase): + + def test_simplify(self): + poly = [(-10, -10), (-10, 10), (0, 15), (10, 10), (10, -10), (0, -5)] + poly = coord.simplify(poly, 10) + simple = [(-1, -1), (-1, 1), (1, 1), (1, -1)] + ...
412dc5aad04bfa3d3ece140e711b45fafe9c1b64
codefights/arcade_py/68.CalkinWilf.py
codefights/arcade_py/68.CalkinWilf.py
# The Calkin-Wilf tree is a tree in which the vertices correspond 1-for-1 to the positive rational numbers. The tree is rooted at the number 1, and any rational number expressed in simplest terms as the fraction a / b has as its two children the numbers a / (a + b) and (a + b) / b. Every positive rational number appear...
Add 68 Calkin Wilf Sequence from CodeFights
Add 68 Calkin Wilf Sequence from CodeFights
Python
mit
aenon/OnlineJudge,aenon/OnlineJudge
--- +++ @@ -0,0 +1,31 @@ +# The Calkin-Wilf tree is a tree in which the vertices correspond 1-for-1 to the positive rational numbers. The tree is rooted at the number 1, and any rational number expressed in simplest terms as the fraction a / b has as its two children the numbers a / (a + b) and (a + b) / b. Every pos...
cba19fbadf8d69b567255a8282974749aff57835
tools/game_utils.py
tools/game_utils.py
import scipy.misc import scipy.special def get_num_hole_card_combinations(game): num_players = game.get_num_players() num_hole_cards = game.get_num_hole_cards() num_cards = game.get_num_suits() * game.get_num_ranks() num_total_hole_cards = num_players * num_hole_cards return scipy.misc.comb(num_ca...
Add method to calculate hole card combinations in game
Add method to calculate hole card combinations in game
Python
mit
JakubPetriska/poker-cfr,JakubPetriska/poker-cfr
--- +++ @@ -0,0 +1,10 @@ +import scipy.misc +import scipy.special + + +def get_num_hole_card_combinations(game): + num_players = game.get_num_players() + num_hole_cards = game.get_num_hole_cards() + num_cards = game.get_num_suits() * game.get_num_ranks() + num_total_hole_cards = num_players * num_hole_car...
3f1353d48b688c65f9dec0b7e3b753b5c3cfc9bb
export_puid.py
export_puid.py
#!/usr/bin/env python3 # coding: utf-8 from wxpy import * ''' 使用 cache 来缓存登陆信息,同时使用控制台登陆 ''' bot = Bot('bot.pkl', console_qr=False) ''' 开启 PUID 用于后续的控制 ''' bot.enable_puid('wxpy_puid.pkl') friends = bot.friends() groups = bot.groups() output = open('data', 'w') output.write("-----Friends-------\n") for i in frie...
ADD EXPORT_PUID.PY * USER CAN USE IT TO GET PUID
ADD EXPORT_PUID.PY * USER CAN USE IT TO GET PUID
Python
mit
robot527/LCBot,Yinr/LCBot,LCTT/LCBot
--- +++ @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +# coding: utf-8 + +from wxpy import * + +''' +使用 cache 来缓存登陆信息,同时使用控制台登陆 +''' +bot = Bot('bot.pkl', console_qr=False) + + +''' +开启 PUID 用于后续的控制 +''' +bot.enable_puid('wxpy_puid.pkl') + +friends = bot.friends() +groups = bot.groups() + +output = open('data', 'w') + +ou...
fc89664fd75f787b03953d8eac3ec99b6fdf19de
lesson5/exceptions_except.py
lesson5/exceptions_except.py
def take_beer(fridge, number=1): if "beer" not in fridge: raise Exception("No beer at all:(") if number > fridge["beer"]: raise Exception("Not enough beer:(") fridge["beer"] -= number if __name__ == "__main__": fridge = { "beer": 2, "milk": 1, "meat": 3, }...
Add y.a. script for showing except working
Add y.a. script for showing except working
Python
bsd-2-clause
drednout/letspython,drednout/letspython
--- +++ @@ -0,0 +1,30 @@ +def take_beer(fridge, number=1): + if "beer" not in fridge: + raise Exception("No beer at all:(") + + if number > fridge["beer"]: + raise Exception("Not enough beer:(") + + fridge["beer"] -= number + + +if __name__ == "__main__": + fridge = { + "beer": 2, + ...
ebf39da6ee59e2fb55226e5c256553ce1093006c
nettests/core/http_invalid_requests.py
nettests/core/http_invalid_requests.py
# -*- encoding: utf-8 -*- from twisted.python import usage from ooni.utils import randomStr from ooni.templates import tcpt class UsageOptions(usage.Options): optParameters = [['backend', 'b', '127.0.0.1:57002', 'The OONI backend that runs a TCP echo server (must be on port 80)']] opt...
Add test that generates a random invalid HTTP request
Add test that generates a random invalid HTTP request
Python
bsd-2-clause
Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe,kdmurray91/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,Karthikeyan-kkk/ooni-probe,juga0/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,lordappsec/ooni-prob...
--- +++ @@ -0,0 +1,63 @@ +# -*- encoding: utf-8 -*- +from twisted.python import usage + +from ooni.utils import randomStr +from ooni.templates import tcpt + +class UsageOptions(usage.Options): + optParameters = [['backend', 'b', '127.0.0.1:57002', + 'The OONI backend that runs a TCP echo ser...
a586973dc63f56dfc180add0f0ae41b6c0475641
tools/print_descriptor.py
tools/print_descriptor.py
#!/usr/bin/env python3 # Copyright (C) 2021 The Android Open Source Project # # 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 requ...
Implement simple tool to print proto descriptor files
Implement simple tool to print proto descriptor files Change-Id: I6b2a2d399bd490a85668e4a53c84a87abe828a46
Python
apache-2.0
google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto
--- +++ @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +# Copyright (C) 2021 The Android Open Source Project +# +# 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/l...
dc0ff0fba6a83daefb35db2e7c93b474aad1928b
scripts/add-migration.py
scripts/add-migration.py
#!/usr/bin/python # This script should add a template migration to the migrations.php # file. If you provide a git commit ID it uses the commit date from # that commit for the timestamp. Otherwise, it uses the current time. import sys import os import subprocess import datetime import dateutil.parser import pytz im...
Add a helper script to add a template migration to the migrations.php file
Add a helper script to add a template migration to the migrations.php file
Python
agpl-3.0
htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID,fzadow/CATMAID,htem/CATMAID,htem/CATMAID,fzadow/CATMAID
--- +++ @@ -0,0 +1,61 @@ +#!/usr/bin/python + +# This script should add a template migration to the migrations.php +# file. If you provide a git commit ID it uses the commit date from +# that commit for the timestamp. Otherwise, it uses the current time. + +import sys +import os +import subprocess +import datetime ...
94ff998fbda79e3760f8ead366a88654512597b6
get_ideogram_annots.py
get_ideogram_annots.py
import sys import os import subprocess import json from scipy import stats from argparse import ArgumentParser parser = ArgumentParser(description="Get Ideogram.js annotations for an SRR") parser.add_argument("--acc", required=True, help="SRR accession") args = parser.parse_args() acc = args.acc out = acc + "_counts"...
Add draft of wrapper script
Add draft of wrapper script
Python
cc0-1.0
NCBI-Hackathons/rnaseqview,NCBI-Hackathons/rnaseqview,NCBI-Hackathons/rnaseqview,NCBI-Hackathons/rnaseqview,NCBI-Hackathons/rnaseqview
--- +++ @@ -0,0 +1,24 @@ +import sys +import os +import subprocess +import json +from scipy import stats +from argparse import ArgumentParser + +parser = ArgumentParser(description="Get Ideogram.js annotations for an SRR") +parser.add_argument("--acc", required=True, help="SRR accession") +args = parser.parse_args() ...
51fdbfed4f96d696847de962906467f1762e789e
scripts/import-lastfm-bio.py
scripts/import-lastfm-bio.py
#!/usr/bin/env python import psycopg2 as ordbms import urllib, urllib2 import xml.etree.cElementTree as ElementTree class ImportLastfmBio: def __init__(self): self.conn = ordbms.connect ("dbname='librefm'") self.cursor = self.conn.cursor() def importAll(self): """Imports descriptions for all...
Add simple script for importing last.fm bio information (which is licensed under CC-BY-SA and GFDL)
Add simple script for importing last.fm bio information (which is licensed under CC-BY-SA and GFDL)
Python
agpl-3.0
foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm
--- +++ @@ -0,0 +1,61 @@ +#!/usr/bin/env python +import psycopg2 as ordbms +import urllib, urllib2 +import xml.etree.cElementTree as ElementTree + + +class ImportLastfmBio: + + + def __init__(self): + self.conn = ordbms.connect ("dbname='librefm'") + self.cursor = self.conn.cursor() + + + def importAl...
98ee8824fcf8a9136b6a48a56108cc5c175f5d00
nysa-path.py
nysa-path.py
#! /usr/bin/python import os import json import site PATH = os.path.abspath(os.path.dirname(__file__)) NYSA_NAME = "nysa" PATH_DICT_NAME = "path.json" PATH_ENTRY_NAME = "nysa-verilog" SITE_NYSA = os.path.abspath(os.path.join(site.getuserbase(), NYSA_NAME)) SITE_PATH = os.path.join(SITE_NYSA, PATH_DICT_NAME) if __nam...
Add a script to update the nysa-verilog path
Add a script to update the nysa-verilog path This path is used to tell Nysa where to look for verilog modules
Python
mit
CospanDesign/nysa-verilog,CospanDesign/nysa-verilog
--- +++ @@ -0,0 +1,37 @@ +#! /usr/bin/python +import os +import json +import site + +PATH = os.path.abspath(os.path.dirname(__file__)) +NYSA_NAME = "nysa" +PATH_DICT_NAME = "path.json" +PATH_ENTRY_NAME = "nysa-verilog" + +SITE_NYSA = os.path.abspath(os.path.join(site.getuserbase(), NYSA_NAME)) +SITE_PATH = os.path.jo...
f331780f48d9f053ba770cade487417537cc2a93
data_structures/graphs/adjacency_list.py
data_structures/graphs/adjacency_list.py
# -*- coding: utf-8 -*- if __name__ == '__main__': from os import getcwd from os import sys sys.path.append(getcwd()) from helpers.display import Section from pprint import pprint as ppr class AbstractGraphList(object): def __init__(self): # We're using a dict since the vertices are labeled...
Add adjacency list data structure
Add adjacency list data structure
Python
apache-2.0
christabor/MoAL,christabor/MoAL,christabor/MoAL,christabor/MoAL,christabor/MoAL
--- +++ @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +if __name__ == '__main__': + from os import getcwd + from os import sys + sys.path.append(getcwd()) + +from helpers.display import Section +from pprint import pprint as ppr + + +class AbstractGraphList(object): + + def __init__(self): + # We're u...
d59439960bed2abe706aa159c1c257a80ae7f7ca
misc/split-mirax.py
misc/split-mirax.py
#!/usr/bin/python import struct, sys, os def rr(f): return struct.unpack("<i", f.read(4))[0] filename = sys.argv[1] f = open(filename) dir = os.path.dirname(filename) HEADER_OFFSET = 37 f.seek(HEADER_OFFSET) filesize = os.stat(sys.argv[1]).st_size num_items = (filesize - HEADER_OFFSET) / 4 # read first po...
Add utility to split mirax data files
Add utility to split mirax data files
Python
lgpl-2.1
openslide/openslide,openslide/openslide,openslide/openslide,openslide/openslide
--- +++ @@ -0,0 +1,79 @@ +#!/usr/bin/python + +import struct, sys, os + + +def rr(f): + return struct.unpack("<i", f.read(4))[0] + + +filename = sys.argv[1] + +f = open(filename) +dir = os.path.dirname(filename) + +HEADER_OFFSET = 37 + +f.seek(HEADER_OFFSET) + +filesize = os.stat(sys.argv[1]).st_size +num_items = ...
71f7f9b344f6475dc86adf00757f265455112aa5
web/Aovek/migrations/0002_video_image.py
web/Aovek/migrations/0002_video_image.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.8 on 2018-02-19 14:33 from __future__ import unicode_literals from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('Aovek', '0001_initial'), ] operations = [ migr...
Add migrations for image field in model
Add migrations for image field in model
Python
mit
nikolaystanishev/traffic-sign-recognition
--- +++ @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.8 on 2018-02-19 14:33 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('Aovek', '0001_initial'),...
51536bfdd41c4814f51049fcb91e59327d1515c9
control/tests/ctrlutil_test.py
control/tests/ctrlutil_test.py
import unittest import numpy as np from control.ctrlutil import * class TestUtils(unittest.TestCase): def setUp(self): self.mag = np.array([1, 10, 100, 2, 0.1, 0.01]) self.db = np.array([0, 20, 40, 6.0206, -20, -40]) def check_unwrap_array(self, angle, period=None): if period is None: ...
Add tests showing problems with ctrlutil.unwrap
Add tests showing problems with ctrlutil.unwrap The routine ctrlutil.unwrap fails if there are large jumps in phase.
Python
bsd-3-clause
murrayrm/python-control,roryyorke/python-control,python-control/python-control
--- +++ @@ -0,0 +1,43 @@ +import unittest +import numpy as np +from control.ctrlutil import * + +class TestUtils(unittest.TestCase): + def setUp(self): + self.mag = np.array([1, 10, 100, 2, 0.1, 0.01]) + self.db = np.array([0, 20, 40, 6.0206, -20, -40]) + + def check_unwrap_array(self, angle, peri...
548fa6380fc0f76708e414a1a3165dde13a663d9
pyqode/python/code_edit.py
pyqode/python/code_edit.py
""" Deprecated; the PyCodeEdit class has been moved into pyqode.python.widgets. This file will be removed in the next minor version (2.2). """ from .widgets.code_edit import PyCodeEdit __all__ = [ 'PyCodeEdit' ]
Fix backward incompatility. This module is deprecated and will be removed in version 2.2
Fix backward incompatility. This module is deprecated and will be removed in version 2.2
Python
mit
pyQode/pyqode.python,zwadar/pyqode.python,pyQode/pyqode.python,mmolero/pyqode.python
--- +++ @@ -0,0 +1,10 @@ +""" +Deprecated; the PyCodeEdit class has been moved into pyqode.python.widgets. + +This file will be removed in the next minor version (2.2). +""" +from .widgets.code_edit import PyCodeEdit + +__all__ = [ + 'PyCodeEdit' +]
620a58856a3051cb6522b94ef68900cdfbdac3b6
tests/fields/base.py
tests/fields/base.py
import steel import unittest class FieldTests(unittest.TestCase): def test_auto_label(self): # One word field = steel.Bytes(size=1) field.set_name('byte') self.assertEqual(field.label, 'byte') # Two words field = steel.Bytes(size=1) field.set_name('two_byte...
Add tests for label management
Add tests for label management
Python
bsd-3-clause
gulopine/steel-experiment
--- +++ @@ -0,0 +1,20 @@ +import steel +import unittest + + +class FieldTests(unittest.TestCase): + def test_auto_label(self): + # One word + field = steel.Bytes(size=1) + field.set_name('byte') + self.assertEqual(field.label, 'byte') + + # Two words + field = steel.Bytes(...
abe81ab36ec3468cc12243d16fe3d43d5d2752a4
tests/test_upload.py
tests/test_upload.py
import pytest from twine.commands import upload def test_find_dists_expands_globs(): files = sorted(upload.find_dists(['twine/__*.py'])) expected = ['twine/__init__.py', 'twine/__main__.py'] assert expected == files def test_find_dists_errors_on_invalid_globs(): with pytest.raises(ValueError): ...
Add tests for new twine-upload functionality
Add tests for new twine-upload functionality
Python
apache-2.0
pypa/twine,warner/twine,reinout/twine,sigmavirus24/twine,beni55/twine,dstufft/twine,jamesblunt/twine,mhils/twine
--- +++ @@ -0,0 +1,21 @@ +import pytest + +from twine.commands import upload + + +def test_find_dists_expands_globs(): + files = sorted(upload.find_dists(['twine/__*.py'])) + expected = ['twine/__init__.py', 'twine/__main__.py'] + assert expected == files + + +def test_find_dists_errors_on_invalid_globs(): +...
20745f81d89efd48b83d448bef60bf809999d32e
testing/test_storm_f.py
testing/test_storm_f.py
#! /usr/bin/env python # # Tests for the Fortran version of `storm`. # # Call with: # $ nosetests -sv # # Mark Piper (mark.piper@colorado.edu) from nose.tools import * import os import shutil from subprocess import call # Globals data_dir = os.path.join(os.getcwd(), 'testing', 'data') f_dir = os.path.join(os.getcwd...
Add unit tests for Fortran version of `storm`
Add unit tests for Fortran version of `storm` I chose to use `nose` for testing because it's convenient, and I'm treating the original version of `storm` as a black box.
Python
mit
mdpiper/storm,csdms-contrib/storm,csdms-contrib/storm,mdpiper/storm
--- +++ @@ -0,0 +1,82 @@ +#! /usr/bin/env python +# +# Tests for the Fortran version of `storm`. +# +# Call with: +# $ nosetests -sv +# +# Mark Piper (mark.piper@colorado.edu) + +from nose.tools import * +import os +import shutil +from subprocess import call + +# Globals +data_dir = os.path.join(os.getcwd(), 'testi...
8006a9afbffc1636702802cf5613ba0aaf1c71ec
qcfractal/alembic/versions/469ece903d76_migrate_provenance_to_not_null.py
qcfractal/alembic/versions/469ece903d76_migrate_provenance_to_not_null.py
"""migrate provenance to not null Revision ID: 469ece903d76 Revises: 6b07e9a3589d Create Date: 2021-05-02 09:48:57.061825 """ from alembic import op import sqlalchemy as sa from sqlalchemy.orm.session import Session # revision identifiers, used by Alembic. revision = "469ece903d76" down_revision = "6b07e9a3589d" br...
Make fields of provenance not null, and fix other validation issues
Make fields of provenance not null, and fix other validation issues
Python
bsd-3-clause
psi4/mongo_qcdb,psi4/mongo_qcdb
--- +++ @@ -0,0 +1,61 @@ +"""migrate provenance to not null + +Revision ID: 469ece903d76 +Revises: 6b07e9a3589d +Create Date: 2021-05-02 09:48:57.061825 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.orm.session import Session + + +# revision identifiers, used by Alembic. +revision = "469ece...
e804e2258183d9986f5756327f875735c8234924
apps/uploads/forms.py
apps/uploads/forms.py
# # Copyright (C) 2017 Maha Farhat # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distribu...
Add a test form object for testing
Add a test form object for testing
Python
agpl-3.0
IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site
--- +++ @@ -0,0 +1,29 @@ +# +# Copyright (C) 2017 Maha Farhat +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later ver...
ba92b42f0729b68648aa485e02314e2a7a7997cb
vigir_ltl_specification/src/vigir_ltl_specification/test_activation_completion.py
vigir_ltl_specification/src/vigir_ltl_specification/test_activation_completion.py
#!/usr/bin/env python from activation_outcomes import * import unittest class FormulaGenerationTests(unittest.TestCase): # ========================================================================= # Test the generation of ActivationOutcomes formulas # =============================================================...
Add test suite for a-o formulas
[vigir_ltl_specification] Add test suite for a-o formulas
Python
bsd-3-clause
team-vigir/vigir_behavior_synthesis,team-vigir/vigir_behavior_synthesis
--- +++ @@ -0,0 +1,56 @@ +#!/usr/bin/env python + +from activation_outcomes import * + +import unittest + +class FormulaGenerationTests(unittest.TestCase): + + # ========================================================================= + # Test the generation of ActivationOutcomes formulas + # =======================...
31f2b8407a4a369dd79bf73f8a838d2bb22d2c19
python/example_code/iam/list_users_with_resource.py
python/example_code/iam/list_users_with_resource.py
# Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file ac...
Add example to list IAM users with service resource
Add example to list IAM users with service resource
Python
apache-2.0
awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,a...
--- +++ @@ -0,0 +1,27 @@ +# Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You +# may not use this file except in compliance with the License. A copy of +# the License is located at +# +# http://aws.amazon.com/apache2....
7d46787474dbc1902cf35fad0ad57c2336ef22f8
CodeFights/kthPermutation.py
CodeFights/kthPermutation.py
#!/usr/local/bin/python # Code Fights Kth Permutation Problem from itertools import permutations def kthPermutation(numbers, k): return list(list(permutations(numbers, len(numbers)))[k - 1]) def main(): tests = [ [[1, 2, 3, 4, 5], 4, [1, 2, 4, 5, 3]], [[1, 2], 1, [1, 2]], [[11, 22, ...
Solve Code Fights kth permutation problem
Solve Code Fights kth permutation problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,35 @@ +#!/usr/local/bin/python +# Code Fights Kth Permutation Problem + +from itertools import permutations + + +def kthPermutation(numbers, k): + return list(list(permutations(numbers, len(numbers)))[k - 1]) + + +def main(): + tests = [ + [[1, 2, 3, 4, 5], 4, [1, 2, 4, 5, 3]], + ...
aab8426c7f917315c6d08dd4389b6c5bbcd53441
change_line_breaks.py
change_line_breaks.py
""" Reformat a single entry fasta file. E.g. useful if a fasta file contains a sequence in a single long line. The Biopython SeqIO writer will generate a sequence with proper line lenght of 60 character.s """ import argparse from Bio import SeqIO parser = argparse.ArgumentParser() parser.add_argument("input_fasta"...
Add fasta line break script
Add fasta line break script
Python
isc
konrad/kuf_bio_scripts
--- +++ @@ -0,0 +1,17 @@ +""" +Reformat a single entry fasta file. + +E.g. useful if a fasta file contains a sequence in a single long +line. The Biopython SeqIO writer will generate a sequence with +proper line lenght of 60 character.s + +""" + +import argparse +from Bio import SeqIO + +parser = argparse.ArgumentPa...
3ea556af950be81db5b1eec7a78429e286715688
unit_tests/test_template.py
unit_tests/test_template.py
#!/usr/bin/python """ Template for writing new test classes. """ import unittest import sys, os, re # from multiqc import ... # This line allows the tests to run if you just naively run this script. # But the preferred way is to use run_tests.sh sys.path.insert(0,'../MultiQC') class T(unittest.TestCase): def...
Add a template for making new tests.
Add a template for making new tests.
Python
mit
ewels/MultiQC_TestData,ewels/MultiQC_TestData,ewels/MultiQC_TestData,ewels/MultiQC_TestData,ewels/MultiQC_TestData
--- +++ @@ -0,0 +1,25 @@ +#!/usr/bin/python + +""" Template for writing new test classes. +""" + +import unittest +import sys, os, re + +# from multiqc import ... + +# This line allows the tests to run if you just naively run this script. +# But the preferred way is to use run_tests.sh +sys.path.insert(0,'../MultiQC'...