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
b45c0cc0e9f2964ad442115f7a83292fb83611ec
test/vim_autopep8.py
test/vim_autopep8.py
"""Run autopep8 on the selected buffer in Vim. map <C-I> :pyfile <path_to>/vim_autopep8.py<CR> Replace ":pyfile" with ":py3file" if Vim is built with Python 3 support. """ from __future__ import unicode_literals import sys import vim ENCODING = vim.eval('&fileencoding') def encode(text): if sys.version_in...
"""Run autopep8 on the selected buffer in Vim. map <C-I> :pyfile <path_to>/vim_autopep8.py<CR> Replace ":pyfile" with ":py3file" if Vim is built with Python 3 support. """ from __future__ import unicode_literals import sys import vim ENCODING = vim.eval('&fileencoding') def encode(text): if sys.version_in...
Put code in main function
Put code in main function
Python
mit
SG345/autopep8,MeteorAdminz/autopep8,Vauxoo/autopep8,hhatto/autopep8,Vauxoo/autopep8,MeteorAdminz/autopep8,SG345/autopep8,vauxoo-dev/autopep8,vauxoo-dev/autopep8,hhatto/autopep8
222935ffc347f9787f08b50cccb1981151db5cec
test_jeni_python3.py
test_jeni_python3.py
import unittest import jeni from test_jeni import BasicInjector class Python3AnnotationTestCase(unittest.TestCase): def test_annotate_without_annotations(self): def fn(hello): "unused" jeni.annotate(fn) self.assertTrue(jeni.annotate.has_annotations(fn)) @jeni.annotate def a...
import unittest import jeni from test_jeni import BasicInjector class Python3AnnotationTestCase(unittest.TestCase): def test_annotate_without_annotations(self): def fn(hello): "unused" jeni.annotate(fn) self.assertTrue(jeni.annotate.has_annotations(fn)) def test_annotate...
Test for missing __annotations__ in Python 3.
Test for missing __annotations__ in Python 3.
Python
bsd-2-clause
groner/jeni-python,rduplain/jeni-python
1fc2e747f1c02d5b8559f03187464eecda008190
fernet_fields/test/testmigrate/migrations/0004_copy_values.py
fernet_fields/test/testmigrate/migrations/0004_copy_values.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def forwards(apps, schema_editor): DualText = apps.get_model('testmigrate', 'DualText') for obj in DualText.objects.all(): obj.value_dual = obj.value def backwards(apps, schema_editor): DualText = a...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def forwards(apps, schema_editor): DualText = apps.get_model('testmigrate', 'DualText') for obj in DualText.objects.all(): obj.value_dual = obj.value obj.save(force_update=True) def backwards(ap...
Fix test migration to actually save updates.
Fix test migration to actually save updates.
Python
bsd-3-clause
orcasgit/django-fernet-fields
e9941e34253768e33cbfa54ff2bb9cf2e8267e1d
workflow-diagnosetargets.py
workflow-diagnosetargets.py
#!/usr/bin/env python # Standard packages import sys import argparse # Third-party packages from toil.job import Job # Package methods from ddb import configuration from ddb_ngsflow import gatk from ddb_ngsflow import pipeline if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argumen...
#!/usr/bin/env python # Standard packages import sys import argparse # Third-party packages from toil.job import Job # Package methods from ddb import configuration from ddb_ngsflow import gatk from ddb_ngsflow import pipeline if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argumen...
Tweak to bam file name calling
Tweak to bam file name calling
Python
mit
dgaston/ddb-scripts,GastonLab/ddb-scripts,dgaston/ddb-ngsflow-scripts
dc6d9ec75ffb2ac776d10a924395d05284bc031e
tests/test_compat.py
tests/test_compat.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_compat ------------ Tests for `cookiecutter.compat` module. """ from cookiecutter.compat import unittest, which def test_existing_command(): assert which('cookiecutter') def test_non_existing_command(): assert not which('stringthatisntashellcommand')...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_compat ------------ Tests for `cookiecutter.compat` module. """ from cookiecutter.compat import which def test_existing_command(): assert which('cookiecutter') def test_non_existing_command(): assert not which('stringthatisntashellcommand')
Remove unused import of compat unittest
Remove unused import of compat unittest
Python
bsd-3-clause
luzfcb/cookiecutter,jhermann/cookiecutter,christabor/cookiecutter,terryjbates/cookiecutter,audreyr/cookiecutter,agconti/cookiecutter,vincentbernat/cookiecutter,kkujawinski/cookiecutter,atlassian/cookiecutter,foodszhang/cookiecutter,lucius-feng/cookiecutter,nhomar/cookiecutter,benthomasson/cookiecutter,ionelmc/cookiecut...
55af2016102ec16a4ec3878f45306e3ac4d520e6
qingcloud/cli/iaas_client/actions/instance/reset_instances.py
qingcloud/cli/iaas_client/actions/instance/reset_instances.py
# coding: utf-8 from qingcloud.cli.misc.utils import explode_array from qingcloud.cli.iaas_client.actions.base import BaseAction class ResetInstancesAction(BaseAction): action = 'ResetInstances' command = 'reset-instances' usage = '%(prog)s -i "instance_id, ..." [-f <conf_file>]' @classmethod d...
# coding: utf-8 from qingcloud.cli.misc.utils import explode_array from qingcloud.cli.iaas_client.actions.base import BaseAction class ResetInstancesAction(BaseAction): action = 'ResetInstances' command = 'reset-instances' usage = '%(prog)s -i "instance_id, ..." [-f <conf_file> -m <login_mode> -p <login...
Add login mode to reset-instances
Add login mode to reset-instances
Python
apache-2.0
yunify/qingcloud-cli
270d06c880fe72987b82fe00f234852e8d49eca0
icekit/plugins/image_gallery/content_plugins.py
icekit/plugins/image_gallery/content_plugins.py
""" Definition of the plugin. """ from django.utils.translation import ugettext_lazy as _ from fluent_contents.extensions import ContentPlugin, plugin_pool from . import models @plugin_pool.register class ImageGalleryPlugin(ContentPlugin): model = models.ImageGalleryShowItem category = _('Assets') render...
""" Definition of the plugin. """ from django.utils.translation import ugettext_lazy as _ from fluent_contents.extensions import ContentPlugin, plugin_pool from . import models @plugin_pool.register class ImageGalleryPlugin(ContentPlugin): model = models.ImageGalleryShowItem category = _('Assets') render...
Remove invalid reference to unnecessary JS for image gallery plugin
Remove invalid reference to unnecessary JS for image gallery plugin
Python
mit
ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit
8f4d0247b56ae157e8486c37e38992015e55ac3e
skimage/io/_plugins/matplotlib_plugin.py
skimage/io/_plugins/matplotlib_plugin.py
import matplotlib.pyplot as plt def imshow(*args, **kwargs): if plt.gca().has_data(): plt.figure() kwargs.setdefault('interpolation', 'nearest') kwargs.setdefault('cmap', 'gray') plt.imshow(*args, **kwargs) imread = plt.imread show = plt.show def _app_show(): show()
import matplotlib.pyplot as plt def imshow(im, *args, **kwargs): """Show the input image and return the current axes. Parameters ---------- im : array, shape (M, N[, 3]) The image to display. *args, **kwargs : positional and keyword arguments These are passed directly to `matplot...
Add docstring to matplotlib imshow plugin
Add docstring to matplotlib imshow plugin The image is now named as an argument, and the axes are returned, in keeping with matplotlib convention.
Python
bsd-3-clause
emon10005/scikit-image,vighneshbirodkar/scikit-image,ofgulban/scikit-image,Midafi/scikit-image,bennlich/scikit-image,chriscrosscutler/scikit-image,dpshelio/scikit-image,emon10005/scikit-image,ofgulban/scikit-image,newville/scikit-image,WarrenWeckesser/scikits-image,Britefury/scikit-image,juliusbierk/scikit-image,GaZ3ll...
1c3d4488566576e3181f7acbf902f0adab3876dd
api/spawner/templates/constants.py
api/spawner/templates/constants.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from django.conf import settings from polyaxon_schemas.polyaxonfile import constants JOB_NAME = 'plxjob-{task_type}{task_idx}-{experiment_uuid}' DEFAULT_PORT = 2222 ENV_VAR_TEMPLATE = '{name: "{var_name}", value: "{var_value}"}' ...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from django.conf import settings JOB_NAME = 'plxjob-{task_type}{task_idx}-{experiment_uuid}' DEFAULT_PORT = 2222 ENV_VAR_TEMPLATE = '{name: "{var_name}", value: "{var_value}"}' VOLUME_NAME = 'pv-{vol_name}' VOLUME_CLAIM_NAME = 'p...
Update naming for spawner jobs
Update naming for spawner jobs
Python
apache-2.0
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
3607309193c5d8b2b5ce0fd98d976b6e6aa49644
test/test_client.py
test/test_client.py
import pytest from numpy import random, ceil from lightning import Lightning, Visualization class TestLightningAPIClient(object): @pytest.fixture(scope="module") def lgn(self, host): lgn = Lightning(host) lgn.create_session("test-session") return lgn def test_create_generic(self,...
import pytest from numpy import random, ceil from lightning import Lightning, Visualization, VisualizationLocal class TestLightningAPIClient(object): @pytest.fixture(scope="module") def lgn(self, host): lgn = Lightning(host) lgn.create_session("test-session") return lgn def test_...
Add test for local visualization
Add test for local visualization
Python
mit
garretstuber/lightning-python,garretstuber/lightning-python,peterkshultz/lightning-python,lightning-viz/lightning-python,garretstuber/lightning-python,lightning-viz/lightning-python,peterkshultz/lightning-python,peterkshultz/lightning-python
427931c5c8847d01e4ce563a9c605a78eceb39f3
amplpy/amplpython/__init__.py
amplpy/amplpython/__init__.py
# -*- coding: utf-8 -*- import os import sys import ctypes import platform if platform.system() == 'Windows': libbase = os.path.join(os.path.dirname(__file__), 'cppinterface', 'lib') lib32 = os.path.join(libbase, 'intel32') lib64 = os.path.join(libbase, 'amd64') from glob import glob try: i...
# -*- coding: utf-8 -*- import os import sys import ctypes import platform if platform.system().startswith(('Windows', 'MSYS', 'CYGWIN', 'MINGW')): libbase = os.path.join(os.path.dirname(__file__), 'cppinterface', 'lib') lib32 = os.path.join(libbase, 'intel32') lib64 = os.path.join(libbase, 'amd64') fr...
Add basic support for MSYS, CYGWIN, and MINGW
Add basic support for MSYS, CYGWIN, and MINGW
Python
bsd-3-clause
ampl/amplpy,ampl/amplpy,ampl/amplpy
0673df239d14edb8d65c17eaa8291ac26fd0b976
test_skewstudent.py
test_skewstudent.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Testing suite for ARG class. """ from __future__ import print_function, division import unittest as ut import numpy as np from skewstudent import SkewStudent __author__ = "Stanislav Khrapov" __email__ = "khrapovs@gmail.com" class ARGTestCase(ut.TestCase): """T...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Testing suite for SkewStudent class. """ from __future__ import print_function, division import unittest as ut import numpy as np from skewstudent import SkewStudent __author__ = "Stanislav Khrapov" __email__ = "khrapovs@gmail.com" class ARGTestCase(ut.TestCase): ...
Fix title in the test
Fix title in the test
Python
mit
khrapovs/skewstudent
3d5de4b69be9d99fec4a8ffb46338f0684ffac26
api/base/waffle_decorators.py
api/base/waffle_decorators.py
import waffle from rest_framework.exceptions import NotFound def require_flag(flag_name): """ Decorator to check whether flag is active. If inactive, raise NotFound. """ def wrapper(fn): def check_flag(*args,**kwargs): if waffle.flag_is_active(args[0].request, flag_name): ...
import waffle from rest_framework.exceptions import NotFound def require_flag(flag_name): """ Decorator to check whether waffle flag is active. If inactive, raise NotFound. """ def wrapper(fn): def check_flag(*args,**kwargs): if waffle.flag_is_active(args[0].request, flag_name)...
Add switch and sample decorators.
Add switch and sample decorators.
Python
apache-2.0
brianjgeiger/osf.io,HalcyonChimera/osf.io,chennan47/osf.io,laurenrevere/osf.io,adlius/osf.io,mfraezz/osf.io,binoculars/osf.io,pattisdr/osf.io,binoculars/osf.io,brianjgeiger/osf.io,felliott/osf.io,laurenrevere/osf.io,aaxelb/osf.io,cslzchen/osf.io,aaxelb/osf.io,caseyrollins/osf.io,pattisdr/osf.io,erinspace/osf.io,mfraezz...
66e16d6e3d80ab81967232d5d154c64c8e277def
robotpy_ext/misc/periodic_filter.py
robotpy_ext/misc/periodic_filter.py
import logging import wpilib class PeriodicFilter: """ Periodic Filter to help keep down clutter in the console. Simply add this filter to your logger and the logger will only print periodically. The logger will always print logging levels of WARNING or higher """ def __i...
import logging import wpilib class PeriodicFilter: """ Periodic Filter to help keep down clutter in the console. Simply add this filter to your logger and the logger will only print periodically. The logger will always print logging levels of WARNING or higher """ def __i...
Allow user to select bypass level
Allow user to select bypass level
Python
bsd-3-clause
Twinters007/robotpy-wpilib-utilities,robotpy/robotpy-wpilib-utilities,robotpy/robotpy-wpilib-utilities,Twinters007/robotpy-wpilib-utilities
56a89d57824d3bd25ac235a8e360d528edd9a7cf
test/factories/blogpost_factory.py
test/factories/blogpost_factory.py
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2013 SF Isle of Man Limited # # PyBossa 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...
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2013 SF Isle of Man Limited # # PyBossa 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 for nullable author in blogpost factory
Fix for nullable author in blogpost factory
Python
agpl-3.0
OpenNewsLabs/pybossa,proyectos-analizo-info/pybossa-analizo-info,proyectos-analizo-info/pybossa-analizo-info,geotagx/pybossa,inteligencia-coletiva-lsd/pybossa,jean/pybossa,proyectos-analizo-info/pybossa-analizo-info,harihpr/tweetclickers,stefanhahmann/pybossa,OpenNewsLabs/pybossa,Scifabric/pybossa,inteligencia-coletiva...
4831c45b53d53d31a6514d5c3e2d0465283b4076
topological_sort.py
topological_sort.py
def topological_sort(): pass def main(): pass if __name__ == '__main__': main()
def topological_sort_recur(): """Topological Sorting by Recursion.""" pass def topological_sort(): """Topological Sorting for Directed Acyclic Graph (DAG).""" pass def main(): # DAG. adjacency_dict = { '0': {}, '1': {}, '2': {'3'}, '3': {'1'}, '4': {'0', '1'}, '5': {'0', '2'} } ...
Add topolofical_sort_recur(), 2 functions’s doc strings and DAG
Add topolofical_sort_recur(), 2 functions’s doc strings and DAG
Python
bsd-2-clause
bowen0701/algorithms_data_structures
7c69d30de5aa58d330a183a0e5015e67c36ca7bc
spacy/tests/regression/test_issue4674.py
spacy/tests/regression/test_issue4674.py
# coding: utf-8 from __future__ import unicode_literals from spacy.kb import KnowledgeBase from spacy.util import ensure_path from spacy.lang.en import English from spacy.tests.util import make_tempdir def test_issue4674(): """Test that setting entities with overlapping identifiers does not mess up IO""" nl...
# coding: utf-8 from __future__ import unicode_literals import pytest from spacy.kb import KnowledgeBase from spacy.util import ensure_path from spacy.lang.en import English from ..tests.util import make_tempdir def test_issue4674(): """Test that setting entities with overlapping identifiers does not mess up IO...
Tidy up and expect warning
Tidy up and expect warning
Python
mit
honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,spacy-io/spaCy,honnibal/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy
455cf39de018762d22b5d212f3a2c08491840bbf
tests/integration/cli/sync_test.py
tests/integration/cli/sync_test.py
from ...testcases import DustyIntegrationTestCase from ...fixtures import busybox_single_app_bundle_fixture class TestSyncCLI(DustyIntegrationTestCase): def setUp(self): super(TestSyncCLI, self).setUp() busybox_single_app_bundle_fixture() self.run_command('bundles activate busyboxa') ...
from ...testcases import DustyIntegrationTestCase from ...fixtures import busybox_single_app_bundle_fixture class TestSyncCLI(DustyIntegrationTestCase): def setUp(self): super(TestSyncCLI, self).setUp() busybox_single_app_bundle_fixture() self.run_command('bundles activate busyboxa') ...
Fix ordering problem in tearDown
Fix ordering problem in tearDown
Python
mit
gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty
6a330523ad683b7883cefa3878c7690fcb5dbd75
TalkingToYouBot.py
TalkingToYouBot.py
from telegram import Updater import json import os def getToken(): token = [] if not os.path.exists(file_path): token.append(input('Insert Token here: ')) with open('token.json', 'w') as f: json.dump(token, f) else: with open("token.json") as f: token = json...
from telegram import Updater import json import os def getToken(): token = [] if not os.path.exists(file_path): token.append(input('Insert Token here: ')) with open('token.json', 'w') as f: json.dump(token, f) else: with open("token.json") as f: token = json...
Add simple Echo function and Bot initialisation
Add simple Echo function and Bot initialisation
Python
mit
h4llow3En/IAmTalkingToYouBot
86a7b0e989e983063a1ff5afd098600bf34da401
ixwsauth_server/api.py
ixwsauth_server/api.py
""" Tastypie API Authorization handlers """ from tastypie.authentication import Authentication from tastypie.authorization import Authorization class ApplicationAuthentication(Authentication): """ Authenticate the API request by checking the application key. """ def is_authenticated(self, request, **...
""" Tastypie API Authorization handlers """ from tastypie.authentication import Authentication from tastypie.authorization import Authorization class ApplicationAuthentication(Authentication): """ Authenticate the API request by checking the application key. """ def is_authenticated(self, request, **...
Add the consumer key to the identifier
Add the consumer key to the identifier Used for rate limiting by API key. Refs #17338
Python
mit
infoxchange/ixwsauth
07d62f1e9525719be48d862a86f3623368c02d9d
kuryr/lib/constants.py
kuryr/lib/constants.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Change DEVICE_OWNER to make it more Neutron compliant
Change DEVICE_OWNER to make it more Neutron compliant Change-Id: Id7a2973928c6df9e134e7b91000e90f244066703
Python
apache-2.0
openstack/kuryr,openstack/kuryr
eb63b0979763375522bc71ce2f06fb625151ea08
MoMMI/Modules/wyci.py
MoMMI/Modules/wyci.py
import random import re from typing import Match from discord import Message from MoMMI import master, always_command, MChannel @always_command("wyci") async def wyci(channel: MChannel, _match: Match, message: Message) -> None: match = re.search(r"\S\s+when[\s*?.!)]*$", message.content, re.IGNORECASE) if match...
import random import re from typing import Match from discord import Message from MoMMI import master, always_command, MChannel @always_command("wyci") async def wyci(channel: MChannel, _match: Match, message: Message) -> None: if not channel.server_config("wyci.enabled", True): return match = re....
Add config to disable WYCI.
Add config to disable WYCI.
Python
mit
PJB3005/MoMMI,PJB3005/MoMMI,PJB3005/MoMMI
da9058064e2a94f717abe2f97af80d2daa4fa292
likert_field/models.py
likert_field/models.py
#-*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from django.utils.translation import ugettext_lazy as _ import likert_field.forms as forms class LikertField(models.IntegerField): """A Likert field is simply stored as an IntegerField""" description = _('Likert item...
#-*- coding: utf-8 -*- from __future__ import unicode_literals from six import string_types from django.db import models from django.utils.translation import ugettext_lazy as _ import likert_field.forms as forms class LikertField(models.IntegerField): """A Likert field is simply stored as an IntegerField""" ...
Handle empty strings from unanswered items
Handle empty strings from unanswered items
Python
bsd-3-clause
kelvinwong-ca/django-likert-field,kelvinwong-ca/django-likert-field
22855458c7c683353f2ed7b577289b63da8bc9c6
src/scikit-cycling/skcycling/utils/io_fit.py
src/scikit-cycling/skcycling/utils/io_fit.py
import numpy as np from fitparse import FitFile def load_power_from_fit(filename): """ Method to open the power data from FIT file into a numpy array. Parameters ---------- filename: str, Path to the FIT file. """ # Check that the filename has the good extension if filename.endsw...
import numpy as np from fitparse import FitFile def load_power_from_fit(filename): """ Method to open the power data from FIT file into a numpy array. Parameters ---------- filename: str, Path to the FIT file. """ # Check that the filename has the good extension if filename.endsw...
Solve the issue of the power got disconnected during the ride
Solve the issue of the power got disconnected during the ride
Python
mit
glemaitre/power-profile,glemaitre/power-profile,clemaitre58/power-profile,clemaitre58/power-profile
844e3635aeb0144f7e4cc0d9de3bfc219312bbe5
ocradmin/plugins/views.py
ocradmin/plugins/views.py
""" RESTful interface to interacting with OCR plugins. """ from django.http import HttpResponse, HttpResponseRedirect, Http404 from django.shortcuts import render_to_response from ocradmin.ocrtasks.models import OcrTask from ocradmin.plugins.manager import ModuleManager import logging logger = logging.getLogger(__na...
""" RESTful interface to interacting with OCR plugins. """ from django.http import HttpResponse, HttpResponseRedirect, Http404 from django.shortcuts import render_to_response from ocradmin.ocrtasks.models import OcrTask from ocradmin.plugins.manager import ModuleManager import logging logger = logging.getLogger(__na...
Include the eval'd node type in the async return
Include the eval'd node type in the async return
Python
apache-2.0
vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium
b052c2fd93cd578723c93dbe7357f1f3c82273eb
src/poliastro/patched_conics.py
src/poliastro/patched_conics.py
# coding: utf-8 """Patched Conics Computations Contains methods to compute interplanetary trajectories approximating the three body problem with Patched Conics. """ from astropy import units as u from poliastro.twobody import Orbit from poliastro.constants import J2000 @u.quantity_input(a=u.m) def compute_soi(body,...
# coding: utf-8 """Patched Conics Computations Contains methods to compute interplanetary trajectories approximating the three body problem with Patched Conics. """ from astropy import units as u from poliastro.twobody import Orbit from poliastro.constants import J2000 @u.quantity_input(a=u.m) def compute_soi(body,...
Replace prints by an exception
Replace prints by an exception
Python
mit
anhiga/poliastro,Juanlu001/poliastro,anhiga/poliastro,poliastro/poliastro,newlawrence/poliastro,newlawrence/poliastro,Juanlu001/poliastro,newlawrence/poliastro,anhiga/poliastro,Juanlu001/poliastro
d156beeaf0638e585c616d697e1ecd76a98d8a3f
axelrod/tests/test_reflex.py
axelrod/tests/test_reflex.py
""" Test suite for Reflex Axelrod PD player. """ import axelrod from test_player import TestPlayer class Reflex_test(TestPlayer): def test_initial_nice_strategy(self): """ First response should always be cooperation. """ p1 = axelrod.Reflex() p2 = axelrod.Player() self.assertEqual...
""" Test suite for Reflex Axelrod PD player. """ import axelrod from test_player import TestPlayer class Reflex_test(TestPlayer): name = "Reflex" player = axelrod.Reflex stochastic = False def test_strategy(self): """ First response should always be cooperation. """ p1 = axelrod.Ref...
Simplify tests to new format.
Simplify tests to new format.
Python
mit
marcharper/Axelrod,ranjinidas/Axelrod,marcharper/Axelrod,ranjinidas/Axelrod
9f208fd476c8864a1b4c294b80d5d8191c400fb5
admin_sso/admin.py
admin_sso/admin.py
from django.conf.urls import url from django.contrib import admin from admin_sso import settings from admin_sso.models import Assignment class AssignmentAdmin(admin.ModelAdmin): list_display = ('__unicode__', 'username', 'username_mode', 'domain', 'user', 'weight') list_editable = ('usern...
from django.conf.urls import url from django.contrib import admin from admin_sso import settings from admin_sso.models import Assignment class AssignmentAdmin(admin.ModelAdmin): list_display = ('__unicode__', 'username', 'username_mode', 'domain', 'user', 'weight') list_editable = ('usern...
Add user to raw_id_fields, drastically improves UX on sites with many users
Add user to raw_id_fields, drastically improves UX on sites with many users
Python
bsd-3-clause
matthiask/django-admin-sso,diegobz/django-admin-sso,diegobz/django-admin-sso,matthiask/django-admin-sso
e255b92589000c2d485d35f9008b78e0313b4374
pystache/template_spec.py
pystache/template_spec.py
# coding: utf-8 """ Provides a class to customize template information on a per-view basis. To customize template properties for a particular view, create that view from a class that subclasses TemplateSpec. The "Spec" in TemplateSpec stands for template information that is "special" or "specified". """ # TODO: fi...
# coding: utf-8 """ Provides a class to customize template information on a per-view basis. To customize template properties for a particular view, create that view from a class that subclasses TemplateSpec. The "spec" in TemplateSpec stands for "special" or "specified" template information. """ class TemplateSpec...
Reorder TemplateSpec attributes and add to docstring.
Reorder TemplateSpec attributes and add to docstring.
Python
mit
nitish116/pystache,rismalrv/pystache,charbeljc/pystache,rismalrv/pystache,harsh00008/pystache,arlenesr28/pystache,defunkt/pystache,beni55/pystache,nitish116/pystache,nitish116/pystache,rismalrv/pystache,jrnold/pystache,jrnold/pystache,harsh00008/pystache,harsh00008/pystache,charbeljc/pystache,arlenesr28/pystache,beni55...
a3ca99ab519401df8f2418ce877065dc3aa63146
app/parsers/models.py
app/parsers/models.py
# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Add message_age property to ParsedMessage
Add message_age property to ParsedMessage
Python
apache-2.0
forseti-security/real-time-enforcer
9cf29c769e3902c44914d3e216ae9457aa7e5fef
api/api/config_settings/redis_settings.py
api/api/config_settings/redis_settings.py
import redis from api.utils import config class RedisPools(object): EXPERIMENTS_STATUS = redis.ConnectionPool.from_url( config.get_string('POLYAXON_REDIS_EXPERIMENTS_STATUS_URL')) JOBS_STATUS = redis.ConnectionPool.from_url( config.get_string('POLYAXON_REDIS_JOBS_STATUS_URL')) JOB_CONTAIN...
import redis from api.utils import config class RedisPools(object): EXPERIMENTS_STATUS = redis.ConnectionPool.from_url( config.get_string('POLYAXON_REDIS_EXPERIMENTS_STATUS_URL')) JOBS_STATUS = redis.ConnectionPool.from_url( config.get_string('POLYAXON_REDIS_JOBS_STATUS_URL')) JOB_CONTAIN...
Add to stream redis db
Add to stream redis db
Python
apache-2.0
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
66b49f913513545e5ae0484963412e965c8f9aa1
saleor/dashboard/category/forms.py
saleor/dashboard/category/forms.py
from django import forms from django.utils.translation import ugettext_lazy as _ from mptt.forms import TreeNodeChoiceField from ...product.models import Category class CategoryForm(forms.ModelForm): class Meta: model = Category exclude = [] def __init__(self, *args, **kwargs): super...
from django import forms from django.utils.translation import ugettext_lazy as _ from mptt.forms import TreeNodeChoiceField from ...product.models import Category class CategoryForm(forms.ModelForm): class Meta: model = Category exclude = [] def __init__(self, *args, **kwargs): super...
Check if new parent is not a descendant of current category
Check if new parent is not a descendant of current category
Python
bsd-3-clause
rchav/vinerack,HyperManTT/ECommerceSaleor,rchav/vinerack,taedori81/saleor,jreigel/saleor,tfroehlich82/saleor,avorio/saleor,paweltin/saleor,laosunhust/saleor,UITools/saleor,spartonia/saleor,arth-co/saleor,spartonia/saleor,taedori81/saleor,arth-co/saleor,rchav/vinerack,tfroehlich82/saleor,avorio/saleor,josesanch/saleor,U...
c7d9287b770a0033cb54f9c1f9ac5f8beb25d528
scripts/cronRefreshEdxQualtrics.py
scripts/cronRefreshEdxQualtrics.py
from surveyextractor import QualtricsExtractor import getopt import sys ### Script for scheduling regular EdxQualtrics updates ### Usage for cron should be "cronRefreshEdxQualtrics.py -m -s -r" # Append directory for dependencies to PYTHONPATH sys.path.append("/home/dataman/Code/qualtrics_etl/src/qualtrics_etl/") qe...
from surveyextractor import QualtricsExtractor import getopt, sys # Script for scheduling regular EdxQualtrics updates # Usage for cron should be "cronRefreshEdxQualtrics.py -m -s -r" qe = QualtricsExtractor() opts, args = getopt.getopt(sys.argv[1:], 'amsr', ['--reset', '--loadmeta', '--loadsurveys', '--loadresponses...
Revert "Added script for cron job to load surveys to database."
Revert "Added script for cron job to load surveys to database." This reverts commit 34e5560437348e5cfeab589b783c9cc524aa2abf.
Python
bsd-3-clause
paepcke/json_to_relation,paepcke/json_to_relation,paepcke/json_to_relation,paepcke/json_to_relation
d5049edc8567cebf936bb07847906c5400f9a6d9
ceph_deploy/tests/unit/hosts/test_suse.py
ceph_deploy/tests/unit/hosts/test_suse.py
from ceph_deploy.hosts import suse class TestSuseInit(object): def setup(self): self.host = suse def test_choose_init_default(self): self.host.release = None init_type = self.host.choose_init() assert init_type == "sysvinit" def test_choose_init_SLE_11(self): ...
from ceph_deploy.hosts import suse from ceph_deploy.hosts.suse.install import map_components class TestSuseInit(object): def setup(self): self.host = suse def test_choose_init_default(self): self.host.release = None init_type = self.host.choose_init() assert init_type == "sysv...
Add tests for component to SUSE package mapping
Add tests for component to SUSE package mapping Signed-off-by: David Disseldorp <589a549dc9f982d9f46aeeb82a09ab6d87ccf1d8@suse.de>
Python
mit
zhouyuan/ceph-deploy,shenhequnying/ceph-deploy,ceph/ceph-deploy,ghxandsky/ceph-deploy,zhouyuan/ceph-deploy,imzhulei/ceph-deploy,SUSE/ceph-deploy,Vicente-Cheng/ceph-deploy,ceph/ceph-deploy,branto1/ceph-deploy,trhoden/ceph-deploy,trhoden/ceph-deploy,osynge/ceph-deploy,ghxandsky/ceph-deploy,SUSE/ceph-deploy,branto1/ceph-d...
d8f33c46b6462788ef6e38dc5aefcdda2144eb66
camoco/__init__.py
camoco/__init__.py
""" Camoco Library - CoAnalysis of Molecular Components CacheMoneyCorn """ __license__ = """ Creative Commons Non-Commercial 4.0 Generic http://creativecommons.org/licenses/by-nc/4.0/ """ import pyximport; pyximport.install() from camoco.Camoco import Camoco from camoco.Expr import Expr from camoco.CO...
""" Camoco Library - CoAnalysis of Molecular Components CacheMoneyCorn """ __license__ = """ Creative Commons Non-Commercial 4.0 Generic http://creativecommons.org/licenses/by-nc/4.0/ """ import pyximport; pyximport.install() from camoco.Camoco import Camoco Camoco.create() from camoco.Expr import Exp...
Fix initial create for camoco class
Fix initial create for camoco class
Python
mit
schae234/Camoco,schae234/Camoco
a1bcb99691f5a0238f6a34a5579df3e89e8d6823
child_sync_gp/model/project_compassion.py
child_sync_gp/model/project_compassion.py
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (C) 2014-2015 Compassion CH (http://www.compassion.ch) # Releasing children from poverty in Jesus' name # @author: Emanuel Cino <ecino@compassion.ch> # # The licence is in the file _...
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (C) 2014-2015 Compassion CH (http://www.compassion.ch) # Releasing children from poverty in Jesus' name # @author: Emanuel Cino <ecino@compassion.ch> # # The licence is in the file _...
Fix bug in write project.
Fix bug in write project.
Python
agpl-3.0
CompassionCH/compassion-switzerland,ndtran/compassion-switzerland,MickSandoz/compassion-switzerland,eicher31/compassion-switzerland,Secheron/compassion-switzerland,CompassionCH/compassion-switzerland,Secheron/compassion-switzerland,CompassionCH/compassion-switzerland,MickSandoz/compassion-switzerland,ecino/compassion-s...
4ad92bfcbfd2145b008cd18e934ebd6dc3be53e9
pytest/test_prefork.py
pytest/test_prefork.py
from tectonic import prefork def test_WorkerMetadata(): """ This is a simple test, as WorkerMetadata only holds data """ pid = 'pid' health_check_read = 100 last_seen = 'now' metadata = prefork.WorkerMetadata(pid=pid, health_check_read=health_check_re...
import os import shutil import os.path import tempfile from tectonic import prefork def test_WorkerMetadata(): """ This is a simple test, as WorkerMetadata only holds data """ pid = 'pid' health_check_read = 100 last_seen = 'now' metadata = prefork.WorkerMetadata(pid=pid, ...
Add a test for the file object
Add a test for the file object
Python
bsd-3-clause
markrwilliams/tectonic
cb8bf92ab2f71767de8b471992d79131e4dde9a1
quicksort/quicksort.py
quicksort/quicksort.py
def sort(arr): return arr; if __name__ == '__main__': unsorted = list(reversed(range(1000))); print sort(unsorted);
def sort(arr, length): if length == 1: return return (arr, length) if __name__ == '__main__': unsorted = list(reversed(range(1000))) initial_len = len(unsorted) print sort(unsorted, initial_len)
Add length parameter to sort and remove semicolons
Add length parameter to sort and remove semicolons The sort function requires a length parameter, so the function declaration and the initial call were modified to reflect that. A length of just 1 element represents the base case of the recursion, so the function simply returns in this case. Also I forgot how python ...
Python
mit
timpel/stanford-algs,timpel/stanford-algs
9256844b08edaff1b9755a6ffc25acc0df76934d
MoodJournal/entries/serializers.py
MoodJournal/entries/serializers.py
from django.contrib.auth.models import User from rest_framework import serializers from .models import UserDefinedCategory from .models import EntryInstance class UserDefinedCategorySerializer(serializers.HyperlinkedModelSerializer): url = serializers.HyperlinkedIdentityField( view_name='category-detail...
from rest_framework import serializers from .models import UserDefinedCategory from .models import EntryInstance class UserDefinedCategorySerializer(serializers.ModelSerializer): class Meta: model = UserDefinedCategory fields = ('user', 'category', 'pk',) class EntryInstanceSerializer(serialize...
Revert "beginning hyperlink model serialization"
Revert "beginning hyperlink model serialization" This reverts commit 6d41c54397512da69604f7e730757f4aff96374f.
Python
mit
swpease/MoodJournal,swpease/MoodJournal,swpease/MoodJournal
5a12f027079d109228456c6f3e4912317721246a
setup.py
setup.py
from distutils.core import setup setup( name='cyrtranslit', packages=['cyrtranslit'], version='0.4', description='Bi-directional Cyrillic transliteration. Transliterate Cyrillic script text to Roman alphabet text and vice versa.', author='Open Data Kosovo', author_email='dev@opendatakosovo.org', url='http...
from distutils.core import setup setup( name='cyrtranslit', packages=['cyrtranslit'], version='0.4', description='Bi-directional Cyrillic transliteration. Transliterate Cyrillic script text to Roman alphabet text and vice versa.', author='Open Data Kosovo', author_email='dev@opendatakosovo.org', url='http...
Declare that cyrtranslit supports Python 3.7
Declare that cyrtranslit supports Python 3.7
Python
mit
opendatakosovo/cyrillic-transliteration
aea05ee76193ac0abe2f6673910917bf13a3b339
setup.py
setup.py
from distutils.core import setup setup( name='simplecrypto', version=open('CHANGES.txt').read().split()[0], author='Lucas Boppre Niehues', author_email='lucasboppre@gmail.com', packages=['simplecrypto'], url='http://pypi.python.org/pypi/simplecrypto/', license='LICENSE.txt', description...
from distutils.core import setup setup( name='simplecrypto', version=open('CHANGES.txt').read().split()[0], author='Lucas Boppre Niehues', author_email='lucasboppre@gmail.com', packages=['simplecrypto'], url='https://github.com/boppreh/simplecrypto', license='LICENSE.txt', description='...
Change homepage to github URL
Change homepage to github URL
Python
mit
boppreh/simplecrypto
5bb90727efb62525995caad3b52fd588d8b08298
pregnancy/urls.py
pregnancy/urls.py
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() import contractions.views urlpatterns = patterns('', # Examples: # url(r'^$', 'pregnancy.views.home', name='home'), # url(r'^pregnancy/', include('...
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() import contractions.views urlpatterns = patterns('', # Examples: # url(r'^$', 'pregnancy.views.home', name='home'), # url(r'^pregnancy/', include('...
Update url to point / to the contractions app
Update url to point / to the contractions app
Python
bsd-2-clause
dreinhold/pregnancy,dreinhold/pregnancy,dreinhold/pregnancy
9fa76b8e9d7fb9309a49d46b9bbd43e9b65418ad
pytest_cookies.py
pytest_cookies.py
# -*- coding: utf-8 -*- import pytest def pytest_addoption(parser): group = parser.getgroup('cookies') group.addoption( '--foo', action='store', dest='dest_foo', default=2015, help='Set the value for the fixture "bar".' ) parser.addini('HELLO', 'Dummy pytest.i...
# -*- coding: utf-8 -*- import pytest from cookiecutter.main import cookiecutter class Cookies(object): """Class to provide convenient access to the cookiecutter API.""" error = None project = None def __init__(self, template, output_dir): self._template = template self._output_dir ...
Implement cookies fixture along with Helper class
Implement cookies fixture along with Helper class
Python
mit
hackebrot/pytest-cookies
eec004dd34ffc977e29481c94345e20cae867238
views.py
views.py
from django.conf import settings from django.http import HttpResponse from django.utils.importlib import import_module def warmup(request): """ Provides default procedure for handling warmup requests on App Engine. Just add this view to your main urls.py. """ for app in settings.INSTALLED_APPS: ...
from django.conf import settings from django.http import HttpResponse from django.utils.importlib import import_module def warmup(request): """ Provides default procedure for handling warmup requests on App Engine. Just add this view to your main urls.py. """ for app in settings.INSTALLED_APPS: ...
Expand pre loading on warmup
Expand pre loading on warmup
Python
bsd-3-clause
adieu/djangoappengine
ba1bfc262e023a01d6e201d48d234640a443ed96
raven/__init__.py
raven/__init__.py
""" raven ~~~~~ :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ __all__ = ('VERSION', 'Client', 'load') try: VERSION = __import__('pkg_resources') \ .get_distribution('raven').version except Exception, e: VERSION = 'unknown' fro...
""" raven ~~~~~ :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ __all__ = ('VERSION', 'Client', 'load') try: VERSION = __import__('pkg_resources') \ .get_distribution('raven').version except Exception, e: VERSION = 'unknown' fro...
Use absolute imports, not relative ones.
Use absolute imports, not relative ones.
Python
bsd-3-clause
hzy/raven-python,akheron/raven-python,akalipetis/raven-python,nikolas/raven-python,arthurlogilab/raven-python,inspirehep/raven-python,recht/raven-python,akheron/raven-python,arthurlogilab/raven-python,arthurlogilab/raven-python,lepture/raven-python,percipient/raven-python,collective/mr.poe,Goldmund-Wyldebeast-Wunderlie...
ee0c852d494a0952d51b7f5ddde77ec2b46deca3
lambdas/update_ecs_service_size.py
lambdas/update_ecs_service_size.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ Change the size of an ECS service. This is used to schedule our service applications: by setting the desired size to 0/greater-than-0, Amazon will do the work of spinning up or scaling down the tasks. The script is triggered by notifications to an SNS topic, in whic...
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ Change the size of an ECS service. This is used to schedule our service applications: by setting the desired size to 0/greater-than-0, Amazon will do the work of spinning up or scaling down the tasks. The script is triggered by notifications to an SNS topic, in whic...
Fix the Update ECS Service size Lambda
Fix the Update ECS Service size Lambda
Python
mit
wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api
dfe84075109620481cac493c1d0dba69d9ca19df
vesper/tests/test_case_mixin.py
vesper/tests/test_case_mixin.py
""" Unit test test case mixin class. This mixin class is intended for use with a subclass of either `unittest.TestCase` or `django.test.TestCase`. It includes several convenience `_assert...` methods. """ import vesper.util.numpy_utils as numpy_utils class TestCaseMixin: def assert_raises(self, excep...
""" Unit test test case mixin class. This mixin class is intended for use with a subclass of either `unittest.TestCase` or `django.test.TestCase`. It includes several convenience `_assert...` methods. """ import vesper.util.numpy_utils as numpy_utils SHOW_EXCEPTION_MESSAGES = False class TestCaseMixin: ...
Add method for testing async function errors.
Add method for testing async function errors.
Python
mit
HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper,HaroldMills/Vesper
33ba6400768b759180d7602c14e6f947d1c8e771
djangosaml2/templatetags/idplist.py
djangosaml2/templatetags/idplist.py
# Copyright (C) 2011 Yaco Sistemas (http://www.yaco.es) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
# Copyright (C) 2011 Yaco Sistemas (http://www.yaco.es) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
Load the config as late as possible to avoid crashing when the configuration is not ready yet. Also this code is more reentrant
Load the config as late as possible to avoid crashing when the configuration is not ready yet. Also this code is more reentrant
Python
apache-2.0
WiserTogether/djangosaml2,sdelements/djangosaml2,kradalby/djangosaml2,kradalby/djangosaml2,WiserTogether/djangosaml2
d83ed858dab0991e4829a7f249260ae1f1140b41
rave/main.py
rave/main.py
import rave.events import rave.modularity import rave.backends import rave.resources import rave.rendering def init_game(game): rave.events.emit('game.init', game) with game.env: rave.modularity.load_all() rave.backends.select_all() def run_game(game): running = True # Stop the eve...
import rave.events import rave.modularity import rave.backends import rave.resources import rave.rendering def init_game(game): rave.modularity.load_all() rave.events.emit('game.init', game) with game.env: rave.backends.select_all() def run_game(game): running = True # Stop the event l...
Load modules in engine context.
core: Load modules in engine context.
Python
bsd-2-clause
rave-engine/rave
a37ef5af5a28207d21b11f08990e233a34afa768
acme/utils/loggers/__init__.py
acme/utils/loggers/__init__.py
# python3 # Copyright 2018 DeepMind Technologies Limited. 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 re...
# python3 # Copyright 2018 DeepMind Technologies Limited. 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 re...
Add LoggingData annotation to Logger base import so users can type-annotate Logger subclasses properly.
Add LoggingData annotation to Logger base import so users can type-annotate Logger subclasses properly. PiperOrigin-RevId: 315308368 Change-Id: I608c9f6f5f4b9edbbf504ec321fc4c8e90ed8193
Python
apache-2.0
deepmind/acme,deepmind/acme
7014bfb976524e95b6e13eb44cf62401568bff1a
examples/web_demo/exifutil.py
examples/web_demo/exifutil.py
""" This script handles the skimage exif problem. """ from PIL import Image import numpy as np ORIENTATIONS = { # used in apply_orientation 2: (Image.FLIP_LEFT_RIGHT,), 3: (Image.ROTATE_180,), 4: (Image.FLIP_TOP_BOTTOM,), 5: (Image.FLIP_LEFT_RIGHT, Image.ROTATE_90), 6: (Image.ROTATE_270,), 7...
""" This script handles the skimage exif problem. """ from PIL import Image import numpy as np ORIENTATIONS = { # used in apply_orientation 2: (Image.FLIP_LEFT_RIGHT,), 3: (Image.ROTATE_180,), 4: (Image.FLIP_TOP_BOTTOM,), 5: (Image.FLIP_LEFT_RIGHT, Image.ROTATE_90), 6: (Image.ROTATE_270,), 7...
FIX web_demo upload was not processing grayscale correctly
FIX web_demo upload was not processing grayscale correctly
Python
agpl-3.0
tackgeun/caffe,CZCV/s-dilation-caffe,longjon/caffe,gnina/gnina,CZCV/s-dilation-caffe,tackgeun/caffe,gnina/gnina,gnina/gnina,gogartom/caffe-textmaps,CZCV/s-dilation-caffe,gogartom/caffe-textmaps,wangg12/caffe,tackgeun/caffe,wangg12/caffe,gnina/gnina,gnina/gnina,gogartom/caffe-textmaps,CZCV/s-dilation-caffe,longjon/caffe...
527c414da01dd40425086253dec2007c54e30675
send_reminders.py
send_reminders.py
from twilio.rest import TwilioRestClient import project.utils.reminders ACCOUNT_SID = "AC6a9746370384b26236aae71013aa35b2" AUTH_TOKEN = "38b0bcc37788e553978c840929d54aa2" def send_reminder(text, phone): client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN) client.messages.create(to=phone, from_="+15713646776", b...
from twilio.rest import TwilioRestClient import project.utils.reminders ACCOUNT_SID = "ayylmao" AUTH_TOKEN = "ayylmao" def send_reminder(text, phone): client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN) client.messages.create(to=phone, from_="+15172194225", body=text) def send_all_reminders(): x = project...
Update API keys and phone number
Update API keys and phone number
Python
apache-2.0
tjcsl/mhacksiv
e7865a22eb2e7433f3c36cd571aae3ac65436423
signage/models.py
signage/models.py
from __future__ import unicode_literals from django.core.urlresolvers import reverse from django.db import models from django.utils.encoding import python_2_unicode_compatible from model_utils.models import TimeFramedModel from taggit.managers import TaggableManager @python_2_unicode_compatible class Slide(TimeFram...
from __future__ import unicode_literals from django.core.urlresolvers import reverse from django.db import models from django.utils.encoding import python_2_unicode_compatible from model_utils.models import TimeFramedModel from taggit.managers import TaggableManager @python_2_unicode_compatible class Slide(TimeFram...
Order displayed slides by weight
Order displayed slides by weight
Python
bsd-3-clause
jbittel/django-signage,jbittel/django-signage,jbittel/django-signage
cf52a7c83e1479a99e95ab2125958a67febfccf5
dataviews/__init__.py
dataviews/__init__.py
import sys, os # Add param submodule to sys.path cwd = os.path.abspath(os.path.split(__file__)[0]) sys.path.insert(0, os.path.join(cwd, '..', 'param')) from .views import * # pyflakes:ignore (API import) from .dataviews import * # pyflakes:ignore (API import) from .sheetviews import * # pyflakes:ignore (API import) f...
import sys, os # Add param submodule to sys.path cwd = os.path.abspath(os.path.split(__file__)[0]) sys.path.insert(0, os.path.join(cwd, '..', 'param')) import param __version__ = param.Version(release=(0,7), fpath=__file__) from .views import * # pyflakes:ignore (API import) from .dataviews import * # pyflakes:igno...
Set __version__ using param.Version (commit tagged as 'v0.7')
Set __version__ using param.Version (commit tagged as 'v0.7')
Python
bsd-3-clause
mjabri/holoviews,basnijholt/holoviews,ioam/holoviews,mjabri/holoviews,ioam/holoviews,vascotenner/holoviews,vascotenner/holoviews,ioam/holoviews,basnijholt/holoviews,basnijholt/holoviews,vascotenner/holoviews,mjabri/holoviews
0236ad9090f7b218fc7515fdc8d919b2fc048a72
simple_counter.py
simple_counter.py
# Copyright 2008 Google 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 agreed to in writing, ...
# Copyright 2008 Google 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 agreed to in writing, ...
Indent only (PEP8) commit of simple counter.
Indent only (PEP8) commit of simple counter.
Python
apache-2.0
GoogleCloudPlatform/appengine-sharded-counters-python
da93d78d141e0e07581b2a00cd6a4fb4058dcf56
scikits/learn/setup.py
scikits/learn/setup.py
def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('learn',parent_package,top_path) config.add_subpackage('datasets') config.add_subpackage('common') config.add_subpackage('machine') config.add_subpackage('utils') r...
def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('learn',parent_package,top_path) config.add_subpackage('datasets') config.add_subpackage('machine') config.add_subpackage('utils') return config if __name__ == '__main...
Remove references to deleted submodule common/
Remove references to deleted submodule common/ From: Fabian Pedregosa <fabian.pedregosa@inria.fr> git-svn-id: a2d1b0e147e530765aaf3e1662d4a98e2f63c719@384 22fbfee3-77ab-4535-9bad-27d1bd3bc7d8
Python
bsd-3-clause
jayflo/scikit-learn,toastedcornflakes/scikit-learn,Aasmi/scikit-learn,kjung/scikit-learn,macks22/scikit-learn,trungnt13/scikit-learn,sgenoud/scikit-learn,ldirer/scikit-learn,aetilley/scikit-learn,elkingtonmcb/scikit-learn,IshankGulati/scikit-learn,zhenv5/scikit-learn,fzalkow/scikit-learn,petosegan/scikit-learn,mojoboss...
1ef1d7a973ce44943fc59315d1f962ed59f06e33
seacucumber/backend.py
seacucumber/backend.py
""" This module contains the SESBackend class, which is what you'll want to set in your settings.py:: EMAIL_BACKEND = 'seacucumber.backend.SESBackend' """ from django.core.mail.backends.base import BaseEmailBackend from seacucumber.tasks import SendEmailTask class SESBackend(BaseEmailBackend): """ A Djang...
""" This module contains the SESBackend class, which is what you'll want to set in your settings.py:: EMAIL_BACKEND = 'seacucumber.backend.SESBackend' """ from django.core.mail.backends.base import BaseEmailBackend from seacucumber.tasks import SendEmailTask class SESBackend(BaseEmailBackend): """ A Djan...
Patch to send mails with UTF8 encoding
Patch to send mails with UTF8 encoding Just a temp fix
Python
mit
makielab/sea-cucumber,duointeractive/sea-cucumber
a9b56fe98a0df71881c41a2524bdb5abc4b0de50
services/imu-logger.py
services/imu-logger.py
#!/usr/bin/env python3 from sense_hat import SenseHat from pymongo import MongoClient import time DELAY = 1 # in seconds sense = SenseHat() client = MongoClient("mongodb://10.0.1.25:27017") db = client.g2x while True: orientation = sense.get_orientation_degrees() print(orientation) acceleration = sen...
#!/usr/bin/env python3 from sense_hat import SenseHat from pymongo import MongoClient from datetime import datetime sense = SenseHat() client = MongoClient("mongodb://10.0.1.25:27017") db = client.g2x last_time = datetime.utcnow() sample_count = 0 while True: current_time = datetime.utcnow() elapsed_time =...
Read samples faster but log only once a second
Read samples faster but log only once a second
Python
bsd-3-clause
gizmo-cda/g2x-submarine-v2,gizmo-cda/g2x-submarine-v2,gizmo-cda/g2x-submarine-v2,gizmo-cda/g2x-submarine-v2
b7b1ae11378b37350a3fcd9d989be58f655ec986
calexicon/helpers.py
calexicon/helpers.py
from datetime import date as vanilla_date def ordinal(n): suffix = "th" if n % 10 == 1: suffix = "st" if n % 10 == 2: suffix = "nd" if n % 10 == 3: suffix = "rd" if 10 < n % 100 < 20: suffix = "th" return "%d%s" % (n, suffix) def month_string(n): d = vanil...
from datetime import date as vanilla_date def ordinal(n): suffix = "th" if n % 10 in [1, 2, 3]: suffix = [None, 'st', 'nd', 'rd'][n % 10] if 10 < n % 100 < 20: suffix = "th" return "%d%s" % (n, suffix) def month_string(n): d = vanilla_date(1995, n, 1) return d.strftime("%B")
Make this part of the function simpler.
Make this part of the function simpler.
Python
apache-2.0
jwg4/qual,jwg4/calexicon
4c987cd45080cb6a1a449fa708a567c40ba8c94f
examples/pax_mininet_node.py
examples/pax_mininet_node.py
# coding: latin-1 """ pax_mininet_node.py: Defines PaxNode which allows Pax to behave as the sole packet hander on a node. """ from mininet.node import Node from mininet.log import info, warn class PaxNode( Node ): "PaxNode: A node which allows Pax to behave as the sole packet hander on that node." def __in...
# coding: latin-1 """ pax_mininet_node.py: Defines PaxNode which allows Pax to behave as the sole packet hander on a node. """ from mininet.node import Node from mininet.log import info, warn class PaxNode( Node ): "PaxNode: A node which allows Pax to behave as the sole packet hander on that node." def __in...
Add comment explaining why we disable ip_forward
Add comment explaining why we disable ip_forward
Python
apache-2.0
niksu/pax,TMVector/pax,niksu/pax,niksu/pax,TMVector/pax
3252a1e0f5b2991179d3fabe66f34a19f7cd85c9
src/DecodeTest.py
src/DecodeTest.py
import unittest from Decode import Decoder import Frames class TestDecoder(unittest.TestCase): """ """ def setUp(self): self.decoder = Decoder() def test_decoder_get_frame_class(self): command = 'SEND' self.assertEquals(self.decoder.get_frame_class(command), Frames.SEND) d...
import unittest from Decode import Decoder import Frames class TestDecoder(unittest.TestCase): """ """ def setUp(self): self.decoder = Decoder() def test_decoder_get_frame_class(self): command = 'SEND' self.assertEquals(self.decoder.get_frame_class(command), Frames.SEND) d...
Send and Connect frame tests
Send and Connect frame tests
Python
mit
phan91/STOMP_agilis
fb0b129216bd98a90cdee623157df5c7e4a742fb
blinkenlights/blinkenlights.py
blinkenlights/blinkenlights.py
#!/usr/bin/python3 import asyncio, signal, os from blink import blink import ipc.coordinator loop = asyncio.get_event_loop() def my_interrupt_handler(): print('Stopping') for task in asyncio.Task.all_tasks(): task.cancel() loop.stop() loop.add_signal_handler(signal.SIGINT, my_interrupt_handle...
#!/usr/bin/python3 import asyncio, signal, os from blink import blink import ipc.coordinator loop = asyncio.get_event_loop() def my_interrupt_handler(): print('Stopping') for task in asyncio.Task.all_tasks(): task.cancel() loop.stop() loop.add_signal_handler(signal.SIGINT, my_interrupt_handle...
Clean up socket file on exiting
Clean up socket file on exiting Change-Id: I34391c64408b5a35386913bd7be01d81feed61b6
Python
mit
fayoh/KSP-Control
3ccaf18243232d756ed139d9f84a6b3903af15f7
exploratory_analysis/author_scan.py
exploratory_analysis/author_scan.py
import os from utils import Reader import code import sys author_dict = dict() def extract_authors(tweets): # code.interact(local=dict(globals(), **locals())) for t in tweets: if t.is_post(): actor = t.actor() create_key(actor['id']) increment_author(actor, t.is_p...
import os from utils import Reader import code import sys def extract_authors(tweets): for t in tweets: if t.is_post(): actor = t.actor() print '"{}","{}","{}","{}",{},{}'.format(actor['id'], actor['link'], ...
Print everything out in csv and use tableau to do calculation
Print everything out in csv and use tableau to do calculation
Python
apache-2.0
chuajiesheng/twitter-sentiment-analysis
9d651a1cdb92d7d8ba039fce97a11de085b54990
polymorphic/formsets/utils.py
polymorphic/formsets/utils.py
""" Internal utils """ import django def add_media(dest, media): """ Optimized version of django.forms.Media.__add__() that doesn't create new objects. Only required for Django < 2.0 """ if django.VERSION >= (2, 0): dest += media else: dest.add_css(media._css) dest.add...
""" Internal utils """ import django def add_media(dest, media): """ Optimized version of django.forms.Media.__add__() that doesn't create new objects. Only required for Django < 2.0 """ if django.VERSION >= (2, 0): combined = dest + media dest._css = combined._css dest._j...
Fix the add_media() hack for Django 2.0
Fix the add_media() hack for Django 2.0
Python
bsd-3-clause
chrisglass/django_polymorphic,chrisglass/django_polymorphic
94e3572a4049b0eb0ff0d762a3bce5248a5bd507
src/sas/sasgui/perspectives/file_converter/file_converter.py
src/sas/sasgui/perspectives/file_converter/file_converter.py
""" File Converter Plugin """ import logging from sas.sasgui.guiframe.plugin_base import PluginBase from sas.sasgui.perspectives.file_converter.converter_panel import ConverterWindow logger = logging.getLogger(__name__) class Plugin(PluginBase): """ This class defines the interface for a Plugin class for...
""" File Converter Plugin """ import logging from sas.sasgui.guiframe.plugin_base import PluginBase from sas.sasgui.perspectives.file_converter.converter_panel import ConverterWindow logger = logging.getLogger(__name__) class Plugin(PluginBase): """ This class defines the interface for a Plugin class for...
Update file converter tooltip in tools menu
Update file converter tooltip in tools menu
Python
bsd-3-clause
SasView/sasview,SasView/sasview,lewisodriscoll/sasview,SasView/sasview,SasView/sasview,SasView/sasview,lewisodriscoll/sasview,lewisodriscoll/sasview,SasView/sasview,lewisodriscoll/sasview,lewisodriscoll/sasview
4712e870bec7c678f88af3d7b54fcf7c8b040795
salt/modules/http.py
salt/modules/http.py
# -*- coding: utf-8 -*- ''' Module for making various web calls. Primarily designed for webhooks and the like, but also useful for basic http testing. ''' from __future__ import absolute_import # Import salt libs import salt.utils.http def query(url, **kwargs): ''' Query a resource, and decode the return dat...
# -*- coding: utf-8 -*- ''' Module for making various web calls. Primarily designed for webhooks and the like, but also useful for basic http testing. ''' from __future__ import absolute_import # Import salt libs import salt.utils.http def query(url, **kwargs): ''' Query a resource, and decode the return dat...
Allow execution module to update_ca_bundle
Allow execution module to update_ca_bundle
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
25e5b38b09a21cd6e6fbf4ba141bc35bb34cb77e
Core/views.py
Core/views.py
from django.shortcuts import render # Create your views here.
from django.http import HttpResponse, HttpResponseNotFound, Http404 from django.shortcuts import render, redirect from django.middleware.csrf import get_token from models import * class view(): request = '' template = '' isSecuredArea = True isUserAuthenticated = False #Normal Overridable methods @abstractme...
Add core view hangler class
Add core view hangler class
Python
mit
Tomcuzz/OctaHomeAutomation,Tomcuzz/OctaHomeAutomation,Tomcuzz/OctaHomeAutomation,Tomcuzz/OctaHomeAutomation
9f9357bc46f813cd8a26a5f14bba5364aa4a4c10
rx/core/operators/contains.py
rx/core/operators/contains.py
from typing import Callable, Optional, TypeVar from rx import operators as ops from rx.core import Observable, pipe, typing from rx.internal.basic import default_comparer _T = TypeVar("_T") def contains_( value: _T, comparer: Optional[typing.Comparer[_T]] = None ) -> Callable[[Observable[_T]], Observable[bool]]...
from typing import Callable, Optional, TypeVar from rx import operators as ops from rx.core import Observable, pipe, typing from rx.internal.basic import default_comparer _T = TypeVar("_T") def contains_( value: _T, comparer: Optional[typing.Comparer[_T]] = None ) -> Callable[[Observable[_T]], Observable[bool]]...
Use typed function instead of lambda
Use typed function instead of lambda
Python
mit
ReactiveX/RxPY,ReactiveX/RxPY
86c106fc95946e4558fabfae57bbd039b248a70c
mindbender/maya/plugins/validate_single_shape.py
mindbender/maya/plugins/validate_single_shape.py
import pyblish.api class ValidateMindbenderSingleShape(pyblish.api.InstancePlugin): """One mesh per transform""" label = "Validate Single Shape" order = pyblish.api.ValidatorOrder hosts = ["maya"] active = False optional = True families = [ "mindbender.model", "mindbender....
import pyblish.api class ValidateMindbenderSingleShape(pyblish.api.InstancePlugin): """Transforms with a mesh must ever only contain a single mesh This ensures models only contain a single shape node. """ label = "Validate Single Shape" order = pyblish.api.ValidatorOrder hosts = ["maya"] ...
Repair validate single shape validator
Repair validate single shape validator
Python
mit
mindbender-studio/core,MoonShineVFX/core,getavalon/core,MoonShineVFX/core,mindbender-studio/core,getavalon/core
2e0585a59e7c3c60b8bf7e0a8d5e377b7f2f9cd5
grammar/entities/adjectives/deff.py
grammar/entities/adjectives/deff.py
from pyparsing import * from ...constants.math.deff import NUM, FULLNUM from ...constants.zones.deff import TOP, BOTTOM from ...constants.verbs.deff import * from ...mana.deff import color from ...types.deff import nontype, supertype from ...functions.deff import delimitedListAnd, delimitedListOr from decl import * ...
from pyparsing import * from ...constants.math.deff import NUM, FULLNUM from ...constants.zones.deff import TOP, BOTTOM from ...constants.verbs.deff import * from ...mana.deff import color from ...types.deff import nontype, supertype from ...functions.deff import delimitedListAnd, delimitedListOr from decl import * ...
Add commentary explaining and/or lists
Add commentary explaining and/or lists
Python
mit
jrgdiz/cardwalker,jrgdiz/cardwalker
400027592a131872da5754306ee5e0ec2eba61cf
tests/test_err.py
tests/test_err.py
# Testing use of cpl_errs import pytest import rasterio from rasterio.errors import RasterioIOError def test_io_error(tmpdir): with pytest.raises(RasterioIOError) as exc_info: rasterio.open(str(tmpdir.join('foo.tif'))) msg, = exc_info.value.args assert msg.startswith("'{0}'".format(tmpdir.join('...
# Testing use of cpl_errs import pytest import rasterio from rasterio.errors import RasterioIOError def test_io_error(tmpdir): """RasterioIOError is raised when a disk file can't be opened. Newlines are removed from GDAL error messages.""" with pytest.raises(RasterioIOError) as exc_info: rasteri...
Check msg in a way that passes for all GDAL versions
Check msg in a way that passes for all GDAL versions
Python
bsd-3-clause
kapadia/rasterio,brendan-ward/rasterio,kapadia/rasterio,kapadia/rasterio,brendan-ward/rasterio,brendan-ward/rasterio
2717a35a78f5982f96d57e258dfedd308cb6ffa8
hoomd/typeparam.py
hoomd/typeparam.py
from hoomd.parameterdicts import AttachedTypeParameterDict class TypeParameter: def __init__(self, name, type_kind, param_dict): self.name = name self.type_kind = type_kind self.param_dict = param_dict def __getitem__(self, key): return self.param_dict[key] def __setitem_...
from hoomd.parameterdicts import AttachedTypeParameterDict class TypeParameter: def __init__(self, name, type_kind, param_dict): self.name = name self.type_kind = type_kind self.param_dict = param_dict def __getitem__(self, key): return self.param_dict[key] def __setitem_...
Add keys iterator for ``TypeParameter``
Add keys iterator for ``TypeParameter``
Python
bsd-3-clause
joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue
d2250ac74b0797d1662c054d2357573578caa251
core/tasks.py
core/tasks.py
import os import gzip import urllib.request from celery import shared_task from django.core.mail import EmailMessage from celery.task import periodic_task from celery.schedules import crontab @shared_task(name='deliver_email') def deliver_email(subject=None, body=None, recipients=None): #print("Entering core.task...
import os import gzip import urllib.request from celery import shared_task from django.core.mail import EmailMessage from celery.task import periodic_task from celery.schedules import crontab @shared_task(name='deliver_email') def deliver_email(subject=None, body=None, recipients=None): if recipients: f...
Clean up code and remove print statements
Clean up code and remove print statements
Python
mit
LindaTNguyen/RAPID,gdit-cnd/RAPID,LindaTNguyen/RAPID,gdit-cnd/RAPID,LindaTNguyen/RAPID,gdit-cnd/RAPID,gdit-cnd/RAPID,gdit-cnd/RAPID,LindaTNguyen/RAPID,LindaTNguyen/RAPID
96aa6271a4dab8c4e222c4161ab9ad06472b4f19
orges/test/integration/test_main.py
orges/test/integration/test_main.py
from __future__ import division, print_function, with_statement from nose.tools import eq_ from orges.main import optimize from orges.optimizer.gridsearch import GridSearchOptimizer from orges.test.util.one_param_sleep_and_negate_f import f def test_optimize_running_too_long_aborts(): optimizer = GridSearchOpti...
from __future__ import division, print_function, with_statement from nose.tools import eq_ from orges.main import optimize from orges.optimizer.gridsearch import GridSearchOptimizer from orges.test.util.one_param_sleep_and_negate_f import f def test_optimize_running_too_long_aborts(): optimizer = GridSearchOpti...
Fix test for optimize method
Fix test for optimize method
Python
bsd-3-clause
cigroup-ol/metaopt,cigroup-ol/metaopt,cigroup-ol/metaopt
7f83888c957b892e6cc9d2e92f49a2737a9eabfe
logstash_handler/__init__.py
logstash_handler/__init__.py
from logging.handlers import SocketHandler import ssl class LogstashHandler(SocketHandler): """ Sends output to an optionally encrypted streaming logstash TCP listener. """ def __init__(self, host, port, keyfile=None, certfile=None, ssl=True): SocketHandler.__init__(self, host, port) self.keyfile = ke...
from logging.handlers import SocketHandler import ssl class LogstashHandler(SocketHandler): """ Sends output to an optionally encrypted streaming logstash TCP listener. """ def __init__(self, host, port, keyfile=None, certfile=None, ca_certs=None, ssl=True): SocketHandler.__init__(self, host, port) se...
Add support for CA certificates
Add support for CA certificates better SSL support
Python
mit
klynch/python-logstash-handler
09fa1e01c6de9dffc99c7726607d64c843b564ba
osgtest/tests/test_53_gums.py
osgtest/tests/test_53_gums.py
import os import pwd import unittest import osgtest.library.core as core import osgtest.library.files as files import osgtest.library.tomcat as tomcat import osgtest.library.osgunittest as osgunittest class TestGUMS(osgunittest.OSGTestCase): def test_01_map_user(self): core.skip_ok_unless_installed('gums...
import os import pwd import unittest import osgtest.library.core as core import osgtest.library.files as files import osgtest.library.tomcat as tomcat import osgtest.library.osgunittest as osgunittest class TestGUMS(osgunittest.OSGTestCase): def test_01_map_user(self): core.skip_ok_unless_installed('gums...
Revert accidental gums test change from previous commit.
Revert accidental gums test change from previous commit. git-svn-id: 884a03e47e2adb735d896e55bb5ad6bc3421ba19@17355 4e558342-562e-0410-864c-e07659590f8c
Python
apache-2.0
efajardo/osg-test,efajardo/osg-test
256a86b9cfbf2f78fc913b87997dd89673d177c5
custom/icds_reports/migrations/0070_ccsrecordmonthly_closed.py
custom/icds_reports/migrations/0070_ccsrecordmonthly_closed.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-09-11 14:35 from __future__ import unicode_literals from __future__ import absolute_import from django.db import migrations, models from corehq.sql_db.operations import RawSQLMigration from custom.icds_reports.utils.migrations import get_view_migrations mi...
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-09-11 14:35 from __future__ import unicode_literals from __future__ import absolute_import from django.db import migrations, models from corehq.sql_db.operations import RawSQLMigration from custom.icds_reports.utils.migrations import get_view_migrations mi...
Remove adding field to View model
Remove adding field to View model
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
49c00236569d48f651bd8f2226907d5c784cbe77
json262/json262.py
json262/json262.py
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*- """ Serialize data to/from JSON Inspired by https://github.com/django/django/blob/master/django/core/serializers/json.py """ # Avoid shadowing the standard library json module from __future__ import absolute_import from __future__ import unicode_literals import datetime import decimal import ...
Bring in encoder from webhooks.
Bring in encoder from webhooks.
Python
bsd-3-clause
audreyr/standardjson,audreyr/standardjson
94b716142a575e73d906f332fda84d68b549d5cd
trove/tests/unittests/util/util.py
trove/tests/unittests/util/util.py
# Copyright 2012 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 l...
# Copyright 2012 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 l...
Fix concurrency issue with Python 3.4 test
Fix concurrency issue with Python 3.4 test We have been seeing failures in parallel Py34 tests caused by the test database being set up more than once. The existing mechanism is not thread-safe. Add a lock around the database setup to ensure the it is ever executed by only one thread. Partially implements: blueprint ...
Python
apache-2.0
zhangg/trove,zhangg/trove,hplustree/trove,openstack/trove,openstack/trove,hplustree/trove
a44c71cf25672606bd866014982b18836acc46ef
string/reverse.py
string/reverse.py
# Reverse each word in a sentence def reverse_sentence(string, separator): # string_list = string.split() # flipped_list = string_list[::-1] flipped_list = (string.split())[::-1] # split string into list and then reverse order of elements in list output = separator.join(flipped_list) print output
# Reverse each word in a sentence def reverse_sentence(string): string_list = string.split() # split string by word into list output = ' '.join([word[::-1] for word in string_list]) # reverse each element/word in list and consolidate into single string print output # test cases test = "Hey dude!" reverse_sentence...
Debug method and add test cases
Debug method and add test cases
Python
mit
derekmpham/interview-prep,derekmpham/interview-prep
d029c67f59ce65f9ad651b2e261e7f29ef8c2ca2
sync_scheduler.py
sync_scheduler.py
from tapiriik.database import db from tapiriik.messagequeue import mq import kombu from datetime import datetime import time channel = mq.channel() exchange = kombu.Exchange("tapiriik-users", type="direct")(channel) exchange.declare() producer = kombu.Producer(channel, exchange) while True: queueing_at = datetime.ut...
from tapiriik.database import db from tapiriik.messagequeue import mq from tapiriik.sync import Sync import kombu from datetime import datetime import time Sync.InitializeWorkerBindings() producer = kombu.Producer(Sync._channel, Sync._exchange) while True: queueing_at = datetime.utcnow() users = db.users.find( ...
Declare relevant queues in sync scheduler
Declare relevant queues in sync scheduler
Python
apache-2.0
campbellr/tapiriik,niosus/tapiriik,dlenski/tapiriik,niosus/tapiriik,cmgrote/tapiriik,gavioto/tapiriik,cpfair/tapiriik,cpfair/tapiriik,abhijit86k/tapiriik,cheatos101/tapiriik,abhijit86k/tapiriik,niosus/tapiriik,cmgrote/tapiriik,dmschreiber/tapiriik,brunoflores/tapiriik,marxin/tapiriik,campbellr/tapiriik,cgourlay/tapirii...
8322c776fe989d65f83beaefff5089716d0286e7
test/test_pydh.py
test/test_pydh.py
import pyDH def test_pydh_keygen(): d1 = pyDH.DiffieHellman() d2 = pyDH.DiffieHellman() d1_pubkey = d1.gen_public_key() d2_pubkey = d2.gen_public_key() d1_sharedkey = d1.gen_shared_key(d2_pubkey) d2_sharedkey = d2.gen_shared_key(d1_pubkey) assert d1_sharedkey == d2_sharedkey
import sys sys.path.append('.') import pyDH def test_pydh_keygen(): d1 = pyDH.DiffieHellman() d2 = pyDH.DiffieHellman() d1_pubkey = d1.gen_public_key() d2_pubkey = d2.gen_public_key() d1_sharedkey = d1.gen_shared_key(d2_pubkey) d2_sharedkey = d2.gen_shared_key(d1_pubkey) assert d1_sharedkey...
Add current dir to Python path
Add current dir to Python path
Python
apache-2.0
amiralis/pyDH
4e309e7f70760e400dc7150b34e7f86c4c5643b4
golddust/packages.py
golddust/packages.py
# Copyright 2015-2017 John "LuaMilkshake" Marion # # 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 ag...
# Copyright 2015-2017 John "LuaMilkshake" Marion # # 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 ag...
Add munge_jar stub for InstallScript
Add munge_jar stub for InstallScript
Python
apache-2.0
Packeteers/GoldDust
4fb3ff629f88935a6dcd905f9268eb953b6ad7fb
src/syft/grid/client/request_api/group_api.py
src/syft/grid/client/request_api/group_api.py
# stdlib from typing import Any from typing import Dict # third party from pandas import DataFrame # syft relative from ...messages.group_messages import CreateGroupMessage from ...messages.group_messages import DeleteGroupMessage from ...messages.group_messages import GetGroupMessage from ...messages.group_messages ...
# stdlib from typing import Any from typing import Callable # syft relative from ...messages.group_messages import CreateGroupMessage from ...messages.group_messages import DeleteGroupMessage from ...messages.group_messages import GetGroupMessage from ...messages.group_messages import GetGroupsMessage from ...messages...
Update Group API - ADD type hints - Remove unused imports
Update Group API - ADD type hints - Remove unused imports
Python
apache-2.0
OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft
599760942e556c5d23deb0904beafcdf11235595
stoneridge_reporter.py
stoneridge_reporter.py
#!/usr/bin/env python # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. import glob import os import requests import stoneridge class StoneRidgeReporter(object): de...
#!/usr/bin/env python # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. import argparse import glob import os import requests import stoneridge class StoneRidgeReporter...
Make reporter succeed in talking to the graph server
Make reporter succeed in talking to the graph server
Python
mpl-2.0
mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge
101e50f1e668169836a5f253c938420f3675fb16
jesusmtnez/python/kata/game.py
jesusmtnez/python/kata/game.py
class Game(): def __init__(self): self._score = 0 def roll(self, pins): self._score += pins def score(self): return self._score
class Game(): def __init__(self): self._rolls = [0] * 21 self._current_roll = 0 def roll(self, pins): self._rolls[self._current_roll] += pins self._current_roll += 1 def score(self): score = 0 for frame in range(0, 20, 2): if self._is_spare(frame...
Add 'spare' support in when calculating scores
[Python] Add 'spare' support in when calculating scores
Python
mit
JesusMtnez/devexperto-challenge,JesusMtnez/devexperto-challenge
2060cf215d851f86ae8c2766b4a2985c9a37cfae
temba/flows/migrations/0056_indexes_update.py
temba/flows/migrations/0056_indexes_update.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations INDEX_SQL = """ CREATE INDEX flows_flowrun_org_modified_id ON flows_flowrun (org_id, modified_on DESC, id DESC); DROP INDEX IF EXISTS flows_flowrun_org_id_modified_on; CREATE INDEX flows_flowrun_org_responded_modified_...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations INDEX_SQL = """ CREATE INDEX flows_flowrun_org_modified_id ON flows_flowrun (org_id, modified_on DESC, id DESC); DROP INDEX IF EXISTS flows_flowrun_org_id_modified_on; CREATE INDEX flows_flowrun_org_modified_id_where_r...
Revert "index on flow run responded field as well"
Revert "index on flow run responded field as well" This reverts commit cbbac0f0f23f6e0ad3ce15a784aad30a82a2fe5a.
Python
agpl-3.0
ewheeler/rapidpro,tsotetsi/textily-web,tsotetsi/textily-web,pulilab/rapidpro,tsotetsi/textily-web,tsotetsi/textily-web,tsotetsi/textily-web,pulilab/rapidpro,ewheeler/rapidpro,pulilab/rapidpro,pulilab/rapidpro,ewheeler/rapidpro,pulilab/rapidpro,ewheeler/rapidpro
1f5d52f18df2fba70b53acd681ebb381f532adff
tests/conftest.py
tests/conftest.py
""" Fixtures in this file are available to all files automatically, no importing required. Only put general purpose fixtures here! """ import pytest import os from shutil import rmtree TEST_CONFIG = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'config.cfg') @pytest.fixture(scope='se...
""" Fixtures in this file are available to all files automatically, no importing required. Only put general purpose fixtures here! """ import pytest import os from shutil import rmtree TEST_CONFIG = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'config.cfg') @pytest.fixture(scope='se...
Document expected behaviour instead of leaving XXX comment
Document expected behaviour instead of leaving XXX comment
Python
agpl-3.0
wakermahmud/sync-engine,ErinCall/sync-engine,nylas/sync-engine,Eagles2F/sync-engine,EthanBlackburn/sync-engine,closeio/nylas,nylas/sync-engine,PriviPK/privipk-sync-engine,ErinCall/sync-engine,ErinCall/sync-engine,Eagles2F/sync-engine,gale320/sync-engine,EthanBlackburn/sync-engine,ErinCall/sync-engine,EthanBlackburn/syn...
f17611b39c9cc3ec6815093db2eb85cb6b30b5ba
lwr/lwr_client/transport/standard.py
lwr/lwr_client/transport/standard.py
""" LWR HTTP Client layer based on Python Standard Library (urllib2) """ from __future__ import with_statement from os.path import getsize import mmap try: from urllib2 import urlopen except ImportError: from urllib.request import urlopen try: from urllib2 import Request except ImportError: from urllib....
""" LWR HTTP Client layer based on Python Standard Library (urllib2) """ from __future__ import with_statement from os.path import getsize import mmap try: from urllib2 import urlopen except ImportError: from urllib.request import urlopen try: from urllib2 import Request except ImportError: from urllib....
Fix small bug introduced in 0b8e5d428e60.
Fix small bug introduced in 0b8e5d428e60. Opening file twice.
Python
apache-2.0
jmchilton/pulsar,natefoo/pulsar,ssorgatem/pulsar,jmchilton/lwr,galaxyproject/pulsar,jmchilton/pulsar,ssorgatem/pulsar,galaxyproject/pulsar,natefoo/pulsar,jmchilton/lwr
0858cd463d4e6179e3bf4abbfa94cc54fb0600db
test/integration/test_node_propagation.py
test/integration/test_node_propagation.py
class TestPropagation(object): def test_node_propagation(self): """ Tests that check node propagation 1) Spin up four servers. 2) Make the first one send a sync request to all three others. 3) Count the numbers of requests made. 4) Check databases to see that they al...
from kitten.server import KittenServer from gevent.pool import Group from mock import MagicMock class TestPropagation(object): def setup_method(self, method): self.servers = Group() for port in range(4): ns = MagicMock() ns.port = 9812 + port server = Kitten...
Add setup to first integration test
Add setup to first integration test
Python
mit
thiderman/network-kitten
4c655c31bf9625fe426c8b481afba41fe328494d
metaci/api/renderers/csv_renderer.py
metaci/api/renderers/csv_renderer.py
# I started here: https://www.django-rest-framework.org/api-guide/renderers/#example from rest_framework import renderers import unicodecsv as csv import io import logging logger = logging.getLogger(__name__) class SimpleCSVRenderer(renderers.BaseRenderer): """Renders simple 1-level-deep data as csv""" med...
# I started here: https://www.django-rest-framework.org/api-guide/renderers/#example import csv import io import logging from rest_framework import renderers logger = logging.getLogger(__name__) class SimpleCSVRenderer(renderers.BaseRenderer): """Renders simple 1-level-deep data as csv""" media_type = "te...
Remove dependency on unicodecsv module
Remove dependency on unicodecsv module
Python
bsd-3-clause
SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci
f1f18b6b996d2bcf108bf7b594d0fdf4dab23057
timpani/themes.py
timpani/themes.py
import os import os.path from . import database THEME_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "../themes")) def getCurrentTheme(): databaseConnection = database.ConnectionManager.getConnection("main") query = (databaseConnection.session .query(database.tables.Setting) .filter(database.tab...
import os import os.path from . import database THEME_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "../themes")) def getCurrentTheme(): databaseConnection = database.ConnectionManager.getConnection("main") query = (databaseConnection.session .query(database.tables.Setting) .filter(database.tab...
Add cases for either CSS or template not existing
Add cases for either CSS or template not existing
Python
mit
ollien/Timpani,ollien/Timpani,ollien/Timpani
f5aa51a57e3d161c12d8b8390e6e6aab7609b459
readthedocs/projects/feeds.py
readthedocs/projects/feeds.py
from django.contrib.syndication.views import Feed from django.db.models import Max from projects.models import Project class LatestProjectsFeed(Feed): title = "Recently updated documentation" link = "http://readthedocs.org" description = "Recently updated documentation on Read the Docs" def items(sel...
from django.contrib.syndication.views import Feed from django.db.models import Max from projects.models import Project class LatestProjectsFeed(Feed): title = "Recently updated documentation" link = "http://readthedocs.org" description = "Recently updated documentation on Read the Docs" def items(sel...
Make the RSS feed not slow.
Make the RSS feed not slow.
Python
mit
VishvajitP/readthedocs.org,soulshake/readthedocs.org,agjohnson/readthedocs.org,attakei/readthedocs-oauth,nikolas/readthedocs.org,pombredanne/readthedocs.org,michaelmcandrew/readthedocs.org,laplaceliu/readthedocs.org,takluyver/readthedocs.org,atsuyim/readthedocs.org,mrshoki/readthedocs.org,d0ugal/readthedocs.org,asampat...
29316060fb422a881833e411350e0149575bf1c4
update-database/stackdoc/namespaces/python.py
update-database/stackdoc/namespaces/python.py
import re import urllib ############### Functions called by stackdoc def get_version(): return 1 def get_ids(title, body, tags): ids = [] if "http://docs.python.org/" in body: urls = re.findall(r'<a href="([^"]+)"', body) for url in urls: m = re.match("http://docs.python.org/...
import re import urllib ############### Functions called by stackdoc def get_version(): return 2 def get_ids(title, body, tags): ids = [] if "http://docs.python.org/" in body or "http://www.python.org/doc/" in body: urls = re.findall(r'<a href="([^"]+)"', body) for url in urls: ...
Support old style Python doc links.
Support old style Python doc links.
Python
bsd-3-clause
alnorth/stackdoc,alnorth/stackdoc,alnorth/stackdoc
f19d4eaec9681192eb761758b1506638b78a5e15
tests/__init__.py
tests/__init__.py
import inspect import os # Get testdata absolute path. abs_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) path = abs_path + "/testdata"
import inspect import os # Get testdata absolute path. abs_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) #path = abs_path + "/testdata" path = "./testdata"
Change the testdata path to relative path.
Change the testdata path to relative path.
Python
mit
PytLab/VASPy,PytLab/VASPy
4ce674ea3a672c2819112b5237319000e33f22c5
marten/__init__.py
marten/__init__.py
"""Stupid simple Python configuration environments""" from __future__ import absolute_import import os as _os __version__ = '0.6.0' _os.environ.setdefault('MARTEN_ENV', 'default') try: from .util import get_config_from_env as _get_config except ImportError: config = None else: config = _get_config()
"""Stupid simple Python configuration environments""" from __future__ import absolute_import from marten import loaded_configs import os as _os __version__ = '0.6.1' _os.environ.setdefault('MARTEN_ENV', 'default') try: from .util import get_config_from_env as _get_config except ImportError: config = None else...
Add explicit import for loaded_configs namespace to fix RuntimeWarning
Add explicit import for loaded_configs namespace to fix RuntimeWarning
Python
mit
nick-allen/marten
0dac29f30853498f6e9d82c8b791ced5ec21667c
models/00_settings.py
models/00_settings.py
import os import logging import json from logging.config import dictConfig from gluon.storage import Storage from gluon.contrib.appconfig import AppConfig # app_config use to cache values in production app_config = AppConfig(reload=True) # settings is used to avoid cached values in production settings = Storage() #...
import os import logging import json from logging.config import dictConfig from gluon.storage import Storage from gluon.contrib.appconfig import AppConfig # app_config use to cache values in production app_config = AppConfig(reload=True) # settings is used to avoid cached values in production settings = Storage() #...
Check configuration file rather than env variable
Check configuration file rather than env variable
Python
apache-2.0
wefner/w2pfooty,wefner/w2pfooty,wefner/w2pfooty
6c0c05c523043abd4fb35ee53daf1a216346a94d
tests/runtests.py
tests/runtests.py
#!/usr/bin/env python ''' Discover all instances of unittest.TestCase in this directory. ''' # Import python libs import os # Import salt libs import saltunittest from integration import TestDaemon TEST_DIR = os.path.dirname(os.path.normpath(os.path.abspath(__file__))) def run_integration_tests(): with TestDaemon...
#!/usr/bin/env python ''' Discover all instances of unittest.TestCase in this directory. ''' # Import python libs import os # Import salt libs import saltunittest from integration import TestDaemon TEST_DIR = os.path.dirname(os.path.normpath(os.path.abspath(__file__))) def run_integration_tests(): with TestDaemon...
Add support for a dir of client tests
Add support for a dir of client tests
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
6c2d73b0d387eb49e38b0432318733b56d2deb96
tests/settings.py
tests/settings.py
SECRET_KEY = 'not-anymore' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', } } INSTALLED_APPS = [ 'tests', ]
SECRET_KEY = 'not-anymore' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', } } INSTALLED_APPS = [ 'tests', ] DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
Add support for Django 4.0.
Add support for Django 4.0.
Python
mit
gintas/django-picklefield
8d7862a7045fbb52ce3a2499766ffa1ffef284af
tests/settings.py
tests/settings.py
""" Settings for tests. """ from moztrap.settings.default import * DEFAULT_FILE_STORAGE = "tests.storage.MemoryStorage" ALLOW_ANONYMOUS_ACCESS = False SITE_URL = "http://localhost:80" USE_BROWSERID = True
""" Settings for tests. """ from moztrap.settings.default import * DEFAULT_FILE_STORAGE = "tests.storage.MemoryStorage" ALLOW_ANONYMOUS_ACCESS = False SITE_URL = "http://localhost:80" USE_BROWSERID = True PASSWORD_HASHERS = ['django.contrib.auth.hashers.UnsaltedMD5PasswordHasher']
Use faster password hashing in tests.
Use faster password hashing in tests.
Python
bsd-2-clause
mccarrmb/moztrap,bobsilverberg/moztrap,mozilla/moztrap,mccarrmb/moztrap,shinglyu/moztrap,mccarrmb/moztrap,shinglyu/moztrap,mccarrmb/moztrap,shinglyu/moztrap,mccarrmb/moztrap,bobsilverberg/moztrap,mozilla/moztrap,bobsilverberg/moztrap,shinglyu/moztrap,mozilla/moztrap,shinglyu/moztrap,bobsilverberg/moztrap,mozilla/moztra...