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
350bd08bdea2df07928d8203680a8bc33d1a7eb1
keops/settings.py
keops/settings.py
from katrid.conf.app_settings import * DATABASES = { 'default': { 'ENGINE': 'katrid.db.backends.sqlite3', 'NAME': 'db.sqlite3', } } AUTH_USER_MODEL = 'base.user' INSTALLED_APPS.append('keops') SERIALIZATION_MODULES = { 'python': 'keops.core.serializers.python', 'json': 'keops.core.se...
from katrid.conf.app_settings import * DATABASES = { 'default': { 'ENGINE': 'katrid.db.backends.sqlite3', 'NAME': 'db.sqlite3', } } AUTH_USER_MODEL = 'base.user' INSTALLED_APPS.append('keops') SERIALIZATION_MODULES = { 'python': 'keops.core.serializers.python', 'json': 'keops.core.se...
Add exclude fields to model options
Add exclude fields to model options
Python
bsd-3-clause
katrid/keops,katrid/keops,katrid/keops
80918b006ddf490096dbe4817162b3c1b8afd0d4
components/includes/utilities.py
components/includes/utilities.py
import random import json import SocketExtend as SockExt import config as conf import parser as p def ping(sock): try: rand = random.randint(1, 99999) data = {'request':'ping', 'contents': {'value':rand}} SockExt.send_msg(sock, json.dumps(data)) result = json.loads(SockExt.recv_msg(sock)) if result['retu...
import random import json import SocketExtend as SockExt import config as conf import parser as p def ping(sock): try: rand = random.randint(1, 99999) data = {'request':'ping', 'contents': {'value':rand}} SockExt.send_msg(sock, json.dumps(data)) result = json.loads(SockExt.recv_msg(sock)) if result['retu...
Clean up, comments, liveness checking, robust data transfer
Clean up, comments, liveness checking, robust data transfer
Python
bsd-2-clause
mavroudisv/Crux
e90c7d034f070361893f77d7a257640d647be0c7
mbuild/tests/test_xyz.py
mbuild/tests/test_xyz.py
import numpy as np import pytest import mbuild as mb from mbuild.utils.io import get_fn from mbuild.tests.base_test import BaseTest from mbuild.exceptions import MBuildError class TestXYZ(BaseTest): def test_load_no_top(self, ethane): ethane.save(filename='ethane.xyz') ethane_in = mb.load('ethane...
import numpy as np import pytest import mbuild as mb from mbuild.formats.xyz import write_xyz from mbuild.utils.io import get_fn from mbuild.tests.base_test import BaseTest from mbuild.exceptions import MBuildError class TestXYZ(BaseTest): def test_load_no_top(self, ethane): ethane.save(filename='ethane....
Add test to ensure write_xyz does not directly take in compound
Add test to ensure write_xyz does not directly take in compound
Python
mit
iModels/mbuild,iModels/mbuild
5682c2a311dbaf94f0b7876b10cabbc90eb88628
hooks/post_gen_project.py
hooks/post_gen_project.py
""" Does the following: 1. Removes _version file and run versionner install if use_versionner == y """ from __future__ import print_function import os from subprocess import call # Get the root project directory PROJECT_DIRECTORY = os.path.realpath(os.path.curdir) def remove_file(file_name): if os.path.exists(...
""" Does the following: 1. Removes _version file and run versionner install if use_versionner == y """ from __future__ import print_function import os from subprocess import call # Get the root project directory PROJECT_DIRECTORY = os.path.realpath(os.path.curdir) def remove_file(file_name): if os.path.exists(...
Add git init to post hooks, and move error handling to functions
Add git init to post hooks, and move error handling to functions
Python
mit
rlaverde/spyder-plugin-cookiecutter
309e4a922729e38a855bd89982cef9b40ba55831
cabot/metricsapp/models/elastic.py
cabot/metricsapp/models/elastic.py
from django.db import models from cabot.metricsapp.api import create_es_client from .base import MetricsSourceBase class ElasticsearchSource(MetricsSourceBase): class Meta: app_label = 'metricsapp' def __str__(self): return self.name urls = models.TextField( max_length=250, ...
from django.db import models from cabot.metricsapp.api import create_es_client from .base import MetricsSourceBase class ElasticsearchSource(MetricsSourceBase): class Meta: app_label = 'metricsapp' def __str__(self): return self.name urls = models.TextField( max_length=250, ...
Create new clients if timeout/urls change and store in a dict keyed by urls_timeout
Create new clients if timeout/urls change and store in a dict keyed by urls_timeout
Python
mit
Affirm/cabot,Affirm/cabot,Affirm/cabot,Affirm/cabot
5ac675b36c7c7ba9110b6b16e11a56f554ff8c8e
signbank/video/urls.py
signbank/video/urls.py
from django.conf.urls import * urlpatterns = patterns('', (r'^video/(?P<videoid>.*)$', 'signbank.video.views.video'), (r'^upload/', 'signbank.video.views.addvideo'), (r'^delete/(?P<videoid>.*)$', 'signbank.video.views.deletevideo'), (r'^poster/(?P<videoid>.*)$', 'signbank.video.views.poster'), ...
from django.conf.urls import * urlpatterns = patterns('', (r'^video/(?P<videoid>\d+)$', 'signbank.video.views.video'), (r'^upload/', 'signbank.video.views.addvideo'), (r'^delete/(?P<videoid>\d+)$', 'signbank.video.views.deletevideo'), (r'^poster/(?P<videoid>\d+)$', 'signbank.video.views.poster'), ...
Use more explicit pattern for video id in URL to prevent matching trailing slash.
Use more explicit pattern for video id in URL to prevent matching trailing slash.
Python
bsd-3-clause
Signbank/Auslan-signbank,Signbank/Auslan-signbank,Signbank/BSL-signbank,Signbank/BSL-signbank,Signbank/BSL-signbank,Signbank/Auslan-signbank,Signbank/BSL-signbank,Signbank/Auslan-signbank
5dc5de9dab24cf698dc26db24d1e1697472c2e05
tests/integration/pillar/test_pillar_include.py
tests/integration/pillar/test_pillar_include.py
from __future__ import unicode_literals from tests.support.case import ModuleCase class PillarIncludeTest(ModuleCase): def test_pillar_include(self): ''' Test pillar include ''' ret = self.minion_run('pillar.items') assert 'a' in ret['element'] assert ret['element'...
# -*- coding: utf-8 -*- ''' Pillar include tests ''' from __future__ import unicode_literals from tests.support.case import ModuleCase class PillarIncludeTest(ModuleCase): def test_pillar_include(self): ''' Test pillar include ''' ret = self.minion_run('pillar.items') ass...
Use file encoding and add docstring
Use file encoding and add docstring
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
55476a86ed482d2e1f473dc629848d2068225c73
keras/dtensor/__init__.py
keras/dtensor/__init__.py
# Copyright 2022 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# Copyright 2022 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Change keras to use dtensor public API.
Change keras to use dtensor public API. PiperOrigin-RevId: 438605222
Python
apache-2.0
keras-team/keras,keras-team/keras
0b88b8e2cf1f841535a679bea249fba19cd2ba1d
maas/client/viscera/tests/test_sshkeys.py
maas/client/viscera/tests/test_sshkeys.py
"""Test for `maas.client.viscera.sshkeys`.""" from .. import sshkeys from ...testing import ( make_string_without_spaces, TestCase, ) from ..testing import bind def make_origin(): return bind(sshkeys.SSHKeys, sshkeys.SSHKey) class TestSSHKeys(TestCase): def test__sshkeys_create(self): ""...
"""Test for `maas.client.viscera.sshkeys`.""" import random from .. import sshkeys from ...testing import ( make_string_without_spaces, TestCase, ) from ..testing import bind from testtools.matchers import Equals def make_origin(): return bind(sshkeys.SSHKeys, sshkeys.SSHKey) class TestSSHKeys(Test...
Add tests for .read methods
Add tests for .read methods
Python
agpl-3.0
alburnum/alburnum-maas-client,blakerouse/python-libmaas
0633a9dbc2dd5972c41a1d3a21243af7f1a11055
core/migrations/0065_alter_machinerequest_required_fields.py
core/migrations/0065_alter_machinerequest_required_fields.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2016-09-29 19:29 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0064_remove_ssh_keys_toggle'), ] operations = [ migrations.AlterMode...
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2016-09-29 19:29 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0064_remove_ssh_keys_toggle'), ] operations = [ migrations.AlterFiel...
Remove Meta-class change for AtmosphereUser
Remove Meta-class change for AtmosphereUser Fixed in solitary-snipe, so not needed anymore.
Python
apache-2.0
CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend
3e66c6546eda367bfef4038a4bb512862a9dd01f
config.py
config.py
# -*- coding: utf-8 -*- DOMAIN = 'studyindenmark-newscontrol.appspot.com' MAIL_SENDER = "Per Thulin <per@youtify.com>"
# -*- coding: utf-8 -*- DOMAIN = 'studyindenmark-newscontrol.appspot.com' MAIL_SENDER = "Study in Denmark <studyindenmark@gmail.com>"
Change email sender to studyindenmark@gmail.com
Change email sender to studyindenmark@gmail.com
Python
mit
studyindenmark/newscontrol,youtify/newscontrol,studyindenmark/newscontrol,youtify/newscontrol
aee3fa76d0d61778f17d200f630bbed145fd69c8
nova/policies/instance_usage_audit_log.py
nova/policies/instance_usage_audit_log.py
# Copyright 2016 Cloudbase Solutions Srl # 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 r...
# Copyright 2016 Cloudbase Solutions Srl # 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 r...
Add policy description for instance-usage-audit-log
Add policy description for instance-usage-audit-log This commit adds policy doc for instance-usage-audit-log policies. Partial implement blueprint policy-docs Change-Id: I8baedb9cb69ccb04361cc0003311487599bc9440
Python
apache-2.0
rahulunair/nova,jianghuaw/nova,mahak/nova,klmitch/nova,Juniper/nova,rahulunair/nova,klmitch/nova,mahak/nova,phenoxim/nova,rajalokan/nova,openstack/nova,mikalstill/nova,mikalstill/nova,klmitch/nova,gooddata/openstack-nova,Juniper/nova,Juniper/nova,mahak/nova,gooddata/openstack-nova,phenoxim/nova,jianghuaw/nova,rahulunai...
d8b5aa8d51fa61c400dd1929d3586e202b860b9d
registration/__init__.py
registration/__init__.py
from django.utils.version import get_version as django_get_version VERSION = (0, 9, 0, 'beta', 1) def get_version(): return django_get_version(VERSION) # pragma: no cover
VERSION = (0, 9, 0, 'beta', 1) def get_version(): from django.utils.version import get_version as django_get_version return django_get_version(VERSION) # pragma: no cover
Move import of Django's get_version into django-registration's get_version, to avoid dependency-order problems.
Move import of Django's get_version into django-registration's get_version, to avoid dependency-order problems.
Python
bsd-3-clause
remarkablerocket/django-mailinglist-registration,remarkablerocket/django-mailinglist-registration
fedf78926b7c135f0f86934975a2b70aa1256884
app/models.py
app/models.py
from datetime import datetime from werkzeug.security import generate_password_hash, check_password_hash from . import db class User(db.Model): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True, autoincrement=True) email = db.Column(db.String(64), ...
from datetime import datetime from flask.ext.login import UserMixin from werkzeug.security import generate_password_hash, check_password_hash from . import db, login_manager class User(UserMixin, db.Model): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True, autoincrement=True) ema...
Add user_loader function for loading a user
Add user_loader function for loading a user
Python
mit
finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is
5fba86c9f9b0d647dc8f821a97a7cc2dbb76deeb
basis_set_exchange/tests/test_aux_sanity.py
basis_set_exchange/tests/test_aux_sanity.py
""" Tests for sanity of auxiliary basis sets """ import pytest from .common_testvars import bs_names, bs_metadata @pytest.mark.parametrize('basis_name', bs_names) def test_aux_sanity(basis_name): """For all basis sets, check that 1. All aux basis sets exist 2. That the role of the aux basis set m...
""" Tests for sanity of auxiliary basis sets """ import pytest from .common_testvars import bs_names, bs_metadata from ..misc import transform_basis_name @pytest.mark.parametrize('basis_name', bs_names) def test_aux_sanity(basis_name): """For all basis sets, check that 1. All aux basis sets exist ...
Fix test: Auxiliaries can have multiple names
Fix test: Auxiliaries can have multiple names
Python
bsd-3-clause
MOLSSI-BSE/basis_set_exchange
eb28f042e1fdc6b18fbbc75b2dc31825b9ee70ee
dev/scripts/milestone2rst.py
dev/scripts/milestone2rst.py
from __future__ import print_function import urllib, json, sys def generate(milestone): # Find the milestone number for the given name milestones_json = json.loads(urllib.urlopen('https://api.github.com/repos/CoolProp/CoolProp/milestones').read()) # Map between name and number title_to_number_map...
from __future__ import print_function import urllib, json, sys def generate(milestone): # Find the milestone number for the given name milestones_json = json.loads(urllib.urlopen('https://api.github.com/repos/CoolProp/CoolProp/milestones').read()) # Map between name and number title_to_number_map...
Allow to get up to 100 issues at once
Allow to get up to 100 issues at once
Python
mit
dcprojects/CoolProp,DANA-Laboratory/CoolProp,JonWel/CoolProp,henningjp/CoolProp,JonWel/CoolProp,DANA-Laboratory/CoolProp,dcprojects/CoolProp,JonWel/CoolProp,CoolProp/CoolProp,CoolProp/CoolProp,CoolProp/CoolProp,dcprojects/CoolProp,CoolProp/CoolProp,henningjp/CoolProp,dcprojects/CoolProp,henningjp/CoolProp,JonWel/CoolPr...
f69125a2e9dcd614057c87a36b415f8966075334
distarray/tests/test_odin.py
distarray/tests/test_odin.py
import numpy as np from IPython.parallel import Client from distarray.client import DistArrayContext from distarray import odin import unittest c = Client() dv = c[:] dac = DistArrayContext(dv) @odin.local(dac) def localsin(da): return np.sin(da) @odin.local(dac) def localadd50(da): return da + 50 @odi...
import numpy as np from IPython.parallel import Client from distarray.client import DistArrayContext from distarray import odin import unittest c = Client() dv = c[:] dac = DistArrayContext(dv) @odin.local(dac) def local_sin(da): return np.sin(da) @odin.local(dac) def local_add50(da): return da + 50 @o...
Refactor names a bit for PEP8.
Refactor names a bit for PEP8.
Python
bsd-3-clause
enthought/distarray,RaoUmer/distarray,RaoUmer/distarray,enthought/distarray
e4332261b557c9567568517d33b55eaaa5d1468c
run_test_BMI_ku_model.py
run_test_BMI_ku_model.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Jan 10 10:56:16 2017 @author: kangwang """ import sys from permamodel.components import bmi_Ku_component x=bmi_Ku_component.BmiKuMethod() x.initialize() x.update() x.finalize() print x._values["ALT"][:]
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Jan 10 10:56:16 2017 @author: kangwang """ import os import sys from permamodel.components import bmi_Ku_component from permamodel.tests import examples_directory cfg_file = os.path.join(examples_directory, 'Ku_method.cfg') x = bmi_Ku_component.BmiKu...
Initialize takes exactly one parameter
Initialize takes exactly one parameter See http://bmi-python.readthedocs.io/en/latest/basic_modeling_interface.base.html#basic_modeling_interface.base.BmiBase.initialize
Python
mit
permamodel/permamodel,permamodel/permamodel
dcbb22300663f0484e81c13770f196e078e83ca5
api/base/parsers.py
api/base/parsers.py
from rest_framework.parsers import JSONParser from api.base.renderers import JSONAPIRenderer class JSONAPIParser(JSONParser): """ Parses JSON-serialized data. Overrides media_type. """ media_type = 'application/vnd.api+json' renderer_class = JSONAPIRenderer
from rest_framework.parsers import JSONParser from api.base.renderers import JSONAPIRenderer from api.base.exceptions import JSONAPIException class JSONAPIParser(JSONParser): """ Parses JSON-serialized data. Overrides media_type. """ media_type = 'application/vnd.api+json' renderer_class = JSONAPI...
Add parse method which flattens data dictionary.
Add parse method which flattens data dictionary.
Python
apache-2.0
icereval/osf.io,RomanZWang/osf.io,cwisecarver/osf.io,abought/osf.io,sloria/osf.io,aaxelb/osf.io,zamattiac/osf.io,KAsante95/osf.io,GageGaskins/osf.io,TomHeatwole/osf.io,pattisdr/osf.io,laurenrevere/osf.io,zamattiac/osf.io,emetsger/osf.io,rdhyee/osf.io,cslzchen/osf.io,mluke93/osf.io,samchrisinger/osf.io,mattclark/osf.io,...
6c59040e8c4aab37ff0c053e295b5b9705365d94
diylang/interpreter.py
diylang/interpreter.py
# -*- coding: utf-8 -*- from os.path import dirname, join from .evaluator import evaluate from .parser import parse, unparse, parse_multiple from .types import Environment def interpret(source, env=None): """ Interpret a DIY Lang program statement Accepts a program statement as a string, interprets it,...
# -*- coding: utf-8 -*- from .evaluator import evaluate from .parser import parse, unparse, parse_multiple from .types import Environment def interpret(source, env=None): """ Interpret a DIY Lang program statement Accepts a program statement as a string, interprets it, and then returns the resulting...
Remove unused imports in interpeter.
Remove unused imports in interpeter.
Python
bsd-3-clause
kvalle/diy-lang,kvalle/diy-lang,kvalle/diy-lisp,kvalle/diy-lisp
ad00d75cac0afe585853092d458a0d99c1373fc8
dlstats/fetchers/__init__.py
dlstats/fetchers/__init__.py
#! /usr/bin/env python3 # -*- coding: utf-8 -*- from . import eurostat, insee, world_bank, IMF, BEA
#! /usr/bin/env python3 # -*- coding: utf-8 -*- from .eurostat import Eurostat from .insee import Insee from .world_bank import WorldBank from .IMF import IMF from .BEA import BEA __all__ = ['Eurostat', 'Insee', 'WorldBank', 'IMF', 'BEA']
Clean up the fetchers namespace
Clean up the fetchers namespace
Python
agpl-3.0
MichelJuillard/dlstats,mmalter/dlstats,MichelJuillard/dlstats,Widukind/dlstats,mmalter/dlstats,MichelJuillard/dlstats,Widukind/dlstats,mmalter/dlstats
f8b229b3f769ddbb21cfd57a8e0ad5341f965439
pylearn2/costs/tests/test_lp_norm_cost.py
pylearn2/costs/tests/test_lp_norm_cost.py
""" Test LpNorm cost """ import numpy import theano from theano import tensor as T from nose.tools import raises def test_shared_variables(): ''' LpNorm should handle shared variables. ''' assert False def test_symbolic_expressions_of_shared_variables(): ''' LpNorm should handle symbolic exp...
""" Test LpNorm cost """ import os from nose.tools import raises from pylearn2.models.mlp import Linear from pylearn2.models.mlp import Softmax from pylearn2.models.mlp import MLP from pylearn2.costs.cost import LpNorm from pylearn2.datasets.cifar10 import CIFAR10 from pylearn2.training_algorithms.sgd import SGD from p...
Add more code to LpNorm unit tests
Add more code to LpNorm unit tests
Python
bsd-3-clause
JesseLivezey/pylearn2,lisa-lab/pylearn2,w1kke/pylearn2,theoryno3/pylearn2,jeremyfix/pylearn2,se4u/pylearn2,mkraemer67/pylearn2,caidongyun/pylearn2,abergeron/pylearn2,aalmah/pylearn2,junbochen/pylearn2,daemonmaker/pylearn2,alexjc/pylearn2,jamessergeant/pylearn2,matrogers/pylearn2,alexjc/pylearn2,CIFASIS/pylearn2,goodfel...
a154611449f1f5a485ac0e12a9feb9e28e342331
server/pypi/packages/grpcio/test/__init__.py
server/pypi/packages/grpcio/test/__init__.py
from __future__ import absolute_import, division, print_function import unittest # Adapted from https://github.com/grpc/grpc/blob/master/examples/python/helloworld. class TestGrpcio(unittest.TestCase): def setUp(self): from concurrent import futures import grpc from . import helloworld_p...
from __future__ import absolute_import, division, print_function import unittest # Adapted from https://github.com/grpc/grpc/blob/master/examples/python/helloworld. class TestGrpcio(unittest.TestCase): def setUp(self): from concurrent import futures import grpc from . import helloworld_p...
Fix hardcoded port number in grpcio test
Fix hardcoded port number in grpcio test
Python
mit
chaquo/chaquopy,chaquo/chaquopy,chaquo/chaquopy,chaquo/chaquopy,chaquo/chaquopy
556bda5688f86949b48d52a997b6de6f4edef45f
fields.py
fields.py
import logging import remoteobjects.dataobject import remoteobjects.fields from remoteobjects.fields import * import typepad.tpobject class Link(remoteobjects.fields.Link): """A `TypePadObject` property representing a link from one TypePad API object to another. This `Link` works like `remoteobjects.fi...
import logging import remoteobjects.dataobject import remoteobjects.fields from remoteobjects.fields import * import typepad.tpobject class Link(remoteobjects.fields.Link): """A `TypePadObject` property representing a link from one TypePad API object to another. This `Link` works like `remoteobjects.fi...
Return the Link instance itself when accessed through a class (so sphinx autodoc works)
Return the Link instance itself when accessed through a class (so sphinx autodoc works)
Python
bsd-3-clause
typepad/python-typepad-api
b8154abba5e1ea176566af2dcfa6eb2407dad9c6
chrome/test/chromedriver/embed_version_in_cpp.py
chrome/test/chromedriver/embed_version_in_cpp.py
#!/usr/bin/env python # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Embeds Chrome user data files in C++ code.""" import optparse import os import sys import chrome_paths import cpp_source sys.path...
#!/usr/bin/env python # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Embeds Chrome user data files in C++ code.""" import optparse import os import sys import chrome_paths import cpp_source sys.path...
Add revision info only if available.
[chromedriver] Add revision info only if available. This may not be available if building on a branch. BUG=305371 NOTRY=true Review URL: https://codereview.chromium.org/26754002 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@227842 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
fujunwei/chromium-crosswalk,ltilve/chromium,Fireblend/chromium-crosswalk,ChromiumWebApps/chromium,jaruba/chromium.src,patrickm/chromium.src,Chilledheart/chromium,ltilve/chromium,M4sse/chromium.src,ondra-novak/chromium.src,jaruba/chromium.src,ChromiumWebApps/chromium,hgl888/chromium-crosswalk-efl,bright-sparks/chromium-...
cc103392eea1f620b656e0dfdb1432a1a589385c
euler_python/problem55.py
euler_python/problem55.py
""" problem55.py If we take 47, reverse and add, 47 + 74 = 121, which is palindromic. A number that never forms a palindrome through the reverse and add process is called a Lychrel number. How many Lychrel numbers are there below ten-thousand? (Only consider fifty iterations) """ from toolset import iterate, quantify,...
""" problem55.py If we take 47, reverse and add, 47 + 74 = 121, which is palindromic. A number that never forms a palindrome through the reverse and add process is called a Lychrel number. How many Lychrel numbers are there below ten-thousand? (Only consider fifty iterations) """ from toolset import iterate, quantify,...
Use clearer function name in is_lychrel
Use clearer function name in is_lychrel
Python
mit
mjwestcott/projecteuler,mjwestcott/projecteuler,mjwestcott/projecteuler
7a1351c7f677380eeee8027399e69b0d34e3e858
daybed/tests/features/model_data.py
daybed/tests/features/model_data.py
import json from lettuce import step, world @step(u'post "([^"]*)" records?') def post_record(step, model_name): world.path = '/data/%s' % str(model_name.lower()) for record in step.hashes: data = json.dumps(record) world.response = world.browser.post(world.path, params=data, status='*') @st...
import json from lettuce import step, world @step(u'post "([^"]*)" records?') def post_record(step, model_name): world.path = '/data/%s' % str(model_name.lower()) for record in step.hashes: data = json.dumps(record) world.response = world.browser.post(world.path, params=data, status='*') @st...
Fix bug of adding the id to the resulting data
Fix bug of adding the id to the resulting data
Python
bsd-3-clause
spiral-project/daybed,spiral-project/daybed
57bc5d89450633ffed33460ae18842f728d601ed
enthought/qt/QtCore.py
enthought/qt/QtCore.py
import os qt_api = os.environ.get('QT_API', 'pyqt') if qt_api == 'pyqt': from PyQt4.QtCore import * from PyQt4.QtCore import pyqtSignal as Signal from PyQt4.Qt import QCoreApplication from PyQt4.Qt import Qt # Emulate PySide version metadata. __version__ = QT_VERSION_STR __version_info__...
import os qt_api = os.environ.get('QT_API', 'pyqt') if qt_api == 'pyqt': from PyQt4.QtCore import * from PyQt4.QtCore import pyqtSignal as Signal from PyQt4.Qt import QCoreApplication from PyQt4.Qt import Qt __version__ = QT_VERSION_STR __version_info__ = tuple(map(int, QT_VERSION_STR.split(...
Add version info for PySide as well.
Add version info for PySide as well.
Python
bsd-3-clause
burnpanck/traits,burnpanck/traits
ba2618e5ca63cad92e17ea154c9d8332064f7771
pdvega/_axes.py
pdvega/_axes.py
from vega3 import VegaLite class VegaLiteAxes(object): """Class representing a pdvega plot axes""" def __init__(self, spec=None, data=None): self.vlspec = VegaLite(spec, data) @property def spec(self): return self.vlspec.spec @property def data(self): return self.vlsp...
from vega3 import VegaLite class VegaLiteAxes(object): """Class representing a pdvega plot axes""" def __init__(self, spec=None, data=None): self.vlspec = VegaLite(spec, data) @property def spec(self): return self.vlspec.spec @property def spec_no_data(self): return {...
Add spec_no_data attribute to axes
Add spec_no_data attribute to axes
Python
mit
jakevdp/pdvega
a3b31c0a3157accb76611d57caa591cd2cdf8d7a
tests/test_mgi_load.py
tests/test_mgi_load.py
from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker import mgi import mgi.load import mgi.models def test_mgi_load(): engine = create_engine('sqlite://') metadata = mgi.models.Base.metadata metadata.bind = engine metadata.create_all() sessionmaker_ = sessionmaker(engine) ...
from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from sqlalchemy import and_ import mgi import mgi.load import mgi.models from translations.models import Translation def test_mgi_load(): engine = create_engine('sqlite://') metadata = mgi.models.Base.metadata metadata.bind = eng...
Test MGI translation loading too.
Test MGI translation loading too.
Python
mit
luispedro/waldo,luispedro/waldo
f19fb3bf2eb90f77b193dc25f5b8bec0dfd253bc
fabtools/require/mysql.py
fabtools/require/mysql.py
""" Idempotent API for managing MySQL users and databases """ from __future__ import with_statement from fabtools.mysql import * from fabtools.deb import is_installed, preseed_package from fabtools.require.deb import package from fabtools.require.service import started def server(version='5.1', password=None): "...
""" Idempotent API for managing MySQL users and databases """ from __future__ import with_statement from fabtools.mysql import * from fabtools.deb import is_installed, preseed_package from fabtools.require.deb import package from fabtools.require.service import started def server(version=None, password=None): ""...
Fix require MySQL server on Ubuntu 12.04 LTS
Fix require MySQL server on Ubuntu 12.04 LTS
Python
bsd-2-clause
pombredanne/fabtools,ronnix/fabtools,fabtools/fabtools,badele/fabtools,sociateru/fabtools,davidcaste/fabtools,pahaz/fabtools,n0n0x/fabtools-python,ahnjungho/fabtools,hagai26/fabtools,prologic/fabtools,AMOSoft/fabtools,bitmonk/fabtools,wagigi/fabtools-python
d540b7c14b9411acdedfe41a77fd4911ef2eb660
src/cmdtree/tests/functional/test_command.py
src/cmdtree/tests/functional/test_command.py
from cmdtree import INT from cmdtree import command, argument, option @argument("host", help="server listen address") @option("reload", is_flag=True, help="if auto-reload on") @option("port", help="server port", type=INT, default=8888) @command(help="run a http server on given address") def run_server(host, reload, p...
import pytest from cmdtree import INT from cmdtree import command, argument, option @argument("host", help="server listen address") @option("reload", is_flag=True, help="if auto-reload on") @option("port", help="server port", type=INT, default=8888) @command(help="run a http server on given address") def run_server(h...
Add functional test for reverse decorator order
Update: Add functional test for reverse decorator order
Python
mit
winkidney/cmdtree,winkidney/cmdtree
d91f12a36e7980111511a6eb94aea2b09a18cb42
app/models.py
app/models.py
from app import db class Base(db.Model): __abstract__ = True pk = db.Column(db.Integer, primary_key=True) created_at = db.Column(db.DateTime, default=db.func.current_timestamp()) updated_at = db.Column(db.DateTime, default=db.func.current_timestamp()) class Route(Base): __tablename__ = 'route...
from app import db from app.dijkstra import Graph, get_shortest_path class Base(db.Model): __abstract__ = True pk = db.Column(db.Integer, primary_key=True) created_at = db.Column(db.DateTime, default=db.func.current_timestamp()) updated_at = db.Column(db.DateTime, default=db.func.current_timestamp()...
Add "calculate" method to Route model to calculate the cost
Add "calculate" method to Route model to calculate the cost
Python
mit
mdsrosa/routes_api_python
8f264af74ca4f1b956af33853134ff8ec722fc40
huecli.py
huecli.py
import click from hue import bridge, configuration @click.group() def cli(): """ Control Philips HUE lighting from the command line """ @cli.command() def setup(): """ Setup connection to Bridge """ ip_address = bridge.discover() bridge.connect(ip_address) config = configuration....
import click from hue import bridge, configuration @click.group() def cli(): """ Control Philips HUE lighting from the command line """ @cli.command() def setup(): """ Setup connection to Bridge """ ip_address = bridge.discover() bridge.connect(ip_address) config = configuration....
Add status to list output
Add status to list output
Python
mit
projectweekend/HUEcli
09d10b24fabbc5982d118b4ba292732945c0e78d
vocab.py
vocab.py
import sys from collections import defaultdict counter = defaultdict(int) cut = 10 with open(sys.argv[1]) as f: for line in f: for word in line.split(): counter[word] += 1 from operator import itemgetter for word,count in sorted( counter.iteritems(), key=itemgetter(1), reverse=True ): ...
from __future__ import print_function import sys from collections import Counter from operator import itemgetter def main(): cut = 10 counter = Counter() with open(sys.argv[1], 'r') as f: for line in f: for word in line.split(): counter[word] += 1 for word, count i...
Clean Python code and make it compatible with both python2 and python3
Clean Python code and make it compatible with both python2 and python3
Python
mit
alexalemi/textbench,alexalemi/textbench,alexalemi/textbench,alexalemi/textbench,alexalemi/textbench
05c3775c589b5afdb9f3d7d3e347615d699669c7
catwatch/blueprints/issue/views.py
catwatch/blueprints/issue/views.py
from flask import ( Blueprint, flash, redirect, url_for, render_template) from flask_login import current_user from flask_babel import gettext as _ from catwatch.blueprints.issue.models import Issue from catwatch.blueprints.issue.forms import SupportForm issue = Blueprint('issue', __name__, templ...
from flask import ( Blueprint, flash, redirect, url_for, render_template) from flask_login import current_user from flask_babel import gettext as _ from catwatch.blueprints.issue.models import Issue from catwatch.blueprints.issue.forms import SupportForm issue = Blueprint('issue', __name__, templ...
Normalize the issue blueprint's code base
Normalize the issue blueprint's code base
Python
mit
nickjj/build-a-saas-app-with-flask,nickjj/build-a-saas-app-with-flask,z123/build-a-saas-app-with-flask,nickjj/build-a-saas-app-with-flask,nickjj/build-a-saas-app-with-flask,z123/build-a-saas-app-with-flask,z123/build-a-saas-app-with-flask
4c0173263b59b9f2940c70a362ced8bfeb26c4f3
databaker/framework.py
databaker/framework.py
import xlutils, xypath import databaker import os import databaker.constants from databaker.constants import * # also brings in template import databaker.databakersolo as ds # causes the xypath.loader to be overwritten from databaker.jupybakeutils import HDim, HDimConst, savepreviewhtml, writetechnicalCSV, Conve...
import xlutils, xypath import databaker import os import databaker.constants from databaker.constants import * # also brings in template import databaker.databakersolo as ds # causes the xypath.loader to be overwritten from databaker.jupybakeutils import HDim, HDimConst, savepreviewhtml, writetechnicalCSV, Conve...
Add table sheet selection capabilit
Add table sheet selection capabilit
Python
agpl-3.0
scraperwiki/databaker,scraperwiki/databaker
11443eda1a192c0f3a4aa8225263b4e312fa5a55
spam_lists/exceptions.py
spam_lists/exceptions.py
# -*- coding: utf-8 -*- class SpamListsError(Exception): '''There was an error during testing a url or host''' class UnknownCodeError(SpamListsError): '''The classification code from the service was not recognized''' class UnathorizedAPIKeyError(SpamListsError): '''The API key used to query the s...
# -*- coding: utf-8 -*- class SpamListsError(Exception): '''There was an error during testing a url or host''' class UnknownCodeError(SpamListsError, KeyError): '''The classification code from the service was not recognized''' class UnathorizedAPIKeyError(SpamListsError): '''The API key used to q...
Make UnknownCodeError additionally extend KeyError
Make UnknownCodeError additionally extend KeyError
Python
mit
piotr-rusin/spam-lists
8b4cc54e55ac222f444c512b6dc1b1d55475cddb
rusts.py
rusts.py
#!/usr/bin/env python2 import valve.source.a2s SERVER="163.172.17.175" PORT=30616 def playerList(server): server = valve.source.a2s.ServerQuerier(server) info = server.info() players = server.players() for p in players['players']: if p["name"]: print(p["name"]) + " (" + str(int((p...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import valve.source.a2s SERVER="163.172.17.175" PORT=30616 def playerList(server): """Retreive player and limited server/game information and print the results Specifically, this retrieves information re: a Rust server. ---------------------------- ...
Update server info, game info, add pretty print, general cleanup.
Update server info, game info, add pretty print, general cleanup.
Python
unlicense
saildata/steamscript,lluis/steamscript,oleerik/steamscript
011949b266ab33df8c0f9bec29ba693824e7d8ef
setup.py
setup.py
#!/usr/bin/env python3 import sys from distutils.core import setup setup( name='pathlib', version=open('VERSION.txt').read().strip(), py_modules=['pathlib'], license='MIT License', description='Object-oriented filesystem paths', long_description=open('README.txt').read(), author='Antoine P...
#!/usr/bin/env python3 import sys from distutils.core import setup setup( name='pathlib', version=open('VERSION.txt').read().strip(), py_modules=['pathlib'], license='MIT License', description='Object-oriented filesystem paths', long_description=open('README.txt').read(), author='Antoine P...
Add classifier for Python 3.3
Add classifier for Python 3.3
Python
mit
pombreda/pathlib
d3650454eed490e4c91216b26463ae135c47e305
setup.py
setup.py
import os, os.path, sys, shutil from distutils.sysconfig import get_python_inc from distutils.core import setup, Extension from distutils.command.build_ext import build_ext libs = ['user32'] setup(name="pyHook", version="1.1", author="Peter Parente", author_email="parente@cs.unc.edu", url="http://ww...
'''pyHook: Python wrapper for out-of-context input hooks in Windows The pyHook package provides callbacks for global mouse and keyboard events in Windows. Python applications register event handlers for user input events such as left mouse down, left mouse up, key down, etc. and set the keyboard and/or mouse hook. T...
Put in specific metadata to register with pyPI
Put in specific metadata to register with pyPI
Python
mit
carolus-rex/pyhook_3000,Answeror/pyhook_py3k
25aba2beceda000d89aab969fec96fc1678e6f6a
websockets/test_uri.py
websockets/test_uri.py
import unittest from .exceptions import InvalidURI from .uri import * VALID_URIS = [ ('ws://localhost/', (False, 'localhost', 80, '/')), ('wss://localhost/', (True, 'localhost', 443, '/')), ('ws://localhost/path?query', (False, 'localhost', 80, '/path?query')), ('WS://LOCALHOST/PATH?QUERY', (False, '...
import unittest from .exceptions import InvalidURI from .uri import * VALID_URIS = [ ('ws://localhost/', (False, 'localhost', 80, '/')), ('wss://localhost/', (True, 'localhost', 443, '/')), ('ws://localhost/path?query', (False, 'localhost', 80, '/path?query')), ('WS://LOCALHOST/PATH?QUERY', (False, '...
Fix a test case and add another.
Fix a test case and add another.
Python
bsd-3-clause
aaugustin/websockets,aaugustin/websockets,dommert/pywebsockets,aaugustin/websockets,aaugustin/websockets,andrewyoung1991/websockets,biddyweb/websockets
cc3f475345a6a0885eea7bc7ba41ebabd2821488
src/damis/models.py
src/damis/models.py
from django.db import models from django.contrib.auth.models import User class DatasetLicence(models.Model): title = models.CharField(max_length=255) short_title = models.CharField(max_length=30) url = models.URLField() summary = models.TextField() updated = models.DatetimeField(auto_now=True) ...
from django.db import models from django.contrib.auth.models import User class DatasetLicence(models.Model): title = models.CharField(max_length=255) short_title = models.CharField(max_length=30) url = models.URLField() summary = models.TextField() updated = models.DateTimeField(auto_now=True) ...
Add dataset upload_to attribute. Fix DateTimeField name.
Add dataset upload_to attribute. Fix DateTimeField name.
Python
agpl-3.0
InScience/DAMIS-old,InScience/DAMIS-old
364aa00d3f97711e25654f63e5d4ab5d6b4e7d44
tests/mod_auth_tests.py
tests/mod_auth_tests.py
from tests.app_tests import BaseTestCase from app.mod_auth.models import * from app.mod_auth.views import user_is_logged_in from flask import url_for USERNAME = 'username' PASSWORD = 'password' INVALID_USERNAME = 'wrong_username' INVALID_PASSWORD = 'wrong_password' class TestAuth(BaseTestCase): def setUp(self): ...
from tests.app_tests import BaseTestCase from app.mod_auth.models import * from app.mod_auth.views import user_is_logged_in from flask import url_for USERNAME = 'username' PASSWORD = 'password' INVALID_USERNAME = 'wrong_username' INVALID_PASSWORD = 'wrong_password' class TestAuth(BaseTestCase): def setUp(self): ...
Use BaseModel.create to create a test user
Use BaseModel.create to create a test user
Python
mit
ziel980/website,ziel980/website
64d7ca9695eed6112c793fda3f2e7fea3751c3cc
tasks.py
tasks.py
from invoke import run from invoke import task @task def clean(docs=False, bytecode=True, extra=''): patterns = ['build'] if docs: patterns.append('docs/_build') if bytecode: patterns.append('**/*.pyc') if extra: patterns.append(extra) for pattern in patterns: run("...
from invoke import run from invoke import task @task def clean(all=False): if all: flag = "--all" else: flag = "" run("python setup.py clean {}".format(flag)) @task def build(docs=False): run("python setup.py build") if docs: run("sphinx-build docs docs/_build") @task d...
Change clean task to use setup.py
Change clean task to use setup.py
Python
bsd-3-clause
pando85/django-registration,allo-/django-registration,sergafts/django-registration,pando85/django-registration,allo-/django-registration,sergafts/django-registration
b4fa43b85a162fa9bef3cb67c2dd523f25707b4d
mo/cli.py
mo/cli.py
from argparse import ArgumentParser import yaml from .runner import Runner def parse_variables(args): variables = {} if args is not None: for variable in args: tokens = variable.split('=') name = tokens[0] value = '='.join(tokens[1:]) variables[name] ...
from argparse import ArgumentParser import yaml from .runner import Runner def parse_variables(args): variables = {} if args is not None: for variable in args: tokens = variable.split('=') name = tokens[0] value = '='.join(tokens[1:]) variables[name] ...
Add a way of listing commands
Add a way of listing commands
Python
mit
thomasleese/mo
a6a59cc0fded7bd2f6dc1d0d01e68836f33726aa
mdotdevs/tests.py
mdotdevs/tests.py
from django.test import TestCase # Create your tests here.
from django.test import TestCase from django.test import Client from django.core.urlresolvers import resolve class MdotdevTest(TestCase): def setUp(self): self.client = Client() pass def test_url_home(self): resolver = resolve('/developers/') self.assertEqual('home', resolver....
Test the urls.py and views.py.
Test the urls.py and views.py.
Python
apache-2.0
uw-it-aca/mdot-developers,uw-it-aca/mdot-developers
3e5e35aa85e656efbdddddf4c4d2accad964a42b
members/elections/serializers.py
members/elections/serializers.py
from rest_framework import serializers from .models import Election, Candidate class CandidatePublicSerializer(serializers.ModelSerializer): organization = serializers.CharField(source='organization.display_name') class Meta: model = Candidate fields = ('candidate_first_name', 'candidate_last_name', 'candidate_...
from rest_framework import serializers from .models import Election, Candidate class CandidatePublicSerializer(serializers.ModelSerializer): organization = serializers.CharField(source='organization.display_name') expertise = serializers.SerializerMethodField() class Meta: model = Candidate ...
Update elections with new apis
Update elections with new apis
Python
mit
ocwc/ocwc-members,ocwc/ocwc-members,ocwc/ocwc-members,ocwc/ocwc-members
7936ef73a786ac7b4d3a718d72e6d0e087b35e05
myFirstProgram.py
myFirstProgram.py
#! /usr/bin/env python num = 3 print num
#! /usr/bin/env python num = 3 print num # This is great! # Now, assign the value 88 to the variable "blanket". # blanket = ?? # print blanket
Add comments about blanket variable.
Add comments about blanket variable.
Python
mit
sk8boarder/my-first-program
0818f5e1471c6da24dbc55954ef4ad27ac289ada
tests/test_grammars.py
tests/test_grammars.py
from .generic import GrammarTest def test_np(): grammar = GrammarTest('grammars/test_np.fcfg', 'grammars/nounphrase.sample', 'grammars/nounphrase.sample.negative') grammar.check_positive() grammar.check_negative() def test_subject(): grammar = GrammarTest('grammars/test_subject.fcfg',...
from .generic import GrammarTest def add_grammar(grammar, positive_sample, negative_sample): grammar = GrammarTest(grammar, positive_sample, negative_sample) grammar.check_positive() grammar.check_negative() def test_np(): add_grammar('grammars/test_np.fcfg', 'grammars/nounphrase.sampl...
Refactor grammar tests to be easily extensible
Refactor grammar tests to be easily extensible
Python
mit
caninemwenja/marker,kmwenja/marker
7f5f4f95eabd1f70c82d336816ae2d17fb273af2
stronghold/middleware.py
stronghold/middleware.py
from django.contrib.auth.decorators import login_required from stronghold import conf, utils class LoginRequiredMiddleware(object): """ Force all views to use login required View is deemed to be public if the @public decorator is applied to the view View is also deemed to be Public if listed in in d...
from django.contrib.auth.decorators import login_required from stronghold import conf, utils class LoginRequiredMiddleware(object): """ Force all views to use login required View is deemed to be public if the @public decorator is applied to the view View is also deemed to be Public if listed in in d...
Refactor public_view_url check to be more pythonic
Refactor public_view_url check to be more pythonic In addition to this I also removed the is_public variable because the new utils function says the same thing so it is redundant.
Python
mit
SunilMohanAdapa/django-stronghold,mgrouchy/django-stronghold,SunilMohanAdapa/django-stronghold
6785f6ef2287bc161085bcca7f1cb8653b88a433
resolwe/flow/management/commands/cleantestdir.py
resolwe/flow/management/commands/cleantestdir.py
""".. Ignore pydocstyle D400. ==================== Clean test directory ==================== Command to run on local machine:: ./manage.py cleantestdir """ import re import shutil from itertools import chain from pathlib import Path from django.core.management.base import BaseCommand from resolwe.storage impo...
""".. Ignore pydocstyle D400. ==================== Clean test directory ==================== Command to run on local machine:: ./manage.py cleantestdir """ import re import shutil from itertools import chain from pathlib import Path from django.core.management.base import BaseCommand from resolwe.storage impo...
Clean only volumes of type host_path
Clean only volumes of type host_path
Python
apache-2.0
genialis/resolwe,genialis/resolwe
0adc42bbcf77c284ed7fbbbed4e50a3640dfa0b5
masters/master.tryserver.chromium.angle/master_site_config.py
masters/master.tryserver.chromium.angle/master_site_config.py
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ActiveMaster definition.""" from config_bootstrap import Master class TryServerANGLE(Master.Master4a): project_name = 'ANGLE Try Server' master_port...
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ActiveMaster definition.""" from config_bootstrap import Master class TryServerANGLE(Master.Master4a): project_name = 'ANGLE Try Server' master_port...
Enable buildbucket builds to Angle tryserver.
Enable buildbucket builds to Angle tryserver. This is a re-land with a fix of https://codereview.chromium.org/1624703003/ R=nodir@chromium.org BUG=577560 Review URL: https://codereview.chromium.org/1614243005 git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@298382 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
eunchong/build,eunchong/build,eunchong/build,eunchong/build
9b53673771b8b185232cffad129036bbe084a169
api.py
api.py
from tastypie.authorization import Authorization from tastypie.authentication import BasicAuthentication from tastypie.fields import ForeignKey from tastypie.resources import ModelResource from .models import APNSDevice, GCMDevice class APNSDeviceResource(ModelResource): class Meta: authorization = Authorization()...
from tastypie.authorization import Authorization from tastypie.authentication import BasicAuthentication from tastypie.fields import ForeignKey from tastypie.resources import ModelResource from .models import APNSDevice, GCMDevice class APNSDeviceResource(ModelResource): class Meta: authorization = Authorization()...
Fix device-user linking in authenticated resources
Fix device-user linking in authenticated resources
Python
mit
Ian-Foote/django-push-notifications,matthewh/django-push-notifications,Ubiwhere/django-push-notifications,freakboy3742/django-push-notifications,gkirkpatrick/django-push-notifications,hylje/django-push-notifications,AndreasBackx/django-push-notifications,cristiano2lopes/django-push-notifications,jleclanche/django-push-...
d19e4a358f1f81f72a02c3015fc4a0def2827e19
nibble_aes/find_dist/find_ids.py
nibble_aes/find_dist/find_ids.py
""" Derive a list of impossible differentials. """ import ast import sys def parse(line): i, rounds, xss = ast.literal_eval(line) yss = [set(xs) for xs in xss] return (i, rounds, yss) def main(): if len(sys.argv) != 3: print("usage: ./find_ids.py [forward differentials file] [backward differe...
""" Derive a list of impossible differentials. """ import ast import sys def parse(line): i, rounds, xss = ast.literal_eval(line) yss = [set(xs) for xs in xss] return (i, rounds, yss) def main(): if len(sys.argv) != 3: print("usage: ./find_ids.py [forward differentials file] [backward differe...
Optimize by using isdisjoint instead of finding intersection.
Optimize by using isdisjoint instead of finding intersection.
Python
mit
wei2912/idc,wei2912/idc,wei2912/aes-idc,wei2912/idc,wei2912/idc,wei2912/aes-idc
f95a42b0a9445a58e68fc83e9b1411bedef67904
wqflask/tests/base/test_general_object.py
wqflask/tests/base/test_general_object.py
import unittest from base.GeneralObject import GeneralObject class TestGeneralObjectTests(unittest.TestCase): """ Test the GeneralObject base class """ def test_object_contents(self): """Test whether base contents are stored properly""" test_obj = GeneralObject("a", "b", "c") ...
import unittest from base.GeneralObject import GeneralObject class TestGeneralObjectTests(unittest.TestCase): """ Test the GeneralObject base class """ def test_object_contents(self): """Test whether base contents are stored properly""" test_obj = GeneralObject("a", "b", "c") ...
Add more tests for GeneralObject
Add more tests for GeneralObject * wqflask/tests/base/test_general_object.py: test object's magic methods
Python
agpl-3.0
genenetwork/genenetwork2,zsloan/genenetwork2,zsloan/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2
c062ae638a4c864e978a4adfcd7d8d830b99abc2
opentreemap/treemap/lib/dates.py
opentreemap/treemap/lib/dates.py
from datetime import datetime from django.utils import timezone import calendar import pytz DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S' DATE_FORMAT = '%Y-%m-%d' def parse_date_string_with_or_without_time(date_string): try: return datetime.strptime(date_string.strip(), '%Y-%m-%d %H:%M:%S') except ValueError...
from datetime import datetime from django.utils import timezone import calendar import pytz DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S' DATE_FORMAT = '%Y-%m-%d' def parse_date_string_with_or_without_time(date_string): try: return datetime.strptime(date_string.strip(), '%Y-%m-%d %H:%M:%S') except ValueError...
Add function for nullsafe, tzsafe comparison
Add function for nullsafe, tzsafe comparison
Python
agpl-3.0
clever-crow-consulting/otm-core,recklessromeo/otm-core,maurizi/otm-core,recklessromeo/otm-core,maurizi/otm-core,RickMohr/otm-core,RickMohr/otm-core,RickMohr/otm-core,clever-crow-consulting/otm-core,recklessromeo/otm-core,recklessromeo/otm-core,maurizi/otm-core,clever-crow-consulting/otm-core,clever-crow-consulting/otm-...
57bda16a1e948d81884277f35b77c16e50d4870e
scripts/slave/chromium/dart_buildbot_run.py
scripts/slave/chromium/dart_buildbot_run.py
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Entry point for the dartium buildbots. This script is called from buildbot and reports results using the buildbot annotation sc...
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Entry point for the dartium buildbots. This script is called from buildbot and reports results using the buildbot annotation sc...
Switch Dartium buildbot script to stable 1.6
Switch Dartium buildbot script to stable 1.6 BUG= Review URL: https://codereview.chromium.org/504383002 git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@291655 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
eunchong/build,eunchong/build,eunchong/build,eunchong/build
f3dcb7105049b9dcc8d6a1a97fbfe8968092a533
mesonwrap/inventory.py
mesonwrap/inventory.py
_ORGANIZATION = 'mesonbuild' _RESTRICTED_PROJECTS = [ 'meson', 'meson-ci', 'mesonwrap', 'wrapdevtools', 'wrapweb', ] _RESTRICTED_ORG_PROJECTS = [ _ORGANIZATION + '/' + proj for proj in _RESTRICTED_PROJECTS ] def is_wrap_project_name(project: str) -> bool: return project not in _RESTRICTED_...
_ORGANIZATION = 'mesonbuild' _RESTRICTED_PROJECTS = [ 'meson', 'meson-ci', 'mesonbuild.github.io', 'mesonwrap', 'wrapdb', 'wrapdevtools', 'wrapweb', ] _RESTRICTED_ORG_PROJECTS = [ _ORGANIZATION + '/' + proj for proj in _RESTRICTED_PROJECTS ] def is_wrap_project_name(project: str) -> bo...
Add mesonbuild.github.io and wrapdb to the list of restricted projects
Add mesonbuild.github.io and wrapdb to the list of restricted projects
Python
apache-2.0
mesonbuild/wrapweb,mesonbuild/wrapweb,mesonbuild/wrapweb
67e16e13b6a4cc505758b3af26e287914ac8f335
demosys/context/__init__.py
demosys/context/__init__.py
import moderngl from demosys.conf import settings from demosys.utils.module_loading import import_string # Window instance shortcut WINDOW = None # noqa def window(raise_on_error=True) -> 'demosys.context.base.Window': """ The window instance we are rendering to :param raise_on_error: Raise an error if...
import moderngl from demosys.conf import settings from demosys.utils.module_loading import import_string from demosys.context.base import BaseWindow # Window instance shortcut WINDOW = None # noqa def window(raise_on_error=True) -> BaseWindow: """ The window instance we are rendering to :param raise_o...
Fix test issue related to pyflakes upgrade
Fix test issue related to pyflakes upgrade
Python
isc
Contraz/demosys-py
ab3cb8fb539d65cb3549d52ec34c7b533a98b2d4
byceps/blueprints/authorization/decorators.py
byceps/blueprints/authorization/decorators.py
# -*- coding: utf-8 -*- """ byceps.blueprints.authorization.decorators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2016 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from functools import wraps from flask import abort, g def permission_required(permission): """Ensur...
# -*- coding: utf-8 -*- """ byceps.blueprints.authorization.decorators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2016 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from functools import wraps from flask import abort, g def permission_required(permission): """Ensur...
Remove `role_required` decorator as only specific permissions, not roles, should be explicitly required
Remove `role_required` decorator as only specific permissions, not roles, should be explicitly required
Python
bsd-3-clause
homeworkprod/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps
644912b4e4ef533db23b732a36e4dfc373f47540
FEZHAT.py
FEZHAT.py
import ADS7830 class FEZHAT: def __init__(self): self._ads = ADS7830.ADS7830(1, 0x48) def get_light(): return self._ads.read(5) / 255.0 # http://ww1.microchip.com/downloads/en/DeviceDoc/20001942F.pdf def get_temperature(): # see page 8 return (((3.3 / ...
import ADS7830 class FEZHAT: def __init__(self): self._ads = ADS7830.ADS7830(1, 0x48) def get_light(self): return self._ads.read(5) / 255.0 # http://ww1.microchip.com/downloads/en/DeviceDoc/20001942F.pdf def get_temperature(self): # see page 8 return (...
Use mV in temperature calculation
Use mV in temperature calculation
Python
apache-2.0
bechynsky/FEZHATPY
1303d1c14f7c3127b8fc87178f268d8b052ef503
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup def readfile(fname): with open(fname) as f: content = f.read() return content setup(name='sockjs-cyclone', version='1.0.2', author='Flavio Grossi', author_email='flaviogrossi@gmail.com', description='SockJS python server...
#!/usr/bin/env python from distutils.core import setup def readfile(fname): with open(fname) as f: content = f.read() return content setup(name='sockjs-cyclone', version='1.0.2', author='Flavio Grossi', author_email='flaviogrossi@gmail.com', description='SockJS python server...
Remove declaration of dependency on simplejson
Remove declaration of dependency on simplejson
Python
mit
flaviogrossi/sockjs-cyclone
3dc525e109d5de1aacaf21c8ea1cdc1b627e206d
setup.py
setup.py
from distutils.core import setup long_description = open('README.rst').read() setup( name = 'lcboapi', packages = ['lcboapi'], version = '0.1.3', description = 'Python wrapper for the unofficial LCBO API', long_description = long_description, author = 'Shane Martin', author_email = 'dev.sh@nemart.in', ...
from distutils.core import setup long_description = open('README.rst').read() setup( name = 'lcboapi', packages = ['lcboapi'], version = '0.1.3', description = 'Python wrapper for the unofficial LCBO API', long_description = long_description, author = 'Shane Martin', author_email = 'dev.sh@nemart.in', ...
Remove package requirements (for testing only); add download URL
Remove package requirements (for testing only); add download URL
Python
mit
shamrt/LCBOAPI
59a08fff34f095f601ced76cd7b2e27665824146
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name='webracer', version='0.2.0', description='Comprehensive web application testing library', author='Oleg Pudeyev', author_email='oleg@bsdpower.com', url='http://github.com/p/webracer', packages=['webracer', 'webracer.utils'], ...
#!/usr/bin/env python from distutils.core import setup import os.path PACKAGE = "webracer" setup(name=PACKAGE, version='0.2.0', description='Comprehensive web application testing library', author='Oleg Pudeyev', author_email='oleg@bsdpower.com', url='http://github.com/p/webracer', packages=['...
Put license and readme into share/doc/webracer rather than installation root
Put license and readme into share/doc/webracer rather than installation root
Python
bsd-2-clause
p/webracer
5fa6b78a9f0ac668d0ad8a0544bbe9f0784a5a19
setup.py
setup.py
from distutils.core import setup setup( name = "django-templatetag-sugar", version = __import__("templatetag_sugar").__version__, author = "Alex Gaynor", author_email = "alex.gaynor@gmail.com", description = "A library to make Django's template tags sweet.", long_description = open("README")...
from distutils.core import setup setup( name = "django-templatetag-sugar", version = __import__("templatetag_sugar").__version__, author = "Alex Gaynor", author_email = "alex.gaynor@gmail.com", description = "A library to make Django's template tags sweet.", long_description = open("README")...
Update the URL for the move.
Update the URL for the move.
Python
bsd-3-clause
alex/django-templatetag-sugar,IRI-Research/django-templatetag-sugar
3d09d6e5a8717c4dee9422b9d84a66319a9bdc01
tests.py
tests.py
import json import unittest from pyunio import pyunio import urllib pyunio.use('httpbin') params_get = { 'params': { 'name': 'James Bond' } } params_body = { 'body': { 'name': 'James Bond' } ...
import json import unittest import sys if sys.version_info[0] == 2: from urllib import urlencode else: from urllib.parse import urlencode from pyunio import pyunio pyunio.use('httpbin') params_get = { 'params': { 'name': 'James Bond' } } params...
Fix unittest failure in python 3.x.
Fix unittest failure in python 3.x.
Python
mit
citruspi/PyUnio
d8d18b50c88e5099942cdb1545863585a8f141a6
top40.py
top40.py
#/usr/bin/env python # -*- coding: utf-8 -*- import click import requests import requests_cache # Cache the API calls and expire after 12 hours requests_cache.install_cache(expire_after=43200) url = 'http://ben-major.co.uk/labs/top40/api/singles/' @click.command() @click.option('--count', default=10, help='...
#/usr/bin/env python # -*- coding: utf-8 -*- import click import requests import requests_cache # Cache the API calls and expire after 12 hours requests_cache.install_cache(expire_after=43200) url = 'http://ben-major.co.uk/labs/top40/api/singles/' @click.command() @click.option('--count', type=click.IntRange(1,...
Implement range of possible values with clamping if values are outside range
Implement range of possible values with clamping if values are outside range
Python
mit
kevgathuku/top40,andela-kndungu/top40
b8906e596193bcdc22d5cdd6b4ce57347e262621
fancypages/defaults.py
fancypages/defaults.py
########## INSTALLED APPS FANCYPAGES_REQUIRED_APPS = ( 'rest_framework', 'model_utils', 'south', 'compressor', 'twitter_tag', 'sorl.thumbnail', ) FANCYPAGES_APPS = ( 'fancypages', 'fancypages.api', 'fancypages.assets', 'fancypages.dashboard', ) ########## END INSTALLED APPS ####...
########## FANCYPAGES SETTINGS FP_HOMEPAGE_NAME = 'Home' FP_DEFAULT_TEMPLATE = 'fancypages/pages/page.html' ########## END FANCYPAGES SETTINGS ########## TWITTER TAG SETTINGS TWITTER_OAUTH_TOKEN = '' TWITTER_OAUTH_SECRET = '' TWITTER_CONSUMER_KEY = '' TWITTER_CONSUMER_SECRET = '' ########## END TWITTER TAG SETTINGS
Clean up default FP settings
Clean up default FP settings
Python
bsd-3-clause
socradev/django-fancypages,tangentlabs/django-fancypages,socradev/django-fancypages,tangentlabs/django-fancypages,socradev/django-fancypages,tangentlabs/django-fancypages
d2b0aba3e13246193f37758e23f4d26b90552508
social_auth/middleware.py
social_auth/middleware.py
# -*- coding: utf-8 -*- from django.conf import settings from django.contrib import messages from django.shortcuts import redirect from social_auth.backends.exceptions import AuthException class SocialAuthExceptionMiddleware(object): """Middleware that handles Social Auth AuthExceptions by providing the user ...
# -*- coding: utf-8 -*- from django.conf import settings from django.contrib import messages from django.shortcuts import redirect from social_auth.backends.exceptions import AuthException class SocialAuthExceptionMiddleware(object): """Middleware that handles Social Auth AuthExceptions by providing the user ...
Correct access of backend name from AuthException
Correct access of backend name from AuthException
Python
bsd-3-clause
omab/django-social-auth,duoduo369/django-social-auth,MjAbuz/django-social-auth,beswarm/django-social-auth,getsentry/django-social-auth,omab/django-social-auth,lovehhf/django-social-auth,sk7/django-social-auth,WW-Digital/django-social-auth,qas612820704/django-social-auth,caktus/django-social-auth,gustavoam/django-social...
e6af345239f2778a2245d9f8be54bf754224aafd
tests/helper.py
tests/helper.py
def mock_api(path, file_path): from httmock import urlmatch, response @urlmatch(scheme = 'https', netloc = 'api.webpay.jp', path = '/v1' + path) def webpay_api_mock(url, request): from os import path import codecs dump = path.dirname(path.abspath(__file__)) + '/mock/' + file_path ...
def mock_api(path, file_path, query = None, data = None): from httmock import urlmatch, response import json @urlmatch(scheme = 'https', netloc = 'api.webpay.jp', path = '/v1' + path) def webpay_api_mock(url, request): assert query is None or url.query == query assert data is None or js...
Add assertion for query and data of request
Add assertion for query and data of request
Python
mit
yamaneko1212/webpay-python
3afee3ae9bc791b0b3ae084f4e53950ec1e32f48
apps/news/models.py
apps/news/models.py
from django.db import models from django.contrib.auth.models import User from thumbs import ImageWithThumbsField from apps.projects.models import Project class News(models.Model): title = models.CharField(max_length=200) summary = models.CharField(max_length=200, null=True, blank=True) body = models.TextF...
from datetime import datetime as dt from django.db import models from django.contrib.auth.models import User from thumbs import ImageWithThumbsField from apps.projects.models import Project class News(models.Model): class Meta: ordering = ('-date_and_time',) title = models.CharField(max_leng...
Change field name from datetime to date_and_time for avoid problems with datetime python's module
Change field name from datetime to date_and_time for avoid problems with datetime python's module
Python
mit
nsi-iff/nsi_site,nsi-iff/nsi_site,nsi-iff/nsi_site
0eb7e39c726ced0e802de925c7ce3b3ec35c61d9
src/billing/factories.py
src/billing/factories.py
import factory import random from billing.models import Billing, OrderBilling from member.factories import ClientFactory from order.factories import OrderFactory class BillingFactory(factory.DjangoModelFactory): class Meta: model = Billing client = factory.SubFactory(ClientFactory) total_amount...
import factory import random from billing.models import Billing, OrderBilling from member.factories import ClientFactory from order.factories import OrderFactory class BillingFactory(factory.DjangoModelFactory): class Meta: model = Billing client = factory.SubFactory(ClientFactory) total_amount...
Remove a BillingOrder factory class that wasn't use
Remove a BillingOrder factory class that wasn't use There was a problem with this class... but since I couldn't find code using it, I simply deleted it.
Python
agpl-3.0
savoirfairelinux/santropol-feast,madmath/sous-chef,savoirfairelinux/santropol-feast,savoirfairelinux/sous-chef,savoirfairelinux/sous-chef,madmath/sous-chef,savoirfairelinux/santropol-feast,madmath/sous-chef,savoirfairelinux/sous-chef
ce7e9b95a9faef242b66e9c551861986f311cdee
guardian/management/commands/clean_orphan_obj_perms.py
guardian/management/commands/clean_orphan_obj_perms.py
from __future__ import unicode_literals from django.core.management.base import NoArgsCommand from guardian.utils import clean_orphan_obj_perms class Command(NoArgsCommand): """ clean_orphan_obj_perms command is a tiny wrapper around :func:`guardian.utils.clean_orphan_obj_perms`. Usage:: $ ...
from __future__ import unicode_literals from django.core.management.base import BaseCommand from guardian.utils import clean_orphan_obj_perms class Command(BaseCommand): """ clean_orphan_obj_perms command is a tiny wrapper around :func:`guardian.utils.clean_orphan_obj_perms`. Usage:: $ pyth...
Drop django.core.management.base.NoArgsCommand (django 1.10 compat)
Drop django.core.management.base.NoArgsCommand (django 1.10 compat) See https://github.com/django/django/blob/stable/1.9.x/django/core/management/base.py#L574-L578
Python
bsd-2-clause
rmgorman/django-guardian,lukaszb/django-guardian,benkonrath/django-guardian,rmgorman/django-guardian,lukaszb/django-guardian,lukaszb/django-guardian,benkonrath/django-guardian,rmgorman/django-guardian,benkonrath/django-guardian
2404e11c06418cc72b1a486d7d62d9d719cfe263
regression/tests/studio/test_studio_login.py
regression/tests/studio/test_studio_login.py
""" End to end tests for Studio Login """ import os from flaky import flaky from bok_choy.web_app_test import WebAppTest from regression.pages.studio.studio_home import DashboardPageExtended from regression.pages.studio.login_studio import StudioLogin from regression.pages.studio.logout_studio import StudioLogout cla...
""" End to end tests for Studio Login """ import os from bok_choy.web_app_test import WebAppTest from regression.pages.studio.studio_home import DashboardPageExtended from regression.pages.studio.login_studio import StudioLogin from regression.pages.studio.logout_studio import StudioLogout class StudioUserLogin(Web...
Fix flaky logout on FF 45
Fix flaky logout on FF 45
Python
agpl-3.0
edx/edx-e2e-tests,edx/edx-e2e-tests
359a80897decd64a0d997005dc7cb731fc294133
setuptools/tests/test_build_ext.py
setuptools/tests/test_build_ext.py
"""build_ext tests """ import unittest import distutils.command.build_ext as orig from setuptools.command.build_ext import build_ext from setuptools.dist import Distribution class TestBuildExtTest(unittest.TestCase): def test_get_ext_filename(self): """ Setuptools needs to give back the same ...
"""build_ext tests """ import distutils.command.build_ext as orig from setuptools.command.build_ext import build_ext from setuptools.dist import Distribution class TestBuildExt: def test_get_ext_filename(self): """ Setuptools needs to give back the same result as distutils, even if the fu...
Use pytest for test discovery in build_ext
Use pytest for test discovery in build_ext
Python
mit
pypa/setuptools,pypa/setuptools,pypa/setuptools
e1b5ba70938decbebdc2c4115f2b27b1b8f45ecf
python/mms/__init__.py
python/mms/__init__.py
try: import sympy except ImportError: print("The 'mms' package requires sympy, it can be installed by running " \ "`pip install sympy --user`.") else: from fparser import FParserPrinter, fparser, print_fparser, build_hit, print_hit from moosefunction import MooseFunctionPrinter, moosefunctio...
try: import sympy except ImportError: print("The 'mms' package requires sympy, it can be installed by running " \ "`pip install sympy --user`.") else: from fparser import FParserPrinter, fparser, print_fparser, build_hit, print_hit from moosefunction import MooseFunctionPrinter, moosefunctio...
Support offscreen matplotlib plots in mms module
Support offscreen matplotlib plots in mms module (refs #13181)
Python
lgpl-2.1
lindsayad/moose,lindsayad/moose,andrsd/moose,jessecarterMOOSE/moose,harterj/moose,bwspenc/moose,permcody/moose,sapitts/moose,SudiptaBiswas/moose,dschwen/moose,sapitts/moose,lindsayad/moose,jessecarterMOOSE/moose,permcody/moose,SudiptaBiswas/moose,milljm/moose,lindsayad/moose,idaholab/moose,jessecarterMOOSE/moose,idahol...
8f9615ebd7ae4802b1e44d6b8243aafb785a7fa3
pamqp/__init__.py
pamqp/__init__.py
"""AMQP Specifications and Classes""" __author__ = 'Gavin M. Roy' __email__ = 'gavinmroy@gmail.com' __since__ = '2011-09-23' __version__ '1.0.1' from header import ProtocolHeader from header import ContentHeader import body import codec import frame import specification
"""AMQP Specifications and Classes""" __author__ = 'Gavin M. Roy' __email__ = 'gavinmroy@gmail.com' __since__ = '2011-09-23' __version__ = '1.0.1' from pamqp.header import ProtocolHeader from pamqp.header import ContentHeader from pamqp import body from pamqp import codec from pamqp import frame from pamqp import sp...
Use absolute imports and fix the version string
Use absolute imports and fix the version string
Python
bsd-3-clause
gmr/pamqp
e40f3cfe77b09d63bce504dcce957bee7788028a
zadarapy/vpsa/__init__.py
zadarapy/vpsa/__init__.py
# Copyright 2019 Zadara Storage, Inc. # Originally authored by Jeremy Brown - https://github.com/jwbrown77 # # 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...
# Copyright 2019 Zadara Storage, Inc. # Originally authored by Jeremy Brown - https://github.com/jwbrown77 # # 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...
Create Base class for enum
Create Base class for enum Change-Id: Ia0de5c1c99cabcab38d1a64949b50e916fadd8b8
Python
apache-2.0
zadarastorage/zadarapy
28fe6a0a1e5e5d8781854aad4f22d368d3d73b12
ld37/common/utils/libutils.py
ld37/common/utils/libutils.py
import math def update_image_rect(image, rect): image_rect = image.get_rect() image_rect.x = rect.x image_rect.y = rect.y def distance_between_rects(rect1, rect2): (r1_center_x, r1_center_y) = rect1.center (r2_center_x, r2_center_y) = rect2.center x_squared = (r1_center_x - r2_center_x)**2 ...
import math def update_image_rect(image, rect): image_rect = image.get_rect() image_rect.x = rect.x image_rect.y = rect.y def distance_between_rects(rect1, rect2): (r1_center_x, r1_center_y) = rect1.center (r2_center_x, r2_center_y) = rect2.center x_squared = (r2_center_x - r1_center_x)**2 ...
Update distance formula to be more standard
Update distance formula to be more standard
Python
mit
Daihiro/ldjam37,maximx1/ldjam37
b635aa57758f667a989039d8874111e5497a7ab7
smithers/smithers/conf/server.py
smithers/smithers/conf/server.py
from os import getenv GEOIP_DB_FILE = '/usr/local/share/GeoIP/GeoIP2-City.mmdb' STATSD_HOST = 'graphite1.private.phx1.mozilla.com' STATSD_PORT = 8125 STATSD_PREFIX = 'glow-workers-{}'.format(getenv('DJANGO_SERVER_ENV')) COUNTRY_MIN_SHARE = 1 # basically off
from os import getenv GEOIP_DB_FILE = '/usr/local/share/GeoIP/GeoIP2-City.mmdb' STATSD_HOST = 'graphite1.private.phx1.mozilla.com' STATSD_PORT = 8125 STATSD_PREFIX = 'glow-workers-{}'.format(getenv('DJANGO_SERVER_ENV')) COUNTRY_MIN_SHARE = 500
Set country minimum vote filter back to 500.
Set country minimum vote filter back to 500.
Python
mpl-2.0
mozilla/mrburns,mozilla/mrburns,mozilla/mrburns
244da6a4ffa5ff8de80d18baceedcf947ef6b68e
tensorflow/python/tf2.py
tensorflow/python/tf2.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Make TF2_BEHAVIOR=0 disable TF2 behavior.
Make TF2_BEHAVIOR=0 disable TF2 behavior. Prior to this change, the mere presence of a TF2_BEHAVIOR environment variable would enable TF2 behavior. With this, setting that environment variable to "0" will disable it. PiperOrigin-RevId: 223804383
Python
apache-2.0
freedomtan/tensorflow,kevin-coder/tensorflow-fork,aldian/tensorflow,davidzchen/tensorflow,alsrgv/tensorflow,renyi533/tensorflow,ghchinoy/tensorflow,freedomtan/tensorflow,cxxgtxy/tensorflow,hfp/tensorflow-xsmm,alsrgv/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gautam1858/tensorflow,theflofly...
1a3db115de722a24780009683f36011e036e9086
tests/test_completion.py
tests/test_completion.py
import os import subprocess import sys from pathlib import Path import typer from typer.testing import CliRunner from first_steps import tutorial001 as mod runner = CliRunner() app = typer.Typer() app.command()(mod.main) def test_show_completion(): result = subprocess.run( [ "bash", ...
import os import subprocess import sys from pathlib import Path import typer from typer.testing import CliRunner from first_steps import tutorial001 as mod runner = CliRunner() app = typer.Typer() app.command()(mod.main) def test_show_completion(): result = subprocess.run( [ "bash", ...
Update completion tests, checking for printed message
:white_check_mark: Update completion tests, checking for printed message
Python
mit
tiangolo/typer,tiangolo/typer
481571daf8e89fb98424e1a068c64c7c1a6209fb
py3-test/tests.py
py3-test/tests.py
# -*- coding: utf-8 -*- import nose.tools as nt from asyncio import Future, gather, get_event_loop, sleep from pyee import EventEmitter def test_async_emit(): """Test that event_emitters can handle wrapping coroutines """ loop = get_event_loop() ee = EventEmitter(loop=loop) future = Future() ...
# -*- coding: utf-8 -*- import nose.tools as nt from asyncio import Future, gather, get_event_loop, sleep from pyee import EventEmitter def test_async_emit(): """Test that event_emitters can handle wrapping coroutines """ loop = get_event_loop() ee = EventEmitter(loop=loop) should_call = Future(...
Rename should_call future in test, raise exception on timeout
Rename should_call future in test, raise exception on timeout
Python
mit
jfhbrook/pyee
e7149a488eaa85baecacfdf78a5d190b51dc46d7
tests/test_upgrade.py
tests/test_upgrade.py
import shutil import tempfile from os import path import unittest from libs.qpanel.upgrader import __first_line as firstline, get_current_version class UpgradeTestClass(unittest.TestCase): def setUp(self): # Create a temporary directory self.test_dir = tempfile.mkdtemp() def tearDown(self): ...
import shutil import tempfile from os import path import unittest from libs.qpanel.upgrader import __first_line as firstline, get_current_version class UpgradeTestClass(unittest.TestCase): def setUp(self): # Create a temporary directory self.test_dir = tempfile.mkdtemp() def tearDown(self): ...
Add not equals test for version function
Add not equals test for version function
Python
mit
roramirez/qpanel,skazancev/qpanel,roramirez/qpanel,skazancev/qpanel,roramirez/qpanel,skazancev/qpanel,skazancev/qpanel,roramirez/qpanel
95421d1b71d2f5847bcea439cde79af2a984eda6
src/sentry/api/endpoints/project_releases.py
src/sentry/api/endpoints/project_releases.py
from __future__ import absolute_import from sentry.api.base import DocSection from sentry.api.bases.project import ProjectEndpoint from sentry.api.serializers import serialize from sentry.models import Release class ProjectReleasesEndpoint(ProjectEndpoint): doc_section = DocSection.RELEASES def get(self, re...
from __future__ import absolute_import from sentry.api.base import DocSection from sentry.api.bases.project import ProjectEndpoint from sentry.api.serializers import serialize from sentry.models import Release class ProjectReleasesEndpoint(ProjectEndpoint): doc_section = DocSection.RELEASES def get(self, re...
Maintain project release sort order
Maintain project release sort order
Python
bsd-3-clause
zenefits/sentry,ewdurbin/sentry,fotinakis/sentry,wong2/sentry,alexm92/sentry,gencer/sentry,Natim/sentry,1tush/sentry,hongliang5623/sentry,daevaorn/sentry,BuildingLink/sentry,daevaorn/sentry,ngonzalvez/sentry,zenefits/sentry,JamesMura/sentry,ngonzalvez/sentry,pauloschilling/sentry,argonemyth/sentry,wong2/sentry,JamesMur...
6d663d1d0172b716e0dccc1f617b5a09b2905b67
script/upload-windows-pdb.py
script/upload-windows-pdb.py
#!/usr/bin/env python import os import glob from lib.util import execute, rm_rf, safe_mkdir, s3put, s3_config SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) SYMBOLS_DIR = 'dist\\symbols' PDB_LIST = [ 'out\\Release\\atom.exe.pdb', 'vendor\\brightray\\vendor\\download\\libchromiumconten...
#!/usr/bin/env python import os import glob from lib.util import execute, rm_rf, safe_mkdir, s3put, s3_config SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) SYMBOLS_DIR = 'dist\\symbols' PDB_LIST = [ 'out\\Release\\atom.exe.pdb', 'vendor\\brightray\\vendor\\download\\libchromiumconten...
Use lowercase for symbol paths
Use lowercase for symbol paths
Python
mit
wolfflow/electron,shockone/electron,ianscrivener/electron,oiledCode/electron,christian-bromann/electron,fffej/electron,darwin/electron,digideskio/electron,jannishuebl/electron,darwin/electron,lrlna/electron,faizalpribadi/electron,lzpfmh/electron,rsvip/electron,mubassirhayat/electron,bwiggs/electron,jiaz/electron,gstack...
46be6053526da38ad9f8fdf40ebb870cd64ae88e
nefertari_sqla/serializers.py
nefertari_sqla/serializers.py
import datetime import decimal import logging import elasticsearch from nefertari.renderers import _JSONEncoder log = logging.getLogger(__name__) class JSONEncoder(_JSONEncoder): def default(self, obj): if isinstance(obj, (datetime.datetime, datetime.date)): return obj.strftime("%Y-%m-%dT%...
import datetime import decimal import logging import elasticsearch from nefertari.renderers import _JSONEncoder log = logging.getLogger(__name__) class JSONEncoderMixin(object): def default(self, obj): if isinstance(obj, (datetime.datetime, datetime.date)): return obj.strftime("%Y-%m-%dT%H...
Refactor encoders to have base class
Refactor encoders to have base class
Python
apache-2.0
ramses-tech/nefertari-sqla,geniusproject/nefertari-sqla,brandicted/nefertari-sqla,oleduc/nefertari-sqla
bcca20cecbc664422f72359ba4fba7d55e833b32
swampdragon/connections/sockjs_connection.py
swampdragon/connections/sockjs_connection.py
from sockjs.tornado import SockJSConnection from ..pubsub_providers.redis_pubsub_provider import RedisPubSubProvider from .. import route_handler import json pub_sub = RedisPubSubProvider() class ConnectionMixin(object): def to_json(self, data): if isinstance(data, dict): return data ...
from sockjs.tornado import SockJSConnection from ..pubsub_providers.redis_pubsub_provider import RedisPubSubProvider from .. import route_handler import json pub_sub = RedisPubSubProvider() class ConnectionMixin(object): def to_json(self, data): if isinstance(data, dict): return data ...
Include channel list in connection
Include channel list in connection
Python
bsd-3-clause
sahlinet/swampdragon,denizs/swampdragon,michael-k/swampdragon,seclinch/swampdragon,Manuel4131/swampdragon,aexeagmbh/swampdragon,Manuel4131/swampdragon,d9pouces/swampdragon,aexeagmbh/swampdragon,michael-k/swampdragon,d9pouces/swampdragon,boris-savic/swampdragon,boris-savic/swampdragon,jonashagstedt/swampdragon,jonashags...
946212f26ff72ea89cb549dfd759572975a6b8ad
grammpy_transforms/EpsilonRulesRemove/findTerminalsRewritedToEps.py
grammpy_transforms/EpsilonRulesRemove/findTerminalsRewritedToEps.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 20.08.2017 15:42 :Licence GNUv3 Part of grammpy-transforms """ from grammpy import Grammar def find_terminals_rewritable_to_epsilon(grammar: Grammar) -> list: raise NotImplementedError()
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 20.08.2017 15:42 :Licence GNUv3 Part of grammpy-transforms """ from grammpy import Grammar, EPSILON def find_terminals_rewritable_to_epsilon(grammar: Grammar) -> list: rewritable = {EPSILON} while True: working = rewritable.copy() fo...
Implement finding of nonterminals rewritable to epsilon
Implement finding of nonterminals rewritable to epsilon
Python
mit
PatrikValkovic/grammpy
0aa7830b3d841d9851521c14b8754f9101bc9a96
demo/views.py
demo/views.py
from django.shortcuts import render from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from wagtail.wagtailcore.models import Page from wagtail.wagtailsearch.models import Query try: # Wagtail >= 1.1 from wagtail.contrib.wagtailsearchpromotions.models import SearchPromotion except Import...
from django.shortcuts import render from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from wagtail.contrib.wagtailsearchpromotions.models import SearchPromotion from wagtail.wagtailcore.models import Page from wagtail.wagtailsearch.models import Query def search(request): # Search sear...
Remove check for Wagtail 1.1
Remove check for Wagtail 1.1
Python
bsd-3-clause
torchbox/wagtaildemo,torchbox/wagtaildemo,torchbox/wagtaildemo,torchbox/wagtaildemo
ff3a7ad122af4cc1cdfa0b882b2d1d7366d640f2
tests/unit/test_secret.py
tests/unit/test_secret.py
# Import libnacl libs import libnacl.secret # Import python libs import unittest class TestSecret(unittest.TestCase): ''' ''' def test_secret(self): msg = b'But then of course African swallows are not migratory.' box = libnacl.secret.SecretBox() ctxt = box.encrypt(msg) self....
# Import libnacl libs import libnacl.secret # Import python libs import unittest class TestSecret(unittest.TestCase): ''' ''' def test_secret(self): msg = b'But then of course African swallows are not migratory.' box = libnacl.secret.SecretBox() ctxt = box.encrypt(msg) self....
Add failing test for unicode string encryption
Add failing test for unicode string encryption
Python
apache-2.0
coinkite/libnacl
316bb319e5422e4fe35b5b0ae2e58617dddad6cd
scrape_symbols.py
scrape_symbols.py
#!/usr/bin/env python # encoding: utf-8 def main(): pass if __name__ == '__main__': main()
#!/usr/bin/env python # encoding: utf-8 from __future__ import unicode_literals import codecs import dshelpers import lxml def get_yahoo_ticker_xml(): """ Return Yahoo! Finance ticker company details as XML. """ url = "http://query.yahooapis.com/v1/public/yql?q=" \ "select%20*%20from%20yahoo.financ...
Implement conversion of Yahoo! tickers to CSV.
Implement conversion of Yahoo! tickers to CSV.
Python
agpl-3.0
scraperwiki/stock-tool,scraperwiki/stock-tool
e981369f61cec6582b3b9b583639f519ab5f0106
deployments/prob140/image/ipython_config.py
deployments/prob140/image/ipython_config.py
# Disable history manager, we don't really use it # and by default it puts an sqlite file on NFS, which is not something we wanna do c.Historymanager.enabled = False # Use memory for notebook notary file to workaround corrupted files on nfs # https://www.sqlite.org/inmemorydb.html # https://github.com/jupyter/jupyter/...
# Disable history manager, we don't really use it # and by default it puts an sqlite file on NFS, which is not something we wanna do c.HistoryManager.enabled = False
Fix typo on ipython config
Fix typo on ipython config s/Historymanager/HistoryManager/
Python
bsd-3-clause
berkeley-dsep-infra/datahub,ryanlovett/datahub,berkeley-dsep-infra/datahub,berkeley-dsep-infra/datahub,ryanlovett/datahub,ryanlovett/datahub
c827ba1ec1846847e44416c6ec5a74418558657c
soundmeter/settings.py
soundmeter/settings.py
# Default settings import ConfigParser import os import pyaudio PROG = 'soundmeter' USER_DIR = os.path.join(os.path.expanduser('~'), '.' + PROG) USER_LOGFILE = os.path.join(USER_DIR, 'log') USER_CONFIG = os.path.join(USER_DIR, 'config') USER_SCRIPT = os.path.join(USER_DIR, 'trigger.sh') config = ConfigParser.ConfigPa...
# Default settings import ConfigParser import os import pyaudio PROG = 'soundmeter' USER_DIR = os.path.join(os.path.expanduser('~'), '.' + PROG) USER_LOGFILE = os.path.join(USER_DIR, 'log') USER_CONFIG = os.path.join(USER_DIR, 'config') USER_SCRIPT = os.path.join(USER_DIR, 'trigger.sh') config = ConfigParser.ConfigPa...
Modify exception handling to local config names
Modify exception handling to local config names
Python
bsd-2-clause
shichao-an/soundmeter
e9aef2b63b1a6036703aa73bc0a6c30bb9425eb6
io_helpers.py
io_helpers.py
import subprocess def speak(say_wa): echo_string = "'{0}'".format(say_wa.replace("'", "'\''")) echo = subprocess.Popen(['echo', echo_string], stdout=subprocess.PIPE) espeak = subprocess.Popen(["espeak", "-v", "english", "--stdout"], stdin=echo.stdout, stdout=subprocess.PIPE)...
import subprocess import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) class Button(object): def __init__(self, button_gpio, callback): self._button_gpio = button_gpio self._callback = callback GPIO.setup(self._button_gpio, GPIO.IN, pull_up_down=GPIO.PUD_UP) def is_pressed(self): ...
Add LED and Button classes
Add LED and Button classes
Python
mit
jessstringham/raspberrypi
0337d51dc2c65c376f30046a0869c6fabf012cd0
webfinger/__init__.py
webfinger/__init__.py
"""A simple Python client implementation of WebFinger (RFC 7033). WebFinger is a discovery protocol that allows you to find information about people or things in a standardized way. """ __version__ = "3.0.0.dev0" # Backwards compatibility stubs from webfinger.client.requests import WebFingerClient from webfinger.o...
"""A simple Python client implementation of WebFinger (RFC 7033). WebFinger is a discovery protocol that allows you to find information about people or things in a standardized way. This package provides a few tools for using WebFinger, including: - requests-based webfinger client (webfinger.client.requests.WebFi...
Improve docs and import WebFingerBuilder
Improve docs and import WebFingerBuilder
Python
bsd-3-clause
Elizafox/python-webfinger
0656b4c1be9820f3cd096359cd8817153f2e0b81
freelancefinder/remotes/tests/test_tasks.py
freelancefinder/remotes/tests/test_tasks.py
"""Tests related to the remotes.tasks functions.""" from django_celery_beat.models import IntervalSchedule, PeriodicTask from jobs.models import Post from ..models import Source from ..tasks import setup_periodic_tasks, harvest_sources def test_make_tasks(): """Ensure that setup makes some tasks/schedules.""" ...
"""Tests related to the remotes.tasks functions.""" from django_celery_beat.models import IntervalSchedule, PeriodicTask from jobs.models import Post from ..models import Source from ..tasks import setup_periodic_tasks, harvest_sources def test_make_tasks(): """Ensure that setup makes some tasks/schedules.""" ...
Test broken harvest doesn't break everything.
Test broken harvest doesn't break everything.
Python
bsd-3-clause
ScorpionResponse/freelancefinder,ScorpionResponse/freelancefinder,ScorpionResponse/freelancefinder
becc9ff7e1d260f9a4f47a36a0e6403e71f9f0b0
contentcuration/contentcuration/utils/messages.py
contentcuration/contentcuration/utils/messages.py
import json import os from django.conf import settings from django.utils.translation import get_language from django.utils.translation import to_locale _JSON_MESSAGES_FILE_CACHE = {} def locale_data_file(locale): path = getattr(settings, 'LOCALE_PATHS')[0] locale_path = os.path.join(path, locale) return...
import json import os from django.conf import settings from django.utils.translation import get_language from django.utils.translation import to_locale _JSON_MESSAGES_FILE_CACHE = {} def locale_data_file(locale): path = getattr(settings, 'LOCALE_PATHS')[0] return os.path.join(path, locale, "LC_FRONTEND_MESS...
Remove no longer needed local variable.
Remove no longer needed local variable.
Python
mit
DXCanas/content-curation,DXCanas/content-curation,DXCanas/content-curation,DXCanas/content-curation
7e4fc8857284c539ce91dd53f11b460a6c9b1633
scrapi/settings/local-dist.py
scrapi/settings/local-dist.py
RAW_PROCESSING = ['cassandra'] NORMALIZED_PROCESSING = ['elasticsearch', 'cassandra']
RAW_PROCESSING = ['postgres'] NORMALIZED_PROCESSING = ['elasticsearch', 'postgres'] RESPONSE_PROCESSOR = 'postgres'
Fix local dist to see if that fixes things
Fix local dist to see if that fixes things
Python
apache-2.0
erinspace/scrapi,CenterForOpenScience/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi