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
42a287d23a1153df636c193695615d99b7c75e4d
test/stop_all.py
test/stop_all.py
import urbackup_api server = urbackup_api.urbackup_server("http://127.0.0.1:55414/x", "admin", "foo") for action in server.get_actions(): a = action["action"] if a ==server.action_full_file or a==server.action_resumed_full_file: print("Running full file backup: "+action["name"]) ...
Test stopping all running file backups
Test stopping all running file backups
Python
apache-2.0
uroni/urbackup-server-python-web-api-wrapper
--- +++ @@ -0,0 +1,12 @@ +import urbackup_api + + +server = urbackup_api.urbackup_server("http://127.0.0.1:55414/x", "admin", "foo") + +for action in server.get_actions(): + a = action["action"] + if a ==server.action_full_file or a==server.action_resumed_full_file: + print("Running full file backup: "+a...
3a9445c6b3053d492c12bbf808d251c6da55632a
tests/import/builtin_import.py
tests/import/builtin_import.py
# test calling builtin import function # basic test __import__('builtins') # first arg should be a string try: __import__(1) except TypeError: print('TypeError') # level argument should be non-negative try: __import__('xyz', None, None, None, -1) except ValueError: print('ValueError')
Add a test for the builtin __import__ function.
tests/import: Add a test for the builtin __import__ function.
Python
mit
pozetroninc/micropython,pfalcon/micropython,micropython/micropython-esp32,AriZuu/micropython,torwag/micropython,HenrikSolver/micropython,Timmenem/micropython,pozetroninc/micropython,ryannathans/micropython,tralamazza/micropython,blazewicz/micropython,oopy/micropython,lowRISC/micropython,alex-robbins/micropython,bvernou...
--- +++ @@ -0,0 +1,16 @@ +# test calling builtin import function + +# basic test +__import__('builtins') + +# first arg should be a string +try: + __import__(1) +except TypeError: + print('TypeError') + +# level argument should be non-negative +try: + __import__('xyz', None, None, None, -1) +except ValueErro...
a72a0674a6db3880ed699101be3c9c46671989f0
xxdata_11.py
xxdata_11.py
import os import _xxdata_11 parameters = { 'isdimd' : 200, 'iddimd' : 40, 'itdimd' : 50, 'ndptnl' : 4, 'ndptn' : 128, 'ndptnc' : 256, 'ndcnct' : 100 } def read_scd(filename): fd = open(filename, 'r') fortran_filename = 'fort.%d' % fd.fileno() os.symlink(filename, fortran_filen...
Add a primitive pythonic wrapper.
Add a primitive pythonic wrapper.
Python
mit
cfe316/atomic,ezekial4/atomic_neu,ezekial4/atomic_neu
--- +++ @@ -0,0 +1,27 @@ +import os +import _xxdata_11 + +parameters = { + 'isdimd' : 200, + 'iddimd' : 40, + 'itdimd' : 50, + 'ndptnl' : 4, + 'ndptn' : 128, + 'ndptnc' : 256, + 'ndcnct' : 100 +} + +def read_scd(filename): + fd = open(filename, 'r') + + fortran_filename = 'fort.%d' % fd.fil...
b6cd59f800b254d91da76083546ab7c10689df5f
tests/test_no_dup_filenames.py
tests/test_no_dup_filenames.py
# Copyright 2014 Red Hat, Inc. # # 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 agre...
Add unit test to enforce unique file names.
Add unit test to enforce unique file names. This patch adds a unit test to ensure we have uniquely named files across each of the element/target directories. Because DIB copies these files into a common namespace files can by cryptically overwritten thus causing a variety of failures. Simply checking for uniquely nam...
Python
apache-2.0
rdo-management/tripleo-image-elements,rdo-management/tripleo-image-elements,openstack/tripleo-image-elements,radez/tripleo-image-elements,radez/tripleo-image-elements,openstack/tripleo-image-elements
--- +++ @@ -0,0 +1,41 @@ +# Copyright 2014 Red Hat, Inc. +# +# 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 +# +# Unles...
e81fd02cc7431ea01416126b88a22b4bba9b755e
tests/test_tools/test_cmake.py
tests/test_tools/test_cmake.py
# Copyright 2015 0xc0170 # # 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, soft...
Test - add cmake test tool
Test - add cmake test tool
Python
apache-2.0
sarahmarshy/project_generator,ohagendorf/project_generator,0xc0170/project_generator,project-generator/project_generator
--- +++ @@ -0,0 +1,55 @@ +# Copyright 2015 0xc0170 +# +# 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 applicab...
abe6ead4f93f98406fe197b6884e51015c200ca1
test/test_searchentities.py
test/test_searchentities.py
import unittest from . import models from sir.schema.searchentities import SearchEntity as E, SearchField as F class QueryResultToDictTest(unittest.TestCase): def setUp(self): self.entity = E(models.B, [ F("id", "id"), F("c_bar", "c.bar"), F("c_bar_trans", "c.bar", tra...
Add a test for query_result_to_dict
Add a test for query_result_to_dict
Python
mit
jeffweeksio/sir
--- +++ @@ -0,0 +1,27 @@ +import unittest + +from . import models +from sir.schema.searchentities import SearchEntity as E, SearchField as F + + +class QueryResultToDictTest(unittest.TestCase): + def setUp(self): + self.entity = E(models.B, [ + F("id", "id"), + F("c_bar", "c.bar"), + ...
257a328745b9622713afa218940d2cd820987e93
examples/color-correction-ui.py
examples/color-correction-ui.py
#!/usr/bin/env python # # Simple example color correction UI. # Talks to an fcserver running on localhost. # # Micah Elizabeth Scott # This example code is released into the public domain. # import Tkinter as tk import socket import json import struct s = socket.socket() s.connect(('localhost', 7890)) print "Connecte...
Add a super simple color correction client example
Add a super simple color correction client example
Python
mit
PimentNoir/fadecandy,fragmede/fadecandy,fragmede/fadecandy,Jorgen-VikingGod/fadecandy,PimentNoir/fadecandy,poe/fadecandy,pixelmatix/fadecandy,pixelmatix/fadecandy,adam-back/fadecandy,jsestrich/fadecandy,Protoneer/fadecandy,Protoneer/fadecandy,hakan42/fadecandy,adam-back/fadecandy,Protoneer/fadecandy,piers7/fadecandy,pi...
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# +# Simple example color correction UI. +# Talks to an fcserver running on localhost. +# +# Micah Elizabeth Scott +# This example code is released into the public domain. +# + +import Tkinter as tk +import socket +import json +import struct + +s = socket.socket() +s.c...
c68c5bf488cb7224d675bec333c6b7a4992574ed
apl_exception.py
apl_exception.py
""" A simple APL exception class """ class APL_Exception (BaseException): """ APL Exception Class """ def __init__ (self,message,line=None): self.message = message self.line = line # EOF
Add a simple APL exception class
Add a simple APL exception class
Python
apache-2.0
NewForester/apl-py,NewForester/apl-py
--- +++ @@ -0,0 +1,13 @@ +""" + A simple APL exception class +""" + +class APL_Exception (BaseException): + """ + APL Exception Class + """ + def __init__ (self,message,line=None): + self.message = message + self.line = line + +# EOF
274e7a93bac93461f07dd43f3f84f1f00e229ffd
hr_employee_relative/migrations/12.0.1.0.0/post-migration.py
hr_employee_relative/migrations/12.0.1.0.0/post-migration.py
# Copyright 2019 Creu Blanca # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openupgradelib import openupgrade @openupgrade.migrate() def migrate(env, version): cr = env.cr columns = 'fam_spouse, fam_spouse_employer, fam_spouse_tel, fam_father,' \ ' fam_father_date_of_...
Add migration script hr_family -> hr_employee_relative
[12.0][IMP] Add migration script hr_family -> hr_employee_relative
Python
agpl-3.0
OCA/hr,OCA/hr,OCA/hr
--- +++ @@ -0,0 +1,50 @@ +# Copyright 2019 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + cr = env.cr + columns = 'fam_spouse, fam_spouse_employer, fam_spouse_tel, fam_father,' ...
0179d4d84987da76c517de4e01100f0e1d2049ea
tests/unit/modules/pacman_test.py
tests/unit/modules/pacman_test.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Eric Vz <eric@base10.org>` ''' # Import Python Libs from __future__ import absolute_import # Import Salt Testing Libs from salttesting import TestCase, skipIf from salttesting.mock import ( MagicMock, patch, NO_MOCK, NO_MOCK_REASON ) from salttesti...
Add unit tests for pacman list packages
Add unit tests for pacman list packages
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +''' + :codeauthor: :email:`Eric Vz <eric@base10.org>` +''' + +# Import Python Libs +from __future__ import absolute_import + +# Import Salt Testing Libs +from salttesting import TestCase, skipIf +from salttesting.mock import ( + MagicMock, + patch, + NO_M...
f2d4ddba7c594ec93f0ede0be1fc515b0c7c2d7b
HJoystick.py
HJoystick.py
#from direct.showbase import DirectObject import pygame #pygame must be in the Main.py directory #THIS FILE MUST BE IN THE MAIN.PY DIRECTORY BECAUSE SON PATH ISSUES class HJoystickSensor(): def __init__(self,joystickId=0): #print os.getcwd() pygame.init() pygame.joystick.init() c=p...
Remove HInput and Isolate joystick related code because son path isues with pygame
Remove HInput and Isolate joystick related code because son path isues with pygame
Python
bsd-2-clause
hikaruAi/HPanda
--- +++ @@ -0,0 +1,34 @@ +#from direct.showbase import DirectObject +import pygame #pygame must be in the Main.py directory +#THIS FILE MUST BE IN THE MAIN.PY DIRECTORY BECAUSE SON PATH ISSUES + + +class HJoystickSensor(): + def __init__(self,joystickId=0): + #print os.getcwd() + pygame.init() + ...
fe63d6e1e822f7cb60d1c0bdaa08eb53d3849783
benchmark/datasets/musicbrainz/extract-from-dbdump.py
benchmark/datasets/musicbrainz/extract-from-dbdump.py
#!/usr/bin/env python """ Script to extract the artist names from a MusicBrainz database dump. Usage: ./extract-from-dbdump.py <dump_dir>/artist <outfile> """ import pandas as pd import sys __author__ = "Uwe L. Korn" __license__ = "MIT" input_file = sys.argv[1] output_file = sys.argv[2] df = pd.read_csv(input...
Add script to extract artist names from MusicBrainz database
Add script to extract artist names from MusicBrainz database
Python
mit
xhochy/libfuzzymatch,xhochy/libfuzzymatch
--- +++ @@ -0,0 +1,20 @@ +#!/usr/bin/env python +""" +Script to extract the artist names from a MusicBrainz database dump. + +Usage: + ./extract-from-dbdump.py <dump_dir>/artist <outfile> +""" + +import pandas as pd +import sys + +__author__ = "Uwe L. Korn" +__license__ = "MIT" + + +input_file = sys.argv[1] +outpu...
3a235e25ac3f5d76eb4030e01afbe7b716ec6d91
py/verify-preorder-serialization-of-a-binary-tree.py
py/verify-preorder-serialization-of-a-binary-tree.py
class Solution(object): def isValidSerialization(self, preorder): """ :type preorder: str :rtype: bool """ def get_tree(nodes, offset): if nodes[offset] == '#': return offset + 1 else: left = get_tree(nodes, offset + 1) ...
Add py solution for 331. Verify Preorder Serialization of a Binary Tree
Add py solution for 331. Verify Preorder Serialization of a Binary Tree 331. Verify Preorder Serialization of a Binary Tree: https://leetcode.com/problems/verify-preorder-serialization-of-a-binary-tree/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,20 @@ +class Solution(object): + def isValidSerialization(self, preorder): + """ + :type preorder: str + :rtype: bool + """ + def get_tree(nodes, offset): + if nodes[offset] == '#': + return offset + 1 + else: + ...
bcee6173027c48bfb25a65d3e97660f2e2a0852b
gentest.py
gentest.py
from itertools import product import json import numpy cube = numpy.array(range(1, 9)).reshape(2, 2, 2) pcube = [ cube[0 ,0 ,0 ], cube[0 ,0 ,0:2], cube[0 ,0:2,0:1], cube[0 ,0:2,0:2], cube[0:2,0:1,0:1], cube[0:2,0:1,0:2], cube[0:2,0:2,0:1], cube[0:2,0:2,0:2], ] for (i, (a, b)) i...
Add a python script to generate test methods
Add a python script to generate test methods
Python
mit
y-uti/php-bsxfun,y-uti/php-bsxfun
--- +++ @@ -0,0 +1,27 @@ +from itertools import product +import json +import numpy + +cube = numpy.array(range(1, 9)).reshape(2, 2, 2) + +pcube = [ + cube[0 ,0 ,0 ], + cube[0 ,0 ,0:2], + cube[0 ,0:2,0:1], + cube[0 ,0:2,0:2], + cube[0:2,0:1,0:1], + cube[0:2,0:1,0:2], + cube[0:2,0:2,0:1], + ...
052392da7980c4f4e2e86cd8eb65da5b91d3547b
CodeFights/differentSymbolsNaive.py
CodeFights/differentSymbolsNaive.py
#!/usr/local/bin/python # Code Fights Different Symbols Naive Problem from collections import Counter def differentSymbolsNaive(s): return len(Counter(s)) def main(): tests = [ ["cabca", 3], ["aba", 2] ] for t in tests: res = differentSymbolsNaive(t[0]) ans = t[1] ...
Solve Code Fights different symbols naive problem
Solve Code Fights different symbols naive problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,29 @@ +#!/usr/local/bin/python +# Code Fights Different Symbols Naive Problem + +from collections import Counter + + +def differentSymbolsNaive(s): + return len(Counter(s)) + + +def main(): + tests = [ + ["cabca", 3], + ["aba", 2] + ] + + for t in tests: + res = dif...
d159b32d51339915ef633f3c6d33ce5eeafa78d6
py/rotate-function.py
py/rotate-function.py
class Solution(object): def maxRotateFunction(self, A): """ :type A: List[int] :rtype: int """ lA = len(A) if not lA: return 0 subsum = 0 F = 0 for i in xrange(1, lA): subsum += A[-i] F += subsum subs...
Add py solution for 396. Rotate Function
Add py solution for 396. Rotate Function 396. Rotate Function: https://leetcode.com/problems/rotate-function/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,21 @@ +class Solution(object): + def maxRotateFunction(self, A): + """ + :type A: List[int] + :rtype: int + """ + lA = len(A) + if not lA: + return 0 + subsum = 0 + F = 0 + for i in xrange(1, lA): + subsum += A[...
ee7c257b62bff832b899f54fd7bf39ae47db05b7
get_new_url.py
get_new_url.py
import sys import polycules if len(sys.argv) != 2: print('Expected ID, got too little or too much') old_id = sys.argv[1] db = polycules.connect_db() result = db.execute('select hash from polycules where id = ?', [ old_id, ]).fetchone() if result is None: print("Couldn't find the polycule with that ID"...
Add tool to get new url
Add tool to get new url
Python
mit
makyo/polycul.es,makyo/polycul.es,makyo/polycul.es
--- +++ @@ -0,0 +1,19 @@ +import sys + +import polycules + + +if len(sys.argv) != 2: + print('Expected ID, got too little or too much') + +old_id = sys.argv[1] + +db = polycules.connect_db() +result = db.execute('select hash from polycules where id = ?', [ + old_id, +]).fetchone() + +if result is None: + pri...
7383343f7fb77c74455a50490ad2886fcf36bbd5
dlstats/fetchers/test_ecb.py
dlstats/fetchers/test_ecb.py
import unittest import mongomock import ulstats from dlstats.fetchers._skeleton import (Skeleton, Category, Series, BulkSeries, Dataset, Provider) import datetime from bson import ObjectId #class CategoriesTestCase(unittest.TestCase): #if __name__ == '__main__': # unittest.ma...
Comment test for the moment
Comment test for the moment
Python
agpl-3.0
Widukind/dlstats,mmalter/dlstats,mmalter/dlstats,MichelJuillard/dlstats,MichelJuillard/dlstats,MichelJuillard/dlstats,mmalter/dlstats,Widukind/dlstats
--- +++ @@ -0,0 +1,12 @@ +import unittest +import mongomock +import ulstats +from dlstats.fetchers._skeleton import (Skeleton, Category, Series, BulkSeries, + Dataset, Provider) +import datetime +from bson import ObjectId + +#class CategoriesTestCase(unittest.TestCase): + +#if __...
9167643047c61bae50a7c73775631c7bfe434cc9
spam/ansiInventory.py
spam/ansiInventory.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ AnsibleInventory: INTRO: USAGE: """ import os import ansible.inventory class AnsibleInventory(object): ''' Ansible Inventory wrapper class. ''' def __init__(self, inventory_filename): ''' Initialize Inventory ''' if...
Add a new wrapper class for managing ansible static inventory.
Add a new wrapper class for managing ansible static inventory.
Python
apache-2.0
bdastur/spam,bdastur/spam
--- +++ @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +AnsibleInventory: + +INTRO: + +USAGE: + +""" + +import os +import ansible.inventory + + +class AnsibleInventory(object): + ''' + Ansible Inventory wrapper class. + ''' + def __init__(self, inventory_filename): + ''' + ...
a67a4e15ce25e9e9a795534b4e629d6680fb491b
ludo/playermoverandom.py
ludo/playermoverandom.py
# Player from playerbase import PlayerBase, Players from random import randint class PlayerMoveRandom(PlayerBase): def get_desc(self): """"Return description string""""" return "Chooses a random pawn to move" def _choose_move_impl(self, moves): if not moves: return None ...
Implement player choosing a random pawn to move
Implement player choosing a random pawn to move
Python
mit
risteon/ludo_python
--- +++ @@ -0,0 +1,17 @@ +# Player + +from playerbase import PlayerBase, Players +from random import randint + + +class PlayerMoveRandom(PlayerBase): + + def get_desc(self): + """"Return description string""""" + return "Chooses a random pawn to move" + + def _choose_move_impl(self, moves): + ...
c7e7430d76337ef5cfd6779d9a32c2c9d948eb86
carbon/guess-encoding.py
carbon/guess-encoding.py
""" awk 'NR % 4 == 0' your.fastq | python %prog [options] guess the encoding of a stream of qual lines. """ import sys import optparse RANGES = { 'Sanger': (33, 93), 'Solexa': (59, 104), 'Illumina-1.3': (64, 104), 'Illumina-1.5': (67, 104) } def get_qual_range(qual_str): """ >>> get_qual_...
Add guess phred encoding script
Add guess phred encoding script
Python
apache-2.0
jason-weirather/Au-public,jason-weirather/Au-public,jason-weirather/Au-public,jason-weirather/Au-public
--- +++ @@ -0,0 +1,67 @@ +""" + awk 'NR % 4 == 0' your.fastq | python %prog [options] + +guess the encoding of a stream of qual lines. +""" +import sys +import optparse + +RANGES = { + 'Sanger': (33, 93), + 'Solexa': (59, 104), + 'Illumina-1.3': (64, 104), + 'Illumina-1.5': (67, 104) +} + + +def get_qua...
61e0c6e325a91564250a937c0b1769992f65a7f5
tests/unit/modules/test_swarm.py
tests/unit/modules/test_swarm.py
# -*- coding: utf-8 -*- # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt Libs import salt.modules.swarm # Import Salt Testing Libs from tests.support.mixins import LoaderModuleMockMixin from tests.support.mock import patch from tests.support.unit import Test...
Add initial unit tests for swarm module
Add initial unit tests for swarm module
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- + +# Import Python libs +from __future__ import absolute_import, print_function, unicode_literals + +# Import Salt Libs +import salt.modules.swarm + +# Import Salt Testing Libs +from tests.support.mixins import LoaderModuleMockMixin +from tests.support.mock import pat...
a4d5e88973a25464be26488d17ecc663cce776d7
altair/examples/world_map.py
altair/examples/world_map.py
""" World Map --------- This example shows how to create a world map using data generators for different background layers. """ # category: maps import altair as alt from vega_datasets import data # Data generators for the background sphere = alt.sphere() graticule = alt.graticule() # Source of land data source = a...
Add map example with data generators
DOC: Add map example with data generators
Python
bsd-3-clause
jakevdp/altair,altair-viz/altair
--- +++ @@ -0,0 +1,27 @@ +""" +World Map +--------- + +This example shows how to create a world map using data generators for +different background layers. +""" +# category: maps + +import altair as alt +from vega_datasets import data + +# Data generators for the background +sphere = alt.sphere() +graticule = alt.gra...
2d6ecb3b5b67539c6ad0f211d7b059ac44df2731
python/bending_examples.py
python/bending_examples.py
# Make a gallery of images showing the RGZ consensus double sources, sorted by bending angle. from astropy.io import ascii path = '/Users/willettk/Astronomy/Research/GalaxyZoo' data = ascii.read('{:}/rgz-analysis/csv/static_catalog3.csv'.format(path),delimiter=' ') import bending_angles as ba import numpy as np pat...
Make gallery of examples for various bending angles up to 90 degrees
Make gallery of examples for various bending angles up to 90 degrees
Python
mit
willettk/rgz-analysis,willettk/rgz-analysis,afgaron/rgz-analysis,willettk/rgz-analysis,afgaron/rgz-analysis,afgaron/rgz-analysis
--- +++ @@ -0,0 +1,30 @@ +# Make a gallery of images showing the RGZ consensus double sources, sorted by bending angle. + +from astropy.io import ascii + +path = '/Users/willettk/Astronomy/Research/GalaxyZoo' +data = ascii.read('{:}/rgz-analysis/csv/static_catalog3.csv'.format(path),delimiter=' ') + +import bending_a...
56f9ea1ba0026bc21eeb904afaf25606a6186125
test/test_regles.py
test/test_regles.py
import unittest import mock import settings from soa.tiquets import GestioTiquets from soa.identitat import GestioIdentitat from filtres.nou import FiltreNou from mailticket import MailTicket from testhelper import llegir_mail class TestRegles(unittest.TestCase): def setUp(self): self.ticket...
Test per veure que no permetem capçaleres multivaluades
Test per veure que no permetem capçaleres multivaluades
Python
agpl-3.0
UPC/mailtoticket,UPC/mailtoticket
--- +++ @@ -0,0 +1,47 @@ +import unittest +import mock +import settings +from soa.tiquets import GestioTiquets +from soa.identitat import GestioIdentitat +from filtres.nou import FiltreNou +from mailticket import MailTicket +from testhelper import llegir_mail + + +class TestRegles(unittest.TestCase): + + def setUp...
ae7f22b5fc606a8415e286ffabd43d3fbb71977c
tests/test_euler.py
tests/test_euler.py
import unittest from QGL import * from QGL.Euler import * from QGL.Cliffords import C1 import QGL.config try: from helpers import setup_test_lib except: from .helpers import setup_test_lib class EulerDecompositions(unittest.TestCase): N_test = 1000 def setUp(self): pass #setup_test_lib() #self.q1 = Qubi...
Add Euler angle conversion tests.
Add Euler angle conversion tests.
Python
apache-2.0
BBN-Q/QGL,BBN-Q/QGL
--- +++ @@ -0,0 +1,39 @@ +import unittest + +from QGL import * +from QGL.Euler import * +from QGL.Cliffords import C1 +import QGL.config +try: + from helpers import setup_test_lib +except: + from .helpers import setup_test_lib + +class EulerDecompositions(unittest.TestCase): + + N_test = 1000 + + def setUp(self): +...
7b6b1426015a83b96395f0c7c112dc53d373647f
fairness_indicators/remediation/__init__.py
fairness_indicators/remediation/__init__.py
# Copyright 2019 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
Add init file for remediation module.
Add init file for remediation module. PiperOrigin-RevId: 285058505
Python
apache-2.0
tensorflow/fairness-indicators,tensorflow/fairness-indicators,tensorflow/fairness-indicators
--- +++ @@ -0,0 +1,13 @@ +# Copyright 2019 Google LLC. 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 +# +# Un...
205362c2f068ca22fe40cb6399b071849727ee55
tests/test_parse.py
tests/test_parse.py
import pytest from rinoh.dimension import DimensionBase, PT, PICA, INCH, MM, CM, PERCENT from rinoh.style import OptionSet, Bool, Integer def test_optionset_from_string(): ONE = 'one' TWO = 'two' THREE = 'three' class TestSet1(OptionSet): values = ONE, TWO, THREE assert TestSet1.from_s...
Test cases for style attribute parsing
Test cases for style attribute parsing OptionSet, Bool, Integer, DimensionBase
Python
agpl-3.0
brechtm/rinohtype,brechtm/rinohtype,brechtm/rinohtype
--- +++ @@ -0,0 +1,76 @@ + +import pytest + +from rinoh.dimension import DimensionBase, PT, PICA, INCH, MM, CM, PERCENT +from rinoh.style import OptionSet, Bool, Integer + + +def test_optionset_from_string(): + ONE = 'one' + TWO = 'two' + THREE = 'three' + + class TestSet1(OptionSet): + values = ON...
4628adc38789f52e8e2ef0cdf600b9fbed7b30ab
test/test_events.py
test/test_events.py
import pytest from h11 import Request from wsproto.events import ( ConnectionClosed, ConnectionEstablished, ConnectionRequested, ) from wsproto.frame_protocol import CloseReason def test_connection_requested_repr_no_subprotocol(): method = b'GET' target = b'/foo' headers = { b'host':...
Test events (really event __repr__)
Test events (really event __repr__)
Python
mit
python-hyper/wsproto
--- +++ @@ -0,0 +1,80 @@ +import pytest + +from h11 import Request + +from wsproto.events import ( + ConnectionClosed, + ConnectionEstablished, + ConnectionRequested, +) +from wsproto.frame_protocol import CloseReason + + +def test_connection_requested_repr_no_subprotocol(): + method = b'GET' + target ...
d67b685340cf2db7cd31b50a4484c29625b8fea5
content/test/gpu/gpu_tests/pixel_expectations.py
content/test/gpu/gpu_tests/pixel_expectations.py
# Copyright 2014 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. from telemetry.page import test_expectations # Valid expectation conditions are: # # Operating systems: # win, xp, vista, win7, mac, leopard, snowleopar...
# Copyright 2014 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. from telemetry.page import test_expectations # Valid expectation conditions are: # # Operating systems: # win, xp, vista, win7, mac, leopard, snowleopar...
Remove pixel test fail expectation
Remove pixel test fail expectation This patch undo the failure expectation in https://codereview.chromium.org/340603002/ and completes the rebaseline of the pixel tests. BUG=384551 Review URL: https://codereview.chromium.org/348853003 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@278961 0039d316-1c4b-4281-b9...
Python
bsd-3-clause
jaruba/chromium.src,Pluto-tv/chromium-crosswalk,ondra-novak/chromium.src,krieger-od/nwjs_chromium.src,hgl888/chromium-crosswalk-efl,Just-D/chromium-1,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk,Chilledheart/chromium,Chilledheart/chromium,crosswalk-project/chromium-crosswalk-efl,jaruba/chromium.src,PeterW...
--- +++ @@ -24,8 +24,4 @@ # self.Fail('Pixel.Canvas2DRedBox', # ['mac', 'amd', ('nvidia', 0x1234)], bug=123) - self.Fail('Pixel.Canvas2DRedBox', bug=384551) - self.Fail('Pixel.CSS3DBlueBox', bug=384551) - self.Fail('Pixel.WebGLGreenTriangle', bug=384551) - pass
90b92a1977c32dd660533567c0d5034b93d5c9c7
pombola/core/management/commands/core_create_places_from_mapit_entries.py
pombola/core/management/commands/core_create_places_from_mapit_entries.py
# This script will copy areas from mapit to core.places, including creating the # place kind if required. # import re # import sys from django.core.management.base import LabelCommand from mapit.models import Type from pombola.core.models import Place, PlaceKind from django.template.defaultfilters import slugify cl...
# This script will copy areas from mapit to core.places, including creating the # place kind if required. # import re # import sys from django.core.management.base import LabelCommand from mapit.models import Type from pombola.core.models import Place, PlaceKind from django.template.defaultfilters import slugify cl...
Add smarts to cope with slug clashes with other places with the same names.
Add smarts to cope with slug clashes with other places with the same names.
Python
agpl-3.0
patricmutwiri/pombola,hzj123/56th,geoffkilpin/pombola,patricmutwiri/pombola,hzj123/56th,ken-muturi/pombola,hzj123/56th,hzj123/56th,mysociety/pombola,mysociety/pombola,hzj123/56th,geoffkilpin/pombola,mysociety/pombola,ken-muturi/pombola,hzj123/56th,mysociety/pombola,ken-muturi/pombola,mysociety/pombola,patricmutwiri/pom...
--- +++ @@ -29,15 +29,24 @@ # create all the places as needed for all mapit areas of that type for area in mapit_type.areas.all(): - print area.name + + # There may be a slug clash as several areas have the same name but + # are different placekinds. Create the slu...
0be0d20fc667f0734b85d98f1d359130f7ed5b98
plotly/tests/test_core/test_graph_objs/test_graph_objs.py
plotly/tests/test_core/test_graph_objs/test_graph_objs.py
from unittest import TestCase import plotly.graph_objs as go import plotly.graph_reference as gr OLD_CLASS_NAMES = ['AngularAxis', 'Annotation', 'Annotations', 'Area', 'Bar', 'Box', 'ColorBar', 'Contour', 'Contours', 'Data', 'ErrorX', 'ErrorY', 'ErrorZ', 'Figure', ...
Add failing specs for current/future class names.
Add failing specs for current/future class names.
Python
mit
plotly/python-api,plotly/python-api,plotly/plotly.py,plotly/plotly.py,plotly/plotly.py,plotly/python-api
--- +++ @@ -0,0 +1,49 @@ +from unittest import TestCase + +import plotly.graph_objs as go +import plotly.graph_reference as gr + +OLD_CLASS_NAMES = ['AngularAxis', 'Annotation', 'Annotations', 'Area', + 'Bar', 'Box', 'ColorBar', 'Contour', 'Contours', + 'Data', 'ErrorX', 'ErrorY', ...
22b2446546ce59b99980e98e81b3571d81085304
tests/test_westminster_daily.py
tests/test_westminster_daily.py
import datetime as dt from flask_application import app def test_daily_westminster_pages_exist(): start_date = dt.date(2015, 01, 01) with app.test_client() as c: for days in range(365): date = start_date + dt.timedelta(days=days) month, day = date.month, date.day ...
Test that daily westminster pages load
Test that daily westminster pages load
Python
bsd-3-clause
tdhopper/westminster-daily,olneyhymn/westminster-daily,olneyhymn/westminster-daily,olneyhymn/westminster-daily,olneyhymn/westminster-daily,tdhopper/westminster-daily,tdhopper/westminster-daily
--- +++ @@ -0,0 +1,30 @@ +import datetime as dt + +from flask_application import app + + +def test_daily_westminster_pages_exist(): + start_date = dt.date(2015, 01, 01) + + with app.test_client() as c: + for days in range(365): + date = start_date + dt.timedelta(days=days) + month, ...
eb828764ddbe3988f71b98082e1560e594c3f65d
ci/teamcity/comment_on_pr.py
ci/teamcity/comment_on_pr.py
""" Post the comment like the following to the PR: ``` :robot: TeamCity test results bot :robot: <Logs from pytest> ``` """ from github import Github import os import sys # Check if this is a pull request or not based on the environment variable try: pr_id = int(os.environ["GITHUB_PR_NUMBER"].split("/")[-1]) exc...
Add a bot message to display TeamCity test results
Add a bot message to display TeamCity test results * Make modin-bot update the comment instead of creating a new one * Also only run the comment bot when a PR is being evaluated Signed-off-by: Devin Petersohn <9526cbaf745870a4c947dfa2bd5208403b463ac3@gmail.com>
Python
apache-2.0
modin-project/modin,modin-project/modin
--- +++ @@ -0,0 +1,49 @@ +""" +Post the comment like the following to the PR: +``` +:robot: TeamCity test results bot :robot: + +<Logs from pytest> +``` +""" + +from github import Github +import os +import sys + +# Check if this is a pull request or not based on the environment variable +try: + pr_id = int(os.envi...
dbdb247ad03ca6b9168f193eadaf28638d718072
scrubadub/filth/named_entity.py
scrubadub/filth/named_entity.py
from .base import Filth class NamedEntityFilth(Filth): """ Named entity filth. Upon initialisation provide a label for named entity (e.g. name, org) """ type = 'named_entity' def __init__(self, *args, label: str, **kwargs): super(NamedEntityFilth, self).__init__(*args, **kwargs) s...
from .base import Filth class NamedEntityFilth(Filth): """ Default filth type, for named entities (e.g. the ones in https://nightly.spacy.io/models/en#en_core_web_lg-labels), except the ones represented in any other filth. """ type = 'named_entity' def __init__(self, *args, label: str, **kwar...
Change docstring for NamedEntity filth
Change docstring for NamedEntity filth
Python
mit
deanmalmgren/scrubadub,datascopeanalytics/scrubadub,datascopeanalytics/scrubadub,deanmalmgren/scrubadub
--- +++ @@ -3,7 +3,8 @@ class NamedEntityFilth(Filth): """ - Named entity filth. Upon initialisation provide a label for named entity (e.g. name, org) + Default filth type, for named entities (e.g. the ones in https://nightly.spacy.io/models/en#en_core_web_lg-labels), + except the ones represented in...
9bfb182f92b8ac82ddb1b35c886b4a3f79708696
scripts/split_train_and_test.py
scripts/split_train_and_test.py
import os import shutil import argparse import random random.seed(47297) parser = argparse.ArgumentParser(description='Split data into train and test sets.') parser.add_argument('subjects_root_path', type=str, help='Directory containing subject sub-directories.') args, _ = parser.parse_known_args() def move_to_part...
Add script for train/test split
Add script for train/test split
Python
mit
YerevaNN/mimic3-benchmarks
--- +++ @@ -0,0 +1,32 @@ +import os +import shutil +import argparse +import random +random.seed(47297) + + +parser = argparse.ArgumentParser(description='Split data into train and test sets.') +parser.add_argument('subjects_root_path', type=str, help='Directory containing subject sub-directories.') +args, _ = parser....
fa375d06128e493f86524e82fa93c892f4d925b7
corehq/apps/data_pipeline_audit/management/commands/find_sql_forms_not_in_es.py
corehq/apps/data_pipeline_audit/management/commands/find_sql_forms_not_in_es.py
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals from __future__ import print_function from datetime import datetime from django.core.management.base import BaseCommand import sys from django.db.models import Q, F from django.db.models.functions import Grea...
Add script to find forms missing in ES
Add script to find forms missing in ES
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,79 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import unicode_literals + +from __future__ import print_function +from datetime import datetime +from django.core.management.base import BaseCommand +import sys +from django.db.models import Q, F +from d...
d8521011d5be28812c222b58901a07e8f30e87ac
neuralstyle/testing-train.py
neuralstyle/testing-train.py
from __future__ import print_function import argparse import numpy as np import torch from torch.autograd import Variable from torch.optim import Adam from torch.utils.data import DataLoader from torchvision import transforms from torchvision import datasets from transformernet import TransformerNet from vgg16 impor...
Add testing code for memory leak.
Add testing code for memory leak.
Python
mit
abhiskk/fast-neural-style,onai/fast-neural-style,abhiskk/fast-neural-style,darkstar112358/fast-neural-style,darkstar112358/fast-neural-style
--- +++ @@ -0,0 +1,70 @@ +from __future__ import print_function + +import argparse + +import numpy as np +import torch +from torch.autograd import Variable +from torch.optim import Adam +from torch.utils.data import DataLoader +from torchvision import transforms +from torchvision import datasets + +from transformerne...
f3e91020f0426fedfe229e94bf1ddc69dd64a136
doc/examples/plot_template_alt.py
doc/examples/plot_template_alt.py
""" ================= Template Matching ================= In this example, we use template matching to identify the occurrence of an image patch (in this case, a sub-image centered on a single coin). Here, we return a single match (the exact same coin), so the maximum value in the ``match_template`` result corresponds...
Add new example plot for `match_template`.
Add new example plot for `match_template`.
Python
bsd-3-clause
SamHames/scikit-image,warmspringwinds/scikit-image,ClinicalGraphics/scikit-image,paalge/scikit-image,emmanuelle/scikits.image,newville/scikit-image,almarklein/scikit-image,chintak/scikit-image,warmspringwinds/scikit-image,rjeli/scikit-image,chriscrosscutler/scikit-image,Britefury/scikit-image,GaZ3ll3/scikit-image,Brite...
--- +++ @@ -0,0 +1,56 @@ +""" +================= +Template Matching +================= + +In this example, we use template matching to identify the occurrence of an +image patch (in this case, a sub-image centered on a single coin). Here, we +return a single match (the exact same coin), so the maximum value in the +`...
9b5f070705de9896c8c6f8347dc0f733ae748793
harvesting_blog_data.py
harvesting_blog_data.py
import os import sys import json import feedparser from bs4 import BeautifulSoup FEED_URL = 'http://g1.globo.com/dynamo/rss2.xml' def cleanHtml(html): return BeautifulSoup(html, 'lxml').get_text() fp = feedparser.parse(FEED_URL) print "Fetched %s entries from '%s'" % (len(fp.entries[0].title), fp.feed.title) b...
Add harvesting blog data example
Add harvesting blog data example
Python
apache-2.0
fabriciojoc/redes-sociais-web,fabriciojoc/redes-sociais-web
--- +++ @@ -0,0 +1,29 @@ +import os +import sys +import json +import feedparser +from bs4 import BeautifulSoup + +FEED_URL = 'http://g1.globo.com/dynamo/rss2.xml' + +def cleanHtml(html): + return BeautifulSoup(html, 'lxml').get_text() + +fp = feedparser.parse(FEED_URL) + +print "Fetched %s entries from '%s'" % (le...
42f66ea6e1921040d6e3055c41372b02511e6a5a
tests/CYK/__init__.py
tests/CYK/__init__.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 31.08.2017 14:50 :Licence GNUv3 Part of pyparsers """
Add directory for CYK tests
Add directory for CYK tests
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -0,0 +1,8 @@ +#!/usr/bin/env python +""" +:Author Patrik Valkovic +:Created 31.08.2017 14:50 +:Licence GNUv3 +Part of pyparsers + +"""
4ae114dd1da8118cc9d2ee87e30f5e0a1f3324f2
tests/test_monitor.py
tests/test_monitor.py
import unittest import Monitors.monitor class TestMonitor(unittest.TestCase): safe_config = {'partition': '/', 'limit': '10G'} one_KB = 1024 one_MB = one_KB * 1024 one_GB = one_MB * 1024 one_TB = one_GB * 1024 def test_MonitorInit(self): m = Monitors.monitor.Monitor(config_options={...
Add some tests for monitor class
Add some tests for monitor class
Python
bsd-3-clause
jamesoff/simplemonitor,jamesoff/simplemonitor,jamesoff/simplemonitor,jamesoff/simplemonitor,jamesoff/simplemonitor
--- +++ @@ -0,0 +1,57 @@ +import unittest +import Monitors.monitor + + +class TestMonitor(unittest.TestCase): + + safe_config = {'partition': '/', 'limit': '10G'} + + one_KB = 1024 + one_MB = one_KB * 1024 + one_GB = one_MB * 1024 + one_TB = one_GB * 1024 + + def test_MonitorInit(self): + m =...
f9b2bba394ad6ce31ffae5cf6ccf445dc280ba95
solutions/beecrowd/2486/2486.py
solutions/beecrowd/2486/2486.py
import sys MIN_VITAMIN_C = 110 MAX_VITAMIN_C = 130 vitamin_c_catalogue = { 'suco de laranja': 120, 'morango fresco': 85, 'mamao': 85, 'goiaba vermelha': 70, 'manga': 56, 'laranja': 50, 'brocolis': 34, } for test in sys.stdin: t = int(test) if not t: break total_c_vit...
Solve C Mais ou Menos? in python
Solve C Mais ou Menos? in python
Python
mit
deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playgr...
--- +++ @@ -0,0 +1,36 @@ +import sys + +MIN_VITAMIN_C = 110 +MAX_VITAMIN_C = 130 + +vitamin_c_catalogue = { + 'suco de laranja': 120, + 'morango fresco': 85, + 'mamao': 85, + 'goiaba vermelha': 70, + 'manga': 56, + 'laranja': 50, + 'brocolis': 34, +} + +for test in sys.stdin: + t = int(test) +...
27fca35a08278a44bb7ba693f222c6c182061872
Enemy.py
Enemy.py
import pygame class Enemy(pygame.sprite.Sprite): def __init__(self, x, y): super().__init__() self.image = pygame.image.load("images/enemy.png").convert_alpha() self.rect = self.image.get_rect(center=(x, y)) def
Add the enemy file and start it up.
Add the enemy file and start it up.
Python
mit
di1111/mlg-fite
--- +++ @@ -0,0 +1,12 @@ +import pygame + +class Enemy(pygame.sprite.Sprite): + + def __init__(self, x, y): + super().__init__() + self.image = pygame.image.load("images/enemy.png").convert_alpha() + self.rect = self.image.get_rect(center=(x, y)) + + def + +
982cd61d7532365d9de56b308c7a4d8308302c15
tests/testapp/tests/test_model_create_with_generic.py
tests/testapp/tests/test_model_create_with_generic.py
try: from django.contrib.contenttypes.fields import GenericForeignKey except ImportError: # Django 1.6 from django.contrib.contenttypes.generic import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models from django.test import TestCase from django_fsm im...
Add a test to demonstrate issue with django 1.11
Add a test to demonstrate issue with django 1.11 If model with state field has other fields that access their field value via a property or a Virtal Field, then creation of instances will fail.
Python
mit
kmmbvnr/django-fsm,kmmbvnr/django-fsm
--- +++ @@ -0,0 +1,44 @@ +try: + from django.contrib.contenttypes.fields import GenericForeignKey +except ImportError: + # Django 1.6 + from django.contrib.contenttypes.generic import GenericForeignKey +from django.contrib.contenttypes.models import ContentType +from django.db import models +from django.test...
6e0f585a8f8433d4f6800cb1f093f97f8a1d4ff7
imageutils/__init__.py
imageutils/__init__.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Image processing utilities for Astropy. """ # Affiliated packages may add whatever they like to this file, but # should keep this content at the top. # ---------------------------------------------------------------------------- from ._astropy_init im...
Update imports for new functions
Update imports for new functions
Python
bsd-3-clause
mhvk/astropy,saimn/astropy,funbaker/astropy,bsipocz/astropy,tbabej/astropy,pllim/astropy,stargaser/astropy,AustereCuriosity/astropy,aleksandr-bakanov/astropy,dhomeier/astropy,funbaker/astropy,kelle/astropy,saimn/astropy,larrybradley/astropy,lpsinger/astropy,pllim/astropy,dhomeier/astropy,bsipocz/astropy,larrybradley/as...
--- +++ @@ -0,0 +1,21 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +""" +Image processing utilities for Astropy. +""" + +# Affiliated packages may add whatever they like to this file, but +# should keep this content at the top. +# ----------------------------------------------------------------...
54b94346d2669347cf2a9a2b24df6b657cf80c5b
nisl/mask.py
nisl/mask.py
import numpy as np from scipy import ndimage ############################################################################### # Operating on connect component ############################################################################### def largest_cc(mask): """ Return the largest connected component of a 3D m...
Mask computation utilities (from nipy).
Mask computation utilities (from nipy).
Python
bsd-3-clause
abenicho/isvr
--- +++ @@ -0,0 +1,90 @@ +import numpy as np +from scipy import ndimage + + +############################################################################### +# Operating on connect component +############################################################################### + + +def largest_cc(mask): + """ Return the...
f333b9c5741a7ffbf49caa0a6130831a834b944f
test_dotfiles.py
test_dotfiles.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import shutil import tempfile import unittest from dotfiles import core def touch(fname, times=None): with file(fname, 'a'): os.utime(fname, times) class DotfilesTestCase(unittest.TestCase): def setUp(self): """Create a temporary hom...
Add unit tests for recent bugfix and move operation
Add unit tests for recent bugfix and move operation
Python
isc
Bklyn/dotfiles,aparente/Dotfiles,nilehmann/dotfiles-1,aparente/Dotfiles,aparente/Dotfiles,aparente/Dotfiles
--- +++ @@ -0,0 +1,85 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import shutil +import tempfile +import unittest + +from dotfiles import core + + +def touch(fname, times=None): + with file(fname, 'a'): + os.utime(fname, times) + + +class DotfilesTestCase(unittest.TestCase): + + def ...
2b0e13039dad8d116a5719540004bed317bb6960
tests/api/test_organizations.py
tests/api/test_organizations.py
# -*- coding: utf-8 -*- """pytest Licenses functions, fixtures and tests.""" import pytest import ciscosparkapi # Helper Functions def list_organizations(api, max=None): return list(api.organizations.list(max=max)) def get_organization_by_id(api, orgId): return api.organizations.get(orgId) def is_val...
Add tests and fixtures for the Organizations API wrapper
Add tests and fixtures for the Organizations API wrapper
Python
mit
jbogarin/ciscosparkapi
--- +++ @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- + +"""pytest Licenses functions, fixtures and tests.""" + + +import pytest + +import ciscosparkapi + + +# Helper Functions + +def list_organizations(api, max=None): + return list(api.organizations.list(max=max)) + + +def get_organization_by_id(api, orgId): + ret...
5d3918c885f430e79e8283533ad5eb3a84ffecc7
blazar/db/migration/alembic_migrations/versions/75a74e4539cb_update_lease_status.py
blazar/db/migration/alembic_migrations/versions/75a74e4539cb_update_lease_status.py
# Copyright 2018 OpenStack Foundation. # # 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 ...
Add migration code for updating lease status
Add migration code for updating lease status Lease status was None before the status module was introduced. This patch is for updating the None status. Partially Implements: blueprint state-machine Change-Id: I64cc07737d5c1c83a4f91d485a21c9a459305b9a
Python
apache-2.0
openstack/blazar,stackforge/blazar,openstack/blazar,ChameleonCloud/blazar,ChameleonCloud/blazar,stackforge/blazar
--- +++ @@ -0,0 +1,43 @@ +# Copyright 2018 OpenStack Foundation. +# +# 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 require...
6279341682ae45a228302972dbd106a2e44e0b12
examples/example_test.py
examples/example_test.py
import unittest from flask import Flask from flask_json import json_response, FlaskJSON, JsonTestResponse def our_app(): app = Flask(__name__) app.test_value = 0 FlaskJSON(app) @app.route('/increment') def increment(): app.test_value += 1 return json_response(value=app.test_value)...
Add example usage of the JsonTestResponse.
Add example usage of the JsonTestResponse.
Python
bsd-3-clause
craig552uk/flask-json
--- +++ @@ -0,0 +1,38 @@ +import unittest +from flask import Flask +from flask_json import json_response, FlaskJSON, JsonTestResponse + + +def our_app(): + app = Flask(__name__) + app.test_value = 0 + FlaskJSON(app) + + @app.route('/increment') + def increment(): + app.test_value += 1 + r...
2427dbad4fc0cfe7685dc2767069748d37262796
movienamer/identify.py
movienamer/identify.py
import os.path as path import re import Levenshtein from .sanitize import sanitize from .tmdb import search def _gather(filename, directory=None, titles={}): # Sanitize the input filename name, year = sanitize(filename) # Start with a basic search results = search(name, year) if year is not No...
Add initial version of identification algorithm
Add initial version of identification algorithm
Python
mit
divijbindlish/movienamer
--- +++ @@ -0,0 +1,86 @@ +import os.path as path +import re + +import Levenshtein + +from .sanitize import sanitize +from .tmdb import search + + +def _gather(filename, directory=None, titles={}): + # Sanitize the input filename + name, year = sanitize(filename) + + # Start with a basic search + results =...
83e136a0e0d93d1dde4966322a3b51f453d0a1ba
tcflib/examples/csv_exporter.py
tcflib/examples/csv_exporter.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import csv from io import StringIO from collections import OrderedDict from tcflib.service import ExportingWorker, run_as_cli class CSVExporter(ExportingWorker): def export(self): columns = OrderedDict() columns['tokenID'] = [token.id for token in...
Add simple CSV exporter to examples.
Add simple CSV exporter to examples.
Python
mit
SeNeReKo/TCFlib
--- +++ @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import csv +from io import StringIO +from collections import OrderedDict + +from tcflib.service import ExportingWorker, run_as_cli + + +class CSVExporter(ExportingWorker): + + def export(self): + + columns = OrderedDict() + ...
1c5fef3a34ed421610a4e9a38feb07e6545e5d13
tests/rules/test_dirty_untar.py
tests/rules/test_dirty_untar.py
import os import pytest import tarfile from thefuck.rules.dirty_untar import match, get_new_command, side_effect from tests.utils import Command @pytest.fixture def tar_error(tmpdir): def fixture(filename): path = os.path.join(str(tmpdir), filename) def reset(path): with tarfile.TarFi...
Add tests for the `dirty_untar` rule
Add tests for the `dirty_untar` rule
Python
mit
PLNech/thefuck,AntonChankin/thefuck,SimenB/thefuck,gogobebe2/thefuck,BertieJim/thefuck,lawrencebenson/thefuck,barneyElDinosaurio/thefuck,vanita5/thefuck,mcarton/thefuck,redreamality/thefuck,subajat1/thefuck,mbbill/thefuck,vanita5/thefuck,qingying5810/thefuck,thinkerchan/thefuck,bigplus/thefuck,mlk/thefuck,AntonChankin/...
--- +++ @@ -0,0 +1,62 @@ +import os +import pytest +import tarfile +from thefuck.rules.dirty_untar import match, get_new_command, side_effect +from tests.utils import Command + + +@pytest.fixture +def tar_error(tmpdir): + def fixture(filename): + path = os.path.join(str(tmpdir), filename) + + def res...
62fb38d0860b5feeee39764b6c66f5ceed39b984
alembic_migration/versions/077ddf78a1f3_fix_protected_docs_versions.py
alembic_migration/versions/077ddf78a1f3_fix_protected_docs_versions.py
"""Fix protected docs versions Revision ID: 077ddf78a1f3 Revises: 9739938498a8 Create Date: 2017-10-30 12:05:51.679435 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '077ddf78a1f3' down_revision = '9739938498a8' branch_labels = None depends_on = None def upgr...
Fix versions of protected/unprotected documents
Fix versions of protected/unprotected documents
Python
agpl-3.0
c2corg/v6_api,c2corg/v6_api,c2corg/v6_api
--- +++ @@ -0,0 +1,33 @@ +"""Fix protected docs versions + +Revision ID: 077ddf78a1f3 +Revises: 9739938498a8 +Create Date: 2017-10-30 12:05:51.679435 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '077ddf78a1f3' +down_revision = '9739938498a8' +branch...
b39dd2afea1f4662e17a927e7e6aa41e850f7470
lib/gen-hangul.py
lib/gen-hangul.py
#!/usr/bin/python3 # Input: https://www.unicode.org/Public/UNIDATA/Jamo.txt import io import re class Builder(object): def __init__(self): pass def read(self, infile): chars = [] for line in infile: if line.startswith('#'): continue line = line...
Add a script for generating jamo character table
lib: Add a script for generating jamo character table
Python
bsd-3-clause
GNOME/gnome-characters,GNOME/gnome-characters,GNOME/gnome-characters,GNOME/gnome-characters,GNOME/gnome-characters
--- +++ @@ -0,0 +1,53 @@ +#!/usr/bin/python3 + +# Input: https://www.unicode.org/Public/UNIDATA/Jamo.txt + +import io +import re + +class Builder(object): + def __init__(self): + pass + + def read(self, infile): + chars = [] + for line in infile: + if line.startswith('#'): + ...
72e69f3535c7e2cd82cdda62636eabd7421ebddf
generative/tests/compare_test/concat_first/dump_hiddens.py
generative/tests/compare_test/concat_first/dump_hiddens.py
from __future__ import division from __future__ import print_function from __future__ import absolute_import import os import subprocess if __name__ == "__main__": for hiddens_dim in [512, 256, 128, 64, 32, 16]: print('Dumping files for (%d)' % hiddens_dim) model_path = '/mnt/visual_communicat...
Add dump script for all hiddens
Add dump script for all hiddens
Python
mit
judithfan/pix2svg
--- +++ @@ -0,0 +1,17 @@ +from __future__ import division +from __future__ import print_function +from __future__ import absolute_import + +import os +import subprocess + +if __name__ == "__main__": + for hiddens_dim in [512, 256, 128, 64, 32, 16]: + print('Dumping files for (%d)' % hiddens_dim) + ...
df784323d0da737755def4015840d118e3c8e595
nettests/core/http_body_length.py
nettests/core/http_body_length.py
# -*- encoding: utf-8 -*- # # :authors: Arturo Filastò # :licence: see LICENSE from twisted.internet import defer from twisted.python import usage from ooni.templates import httpt class UsageOptions(usage.Options): optParameters = [ ['url', 'u', None, 'Specify a single URL to test.'], ...
Add test that detects censorship in HTTP pages based on HTTP body length
Add test that detects censorship in HTTP pages based on HTTP body length
Python
bsd-2-clause
juga0/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,Karthikeyan-kkk/ooni-probe,Karthikeyan-kkk/ooni-probe,Karthikeyan-kkk/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,lordappsec/ooni-prob...
--- +++ @@ -0,0 +1,90 @@ +# -*- encoding: utf-8 -*- +# +# :authors: Arturo Filastò +# :licence: see LICENSE + +from twisted.internet import defer +from twisted.python import usage +from ooni.templates import httpt + +class UsageOptions(usage.Options): + optParameters = [ + ['url', 'u', None, 'S...
f970198596d8c20c89701fbcce38fd5736096e86
namegen/markov.py
namegen/markov.py
#!/usr/bin/env python """ Module which produces readble name from 256-bit of random data (i.e. sha-256 hash) """ MAXWORDLEN=12 # # Modules which contain problablity dictionaries # generated by genmarkov script # from surname_hash import surname from female_hash import female from male_hash import male # import operat...
Set maximal word length limit
Set maximal word length limit
Python
agpl-3.0
cheshirenet/cheshirenet
--- +++ @@ -0,0 +1,104 @@ +#!/usr/bin/env python +""" +Module which produces readble name from 256-bit of random data +(i.e. sha-256 hash) + + +""" +MAXWORDLEN=12 +# +# Modules which contain problablity dictionaries +# generated by genmarkov script +# +from surname_hash import surname +from female_hash import female ...
3601a0dc9d762e17c24e0dbf86ee1ef4a00c49cd
yithlibraryserver/tests/test_security.py
yithlibraryserver/tests/test_security.py
from pyramid.httpexceptions import HTTPBadRequest, HTTPUnauthorized from yithlibraryserver import testing from yithlibraryserver.security import authorize_user class AuthorizationTests(testing.TestCase): clean_collections = ('access_codes', 'users') def test_authorize_user(self): request = testing...
Add tests for the authorize_user function
Add tests for the authorize_user function
Python
agpl-3.0
lorenzogil/yith-library-server,Yaco-Sistemas/yith-library-server,Yaco-Sistemas/yith-library-server,lorenzogil/yith-library-server,lorenzogil/yith-library-server,Yaco-Sistemas/yith-library-server
--- +++ @@ -0,0 +1,49 @@ +from pyramid.httpexceptions import HTTPBadRequest, HTTPUnauthorized + +from yithlibraryserver import testing +from yithlibraryserver.security import authorize_user + + +class AuthorizationTests(testing.TestCase): + + clean_collections = ('access_codes', 'users') + + def test_authorize_...
40dd078b5e176ae5039bf20dcb50350e8f065808
recognition/scrollError.py
recognition/scrollError.py
from sense_hat import SenseHat import sys sense = SenseHat() sense.show_message(sys.stdin.read(), scroll_speed=.08, text_colour=[255, 0, 0])
Create python script to scroll error messages
Create python script to scroll error messages
Python
mit
jeffstephens/pi-resto,jeffstephens/pi-resto
--- +++ @@ -0,0 +1,5 @@ +from sense_hat import SenseHat +import sys + +sense = SenseHat() +sense.show_message(sys.stdin.read(), scroll_speed=.08, text_colour=[255, 0, 0])
b0c03b86d606c85dd1cab1ad9e9678e1057d0ae1
Lib/fontTools/pens/ttGlyphPen.py
Lib/fontTools/pens/ttGlyphPen.py
from __future__ import print_function, division, absolute_import from array import array from fontTools.misc.py23 import * from fontTools.pens.basePen import AbstractPen from fontTools.ttLib.tables import ttProgram from fontTools.ttLib.tables._g_l_y_f import Glyph from fontTools.ttLib.tables._g_l_y_f import GlyphCompo...
Add pen which draws to TrueType glyphs.
Add pen which draws to TrueType glyphs.
Python
mit
googlefonts/fonttools,fonttools/fonttools
--- +++ @@ -0,0 +1,80 @@ +from __future__ import print_function, division, absolute_import +from array import array + +from fontTools.misc.py23 import * +from fontTools.pens.basePen import AbstractPen +from fontTools.ttLib.tables import ttProgram +from fontTools.ttLib.tables._g_l_y_f import Glyph +from fontTools.ttLi...
08447fa344e21d6d704c6f195ad2b7405fa8f916
saleor/order/test_order.py
saleor/order/test_order.py
from .models import Order def test_total_property(): order = Order(total_net=20, total_tax=5) assert order.total.gross == 25 assert order.total.tax == 5 assert order.total.net == 20
Add test for total property
Add test for total property
Python
bsd-3-clause
UITools/saleor,car3oon/saleor,itbabu/saleor,tfroehlich82/saleor,tfroehlich82/saleor,maferelo/saleor,laosunhust/saleor,jreigel/saleor,itbabu/saleor,UITools/saleor,car3oon/saleor,KenMutemi/saleor,maferelo/saleor,HyperManTT/ECommerceSaleor,itbabu/saleor,spartonia/saleor,KenMutemi/saleor,laosunhust/saleor,jreigel/saleor,ro...
--- +++ @@ -0,0 +1,8 @@ +from .models import Order + + +def test_total_property(): + order = Order(total_net=20, total_tax=5) + assert order.total.gross == 25 + assert order.total.tax == 5 + assert order.total.net == 20
ace26ab5e713fabd02f4f481956c47640f50b166
tempest/tests/lib/services/volume/v2/test_limits_client.py
tempest/tests/lib/services/volume/v2/test_limits_client.py
# Copyright 2017 FiberHome Telecommunication Technologies CO.,LTD # 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/LI...
Add unit test for volume limits client
Add unit test for volume limits client This patch adds unit test for volume v2 limits client. Partially Implements: blueprint tempest-lib-missing-test-coverage Change-Id: I08a982758fcdd364e1790e1049d0022f04e4bcc7
Python
apache-2.0
vedujoshi/tempest,openstack/tempest,cisco-openstack/tempest,cisco-openstack/tempest,Juniper/tempest,masayukig/tempest,openstack/tempest,Juniper/tempest,masayukig/tempest,vedujoshi/tempest
--- +++ @@ -0,0 +1,59 @@ +# Copyright 2017 FiberHome Telecommunication Technologies CO.,LTD +# 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 +# +# ...
e4b9c43d53121d2b21c4b864fcc74674b0b6dfc1
scratchpad/Interpolator.py
scratchpad/Interpolator.py
class Interpolator: def __init__(self): self.data = [] def addIndexValue(self, index, value): self.data.append((index, value)) def valueAtIndex(self, target_index): if target_index < self.data[0][0]: return None elif self.data[-1][0] < target_index: ...
Create class to interpolate values between indexes
Create class to interpolate values between indexes
Python
mit
thelonious/g2x,gizmo-cda/g2x,gizmo-cda/g2x,thelonious/g2x,gizmo-cda/g2x,gizmo-cda/g2x
--- +++ @@ -0,0 +1,31 @@ +class Interpolator: + def __init__(self): + self.data = [] + + def addIndexValue(self, index, value): + self.data.append((index, value)) + + def valueAtIndex(self, target_index): + if target_index < self.data[0][0]: + return None + elif self.da...
36781fb1b04a3d2fd3162ea88969244faab22a60
open511/utils/postgis.py
open511/utils/postgis.py
from django.db import connection def gml_to_ewkt(gml_string, force_2D=False): cursor = connection.cursor() if force_2D: sql = 'SELECT ST_AsEWKT(ST_Force_2D(ST_GeomFromGML(%s)))' else: sql = 'SELECT ST_AsEWKT(ST_GeomFromGML(%s))' cursor.execute(sql, [gml_string]) return cursor.fetcho...
Convert GML to EWKT, via PostGIS
Convert GML to EWKT, via PostGIS
Python
mit
Open511/open511-server,Open511/open511-server,Open511/open511-server
--- +++ @@ -0,0 +1,10 @@ +from django.db import connection + +def gml_to_ewkt(gml_string, force_2D=False): + cursor = connection.cursor() + if force_2D: + sql = 'SELECT ST_AsEWKT(ST_Force_2D(ST_GeomFromGML(%s)))' + else: + sql = 'SELECT ST_AsEWKT(ST_GeomFromGML(%s))' + cursor.execute(sql, [g...
fcc92760db0d1dc56aca70aff69b34a29c9e8e6c
tests/test_util.py
tests/test_util.py
from lib import util def test_cachedproperty(): class Target: def __init__(self): self.call_count = 0 @util.cachedproperty def prop(self): self.call_count += 1 return self.call_count t = Target() assert t.prop == t.prop == 1 def test_deep_get...
Add unit tests for the methods in util
Add unit tests for the methods in util
Python
mit
shsmith/electrumx,thelazier/electrumx,Groestlcoin/electrumx-grs,erasmospunk/electrumx,shsmith/electrumx,bauerj/electrumx,thelazier/electrumx,erasmospunk/electrumx,Crowndev/electrumx,Groestlcoin/electrumx-grs,bauerj/electrumx,Crowndev/electrumx
--- +++ @@ -0,0 +1,48 @@ +from lib import util + + +def test_cachedproperty(): + class Target: + def __init__(self): + self.call_count = 0 + + @util.cachedproperty + def prop(self): + self.call_count += 1 + return self.call_count + + t = Target() + assert...
6e805995a165f923c1c4f71c163c64a245f9a3d5
setup.py
setup.py
from distutils.core import setup setup(name='dimreducer', version='1.0', description='Dimension reduction methods', py_modules=['dimreducer'], ) setup(name='multiphenotype_utils', version='1.0', description='Utility functions for all methods', py_modules=['multiphenotype_utils...
Add simple distutils script for modules
Add simple distutils script for modules
Python
mit
epierson9/multiphenotype_methods
--- +++ @@ -0,0 +1,37 @@ +from distutils.core import setup + +setup(name='dimreducer', + version='1.0', + description='Dimension reduction methods', + py_modules=['dimreducer'], + ) + +setup(name='multiphenotype_utils', + version='1.0', + description='Utility functions for all methods', +...
c6c6594cda35aaa15f1efb9f336548671b0028c5
rmake/lib/twisted_extras/tools.py
rmake/lib/twisted_extras/tools.py
# # Copyright (c) rPath, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU 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 distributed in the h...
Add generic serializer tool for plugins to use
Add generic serializer tool for plugins to use
Python
apache-2.0
sassoftware/rmake3,sassoftware/rmake3,sassoftware/rmake3
--- +++ @@ -0,0 +1,41 @@ +# +# Copyright (c) rPath, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# ...
1d25676049994db266129b1a1c98cec3acbba0ca
goodtablesio/models/subscription.py
goodtablesio/models/subscription.py
import logging import datetime from sqlalchemy import ( Column, Unicode, DateTime, Boolean, ForeignKey) from sqlalchemy.orm import relationship from goodtablesio.models.base import Base, BaseModelMixin, make_uuid log = logging.getLogger(__name__) class Subscription(Base, BaseModelMixin): __tablename__ = ...
Add missing file on last merge
Add missing file on last merge
Python
agpl-3.0
frictionlessdata/goodtables.io,frictionlessdata/goodtables.io,frictionlessdata/goodtables.io,frictionlessdata/goodtables.io
--- +++ @@ -0,0 +1,28 @@ +import logging +import datetime + +from sqlalchemy import ( + Column, Unicode, DateTime, Boolean, ForeignKey) +from sqlalchemy.orm import relationship + +from goodtablesio.models.base import Base, BaseModelMixin, make_uuid + + +log = logging.getLogger(__name__) + + +class Subscription(Bas...
5f051f2ae1b105d6cc58d1cac760cb5d20908c3b
valai/translate.py
valai/translate.py
# * coding: utf8 * # # (C) 2020 Muthiah Annamalai <ezhillang@gmail.com> # # Uses the IIT-Bombay service on the web. # import json import requests from urllib.parse import quote from functools import lru_cache @lru_cache(1024,str) def en2ta(text): """translate from English to Tamil""" return IITB_translator(...
Support rudimentary translation service from IIT Bombay via web API.
Support rudimentary translation service from IIT Bombay via web API. me: கவிதை மிக அழகாக இருக்கிறது it: கவிதை of the most beautiful me: good morning it: நல்ல காலை me: world is not flat it: உலக சமதளமான கிடைக்கிறது.
Python
mit
Ezhil-Language-Foundation/open-tamil,Ezhil-Language-Foundation/open-tamil,Ezhil-Language-Foundation/open-tamil,arcturusannamalai/open-tamil,arcturusannamalai/open-tamil,arcturusannamalai/open-tamil,arcturusannamalai/open-tamil,Ezhil-Language-Foundation/open-tamil,arcturusannamalai/open-tamil,arcturusannamalai/open-tami...
--- +++ @@ -0,0 +1,33 @@ +# * coding: utf8 * +# +# (C) 2020 Muthiah Annamalai <ezhillang@gmail.com> +# +# Uses the IIT-Bombay service on the web. +# + +import json +import requests +from urllib.parse import quote +from functools import lru_cache + + +@lru_cache(1024,str) +def en2ta(text): + """translate from Engl...
27ed68923579c5afff0c70b025deb8b73d448aa8
indicators/migrations/0013_set_all_calculation_type_to_numeric.py
indicators/migrations/0013_set_all_calculation_type_to_numeric.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2018-07-04 09:56 from __future__ import unicode_literals from django.db import migrations from ..models import Indicator def set_calculation_type(apps, schema_editor): Indicator.objects.all().update( calculation_type=Indicator.CALC_TYPE_NUMERIC) c...
Set calculation type of all indicators to Number
Set calculation type of all indicators to Number
Python
apache-2.0
toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity,toladata/TolaActivity
--- +++ @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.3 on 2018-07-04 09:56 +from __future__ import unicode_literals + +from django.db import migrations +from ..models import Indicator + + +def set_calculation_type(apps, schema_editor): + Indicator.objects.all().update( + calculation...
834516acf7b5cfbbb0f728f8b725bea120b5f5b3
post_receive.py
post_receive.py
import re import os import sys import os import json from subprocess import Popen, PIPE from httplib2 import Http postURL = "http://localhost:2069/json" pwd = os.getcwd() if len(sys.argv) <= 3: print("Usage: post-receive [old] [new] [ref]") exit() old, new, ref = sys.argv[1:4] m = re.match(r"^.*/([^/]+)$", p...
Add python version of the post-receive hook
Add python version of the post-receive hook
Python
apache-2.0
Humbedooh/gitpubsub
--- +++ @@ -0,0 +1,55 @@ +import re +import os +import sys +import os +import json +from subprocess import Popen, PIPE +from httplib2 import Http + +postURL = "http://localhost:2069/json" + +pwd = os.getcwd() +if len(sys.argv) <= 3: + print("Usage: post-receive [old] [new] [ref]") + exit() + +old, new, ref = sy...
c7c3ab0a4013df99b928351040f1156b07ba6767
tests/unit/utils/test_tokens.py
tests/unit/utils/test_tokens.py
from flask import current_app from itsdangerous import TimedJSONWebSignatureSerializer from flaskbb.utils.tokens import make_token, get_token_status def test_make_token(user): token = make_token(user, "test") s = TimedJSONWebSignatureSerializer(current_app.config['SECRET_KEY']) unpacked_token = s.loads(to...
Add some tests for the tokens
Add some tests for the tokens
Python
bsd-3-clause
realityone/flaskbb,realityone/flaskbb,realityone/flaskbb
--- +++ @@ -0,0 +1,55 @@ +from flask import current_app +from itsdangerous import TimedJSONWebSignatureSerializer +from flaskbb.utils.tokens import make_token, get_token_status + + +def test_make_token(user): + token = make_token(user, "test") + s = TimedJSONWebSignatureSerializer(current_app.config['SECRET_KEY...
0848197b3c9ff8d09575b85b5e3a2ca1aac6f6c5
app/drivers/pycolator/splitmerge.py
app/drivers/pycolator/splitmerge.py
from app.drivers.basedrivers import PycolatorDriver from app.preparation import pycolator as preparation from app.readers import pycolator as readers class SplitDriver(PycolatorDriver): def __init__(self, **kwargs): super(SplitDriver, self).__init__(**kwargs) self.targetsuffix = kwargs.get('target...
Put split and merge in own module too
Put split and merge in own module too
Python
mit
glormph/msstitch
--- +++ @@ -0,0 +1,55 @@ +from app.drivers.basedrivers import PycolatorDriver +from app.preparation import pycolator as preparation +from app.readers import pycolator as readers + + +class SplitDriver(PycolatorDriver): + def __init__(self, **kwargs): + super(SplitDriver, self).__init__(**kwargs) + se...
5dd9cc55368e9f5bd8c79f74f3c7c1fc84a6bd8b
common/migrations/0010_auto_20200529_0514.py
common/migrations/0010_auto_20200529_0514.py
# Generated by Django 2.2.12 on 2020-05-29 05:14 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('common', '0009_upload_hosting'), ] operations = [ migrations.AlterField( model_name='upload', name='destination', ...
Add common migration (unrelated to branch)
Add common migration (unrelated to branch)
Python
agpl-3.0
lutris/website,lutris/website,lutris/website,lutris/website
--- +++ @@ -0,0 +1,18 @@ +# Generated by Django 2.2.12 on 2020-05-29 05:14 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('common', '0009_upload_hosting'), + ] + + operations = [ + migrations.AlterField( + model_name='u...
fa0afad07f34f350233ae2a4f1654faef9bc1814
utils/benchmark/Strings/PySort.py
utils/benchmark/Strings/PySort.py
words=[ u"James", u"John", u"Robert", u"Michael", u"William", u"David", u"Richard", u"Joseph", u"Charles", u"Thomas", u"Christopher", u"Daniel", u"Matthew", u"Donald", u"Anthony", u"Paul", u"Mark", u"George", u"Steven", u"Kenneth", u"Andrew", u"Edward", u"Brian", u"Joshua", u"Kevin", u"Ronald", u"Timothy", u"Jason...
Add a python version for the phonebook benchmark
Add a python version for the phonebook benchmark Swift SVN r17601
Python
apache-2.0
SwiftAndroid/swift,ahoppen/swift,uasys/swift,karwa/swift,gottesmm/swift,ken0nek/swift,xwu/swift,huonw/swift,natecook1000/swift,jckarter/swift,ken0nek/swift,allevato/swift,hughbe/swift,tinysun212/swift-windows,gmilos/swift,MukeshKumarS/Swift,shahmishal/swift,sschiau/swift,austinzheng/swift,adrfer/swift,uasys/swift,shajr...
--- +++ @@ -0,0 +1,41 @@ + +words=[ + u"James", u"John", u"Robert", u"Michael", u"William", u"David", u"Richard", u"Joseph", + u"Charles", u"Thomas", u"Christopher", u"Daniel", u"Matthew", u"Donald", u"Anthony", + u"Paul", u"Mark", u"George", u"Steven", u"Kenneth", u"Andrew", u"Edward", u"Brian", + u"Joshua", u"Kevin...
2e9f43d1c1679355e2d7d452137ddf7fb2bbdedf
tests/async-send-get-test.py
tests/async-send-get-test.py
#!/usr/bin/env python """ Send a message and confirm you can retrieve it with Basic.Get Test Steps: 1) Connect to broker - start_test 2) Open Channel - on_connected 3) Delcare Queue - on_channel_open 4) Send test message - on_queue_declared 5) Call basic get - on_queue_declared 6) Validate t...
Test Basic.Publish -> Basic.Get message passing
Test Basic.Publish -> Basic.Get message passing
Python
bsd-3-clause
Zephor5/pika,vrtsystems/pika,renshawbay/pika-python3,jstnlef/pika,hugoxia/pika,vitaly-krugl/pika,skftn/pika,fkarb/pika-python3,reddec/pika,shinji-s/pika,benjamin9999/pika,pika/pika,zixiliuyue/pika,knowsis/pika,Tarsbot/pika
--- +++ @@ -0,0 +1,66 @@ +#!/usr/bin/env python +""" +Send a message and confirm you can retrieve it with Basic.Get +Test Steps: + +1) Connect to broker - start_test +2) Open Channel - on_connected +3) Delcare Queue - on_channel_open +4) Send test message - on_queue_declared +5) Call basic get ...
e7e51333133dd561e8a746144c29c6635d8a982a
migrations/versions/320f4eb0698b_add_proposal_image.py
migrations/versions/320f4eb0698b_add_proposal_image.py
"""add proposal image Revision ID: 320f4eb0698b Revises: 26ef95fc6f2c Create Date: 2015-03-31 15:55:20.062624 """ # revision identifiers, used by Alembic. revision = '320f4eb0698b' down_revision = '26ef95fc6f2c' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alemb...
Add migration to add column for proposal image filename
Add migration to add column for proposal image filename
Python
agpl-3.0
fairdemocracy/vilfredo-core
--- +++ @@ -0,0 +1,26 @@ +"""add proposal image + +Revision ID: 320f4eb0698b +Revises: 26ef95fc6f2c +Create Date: 2015-03-31 15:55:20.062624 + +""" + +# revision identifiers, used by Alembic. +revision = '320f4eb0698b' +down_revision = '26ef95fc6f2c' + +from alembic import op +import sqlalchemy as sa + + +def upgrade...
fcf0ed3c4e2deb9ce1d6a758dc18e6a03542eb59
candidates/management/commands/candidates_parties_with_multiple_emblems.py
candidates/management/commands/candidates_parties_with_multiple_emblems.py
from django.core.management.base import BaseCommand from candidates.popit import create_popit_api_object, popit_unwrap_pagination class Command(BaseCommand): def handle(self, *args, **options): api = create_popit_api_object() for org in popit_unwrap_pagination( api.organizations, ...
Add a script to find parties with multiple emblems (logos) from the EC
Add a script to find parties with multiple emblems (logos) from the EC This was useful at some point, apparently!
Python
agpl-3.0
mysociety/yournextmp-popit,mysociety/yournextmp-popit,DemocracyClub/yournextrepresentative,mysociety/yournextrepresentative,datamade/yournextmp-popit,neavouli/yournextrepresentative,YoQuieroSaber/yournextrepresentative,neavouli/yournextrepresentative,mysociety/yournextmp-popit,DemocracyClub/yournextrepresentative,YoQui...
--- +++ @@ -0,0 +1,24 @@ +from django.core.management.base import BaseCommand + +from candidates.popit import create_popit_api_object, popit_unwrap_pagination + +class Command(BaseCommand): + + def handle(self, *args, **options): + api = create_popit_api_object() + + for org in popit_unwrap_paginatio...
0f6e065a70bcd1f9dd64dfa04c13cb0065e33c13
src/autobot/src/navigator_test.py
src/autobot/src/navigator_test.py
#!/usr/bin/env python import unittest import mock from autobot.msg import detected_object from navigator import * def fake_stopCar(): return True def fake_srvTogglePathFinder(state): return def fake_setWallDist(dist, wall): return class NavigatorTest(unittest.TestCase): @mock.patch('navigator.se...
Add basic test for navigator
Add basic test for navigator
Python
mit
atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot
--- +++ @@ -0,0 +1,37 @@ +#!/usr/bin/env python +import unittest +import mock +from autobot.msg import detected_object +from navigator import * + + +def fake_stopCar(): + return True + + +def fake_srvTogglePathFinder(state): + return + + +def fake_setWallDist(dist, wall): + return + + +class NavigatorTest(un...
a5012c9fb81768e85b555b52264baa11efc17ba1
test/test_select_taxa.py
test/test_select_taxa.py
import logging import os import tempfile import unittest import select_taxa class Test(unittest.TestCase): def setUp(self): self.longMessage = True logging.root.setLevel(logging.DEBUG) def test_main(self): ''' Select a single genome and assert the download log file contains ...
Add unittest for select_taxa that runs main and selects a single genome
Add unittest for select_taxa that runs main and selects a single genome
Python
mit
ODoSE/odose.nl
--- +++ @@ -0,0 +1,32 @@ +import logging +import os +import tempfile +import unittest + +import select_taxa + + +class Test(unittest.TestCase): + + def setUp(self): + self.longMessage = True + logging.root.setLevel(logging.DEBUG) + + def test_main(self): + ''' + Select a single genom...
5692f64619bf009cf92bf0a8c6f77bf82f0e3d02
tests/test_regression.py
tests/test_regression.py
# Copyright: See the LICENSE file. """Regression tests related to issues found with the project""" import datetime import typing as T import unittest import factory # Example objects # =============== class Author(T.NamedTuple): fullname: str pseudonym: T.Optional[str] = None class Book(T.NamedTuple): ...
Add a new regression testing module
Add a new regression testing module That module should hold all tests used when reproducing (and fixing) an issue.
Python
mit
FactoryBoy/factory_boy
--- +++ @@ -0,0 +1,53 @@ +# Copyright: See the LICENSE file. + + +"""Regression tests related to issues found with the project""" + +import datetime +import typing as T +import unittest + +import factory + +# Example objects +# =============== + + +class Author(T.NamedTuple): + fullname: str + pseudonym: T.Opti...
122eb3c6eb9f8467fc5d3325f0e5c58cc285cb50
token-hexkey.py
token-hexkey.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License...
Add a script to convert hex formatted key to token using random partitioner
Add a script to convert hex formatted key to token using random partitioner
Python
apache-2.0
bharatendra/ctools
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file ...
81f983c833d9858ad23f589367bf601babddf858
elements/activation_functions.py
elements/activation_functions.py
import theano import theano.tensor as T """ A set of activation functions for Neural Network layers. They're in the form of class so we can take advantage of constructor to set initial value for some parameters. """ def tanh(x): """ tanh function (-1 to 1) @input: x, theano shared variable. @output: element-wise...
Add some useful activation functions.
Add some useful activation functions.
Python
mit
mmohaveri/DeepNetTookKit
--- +++ @@ -0,0 +1,64 @@ +import theano +import theano.tensor as T + +""" +A set of activation functions for Neural Network layers. +They're in the form of class so we can take advantage of constructor +to set initial value for some parameters. +""" + +def tanh(x): + """ + tanh function (-1 to 1) + + @input: x, thean...
dbc20f37c7fb1dd00c90ac54d2021fb1ba3b5eda
exam.py
exam.py
import time import sys from groupy.client import Client def read_token_from_file(filename): with open(filename) as f: return f.read().strip() def test_groups(groups): for group in groups: print(group) print('Members:') for member in group.members[:5]: print(memb...
Add some end-to-end functional tests
Add some end-to-end functional tests Since running these tests is not part of the automated tests, and since the test runner picks up any file that has a name containing "test" I have to be clever and call it "exam.py."
Python
apache-2.0
rhgrant10/Groupy
--- +++ @@ -0,0 +1,102 @@ +import time +import sys + +from groupy.client import Client + + +def read_token_from_file(filename): + with open(filename) as f: + return f.read().strip() + + +def test_groups(groups): + for group in groups: + print(group) + + print('Members:') + for member...
64139e0a41c1b1da81e9b5e244b2d7095c4a7a2b
core/management/commands/delete_old_sessions.py
core/management/commands/delete_old_sessions.py
from datetime import datetime from django.core.management.base import BaseCommand from django.contrib.sessions.models import Session """ >>> def clean(count): ... for idx, s in enumerate(Session.objects.filter(expire_date__lt=now)[:count+1]): ... s.delete() ... if str(idx).endswith('000'): print idx ... p...
Add delete old sessions command
Add delete old sessions command
Python
mit
nanuxbe/djangopackages,QLGu/djangopackages,nanuxbe/djangopackages,QLGu/djangopackages,pydanny/djangopackages,QLGu/djangopackages,pydanny/djangopackages,pydanny/djangopackages,nanuxbe/djangopackages
--- +++ @@ -0,0 +1,34 @@ +from datetime import datetime + +from django.core.management.base import BaseCommand +from django.contrib.sessions.models import Session + +""" +>>> def clean(count): +... for idx, s in enumerate(Session.objects.filter(expire_date__lt=now)[:count+1]): +... s.delete() +... if str(id...
05bf0cd188d4666c9c0aeb56a95d7867f25952c2
demo_dqn_continuous.py
demo_dqn_continuous.py
import argparse import chainer from chainer import serializers import gym import numpy as np import random_seed import env_modifiers import q_function def eval_single_run(env, model, phi): test_r = 0 obs = env.reset() done = False while not done: s = chainer.Variable(np.expand_dims(phi(obs),...
Add a script for dqn continuous task demo
Add a script for dqn continuous task demo
Python
mit
toslunar/chainerrl,toslunar/chainerrl
--- +++ @@ -0,0 +1,68 @@ +import argparse + +import chainer +from chainer import serializers +import gym +import numpy as np + +import random_seed +import env_modifiers +import q_function + + +def eval_single_run(env, model, phi): + test_r = 0 + obs = env.reset() + done = False + while not done: + ...
c39b95eebb402d1d0137448b3f0efd9b6d7ec169
tests/managers/test_repository.py
tests/managers/test_repository.py
from unittest import TestCase from mock import MagicMock, patch from nose.tools import eq_ from pyolite.managers.repository import RepositoryManager class TestRepositoryManager(TestCase): def test_get_repository(self): mocked_repository = MagicMock() mocked_repository.get_by_name.return_value = 'my_repo' ...
Test if repository manager if retrieving a repository when we lookup after one
Test if repository manager if retrieving a repository when we lookup after one
Python
bsd-2-clause
shawkinsl/pyolite,PressLabs/pyolite
--- +++ @@ -0,0 +1,28 @@ +from unittest import TestCase + +from mock import MagicMock, patch +from nose.tools import eq_ + +from pyolite.managers.repository import RepositoryManager + + +class TestRepositoryManager(TestCase): + def test_get_repository(self): + mocked_repository = MagicMock() + mocked_repositor...
9ad755263fe12fa16c0b27381893c380626c85d8
bindings/pyroot/test/conversions.py
bindings/pyroot/test/conversions.py
import unittest import ROOT cppcode = """ void stringViewConv(std::string_view) {}; """ class ListInitialization(unittest.TestCase): @classmethod def setUpClass(cls): ROOT.gInterpreter.Declare(cppcode) def test_string_view_conv(self): ROOT.stringViewConv("pyString") if __name__ == '__mai...
Add unittest for string_view conversion
[PyROOT] Add unittest for string_view conversion
Python
lgpl-2.1
olifre/root,olifre/root,karies/root,olifre/root,zzxuanyuan/root,karies/root,olifre/root,root-mirror/root,karies/root,zzxuanyuan/root,olifre/root,root-mirror/root,zzxuanyuan/root,karies/root,karies/root,root-mirror/root,root-mirror/root,zzxuanyuan/root,karies/root,olifre/root,root-mirror/root,zzxuanyuan/root,root-mirror...
--- +++ @@ -0,0 +1,17 @@ +import unittest +import ROOT + +cppcode = """ +void stringViewConv(std::string_view) {}; +""" + +class ListInitialization(unittest.TestCase): + @classmethod + def setUpClass(cls): + ROOT.gInterpreter.Declare(cppcode) + + def test_string_view_conv(self): + ROOT.stringVi...
9eb5f67a954888c4e14789b5b8acc785c789a77c
oidc_provider/management/commands/creatersakey.py
oidc_provider/management/commands/creatersakey.py
from Crypto.PublicKey import RSA from django.conf import settings from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): help = 'Randomly generate a new RSA key for the OpenID server' def handle(self, *args, **options): try: key = RSA.generate(1024)...
Add a command for creating rsa key.
Add a command for creating rsa key.
Python
mit
juanifioren/django-oidc-provider,wojtek-fliposports/django-oidc-provider,nmohoric/django-oidc-provider,nmohoric/django-oidc-provider,ByteInternet/django-oidc-provider,juanifioren/django-oidc-provider,wojtek-fliposports/django-oidc-provider,bunnyinc/django-oidc-provider,bunnyinc/django-oidc-provider,wayward710/django-oi...
--- +++ @@ -0,0 +1,18 @@ +from Crypto.PublicKey import RSA + +from django.conf import settings +from django.core.management.base import BaseCommand, CommandError + + +class Command(BaseCommand): + help = 'Randomly generate a new RSA key for the OpenID server' + + def handle(self, *args, **options): + try...
38bfc1a536f43ece367a49a62501b57c89f689a1
django-server/feel/core/db/reset.py
django-server/feel/core/db/reset.py
from django.db.models.base import ModelBase from quiz.models import Quiz, ShortAnswer, Choice, QuizAttempt from codequiz.models import CodeQuiz, CodeQuizAttempt from concept.models import Concept, ConceptSection from course.models import Course, CourseSlug, CourseConcept, ConceptDependency def reset(): for key,...
Add script to delete tables.
Data: Add script to delete tables.
Python
mit
pixyj/feel,pixyj/feel,pixyj/feel,pixyj/feel,pixyj/feel
--- +++ @@ -0,0 +1,17 @@ +from django.db.models.base import ModelBase + +from quiz.models import Quiz, ShortAnswer, Choice, QuizAttempt +from codequiz.models import CodeQuiz, CodeQuizAttempt + +from concept.models import Concept, ConceptSection +from course.models import Course, CourseSlug, CourseConcept, ConceptDepe...
9386236d41298ed8888a6774f40a15d44b7e53fe
data_log/management/commands/generate_report_fixture.py
data_log/management/commands/generate_report_fixture.py
from django.core.management.base import BaseCommand from django.core import serializers from data_log import models import json class Command(BaseCommand): help = 'Create Data Log Report fixtures' def handle(self, *args, **kwargs): self.stdout.write('Creating fixtures for Data Log Reports...') ...
Create command for Data Log Report fixtures
Create command for Data Log Report fixtures
Python
apache-2.0
porksmash/swarfarm,porksmash/swarfarm,porksmash/swarfarm,porksmash/swarfarm
--- +++ @@ -0,0 +1,33 @@ +from django.core.management.base import BaseCommand +from django.core import serializers + +from data_log import models +import json + + +class Command(BaseCommand): + help = 'Create Data Log Report fixtures' + + def handle(self, *args, **kwargs): + self.stdout.write('Creating f...
496754c54005cf7e1b49ada8e612207f5e2846ff
python/example_code/sqs/dead_letter_queue.py
python/example_code/sqs/dead_letter_queue.py
# Copyright 2010-2016 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 dead letter SQS queue example
Add dead letter SQS queue example
Python
apache-2.0
awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,imshashank/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,imshashank/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,imshashank/aws-doc-sdk-examples,imshashank/aws-doc-sdk-examples,imshashank/aws-doc-sdk-examples,awsdocs/aws-doc...
--- +++ @@ -0,0 +1,37 @@ +# Copyright 2010-2016 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....
1718926c99692fefb90627c55589990cd0e0225b
wagtail/project_template/home/migrations/0002_create_homepage.py
wagtail/project_template/home/migrations/0002_create_homepage.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def create_homepage(apps, schema_editor): # Get models ContentType = apps.get_model('contenttypes.ContentType') Page = apps.get_model('wagtailcore.Page') Site = apps.get_model('wagtailcore.Site') Home...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def create_homepage(apps, schema_editor): # Get models ContentType = apps.get_model('contenttypes.ContentType') Page = apps.get_model('wagtailcore.Page') Site = apps.get_model('wagtailcore.Site') Home...
Make migrations in project_template home app reversible
Make migrations in project_template home app reversible
Python
bsd-3-clause
rsalmaso/wagtail,FlipperPA/wagtail,chrxr/wagtail,nutztherookie/wagtail,mikedingjan/wagtail,nimasmi/wagtail,rsalmaso/wagtail,Toshakins/wagtail,mikedingjan/wagtail,thenewguy/wagtail,mikedingjan/wagtail,iansprice/wagtail,nilnvoid/wagtail,nimasmi/wagtail,mikedingjan/wagtail,nutztherookie/wagtail,zerolab/wagtail,FlipperPA/w...
--- +++ @@ -12,10 +12,11 @@ HomePage = apps.get_model('home.HomePage') # Delete the default homepage - Page.objects.get(id=2).delete() + # If migration is run multiple times, it may have already been deleted + Page.objects.filter(id=2).delete() # Create content type for homepage model - ...
631faacaf077c2b4d0d446e42076fd4e4f27ed37
djlotrek/tests/test_templatetags.py
djlotrek/tests/test_templatetags.py
import os import mock from django.test import TestCase from djlotrek.templatetags.djlotrek_tags import absolute_url from django.test import RequestFactory class TemplateTagsTestCase(TestCase): def setUp(self): pass def test_absolute_url(self): """Our beloved get_host_url utility""" ...
Add tests for template tags
Add tests for template tags
Python
mit
lotrekagency/djlotrek,lotrekagency/djlotrek
--- +++ @@ -0,0 +1,46 @@ +import os +import mock + +from django.test import TestCase + +from djlotrek.templatetags.djlotrek_tags import absolute_url + +from django.test import RequestFactory + + +class TemplateTagsTestCase(TestCase): + + def setUp(self): + pass + + def test_absolute_url(self): + "...
f2028ab194fe7c1c1497ee9320ddddbbece6406a
nova/common/eventlet_backdoor.py
nova/common/eventlet_backdoor.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2012 Openstack, LLC. # Administrator of the National Aeronautics and Space Administration. # 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 ...
Add eventlet backdoor to facilitate troubleshooting.
Add eventlet backdoor to facilitate troubleshooting. This provides a FLAG to turn on Eventlet's builtin backdoor server which allows you to connect over telnet and receive a Python prompt (which is immensely helpful for debugging running systems). Fixes bug 1000366 Change-Id: I779247a0796d34ba2a5478436d85b30ba76c4a0...
Python
apache-2.0
n0ano/ganttclient
--- +++ @@ -0,0 +1,69 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright (c) 2012 Openstack, LLC. +# Administrator of the National Aeronautics and Space Administration. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except i...
d81ba7d656f11e817eb610b1c65a4880fddc9004
saylua/modules/arcade/api.py
saylua/modules/arcade/api.py
from saylua.wrappers import api_login_required from flask import g, request from models.db import Game, GameLog from saylua.utils import int_or_none import json # Send a score to the API. @api_login_required() def api_send_score(game_id): try: gameName = Game(game_id) except IndexError: retu...
from saylua import db from saylua.wrappers import api_login_required from flask import g, request from models.db import Game, GameLog from saylua.utils import int_or_none import json # Send a score to the API. @api_login_required() def api_send_score(game_id): try: gameName = Game(game_id) except I...
Fix getting money from arcade games.
Fix getting money from arcade games.
Python
agpl-3.0
saylua/SayluaV2,saylua/SayluaV2,LikeMyBread/Saylua,saylua/SayluaV2,LikeMyBread/Saylua,LikeMyBread/Saylua,LikeMyBread/Saylua
--- +++ @@ -1,3 +1,5 @@ +from saylua import db + from saylua.wrappers import api_login_required from flask import g, request from models.db import Game, GameLog @@ -22,5 +24,6 @@ score = int_or_none(data.get('score')) or 0 GameLog.record_score(g.user.id, game_id, score) g.use...
61e56ad3feecef6fe422db8fb5d7b9b26dc03d6a
day3-2.py
day3-2.py
"""This module checks how many valid triangles are in the input data.""" def main(): """Run main function.""" with open('data/day3data.txt', 'r') as f: input = f.readlines() dataList = [map(int, i.strip('\n').split()) for i in input] # Transpose the data. dataList = [list(i) for i in zip...
Add day 3 part 2.
Add day 3 part 2.
Python
mit
SayWhat1/adventofcode2016
--- +++ @@ -0,0 +1,34 @@ +"""This module checks how many valid triangles are in the input data.""" + + +def main(): + """Run main function.""" + with open('data/day3data.txt', 'r') as f: + input = f.readlines() + + dataList = [map(int, i.strip('\n').split()) for i in input] + + # Transpose the data...
a07e4d08b475e0d921265f9da104f109943901bc
simlammps/tests/cuds_test.py
simlammps/tests/cuds_test.py
"""Tests for running lammps using CUDS and Simulation classes.""" import unittest from simphony.core.cuba import CUBA from simphony import CUDS, Simulation from simphony.engine import EngineInterface from simphony.testing.utils import create_particles_with_id from simphony.cuds.particles import Particle, Particles c...
Add lammps wrapper tests with cuds
Add lammps wrapper tests with cuds
Python
bsd-2-clause
simphony/simphony-lammps-md,simphony/simphony-lammps-md
--- +++ @@ -0,0 +1,51 @@ +"""Tests for running lammps using CUDS and Simulation classes.""" +import unittest + +from simphony.core.cuba import CUBA +from simphony import CUDS, Simulation +from simphony.engine import EngineInterface +from simphony.testing.utils import create_particles_with_id +from simphony.cuds.parti...