commit stringlengths 40 40 | old_file stringlengths 4 150 | new_file stringlengths 4 150 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 501 | message stringlengths 15 4.06k | lang stringclasses 4
values | license stringclasses 13
values | repos stringlengths 5 91.5k | diff stringlengths 0 4.35k |
|---|---|---|---|---|---|---|---|---|---|---|
e289c48727573a43a062213fd52bc43a2781bd8b | indra/trips/trips_api.py | indra/trips/trips_api.py | import sys
import trips_client
from processor import TripsProcessor
def process_text(text):
html = trips_client.send_query(text)
xml = trips_client.get_xml(html)
trips_client.save_xml(xml, 'test.xml')
return process_xml(xml)
def process_xml(xml_string):
tp = TripsProcessor(xml_string)
tp.get... | import sys
import trips_client
from processor import TripsProcessor
def process_text(text, save_xml_name='trips_output.xml'):
html = trips_client.send_query(text)
xml = trips_client.get_xml(html)
if save_xml_name:
trips_client.save_xml(xml, save_xml_name)
return process_xml(xml)
def process_... | Add save xml name argument to TRIPS API | Add save xml name argument to TRIPS API
| Python | bsd-2-clause | jmuhlich/indra,pvtodorov/indra,bgyori/indra,sorgerlab/indra,johnbachman/indra,sorgerlab/indra,sorgerlab/belpy,pvtodorov/indra,sorgerlab/indra,johnbachman/belpy,pvtodorov/indra,bgyori/indra,johnbachman/indra,jmuhlich/indra,jmuhlich/indra,johnbachman/indra,bgyori/indra,sorgerlab/belpy,sorgerlab/belpy,johnbachman/belpy,jo... | ---
+++
@@ -3,10 +3,11 @@
from processor import TripsProcessor
-def process_text(text):
+def process_text(text, save_xml_name='trips_output.xml'):
html = trips_client.send_query(text)
xml = trips_client.get_xml(html)
- trips_client.save_xml(xml, 'test.xml')
+ if save_xml_name:
+ trips_clie... |
62e5867f9dc5a758e3803e66043255881c8250c2 | democracy_club/apps/dc_members/forms.py | democracy_club/apps/dc_members/forms.py | from django.forms import ModelForm
from localflavor.gb.forms import GBPostcodeField
from .models import Member
class MemberUpdateForm(ModelForm):
class Meta:
model = Member
exclude = ['token', 'user', 'constituency', 'mapit_json']
postcode = GBPostcodeField(required=True) | from django.forms import ModelForm
from localflavor.gb.forms import GBPostcodeField
from .models import Member
class MemberUpdateForm(ModelForm):
class Meta:
model = Member
exclude = [
'token',
'user',
'constituency',
'mapit_json',
'sour... | Exclude most fields from User Profiles | Exclude most fields from User Profiles
| Python | bsd-3-clause | DemocracyClub/Website,DemocracyClub/Website,DemocracyClub/Website,DemocracyClub/Website | ---
+++
@@ -7,6 +7,12 @@
class MemberUpdateForm(ModelForm):
class Meta:
model = Member
- exclude = ['token', 'user', 'constituency', 'mapit_json']
+ exclude = [
+ 'token',
+ 'user',
+ 'constituency',
+ 'mapit_json',
+ 'source',
+ ... |
c608e7c88c4971e647171014ac5c8e77ecb0df34 | braid/info.py | braid/info.py | from fabric.api import run, quiet
from braid import succeeds, cacheInEnvironment
@cacheInEnvironment
def distroName():
"""
Get the name of the distro.
"""
with quiet():
lsb = run('/usr/bin/lsb_release --id --short', warn_only=True)
if lsb.succeeded:
return lsb.lower()
... | from fabric.api import run, quiet
from braid import succeeds, cacheInEnvironment
@cacheInEnvironment
def distroName():
"""
Get the name of the distro.
"""
with quiet():
lsb = run('/usr/bin/lsb_release --id --short', warn_only=True)
if lsb.succeeded:
return lsb.lower()
... | Add a helper to detect the architecture. | Add a helper to detect the architecture.
| Python | mit | alex/braid,alex/braid | ---
+++
@@ -19,6 +19,8 @@
if succeeds('/usr/bin/test -f {}'.format(sentinel)):
return distro
+
+
def distroFamily():
"""
Get the family of the distro.
@@ -34,3 +36,14 @@
if distro in members:
return family
return 'other'
+
+
+@cacheInEnvironment
+d... |
8026e6b21aacffc6f08d634103bc32b1775882ae | devicehive/transports/base_transport.py | devicehive/transports/base_transport.py | class BaseTransport(object):
"""Base transport class."""
def __init__(self, name, data_format_class, data_format_options,
handler_class, handler_options):
self._name = name
self._data_format = data_format_class(**data_format_options)
self._handler = handler_class(**hand... | class BaseTransport(object):
"""Base transport class."""
def __init__(self, name, data_format_class, data_format_options,
handler_class, handler_options):
self._name = name
self._data_format = data_format_class(**data_format_options)
self._handler = handler_class(self, ... | Remove transport from handler methods | Remove transport from handler methods
| Python | apache-2.0 | devicehive/devicehive-python | ---
+++
@@ -5,7 +5,7 @@
handler_class, handler_options):
self._name = name
self._data_format = data_format_class(**data_format_options)
- self._handler = handler_class(**handler_options)
+ self._handler = handler_class(self, **handler_options)
self._connected... |
22dcc9ee23841ecfbb23f76f2f8fd5c5c5bfb8cb | app/models.py | app/models.py | from app import db
class Base(db.Model):
__abstract__ = True
id = 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
class Base(db.Model):
__abstract__ = True
id = 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... | Remove unecessary initialization from Route model | Remove unecessary initialization from Route model
| Python | mit | mdsrosa/routes_api_python | ---
+++
@@ -18,11 +18,6 @@
destination_point = db.Column(db.String(128), nullable=False)
distance = db.Column(db.Integer, nullable=False)
- def __init__(self, origin_point, destination_point, distance):
- self.origin_point = origin_point
- self.destination_point = destination_point
- ... |
424fc74377ba4385e4c25fe90f888d39d5f14abd | runtests.py | runtests.py | #!/usr/bin/env python
from os.path import dirname, abspath
import sys
from django.conf import settings
if not settings.configured:
from django import VERSION
settings_dict = dict(
INSTALLED_APPS=(
'localeurl',
'localeurl.tests',
'django.contrib.sites', # for sitema... | #!/usr/bin/env python
from os.path import dirname, abspath
import sys
from django.conf import settings
if not settings.configured:
from django import VERSION
settings_dict = dict(
INSTALLED_APPS=(
'localeurl',
'localeurl.tests',
'django.contrib.sites', # for sitema... | Add SITE_ID to test settings since contrib.sites is in INSTALLED_APPS. | Add SITE_ID to test settings since contrib.sites is in INSTALLED_APPS.
| Python | mit | extertioner/django-localeurl,carljm/django-localeurl,gonnado/django-localeurl | ---
+++
@@ -14,6 +14,7 @@
'django.contrib.sites', # for sitemap test
),
ROOT_URLCONF='localeurl.tests.test_urls',
+ SITE_ID=1,
)
if VERSION >= (1, 2):
settings_dict["DATABASES"] = { |
fe5d330fd809285576b1696ccb9807910f5778ce | numscons/__init__.py | numscons/__init__.py | from core.misc import get_scons_path, get_scons_build_dir, \
get_scons_configres_dir, get_scons_configres_filename
from core.numpyenv import GetNumpyEnvironment
from core.libinfo_scons import NumpyCheckLibAndHeader
from checkers import CheckF77BLAS, CheckCBLAS, CheckCLAPACK, CheckF77LAPACK, Chec... | # XXX those are needed by the scons command only...
from core.misc import get_scons_path, get_scons_build_dir, \
get_scons_configres_dir, get_scons_configres_filename
# XXX those should not be needed by the scons command only...
from core.extension import get_python_inc, get_pythonlib_dir
# Thos... | Mark things to clean up later in global import | Mark things to clean up later in global import | Python | bsd-3-clause | cournape/numscons,cournape/numscons,cournape/numscons | ---
+++
@@ -1,9 +1,14 @@
+# XXX those are needed by the scons command only...
from core.misc import get_scons_path, get_scons_build_dir, \
get_scons_configres_dir, get_scons_configres_filename
+# XXX those should not be needed by the scons command only...
+from core.extension import get_pyth... |
b2ccc1b8144bf54f9e1416c187f9b5670e5d234d | src/librement/registration/forms.py | src/librement/registration/forms.py | from django import forms
from django.contrib.auth.models import User
from librement.profile.enums import AccountEnum
from librement.profile.models import Profile
class RegistrationForm(forms.ModelForm):
email = forms.EmailField()
password = forms.CharField()
password_confirm = forms.CharField()
cla... | from django import forms
from django.contrib.auth.models import User
from librement.profile.enums import AccountEnum
from librement.account.models import Email
from librement.profile.models import Profile
class RegistrationForm(forms.ModelForm):
email = forms.EmailField()
password = forms.CharField()
pa... | Check email address is not already used. | Check email address is not already used.
Signed-off-by: Chris Lamb <29e6d179a8d73471df7861382db6dd7e64138033@debian.org>
| Python | agpl-3.0 | rhertzog/librement,rhertzog/librement,rhertzog/librement | ---
+++
@@ -3,6 +3,7 @@
from librement.profile.enums import AccountEnum
+from librement.account.models import Email
from librement.profile.models import Profile
class RegistrationForm(forms.ModelForm):
@@ -23,6 +24,14 @@
'zipcode',
'country',
)
+
+ def clean_email(self):... |
adfe28a11fea94b207eea0417123a4155c909f05 | gpiocrust/__init__.py | gpiocrust/__init__.py | """
Object oriented wrapper around RPi.GPIO. Falls back to mock objects if RPi.GPIO
is not found.
"""
try:
import RPi.GPIO
from .raspberry_pi import *
except RuntimeError:
print(
'----------------------------------------------------------------------------')
print(
' WARNING: RPi.GPIO can only ... | """
Object oriented wrapper around RPi.GPIO. Falls back to mock objects if RPi.GPIO
is not found.
"""
try:
import RPi.GPIO
from .raspberry_pi import *
except RuntimeError:
print(
'----------------------------------------------------------------------------')
print(
' WARNING: RPi.GPIO can only ... | Fix import errors on non-RPi platforms | Fix import errors on non-RPi platforms
| Python | mit | zourtney/gpiocrust | ---
+++
@@ -13,6 +13,7 @@
' WARNING: RPi.GPIO can only be run on the RPi. Falling back to mock objects.')
print(
'----------------------------------------------------------------------------')
+ from .gpio_mock import *
except ImportError:
print('-----------------------------------------------... |
da2dc4e6f905356a705e2f75701f9d23c4b008ba | signac/contrib/errors.py | signac/contrib/errors.py | # Copyright (c) 2017 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
from ..core.errors import Error
class WorkspaceError(Error, OSError):
"Raised when there is an issue to create or access the workspace."
def __init__(self, error):
... | # Copyright (c) 2017 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
from ..core.errors import Error
class WorkspaceError(Error, OSError):
"Raised when there is an issue to create or access the workspace."
def __init__(self, error):
... | Fix OSError not printing bug | Fix OSError not printing bug
| Python | bsd-3-clause | csadorf/signac,csadorf/signac | ---
+++
@@ -9,6 +9,9 @@
def __init__(self, error):
self.error = error
"The underlying error causing this issue."
+
+ def __str__(self):
+ return self.error
class DestinationExistsError(Error, RuntimeError): |
24da68c145750ae230a7a855a1daf3cd97a813d8 | config.py | config.py | # 4chThreadArchiver
# Copyright (C) 2016, Sebastian "Chloride Cull" Johansson
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any... | # 4chThreadArchiver
# Copyright (C) 2016, Sebastian "Chloride Cull" Johansson
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any... | Change desustorage URL to desuarchive | Change desustorage URL to desuarchive
| Python | agpl-3.0 | ChlorideCull/4chThreadArchiver | ---
+++
@@ -11,6 +11,6 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
-ARCHIVE_SITE="https://desustorage.org"
+ARCHIVE_SITE="https://desuarchive.org"
UA="4chThreadArchiver/1.0 (Python {vinfo[0]}.{vinfo[1]}.{vinfo[2]}, using urllib)"
#UA="... |
dad58aa0162290627e9d96a5047a507237a49b76 | calculate.py | calculate.py |
operators = {'+', '-', '*', '/', '(', ')'}
def parse_formula(text):
tokens = []
buffer = ''
for c in text:
if '0' <= c <= '9':
buffer += c
elif c in operators:
if buffer:
tokens.append(int(buffer))
tokens.append(c)
buffer =... | # List of operators along with their associated precedence
operators = {None: 100, '+': 3, '-': 3, '*': 2, '/': 2, '(': 1, ')': 1}
def operation(v1, v2, operator):
if item == '+':
return v1 + v2
elif item == '-':
return v1 - v2
elif item == '*':
return v1 * v2
elif item == '/':... | Add support for basic binary operations | Add support for basic binary operations
| Python | mit | MichaelAquilina/Simple-Calculator | ---
+++
@@ -1,5 +1,18 @@
+# List of operators along with their associated precedence
+operators = {None: 100, '+': 3, '-': 3, '*': 2, '/': 2, '(': 1, ')': 1}
-operators = {'+', '-', '*', '/', '(', ')'}
+
+def operation(v1, v2, operator):
+ if item == '+':
+ return v1 + v2
+ elif item == '-':
+ r... |
b6b1117df271dae8adefa8cb8d3413b73fb393ce | touchpad_listener/touchpad_listener.py | touchpad_listener/touchpad_listener.py |
import serial
import sonic
sonic_pi = sonic.SonicPi()
connection = serial.Serial('/dev/tty.usbmodem1421', 115200)
while True:
line = connection.readline()
command, argument = line.strip().split(' ', 1)
if command == 'pad':
number = int(argument)
sonic_pi.run('cue :pad, number: {}'.format... |
import serial
import sonic
import glob
sonic_pi = sonic.SonicPi()
connection = serial.Serial(glob.glob('/dev/tty.usbmodem*')[0], 115200)
while True:
line = connection.readline()
command, argument = line.strip().split(' ', 1)
if command == 'pad':
number = int(argument)
sonic_pi.run('cue :... | Use `glob` to find an appropriate serial ttry | Use `glob` to find an appropriate serial ttry | Python | bsd-2-clause | CoderDojoScotland/coderdojo-sequencer,jonathanhogg/coderdojo-sequencer | ---
+++
@@ -1,10 +1,11 @@
import serial
import sonic
+import glob
sonic_pi = sonic.SonicPi()
-connection = serial.Serial('/dev/tty.usbmodem1421', 115200)
+connection = serial.Serial(glob.glob('/dev/tty.usbmodem*')[0], 115200)
while True:
line = connection.readline() |
3372bade0c5aee8c30c507832c842d6533608f61 | porunga/tests/test_main.py | porunga/tests/test_main.py | import unittest
from porunga import get_manager
from porunga.commands.test import PorungaTestCommand
class TestManager(unittest.TestCase):
def test_manager_has_proper_commands(self):
manager = get_manager()
commands = manager.get_commands()
self.assertIn('test', commands)
test_co... | import unittest
from porunga import get_manager
from porunga.commands.test import PorungaTestCommand
class TestManager(unittest.TestCase):
def test_manager_has_proper_commands(self):
manager = get_manager()
commands = manager.get_commands()
self.assertTrue('test' in commands)
tes... | Test updated to work with Python 2.6 | Test updated to work with Python 2.6
| Python | bsd-2-clause | lukaszb/porunga,lukaszb/porunga | ---
+++
@@ -9,7 +9,7 @@
manager = get_manager()
commands = manager.get_commands()
- self.assertIn('test', commands)
+ self.assertTrue('test' in commands)
test_command = commands['test']
- self.assertIsInstance(test_command, PorungaTestCommand)
+ self.assertTrue... |
71e73f19fcf9770f6b79092e3af66c9f27ecdc61 | eduid_dashboard_amp/__init__.py | eduid_dashboard_amp/__init__.py | from eduid_am.exceptions import UserDoesNotExist
def attribute_fetcher(db, user_id):
attributes = {}
user = db.profiles.find_one({'_id': user_id})
if user is None:
raise UserDoesNotExist("No user matching _id='%s'" % user_id)
else:
# white list of valid attributes for security reason... | from eduid_am.exceptions import UserDoesNotExist
WHITELIST_SET_ATTRS = (
'givenName',
'sn',
'displayName',
'photo',
'preferredLanguage',
'mail',
# TODO: Arrays must use put or pop, not set, but need more deep refacts
'norEduPersonNIN',
'eduPersonEntitlement',
'mobile',
'ma... | Add the new schema, now the $set modifier is used | Add the new schema, now the $set modifier is used
| Python | bsd-3-clause | SUNET/eduid-dashboard-amp | ---
+++
@@ -1,4 +1,23 @@
from eduid_am.exceptions import UserDoesNotExist
+
+
+WHITELIST_SET_ATTRS = (
+ 'givenName',
+ 'sn',
+ 'displayName',
+ 'photo',
+ 'preferredLanguage',
+ 'mail',
+
+ # TODO: Arrays must use put or pop, not set, but need more deep refacts
+ 'norEduPersonNIN',
+ 'edu... |
805c52698b3fed8df98462c15045f5de3822e241 | edx_repo_tools/dev/clone_org.py | edx_repo_tools/dev/clone_org.py | """Clone an entire GitHub organization."""
import os.path
import click
from git.repo.base import Repo
from edx_repo_tools.auth import pass_github
@click.command()
@click.option(
'--forks/--no-forks', is_flag=True, default=False,
help="Should forks be included?"
)
@click.option(
'--depth', type=int, def... | """Clone an entire GitHub organization."""
import os.path
import click
from git.repo.base import Repo
from edx_repo_tools.auth import pass_github
@click.command()
@click.option(
'--forks/--no-forks', is_flag=True, default=False,
help="Should forks be included?"
)
@click.option(
'--depth', type=int, defa... | Fix to work in python 3. | Fix to work in python 3.
| Python | apache-2.0 | edx/repo-tools,edx/repo-tools | ---
+++
@@ -6,7 +6,6 @@
from git.repo.base import Repo
from edx_repo_tools.auth import pass_github
-
@click.command()
@click.option(
@@ -22,7 +21,7 @@
)
@pass_github
def main(hub, forks, depth, org):
- for repo in hub.organization(org).repositories():
+ for repo in hub.organization(org).iter_repos():... |
40edb65ee751dfe4cf6e04ee59891266d8b14f30 | spacy/tests/regression/test_issue1380.py | spacy/tests/regression/test_issue1380.py | import pytest
from ...language import Language
def test_issue1380_empty_string():
nlp = Language()
doc = nlp('')
assert len(doc) == 0
@pytest.mark.models('en')
def test_issue1380_en(EN):
doc = EN('')
assert len(doc) == 0
| from __future__ import unicode_literals
import pytest
from ...language import Language
def test_issue1380_empty_string():
nlp = Language()
doc = nlp('')
assert len(doc) == 0
@pytest.mark.models('en')
def test_issue1380_en(EN):
doc = EN('')
assert len(doc) == 0
| Make test work for Python 2.7 | Make test work for Python 2.7
| Python | mit | recognai/spaCy,aikramer2/spaCy,honnibal/spaCy,aikramer2/spaCy,recognai/spaCy,aikramer2/spaCy,spacy-io/spaCy,explosion/spaCy,aikramer2/spaCy,explosion/spaCy,recognai/spaCy,recognai/spaCy,honnibal/spaCy,explosion/spaCy,spacy-io/spaCy,aikramer2/spaCy,recognai/spaCy,honnibal/spaCy,spacy-io/spaCy,honnibal/spaCy,spacy-io/spa... | ---
+++
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
import pytest
from ...language import Language |
66cb548c0d609e6364f9ec934814911760023d92 | ehriportal/urls.py | ehriportal/urls.py | from django.conf import settings
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.contrib import admin
admin.autodiscover()
from pinax.apps.account.openid_consumer import PinaxConsumer
handler500 = "pinax.views.server_error"
urlpatterns = patterns("",
... | from django.conf import settings
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.contrib import admin
admin.autodiscover()
from pinax.apps.account.openid_consumer import PinaxConsumer
handler500 = "pinax.views.server_error"
urlpatterns = patterns("",
... | Allow site_media/media to be served by staticfiles | Allow site_media/media to be served by staticfiles
| Python | mit | mikesname/ehri-collections,mikesname/ehri-collections,mikesname/ehri-collections | ---
+++
@@ -30,5 +30,10 @@
if settings.SERVE_MEDIA:
urlpatterns += patterns("",
- url(r"", include("staticfiles.urls")),
+ url(r"", include("staticfiles.urls"), {
+ 'document_root': settings.MEDIA_ROOT,
+ }),
+ url("^site_media/media(?P<path>.*)$", 'django.views.stat... |
e442d59dc58f7d6eeea3a3786d806af07b2ccb6a | fixtures/generate_random_network.py | fixtures/generate_random_network.py | from factory import fuzzy
from users.tests.factories import UserFactory
RANDOM_SEED = 1024
def create_profiles(num_profiles):
fuzzy.reseed_random(RANDOM_SEED)
return [user.profile
for user in (UserFactory.create() for x in range(num_profiles))]
| from factory import fuzzy
from users.tests.factories import UserFactory
RANDOM_SEED = 1024
def create_profiles(num_profiles):
# This seed does nothing because I'm using fake-factory instead of
# factory.fuzzy. TODO fix it
fuzzy.reseed_random(RANDOM_SEED)
return [user.profile
for user in... | Add todo to fix randomness | Add todo to fix randomness
| Python | mit | sbuss/voteswap,sbuss/voteswap,sbuss/voteswap,sbuss/voteswap | ---
+++
@@ -7,6 +7,8 @@
def create_profiles(num_profiles):
+ # This seed does nothing because I'm using fake-factory instead of
+ # factory.fuzzy. TODO fix it
fuzzy.reseed_random(RANDOM_SEED)
return [user.profile
for user in (UserFactory.create() for x in range(num_profiles))] |
f40da1b097d900c0c435d7550e891b0ece99bd91 | lib/torque_accounting.py | lib/torque_accounting.py | # torque_accounting.py
# Functions for working with Torque accounting files
def parse_line(line):
event = line.split(';')
job_name = event[2]
event_type = event[1]
event_time = event[0]
properties={}
prop_strings = event.split(" ")
for p in prop_strings:
prop=p.split("=")
... | # torque_accounting.py
# Functions for working with Torque accounting files
def parse_line(line):
event = line.split(';')
job_name = event[2]
event_type = event[1]
event_time = event[0]
properties={}
prop_strings = event.split(" ")
for p in prop_strings:
prop=p.split("=")
... | Add parse_files method to loop through a bunch of files | Add parse_files method to loop through a bunch of files
| Python | mit | ajdecon/torque_qhistory,ajdecon/torque_qhistory | ---
+++
@@ -22,6 +22,8 @@
lines=text.split("\n")
for line in lines:
+ if len(line)==0:
+ continue
job_name, event_type, event_time, properties = parse_line(line)
if not job_name in jobs:
jobs[job_name] = {}
@@ -32,3 +34,12 @@
jobs[job_name][p]=... |
62e40ee27413b170d40791912d8509e26b981398 | examples/tools/print_devices.py | examples/tools/print_devices.py | # import PyOpenCL and Numpy. An OpenCL-enabled GPU is not required,
# OpenCL kernels can be compiled on most CPUs thanks to the Intel SDK for OpenCL
# or the AMD APP SDK.
import pyopencl as cl
def main():
dev_type_str = {}
for dev_type in ['ACCELERATOR', 'ALL', 'CPU', 'CUSTOM', 'DEFAULT', 'GPU']:
dev_t... | # import PyOpenCL and Numpy. An OpenCL-enabled GPU is not required,
# OpenCL kernels can be compiled on most CPUs thanks to the Intel SDK for OpenCL
# or the AMD APP SDK.
import pyopencl as cl
def main():
dev_type_str = {}
for dev_type in ['ACCELERATOR', 'ALL', 'CPU', 'CUSTOM', 'DEFAULT', 'GPU']:
dev_t... | Print devices example - change out format | Print devices example - change out format
| Python | mit | openre/openre,openre/openre | ---
+++
@@ -8,12 +8,13 @@
for dev_type in ['ACCELERATOR', 'ALL', 'CPU', 'CUSTOM', 'DEFAULT', 'GPU']:
dev_type_str[getattr(cl.device_type, dev_type)] = dev_type
for platform_index, platform in enumerate(cl.get_platforms()):
- print 'ID: %s' % platform_index
- print platform.name
- ... |
139675bc644b796f4b472b3a8d9abd90205204c4 | bands_inspect/__init__.py | bands_inspect/__init__.py | # -*- coding: utf-8 -*-
# (c) 2017-2019, ETH Zurich, Institut fuer Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
"""
A tool for modifying, comparing and plotting electronic bandstructures.
"""
from . import kpoints
from . import eigenvals
from . import compare
from . import lattice
from . import plot
... | # -*- coding: utf-8 -*-
# (c) 2017-2019, ETH Zurich, Institut fuer Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
"""
A tool for modifying, comparing and plotting electronic bandstructures.
"""
from . import kpoints
from . import eigenvals
from . import compare
from . import lattice
from . import plot
... | Change version number to 0.2.2. | Change version number to 0.2.2.
| Python | apache-2.0 | Z2PackDev/bands_inspect,Z2PackDev/bands_inspect | ---
+++
@@ -12,4 +12,4 @@
from . import lattice
from . import plot
-__version__ = '0.2.1'
+__version__ = '0.2.2' |
0f0a9eda5be7cfe0a2076dc2dd8a4d24068f75e0 | benchmarks/step_detect.py | benchmarks/step_detect.py | try:
from asv import step_detect
except ImportError:
pass
class Simple:
def setup(self):
self.y = ([1]*20 + [2]*30)*50
def time_detect_regressions(self):
step_detect.detect_regressions(self.y)
def time_solve_potts_approx(self):
step_detect.solve_potts_approx(self.y, 0.3, ... | try:
from asv import step_detect
except ImportError:
pass
class Simple:
def setup(self):
self.y = ([1]*20 + [2]*30)*50
if hasattr(step_detect, 'detect_steps'):
def time_detect_regressions(self):
steps = step_detect.detect_steps(self.y)
step_detect.detect_regres... | Fix benchmarks vs. changes in b1cc0a9aa5107 | Fix benchmarks vs. changes in b1cc0a9aa5107
| Python | bsd-3-clause | qwhelan/asv,qwhelan/asv,pv/asv,pv/asv,spacetelescope/asv,spacetelescope/asv,airspeed-velocity/asv,spacetelescope/asv,airspeed-velocity/asv,airspeed-velocity/asv,qwhelan/asv,pv/asv,airspeed-velocity/asv,spacetelescope/asv,qwhelan/asv,pv/asv | ---
+++
@@ -8,8 +8,13 @@
def setup(self):
self.y = ([1]*20 + [2]*30)*50
- def time_detect_regressions(self):
- step_detect.detect_regressions(self.y)
+ if hasattr(step_detect, 'detect_steps'):
+ def time_detect_regressions(self):
+ steps = step_detect.detect_steps(self.y... |
89975de83d82695ba4615c72d17ac85baa39593d | invar/utils/ocr.py | invar/utils/ocr.py | # -*- coding: utf-8 -*-
from baluhn import generate as baluhn_generate, verify as baluhn_verify
from django.conf import settings
def generate(reference, check_length=settings.INVAR_OCR_CHECK_LENGTH):
reference = str(reference)
assert check_length == 1 or check_length == 2
if check_length == 1:
re... | # -*- coding: utf-8 -*-
from baluhn import generate as baluhn_generate, verify as baluhn_verify
from django.conf import settings
def generate(reference, check_length=settings.INVAR_OCR_CHECK_LENGTH):
reference = str(reference)
assert check_length == 1 or check_length == 2
if check_length == 1:
re... | Fix for empty reference bug | Fix for empty reference bug
| Python | mit | ovidner/bitket,ovidner/bitket,ovidner/bitket,ovidner/bitket | ---
+++
@@ -28,6 +28,9 @@
if baluhn_verify(ocr):
if check_length == 1:
return True
- elif check_length == 2 and str(len(ocr)) == ocr[-2]:
- return True
+ elif check_length == 2:
+ if len(ocr) < 3:
+ return False
+ if str(len(ocr)... |
860ef2b11774bc6acab848a6b37b808938086973 | pylibui/core.py | pylibui/core.py | """
Python wrapper for libui.
"""
from . import libui
class App:
def __init__(self):
"""
Creates a new pylibui app.
"""
options = libui.uiInitOptions()
libui.uiInit(options)
def __enter__(self):
self.start()
def start(self):
"""
S... | """
Python wrapper for libui.
"""
from . import libui
class App:
def __init__(self):
"""
Creates a new pylibui app.
"""
options = libui.uiInitOptions()
libui.uiInit(options)
def start(self):
"""
Starts the application main loop.
:return: N... | Revert "Make App a context manager" | Revert "Make App a context manager"
| Python | mit | superzazu/pylibui,superzazu/pylibui,joaoventura/pylibui,joaoventura/pylibui | ---
+++
@@ -16,9 +16,6 @@
options = libui.uiInitOptions()
libui.uiInit(options)
- def __enter__(self):
- self.start()
-
def start(self):
"""
Starts the application main loop.
@@ -26,10 +23,6 @@
:return: None
"""
libui.uiMain()
-
- ... |
d8c21c06f93f479fbbabaf02e4993499bd147e94 | python/setup.py | python/setup.py | #!/usr/bin/env python
from setuptools import setup, Extension
import string
import sys
import os
sys.path.append('./test')
with open("README.md") as f:
long_description = f.read()
def cmd(line):
return os.popen(line).readlines()[0][:-1].split()
setup(name = 'sentencepiece',
author = 'Taku Kudo',
... | #!/usr/bin/env python
from setuptools import setup, Extension
import string
import subprocess
import sys
sys.path.append('./test')
with open("README.md") as f:
long_description = f.read()
def cmd(line):
try:
output = subprocess.check_output(line, shell=True)
except subprocess.CalledProcessError:... | Call sys.exit when pkg-config fails | Call sys.exit when pkg-config fails
| Python | apache-2.0 | google/sentencepiece,google/sentencepiece,google/sentencepiece,google/sentencepiece | ---
+++
@@ -2,8 +2,8 @@
from setuptools import setup, Extension
import string
+import subprocess
import sys
-import os
sys.path.append('./test')
@@ -11,7 +11,12 @@
long_description = f.read()
def cmd(line):
- return os.popen(line).readlines()[0][:-1].split()
+ try:
+ output = subprocess... |
d84f42d45bb16820fb0077c9f0f92ba88e24d5de | cabot/cabotapp/jenkins.py | cabot/cabotapp/jenkins.py | from os import environ as env
from django.conf import settings
import requests
from datetime import datetime
from django.utils import timezone
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
auth = (settings.JENKINS_USER, settings.JENKINS_PASS)
def get_job_status(jobname):
ret =... | from os import environ as env
from django.conf import settings
import requests
from datetime import datetime
from django.utils import timezone
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
if settings.JENKINS_USER:
auth = (settings.JENKINS_USER, settings.JENKINS_PASS)
else:
... | Fix Jenkins tests when no user is set | Fix Jenkins tests when no user is set
| Python | mit | Affirm/cabot,Affirm/cabot,Affirm/cabot,Affirm/cabot | ---
+++
@@ -8,7 +8,10 @@
logger = get_task_logger(__name__)
-auth = (settings.JENKINS_USER, settings.JENKINS_PASS)
+if settings.JENKINS_USER:
+ auth = (settings.JENKINS_USER, settings.JENKINS_PASS)
+else:
+ auth = None
def get_job_status(jobname): |
51059ae476ca0dd553220cf25c73a0eb14a099de | RecorderFactory.py | RecorderFactory.py | from Recorders import Recorder, PrintRecorder, FileRecorder
factory = dict([
('print', create_print_recorder),
('file', create_file_recorder)])
def create_recorder(config):
return factory[config.type](config.config)
def create_print_recorder(config):
return PrintRecorder(config)
def create_file_reco... | from Recorders import Recorder, PrintRecorder, FileRecorder
def create_print_recorder(config):
return PrintRecorder(config)
def create_file_recorder(config):
return FileRecorder(config)
recorderInitializers = dict([
('print', create_print_recorder),
('file', create_file_recorder)])
def create_record... | Define initializers before use them | Define initializers before use them
| Python | mit | hectortosa/py-temperature-recorder | ---
+++
@@ -1,14 +1,14 @@
from Recorders import Recorder, PrintRecorder, FileRecorder
-
-factory = dict([
- ('print', create_print_recorder),
- ('file', create_file_recorder)])
-
-def create_recorder(config):
- return factory[config.type](config.config)
def create_print_recorder(config):
return Prin... |
e40985c1ecba1529987ed9551210677ea93b9614 | test/unit/builtins/test_install.py | test/unit/builtins/test_install.py | from .common import BuiltinTest
from bfg9000.builtins import default, install # noqa
from bfg9000 import file_types
from bfg9000.path import Path, Root
class TestInstall(BuiltinTest):
def test_install_none(self):
self.assertEqual(self.builtin_dict['install'](), None)
def test_install_single(self):
... | import mock
from .common import BuiltinTest
from bfg9000.builtins import default, install # noqa
from bfg9000 import file_types
from bfg9000.path import Path, Root
class TestInstall(BuiltinTest):
def test_install_none(self):
self.assertEqual(self.builtin_dict['install'](), None)
def test_install_s... | Add tests for unset installation dirs | Add tests for unset installation dirs
| Python | bsd-3-clause | jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000 | ---
+++
@@ -1,3 +1,5 @@
+import mock
+
from .common import BuiltinTest
from bfg9000.builtins import default, install # noqa
@@ -25,3 +27,11 @@
exe = file_types.Executable(Path('/path/to/exe', Root.absolute), None)
self.assertRaises(ValueError, self.builtin_dict['install'], exe)
+
+ def tes... |
260cd3b96df3a4746560db0032d7b6042c55d7fc | integration-test/976-fractional-pois.py | integration-test/976-fractional-pois.py | # https://www.openstreetmap.org/way/147689077
# Apple Store, SF
assert_has_feature(
15, 5242, 12664, 'pois',
{ 'id': 147689077, 'min_zoom': 15.68 })
| # https://www.openstreetmap.org/way/147689077
# Apple Store, SF
assert_has_feature(
15, 5242, 12664, 'pois',
{ 'id': 147689077, 'min_zoom': 15.68 })
# Test that source and min_zoom are set properly for boundaries, roads, transit, and water
assert_has_feature(
5, 9, 12, 'boundaries',
{ 'min_zoom': 0 , '... | Add tests for source and min_zoom | Add tests for source and min_zoom
| Python | mit | mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource | ---
+++
@@ -3,3 +3,51 @@
assert_has_feature(
15, 5242, 12664, 'pois',
{ 'id': 147689077, 'min_zoom': 15.68 })
+
+# Test that source and min_zoom are set properly for boundaries, roads, transit, and water
+assert_has_feature(
+ 5, 9, 12, 'boundaries',
+ { 'min_zoom': 0 , 'id': 8024,
+ 'source': 'na... |
633969d8d53d28db48bb2478820e90315329542c | tiddlywebplugins/prettyerror/instance.py | tiddlywebplugins/prettyerror/instance.py |
store_contents = {}
store_structure = {}
store_contents['_default_errors'] = [
'src/_errors/index.recipe',
]
store_structure['recipes'] = {}
store_structure['bags'] = {}
store_structure['recipes']['_errors'] = {
'desc': 'Pretty Errors Error Tiddlers',
'recipe': [
('_defau... | """
Establish the data structures representing the bags and recipes needed
by this plugin.
"""
store_contents = {}
store_structure = {}
store_contents['_default_errors'] = [
'src/_errors/index.recipe',
]
store_structure['recipes'] = {}
store_structure['bags'] = {}
store_structure['recipes']['_errors... | Correct set policy on bag. | Correct set policy on bag.
Had been missing create constraint.
| Python | bsd-3-clause | tiddlyweb/tiddlywebplugins.prettyerror | ---
+++
@@ -1,3 +1,7 @@
+"""
+Establish the data structures representing the bags and recipes needed
+by this plugin.
+"""
store_contents = {}
store_structure = {}
@@ -21,7 +25,7 @@
'manage': ['R:ADMIN'],
'delete': ['R:ADMIN'],
'owner': 'administractor',
- 'write'... |
fe37ef9248f8658296e6f465d380d639d6047a5d | aspen/server/diesel_.py | aspen/server/diesel_.py | import diesel
from aspen.server import BaseEngine
from diesel.protocols import wsgi
class Engine(BaseEngine):
app = None # a diesel app instance
def bind(self):
self.app = wsgi.WSGIApplication( self.website
, self.website.address[1]
... | import diesel
from aspen.server import BaseEngine
from diesel.protocols import wsgi
class Engine(BaseEngine):
diesel_app = None # a diesel diesel_app instance
def bind(self):
self.diesel_app = wsgi.WSGIApplication( self.website
, self.website.address[1]
... | Reduce log spam from diesel. | Reduce log spam from diesel.
| Python | mit | gratipay/aspen.py,gratipay/aspen.py | ---
+++
@@ -5,20 +5,21 @@
class Engine(BaseEngine):
- app = None # a diesel app instance
+ diesel_app = None # a diesel diesel_app instance
def bind(self):
- self.app = wsgi.WSGIApplication( self.website
- , self.website.address[1]
- ... |
cc08fcbb513224aafe6c04143a150d1019c032ef | setup_py2exe.py | setup_py2exe.py | #!/usr/bin/env python
# C:\Python27_32\python.exe setup_py2exe.py py2exe
from distutils.core import setup
from glob import glob
import os
import py2exe
from setup import SSLYZE_SETUP
data_files = [("Microsoft.VC90.CRT", glob(r'C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*'))]
# T... | #!/usr/bin/env python
# C:\Python27_32\python.exe setup_py2exe.py py2exe
from distutils.core import setup
from glob import glob
import os
import py2exe
from setup import SSLYZE_SETUP
data_files = [("Microsoft.VC90.CRT", glob(r'C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*'))]
# T... | Fix trust stores paths for py2exe builds | Fix trust stores paths for py2exe builds
| Python | agpl-3.0 | nabla-c0d3/sslyze | ---
+++
@@ -11,14 +11,13 @@
data_files = [("Microsoft.VC90.CRT", glob(r'C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*'))]
# Trust Stores
-plugin_data_path = 'plugins\\data\\trust_stores'
plugin_data_files = []
-for file in os.listdir(plugin_data_path):
- file = os.path.join... |
013d0e3b2d8fdc212ae63f635a1e8def988672fa | tests/structures/test_sequences.py | tests/structures/test_sequences.py | import unittest
from ..utils import TranspileTestCase
class SequenceTests(TranspileTestCase):
def test_unpack_sequence(self):
self.assertCodeExecution("""
x = [1, 2, 3]
a, b, c = x
print(a)
print(b)
print(c)
""")
@unittest.skip(... | import unittest
from ..utils import TranspileTestCase
class SequenceTests(TranspileTestCase):
def test_unpack_sequence(self):
self.assertCodeExecution("""
x = [1, 2, 3]
a, b, c = x
print(a)
print(b)
print(c)
""")
@unittest.expec... | Convert some skips to expected failures. | Convert some skips to expected failures.
| Python | bsd-3-clause | glasnt/voc,freakboy3742/voc,ASP1234/voc,ASP1234/voc,Felix5721/voc,pombredanne/voc,pombredanne/voc,Felix5721/voc,cflee/voc,cflee/voc,gEt-rIgHt-jR/voc,glasnt/voc,gEt-rIgHt-jR/voc,freakboy3742/voc | ---
+++
@@ -13,7 +13,7 @@
print(c)
""")
- @unittest.skip('Feature not yet implemented')
+ @unittest.expectedFailure
def test_unpack_sequence_overflow(self):
self.assertCodeExecution("""
x = [1, 2, 3]
@@ -22,7 +22,7 @@
print(b)
""")... |
9639cb7607d301abbc7ad6c8b22aa97e6a0eb5cb | tests/examples/test_examples_run.py | tests/examples/test_examples_run.py | import pytest
from os.path import abspath, basename, dirname, join
import subprocess
import glob
import sys
cwd = abspath(dirname(__file__))
examples_dir = join(cwd, "..", "..", "examples")
example_files = glob.glob("%s/*.py" % examples_dir)
@pytest.fixture(params=[pytest.param(f, marks=pytest.mark.xfail(reason="un... | import pytest
from os.path import abspath, basename, dirname, join
import subprocess
import glob
import sys
cwd = abspath(dirname(__file__))
examples_dir = join(cwd, "..", "..", "examples")
example_files = glob.glob("%s/*.py" % examples_dir)
@pytest.fixture(params=glob.glob("%s/*.py" % examples_dir),
... | Remove pytest flag for xfails | Remove pytest flag for xfails
| Python | mit | firedrakeproject/gusto,firedrakeproject/dcore | ---
+++
@@ -10,9 +10,7 @@
example_files = glob.glob("%s/*.py" % examples_dir)
-@pytest.fixture(params=[pytest.param(f, marks=pytest.mark.xfail(reason="unreliable"))
- if f.endswith("mountain_hydrostatic.py")
- else f for f in example_files],
+@pytest.fixture(params=g... |
e783dfef25eb1e3b06064fb2bd125cef4f56ec08 | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2013 Aparajita Fishman
#
# Project: https://github.com/SublimeLinter/SublimeLinter-contrib-gjslint
# License: MIT
#
"""This module exports the GJSLint plugin linter class."""
from S... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2013 Aparajita Fishman
#
# Project: https://github.com/SublimeLinter/SublimeLinter-contrib-gjslint
# License: MIT
#
"""This module exports the GJSLint plugin linter class."""
from S... | Change 'language' to 'syntax', that is more precise terminology. | Change 'language' to 'syntax', that is more precise terminology.
| Python | mit | SublimeLinter/SublimeLinter-gjslint | ---
+++
@@ -18,7 +18,7 @@
"""Provides an interface to the gjslint executable."""
- language = ('javascript', 'html')
+ syntax = ('javascript', 'html')
cmd = 'gjslint --nobeep --nosummary'
regex = r'^Line (?P<line>\d+), (?:(?P<error>E)|(?P<warning>W)):\d+: (?P<message>[^"]+(?P<near>"[^"]+")?)$... |
ce6685d18492fe0787ded92939f52916e0d9cbaa | lc046_permutations.py | lc046_permutations.py | """Leetcode 46. Permutations
Medium
URL: https://leetcode.com/problems/permutations/
Given a collection of distinct integers, return all possible permutations.
Example:
Input: [1,2,3]
Output:
[
[1,2,3],
[1,3,2],
[2,1,3],
[2,3,1],
[3,1,2],
[3,2,1]
]
"""
class Solution(object):
def _backtrack(self, pe... | """Leetcode 46. Permutations
Medium
URL: https://leetcode.com/problems/permutations/
Given a collection of distinct integers, return all possible permutations.
Example:
Input: [1,2,3]
Output:
[
[1,2,3],
[1,3,2],
[2,1,3],
[2,3,1],
[3,1,2],
[3,2,1]
]
"""
class Solution(object):
def _backtrack(self, pe... | Refactor adding temp to permutations | Refactor adding temp to permutations
| Python | bsd-2-clause | bowen0701/algorithms_data_structures | ---
+++
@@ -23,16 +23,17 @@
if len(temps) == len(nums):
# One of permutations is completed.
permutations.append(temps[:])
- else:
- for i in range(len(nums)):
- # If num i was used, skip it; otherwise add it to temps.
- if nums[i] in t... |
6ba67b7090bbbb7a19e3a6c5623c1e63c0452428 | dmoj/executors/OCTAVE.py | dmoj/executors/OCTAVE.py | from .base_executor import ScriptExecutor
class Executor(ScriptExecutor):
ext = '.m'
name = 'OCTAVE'
command = 'octave'
address_grace = 131072
test_program = "disp(input('', 's'))"
fs = ['.*\.m', '/lib/', '/etc/nsswitch\.conf$', '/etc/passwd$', '/usr/share/', '/etc/fltk/']
def get_cmdlin... | from .base_executor import ScriptExecutor
class Executor(ScriptExecutor):
ext = '.m'
name = 'OCTAVE'
command = 'octave'
address_grace = 131072
test_program = "disp(input('', 's'))"
fs = ['.*\.m', '/lib/', '/etc/nsswitch\.conf$', '/etc/passwd$', '/usr/share/', '/etc/fltk/']
def get_cmdlin... | Address execve protection fault in Octave autoconfig | Address execve protection fault in Octave autoconfig
`octave-cli` is what we really want
| Python | agpl-3.0 | DMOJ/judge,DMOJ/judge,DMOJ/judge | ---
+++
@@ -13,3 +13,9 @@
def get_cmdline(self):
return [self.get_command(), '--no-gui', '--no-history', '--no-init-file', '--no-site-file',
'--no-window-system', '--norc', '--quiet', self._code]
+
+ @classmethod
+ def get_find_first_mapping(cls):
+ return {
+ 'o... |
a962b38f6e36e8d06feee5fed5fcacaa69ef6761 | dnzo/admin/migrations.py | dnzo/admin/migrations.py | from google.appengine.ext import db
def update_context_indexes(start_key = None):
def fn(task):
task.contexts_index = " ".join(task.contexts)
task.put()
return True
from tasks_data.models import Task
return do_for_all(Task, start_key, fn, 50)
def do_for_all(model_klass, start_key, callbac... | from google.appengine.ext import db
def update_context_indexes(start_key = None):
def fn(task):
task.contexts_index = " ".join(task.contexts)
task.put()
return True
from tasks_data.models import Task
return do_for_all(Task, start_key, fn, 20)
def do_for_all(model_klass, start_key, callbac... | Change to 20 records at a time instead of 50. | Change to 20 records at a time instead of 50.
git-svn-id: 062a66634e56759c7c3cc44955c32d2ce0012d25@256 c02d1e6f-6a35-45f2-ab14-3b6f79a691ff
| Python | mit | taylorhughes/done-zo,taylorhughes/done-zo,taylorhughes/done-zo,taylorhughes/done-zo | ---
+++
@@ -8,7 +8,7 @@
return True
from tasks_data.models import Task
- return do_for_all(Task, start_key, fn, 50)
+ return do_for_all(Task, start_key, fn, 20)
def do_for_all(model_klass, start_key, callback, max_records = 100): |
011f7fbe66cc226cdd2be2e2eeef44df11733251 | scrapyard/kickass.py | scrapyard/kickass.py | import cache
import network
import scraper
import urllib
KICKASS_URL = 'http://kickass.so'
################################################################################
def movie(movie_info):
return __search('category:{0} imdb:{1}'.format('movies', movie_info['imdb_id'][2:]))
#################################... | import cache
import network
import scraper
import urllib
KICKASS_URL = 'http://kickass.so'
################################################################################
def movie(movie_info):
return __search('category:{0} imdb:{1}'.format('movies', movie_info['imdb_id'][2:]))
#################################... | Remove ? from show title when searching | Kickass: Remove ? from show title when searching
| Python | mit | sharkone/scrapyard | ---
+++
@@ -11,7 +11,8 @@
################################################################################
def episode(show_info, episode_info):
- return __search('category:{0} {1} season:{2} episode:{3}'.format('tv', show_info['title'], episode_info['season_index'], episode_info['episode_index']))
+ clean_... |
21bcb3105c9c3884f2a369a75408d91cdca5992e | tests/core/test_extensions.py | tests/core/test_extensions.py | from __future__ import unicode_literals, print_function, division, absolute_import
from nose.tools import raises
from openfisca_core.parameters import ParameterNode
from openfisca_country_template import CountryTaxBenefitSystem
tbs = CountryTaxBenefitSystem()
def test_extension_not_already_loaded():
assert tbs... | from __future__ import unicode_literals, print_function, division, absolute_import
from nose.tools import raises
from openfisca_core.parameters import ParameterNode
from openfisca_country_template import CountryTaxBenefitSystem
tbs = CountryTaxBenefitSystem()
def test_extension_not_already_loaded():
assert tbs... | Test extension's parameter access for a given period | Test extension's parameter access for a given period
| Python | agpl-3.0 | openfisca/openfisca-core,openfisca/openfisca-core | ---
+++
@@ -31,6 +31,7 @@
assert tbs.get_variable('local_town_child_allowance') is not None
assert walk_and_count(tbs.parameters) == 9
+ assert tbs.parameters('2016-01').local_town.child_allowance.amount == 100.0
assert tbs.parameters.local_town.child_allowance.amount is not None
|
513244c067713a9b87f322c50be43643fdcca056 | test/api/test_api.py | test/api/test_api.py | import time
import subprocess
import pytest
import sys
SOURCE = "**"
if len(sys.argv) == 2:
SOURCE = str(sys.argv[1])
start = subprocess.Popen(['make', 'backend'])
time.sleep(5)
process = subprocess.run("pytest augur/datasources/{}/test_{}_routes.py".format(SOURCE, SOURCE), shell=True)
time.sleep(2)
subprocess.Po... | import time
import subprocess
import os
import pytest
import sys
SOURCE = "**"
if len(sys.argv) == 2:
SOURCE = str(sys.argv[1])
FNULL = open(os.devnull, 'w')
start = subprocess.Popen(['augur', 'run'], stdout=FNULL, stderr=subprocess.STDOUT)
time.sleep(20)
process = subprocess.run("pytest augur/datasources/{}/tes... | Refactor API testing script to be consistent with Travis build | Refactor API testing script to be consistent with Travis build
Signed-off-by: Carter Landis <ffc486ac0b21a34cfd7d1170183ed86b0f1b04a2@gmail.com>
| Python | mit | OSSHealth/ghdata,OSSHealth/ghdata,OSSHealth/ghdata | ---
+++
@@ -1,5 +1,6 @@
import time
import subprocess
+import os
import pytest
import sys
@@ -7,10 +8,12 @@
if len(sys.argv) == 2:
SOURCE = str(sys.argv[1])
-start = subprocess.Popen(['make', 'backend'])
+FNULL = open(os.devnull, 'w')
+
+start = subprocess.Popen(['augur', 'run'], stdout=FNULL, stderr=su... |
c8f1d40f97e0e6be633acec8533f890287ef5200 | server/systeminfo.py | server/systeminfo.py | #!/bin/python3
""" This script contains functions to access various system's info.
Author: Julien Delplanque
"""
import subprocess
def get_uptime():
""" Return the uptime of the system as a str using the command: $ uptime
"""
proc = subprocess.Popen(["uptime"], stdout=subprocess.PIPE, shell=True)
... | #!/bin/python3
""" This script contains functions to access various system's info.
Author: Julien Delplanque
"""
import subprocess
def get_uptime():
""" Return the uptime of the system as a str using the command: $ uptime
"""
proc = subprocess.Popen(["uptime"], stdout=subprocess.PIPE, shell=True)
... | Correct get_uptime function. It didn't extract the uptime correctly. Now it does. | Correct get_uptime function. It didn't extract the uptime correctly. Now it does.
| Python | mit | juliendelplanque/raspirestmonitor | ---
+++
@@ -10,6 +10,6 @@
"""
proc = subprocess.Popen(["uptime"], stdout=subprocess.PIPE, shell=True)
(output, error) = proc.communicate()
- uptime = output.decode("utf-8").split()[2]
- uptime = uptime[0:len(uptime)-2] # remove the comma
+ uptime = output.decode("utf-8").split(",")[0]
+ upt... |
aae2a298d0f5b6e94d4c7041b1cef0df424666a9 | bench_bin.py | bench_bin.py | import socket
import time
import random
import struct
NUM = 1024 * 1024 * 4
KEYS = ["test", "foobar", "zipzap"]
VALS = [32, 100, 82, 101, 5, 6, 42, 73]
BINARY_HEADER = struct.Struct("<BBHd")
BIN_TYPES = {"kv": 1, "c": 2, "ms": 3}
def format(key, type, val):
"Formats a binary message for statsite"
key = str(... | import socket
import time
import random
import struct
NUM = 1024 * 1024
KEYS = ["test", "foobar", "zipzap"]
VALS = [32, 100, 82, 101, 5, 6, 42, 73]
BINARY_HEADER = struct.Struct("<BBHd")
BIN_TYPES = {"kv": 1, "c": 2, "ms": 3}
def format(key, type, val):
"Formats a binary message for statsite"
key = str(key)... | Change binary benchmark to loop forever too | Change binary benchmark to loop forever too
| Python | bsd-3-clause | u-s-p/statsite,statsite/statsite,Instagram/statsite,kuba--/statsite,zeedunk/statsite,nwangtw/statsite,theatrus/statsite,lazybios/statsite,zeedunk/statsite,Instagram/statsite,statsite/statsite,tsunli/statsite,kuba--/statsite,armon/statsite,nspragg/statsite,nspragg/statsite,sleepybishop/statsite,theatrus/statsite,u-s-p/s... | ---
+++
@@ -3,7 +3,7 @@
import random
import struct
-NUM = 1024 * 1024 * 4
+NUM = 1024 * 1024
KEYS = ["test", "foobar", "zipzap"]
VALS = [32, 100, 82, 101, 5, 6, 42, 73]
@@ -31,13 +31,16 @@
s.connect(("localhost", 8125))
start = time.time()
-current = 0
-while current < len(METS):
- msg = "".join(METS[... |
be3824f150fc96f10a485b24a93290c6c87afc46 | sotu/github.py | sotu/github.py | import os
import urllib
import requests
GITHUB_BASE_URI = os.environ.get('GITHUB_BASE_URI', 'https://github.com')
GITHUB_API_BASE_URI = os.environ.get('GITHUB_API_BASE_URI', 'https://api.github.com')
GITHUB_CLIENT_ID = os.environ['GITHUB_CLIENT_ID']
GITHUB_CLIENT_SECRET = os.environ['GITHUB_CLIENT_SECRET']
GITHUB_CAL... | import os
import urllib
import requests
GITHUB_BASE_URI = os.environ.get('GITHUB_BASE_URI', 'https://github.com')
GITHUB_API_BASE_URI = os.environ.get('GITHUB_API_BASE_URI', 'https://api.github.com')
GITHUB_CLIENT_ID = os.environ['GITHUB_CLIENT_ID']
GITHUB_CLIENT_SECRET = os.environ['GITHUB_CLIENT_SECRET']
GITHUB_CAL... | Use correct URL for API | [GitHub] Use correct URL for API
| Python | mit | CocoaPods/sotu.cocoapods.org,CocoaPods/sotu.cocoapods.org | ---
+++
@@ -24,11 +24,11 @@
def retrieve_account(access_token):
- return requests.get(GITHUB_BASE_URI + '/user?' + urllib.urlencode({'access_token': access_token})).json()
+ return requests.get(GITHUB_API_BASE_URI + '/user?' + urllib.urlencode({'access_token': access_token})).json()
def retrieve_email... |
552166a61e66f305b3729718361078558298883b | couchdb/tests/testutil.py | couchdb/tests/testutil.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import uuid
from couchdb import client
class TempDatabaseMixin(object):
temp_dbs = None
_d... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import random
import sys
from couchdb import client
class TempDatabaseMixin(object):
temp_dbs ... | Use a random number instead of uuid for temp database name. | Use a random number instead of uuid for temp database name.
| Python | bsd-3-clause | ssaavedra/couchdb-python,oliora/couchdb-python,hdmessaging/couchbase-mapping-python | ---
+++
@@ -6,7 +6,8 @@
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
-import uuid
+import random
+import sys
from couchdb import client
class TempDatabaseMixin(object):
@@ -25,7 +26,12 @@
def temp_db(self):
if self.t... |
bd11c37a8669bdae2d4561483f50da0891b82627 | monsetup/detection/plugins/zookeeper.py | monsetup/detection/plugins/zookeeper.py | import logging
import os
import yaml
import monsetup.agent_config
import monsetup.detection
log = logging.getLogger(__name__)
class Zookeeper(monsetup.detection.Plugin):
"""Detect Zookeeper daemons and setup configuration to monitor them.
"""
def _detect(self):
"""Run detection, set self.ava... | import logging
import os
import yaml
import monsetup.agent_config
import monsetup.detection
log = logging.getLogger(__name__)
class Zookeeper(monsetup.detection.Plugin):
"""Detect Zookeeper daemons and setup configuration to monitor them.
"""
def _detect(self):
"""Run detection, set self.ava... | Fix detection of Zookeeper in monasca-setup | Fix detection of Zookeeper in monasca-setup
The Zookeeper detection plugin was looking for zookeeper in the process
command-line. This was producing false positives in the detection
process because storm uses the zookeeper library and it shows up
the command-line for storm.
Change-Id: I764a3064003beec55f0e589272855d... | Python | bsd-3-clause | sapcc/monasca-agent,sapcc/monasca-agent,sapcc/monasca-agent | ---
+++
@@ -19,7 +19,7 @@
"""Run detection, set self.available True if the service is detected.
"""
- if monsetup.detection.find_process_cmdline('zookeeper') is not None:
+ if monsetup.detection.find_process_cmdline('org.apache.zookeeper') is not None:
self.available = T... |
16703454a9334b6667a761bd52b0a5029e5976b2 | tests/test_api_views.py | tests/test_api_views.py | import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.api.settings")
import django
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from api.webview.views import DocumentList
django.setup()
class APIViewTests(TestCase):
def setUp(self):
self.factory = APIRequ... | import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.api.settings")
import pytest
import django
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from api.webview.views import DocumentList
django.setup()
class APIViewTests(TestCase):
def setUp(self):
self.fac... | Add pytest mark database setup for test | Add pytest mark database setup for test
| Python | apache-2.0 | erinspace/scrapi,felliott/scrapi,fabianvf/scrapi,CenterForOpenScience/scrapi,erinspace/scrapi,fabianvf/scrapi,mehanig/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,felliott/scrapi | ---
+++
@@ -1,6 +1,7 @@
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.api.settings")
+import pytest
import django
from django.test import TestCase
from rest_framework.test import APIRequestFactory
@@ -15,6 +16,7 @@
def setUp(self):
self.factory = APIRequestFactory()
+ @pytes... |
7cff4344538c59763560a9a86fda0f464f208b66 | nightreads/user_manager/user_service.py | nightreads/user_manager/user_service.py | from django.contrib.auth.models import User
from nightreads.posts.models import Tag
from .models import UserTag
def update_user_tags(user, tags):
tags_objs = Tag.objects.filter(name__in=tags)
user.usertag.tags.add(*tags_objs)
user.save()
def get_user(email):
user, created = User.objects.get_or_crea... | from django.contrib.auth.models import User
from nightreads.posts.models import Tag
from .models import UserTag
def update_user_tags(user, tags):
tags_objs = Tag.objects.filter(name__in=tags)
if tags_objs:
user.usertag.tags.clear()
user.usertag.tags.add(*tags_objs)
user.save()
def get_u... | Clear existing tags before updating | Clear existing tags before updating
| Python | mit | avinassh/nightreads,avinassh/nightreads | ---
+++
@@ -6,7 +6,9 @@
def update_user_tags(user, tags):
tags_objs = Tag.objects.filter(name__in=tags)
- user.usertag.tags.add(*tags_objs)
+ if tags_objs:
+ user.usertag.tags.clear()
+ user.usertag.tags.add(*tags_objs)
user.save()
|
c31d1b9a50452ae1906eca9735cbfb9acd2580dd | src/parse_user_history/history_parser.py | src/parse_user_history/history_parser.py | import os.path
import json
import urlparse
ACCEPTED_FILETYPES = [
'json',
# 'csv'
]
class HistoryParser():
def __init__(self, path):
if not os.path.isfile(path):
raise Exception("File not found.")
if path.split(".")[-1] not in ACCEPTED_FILETYPES:
raise Excep... | import os.path
import json
import urlparse
ACCEPTED_FILETYPES = [
'json',
# 'csv'
]
class HistoryParser():
def __init__(self, path):
if not os.path.isfile(path):
raise Exception("File not found.")
if path.split(".")[-1] not in ACCEPTED_FILETYPES:
raise Excep... | Prepend http to urls in user history | Prepend http to urls in user history
| Python | mit | piatra/ssl-project | ---
+++
@@ -26,11 +26,9 @@
visited = {}
for entry in data:
url = urlparse.urlparse(entry["url"]).netloc
- try:
- visited[url] = visited[url] + entry["visitCount"]
- except:
- visited[url] = entry["visitCount"]
+ if len(url.s... |
1cafb39b6204010d3e17b059254af6042f4a9efc | apts/__init__.py | apts/__init__.py | import os
import shutil
import configparser
from .equipment import Equipment
from .observations import Observation
from .place import Place
from .weather import Weather
from .notify import Notify
from .catalogs import Catalogs
from .utils import Utils
user_config = os.path.expanduser("~") + "/.config/apts/apts.ini"
... | import os
import shutil
import configparser
from .equipment import Equipment
from .observations import Observation
from .place import Place
from .weather import Weather
from .notify import Notify
from .catalogs import Catalogs
from .utils import Utils
# Default values for configuration values
DEFAULTS = {
'weathe... | Add default values for config | Add default values for config
| Python | apache-2.0 | pozar87/apts | ---
+++
@@ -10,9 +10,23 @@
from .catalogs import Catalogs
from .utils import Utils
+# Default values for configuration values
+DEFAULTS = {
+ 'weather': {
+ 'api_key': 'unknown',
+ 'api_url': 'unknown'
+ },
+ 'notification': {
+ 'email_address': 'unknown',
+ 'email_password': ... |
52648b65d5920e3c87cfbdd0d71d4d91302b3991 | calaccess_raw/admin/tracking.py | calaccess_raw/admin/tracking.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Custom administration panels for tracking models.
"""
from __future__ import unicode_literals
from django.contrib import admin
from calaccess_raw import models
from .base import BaseAdmin
@admin.register(models.RawDataVersion)
class RawDataVersionAdmin(BaseAdmin):
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Custom administration panels for tracking models.
"""
from __future__ import unicode_literals
from django.contrib import admin
from calaccess_raw import models
from .base import BaseAdmin
@admin.register(models.RawDataVersion)
class RawDataVersionAdmin(BaseAdmin):
... | Update count fields on RawDataVersionAdmin | Update count fields on RawDataVersionAdmin
| Python | mit | california-civic-data-coalition/django-calaccess-raw-data | ---
+++
@@ -18,8 +18,10 @@
"id",
"release_datetime",
"pretty_download_size",
- "file_count",
- "record_count",
+ "download_file_count",
+ "download_record_count",
+ "clean_file_count",
+ "clean_record_count",
"pretty_clean_size",
)
... |
d4c0a8d0077439adb1e074e6f6e1a1e8b751a804 | serfnode/handler/config.py | serfnode/handler/config.py | import os
import uuid
from mischief.actors.pipe import get_local_ip
import yaml
def read_serfnode_yml():
with open('/serfnode.yml') as input:
conf = yaml.load(input) or {}
return conf['serfnode']
yml = read_serfnode_yml()
role = os.environ.get('ROLE') or yml.get('ROLE') or 'no_role'
peer = os... | import os
import uuid
from mischief.actors.pipe import get_local_ip
import yaml
def read_serfnode_yml():
with open('/serfnode.yml') as input:
conf = yaml.load(input) or {}
return conf.get('serfnode', {})
yml = read_serfnode_yml()
role = os.environ.get('ROLE') or yml.get('ROLE') or 'no_role'
p... | Fix handling of empty file | Fix handling of empty file | Python | mit | waltermoreira/serfnode,waltermoreira/serfnode,waltermoreira/serfnode | ---
+++
@@ -8,7 +8,7 @@
def read_serfnode_yml():
with open('/serfnode.yml') as input:
conf = yaml.load(input) or {}
- return conf['serfnode']
+ return conf.get('serfnode', {})
yml = read_serfnode_yml() |
e033fa49673cdc1b682edcc2aaf1e140a73ab1b4 | src/wirecloud/platform/context/models.py | src/wirecloud/platform/context/models.py | # -*- coding: utf-8 -*-
# Copyright 2013 Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... | # -*- coding: utf-8 -*-
# Copyright 2013 Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... | Remove scope attribute from Constant | Remove scope attribute from Constant
| Python | agpl-3.0 | rockneurotiko/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud,jpajuelo/wirecloud,jpajuelo/wirecloud,rockneurotiko/wirecloud | ---
+++
@@ -24,12 +24,10 @@
class Constant(models.Model):
- scope = models.CharField(_('Scope'), max_length=20, null=False, blank=False)
- concept = models.CharField(_('Concept'), max_length=255, null=False, blank=False)
+ concept = models.CharField(_('Concept'), max_length=255, unique=True, null=False,... |
53cae8a7d95832a0f95a537468552254028a0668 | tests/system/test_auth.py | tests/system/test_auth.py | import pytest
from inbox.models.session import session_scope
from client import InboxTestClient
from conftest import (timeout_loop, credentials, create_account, API_BASE)
@timeout_loop('sync_start')
def wait_for_sync_start(client):
return True if client.messages.first() else False
@timeout_loop('auth')
def wai... | import pytest
from inbox.models.session import session_scope
from client import InboxTestClient
from conftest import (timeout_loop, credentials, create_account, API_BASE)
from accounts import broken_credentials
@timeout_loop('sync_start')
def wait_for_sync_start(client):
return True if client.messages.first() el... | Add a system test to check for expected broken accounts | Add a system test to check for expected broken accounts
Summary:
This is the system test for D765 and finishes up the sync engine side
of T495 - checking for All Mail folder and failing gracefully if it's
absent.
This test specifically adds another check in `test_auth` based on a
new list of live, bad credentials in ... | Python | agpl-3.0 | gale320/sync-engine,Eagles2F/sync-engine,wakermahmud/sync-engine,nylas/sync-engine,ErinCall/sync-engine,wakermahmud/sync-engine,EthanBlackburn/sync-engine,closeio/nylas,jobscore/sync-engine,jobscore/sync-engine,Eagles2F/sync-engine,wakermahmud/sync-engine,closeio/nylas,nylas/sync-engine,EthanBlackburn/sync-engine,waker... | ---
+++
@@ -3,6 +3,7 @@
from inbox.models.session import session_scope
from client import InboxTestClient
from conftest import (timeout_loop, credentials, create_account, API_BASE)
+from accounts import broken_credentials
@timeout_loop('sync_start')
@@ -33,3 +34,24 @@
# wait for sync to start. tests rely... |
8d9b163b73da8c498793cce2f22f6a7cbe524d94 | bucketcache/__init__.py | bucketcache/__init__.py | from __future__ import absolute_import, division, print_function
from .backends import *
from .buckets import *
from .config import *
from .exceptions import *
from .keymakers import *
from .log import logger, logger_config
from .utilities import *
__all__ = (backends.__all__ + buckets.__all__ + config.__all__ +
... | from __future__ import absolute_import, division, print_function
from .backends import *
from .buckets import *
from .config import *
from .exceptions import *
from .keymakers import *
from .log import logger, logger_config
from .utilities import *
__all__ = (backends.__all__ + buckets.__all__ + config.__all__ +
... | BUmp version number to 0.12.1 | BUmp version number to 0.12.1
| Python | mit | RazerM/bucketcache | ---
+++
@@ -12,6 +12,6 @@
exceptions.__all__ + keymakers.__all__ + utilities.__all__)
__author__ = 'Frazer McLean <frazer@frazermclean.co.uk>'
-__version__ = '0.12.0'
+__version__ = '0.12.1'
__license__ = 'MIT'
__description__ = 'Versatile persisent file cache.' |
b777c8268ec661539f868937478c3bbc204f2fb3 | tests/test_RI_response.py | tests/test_RI_response.py | from addons import *
from utils import *
tdir = 'Response-Theory'
def test_beta(workspace):
exe_py(workspace, tdir, 'Self-Consistent-Field/beta')
def test_CPHF(workspace):
exe_py(workspace, tdir, 'Self-Consistent-Field/CPHF')
def test_helper_CPHF(workspace):
exe_py(workspace, tdir, 'Self-Consistent-... | from addons import *
from utils import *
tdir = 'Response-Theory'
def test_beta(workspace):
exe_py(workspace, tdir, 'Self-Consistent-Field/beta')
def test_CPHF(workspace):
exe_py(workspace, tdir, 'Self-Consistent-Field/CPHF')
def test_helper_CPHF(workspace):
exe_py(workspace, tdir, 'Self-Consistent-... | Use integral derivative decorator for test | Use integral derivative decorator for test
| Python | bsd-3-clause | dsirianni/psi4numpy,psi4/psi4numpy | ---
+++
@@ -21,6 +21,7 @@
exe_py(workspace, tdir, 'Self-Consistent-Field/TDHF')
+@using_psi4_python_integral_deriv
def test_vcd(workspace):
exe_py(workspace, tdir, 'Self-Consistent-Field/vcd')
|
f5227b573588f6258b22c15583dc1d0ee259a9db | aiopg/__init__.py | aiopg/__init__.py | import re
import sys
from collections import namedtuple
from .connection import connect, Connection, TIMEOUT as DEFAULT_TIMEOUT
from .cursor import Cursor
from .pool import create_pool, Pool
__all__ = ('connect', 'create_pool', 'Connection', 'Cursor', 'Pool',
'version', 'version_info', 'DEFAULT_TIMEOUT')
... | import re
import sys
from collections import namedtuple
from .connection import connect, Connection, TIMEOUT as DEFAULT_TIMEOUT
from .cursor import Cursor
from .pool import create_pool, Pool
__all__ = ('connect', 'create_pool', 'Connection', 'Cursor', 'Pool',
'version', 'version_info', 'DEFAULT_TIMEOUT')
... | Make version format PEP 440 compatible | Make version format PEP 440 compatible
| Python | bsd-2-clause | nerandell/aiopg,hyzhak/aiopg,luhn/aiopg,aio-libs/aiopg,eirnym/aiopg,graingert/aiopg | ---
+++
@@ -27,7 +27,7 @@
major = int(match.group('major'))
minor = int(match.group('minor'))
micro = int(match.group('micro'))
- levels = {'rc': 'candidate',
+ levels = {'c': 'candidate',
'a': 'alpha',
'b': 'beta',
None... |
78cfcc7520bc2b2006f22ac4ef4fb432770c835c | bootstrap.py | bootstrap.py | #!/usr/bin/env python
"""
Bootstrap and serve your application. This file also serves to not make your
application completely reliant upon DotCloud's hosting service.
If you're in a development environment, envoke the script with:
$ python bootstrap.py
In a production environment, your application can be run wit... | #!/usr/bin/env python
"""
Bootstrap and serve your application. This file also serves to not make your
application completely reliant upon DotCloud's hosting service.
If you're in a development environment, envoke the script with:
$ python bootstrap.py
In a production environment, your application can be run wit... | Allow Flask to get port from heroku environment | Allow Flask to get port from heroku environment
| Python | mit | Leonnash21/flask_heroku,Leonnash21/flask_heroku,QueryControl/querycontrol,Leonnash21/flask_heroku,bryanyang0528/ubike_api,pmrowla/goonbcs,QueryControl/querycontrol,Leonnash21/flask_heroku,bryanyang0528/ubike_api,Leonnash21/flask_heroku,pmrowla/goonbcs,QueryControl/querycontrol,bryanyang0528/ubike_api | ---
+++
@@ -13,6 +13,7 @@
"""
+import os
import argparse
from app import create_app
@@ -34,8 +35,9 @@
app = create_app()
if gevent_environment:
from gevent.wsgi import WSGIServer
- # The port should probably be set to 80.
- http_server = WSGIServer(('', 5000), app)
+ #... |
429ffd7f41dda00f662167f179aea73b7d018807 | pi_setup/system.py | pi_setup/system.py | #!/usr/bin/env python
import subprocess
def main():
subprocess.call(["apt-get", "update"])
subprocess.call(["apt-get", "-y", "upgrade"])
subprocess.call(["apt-get", "-y", "install", "python-dev"])
subprocess.call(["apt-get", "-y", "install", "python-pip"])
subprocess.call(["apt-get", "-y", "instal... | #!/usr/bin/env python
import subprocess
from utils.installation import OptionalInstall
def main():
subprocess.call(["apt-get", "update"])
subprocess.call(["apt-get", "-y", "upgrade"])
subprocess.call(["apt-get", "-y", "install", "python-dev"])
subprocess.call(["apt-get", "-y", "install", "python-pip"]... | Make upstart an optional install | Make upstart an optional install
| Python | mit | projectweekend/Pi-Setup,projectweekend/Pi-Setup | ---
+++
@@ -1,5 +1,6 @@
#!/usr/bin/env python
import subprocess
+from utils.installation import OptionalInstall
def main():
@@ -10,6 +11,17 @@
subprocess.call(["apt-get", "-y", "install", "avahi-daemon"])
subprocess.call(["apt-get", "-y", "install", "rpi-update"])
subprocess.call(["pip", "instal... |
6d6394dd9917bdc97988818d7eb358b7d92d53c4 | pythonforandroid/recipes/android/src/setup.py | pythonforandroid/recipes/android/src/setup.py | from distutils.core import setup, Extension
import os
library_dirs = ['libs/' + os.environ['ARCH']]
lib_dict = {
'pygame': ['sdl'],
'sdl2': ['SDL2', 'SDL2_image', 'SDL2_mixer', 'SDL2_ttf']
}
sdl_libs = lib_dict[os.environ['BOOTSTRAP']]
renpy_sound = Extension('android._android_sound',
... | from distutils.core import setup, Extension
import os
library_dirs = ['libs/' + os.environ['ARCH']]
lib_dict = {
'pygame': ['sdl'],
'sdl2': ['SDL2', 'SDL2_image', 'SDL2_mixer', 'SDL2_ttf']
}
sdl_libs = lib_dict.get(os.environ['BOOTSTRAP'], [])
renpy_sound = Extension('android._android_sound',
... | Fix compile error of recipe "android" for non-sdl bootstrap build | Fix compile error of recipe "android" for non-sdl bootstrap build
| Python | mit | rnixx/python-for-android,kronenpj/python-for-android,rnixx/python-for-android,PKRoma/python-for-android,kronenpj/python-for-android,kronenpj/python-for-android,rnixx/python-for-android,kivy/python-for-android,PKRoma/python-for-android,PKRoma/python-for-android,rnixx/python-for-android,kivy/python-for-android,rnixx/pyth... | ---
+++
@@ -6,7 +6,7 @@
'pygame': ['sdl'],
'sdl2': ['SDL2', 'SDL2_image', 'SDL2_mixer', 'SDL2_ttf']
}
-sdl_libs = lib_dict[os.environ['BOOTSTRAP']]
+sdl_libs = lib_dict.get(os.environ['BOOTSTRAP'], [])
renpy_sound = Extension('android._android_sound',
['android/_android_sound.c'... |
b6ab579fa65f816704142716fbd68645ac5f2ff8 | zenaida/contrib/feedback/models.py | zenaida/contrib/feedback/models.py | from django.conf import settings
from django.db import models
class FeedbackItem(models.Model):
timestamp = models.DateTimeField(auto_now_add=True)
user = models.ForeignKey(settings.AUTH_USER_MODEL)
resolved = models.BooleanField(default=False)
content = models.TextField()
screenshot = models.File... | from django.conf import settings
from django.db import models
class FeedbackItem(models.Model):
timestamp = models.DateTimeField(auto_now_add=True)
user = models.ForeignKey(settings.AUTH_USER_MODEL)
resolved = models.BooleanField(default=False)
content = models.TextField()
screenshot = models.File... | Order feedback items by their timestamp. | Order feedback items by their timestamp.
| Python | bsd-3-clause | littleweaver/django-zenaida,littleweaver/django-zenaida,littleweaver/django-zenaida,littleweaver/django-zenaida | ---
+++
@@ -30,3 +30,6 @@
username=self.user.get_full_name(),
path = self.request_path
)
+
+ class Meta:
+ ordering = ["-timestamp"] |
9ac802f89f8c00dc3f0c4534d234c1dd1dc7a203 | c3py/chart_component.py | c3py/chart_component.py | class ChartComponent(object):
def __init__(self):
self.config = {}
def __string_wrap__(self, string_to_wrap):
return "'" + string_to_wrap + "'"
class ChartComponentDict(ChartComponent):
def __init__(self):
super(ChartComponentDict, self).__init__()
class ChartCompon... | class ChartComponent(object):
def __init__(self):
self.config = {}
def __string_wrap__(self, string_to_wrap):
return "'" + str(string_to_wrap) + "'"
class ChartComponentDict(ChartComponent):
def __init__(self):
super(ChartComponentDict, self).__init__()
class ChartC... | Enforce string before wrapping in quotation marks | Enforce string before wrapping in quotation marks
| Python | mit | h0s/c3py,harshil-shah/c3py,harshil-shah/c3py,h0s/c3py | ---
+++
@@ -6,7 +6,7 @@
def __string_wrap__(self, string_to_wrap):
- return "'" + string_to_wrap + "'"
+ return "'" + str(string_to_wrap) + "'"
class ChartComponentDict(ChartComponent): |
fccf1d6562e8d5e1349d1f0826993ec799a5fc07 | app/timetables/tests/test_models.py | app/timetables/tests/test_models.py | from django.test import TestCase
from django.db import IntegrityError
from app.timetables.models import Weekday, Meal
class WeekdayTest(TestCase):
"""Tests the Weekday model."""
def setUp(self):
Weekday.objects.create(name='monday')
def test_weekday_name_should_be_capitalized_on_save(self):
... | from datetime import datetime
from django.test import TestCase
from django.db import IntegrityError
from app.timetables.models import Weekday, Meal
class WeekdayTest(TestCase):
"""Tests the Weekday model."""
def setUp(self):
Weekday.objects.create(name='monday')
def test_weekday_name_should_be... | Use time object for model test | Use time object for model test
| Python | mit | teamtaverna/core | ---
+++
@@ -1,3 +1,5 @@
+from datetime import datetime
+
from django.test import TestCase
from django.db import IntegrityError
@@ -26,7 +28,9 @@
def setUp(self):
Meal.objects.create(
- name='breakfast', start_time='21:30:05', end_time='22:30:05'
+ name='breakfast',
+ ... |
3be244ab1d7b03648350356dd3d9b6025516def5 | capstone/rl/tabularf.py | capstone/rl/tabularf.py | import random
class TabularF(dict):
'''
Tabular representation for any of the two types of value functions:
1. state value function (V-Functions).
e.g.
vf = TabularF()
vf[state] = 1
2. state-action value functions (Q-functions)
e.g.
qf = TabularF()
qf[(state... | import random
_MEAN = 0.0
_STD = 0.3
class TabularF(dict):
'''
Tabular representation for any of the two types of value functions:
1. state value function (V-Functions).
e.g.
vf = TabularF()
vf[state] = 1
2. state-action value functions (Q-functions)
e.g.
qf = Tabu... | Initialize values using a gaussian distribution with mean = 0 and std = 0.3 | Initialize values using a gaussian distribution with mean = 0 and std = 0.3
| Python | mit | davidrobles/mlnd-capstone-code | ---
+++
@@ -1,5 +1,7 @@
import random
+_MEAN = 0.0
+_STD = 0.3
class TabularF(dict):
'''
@@ -19,5 +21,5 @@
def __getitem__(self, key):
if key not in self:
- self[key] = random.random() - 0.5
+ self[key] = random.gauss(_MEAN, _STD)
return super(TabularF, self).... |
a6ac83978cfab99fbe1e2fc9715a0cdea3d7b472 | coss/urls.py | coss/urls.py | from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtailcore import urls as wagtail_urls
from wagtail.wagtaildocs import urls as w... | from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtailcore import urls as wagtail_urls
from wagtail.wagtaildocs import urls as w... | Move CMS admin panel to /cms. | Move CMS admin panel to /cms.
| Python | mpl-2.0 | akatsoulas/coss,akatsoulas/coss,akatsoulas/coss,akatsoulas/coss | ---
+++
@@ -11,9 +11,9 @@
from coss.search import views as search_views
urlpatterns = [
- url(r'^django-admin/', include(admin.site.urls)),
+ url(r'^admin/', include(admin.site.urls)),
- url(r'^admin/', include(wagtailadmin_urls)),
+ url(r'^cms-admin/', include(wagtailadmin_urls)),
url(r'^docum... |
11cf68b017f1feccc27fcfacea2c67aafc8e682d | tools/contributer_list.py | tools/contributer_list.py | #!/usr/bin/env python
"""Print a list of contributors for a particular milestone.
Usage:
python tools/contributor_list.py MILESTONE
"""
import sys
from gh_api import (
get_milestone_id,
get_issues_list,
)
if __name__ == "__main__":
if len(sys.argv) != 2:
print(__doc__)
sys.exit(1)
... | #!/usr/bin/env python
"""Print a list of contributors for a particular milestone.
Usage:
python tools/contributor_list.py [MILESTONE] [MILESTONE] ...
"""
import sys
from gh_api import (
get_milestones,
get_milestone_id,
get_issues_list,
)
if __name__ == "__main__":
if len(sys.argv) < 2:
... | Include multiple milestones and open issues in contributor list | Include multiple milestones and open issues in contributor list [ci skip]
| Python | bsd-3-clause | jhamrick/nbgrader,jhamrick/nbgrader,jupyter/nbgrader,jhamrick/nbgrader,jhamrick/nbgrader,jupyter/nbgrader,jupyter/nbgrader,jupyter/nbgrader,jupyter/nbgrader | ---
+++
@@ -3,44 +3,45 @@
Usage:
- python tools/contributor_list.py MILESTONE
+ python tools/contributor_list.py [MILESTONE] [MILESTONE] ...
"""
import sys
from gh_api import (
+ get_milestones,
get_milestone_id,
get_issues_list,
)
if __name__ == "__main__":
- if len(sys.argv) ... |
3b22d14a3f20159d2f334002738d4e7fcfa7b09c | bitHopper/Tracking/getwork_store.py | bitHopper/Tracking/getwork_store.py | #Copyright (C) 2011,2012 Colin Rice
#This software is licensed under an included MIT license.
#See the file entitled LICENSE
#If you were not provided with a copy of the license please contact:
# Colin Rice colin@daedrum.net
import gevent, time, logging
class Getwork_Store:
"""
Class that stores getworks so ... | #Copyright (C) 2011,2012 Colin Rice
#This software is licensed under an included MIT license.
#See the file entitled LICENSE
#If you were not provided with a copy of the license please contact:
# Colin Rice colin@daedrum.net
import gevent, time, logging
class Getwork_Store:
"""
Class that stores getworks so w... | Store merkle roots for 10 minutes | Store merkle roots for 10 minutes
| Python | mit | c00w/bitHopper,c00w/bitHopper | ---
+++
@@ -1,7 +1,7 @@
#Copyright (C) 2011,2012 Colin Rice
#This software is licensed under an included MIT license.
#See the file entitled LICENSE
-#If you were not provided with a copy of the license please contact:
+#If you were not provided with a copy of the license please contact:
# Colin Rice colin@daedr... |
94b37ba0abacbff53da342574b61c87810f6a5d4 | bulletin/tools/plugins/forms/job.py | bulletin/tools/plugins/forms/job.py | from datetimewidget.widgets import DateTimeWidget
from django.forms import ModelForm
from form_utils.widgets import ImageWidget
from ..models import Job
job_field_labels = {
'image': 'Image (10Mb Limit)',
'url': 'URL'
}
job_help_texts = {
'url': 'Provide a full url, e.g., "http://www.example.com/page.htm... | from datetimewidget.widgets import DateTimeWidget
from django.forms import ModelForm
from form_utils.widgets import ImageWidget
from ..models import Job
job_field_labels = {
'image': 'Image (10Mb Limit)',
'url': 'URL'
}
job_help_texts = {
'url': 'Provide a full url, e.g., "http://www.example.com/page.htm... | Make image required on Job submit form. | Make image required on Job submit form.
| Python | mit | AASHE/django-bulletin,AASHE/django-bulletin,AASHE/django-bulletin | ---
+++
@@ -13,6 +13,10 @@
'url': 'Provide a full url, e.g., "http://www.example.com/page.html"'
}
+field_widgets = {
+ 'image': ImageWidget(attrs={'required': 'required'})
+}
+
class JobSubmitForm(ModelForm):
@@ -22,11 +26,9 @@
'url',
'organization',
... |
7a4a3d76f89c14426191a6f0c4dfe09371416a0e | lib/pegasus/python/Pegasus/__init__.py | lib/pegasus/python/Pegasus/__init__.py | # Copyright 2009 University Of Southern California
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | # Copyright 2009 University Of Southern California
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | Add TRACE level to Pegasus logging | Add TRACE level to Pegasus logging
| Python | apache-2.0 | pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus | ---
+++
@@ -11,3 +11,28 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+import logging
+
+class Logger(logging.getLoggerClass()):
+ "A custom logger for Pegasus with TRACE lev... |
9a4ea40b2eb164f8c18e9812c27aa430c3c27772 | api/serializers.py | api/serializers.py | from django.contrib.auth.models import User
from rest_framework import serializers
from api.models import UserPreferences
class UserPreferencesSummarySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = UserPreferences
fields = (
'id',
'url'
)
... | from django.contrib.auth.models import User
from rest_framework import serializers
from api.models import UserPreferences
class UserPreferencesSummarySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = UserPreferences
fields = (
'id',
'url'
)
... | Include new airport_ui preference in serializer for view | Include new airport_ui preference in serializer for view
| Python | apache-2.0 | CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend | ---
+++
@@ -52,8 +52,9 @@
fields = (
'id',
'url',
+ 'user',
'show_beta_interface',
- 'user',
+ 'airport_ui',
'created_date',
'modified_date'
) |
1dac2942eb9a15517392eebc9aa96dcb658ebfee | src/passgen.py | src/passgen.py | import string
import random
import argparse
def passgen(length=12):
"""Generate a strong password with *length* characters"""
pool = string.ascii_uppercase + string.ascii_lowercase + string.digits
return ''.join(random.SystemRandom().choice(pool) for _ in range(length))
def main():
parser = argparse... | import string
import random
import argparse
def passgen(length=12):
"""Generate a strong password with *length* characters"""
pool = string.ascii_uppercase + string.ascii_lowercase + string.digits
# Using technique from Stack Overflow answer
# http://stackoverflow.com/a/23728630
chars = [random.S... | Make it more clear how password is generated | Make it more clear how password is generated
| Python | mit | soslan/passgen | ---
+++
@@ -6,7 +6,11 @@
def passgen(length=12):
"""Generate a strong password with *length* characters"""
pool = string.ascii_uppercase + string.ascii_lowercase + string.digits
- return ''.join(random.SystemRandom().choice(pool) for _ in range(length))
+
+ # Using technique from Stack Overflow answe... |
0c22486320b064c078fe009faf41e2d0c7f5e272 | passwordless/views.py | passwordless/views.py | from django.shortcuts import render
from django.views.generic.edit import FormView
from . import forms
# Create your views here.
def logout(request):
return render(request, 'passwordless/logout.html')
def authn(request, token):
return render(request, 'passwordless/authn.html')
class LoginView(FormView):
... | from django.shortcuts import render
from django.views.generic.edit import FormView
from . import forms
# Create your views here.
def logout(request):
return render(request, 'passwordless/logout.html')
def authn(request, token):
return render(request, 'passwordless/authn.html')
class LoginView(FormView):
... | Refactor RegisterView as subclass of LoginView | Refactor RegisterView as subclass of LoginView
They share much of the work, they should share the code as well
| Python | mit | Kromey/fbxnano,Kromey/akwriters,Kromey/fbxnano,Kromey/akwriters,Kromey/akwriters,Kromey/fbxnano,Kromey/fbxnano,Kromey/akwriters | ---
+++
@@ -23,14 +23,12 @@
return super().form_valid(form)
-class RegisterView(FormView):
+class RegisterView(LoginView):
template_name = 'passwordless/register.html'
form_class = forms.RegistrationForm
- success_url = '/'
def form_valid(self, form):
form.create_user()
- ... |
1d5b3630d372d763ad445b969eaad97fd569db52 | examples/cross_thread.py | examples/cross_thread.py | #!/usr/bin/python
"""
Example of an Eliot action context spanning multiple threads.
"""
from threading import Thread
from sys import stdout
from eliot import to_file, preserve_context, start_action
to_file(stdout)
def add_in_thread(x, y):
with start_action(action_type="in_thread", x=x, y=y) as context:
... | #!/usr/bin/env python
"""
Example of an Eliot action context spanning multiple threads.
"""
from __future__ import unicode_literals
from threading import Thread
from sys import stdout
from eliot import to_file, preserve_context, start_action
to_file(stdout)
def add_in_thread(x, y):
with start_action(action_ty... | Fix hashbang, add future import. | Fix hashbang, add future import.
| Python | apache-2.0 | ScatterHQ/eliot,ScatterHQ/eliot,ScatterHQ/eliot,ClusterHQ/eliot | ---
+++
@@ -1,8 +1,10 @@
-#!/usr/bin/python
+#!/usr/bin/env python
"""
Example of an Eliot action context spanning multiple threads.
"""
+
+from __future__ import unicode_literals
from threading import Thread
from sys import stdout |
0f844e44f0b1b8873aa777becf7e7a8fcc48483b | virtool/indexes/models.py | virtool/indexes/models.py | import enum
from sqlalchemy import Column, Integer, String, Enum
from virtool.pg.utils import Base, SQLEnum
class IndexType(str, SQLEnum):
"""
Enumerated type for index file types
"""
json = "json"
fasta = "fasta"
bowtie2 = "bowtie2"
class IndexFile(Base):
"""
SQL model to store n... | import enum
from sqlalchemy import Column, Integer, String, Enum
from virtool.pg.utils import Base, SQLEnum
class IndexType(str, SQLEnum):
"""
Enumerated type for index file types
"""
json = "json"
fasta = "fasta"
bowtie2 = "bowtie2"
class IndexFile(Base):
"""
SQL model to store n... | Make 'name' and 'index' columns non-nullable for IndexFile model | Make 'name' and 'index' columns non-nullable for IndexFile model
| Python | mit | virtool/virtool,virtool/virtool,igboyes/virtool,igboyes/virtool | ---
+++
@@ -23,8 +23,8 @@
__tablename__ = "index_files"
id = Column(Integer, primary_key=True)
- name = Column(String)
- index = Column(String)
+ name = Column(String, nullable=False)
+ index = Column(String, nullable=False)
type = Column(Enum(IndexType))
size = Column(Integer)
|
e01571fb8c29b78f16c34bfcd2d806b183224047 | opps/containers/forms.py | opps/containers/forms.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from django.conf import settings
from opps.db.models.fields.jsonf import JSONFormField
from opps.fields.widgets import JSONField
from opps.fields.models import Field, FieldOption
class ContainerAdminForm(forms.ModelForm):
def __init__(self, *... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from django.conf import settings
from opps.db.models.fields.jsonf import JSONFormField
from opps.fields.widgets import JSONField
from opps.fields.models import Field, FieldOption
class ContainerAdminForm(forms.ModelForm):
def __init__(self, *... | Fix mirror_channel widget on OPPS_MIRROR_CHANNEL false | Fix mirror_channel widget on OPPS_MIRROR_CHANNEL false
| Python | mit | opps/opps,YACOWS/opps,YACOWS/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,opps/opps,williamroot/opps,opps/opps,jeanmask/opps,opps/opps,jeanmask/opps,williamroot/opps | ---
+++
@@ -11,6 +11,9 @@
class ContainerAdminForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(ContainerAdminForm, self).__init__(*args, **kwargs)
+
+ if not settings.OPPS_MIRROR_CHANNEL:
+ self.fields['mirror_channel'].widget = forms.HiddenInput()
self.fie... |
9ada81a111c0b5c8d523bbb532a7be3873f603fe | __init__.py | __init__.py | from flask import Flask, request, redirect
import twilio.twiml
app = Flask(__name__)
@app.route("/", methods=['GET', 'POST'])
def hello():
""" Respond to incoming calls with a SMS """
body = request.values.get('Body', None)
resp = twilio.twiml.Response()
if body == '#bff':
resp.message('#a... | from flask import Flask, request, redirect
import twilio.twiml
app = Flask(__name__)
@app.route("/", methods=['GET', 'POST'])
def hello():
""" Respond to incoming calls with a SMS """
body = request.values.get('Body', None)
resp = twilio.twiml.Response()
if body == '#bff':
resp.message('#a... | Add more conversation into the mix. | Add more conversation into the mix.
| Python | mit | patrickbeeson/text-me | ---
+++
@@ -15,6 +15,18 @@
if body == '#bff':
resp.message('#awesome')
resp.message("What's your name?")
+ user_name = request.values.get('Body', None)
+ resp.message("It's great to meet you {name}!".format(name=user_name))
+ resp.message("Wanna set up a play date?")
+ ... |
d672cbc84ced1af4f7e5f0cf97c5d087a477717c | tools/sharding_supervisor/sharding_supervisor.py | tools/sharding_supervisor/sharding_supervisor.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.
from sharding_supervisor_old import * # pylint: disable=W0401,W0614
if __name__ == "__main__":
sys.exit(main())
| #!/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.
"""Defer to run_test_cases.py."""
import os
import optparse
import sys
ROOT_DIR = os.path.dirname(
os.path.dirname(os.path.di... | Switch over to run_test_cases.py, take 2. | Switch over to run_test_cases.py, take 2.
Instead of doing a "Revert r168479 'Revert r168478'", it's using a simpler version based on renaming sharding_supervisor first.
Try to enable run_test_cases.py again.
R=phajdan.jr@chromium.org
BUG=164886
Review URL: https://codereview.chromium.org/11472024
git-svn-id: de01... | Python | bsd-3-clause | markYoungH/chromium.src,mohamed--abdel-maksoud/chromium.src,dednal/chromium.src,anirudhSK/chromium,anirudhSK/chromium,Fireblend/chromium-crosswalk,mogoweb/chromium-crosswalk,hujiajie/pa-chromium,zcbenz/cefode-chromium,dushu1203/chromium.src,hujiajie/pa-chromium,dushu1203/chromium.src,M4sse/chromium.src,mogoweb/chromium... | ---
+++
@@ -3,8 +3,64 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-from sharding_supervisor_old import * # pylint: disable=W0401,W0614
+"""Defer to run_test_cases.py."""
+
+import os
+import optparse
+import sys
+
+ROOT_DIR = os.path.dirname(
+ os.p... |
7e70f6deb9e66a43c37241bc4e86ec2f85d81b4a | api/radar_api/serializers/sources.py | api/radar_api/serializers/sources.py | from radar_api.serializers.groups import GroupReferenceField
from radar_api.serializers.source_types import SourceTypeReferenceField
class SourceGroupSerializerMixin(object):
source_group = GroupReferenceField()
source_type = SourceTypeReferenceField()
def get_model_exclude(self):
attrs = super(S... | from radar_api.serializers.groups import TinyGroupReferenceField
from radar_api.serializers.source_types import SourceTypeReferenceField
class SourceGroupSerializerMixin(object):
source_group = TinyGroupReferenceField()
source_type = SourceTypeReferenceField()
def get_model_exclude(self):
attrs =... | Use tiny serializer for source group | Use tiny serializer for source group
| Python | agpl-3.0 | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | ---
+++
@@ -1,9 +1,9 @@
-from radar_api.serializers.groups import GroupReferenceField
+from radar_api.serializers.groups import TinyGroupReferenceField
from radar_api.serializers.source_types import SourceTypeReferenceField
class SourceGroupSerializerMixin(object):
- source_group = GroupReferenceField()
+ ... |
a42997458baa1c6a1648896ff50f44e79525f8a1 | ognskylines/commands/devices/insert.py | ognskylines/commands/devices/insert.py | from ognskylines.dbutils import session
from ognskylines.model import Device
from ogn.utils import get_ddb, get_trackable
from manager import Manager
manager = Manager()
@manager.command
def import_ddb():
"""Import registered devices from the DDB (discards all devices before import)."""
session.query(Device... | from ognskylines.dbutils import session
from ognskylines.model import Device
import requests
from manager import Manager
manager = Manager()
DDB_URL = "http://ddb.glidernet.org/download/?j=1"
def get_ddb():
devices = requests.get(DDB_URL).json()
for device in devices['devices']:
device.update({'ide... | Add function to fetch devices from the DDB | Add function to fetch devices from the DDB
| Python | agpl-3.0 | kerel-fs/ogn-skylines-gateway,kerel-fs/ogn-skylines-gateway | ---
+++
@@ -1,10 +1,20 @@
from ognskylines.dbutils import session
from ognskylines.model import Device
-from ogn.utils import get_ddb, get_trackable
-
+import requests
from manager import Manager
manager = Manager()
+
+
+DDB_URL = "http://ddb.glidernet.org/download/?j=1"
+
+
+def get_ddb():
+ devices = reque... |
0ac3ab3278e81aebe4717e0f599f752b4fda06d3 | examples/swat-s1/tests.py | examples/swat-s1/tests.py | """
swat-s1 tests.
"""
# from mininet.cli import CLI
from mininet.net import Mininet
from nose.plugins.skip import SkipTest
from utils import STATE, RWT_INIT_LEVEL
from utils import TANK_SECTION
from topo import SwatTopo
from physical_process import RawWaterTank
# import subprocess
# import sys
@SkipTest
def tes... | """
swat-s1 tests.
"""
# from mininet.cli import CLI
from mininet.net import Mininet
from utils import STATE, RWT_INIT_LEVEL
from utils import TANK_SECTION
from topo import SwatTopo
from physical_process import RawWaterTank
# import subprocess
# import sys
def test_init():
pass
def test_topo():
topo =... | Remove examples dep from nose | Remove examples dep from nose
| Python | mit | remmihsorp/minicps,scy-phy/minicps,remmihsorp/minicps,scy-phy/minicps | ---
+++
@@ -4,8 +4,6 @@
# from mininet.cli import CLI
from mininet.net import Mininet
-
-from nose.plugins.skip import SkipTest
from utils import STATE, RWT_INIT_LEVEL
from utils import TANK_SECTION
@@ -17,7 +15,6 @@
# import sys
-@SkipTest
def test_init():
pass |
d5ed26ebbd84ed16d8d39607ef138581aa3b9d75 | osf/migrations/0145_add_preprint_contenttype_to_collections.py | osf/migrations/0145_add_preprint_contenttype_to_collections.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-08 16:56
from __future__ import unicode_literals
from django.db import migrations
from osf.models import Collection
from django.contrib.contenttypes.models import ContentType
def reverse_func(state, schema):
preprint_content_type = ContentType.obje... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-08 16:56
from __future__ import unicode_literals
from django.db import migrations
from osf.models import Collection
from django.contrib.contenttypes.models import ContentType
def reverse_func(state, schema):
preprint_content_type = ContentType.obje... | Use the Collection.collected_types through table to bulk add preprints as a valid collected_type for existing collections. | Use the Collection.collected_types through table to bulk add preprints as a valid collected_type for existing collections.
- Use the Collection - collected_types through table to remove preprints from collected_types.
| Python | apache-2.0 | CenterForOpenScience/osf.io,Johnetordoff/osf.io,pattisdr/osf.io,adlius/osf.io,baylee-d/osf.io,brianjgeiger/osf.io,felliott/osf.io,mattclark/osf.io,mfraezz/osf.io,felliott/osf.io,aaxelb/osf.io,brianjgeiger/osf.io,mfraezz/osf.io,CenterForOpenScience/osf.io,brianjgeiger/osf.io,mfraezz/osf.io,CenterForOpenScience/osf.io,aa... | ---
+++
@@ -9,16 +9,20 @@
def reverse_func(state, schema):
preprint_content_type = ContentType.objects.get(app_label='osf', model='preprint')
- collections = Collection.objects.filter(collected_types__in=[preprint_content_type.id])
- for collection in collections:
- collection.collected_types.rem... |
68b86aff3c9004b12dbd05cd1861229e73883e38 | quickstart/python/understand/example-2/create_joke_task.6.x.py | quickstart/python/understand/example-2/create_joke_task.6.x.py | # Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)
# Create a new task named 't... | # Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)
# Provide actions for the ne... | Update to include actions in Create | Update to include actions in Create | Python | mit | TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets | ---
+++
@@ -6,13 +6,6 @@
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)
-# Create a new task named 'tell_a_joke'
-# Replace 'UAXXX...' with your Assistant's unique SID https://www.twilio.com/console/autopilot/list
-task = client.preview.understand \
- .assistants('UA... |
4349e65c1c353f8808e139c57439a3dfe2e2846e | armstrong/core/arm_sections/views.py | armstrong/core/arm_sections/views.py | from django.core.urlresolvers import reverse
from django.views.generic import DetailView
from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404
from .models import Section
class SimpleSectionView(DetailView):
context_object_name = 'section'
model = Section
def g... | from django.core.urlresolvers import reverse
from django.views.generic import DetailView
from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404
from .models import Section
class SimpleSectionView(DetailView):
context_object_name = 'section'
model = Section
def g... | Call get_section from get_object for backwards compatibility | Call get_section from get_object for backwards compatibility | Python | apache-2.0 | texastribune/armstrong.core.tt_sections,armstrong/armstrong.core.arm_sections,texastribune/armstrong.core.tt_sections,texastribune/armstrong.core.tt_sections,armstrong/armstrong.core.arm_sections | ---
+++
@@ -10,7 +10,10 @@
context_object_name = 'section'
model = Section
- def get_object(self, queryset=None):
+ def get_object(self):
+ return self.get_section()
+
+ def get_section(self):
return get_object_or_404(self.get_queryset(),
full_slu... |
7e0030eb22671897a80633d57056ba0f26f15a77 | src/coordinators/models.py | src/coordinators/models.py | from __future__ import unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from locations.models import District
class Coordinator(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
is_manage... | from __future__ import unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from locations.models import District
class Coordinator(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
is_manage... | Make filter_by_district more strict - don't show anything to unconfigured users | Make filter_by_district more strict - don't show anything to unconfigured users
| Python | mit | mrts/foodbank-campaign,mrts/foodbank-campaign,mrts/foodbank-campaign,mrts/foodbank-campaign | ---
+++
@@ -13,10 +13,13 @@
blank=True, null=True)
def filter_by_district(qs, user, lookup):
+ # superusers and managers see everything
if (user.is_superuser
- or not hasattr(user, 'coordinator')
- or user.coordinator.is_manager):
+ or hasattr(user, 'coordinato... |
347038c528b07f2553f09daab6915828ab2a6113 | tests/__init__.py | tests/__init__.py | # -*- coding: utf-8 -*-
# Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com>
#
# This file is part of subliminal.
#
# subliminal is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 3 of... | # -*- coding: utf-8 -*-
# Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com>
#
# This file is part of subliminal.
#
# subliminal is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 3 of... | Add test_videos to the main test suite | Add test_videos to the main test suite
| Python | mit | oxan/subliminal,t4lwh/subliminal,h3llrais3r/subliminal,getzze/subliminal,bogdal/subliminal,hpsbranco/subliminal,ravselj/subliminal,nvbn/subliminal,fernandog/subliminal,goll/subliminal,ratoaq2/subliminal,Elettronik/subliminal,neo1691/subliminal,juanmhidalgo/subliminal,SickRage/subliminal,Diaoul/subliminal,kbkailashbagar... | ---
+++
@@ -15,11 +15,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with subliminal. If not, see <http://www.gnu.org/licenses/>.
-from . import test_language, test_services, test_subliminal
+from . import test_language, test_services, test_subliminal, test_videos
impo... |
a18e29b492cefaac64b2bd217a897aff7ebd8466 | tests/__init__.py | tests/__init__.py | # tests.__init__
import os
import os.path
import shutil
import tempfile
import yvs.shared as yvs
temp_dir = tempfile.gettempdir()
yvs.LOCAL_DATA_DIR_PATH = os.path.join(temp_dir, 'yvs-data')
yvs.LOCAL_CACHE_DIR_PATH = os.path.join(temp_dir, 'yvs-cache')
def set_up():
try:
os.mkdir(yvs.LOCAL_DATA_DIR_PA... | # tests.__init__
import os
import os.path
import shutil
import tempfile
import yvs.shared as yvs
from mock import patch
temp_dir = tempfile.gettempdir()
local_data_dir_patcher = patch(
'yvs.shared.LOCAL_DATA_DIR_PATH',
os.path.join(temp_dir, 'yvs-data'))
local_cache_dir_patcher = patch(
'yvs.shared.LOCAL... | Use patchers for overriding data/cache directories | Use patchers for overriding data/cache directories
| Python | mit | caleb531/youversion-suggest,caleb531/youversion-suggest | ---
+++
@@ -5,18 +5,25 @@
import shutil
import tempfile
import yvs.shared as yvs
+from mock import patch
temp_dir = tempfile.gettempdir()
-yvs.LOCAL_DATA_DIR_PATH = os.path.join(temp_dir, 'yvs-data')
-yvs.LOCAL_CACHE_DIR_PATH = os.path.join(temp_dir, 'yvs-cache')
+local_data_dir_patcher = patch(
+ 'yvs.sha... |
341dcac3331a21c1b747075ab73601cb08d4868d | compliance_checker/tests/helpers.py | compliance_checker/tests/helpers.py | from netCDF4 import Dataset
import tempfile
class MockNetCDF(Dataset):
"""
Wrapper object around NetCDF Dataset to write data only to memory.
"""
def __init__(self):
# taken from test/tst_diskless.py NetCDF library
# even though we aren't persisting data to disk, the constructor
... | from netCDF4 import Dataset
import tempfile
class MockNetCDF(Dataset):
"""
Wrapper object around NetCDF Dataset to write data only to memory.
"""
def __init__(self):
# taken from test/tst_diskless.py NetCDF library
# even though we aren't persisting data to disk, the constructor
... | Add name and dimensions attributes to MockVariable class | Add name and dimensions attributes to MockVariable class
| Python | apache-2.0 | DanielJMaher/compliance-checker,aodn/compliance-checker,ioos/compliance-checker,lukecampbell/compliance-checker,ocefpaf/compliance-checker | ---
+++
@@ -37,5 +37,7 @@
def __init__(self, copy_var=None):
if copy_var is not None:
+ self.name = copy_var.name
+ self.dimensions = copy_var.dimensions
for att in copy_var.ncattrs():
setattr(self, att, getattr(copy_var, att)) |
70d2a1cd5363b0a40cc488e9f12eca59bb307a0e | pyamf/adapters/_django_contrib_auth_models.py | pyamf/adapters/_django_contrib_auth_models.py | """
"""
from django.contrib.auth import models
import pyamf.adapters
models.User.__amf__ = {
'exclude': ('message_set', 'password'),
'readonly': ('username',)
}
# ensure that the adapter that we depend on is loaded ..
pyamf.adapters.get_adapter('django.db.models.base')
pyamf.register_package(models, model... | """
"""
from django.contrib.auth import models
import pyamf.adapters
models.User.__amf__ = {
'exclude': ('message_set', 'password'),
'readonly': ('username',)
}
# ensure that the adapter that we depend on is loaded ..
pyamf.get_adapter('django.db.models.base')
pyamf.register_package(models, models.__name_... | Use the new get_adapter api | Use the new get_adapter api
| Python | mit | thijstriemstra/pyamf,hydralabs/pyamf,hydralabs/pyamf,thijstriemstra/pyamf | ---
+++
@@ -12,6 +12,6 @@
}
# ensure that the adapter that we depend on is loaded ..
-pyamf.adapters.get_adapter('django.db.models.base')
+pyamf.get_adapter('django.db.models.base')
pyamf.register_package(models, models.__name__) |
7aa341cc37f480717a3b2c42a20f44b5d174e0eb | create_sample.py | create_sample.py | # importing modules/ libraries
import pandas as pd
import random
import numpy as np
# create a sample of prior orders
orders_df = pd.read_csv("Data/orders.csv")
s = round(3214874 * 0.1)
i = sorted(random.sample(list(orders_df[orders_df["eval_set"]=="prior"].index), s))
orders_df.loc[i,:].to_csv("Data/orders_prior_samp... | # importing modules/ libraries
import pandas as pd
import random
import numpy as np
# create a sample of prior orders
orders_df = pd.read_csv("Data/orders.csv")
s = round(3214874 * 0.01)
i = sorted(random.sample(list(orders_df[orders_df["eval_set"]=="prior"].index), s))
orders_df.loc[i,:].to_csv("Data/orders_prior_sam... | Reduce sample size for faster processing | fix: Reduce sample size for faster processing
| Python | mit | rjegankumar/instacart_prediction_model | ---
+++
@@ -5,12 +5,12 @@
# create a sample of prior orders
orders_df = pd.read_csv("Data/orders.csv")
-s = round(3214874 * 0.1)
+s = round(3214874 * 0.01)
i = sorted(random.sample(list(orders_df[orders_df["eval_set"]=="prior"].index), s))
orders_df.loc[i,:].to_csv("Data/orders_prior_sample.csv", index = False)... |
316066b2415861b65d540b822df1b2afea906207 | regulations/management/commands/setup_cors.py | regulations/management/commands/setup_cors.py | import boto3
from django.conf import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Set CORS rules on the Notice and Comment attachment bucket'
def handle(self, *args, **options):
session = boto3.Session(
aws_access_key_id=settings.ATTACHM... | import boto3
from django.conf import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Set CORS rules on the Notice and Comment attachment bucket'
def handle(self, *args, **options):
hosts = settings.ALLOWED_HOSTS
origins = ['http://' + host for ... | Add protocol to hosts for CORS | Add protocol to hosts for CORS
| Python | cc0-1.0 | 18F/regulations-site,tadhg-ohiggins/regulations-site,eregs/regulations-site,18F/regulations-site,eregs/regulations-site,eregs/regulations-site,tadhg-ohiggins/regulations-site,tadhg-ohiggins/regulations-site,18F/regulations-site,eregs/regulations-site,18F/regulations-site,tadhg-ohiggins/regulations-site | ---
+++
@@ -7,18 +7,23 @@
help = 'Set CORS rules on the Notice and Comment attachment bucket'
def handle(self, *args, **options):
+ hosts = settings.ALLOWED_HOSTS
+ origins = ['http://' + host for host in hosts]
+ origins = origins + ['https://' + host for host in hosts]
+
se... |
cdfa65efbb9c97f060a51aa5613a2788c437e0a1 | pal/services/__init__.py | pal/services/__init__.py | from pal.services.bonapp_service import BonAppService
from pal.services.dictionary_service import DictionaryService
from pal.services.directory_service import DirectoryService
from pal.services.joke_service import JokeService
from pal.services.movie_service import MovieService
from pal.services.service import wrap_resp... | from pal.services.bonapp_service import BonAppService
from pal.services.dictionary_service import DictionaryService
from pal.services.directory_service import DirectoryService
from pal.services.joke_service import JokeService
from pal.services.movie_service import MovieService
from pal.services.service import wrap_resp... | Put JokeService in the right place alphabetically | Put JokeService in the right place alphabetically
| Python | bsd-3-clause | Machyne/pal,Machyne/pal,Machyne/pal,Machyne/pal | ---
+++
@@ -15,8 +15,8 @@
BonAppService,
DictionaryService,
DirectoryService,
+ FacebookService,
JokeService,
- FacebookService,
MovieService,
UltraLinguaService,
WAService, |
6fe588ea915d65fdab00b53f883b0a72ef6cf564 | tests/test_apd.py | tests/test_apd.py | import json
from sforparser.apd import scraper
INPUT_FILE = 'data/apd/input.txt'
def test_output_strips_email_spaces():
json_str = scraper(open(INPUT_FILE))
data = json.loads(json_str)
offensive_field = data[70]["locations"][0]["emails"]
expected = [
"ronald.sanders@sfdph.org",
"jua... | import json
import os
import pytest
from sforparser.apd import scraper
INPUT_FILE = 'data/apd/input.txt'
@pytest.fixture
def data():
json_str = scraper(open(INPUT_FILE))
artifact_dir = os.getenv('CIRCLE_ARTIFACTS')
if artifact_dir:
artifact_file = os.path.join(artifact_dir, 'apd.json')
... | Switch to pytest fixture and generate artifact for circle ci | Switch to pytest fixture and generate artifact for circle ci
| Python | mit | sfbrigade/sf-openreferral-datalib | ---
+++
@@ -1,14 +1,26 @@
import json
+import os
+
+import pytest
from sforparser.apd import scraper
INPUT_FILE = 'data/apd/input.txt'
-def test_output_strips_email_spaces():
+@pytest.fixture
+def data():
json_str = scraper(open(INPUT_FILE))
- data = json.loads(json_str)
+ artifact_dir = os.ge... |
c67864e50b92c38cbcc0e4e8ae630ff9e7194a55 | profiles/views.py | profiles/views.py | from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.utils.datastructures import MultiValueDictKeyError
from django.views.generic import TemplateView, UpdateView
from incuna.utils ... | from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.views.generic import TemplateView, UpdateView
from incuna.utils import get_class_from_path
from profiles.models import Profile... | Remove the exception handling code for getting the success url | Remove the exception handling code for getting the success url
| Python | bsd-2-clause | incuna/django-extensible-profiles | ---
+++
@@ -2,7 +2,6 @@
from django.contrib.auth.decorators import login_required
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
-from django.utils.datastructures import MultiValueDictKeyError
from django.views.generic import TemplateView, UpdateView
from incuna.utils i... |
48902df1fb9b8b299155cd7e2f9a2bf3444abdc8 | awsom/__init__.py | awsom/__init__.py | #!/usr/bin/python
from awsom.entity import Entity, Factory
from awsom.config import AccountEntity, config
class ModelRootFactory(Factory):
def __init__(self, entity):
super(ModelRootFactory, self).__init__(entity)
def populate(self):
# Attach all configuration-defined accounts as children of th... | #!/usr/bin/python
from awsom.entity import Entity, Factory
from awsom.config import AccountEntity, config
class ModelRootFactory(Factory):
def __init__(self, entity):
super(ModelRootFactory, self).__init__(entity)
def populate(self):
# Attach all configuration-defined accounts as children of th... | Fix bug with account additions using old Entity API | Fix bug with account additions using old Entity API
| Python | mit | tuxpiper/awsom | ---
+++
@@ -15,7 +15,7 @@
def __init__(self, name):
super(ModelRootEntity, self).__init__(factory=ModelRootFactory(self),name=name)
def add_account(self, name, **attrs):
- self[name] = AccountEntity(name, **attrs)
+ self._add_child(name, AccountEntity(parent=self, name=name, **attrs))... |
dff2b0cb2b425217435deaa7c33d54f168f1a9d7 | playground/testing.py | playground/testing.py | import numpy as np
import matplotlib.pyplot as plt
def takeFFT(data):
data = data / np.linalg.norm(data)
data_squared = np.square(data)
fft_out = np.fft.fft(data_squared)
fft_shape = np.fft.fftfreq(data_squared.shape[-1])
plt.stem(fft_shape, fft_out)
#plt.stem(fft_shape, np.fft.fftshift(fft_ou... | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
def takeFFT(data):
data = data / np.linalg.norm(data)
data_squared = np.square(data)
fft_out = np.fft.fft(data_squared)
fft_shape = np.fft.fftfreq(data_squared.shape[-1])
a = np.absolute(fft_out).argmax()
print(fft_out[a]... | Fix frequency and phase offset | Fix frequency and phase offset
| Python | mit | williamalu/mimo_usrp | ---
+++
@@ -1,5 +1,6 @@
import numpy as np
import matplotlib.pyplot as plt
+import seaborn as sns
def takeFFT(data):
data = data / np.linalg.norm(data)
@@ -7,22 +8,28 @@
fft_out = np.fft.fft(data_squared)
fft_shape = np.fft.fftfreq(data_squared.shape[-1])
- plt.stem(fft_shape, fft_out)
+ a... |
4c23e08172f3a1dfc64e32fce53f8f7188a0bf0c | pubsubpull/api.py | pubsubpull/api.py | """
APIs exposed by pubsubpull.
"""
from __future__ import absolute_import
from async.api import schedule
from django.db import connection
from pubsubpull import _join_with_project_path
def add_trigger_function():
"""Used for older versions of Postres, or test runs where there are no
migrations.
... | """
APIs exposed by pubsubpull.
"""
from __future__ import absolute_import
from async.api import schedule
from django.db import connection
from pubsubpull import _join_with_project_path
def add_trigger_function():
"""Used for older versions of Postres, or test runs where there are no
migrations.
... | Return the SQL we've just tried to run | Return the SQL we've just tried to run
| Python | mit | KayEss/django-pubsubpull,KayEss/django-pubsubpull,KayEss/django-pubsubpull | ---
+++
@@ -25,6 +25,7 @@
sql = file(_join_with_project_path("trigger-attach.sql")).read()
sql = sql.format(db_table=model._meta.db_table)
cursor.execute(sql)
+ return sql
def pull(model, callback, **kwargs): |
c39c362e949a7d89f92207d0b26bc9f6d61eacae | ibmcnx/doc/DataSources.py | ibmcnx/doc/DataSources.py | ######
# Check ExId (GUID) by Email through JDBC
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-04
#
# License: Apache 2.0
#
# Check ExId of a User in all Connections Appli... | ######
# Check ExId (GUID) by Email through JDBC
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-04
#
# License: Apache 2.0
#
# Check ExId of a User in all Connections Appli... | Create script to save documentation to a file | 4: Create script to save documentation to a file
Task-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/4 | Python | apache-2.0 | stoeps13/ibmcnx2,stoeps13/ibmcnx2 | ---
+++
@@ -15,8 +15,7 @@
import ibmcnx.functions
cell = "'/Cell:" + AdminControl.getCell() + "/'"
-print cell
-cellid = AdminConfig.getid( )
+cellid = AdminConfig.getid( cell )
dbs = AdminConfig.list( 'DataSource', cellid )
for db in dbs: |
c825373971d0ad24e4ca71fd4da88e55e62a6b17 | productmd/__init__.py | productmd/__init__.py | # -*- coding: utf-8 -*-
# Copyright (C) 2015 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
... | Allow importing major classes directly from productmd | Allow importing major classes directly from productmd
This should simplify things for most users: just import productmd module
and Compose (the one for metadata loading), Rpms and Images classes are
directly available as well as ComposeInfo, DiscInfo and TreeInfo.
| Python | lgpl-2.1 | release-engineering/productmd,lubomir/productmd,release-engineering/productmd,lubomir/productmd | ---
+++
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2015 Red Hat, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (... | |
ceda6bd7388df744e3ffd93118919ae67c55fe97 | unittest-build.py | unittest-build.py | #!/usr/bin/python
import sys
import os
if sys.platform == 'win32':
os.system ( 'devenv /build libSequantoAutomation.sln' )
else:
os.system ( 'make' )
| #!/usr/bin/python
import sys
import os
if sys.platform == 'win32':
os.system ( 'devenv libSequantoAutomation.sln /build Debug' )
else:
os.system ( 'make' )
| Fix devenv call in unittesting script. | Fix devenv call in unittesting script.
| Python | apache-2.0 | seqzap/sequanto-automation,seqzap/sequanto-automation,rasmus-toftdahl-olesen/sequanto-automation,rasmus-toftdahl-olesen/sequanto-automation,micronpn/sequanto-automation,micronpn/sequanto-automation,rasmus-toftdahl-olesen/sequanto-automation,seqzap/sequanto-automation,seqzap/sequanto-automation,seqzap/sequanto-automatio... | ---
+++
@@ -4,6 +4,6 @@
import os
if sys.platform == 'win32':
- os.system ( 'devenv /build libSequantoAutomation.sln' )
+ os.system ( 'devenv libSequantoAutomation.sln /build Debug' )
else:
os.system ( 'make' ) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.