commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
e924f67b37c1a7612e520cca9715152029ddf338
test/integration/ggrc/services/test_query_snapshots.py
test/integration/ggrc/services/test_query_snapshots.py
# coding: utf-8 # Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Tests for /query api endpoint.""" from datetime import datetime from operator import itemgetter from flask import json from nose.plugins.skip import SkipTest from ggrc import db from gg...
# coding: utf-8 # Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Tests for /query api endpoint.""" from ggrc import views from ggrc import models from integration.ggrc.converters import TestCase from integration.ggrc.models import factories class ...
Update snapshot query test generation
Update snapshot query test generation
Python
apache-2.0
selahssea/ggrc-core,plamut/ggrc-core,andrei-karalionak/ggrc-core,VinnieJohns/ggrc-core,josthkko/ggrc-core,AleksNeStu/ggrc-core,j0gurt/ggrc-core,j0gurt/ggrc-core,j0gurt/ggrc-core,andrei-karalionak/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,josthkko/ggrc-core,AleksNeStu/ggrc-core,josthkko/g...
aaa3f6b8154f03eab16528c05d889c6160e63f22
server/siege/views/devices.py
server/siege/views/devices.py
from flask import request from flask import url_for from flask import abort from siege.service import app, db from siege.models import Device from view_utils import jsonate @app.route('/devices') def devices_index(): response = jsonate([d.to_dict() for d in Device.query.all()]) return response @app.route('...
from flask import request from flask import url_for from flask import abort from siege.service import app, db from siege.models import Device from view_utils import jsonate @app.route('/devices') def devices_index(): response = jsonate([d.to_dict() for d in Device.query.all()]) return response @app.route('...
Put the user agent in the device object
Put the user agent in the device object
Python
bsd-2-clause
WalterCReel3/siege,WalterCReel3/siege,WalterCReel3/siege,WalterCReel3/siege
95d0461cf2f06534f81a954b1f95658cbb019ec6
tests/startsymbol_tests/NonterminalNotInGrammarTest.py
tests/startsymbol_tests/NonterminalNotInGrammarTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 10.08.2017 23:20 :Licence GNUv3 Part of grammpy """ from unittest import TestCase, main from grammpy import * from grammpy.exceptions import NonterminalDoesNotExistsException class NonterminalNotInGrammarTest(TestCase): pass if __name__ == '__main__':...
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 10.08.2017 23:20 :Licence GNUv3 Part of grammpy """ from unittest import TestCase, main from grammpy import * from grammpy.exceptions import NonterminalDoesNotExistsException class A(Nonterminal): pass class B(Nonterminal): pass class Nontermina...
Add tests of setting nonterminal, which is not in grammar, as start symbol
Add tests of setting nonterminal, which is not in grammar, as start symbol
Python
mit
PatrikValkovic/grammpy
7e88a5d648d8e9aec82be14cd55667136adb3754
pytest-{{cookiecutter.plugin_name}}/test_{{cookiecutter.plugin_name}}.py
pytest-{{cookiecutter.plugin_name}}/test_{{cookiecutter.plugin_name}}.py
# -*- coding: utf-8 -*- def test_bar_fixture(testdir): testdir.tmpdir.join('test_foo.py').write(''' def test_a(bar): assert bar == "something" ''' result = testdir.runpytest('--foo=something') def test_foo_option(): pass
# -*- coding: utf-8 -*- def test_bar_fixture(testdir): """Make sure that pytest accepts our fixture.""" # create a temporary pytest test module testdir.makepyfile(""" def test_sth(bar): assert bar == "europython2015" """) # run pytest with the following cmd args result = t...
Implement test for help and cli args
Implement test for help and cli args
Python
mit
luzfcb/cookiecutter-pytest-plugin,pytest-dev/cookiecutter-pytest-plugin,s0undt3ch/cookiecutter-pytest-plugin
9dad4033e4a66208ca00bcb0340f6a2271f1090f
montage_wrapper/mpi.py
montage_wrapper/mpi.py
MPI_COMMAND = 'mpirun -n {n_proc} {executable}' def set_mpi_command(command): """ Set the MPI Command to use. This should contain {n_proc} to indicate the number of processes, and {executable} to indicate the name of the executable. Parameters ---------- command: str The M...
MPI_COMMAND = 'mpirun -n {n_proc} {executable}' def set_mpi_command(command): """ Set the MPI Command to use. This should contain {n_proc} to indicate the number of processes, and {executable} to indicate the name of the executable. Parameters ---------- command: str The M...
Fix setting of custom MPI command
Fix setting of custom MPI command
Python
bsd-3-clause
vterron/montage-wrapper,astrofrog/montage-wrapper,astropy/montage-wrapper,astrofrog/montage-wrapper,jat255/montage-wrapper
a09689c570e70c80ad7cadd9702133b3851c63b9
providers/provider.py
providers/provider.py
import json import requests from requests.utils import get_unicode_from_response from lxml import html as lxml_html class BaseProvider(object): # ==== HELPER METHODS ==== def parse_html(self, url, css_selector): html = self._http_get(url) document = lxml_html.document_fromstring(html) r...
import json import requests from requests.utils import get_unicode_from_response from lxml import html as lxml_html class BaseProvider(object): # ==== HELPER METHODS ==== def parse_html(self, url, css_selector, timeout=60): html = self._http_get(url, timeout=timeout) document = lxml_html.docume...
Increase timeout to 60 sec and make available to external callers.
Increase timeout to 60 sec and make available to external callers.
Python
mit
EmilStenstrom/nephele
a229e1737542a5011e70c3fa63c360638e96e754
lettuce_webdriver/css_selector_steps.py
lettuce_webdriver/css_selector_steps.py
from lettuce import step from lettuce import world from lettuce_webdriver.util import assert_true from lettuce_webdriver.util import assert_false import logging log = logging.getLogger(__name__) def wait_for_elem(browser, xpath, timeout=15): start = time.time() elems = [] while time.time() - start < time...
import time from lettuce import step from lettuce import world from lettuce_webdriver.util import assert_true from lettuce_webdriver.util import assert_false import logging log = logging.getLogger(__name__) def wait_for_elem(browser, sel, timeout=15): start = time.time() elems = [] while time.time() - s...
Make the step actually do something.
Make the step actually do something.
Python
mit
koterpillar/aloe_webdriver,aloetesting/aloe_webdriver,macndesign/lettuce_webdriver,ponsfrilus/lettuce_webdriver,aloetesting/aloe_webdriver,macndesign/lettuce_webdriver,infoxchange/aloe_webdriver,bbangert/lettuce_webdriver,aloetesting/aloe_webdriver,koterpillar/aloe_webdriver,infoxchange/lettuce_webdriver,infoxchange/al...
6926ddbb9cdbf05808339412cee5106e581f66cb
tests/import_wordpress_and_build_workflow.py
tests/import_wordpress_and_build_workflow.py
# -*- coding: utf-8 -*- """ Script to test the import workflow. It will remove an existing Nikola installation and then install from the package directory. After that it will do create a new site with the import_wordpress command and use that newly created site to make a build. """ from __future__ import unicode_liter...
# -*- coding: utf-8 -*- """ Script to test the import workflow. It will remove an existing Nikola installation and then install from the package directory. After that it will do create a new site with the import_wordpress command and use that newly created site to make a build. """ from __future__ import unicode_liter...
Use the more or less new options for importing
Use the more or less new options for importing
Python
mit
damianavila/nikola,xuhdev/nikola,getnikola/nikola,berezovskyi/nikola,TyberiusPrime/nikola,kotnik/nikola,atiro/nikola,servalproject/nikola,gwax/nikola,schettino72/nikola,kotnik/nikola,lucacerone/nikola,okin/nikola,s2hc-johan/nikola,andredias/nikola,masayuko/nikola,x1101/nikola,s2hc-johan/nikola,Proteus-tech/nikola,techd...
48394c55599968c456f1f58c0fcdf58e1750f293
amplpy/tests/TestBase.py
amplpy/tests/TestBase.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, absolute_import, division from builtins import map, range, object, zip, sorted from .context import amplpy import unittest import tempfile import shutil import os class TestBase(unittest.TestCase): def setUp(self): self....
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, absolute_import, division from builtins import map, range, object, zip, sorted from .context import amplpy import unittest import tempfile import shutil import os # For MSYS2, MINGW, etc., run with: # $ REAL_ROOT=`cygpath -w /` pyth...
Add workaround for tests on MSYS2 and MINGW
Add workaround for tests on MSYS2 and MINGW
Python
bsd-3-clause
ampl/amplpy,ampl/amplpy,ampl/amplpy
43afda1fa0ae2d0011d6b87b5c05e3eb1fe13a21
viewer_examples/viewers/collection_viewer.py
viewer_examples/viewers/collection_viewer.py
""" ===================== CollectionViewer demo ===================== Demo of CollectionViewer for viewing collections of images. This demo uses successively darker versions of the same image to fake an image collection. You can scroll through images with the slider, or you can interact with the viewer using your key...
""" ===================== CollectionViewer demo ===================== Demo of CollectionViewer for viewing collections of images. This demo uses successively darker versions of the same image to fake an image collection. You can scroll through images with the slider, or you can interact with the viewer using your key...
Use gaussian pyramid function for collection viewer example
Use gaussian pyramid function for collection viewer example
Python
bsd-3-clause
rjeli/scikit-image,juliusbierk/scikit-image,vighneshbirodkar/scikit-image,Midafi/scikit-image,newville/scikit-image,SamHames/scikit-image,bennlich/scikit-image,vighneshbirodkar/scikit-image,ofgulban/scikit-image,blink1073/scikit-image,GaZ3ll3/scikit-image,keflavich/scikit-image,michaelpacer/scikit-image,chintak/scikit-...
710c77b2805058364e326d26c9e0c7cfcfed6453
repugeng/Compat3k.py
repugeng/Compat3k.py
from repugeng.StaticClass import StaticClass import sys class Compat3k(StaticClass): @classmethod def str_to_bytes(cls, s): """Convert a string of either width to a byte string.""" try: try: return bytes(s) except NameError: ret...
from repugeng.StaticClass import StaticClass import sys class Compat3k(StaticClass): @classmethod def str_to_bytes(cls, s): """Convert a string of either width to a byte string.""" try: try: return bytes(s) except NameError: ret...
Fix yet another 3k issue (stderr not flushing automatically).
Fix yet another 3k issue (stderr not flushing automatically). Signed-off-by: Thomas Hori <7133b3a0da8e60bd3295f2c8559ef184054a68ed@liddicott.com>
Python
mpl-2.0
thomas-hori/Repuge-NG
c0ff6cbf293bca3f0757a62e05a14c56dbdf12a4
installscripts/jazz-terraform-unix-noinstances/scripts/health_check.py
installscripts/jazz-terraform-unix-noinstances/scripts/health_check.py
import boto3 import sys import time def health_check_tg(client, tg_arn, max_tries): if max_tries == 1: return False else: max_tries -= 1 try: response = client.describe_target_health(TargetGroupArn=str(tg_arn)) if response['TargetHealthDescriptio...
import boto3 import sys import time def health_check_tg(client, tg_arn, max_tries): if max_tries == 1: return False else: max_tries -= 1 try: response = client.describe_target_health(TargetGroupArn=str(tg_arn)) if response['TargetHealthDescriptions'][0]['TargetHealth']['Sta...
Fix travis issue for v1.13.1 release
Fix travis issue for v1.13.1 release
Python
apache-2.0
tmobile/jazz-installer,tmobile/jazz-installer,tmobile/jazz-installer,tmobile/jazz-installer
8ad795f86e16209007537cbf47a3466733653e2d
snippets/__main__.py
snippets/__main__.py
import argparse import sys from .generator import Generator from .repository import Repository def run(args=sys.argv[1:]): parser = argparse.ArgumentParser() parser.add_argument('-s', '--source', default='snippets') parser.add_argument('-o', '--output', default='output') parser.add_argument('-t', '--...
import argparse import sys from .generator import Generator from .repository import Repository def run(args=sys.argv[1:]): parser = argparse.ArgumentParser() parser.add_argument('-r', '--repository', default='snippets') parser.add_argument('-o', '--output', default='output') parser.add_argument('-t',...
Fix cli argument name for repository path
Fix cli argument name for repository path
Python
isc
trilan/snippets,trilan/snippets
cd38101f097edc60312f0c083385968ed40fd54a
src/control.py
src/control.py
#!/usr/bin/env python import rospy from gazebo_msgs.msg import ModelStates from geometry_msgs.msg import Twist from constants import DELTA_T, STEPS from controller import create_controller from plotter import Plotter def get_pose(message): global current_pose current_pose = message.pose[2] def compute_cont...
#!/usr/bin/env python import rospy from gazebo_msgs.msg import ModelStates from geometry_msgs.msg import Twist from constants import DELTA_T, STEPS from controller import create_controller from plotter import Plotter def get_pose(message): global current_pose, current_twist current_pose = message.pose[2] ...
Store current twist in a global variable
Store current twist in a global variable
Python
mit
bit0001/trajectory_tracking,bit0001/trajectory_tracking
7d03a6bfa32d2bf20a95769b2937e098972285af
src/scs_mfr/test/opc_test.py
src/scs_mfr/test/opc_test.py
""" Created on 18 May 2017 @author: Bruno Beloff (bruno.beloff@southcoastscience.com) """ import sys from scs_dfe.particulate.opc_n2 import OPCN2 from scs_host.bus.i2c import I2C from scs_host.sys.host import Host from scs_mfr.test.test import Test # --------------------------------------------------------------...
""" Created on 18 May 2017 @author: Bruno Beloff (bruno.beloff@southcoastscience.com) """ import sys from scs_dfe.particulate.opc_n2 import OPCN2 from scs_host.bus.i2c import I2C from scs_host.sys.host import Host from scs_mfr.test.test import Test # --------------------------------------------------------------...
Put SPI slave configurations on Host.
Put SPI slave configurations on Host.
Python
mit
south-coast-science/scs_mfr,south-coast-science/scs_mfr
6b819174557a1dffbcb397dc1d6e2a3f7e01a12b
milestones/migrations/0002_data__seed_relationship_types.py
milestones/migrations/0002_data__seed_relationship_types.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from milestones.data import fetch_milestone_relationship_types def seed_relationship_types(apps, schema_editor): """Seed the relationship types.""" MilestoneRelationshipType = apps.get_model("milestones"...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from milestones.data import fetch_milestone_relationship_types def seed_relationship_types(apps, schema_editor): """Seed the relationship types.""" MilestoneRelationshipType = apps.get_model("milestones"...
Remove uses of using() from migrations
Remove uses of using() from migrations This hardcoded the db_alias fetched from schema_editor and forces django to try and migrate any second database you use, rather than routing to the default database. In testing a build from scratch, these do not appear needed. Using using() prevents us from using multiple datab...
Python
agpl-3.0
edx/edx-milestones
6bdb91aefc6acb9b0065c7edae19887778dedb22
.ci/package-version.py
.ci/package-version.py
#!/usr/bin/env python3 import os.path import sys def main(): setup_py = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'setup.py') with open(setup_py, 'r') as f: for line in f: if line.startswith('VERSION ='): _, _, version = line.pa...
#!/usr/bin/env python3 import os.path import sys def main(): version_file = os.path.join( os.path.dirname(os.path.dirname(__file__)), 'uvloop', '__init__.py') with open(version_file, 'r') as f: for line in f: if line.startswith('__version__ ='): _, _, version = l...
Fix ci / package_version.py script to support __version__
Fix ci / package_version.py script to support __version__
Python
apache-2.0
1st1/uvloop,MagicStack/uvloop,MagicStack/uvloop
261cb5aecc52d07b10d826e8b22d17817d1c3529
web/backend/backend_django/apps/capacity/management/commands/importpath.py
web/backend/backend_django/apps/capacity/management/commands/importpath.py
from __future__ import unicode_literals from optparse import make_option import os from csv import reader from codecs import BOM_UTF8 import pickle from django.utils.six import string_types, PY3 from django.core.management.base import BaseCommand, CommandError from ...models import Path class Command(BaseCommand): ...
from __future__ import unicode_literals from optparse import make_option import os from csv import reader from codecs import BOM_UTF8 import pickle from django.utils.six import string_types, PY3 from django.core.management.base import BaseCommand, CommandError from ...models import Path class Command(BaseCommand): ...
Update import path method to reflect behaviour
Update import path method to reflect behaviour
Python
apache-2.0
tOverney/ADA-Project,tOverney/ADA-Project,tOverney/ADA-Project
24d7f9f05e4d597358b62a50d2d0f5fad6a61c63
package_name/__meta__.py
package_name/__meta__.py
name = "package-name" # See https://www.python.org/dev/peps/pep-0008/ path = name.lower().replace("-", "_").replace(" ", "_") version = "0.1.dev0" # https://python.org/dev/peps/pep-0440 https://semver.org author = "Author Name" author_email = "" description = "" # One-liner url = "" # your project homepage license ...
# `name` is the name of the package as used for `pip install package` name = "package-name" # `path` is the name of the package for `import package` path = name.lower().replace("-", "_").replace(" ", "_") # Your version number should follow https://python.org/dev/peps/pep-0440 and # https://semver.org version = "0.1.de...
Clarify comments on what name and path are
DOC: Clarify comments on what name and path are
Python
mit
scottclowe/python-continuous-integration,scottclowe/python-ci,scottclowe/python-ci,scottclowe/python-continuous-integration
1869b79d49419799cecf1f5e19eb0aa3987e215b
tests/test_vector2_scalar_multiplication.py
tests/test_vector2_scalar_multiplication.py
import pytest # type: ignore from ppb_vector import Vector2 @pytest.mark.parametrize("x, y, expected", [ (Vector2(6, 1), 0, Vector2(0, 0)), (Vector2(6, 1), 2, Vector2(12, 2)), (Vector2(0, 0), 3, Vector2(0, 0)), (Vector2(-1.5, 2.4), -2, Vector2(3.0, -4.8)), (Vector2(1, 2), 0.1, Vector2(0.1, 0.2)) ...
import pytest # type: ignore from hypothesis import given from hypothesis.strategies import floats from utils import vectors from ppb_vector import Vector2 @pytest.mark.parametrize("x, y, expected", [ (Vector2(6, 1), 0, Vector2(0, 0)), (Vector2(6, 1), 2, Vector2(12, 2)), (Vector2(0, 0), 3, Vector2(0, 0))...
Add a test of the associativity of scalar multiplication
Add a test of the associativity of scalar multiplication
Python
artistic-2.0
ppb/ppb-vector,ppb/ppb-vector
6b14c9e5683d41ca9d8b9138c25af7526c83d1e4
test/integration/ggrc/converters/test_import_delete.py
test/integration/ggrc/converters/test_import_delete.py
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> from ggrc.converters import errors from integration.ggrc import TestCase class TestBasicCsvImport(TestCase): def setUp(self): TestCase.setUp(self) self.client.get("/login") def test_policy_ba...
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> from integration.ggrc import TestCase class TestBasicCsvImport(TestCase): def setUp(self): TestCase.setUp(self) self.client.get("/login") def test_policy_basic_import(self): filename = "c...
Optimize basic delete import tests
Optimize basic delete import tests The dry-run check is now automatically performed on each import and we do not need to duplicate the work in the delete test.
Python
apache-2.0
selahssea/ggrc-core,selahssea/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core
e4079d7cdeb59a3cac129813b7bb14a6639ea9db
plugins/Webcam_plugin.py
plugins/Webcam_plugin.py
info = { 'id': 'webcam', 'name': 'Webcam', 'description': 'Generic webcam driver', 'module name': 'Webcam', 'class name': 'Webcam', 'author': 'Philip Chimento', 'copyright year': '2011', }
info = { 'id': 'webcam', 'name': 'OpenCV', 'description': 'Video camera interfacing through OpenCV', 'module name': 'Webcam', 'class name': 'Webcam', 'author': 'Philip Chimento', 'copyright year': '2011', }
Rename 'webcam' plugin to OpenCV
Rename 'webcam' plugin to OpenCV
Python
mit
ptomato/Beams
df6642256806e0a501e83c06e64b35f187efaf60
rally/benchmark/scenarios/authenticate/authenticate.py
rally/benchmark/scenarios/authenticate/authenticate.py
# Copyright 2014 Red Hat, Inc. <http://www.redhat.com> # # 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 b...
# Copyright 2014 Red Hat, Inc. <http://www.redhat.com> # # 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 b...
Fix for Authentication scenario to correctly use self.clients
Fix for Authentication scenario to correctly use self.clients Scenario has recently been refactored, self.clients in Scenario now takes the name of the CLI client. During the refactoring, the Authenticate scenario was not correctly updated, which causes the authentication scenario to fail. This patch fixes that. Chan...
Python
apache-2.0
pandeyop/rally,go-bears/rally,vefimova/rally,aplanas/rally,group-policy/rally,amit0701/rally,shdowofdeath/rally,ytsarev/rally,go-bears/rally,vefimova/rally,group-policy/rally,shdowofdeath/rally,openstack/rally,gluke77/rally,ytsarev/rally,redhat-openstack/rally,varunarya10/rally,amit0701/rally,gluke77/rally,vganapath/ra...
022f2cc6d067769a6c8e56601c0238aac69ec9ab
jfr_playoff/settings.py
jfr_playoff/settings.py
import glob, json, os, readline, sys def complete_filename(text, state): return (glob.glob(text+'*')+[None])[state] class PlayoffSettings: def __init__(self): self.interactive = False self.settings_file = None if len(sys.argv) > 1: self.settings_file = sys.argv[1] ...
import glob, json, os, readline, sys def complete_filename(text, state): return (glob.glob(text+'*')+[None])[state] class PlayoffSettings: def __init__(self): self.settings = None self.interactive = False self.settings_file = None if len(sys.argv) > 1: self.setting...
Load config file only once
Load config file only once
Python
bsd-2-clause
emkael/jfrteamy-playoff,emkael/jfrteamy-playoff
19faa280c924254b960a8b9fcb716017e51db09f
pymks/tests/test_mksRegressionModel.py
pymks/tests/test_mksRegressionModel.py
from pymks import MKSRegressionModel import numpy as np def test(): Nbin = 2 Nspace = 81 Nsample = 400 def filter(x): return np.where(x < 10, np.exp(-abs(x)) * np.cos(x * np.pi), np.exp(-abs(x - 20)) * np.cos((x - 20) * np.pi)) coeff = np.l...
from pymks import MKSRegressionModel import numpy as np def test(): Nbin = 2 Nspace = 81 Nsample = 400 def filter(x): return np.where(x < 10, np.exp(-abs(x)) * np.cos(x * np.pi), np.exp(-abs(x - 20)) * np.cos((x - 20) * np.pi)) coeff = np.l...
Fix test due to addition of coeff property
Fix test due to addition of coeff property Address #49 Add fftshift to test coefficients as model.coeff now returns the shifted real versions.
Python
mit
davidbrough1/pymks,XinyiGong/pymks,awhite40/pymks,davidbrough1/pymks,fredhohman/pymks
0336651c6538d756eb40babe086975a0f7fcabd6
qual/tests/test_historical_calendar.py
qual/tests/test_historical_calendar.py
from test_calendar import CalendarTest from qual.calendars import EnglishHistoricalCalendar class TestHistoricalCalendar(object): def setUp(self): self.calendar = self.calendar_type() def test_before_switch(self): for triplet in self.julian_triplets: self.check_valid_date(*triplet...
from test_calendar import CalendarTest from qual.calendars import EnglishHistoricalCalendar class TestHistoricalCalendar(object): def setUp(self): self.calendar = self.calendar_type() def test_before_switch(self): for triplet in self.julian_triplets: self.check_valid_date(*triplet...
Correct test for the right missing days and present days.
Correct test for the right missing days and present days. 1st and 2nd of September 1752 happened, so did 14th. 3rd to 13th did not.
Python
apache-2.0
jwg4/qual,jwg4/calexicon
6833865ff35d451a8215803b9fa74cd57167ed82
script/lib/config.py
script/lib/config.py
#!/usr/bin/env python NODE_VERSION = 'v0.11.10' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = 'aa4874a6bcc51fdd87ca7ae0928514ce83645988'
#!/usr/bin/env python NODE_VERSION = 'v0.11.10' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = '9c654df782c77449e7d8fa741843143145260aeb'
Update libchromiumcontent: Contain linux symbols.
Update libchromiumcontent: Contain linux symbols.
Python
mit
trankmichael/electron,gabrielPeart/electron,felixrieseberg/electron,seanchas116/electron,bitemyapp/electron,xfstudio/electron,leolujuyi/electron,pombredanne/electron,astoilkov/electron,gabriel/electron,mubassirhayat/electron,smczk/electron,Jacobichou/electron,medixdev/electron,yalexx/electron,natgolov/electron,rsvip/el...
c56480fd8905332e54649dac0ade95c825e8ba23
script/lib/config.py
script/lib/config.py
#!/usr/bin/env python NODE_VERSION = 'v0.11.10' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = 'b27290717c08f8c6a58067d3c3725d68b4e6a2e5'
#!/usr/bin/env python NODE_VERSION = 'v0.11.10' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = 'fe05f53f3080889ced2696b2741d93953e654b49'
Update libchromiumcontent to use the thin version.
Update libchromiumcontent to use the thin version.
Python
mit
cos2004/electron,rajatsingla28/electron,bobwol/electron,tonyganch/electron,gbn972/electron,deed02392/electron,natgolov/electron,felixrieseberg/electron,bright-sparks/electron,adcentury/electron,jhen0409/electron,soulteary/electron,pandoraui/electron,subblue/electron,matiasinsaurralde/electron,jlord/electron,rreimann/el...
1c32b17bd4c85165f91fbb188b22471a296c6176
kajiki/i18n.py
kajiki/i18n.py
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) from .ir import TranslatableTextNode def gettext(s): return s def extract(fileobj, keywords, comment_tags, options): '''Babel entry point that extracts translation strings fr...
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) from .ir import TranslatableTextNode def gettext(s): return s def extract(fileobj, keywords, comment_tags, options): '''Babel entry point that extracts translation strings fr...
Fix issue with message extractor on Py2
Fix issue with message extractor on Py2
Python
mit
ollyc/kajiki,ollyc/kajiki,ollyc/kajiki
c1785e0713a5af6b849baaa1b314a13ac777f3f5
tests/test_str_py3.py
tests/test_str_py3.py
from os import SEEK_SET from random import choice, seed from string import ascii_uppercase, digits import fastavro from fastavro.compat import BytesIO letters = ascii_uppercase + digits id_size = 100 seed('str_py3') # Repeatable results def gen_id(): return ''.join(choice(letters) for _ in range(id_size)) k...
# -*- coding: utf-8 -*- """Python3 string tests for fastavro""" from __future__ import absolute_import from os import SEEK_SET from random import choice, seed from string import ascii_uppercase, digits try: from cStringIO import StringIO as BytesIO except ImportError: from io import BytesIO import fastavro ...
Test files shouldn't import 'fastavro.compat'. Just import BytesIO manually.
Test files shouldn't import 'fastavro.compat'. Just import BytesIO manually.
Python
mit
e-heller/fastavro,e-heller/fastavro
df1397dcf6fe849b87db139e8ea3087a5f73649a
tests/graphics/toolbuttons.py
tests/graphics/toolbuttons.py
from gi.repository import Gtk from sugar3.graphics.toolbarbox import ToolbarBox from sugar3.graphics.colorbutton import ColorToolButton from sugar3.graphics.radiotoolbutton import RadioToolButton from sugar3.graphics.toggletoolbutton import ToggleToolButton import common test = common.Test() test.show() vbox = Gtk...
from gi.repository import Gtk from sugar3.graphics.toolbarbox import ToolbarBox from sugar3.graphics.colorbutton import ColorToolButton from sugar3.graphics.radiotoolbutton import RadioToolButton from sugar3.graphics.toggletoolbutton import ToggleToolButton import common test = common.Test() test.show() vbox = Gtk...
Update toolbar buttons testcase with API change for the icon name
Update toolbar buttons testcase with API change for the icon name Follow up of fe11a3aa23c0e7fbc3c0c498e147b0a20348cc12 . Signed-off-by: Manuel Quiñones <6f5069c5b6be23302a13accec56587944be09079@laptop.org>
Python
lgpl-2.1
i5o/sugar-toolkit-gtk3,puneetgkaur/sugar-toolkit-gtk3,tchx84/sugar-toolkit-gtk3,gusDuarte/sugar-toolkit-gtk3,godiard/sugar-toolkit-gtk3,puneetgkaur/sugar-toolkit-gtk3,ceibal-tatu/sugar-toolkit-gtk3,puneetgkaur/backup_sugar_sugartoolkit,sugarlabs/sugar-toolkit-gtk3,tchx84/sugar-toolkit-gtk3,i5o/sugar-toolkit-gtk3,Daksh/...
2f56d481c05e28a4434a038a356f521b4ea5cbca
tests/test_simple_features.py
tests/test_simple_features.py
from wordgraph.points import Point import wordgraph EPOCH_START = 1407109280 def time_values(values, start=EPOCH_START, increment=1): datapoints = [] for index, value in enumerate(values): datapoints.append(Point(x=value, y=start + (increment * index))) return datapoints def test_monotonic_up_per...
from wordgraph.points import Point import wordgraph EPOCH_START = 1407109280 def time_values(values, start=EPOCH_START, increment=1): datapoints = [] for index, value in enumerate(values): datapoints.append(Point(x=value, y=start + (increment * index))) return datapoints def test_monotonic_up_per...
Test case for step function in time series
Test case for step function in time series Test a graph function that is linear in two time periods, jumping between linear values.
Python
apache-2.0
tleeuwenburg/wordgraph,tleeuwenburg/wordgraph
9051fc68b2c542f7a201a969340b1f1f5d0f660c
test_openfolder.py
test_openfolder.py
import pytest from mock import patch, MagicMock from open_folder import * def test_folder_exists(): with patch('subprocess.check_call', MagicMock(return_value="NOOP")): result = open_folder(".") assert result == None def test_folder_does_not_exists(): with patch('subprocess.check_call', Magic...
import pytest from mock import patch, MagicMock from open_folder import * def test_folder_exists(): with patch('subprocess.check_call', MagicMock(return_value="NOOP")): result = open_folder(".") assert result == None def test_folder_does_not_exists(): with patch('subprocess.check_call', Magic...
Check to ensure the exceptions return the text we expect.
Check to ensure the exceptions return the text we expect.
Python
mit
golliher/dg-tickler-file
e5fa10e27d9c5911b0238d23fc13acc081accc79
utils/dates.py
utils/dates.py
# This file is part of e-Giełda. # Copyright (C) 2014-2015 Mateusz Maćkowski and Tomasz Zieliński # # e-Giełda is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at ...
# This file is part of e-Giełda. # Copyright (C) 2014-2015 Mateusz Maćkowski and Tomasz Zieliński # # e-Giełda is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at ...
Fix error on date save
Fix error on date save
Python
agpl-3.0
m4tx/egielda,m4tx/egielda,m4tx/egielda
ca430300c08f78b7c2de4153e08c1645996f85b7
tests/test_parsers.py
tests/test_parsers.py
import unittest from brew.parsers import JSONDataLoader class TestJSONDataLoader(unittest.TestCase): def setUp(self): self.parser = JSONDataLoader('./') def test_format_name(self): name_list = [('pale malt 2-row us', 'pale_malt_2_row_us'), ('caramel crystal malt 20l', '...
import unittest from brew.parsers import DataLoader from brew.parsers import JSONDataLoader class TestDataLoader(unittest.TestCase): def setUp(self): self.parser = DataLoader('./') def test_read_data_raises(self): with self.assertRaises(NotImplementedError): self.parser.read_dat...
Add test to DataLoader base class
Add test to DataLoader base class
Python
mit
chrisgilmerproj/brewday,chrisgilmerproj/brewday
17d2d4eaf58011ceb33a4d5944253578c2b5edd1
pmdarima/preprocessing/endog/tests/test_log.py
pmdarima/preprocessing/endog/tests/test_log.py
# -*- coding: utf-8 -*- import numpy as np from numpy.testing import assert_array_almost_equal from scipy import stats import pytest from pmdarima.preprocessing import LogEndogTransformer from pmdarima.preprocessing import BoxCoxEndogTransformer def test_same(): y = [1, 2, 3] trans = BoxCoxEndogTransformer()...
# -*- coding: utf-8 -*- import numpy as np from numpy.testing import assert_array_almost_equal from scipy import stats import pytest from pmdarima.preprocessing import LogEndogTransformer from pmdarima.preprocessing import BoxCoxEndogTransformer def test_same(): y = [1, 2, 3] trans = BoxCoxEndogTransformer(...
Add test_invertible to log transformer test
Add test_invertible to log transformer test
Python
mit
alkaline-ml/pmdarima,tgsmith61591/pyramid,tgsmith61591/pyramid,alkaline-ml/pmdarima,alkaline-ml/pmdarima,tgsmith61591/pyramid
5c1f9b0a70fe47bbfa7d3813a47e2da81cd81506
tests/runalldoctests.py
tests/runalldoctests.py
import doctest import glob import pkg_resources try: pkg_resources.require('OWSLib') except (ImportError, pkg_resources.DistributionNotFound): pass testfiles = glob.glob('*.txt') for file in testfiles: doctest.testfile(file)
import doctest import getopt import glob import sys import pkg_resources try: pkg_resources.require('OWSLib') except (ImportError, pkg_resources.DistributionNotFound): pass def run(pattern): if pattern is None: testfiles = glob.glob('*.txt') else: testfiles = glob.glob(pattern) fo...
Add option to pick single test file from the runner
Add option to pick single test file from the runner git-svn-id: 8e0fbe17d71f9a07a4f24b82f5b9fb44b438f95e@620 b426a367-1105-0410-b9ff-cdf4ab011145
Python
bsd-3-clause
sabman/OWSLib,monoid/owslib,monoid/owslib
61bbd4e8fc0712fe56614481173eb86d409eb8d7
tests/test_linked_list.py
tests/test_linked_list.py
from unittest import TestCase from pystructures.linked_lists import LinkedList, Node class TestNode(TestCase): def test_value(self): """ A simple test to check the Node's value """ node = Node(10) self.assertEqual(10, node.value) def test_improper_node(self): """ A test to che...
from builtins import range from unittest import TestCase from pystructures.linked_lists import LinkedList, Node class TestNode(TestCase): def test_value(self): """ A simple test to check the Node's value """ node = Node(10) self.assertEqual(10, node.value) def test_improper_node(self)...
Fix range issue with travis
Fix range issue with travis
Python
mit
apranav19/pystructures
01c0dd4d34e61df589b3dd9ee3c5f8b96cf5486b
tests/test_transformer.py
tests/test_transformer.py
from __future__ import unicode_literals import functools from scrapi.base import XMLHarvester from scrapi.linter import RawDocument from .utils import get_leaves from .utils import TEST_SCHEMA, TEST_NAMESPACES, TEST_XML_DOC class TestHarvester(XMLHarvester): def harvest(self, days_back=1): return [Raw...
from __future__ import unicode_literals import functools from scrapi.base import XMLHarvester from scrapi.linter import RawDocument from .utils import get_leaves from .utils import TEST_SCHEMA, TEST_NAMESPACES, TEST_XML_DOC class TestHarvester(XMLHarvester): def harvest(self, days_back=1): return [Raw...
Update tests with required properties
Update tests with required properties
Python
apache-2.0
CenterForOpenScience/scrapi,jeffreyliu3230/scrapi,fabianvf/scrapi,felliott/scrapi,erinspace/scrapi,icereval/scrapi,mehanig/scrapi,ostwald/scrapi,erinspace/scrapi,alexgarciac/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,fabianvf/scrapi,felliott/scrapi
46d274401080d47f3a9974c6ee80f2f3b9c0c8b0
metakernel/magics/tests/test_download_magic.py
metakernel/magics/tests/test_download_magic.py
from metakernel.tests.utils import (get_kernel, get_log_text, clear_log_text, EvalKernel) import os def test_download_magic(): kernel = get_kernel(EvalKernel) kernel.do_execute("%download --filename TEST.txt https://raw.githubusercontent.com/blink1073/metakernel/master/LIC...
from metakernel.tests.utils import (get_kernel, get_log_text, clear_log_text, EvalKernel) import os def test_download_magic(): kernel = get_kernel(EvalKernel) kernel.do_execute("%download --filename TEST.txt https://raw.githubusercontent.com/blink1073/metakernel/master/LIC...
Add download test without filename
Add download test without filename
Python
bsd-3-clause
Calysto/metakernel
6220c36f046b2b504cc2ebbbc04a34c4d826564d
IPython/extensions/tests/test_storemagic.py
IPython/extensions/tests/test_storemagic.py
import tempfile, os import nose.tools as nt ip = get_ipython() ip.magic('load_ext storemagic') def test_store_restore(): ip.user_ns['foo'] = 78 ip.magic('alias bar echo "hello"') tmpd = tempfile.mkdtemp() ip.magic('cd ' + tmpd) ip.magic('store foo') ip.magic('store bar') # Check stor...
import tempfile, os from IPython.config.loader import Config import nose.tools as nt ip = get_ipython() ip.magic('load_ext storemagic') def test_store_restore(): ip.user_ns['foo'] = 78 ip.magic('alias bar echo "hello"') tmpd = tempfile.mkdtemp() ip.magic('cd ' + tmpd) ip.magic('store foo') ip...
Add test for StoreMagics.autorestore option
Add test for StoreMagics.autorestore option
Python
bsd-3-clause
ipython/ipython,ipython/ipython
975a5010e97b11b9b6f00923c87268dd883b1cfa
2017-code/opt/test1.py
2017-code/opt/test1.py
# test1.py # Ronald L. Rivest and Karim Husayn Karimi # August 17, 2017 # Routine to experiment with scipy.optimize.minimize import scipy.optimize from scipy.stats import norm # function to minimize: def g(xy): (x,y) = xy print("g({},{})".format(x,y)) return x + y # constraints noise_level = 0.0000005 ...
# test1.py # Ronald L. Rivest and Karim Husayn Karimi # August 17, 2017 # Routine to experiment with scipy.optimize.minimize import scipy.optimize from scipy.stats import norm # function to minimize: def g(xy): (x,y) = xy print("g({},{})".format(x,y)) return x + y # constraints noise_level = 0.05 # co...
Switch to COBYLA optimization method. Works much better.
Switch to COBYLA optimization method. Works much better.
Python
mit
ron-rivest/2017-bayes-audit,ron-rivest/2017-bayes-audit
76cf350b4ca48455e9ae7d6288d992389a8ec0b5
src/toil/provisioners/azure/__init__.py
src/toil/provisioners/azure/__init__.py
# Copyright (C) 2015-2016 Regents of the University of California # # 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 app...
# Copyright (C) 2015-2016 Regents of the University of California # # 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 app...
Remove getAzureZone from init, no longer needed.
Remove getAzureZone from init, no longer needed.
Python
apache-2.0
BD2KGenomics/slugflow,BD2KGenomics/slugflow
6941d9048a8c630244bb48100864872b35a1a307
tests/functional/test_layout_and_styling.py
tests/functional/test_layout_and_styling.py
import os from .base import FunctionalTest class LayoutStylingTest(FunctionalTest): def test_bootstrap_links_loaded_successfully(self): self.browser.get(self.live_server_url) self.assertIn( "//netdna.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css", self.browser.p...
from .base import FunctionalTest class LayoutStylingTest(FunctionalTest): def test_bootstrap_links_loaded_successfully(self): self.browser.get(self.live_server_url) links = [link.get_attribute("href") for link in self.browser.find_elements_by_tag_name('link')] scripts = ...
Fix bootstrap and jQuery link checking in homepage
Fix bootstrap and jQuery link checking in homepage
Python
bsd-3-clause
andela-kndungu/compshop,andela-kndungu/compshop,kevgathuku/compshop,kevgathuku/compshop,kevgathuku/compshop,kevgathuku/compshop,andela-kndungu/compshop,andela-kndungu/compshop
7375c41b1d9bd5ca153df80705ae1887e6f2e70b
api/base/exceptions.py
api/base/exceptions.py
def jsonapi_exception_handler(exc, context): """ Custom exception handler that nests detail inside errors. """ from rest_framework.views import exception_handler response = exception_handler(exc, context) if response is not None: if 'detail' in response.data: response.data ...
def jsonapi_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array with a 'detail' member """ from rest_framework.views import exception_handler response = exception_handler(exc, context) if response is not None: if 'detail' in response.dat...
Change docstring for exception handler
Change docstring for exception handler
Python
apache-2.0
RomanZWang/osf.io,felliott/osf.io,cosenal/osf.io,caseyrollins/osf.io,aaxelb/osf.io,aaxelb/osf.io,ckc6cz/osf.io,zamattiac/osf.io,emetsger/osf.io,ZobairAlijan/osf.io,monikagrabowska/osf.io,petermalcolm/osf.io,mfraezz/osf.io,crcresearch/osf.io,MerlinZhang/osf.io,mluke93/osf.io,hmoco/osf.io,emetsger/osf.io,felliott/osf.io,...
6d624d693a05749879f4184231e727590542db03
backend/globaleaks/tests/utils/test_zipstream.py
backend/globaleaks/tests/utils/test_zipstream.py
# -*- encoding: utf-8 -*- import StringIO from twisted.internet.defer import inlineCallbacks from zipfile import ZipFile from globaleaks.tests import helpers from globaleaks.utils.zipstream import ZipStream class TestZipStream(helpers.TestGL): @inlineCallbacks def setUp(self): yield helpers.TestGL.s...
# -*- encoding: utf-8 -*- import os import StringIO from twisted.internet.defer import inlineCallbacks from zipfile import ZipFile from globaleaks.tests import helpers from globaleaks.utils.zipstream import ZipStream class TestZipStream(helpers.TestGL): @inlineCallbacks def setUp(self): yield helper...
Improve unit testing of zipstream utilities
Improve unit testing of zipstream utilities
Python
agpl-3.0
vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks
92138f23dfc5dbbcb81aeb1f429e68a63a9d5005
apps/organizations/admin.py
apps/organizations/admin.py
from django.contrib import admin from apps.organizations.models import ( Organization, OrganizationAddress, OrganizationMember ) class OrganizationAddressAdmin(admin.StackedInline): model = OrganizationAddress extra = 0 class OrganizationAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ("nam...
from django.contrib import admin from apps.organizations.models import ( Organization, OrganizationAddress, OrganizationMember ) class OrganizationAddressAdmin(admin.StackedInline): model = OrganizationAddress extra = 0 class OrganizationAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ("nam...
Add a custom Admin page for organization members.
Add a custom Admin page for organization members. This is a partial fix for BB-66.
Python
bsd-3-clause
onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site
539608a9ca9a21707184496e744fc40a8cb72cc1
announce/management/commands/migrate_mailchimp_users.py
announce/management/commands/migrate_mailchimp_users.py
from django.core.management.base import BaseCommand, CommandError from django.contrib.auth.models import User from announce.mailchimp import archive_members, list_members, batch_subscribe from studygroups.models import Profile import requests import logging logger = logging.getLogger(__name__) class Command(BaseCo...
from django.core.management.base import BaseCommand, CommandError from django.contrib.auth.models import User from announce.mailchimp import archive_members, list_members, batch_subscribe from studygroups.models import Profile import requests import logging logger = logging.getLogger(__name__) class Command(BaseCo...
Remove once of code for mailchimp list migration
Remove once of code for mailchimp list migration
Python
mit
p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles
c93cb479446fbe12e019550f193cb45dbdc1e3e0
pytest-{{cookiecutter.plugin_name}}/pytest_{{cookiecutter.plugin_name}}.py
pytest-{{cookiecutter.plugin_name}}/pytest_{{cookiecutter.plugin_name}}.py
# -*- coding: utf-8 -*- import pytest def pytest_addoption(parser): group = parser.getgroup('{{cookiecutter.plugin_name}}') group.addoption( '--foo', action='store', dest='foo', help='alias for --foo' ) @pytest.fixture def bar(request): return request.config.option.f...
# -*- coding: utf-8 -*- import pytest def pytest_addoption(parser): group = parser.getgroup('{{cookiecutter.plugin_name}}') group.addoption( '--foo', action='store', dest='foo', help='Set the value for the fixture "bar".' ) @pytest.fixture def bar(request): return re...
Optimize the help message for the option arg
Optimize the help message for the option arg
Python
mit
luzfcb/cookiecutter-pytest-plugin,s0undt3ch/cookiecutter-pytest-plugin,pytest-dev/cookiecutter-pytest-plugin
3d7bbd37485dca4782ad7e7fdb088b22db586b66
pyscores/config.py
pyscores/config.py
BASE_URL = "http://api.football-data.org/v1" LEAGUE_IDS = { "PL": "426", "ELC": "427", "EL1": "428", "FAC": "429", "BL1": "430", "BL2": "431", "DFB": "432", "DED": "433", "FL1": "434", "FL2": "435", "PD": "436", "SD": "437", "SA": "438", "PPL": "439", "CL": "...
BASE_URL = "http://api.football-data.org/v1" LEAGUE_IDS = { "BSA": "444", "PL": "445", "ELC": "446", "EL1": "447", "EL2": "448", "DED": "449", "FL1": "450", "FL2": "451", "BL1": "452", "BL2": "453", "PD": "455", "SA": "456", "PPL": "457", "DFB": "458", "SB": ...
Update league codes for new season
Update league codes for new season
Python
mit
conormag94/pyscores
a476c42216af99488c2e02bacd29f7e3a869a3e7
tests/retrieval_metrics/test_precision_at_k.py
tests/retrieval_metrics/test_precision_at_k.py
import numpy as np import pytest import tensorflow as tf from tensorflow_similarity.retrieval_metrics import PrecisionAtK testdata = [ ( "micro", tf.constant(0.583333333), ), ( "macro", tf.constant(0.5), ), ] @pytest.mark.parametrize("avg, expected", testdata, ids=["m...
import numpy as np import pytest import tensorflow as tf from tensorflow_similarity.retrieval_metrics import PrecisionAtK testdata = [ ( "micro", tf.constant(0.583333333), ), ( "macro", tf.constant(0.5), ), ] @pytest.mark.parametrize("avg, expected", testdata, ids=["m...
Update atol on precision at k test.
Update atol on precision at k test.
Python
apache-2.0
tensorflow/similarity
b1a3a17460ae1f68c6c9bf60ecbd6a3b80a95abe
billjobs/tests/tests_model.py
billjobs/tests/tests_model.py
from django.test import TestCase, Client from django.contrib.auth.models import User from billjobs.models import Bill, Service from billjobs.settings import BILLJOBS_BILL_ISSUER class BillingTestCase(TestCase): ''' Test billing creation and modification ''' fixtures = ['dev_data.json'] def setUp(self): ...
from django.test import TestCase, Client from django.contrib.auth.models import User from billjobs.models import Bill, Service from billjobs.settings import BILLJOBS_BILL_ISSUER class BillingTestCase(TestCase): ''' Test billing creation and modification ''' fixtures = ['dev_data.json'] def setUp(self): ...
Refactor test to use user
Refactor test to use user
Python
mit
ioO/billjobs
ed8423041abc80b778bf9ffed61e3dad246d72ff
bucketeer/test/test_commit.py
bucketeer/test/test_commit.py
import unittest import boto from bucketeer import commit class BuckeeterTest(unittest.TestCase): def setUp(self): # Create a bucket with one file connection = boto.connect_s3() bucket = connection.create_bucket('bucket.exists') return def tearDown(self): # Remove all test-created buckets and...
import unittest import boto from bucketeer import commit class BuckeeterTest(unittest.TestCase): global existing_bucket existing_bucket = 'bucket.exists' def setUp(self): # Create a bucket with one file connection = boto.connect_s3() bucket = connection.create_bucket(existing_bucket) return ...
Refactor bucket name to global variable
Refactor bucket name to global variable
Python
mit
mgarbacz/bucketeer
d0367aacfea7c238c476772a2c83f7826b1e9de5
corehq/apps/export/tasks.py
corehq/apps/export/tasks.py
from celery.task import task from corehq.apps.export.export import get_export_file, rebuild_export from couchexport.models import Format from couchexport.tasks import escape_quotes from soil.util import expose_cached_download @task def populate_export_download_task(export_instances, filters, download_id, filename=No...
from celery.task import task from corehq.apps.export.export import get_export_file, rebuild_export from couchexport.models import Format from couchexport.tasks import escape_quotes from soil.util import expose_cached_download @task def populate_export_download_task(export_instances, filters, download_id, filename=No...
Fix botched keyword args in rebuild_export_task()
Fix botched keyword args in rebuild_export_task()
Python
bsd-3-clause
dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq
bddd7cb9131dd61a8167fe9db5bbc3b02f8e3add
tests/main.py
tests/main.py
#!/usr/bin/env python """ Tests for python-bna >>> import bna >>> serial = "US120910711868" >>> secret = b"88aaface48291e09dc1ece9c2aa44d839983a7ff" >>> bna.get_token(secret, time=1347279358) (93461643, 2) >>> bna.get_token(secret, time=1347279359) (93461643, 1) >>> bna.get_token(secret, time=1347279360) (86031001, 30...
#!/usr/bin/env python """ Tests for python-bna >>> import bna >>> serial = "US120910711868" >>> secret = b"88aaface48291e09dc1ece9c2aa44d839983a7ff" >>> bna.get_token(secret, time=1347279358) (93461643, 2) >>> bna.get_token(secret, time=1347279359) (93461643, 1) >>> bna.get_token(secret, time=1347279360) (86031001, 30...
Add a test for bna.get_otpauth_url
Add a test for bna.get_otpauth_url
Python
mit
jleclanche/python-bna,Adys/python-bna
86a325777742e1fa79bc632fca9460f3b1b8eb16
to_do/urls.py
to_do/urls.py
from django.conf.urls import patterns, include, url from task.views import TaskList, TaskView # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^$', TaskList.as_view(), name='TaskList'), url(r'^task/', TaskView.as_view(),...
from django.conf.urls import patterns, include, url from task.views import TaskList, TaskView, get_task_list # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^$', TaskList.as_view(), name='TaskList'), url(r'^task/', Task...
Enable url to get all list of tasks by ajax
Enable url to get all list of tasks by ajax
Python
mit
rosadurante/to_do,rosadurante/to_do
49975504a590a1ae53e2e8cc81aadea277cc5600
cvrminer/app/__init__.py
cvrminer/app/__init__.py
"""cvrminer app.""" from __future__ import absolute_import, division, print_function from flask import Flask from flask_bootstrap import Bootstrap def create_app(smiley=False): """Create app. Factory for app. Parameters ---------- smiley : bool, optional Determines whether the smiley ...
"""cvrminer app.""" from __future__ import absolute_import, division, print_function from flask import Flask from flask_bootstrap import Bootstrap, StaticCDN def create_app(smiley=False): """Create app. Factory for app. Parameters ---------- smiley : bool, optional Determines whether ...
Change to use local Javascript and CSS files
Change to use local Javascript and CSS files
Python
apache-2.0
fnielsen/cvrminer,fnielsen/cvrminer,fnielsen/cvrminer
3b4322b8de8ffdc691f08fbf7f35e6ec5293f41e
crm_job_position/models/crm_job_position.py
crm_job_position/models/crm_job_position.py
# -*- encoding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in root directory ############################################################################## from openerp import models, fields class CrmJobPosition...
# -*- encoding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in root directory ############################################################################## from openerp import models, fields class CrmJobPosition...
Set some fields as tranlate
Set some fields as tranlate
Python
agpl-3.0
acsone/partner-contact,Therp/partner-contact,diagramsoftware/partner-contact,Endika/partner-contact,open-synergy/partner-contact
f7bfcd7fee64ae9220710835974125f41dae1c50
frappe/core/doctype/role/test_role.py
frappe/core/doctype/role/test_role.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe import unittest test_records = frappe.get_test_records('Role') class TestUser(unittest.TestCase): def test_disable_role(self): frappe.get_doc("User", "test@exam...
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe import unittest test_records = frappe.get_test_records('Role') class TestUser(unittest.TestCase): def test_disable_role(self): frappe.get_doc("User", "test@exam...
Test Case for disabled role
fix: Test Case for disabled role
Python
mit
mhbu50/frappe,mhbu50/frappe,saurabh6790/frappe,frappe/frappe,saurabh6790/frappe,vjFaLk/frappe,StrellaGroup/frappe,vjFaLk/frappe,yashodhank/frappe,StrellaGroup/frappe,almeidapaulopt/frappe,adityahase/frappe,almeidapaulopt/frappe,adityahase/frappe,adityahase/frappe,adityahase/frappe,mhbu50/frappe,yashodhank/frappe,frappe...
82121f05032f83de538c4a16596b24b5b012a3be
chaco/shell/tests/test_tutorial_example.py
chaco/shell/tests/test_tutorial_example.py
""" Test script-oriented example from interactive plotting tutorial source: docs/source/user_manual/chaco_tutorial.rst """ import unittest from numpy import linspace, pi, sin from enthought.chaco.shell import plot, show, title, ytitle class InteractiveTestCase(unittest.TestCase): def test_script(self): ...
""" Test script-oriented example from interactive plotting tutorial source: docs/source/user_manual/chaco_tutorial.rst """ import unittest from numpy import linspace, pi, sin from chaco.shell import plot, title, ytitle class InteractiveTestCase(unittest.TestCase): def test_script(self): x = linspace(-2...
Clean up: pyflakes and remove enthought.chaco import. We should and will update the tutorial later.
Clean up: pyflakes and remove enthought.chaco import. We should and will update the tutorial later.
Python
bsd-3-clause
tommy-u/chaco,burnpanck/chaco,burnpanck/chaco,tommy-u/chaco,tommy-u/chaco,burnpanck/chaco
e029998f73a77ebd8f4a6e32a8b03edcc93ec0d7
dataproperty/__init__.py
dataproperty/__init__.py
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import from ._align import Align from ._align_getter import align_getter from ._container import MinMaxContainer from ._data_property import ( ColumnDataProperty, DataProperty ) from ._error impo...
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import from ._align import Align from ._align_getter import align_getter from ._container import MinMaxContainer from ._data_property import ( ColumnDataProperty, DataProperty ) from ._error impo...
Delete import that no longer used
Delete import that no longer used
Python
mit
thombashi/DataProperty
69abcf66d36079e100815f629487d121ae016ee9
future/tests/test_standard_library_renames.py
future/tests/test_standard_library_renames.py
""" Tests for the future.standard_library_renames module """ from __future__ import absolute_import, unicode_literals, print_function from future import standard_library_renames, six import unittest class TestStandardLibraryRenames(unittest.TestCase): def test_configparser(self): import configparser ...
""" Tests for the future.standard_library_renames module """ from __future__ import absolute_import, unicode_literals, print_function from future import standard_library_renames, six import unittest class TestStandardLibraryRenames(unittest.TestCase): def test_configparser(self): import configparser ...
Fix test for queue module
Fix test for queue module I was testing heapq before ;) ...
Python
mit
QuLogic/python-future,QuLogic/python-future,krischer/python-future,michaelpacer/python-future,michaelpacer/python-future,krischer/python-future,PythonCharmers/python-future,PythonCharmers/python-future
f266132c05c37469290027e7aa8000d1f9a19a6c
tst/colors.py
tst/colors.py
YELLOW = '\033[1;33m' LRED = '\033[1;31m' LGREEN = '\033[1;32m' GREEN="\033[9;32m" WHITE="\033[1;37m" LCYAN = '\033[1;36m' LBLUE = '\033[1;34m' RESET = '\033[0m'
YELLOW = '\033[1;33m' LRED = '\033[1;31m' LGREEN = '\033[1;32m' GREEN = '\033[9;32m' WHITE = '\033[0;37m' LWHITE = '\033[1;37m' LCYAN = '\033[1;36m' LBLUE = '\033[1;34m' RESET = '\033[0m' CRITICAL = '\033[41;37m'
Add some new color codes
Add some new color codes
Python
agpl-3.0
daltonserey/tst,daltonserey/tst
038978f87883247a14e9bec08708452c98c91285
test/test_chimera.py
test/test_chimera.py
import unittest import utils import os import sys import re import shutil import subprocess TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) utils.set_search_paths(TOPDIR) import cryptosite.chimera class Tests(unittest.TestCase): def test_bad(self): """Test wrong arguments to chime...
import unittest import utils import os import sys import re import shutil import subprocess TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) utils.set_search_paths(TOPDIR) import cryptosite.chimera class Tests(unittest.TestCase): def test_bad(self): """Test wrong arguments to chime...
Check generated file for sanity.
Check generated file for sanity.
Python
lgpl-2.1
salilab/cryptosite,salilab/cryptosite,salilab/cryptosite
05ddf0fff9469ae0173809eb559486ff216231a0
test/test_scripts.py
test/test_scripts.py
import pytest import subprocess @pytest.mark.parametrize("script", []) def test_script(script): try: subprocess.check_output([script, '-h'], stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: print e.output assert e.returncode == 0
import pytest import subprocess @pytest.mark.parametrize("script", ['bin/cast-example']) def test_script(script): try: subprocess.check_output([script, '-h'], stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: print e.output assert e.returncode == 0
Add example-cast to sanity test
Add example-cast to sanity test
Python
mit
maxzheng/clicast
33598fd8baf527d63cef965eddfc90548b6c52b3
go/apps/jsbox/definition.py
go/apps/jsbox/definition.py
import json from go.vumitools.conversation.definition import ( ConversationDefinitionBase, ConversationAction) class ViewLogsAction(ConversationAction): action_name = 'view_logs' action_display_name = 'View Sandbox Logs' redirect_to = 'jsbox_logs' class ConversationDefinition(ConversationDefinition...
import json from go.vumitools.conversation.definition import ( ConversationDefinitionBase, ConversationAction) class ViewLogsAction(ConversationAction): action_name = 'view_logs' action_display_name = 'View Sandbox Logs' redirect_to = 'jsbox_logs' class ConversationDefinition(ConversationDefinition...
Remove non-unicode endpoints from the endpoint list.
Remove non-unicode endpoints from the endpoint list.
Python
bsd-3-clause
praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go
fbc46862af7fa254f74f1108149fd0669c46f1ad
rplugin/python3/deoplete/sources/LanguageClientSource.py
rplugin/python3/deoplete/sources/LanguageClientSource.py
import re from .base import Base CompleteResults = "g:LanguageClient_completeResults" def simplify_snippet(snip: str) -> str: snip = re.sub(r'(?<!\\)\$(?P<num>\d+)', '<`\g<num>`>', snip) return re.sub(r'(?<!\\)\${(?P<num>\d+):(?P<desc>.+?)}', '<`\g<num>:\g<desc>`>', snip) class Source(Ba...
from .base import Base CompleteResults = "g:LanguageClient_completeResults" class Source(Base): def __init__(self, vim): super().__init__(vim) self.name = "LanguageClient" self.mark = "[LC]" self.rank = 1000 self.filetypes = vim.eval( "get(g:, 'LanguageClient...
Remove problematic deoplete source customization.
Remove problematic deoplete source customization. Close #312.
Python
mit
autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/L...
d6a3d43e58796299c55fe3a6c6d597edaf5cfc3c
troposphere/kms.py
troposphere/kms.py
# Copyright (c) 2012-2013, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject from .validators import boolean try: from awacs.aws import Policy policytypes = (dict, Policy) except ImportError: policytypes = dict, class Alias(AWSObject): res...
# Copyright (c) 2012-2013, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, Tags from .validators import boolean try: from awacs.aws import Policy policytypes = (dict, Policy) except ImportError: policytypes = dict, class Alias(AWSObject): ...
Change KMS::Key to accept a standard Tags
Change KMS::Key to accept a standard Tags
Python
bsd-2-clause
ikben/troposphere,pas256/troposphere,johnctitus/troposphere,cloudtools/troposphere,ikben/troposphere,cloudtools/troposphere,johnctitus/troposphere,pas256/troposphere
ca777965c26b8dfd43b472adeb032f048e2537ed
acceptancetests/tests/acc_test_login_page.py
acceptancetests/tests/acc_test_login_page.py
# (c) Crown Owned Copyright, 2016. Dstl. import os import unittest from splinter import Browser class TestLoginPage (unittest.TestCase): def setUp(self): self.browser = Browser('phantomjs') def test_login_page_appears(self): # This needs to come from an environment variable at some point ...
# (c) Crown Owned Copyright, 2016. Dstl. import os import unittest from splinter import Browser class TestLoginPage (unittest.TestCase): def setUp(self): self.browser = Browser('phantomjs') def test_login_page_appears(self): # This needs to come from an environment variable at some point ...
Check that expected title exists in the actual title, not the other way round
Check that expected title exists in the actual title, not the other way round
Python
mit
dstl/lighthouse,dstl/lighthouse,dstl/lighthouse,dstl/lighthouse,dstl/lighthouse
d5ee91ba36c7e3d2ce0720b5b047934d554041cd
app/__init__.py
app/__init__.py
from flask import Flask from flask.ext.bootstrap import Bootstrap from config import config bootstrap = Bootstrap() def create_app(config_name): app = Flask(__name__) app.config.from_object(config[config_name]) bootstrap.init_app(app) from .aflafrettir import aflafrettir as afla_blueprint app.register_bl...
from flask import Flask from flask.ext.bootstrap import Bootstrap from flask.ext.sqlalchemy import SQLAlchemy from config import config bootstrap = Bootstrap() db = SQLAlchemy() def create_app(config_name): app = Flask(__name__) app.config.from_object(config[config_name]) bootstrap.init_app(app) db.init_app...
Initialize the database in the application package constructor
Initialize the database in the application package constructor
Python
mit
finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is
154b64b2ee56fa4391251268ba4a85d178bedd60
djangoautoconf/urls.py
djangoautoconf/urls.py
from django.conf.urls import patterns, include, url from django.conf import settings from django.conf.urls.static import static # Uncomment the next two lines to enable the admin: from django.contrib import admin # from mezzanine.core.views import direct_to_template admin.autodiscover() # Must be defined before aut...
from django.conf.urls import patterns, include, url from django.conf import settings from django.conf.urls.static import static # Uncomment the next two lines to enable the admin: from django.contrib import admin # from mezzanine.core.views import direct_to_template admin.autodiscover() # Must be defined before aut...
Fix the issue of override url by mistake.
Fix the issue of override url by mistake.
Python
bsd-3-clause
weijia/djangoautoconf,weijia/djangoautoconf
96f9819ab67b48135a61c8a1e15bc808cf82d194
bokeh/models/widget.py
bokeh/models/widget.py
from __future__ import absolute_import from ..plot_object import PlotObject from ..properties import Bool class Widget(PlotObject): disabled = Bool(False)
from __future__ import absolute_import from ..plot_object import PlotObject from ..properties import Bool from ..embed import notebook_div class Widget(PlotObject): disabled = Bool(False) def _repr_html_(self): return notebook_div(self) @property def html(self): from IPython.core.dis...
Implement display protocol for Widget (_repr_html_)
Implement display protocol for Widget (_repr_html_) This effectively allows us to automatically display plots and widgets.
Python
bsd-3-clause
evidation-health/bokeh,abele/bokeh,mutirri/bokeh,percyfal/bokeh,htygithub/bokeh,jakirkham/bokeh,rhiever/bokeh,DuCorey/bokeh,srinathv/bokeh,DuCorey/bokeh,awanke/bokeh,clairetang6/bokeh,ericdill/bokeh,ahmadia/bokeh,saifrahmed/bokeh,mutirri/bokeh,bokeh/bokeh,gpfreitas/bokeh,philippjfr/bokeh,xguse/bokeh,srinathv/bokeh,drap...
5a6c809afc6b228d7f5d37154adda162802c0110
botcommands/vimtips.py
botcommands/vimtips.py
# coding: utf-8 import requests def vimtips(msg=None): try: tip = requests.get('http://vim-tips.com/random_tips/json').json() except Exception as e: return None return u'%s\n%s' % (tip['Content'], tip['Comment'], )
# coding: utf-8 import requests from redis_wrap import get_hash from rq.decorators import job def vimtips(msg=None): try: existing_tips = get_hash('vimtips') _len = len(existing_tips) if _len > 0: _index = randint(0, _len - 1) _k = existing_tips.keys()[_index] ...
Use RQ to queue collecting job
Use RQ to queue collecting job
Python
bsd-2-clause
JokerQyou/bot
16d0f3f0ca4ce59f08e598b6f9f25bb6dc8e1713
benchmark/benchmark.py
benchmark/benchmark.py
import time import sys from utils import format_duration if sys.platform == "win32": default_timer = time.clock else: default_timer = time.time class Benchmark(): def __init__(self, func, name="", repeat=5): self.func = func self.repeat = repeat self.name = name self.verb...
import time import sys from utils import format_duration if sys.platform == "win32": default_timer = time.clock else: default_timer = time.time class Benchmark(): def __init__(self, func, name="", repeat=5): self.func = func self.repeat = repeat self.name = name self.verb...
Fix bad console output formatting
Fix bad console output formatting
Python
mit
jameshy/libtree,conceptsandtraining/libtree
2cf8d03324af2fadf905da811cfab4a29a6bc93a
pony_barn/settings/django_settings.py
pony_barn/settings/django_settings.py
DATABASES = { 'default': { 'ENGINE': '{{ db_engine }}', 'NAME': '{{ db_name }}', 'USER': '{{ db_user}}', 'PASSWORD': '{{ db_pass }}', }, 'other': { 'ENGINE': 'django.db.backends.sqlite3', 'TEST_NAME': 'other_db' } }
import os pid = os.getpid() DATABASES = { 'default': { 'ENGINE': '{{ db_engine }}', 'NAME': '{{ db_name }}', 'USER': '{{ db_user}}', 'PASSWORD': '{{ db_pass }}', }, 'other': { 'ENGINE': 'django.db.backends.sqlite3', 'TEST_NAME': 'other_db_%s' % pid, } }
Append PID to Django database to avoid conflicts.
Append PID to Django database to avoid conflicts.
Python
mit
ericholscher/pony_barn,ericholscher/pony_barn
0d8a28b62c4e54ee84861da75b0f0626bc4e46e7
get_data_from_twitter.py
get_data_from_twitter.py
# -*- coding: UTF-8 -*- import numpy from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream import json import config #Much of this code comes from http://adilmoujahid.com/posts/2014/07/twitter-analytics/ class StdOutListener(StreamListener): def on_data(self, data_...
# -*- coding: UTF-8 -*- import numpy from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream import json import config #Much of this code comes from http://adilmoujahid.com/posts/2014/07/twitter-analytics/ class StdOutListener(StreamListener): def on_data(self, data_...
Add back filter for Hillary2016
Add back filter for Hillary2016
Python
mpl-2.0
aDataAlchemist/election-tweets
8f1fd73d6a88436d24f936adec997f88ad7f1413
neutron/tests/unit/objects/test_l3agent.py
neutron/tests/unit/objects/test_l3agent.py
# Copyright (c) 2016 Intel Corporation. # # 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 la...
# Copyright (c) 2016 Intel Corporation. # # 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 la...
Use unique binding_index for RouterL3AgentBinding
Use unique binding_index for RouterL3AgentBinding This is because (router_id, binding_index) tuple is expected to be unique, as per db model. Closes-Bug: #1674434 Change-Id: I64fcee88f2ac942e6fa173644fbfb7655ea6041b
Python
apache-2.0
openstack/neutron,mahak/neutron,noironetworks/neutron,huntxu/neutron,eayunstack/neutron,openstack/neutron,huntxu/neutron,eayunstack/neutron,mahak/neutron,mahak/neutron,openstack/neutron,noironetworks/neutron
867a8081646eb061555eda2471c5174a842dd6fd
tests/test_floodplain.py
tests/test_floodplain.py
from unittest import TestCase import niche_vlaanderen as nv import numpy as np import rasterio class TestFloodPlain(TestCase): def test__calculate(self): fp = nv.FloodPlain() fp._calculate(depth=np.array([1, 2, 3]), frequency="T25", period="winter", duration=1) np.test...
from unittest import TestCase import niche_vlaanderen as nv import numpy as np import rasterio class TestFloodPlain(TestCase): def test__calculate(self): fp = nv.FloodPlain() fp._calculate(depth=np.array([1, 2, 3]), frequency="T25", period="winter", duration=1) np.test...
Fix tests for running floodplain model in ci
Fix tests for running floodplain model in ci
Python
mit
johanvdw/niche_vlaanderen
fc8ac6ba5081e7847847d31588a65db8ea13416c
openprescribing/matrixstore/build/dates.py
openprescribing/matrixstore/build/dates.py
DEFAULT_NUM_MONTHS = 60 def generate_dates(end_str, months=None): """ Given an end date as a string in YYYY-MM form (or the underscore separated equivalent), return a list of N consecutive months as strings in YYYY-MM-01 form, with that month as the final member """ if months is None: ...
DEFAULT_NUM_MONTHS = 60 def generate_dates(end_str, months=None): """ Given an end date as a string in YYYY-MM form (or the underscore separated equivalent), return a list of N consecutive months as strings in YYYY-MM-01 form, with that month as the final member """ if months is None: ...
Fix another py27-ism which Black can't handle
Fix another py27-ism which Black can't handle Not sure how I missed this one last time.
Python
mit
ebmdatalab/openprescribing,ebmdatalab/openprescribing,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc
68aeddc44d4c9ace7ab9d2475a92c5fd39b4a665
ckanext/requestdata/controllers/request_data.py
ckanext/requestdata/controllers/request_data.py
from ckan.lib import base from ckan.common import c, _ from ckan import logic from ckanext.requestdata import emailer from ckan.plugins import toolkit import ckan.model as model import ckan.plugins as p import json get_action = logic.get_action NotFound = logic.NotFound NotAuthorized = logic.NotAuthorized ValidationEr...
from ckan.lib import base from ckan.common import c, _ from ckan import logic from ckanext.requestdata import emailer from ckan.plugins import toolkit import ckan.model as model import ckan.plugins as p import json get_action = logic.get_action NotFound = logic.NotFound NotAuthorized = logic.NotAuthorized ValidationEr...
Remove user_mail from request data
Remove user_mail from request data
Python
agpl-3.0
ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata
73b61983de6ff655b4f11205c0acd2b2f92915f4
eva/util/nutil.py
eva/util/nutil.py
import numpy as np def to_rgb(pixels): return np.repeat(pixels, 3 if pixels.shape[2] == 1 else 1, 2) def binarize(arr, generate=np.random.uniform): """ Stochastically binarize values in [0, 1] by treating them as p-values of a Bernoulli distribution. """ return (generate(size=arr.shape) < arr...
import numpy as np def to_rgb(pixels): return np.repeat(pixels, 3 if pixels.shape[2] == 1 else 1, 2) def binarize(arr, generate=np.random.uniform): return (generate(size=arr.shape) < arr).astype('i')
Remove comment; change to int
Remove comment; change to int
Python
apache-2.0
israelg99/eva
a24c657ca84e553a39e23d201d605d84d828c322
examples/hello.py
examples/hello.py
from cell import Actor, Agent from cell.actors import Server from kombu import Connection from kombu.log import setup_logging connection = Connection() class GreetingActor(Server): default_routing_key = 'GreetingActor' class state: def greet(self, who='world'): return 'Hello %s' % who...
from cell import Actor, Agent from cell.actors import Server from kombu import Connection from kombu.log import setup_logging connection = Connection() class GreetingActor(Server): default_routing_key = 'GreetingActor' class state: def greet(self, who='world'): return 'Hello %s' % who ...
Use the Server class (an Actor derived class)
Use the Server class (an Actor derived class)
Python
bsd-3-clause
celery/cell,celery/cell
d70ccd856bb4ddb061ff608716ef15f778380d62
gnsq/stream/defalte.py
gnsq/stream/defalte.py
from __future__ import absolute_import import zlib from .compression import CompressionSocket class DefalteSocket(CompressionSocket): def __init__(self, socket, level): self._decompressor = zlib.decompressobj(level) self._compressor = zlib.compressobj(level) super(DefalteSocket, self).__i...
from __future__ import absolute_import import zlib from .compression import CompressionSocket class DefalteSocket(CompressionSocket): def __init__(self, socket, level): wbits = -zlib.MAX_WBITS self._decompressor = zlib.decompressobj(wbits) self._compressor = zlib.compressobj(level, zlib.D...
Set correct waits for deflate.
Set correct waits for deflate.
Python
bsd-3-clause
wtolson/gnsq,hiringsolved/gnsq,wtolson/gnsq
02ca8bc5908b0ff15cd97846e1fd1488eddb4087
backend/schedule/models.py
backend/schedule/models.py
from django.db import models class Event(models.Model): setup_start = models.DateField setup_end = model.DateField event_start = model.DateField event_end = model.DateField teardown_start = model.DateField teardown_end = model.DateField needed_resources = models.ManyToMany(Resource) sta...
from django.db import models class Event(models.Model): setup_start = models.DateField setup_end = model.DateField event_start = model.DateField event_end = model.DateField teardown_start = model.DateField teardown_end = model.DateField needed_resources = models.ManyToMany(Resource) sta...
Add square feet to Location data model.
Add square feet to Location data model.
Python
mit
bable5/schdlr,bable5/schdlr,bable5/schdlr,bable5/schdlr
1fbb58a3f6692a7467f758ccedca6f8baa96a165
text/__init__.py
text/__init__.py
#! /usr/bin/env python import os def get_files(path, ext=None): """ Get all files in directory path, optionally with the specified extension """ if ext is None: ext = '' return [ os.path.abspath(fname) for fname in os.listdir(path) if os.path.isfile(fname) ...
#! /usr/bin/env python import os import re def get_files(path, ext=None): """ Get all files in directory path, optionally with the specified extension """ if ext is None: ext = '' return [ os.path.abspath(fname) for fname in os.listdir(path) if os.path.isfile(fnam...
Add function to get the functions / classes that are defined
Add function to get the functions / classes that are defined
Python
mit
IanLee1521/utilities
8e75605e0511b85dfd500b644613739f29705da6
cfnf.py
cfnf.py
import sublime, sublime_plugin import time class cfnewfile(sublime_plugin.TextCommand): def run(self, edit): localtime = time.asctime( time.localtime(time.time()) ) self.view.insert(edit,0,"<!---\r\n Name:\r\n Description:\r\n Written By:\r\n Date Created: "+localtime+"\r\n History:\r\n--->\r\n")
import sublime, sublime_plugin import time class cfnfCommand(sublime_plugin.WindowCommand): def run(self): a = self.window.new_file() a.run_command("addheader") class addheaderCommand(sublime_plugin.TextCommand): def run(self, edit): localtime = time.asctime( time.localtime(time.time()) ) sel...
Send text to new file
Send text to new file
Python
bsd-2-clause
dwkd/SublimeCFNewFile
99af762edb7a8fa4b0914bdf157af151a814adb6
backend/api.py
backend/api.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import json import boto3 table_name = os.environ.get("TABLE_NAME") table = boto3.resource("dynamodb").Table(table_name) def _log_dynamo(response): print "HTTPStatusCode:{}, RetryAttempts:{}, ScannedCount:{}, Count:{}".format( response.get("ResponseM...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import json import boto3 table_name = os.environ.get("TABLE_NAME") table = boto3.resource("dynamodb").Table(table_name) def _log_dynamo(response): print "HTTPStatusCode:{}, RetryAttempts:{}, ScannedCount:{}, Count:{}".format( response.get("ResponseM...
Add CORS header to function
Add CORS header to function
Python
mit
Vilsepi/no-servers,Vilsepi/no-servers,Vilsepi/no-servers,Vilsepi/no-servers
6589df70baad1b57c604736d75e424465cf8775e
djangoautoconf/auto_conf_admin_tools/reversion_feature.py
djangoautoconf/auto_conf_admin_tools/reversion_feature.py
from djangoautoconf.auto_conf_admin_tools.admin_feature_base import AdminFeatureBase from django.conf import settings __author__ = 'weijia' class ReversionFeature(AdminFeatureBase): def __init__(self): super(ReversionFeature, self).__init__() self.related_search_fields = {} def process_paren...
from djangoautoconf.auto_conf_admin_tools.admin_feature_base import AdminFeatureBase from django.conf import settings __author__ = 'weijia' class ReversionFeature(AdminFeatureBase): def __init__(self): super(ReversionFeature, self).__init__() self.related_search_fields = {} def process_paren...
Fix import issue for Django 1.5 above
Fix import issue for Django 1.5 above
Python
bsd-3-clause
weijia/djangoautoconf,weijia/djangoautoconf
6df7ee955c7dfaee9a597b331dbc4c448fe3738a
fpr/migrations/0017_ocr_unique_names.py
fpr/migrations/0017_ocr_unique_names.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def data_migration(apps, schema_editor): """Migration that causes each OCR text file to include the UUID of its source file in its filename. This prevents OCR text files from overwriting one another when the...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def data_migration(apps, schema_editor): """Migration that causes each OCR text file to include the UUID of its source file in its filename. This prevents OCR text files from overwriting one another when the...
Fix OCR command UUID typo
Fix OCR command UUID typo
Python
agpl-3.0
artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin
8c49359a79d815cc21acbd58adc36c52d75e20b7
dash2012/auth/views.py
dash2012/auth/views.py
from django.http import HttpResponseRedirect from django.shortcuts import render from django.core.urlresolvers import reverse from django.contrib.auth import authenticate, login as auth_login, logout as auth_logout from django.contrib.auth.decorators import login_required from cloudfish.models import Cloud def login(...
from django.http import HttpResponseRedirect from django.shortcuts import render from django.core.urlresolvers import reverse from django.contrib.auth import authenticate, login as auth_login, logout as auth_logout from django.contrib.auth.decorators import login_required from cloudfish.models import Cloud def login(...
Add login failed flash message
Add login failed flash message
Python
bsd-3-clause
losmiserables/djangodash2012,losmiserables/djangodash2012
e170a96859232d1436930be7a0cbfc7f2295c8a7
main.py
main.py
from twisted.internet import reactor from twisted.web import server, resource from teiler.server import FileServerResource from teiler.client import FileRequestResource import sys from twisted.python import log class HelloResource(resource.Resource): isLeaf = False numberRequests = 0 def render_GET(self...
from twisted.internet import reactor from twisted.web import server, resource from teiler.server import FileServerResource from teiler.client import FileRequestResource import sys from twisted.python import log class HelloResource(resource.Resource): isLeaf = False numberRequests = 0 def render_GET(self...
Set root resource to welcome
Set root resource to welcome
Python
mit
derwolfe/teiler,derwolfe/teiler
73b6a84cfc0ccc20d04c3dd80c3e505cd118be4d
nsfw.py
nsfw.py
import random from discord.ext import commands from lxml import etree class NSFW: def __init__(self, bot): self.bot = bot @commands.command(aliases=['gel']) async def gelbooru(self, ctx, *, tags): async with ctx.typing(): entries = [] url = 'http://gelbooru.com/in...
import random from discord.ext import commands from lxml import etree class NSFW: def __init__(self, bot): self.bot = bot @commands.command(aliases=['gel'], hidden=True) async def gelbooru(self, ctx, *, tags): async with ctx.typing(): entries = [] url = 'http://ge...
Make command invisible by default
Make command invisible by default
Python
mit
BeatButton/beattie-bot,BeatButton/beattie
22e6cce28da8a700bd4cd45aa47913aaff559a9d
functional_tests/management/commands/create_testrecipe.py
functional_tests/management/commands/create_testrecipe.py
from django.conf import settings from django.core.management.base import BaseCommand from django.core.management import call_command import random import string from recipes.models import Recipe class Command(BaseCommand): def handle(self, *args, **options): r = Recipe(name=''.join(random.choice(string.asc...
import datetime from django.conf import settings from django.core.management.base import BaseCommand from django.core.management import call_command import random import string from recipes.models import Recipe class Command(BaseCommand): def handle(self, *args, **options): r = Recipe(name=''.join(random.c...
Make sure that recipes created by the command show up
Make sure that recipes created by the command show up
Python
agpl-3.0
XeryusTC/rotd,XeryusTC/rotd,XeryusTC/rotd
f96990118d51b56ad438a8efbf2a7f83ec0f3c63
conference_scheduler/tests/test_parameters.py
conference_scheduler/tests/test_parameters.py
from conference_scheduler import parameters def test_variables(shape): X = parameters.variables(shape) assert len(X) == 21 def test_schedule_all_events(shape, X): constraints = [c for c in parameters._schedule_all_events(shape, X)] assert len(constraints) == 3 def test_max_one_event_per_slot(shape...
from conference_scheduler import parameters import numpy as np def test_tags(events): tags = parameters.tags(events) assert np.array_equal(tags, np.array([[1, 0], [1, 1], [0, 1]])) def test_variables(shape): X = parameters.variables(shape) assert len(X) == 21 def test_schedule_all_events(shape, X): ...
Add failing test to function to build tags matrix.
Add failing test to function to build tags matrix.
Python
mit
PyconUK/ConferenceScheduler
24e65db624221d559f46ce74d88ad28ec970d754
profile_collection/startup/00-startup.py
profile_collection/startup/00-startup.py
import logging session_mgr._logger.setLevel(logging.INFO) from dataportal import (DataBroker as db, StepScan as ss, DataBroker, StepScan, DataMuxer) from bluesky.standard_config import * from ophyd.commands import * gs.RE.md['config'] = {} gs.RE.md['owner'] = 'xf28id1'...
import logging session_mgr._logger.setLevel(logging.INFO) from dataportal import (DataBroker as db, StepScan as ss, DataBroker, StepScan, DataMuxer) from bluesky.standard_config import * from ophyd.commands import * gs.RE.md['config'] = {} gs.RE.md['owner'] = 'xf28id1'...
Update bluesky's API to the qt_kicker.
Update bluesky's API to the qt_kicker.
Python
bsd-2-clause
NSLS-II-XPD/ipython_ophyd,pavoljuhas/ipython_ophyd,pavoljuhas/ipython_ophyd,NSLS-II-XPD/ipython_ophyd
54b2a6953a4da2b217052d166ad1f069f683b9ee
scripts/nomenclature/nomenclature_map.py
scripts/nomenclature/nomenclature_map.py
"""Create a map from the input binomials to their ITIS accepted synonyms. """ import pandas as pd itis_results = pd.read_csv("search_result.csv", encoding = "ISO-8859-1")
"""Create a map from the input binomials to their ITIS accepted synonyms. """ import pandas as pd from PyFloraBook.in_out.data_coordinator import locate_nomenclature_folder # Globals INPUT_FILE_NAME = "search_results.csv" # Input nomenclature_folder = locate_nomenclature_folder() itis_results = pd.read_csv( str...
Implement locator in nomenclature map
Implement locator in nomenclature map
Python
mit
jnfrye/local_plants_book
b77e39b21a326655a04dbd15fcacfd2cc57a6008
core/emails.py
core/emails.py
from django.core.mail import EmailMessage from django.template.loader import render_to_string def notify_existing_user(user, event): """ Sends e-mail to existing organizer, that they're added to the new Event. """ content = render_to_string('emails/existing_user.html', { 'user': user, ...
from django.core.mail import EmailMessage from django.template.loader import render_to_string def notify_existing_user(user, event): """ Sends e-mail to existing organizer, that they're added to the new Event. """ content = render_to_string('emails/existing_user.html', { 'user': user, ...
Fix broken order of arguments in send_email
Fix broken order of arguments in send_email Ticket #342
Python
bsd-3-clause
patjouk/djangogirls,patjouk/djangogirls,patjouk/djangogirls,DjangoGirls/djangogirls,patjouk/djangogirls,DjangoGirls/djangogirls,DjangoGirls/djangogirls
badddd6aa9533a01e07477174dc7422ee4941014
wsgi.py
wsgi.py
# Yith Library Server is a password storage server. # Copyright (C) 2015 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com> # # This file is part of Yith Library Server. # # Yith Library Server is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as publ...
# Yith Library Server is a password storage server. # Copyright (C) 2015 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com> # # This file is part of Yith Library Server. # # Yith Library Server is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as publ...
Read the conf file using absolute paths
Read the conf file using absolute paths
Python
agpl-3.0
lorenzogil/yith-library-server,lorenzogil/yith-library-server,lorenzogil/yith-library-server
a6300723150d7d1ff9a58f4f3f1297e0fe2c6f78
css_updater/git/manager.py
css_updater/git/manager.py
"""manages github repos""" import os import tempfile from typing import Dict, Any import pygit2 as git from .webhook.handler import Handler class Manager(object): """handles git repos""" def __init__(self: Manager, handler: Handler) -> None: self.webhook_handler: Handler = handler self.temp...
"""manages github repos""" import os import tempfile from typing import Dict, Any import pygit2 as git from .webhook.handler import Handler class Manager(object): """handles git repos""" def __init__(self: Manager, handler: Handler) -> None: self.webhook_handler: Handler = handler self.temp...
Check for errors in config
Check for errors in config
Python
mit
neoliberal/css-updater
3d64eb4a7438b6b4f46f1fdf7f47d530cb11b09c
spacy/tests/regression/test_issue2396.py
spacy/tests/regression/test_issue2396.py
# coding: utf-8 from __future__ import unicode_literals from ..util import get_doc import pytest import numpy @pytest.mark.parametrize('sentence,matrix', [ ( 'She created a test for spacy', numpy.array([ [0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 2, 3, 3, 3...
# coding: utf-8 from __future__ import unicode_literals from ..util import get_doc import pytest import numpy from numpy.testing import assert_array_equal @pytest.mark.parametrize('words,heads,matrix', [ ( 'She created a test for spacy'.split(), [1, 0, 1, -2, -1, -1], numpy.array([ ...
Update get_lca_matrix test for develop
Update get_lca_matrix test for develop
Python
mit
explosion/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,honnibal/spaCy,honnibal/spaCy,spacy-io/spaCy,honnibal/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy