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 |
|---|---|---|---|---|---|---|---|---|---|---|
85814828d2caedd8612db6ce0ecec92025a34330 | tests/test_main.py | tests/test_main.py | from cookiecutter.main import is_repo_url
def test_is_repo_url():
"""Verify is_repo_url works."""
assert is_repo_url('gitolite@server:team/repo') is True
assert is_repo_url('git@github.com:audreyr/cookiecutter.git') is True
assert is_repo_url('https://github.com/audreyr/cookiecutter.git') is True
... | from cookiecutter.main import is_repo_url
def test_is_repo_url():
"""Verify is_repo_url works."""
assert is_repo_url('gitolite@server:team/repo') is True
assert is_repo_url('git@github.com:audreyr/cookiecutter.git') is True
assert is_repo_url('https://github.com/audreyr/cookiecutter.git') is True
... | Add test for bitbucket domain | Add test for bitbucket domain
| Python | bsd-3-clause | michaeljoseph/cookiecutter,Springerle/cookiecutter,Springerle/cookiecutter,venumech/cookiecutter,cguardia/cookiecutter,luzfcb/cookiecutter,pjbull/cookiecutter,agconti/cookiecutter,willingc/cookiecutter,audreyr/cookiecutter,audreyr/cookiecutter,venumech/cookiecutter,takeflight/cookiecutter,dajose/cookiecutter,takeflight... | ---
+++
@@ -7,6 +7,7 @@
assert is_repo_url('git@github.com:audreyr/cookiecutter.git') is True
assert is_repo_url('https://github.com/audreyr/cookiecutter.git') is True
assert is_repo_url('gh:audreyr/cookiecutter-pypackage') is True
+ assert is_repo_url('https://bitbucket.org/pokoli/cookiecutter.hg')... |
0de3f3380eda3ed541fbf37243e13243a5ad6e1e | tests/test_open.py | tests/test_open.py | #!/usr/bin/env python
import unittest
import yv_suggest.open as yvs
import inspect
class OpenTestCase(unittest.TestCase):
'''test the handling of Bible reference URLs'''
def test_url(self):
'''should build correct URL to Bible reference'''
url = yvs.get_ref_url('esv/jhn.3.16')
self.ass... | #!/usr/bin/env python
import unittest
import yv_suggest.open as yvs
import inspect
class WebbrowserMock(object):
'''mock the builtin webbrowser module'''
def open(self, url):
'''mock the webbrowser.open() function'''
self.url = url
class OpenTestCase(unittest.TestCase):
'''test the handli... | Add unit test for opening bible reference urls | Add unit test for opening bible reference urls
| Python | mit | caleb531/youversion-suggest,caleb531/youversion-suggest | ---
+++
@@ -2,6 +2,13 @@
import unittest
import yv_suggest.open as yvs
import inspect
+
+class WebbrowserMock(object):
+ '''mock the builtin webbrowser module'''
+
+ def open(self, url):
+ '''mock the webbrowser.open() function'''
+ self.url = url
class OpenTestCase(unittest.TestCase):
... |
b676e0ba5ab1f37147cdf2ff28223fc57f37f567 | models/log_entry.py | models/log_entry.py |
from database import db
from conversions import datetime_from_str
class LogEntry(db.Model):
id = db.Column(db.Integer, primary_key=True)
timestamp = db.Column(db.DateTime, index=True)
server = db.Column(db.String(100), index=True)
log_name = db.Column(db.String(1000), index=True)
message = db.Co... |
from database import db
from conversions import datetime_from_str
class LogEntry(db.Model):
id = db.Column(db.Integer, primary_key=True)
timestamp = db.Column(db.DateTime, index=True)
server = db.Column(db.String(100), index=True)
log_name = db.Column(db.String(760), index=True)
message = db.Col... | Reduce the size of log_name so it fits within mysql's limit. | Reduce the size of log_name so it fits within mysql's limit.
| Python | agpl-3.0 | izrik/sawmill,izrik/sawmill,izrik/sawmill | ---
+++
@@ -8,7 +8,7 @@
id = db.Column(db.Integer, primary_key=True)
timestamp = db.Column(db.DateTime, index=True)
server = db.Column(db.String(100), index=True)
- log_name = db.Column(db.String(1000), index=True)
+ log_name = db.Column(db.String(760), index=True)
message = db.Column(db.Tex... |
006f957d8b6d747ad701d7b39a411df8f562f17f | modules/karmamod.py | modules/karmamod.py | """Keeps track of karma counts.
@package ppbot
@syntax .karma <item>
"""
import re
from modules import *
class Karmamod(Module):
def __init__(self, *args, **kwargs):
"""Constructor"""
Module.__init__(self, kwargs=kwargs)
def _register_events(self):
self.add_command('karma', 'get_ka... | """Keeps track of karma counts.
@package ppbot
@syntax .karma <item>
"""
import re
from modules import *
class Karmamod(Module):
def __init__(self, *args, **kwargs):
"""Constructor"""
Module.__init__(self, kwargs=kwargs)
def _register_events(self):
self.add_command('karma', 'get_ka... | Change to reply only if target has karma | Change to reply only if target has karma
| Python | mit | billyvg/piebot | ---
+++
@@ -24,10 +24,9 @@
'source': event['target']})
try:
result = karma['count']
+ self.reply('%s has %d karma.' % (event['args'][0], result))
except KeyError, TypeError:
result = 0
-
- self.msg(event['target'], '%s has %d karma.' % (event[... |
a4d1659197c0c3da706065d5362fd3b060223c87 | newaccount/views.py | newaccount/views.py | from django.shortcuts import render
from django.http import JsonResponse
import common.render
from common.settings import get_page_config
def form(request):
''' The signup form webpage '''
context = get_page_config(title='New User Sign Up')
context['form'] = [
{'label': 'User Name', 'name': 'usern... | from django.http import JsonResponse
from django.contrib.auth.models import User
from django.core.validators import validate_email
from django.core.exceptions import ValidationError
from django.shortcuts import render
import urllib
import common.render
from common.settings import get_page_config
def form(request):
... | Implement backend newaccount form verification | Implement backend newaccount form verification
| Python | mit | NicolasKiely/Robit-Tracker,NicolasKiely/Robit-Tracker,NicolasKiely/Robit-Tracker | ---
+++
@@ -1,5 +1,9 @@
+from django.http import JsonResponse
+from django.contrib.auth.models import User
+from django.core.validators import validate_email
+from django.core.exceptions import ValidationError
from django.shortcuts import render
-from django.http import JsonResponse
+import urllib
import common.ren... |
1e562decdc03295dec4cb37d26162e5d9aa31079 | neutron/tests/common/agents/l3_agent.py | neutron/tests/common/agents/l3_agent.py | # Copyright 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | # Copyright 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | Update L3 agent drivers singletons to look at new agent | Update L3 agent drivers singletons to look at new agent
L3 agent drivers are singletons. They're created once, and hold
self.l3_agent. During testing, the agent is tossed away and
re-built, but the drivers singletons are pointing at the old
agent, and its old configuration.
Change-Id: Ie8a15318e71ea47cccad3b788751d91... | Python | apache-2.0 | JianyuWang/neutron,SmartInfrastructures/neutron,eayunstack/neutron,skyddv/neutron,MaximNevrov/neutron,watonyweng/neutron,gkotton/neutron,openstack/neutron,mandeepdhami/neutron,glove747/liberty-neutron,projectcalico/calico-neutron,SamYaple/neutron,takeshineshiro/neutron,dims/neutron,watonyweng/neutron,miyakz1192/neutron... | ---
+++
@@ -19,6 +19,12 @@
class TestL3NATAgent(agent.L3NATAgentWithStateReport):
NESTED_NAMESPACE_SEPARATOR = '@'
+ def __init__(self, host, conf=None):
+ super(TestL3NATAgent, self).__init__(host, conf)
+ self.event_observers.observers = set(
+ observer.__class__(self) for observ... |
a2826203584c6f42b8e48a9eb9285d3a90983b98 | rts/urls.py | rts/urls.py | from django.conf.urls import patterns, include, url
from django.core.urlresolvers import reverse
from django.views.generic.base import RedirectView
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^$', RedirectView.as_view(url=reverse('admin:index')), name='home'),
u... | from django.conf.urls import patterns, include, url
from django.core.urlresolvers import reverse_lazy
from django.views.generic.base import RedirectView
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^$', RedirectView.as_view(url=reverse_lazy('admin:index')),
n... | Use reverse_lazy to avoid weird url setup circularity. | Use reverse_lazy to avoid weird url setup circularity.
| Python | bsd-3-clause | praekelt/go-rts-zambia | ---
+++
@@ -1,5 +1,5 @@
from django.conf.urls import patterns, include, url
-from django.core.urlresolvers import reverse
+from django.core.urlresolvers import reverse_lazy
from django.views.generic.base import RedirectView
from django.contrib import admin
@@ -7,7 +7,8 @@
urlpatterns = patterns(
'',
- ... |
b4a2214d84884148760623eb655ac9e538b27370 | planterbox/tests/test_hooks/__init__.py | planterbox/tests/test_hooks/__init__.py | from planterbox import (
step,
hook,
)
hooks_run = set()
@hook('before', 'feature')
def before_feature_hook(feature_suite):
global hooks_run
hooks_run.add(('before', 'feature'))
@hook('before', 'scenario')
def before_scenario_hook(scenario_test):
global hooks_run
hooks_run.add(('before', '... | from planterbox import (
step,
hook,
)
hooks_run = set()
@hook('before', 'feature')
def before_feature_hook(feature_suite):
global hooks_run
hooks_run.add(('before', 'feature'))
@hook('before', 'scenario')
def before_scenario_hook(test):
global hooks_run
hooks_run.add(('before', 'scenario'... | Clarify arguments in tests slightly | Clarify arguments in tests slightly
| Python | mit | npilon/planterbox | ---
+++
@@ -14,7 +14,7 @@
@hook('before', 'scenario')
-def before_scenario_hook(scenario_test):
+def before_scenario_hook(test):
global hooks_run
hooks_run.add(('before', 'scenario'))
@@ -26,7 +26,7 @@
@step(r'I verify that all before hooks have run')
-def verify_before_hooks(world):
+def verify... |
229d1f1611f7372e43ae5f638b9fcb15fe395432 | notebooks/demo/services/common/tools.py | notebooks/demo/services/common/tools.py | import csv
import os
HERE = os.path.dirname(os.path.abspath(__file__))
def load_db():
with open(os.path.join(HERE, 'The_Haiti_Earthquake_Database.csv')) as f:
reader = csv.DictReader(f)
for elt in reader:
del elt['']
yield elt
HAITI_DB = list(load_db())
| # -*- coding: utf-8 -*-
import csv
import os
import re
HERE = os.path.dirname(os.path.abspath(__file__))
def sexa_to_dec(dh, min, secs, sign):
return sign*(dh + float(min)/60 + float(secs)/60**2)
def string_to_dec(s, neg):
parsed = filter(
None, re.split('[\'" °]', unicode(s, 'utf-8')))
sign ... | Return geo coordinates in decimal | Return geo coordinates in decimal
| Python | mit | DesignSafe-CI/adama_example | ---
+++
@@ -1,8 +1,30 @@
+# -*- coding: utf-8 -*-
+
import csv
import os
+import re
HERE = os.path.dirname(os.path.abspath(__file__))
+
+
+def sexa_to_dec(dh, min, secs, sign):
+ return sign*(dh + float(min)/60 + float(secs)/60**2)
+
+
+def string_to_dec(s, neg):
+ parsed = filter(
+ None, re.spli... |
70aa7af1a5da51813a09da4f9671e293c4a01d91 | util/connection.py | util/connection.py | import os
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
from sqlalchemy.orm.scoping import scoped_session
from sqlalchemy.pool import NullPool
DB_URL = os.environ.get('DB_URL')
if not DB_URL:
raise ValueError("DB_URL not present in th... | import os
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
from sqlalchemy.orm.scoping import scoped_session
from sqlalchemy.pool import NullPool
AIRFLOW_CONN_MYSQL_TRACKER = os.environ.get('AIRFLOW_CONN_MYSQL_TRACKER')
if not AIRFLOW_CONN_M... | Add Mysql Tracker database to store our data | Add Mysql Tracker database to store our data
| Python | apache-2.0 | LREN-CHUV/data-factory-airflow-dags,LREN-CHUV/airflow-mri-preprocessing-dags,LREN-CHUV/data-factory-airflow-dags,LREN-CHUV/airflow-mri-preprocessing-dags | ---
+++
@@ -6,10 +6,10 @@
from sqlalchemy.orm.scoping import scoped_session
from sqlalchemy.pool import NullPool
-DB_URL = os.environ.get('DB_URL')
+AIRFLOW_CONN_MYSQL_TRACKER = os.environ.get('AIRFLOW_CONN_MYSQL_TRACKER')
-if not DB_URL:
- raise ValueError("DB_URL not present in the environment")
+if not AI... |
f8464d93ab56f7b8d46e430de4fe9b019117da4c | ofp/v0x01/controller2switch/flow_mod.py | ofp/v0x01/controller2switch/flow_mod.py | """Modifications to the flow table from the controller"""
# System imports
import enum
# Third-party imports
# Local source tree imports
from common import action
from common import flow_match
from common import header as of_header
from foundation import base
from foundation import basic_types
# Enums
class FlowM... | Implement flow table modifications classes and enums | Implement flow table modifications classes and enums
| Python | mit | cemsbr/python-openflow,kytos/python-openflow | ---
+++
@@ -0,0 +1,82 @@
+"""Modifications to the flow table from the controller"""
+
+# System imports
+import enum
+
+# Third-party imports
+
+# Local source tree imports
+from common import action
+from common import flow_match
+from common import header as of_header
+from foundation import base
+from foundation i... | |
6934b792deaad42eb8ab856d1e0420b9a88a8c41 | utility/util.py | utility/util.py | # Stdlib imports
from datetime import datetime
from pytz import timezone
# Core Django imports
from django.utils.timezone import utc
# Imports from app
from sync_center.models import Map, KML
def get_update_id_list(model_name, req_data):
db_data = None
if model_name == 'map':
db_data = Map.objects.... | # Stdlib imports
from datetime import datetime
from pytz import timezone
# Core Django imports
from django.utils.timezone import utc
# Imports from app
from sync_center.models import Map, KML
def get_update_id_list(model_name, req_data):
db_data = None
if model_name == 'map':
db_data = Map.objects.... | Modify parsing logic for last_modified in JSON | Modify parsing logic for last_modified in JSON
| Python | mit | CMUPracticum/TrailScribe,CMUPracticum/TrailScribeServer,CMUPracticum/TrailScribe,CMUPracticum/TrailScribeServer,CMUPracticum/TrailScribe | ---
+++
@@ -25,7 +25,7 @@
if id_str not in req_data.keys():
id_list.append(data.id)
else:
- req_last_modified = datetime.strptime(req_data[id_str]['last_modified'], '%Y-%m-%d %H:%M:%S').replace(tzinfo = utc)
+ req_last_modified = datetime.strptime(req_data[id_str][... |
a66c6d3b9c3453f4ea5a4352de17bb83c75776a5 | settings.py | settings.py | #
platedir = 'J:\\hte_jcap_app_proto\\plate'
mapdir = 'J:\\hte_jcap_app_proto\\map'
rundir = 'C:\\INST\\RUNS'
stagx_min = 0
stagx_max = 101.9
stagy_min = 0
stagy_max = 100
| #
platedir = 'J:\\hte_jcap_app_proto\\plate'
mapdir = 'J:\\hte_jcap_app_proto\\map'
rundir = 'C:\\INST\\RUNS'
stagx_min = 0
stagx_max = 101.9
stagy_min = 0
stagy_max = 101.9
| Update x and y stage limits according to Orbis stage calibration. | Update x and y stage limits according to Orbis stage calibration.
| Python | mit | dngv/JCAPOrbisAlign | ---
+++
@@ -5,4 +5,4 @@
stagx_min = 0
stagx_max = 101.9
stagy_min = 0
-stagy_max = 100
+stagy_max = 101.9 |
07ef73f98e85919863af43f9c50bde85a143660d | conf_site/reviews/admin.py | conf_site/reviews/admin.py | from django.contrib import admin
from conf_site.reviews.models import (
ProposalFeedback,
ProposalNotification,
ProposalResult,
ProposalVote,
)
class ProposalInline(admin.StackedInline):
model = ProposalNotification.proposals.through
@admin.register(ProposalFeedback)
class ProposalFeedbackAdmin... | from django.contrib import admin
from conf_site.reviews.models import (
ProposalFeedback,
ProposalNotification,
ProposalResult,
ProposalVote,
)
class ProposalInline(admin.StackedInline):
model = ProposalNotification.proposals.through
@admin.register(ProposalFeedback)
class ProposalFeedbackAdmin... | Enable filtering ProposalVotes by reviewer. | Enable filtering ProposalVotes by reviewer.
| Python | mit | pydata/conf_site,pydata/conf_site,pydata/conf_site | ---
+++
@@ -32,4 +32,4 @@
@admin.register(ProposalVote)
class ProposalVoteAdmin(admin.ModelAdmin):
list_display = ("proposal", "voter", "score", "comment")
- list_filter = ("score",)
+ list_filter = ["score", "voter"] |
ff65853def5bf1044fe457362f85b8aecca66152 | tests/laser/transaction/create.py | tests/laser/transaction/create.py | import mythril.laser.ethereum.transaction as transaction
from mythril.ether import util
import mythril.laser.ethereum.svm as svm
from mythril.disassembler.disassembly import Disassembly
from datetime import datetime
from mythril.ether.soliditycontract import SolidityContract
import tests
from mythril.analysis.security ... | from mythril.laser.ethereum.transaction import execute_contract_creation
from mythril.ether import util
import mythril.laser.ethereum.svm as svm
from mythril.disassembler.disassembly import Disassembly
from datetime import datetime
from mythril.ether.soliditycontract import SolidityContract
import tests
from mythril.an... | Update test to reflect the refactor | Update test to reflect the refactor
| Python | mit | b-mueller/mythril,b-mueller/mythril,b-mueller/mythril,b-mueller/mythril | ---
+++
@@ -1,4 +1,4 @@
-import mythril.laser.ethereum.transaction as transaction
+from mythril.laser.ethereum.transaction import execute_contract_creation
from mythril.ether import util
import mythril.laser.ethereum.svm as svm
from mythril.disassembler.disassembly import Disassembly
@@ -15,7 +15,7 @@
laser_e... |
d41d0c15661be517d761e7d6bae2be17495b0f6e | src/deps.py | src/deps.py | # Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | Update frontend to chrome r108801 | Update frontend to chrome r108801
| Python | apache-2.0 | natduca/trace_event_viewer,natduca/trace_event_viewer,natduca/trace_event_viewer | ---
+++
@@ -13,4 +13,4 @@
# limitations under the License.
CHROME_SVN_BASE = 'http://src.chromium.org/svn/trunk/src/'
-CHROME_SVN_REV = 96732
+CHROME_SVN_REV = 108801 |
77e4fb7ef74bcfd58b548cca8ec9898eb936e7ef | conanfile.py | conanfile.py | from conans import ConanFile, CMake
class EsappConan(ConanFile):
name = 'esapp'
version = '0.4.1'
url = 'https://github.com/jason2506/esapp'
license = 'BSD 3-Clause'
author = 'Chi-En Wu'
requires = 'desa/0.1.0@jason2506/testing'
settings = 'os', 'compiler', 'build_type', 'arch'
gene... | from conans import ConanFile, CMake
class EsappConan(ConanFile):
name = 'esapp'
version = '0.4.1'
url = 'https://github.com/jason2506/esapp'
license = 'BSD 3-Clause'
author = 'Chi-En Wu'
requires = 'desa/0.1.0@jason2506/testing'
settings = 'os', 'compiler', 'build_type', 'arch'
gene... | Remove default option for `desa` | Remove default option for `desa`
| Python | bsd-3-clause | jason2506/esapp,jason2506/esapp | ---
+++
@@ -13,9 +13,6 @@
settings = 'os', 'compiler', 'build_type', 'arch'
generators = 'cmake'
- default_options = (
- 'desa:build_tests=False'
- )
exports = (
'CMakeLists.txt', |
5b5f891b6ee714966eefed1adfbd366eb078210f | webpack_resolve.py | webpack_resolve.py | import json
import os
import wiki
PROJECT_ROOT_DIRECTORY = os.path.dirname(globals()['__file__'])
DJANGO_WIKI_STATIC = os.path.join(os.path.dirname(wiki.__file__), 'static')
# This whole file is essentially just a big ugly hack.
# For webpack to properly build wiki static files it needs the absolute path to the wiki
... | import json
import os
import wiki
DJANGO_WIKI_STATIC = os.path.join(os.path.dirname(wiki.__file__), 'static')
WEBPACK_RESOLVE_FILE = 'webpack-extra-resolve.json'
# This whole file is essentially just a big ugly hack.
# For webpack to properly build wiki static files it needs the absolute path to the wiki
# static fol... | Remove unnecessary project root variable from webpack resolve script | Remove unnecessary project root variable from webpack resolve script
| Python | mit | dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4 | ---
+++
@@ -2,8 +2,8 @@
import os
import wiki
-PROJECT_ROOT_DIRECTORY = os.path.dirname(globals()['__file__'])
DJANGO_WIKI_STATIC = os.path.join(os.path.dirname(wiki.__file__), 'static')
+WEBPACK_RESOLVE_FILE = 'webpack-extra-resolve.json'
# This whole file is essentially just a big ugly hack.
# For webpack ... |
fdf05b0fa93c350d2cd030e451b0e26ed7393209 | tests/clientlib/validate_manifest_test.py | tests/clientlib/validate_manifest_test.py |
import pytest
from pre_commit.clientlib.validate_manifest import additional_manifest_check
from pre_commit.clientlib.validate_manifest import InvalidManifestError
from pre_commit.clientlib.validate_manifest import run
def test_returns_0_for_valid_manifest():
assert run(['example_manifest.yaml']) == 0
def test... |
import jsonschema
import jsonschema.exceptions
import pytest
from pre_commit.clientlib.validate_manifest import additional_manifest_check
from pre_commit.clientlib.validate_manifest import InvalidManifestError
from pre_commit.clientlib.validate_manifest import MANIFEST_JSON_SCHEMA
from pre_commit.clientlib.validate_m... | Add better tests for manifest json schema | Add better tests for manifest json schema
| Python | mit | chriskuehl/pre-commit,pre-commit/pre-commit,philipgian/pre-commit,beni55/pre-commit,Lucas-C/pre-commit,barrysteyn/pre-commit,Lucas-C/pre-commit,Lucas-C/pre-commit,dnephin/pre-commit,philipgian/pre-commit,dnephin/pre-commit,Teino1978-Corp/pre-commit,philipgian/pre-commit,chriskuehl/pre-commit,chriskuehl/pre-commit-1,dne... | ---
+++
@@ -1,8 +1,11 @@
+import jsonschema
+import jsonschema.exceptions
import pytest
from pre_commit.clientlib.validate_manifest import additional_manifest_check
from pre_commit.clientlib.validate_manifest import InvalidManifestError
+from pre_commit.clientlib.validate_manifest import MANIFEST_JSON_SCHEMA
... |
8da5356b2a08679cbf61cff21db2068980866701 | scripts/master/factory/dart/channels.py | scripts/master/factory/dart/channels.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class Channel(object):
def __init__(self, name, branch, position, category_postfix, priority):
self.branch = branch
self.builder_postfix = '-' + na... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class Channel(object):
def __init__(self, name, branch, position, category_postfix, priority):
self.branch = branch
self.builder_postfix = '-' + na... | Update stable channel builders to 1.6 branch | Update stable channel builders to 1.6 branch
Review URL: https://codereview.chromium.org/494783003
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@291643 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | eunchong/build,eunchong/build,eunchong/build,eunchong/build | ---
+++
@@ -19,7 +19,7 @@
CHANNELS = [
Channel('be', 'branches/bleeding_edge', 0, '', 4),
Channel('dev', 'trunk', 1, '-dev', 2),
- Channel('stable', 'branches/1.5', 2, '-stable', 1),
+ Channel('stable', 'branches/1.6', 2, '-stable', 1),
Channel('integration', 'branches/dartium_integration', 3, '-integrati... |
70ef413e0e43103877fc94cdfebd11002e6cbcbd | scripts/master/factory/dart/channels.py | scripts/master/factory/dart/channels.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class Channel(object):
def __init__(self, name, branch, position, category_postfix, priority):
self.branch = branch
self.builder_postfix = '-' + na... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class Channel(object):
def __init__(self, name, branch, position, category_postfix, priority):
self.branch = branch
self.builder_postfix = '-' + na... | Update stable channel to 1.1 | Update stable channel to 1.1
Review URL: https://codereview.chromium.org/138273002
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@244706 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | eunchong/build,eunchong/build,eunchong/build,eunchong/build | ---
+++
@@ -19,7 +19,7 @@
CHANNELS = [
Channel('be', 'branches/bleeding_edge', 0, '', 3),
Channel('dev', 'trunk', 1, '-dev', 2),
- Channel('stable', 'branches/1.0', 2, '-stable', 1),
+ Channel('stable', 'branches/1.1', 2, '-stable', 1),
]
CHANNELS_BY_NAME = {} |
ba93ea71b87c95f4d52c85ae652496ebfb012e1f | pupa/importers/memberships.py | pupa/importers/memberships.py | from .base import BaseImporter
class MembershipImporter(BaseImporter):
_type = 'membership'
def __init__(self, jurisdiction_id, person_importer, org_importer):
super(MembershipImporter, self).__init__(jurisdiction_id)
self.person_importer = person_importer
self.org_importer = org_impo... | from .base import BaseImporter
class MembershipImporter(BaseImporter):
_type = 'membership'
def __init__(self, jurisdiction_id, person_importer, org_importer):
super(MembershipImporter, self).__init__(jurisdiction_id)
self.person_importer = person_importer
self.org_importer = org_impo... | Add unmatched_legislator to the spec | Add unmatched_legislator to the spec
| Python | bsd-3-clause | datamade/pupa,datamade/pupa,rshorey/pupa,mileswwatkins/pupa,rshorey/pupa,mileswwatkins/pupa,opencivicdata/pupa,influence-usa/pupa,influence-usa/pupa,opencivicdata/pupa | ---
+++
@@ -16,6 +16,10 @@
# if this is a historical role, only update historical roles
'end_date': membership.get('end_date')
}
+
+ if 'unmatched_legislator' in membership:
+ spec['unmatched_legislator'] = membership['unmatched_legislator']
+
... |
8a534a9927ac0050b3182243c2b8bbf59127549e | test/multiple_invocations_test.py | test/multiple_invocations_test.py | # Copyright (c) 2012 - 2014 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
from jenkinsflow.flow import serial
from .framework import mock_api
def test_multiple_invocations_immediate():
with mock_api.api(__file__) as api:
api.flow_job()
... | # Copyright (c) 2012 - 2014 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
from jenkinsflow.flow import serial
from .framework import mock_api
def test_multiple_invocations_same_flow():
with mock_api.api(__file__) as api:
api.flow_job()
... | Test two flow invocations after each other | Test two flow invocations after each other
| Python | bsd-3-clause | lechat/jenkinsflow,lhupfeldt/jenkinsflow,lhupfeldt/jenkinsflow,lechat/jenkinsflow,lechat/jenkinsflow,lhupfeldt/jenkinsflow,lhupfeldt/jenkinsflow,lechat/jenkinsflow | ---
+++
@@ -5,7 +5,7 @@
from .framework import mock_api
-def test_multiple_invocations_immediate():
+def test_multiple_invocations_same_flow():
with mock_api.api(__file__) as api:
api.flow_job()
_params = (('password', '', 'Some password'), ('s1', '', 'Some string argument'))
@@ -14,3 +14,... |
dd7682dd12333b9fec63a112a0484e9391937041 | tests/cputestdata/cpu-reformat.py | tests/cputestdata/cpu-reformat.py | #!/usr/bin/env python3
import sys
import json
dec = json.JSONDecoder()
data, pos = dec.raw_decode(sys.stdin.read())
json.dump(data, sys.stdout, indent=2, separators=(',', ': '))
print("\n")
| #!/usr/bin/env python3
import sys
import json
dec = json.JSONDecoder()
data, pos = dec.raw_decode(sys.stdin.read())
json.dump(data, sys.stdout, indent=2, separators=(',', ': '))
print("")
| Make sure generated files pass syntax-check | cputest: Make sure generated files pass syntax-check
The tests/cputestdata/cpu-parse.sh would produce JSON files with QEMU
replies which wouldn't pass syntax-check. Let's fix this by not emitting
an extra new line after reformatting the JSON file.
Signed-off-by: Jiri Denemark <62bdf77dc47919a4d59a91822129d14633cfca81... | Python | lgpl-2.1 | olafhering/libvirt,andreabolognani/libvirt,eskultety/libvirt,zippy2/libvirt,andreabolognani/libvirt,jfehlig/libvirt,zippy2/libvirt,jfehlig/libvirt,olafhering/libvirt,zippy2/libvirt,olafhering/libvirt,libvirt/libvirt,crobinso/libvirt,fabianfreyer/libvirt,jardasgit/libvirt,fabianfreyer/libvirt,crobinso/libvirt,nertpinx/l... | ---
+++
@@ -6,4 +6,4 @@
dec = json.JSONDecoder()
data, pos = dec.raw_decode(sys.stdin.read())
json.dump(data, sys.stdout, indent=2, separators=(',', ': '))
-print("\n")
+print("") |
fc7db2a55ad3f612ac6ef01cfa57ce03040708a5 | evelink/__init__.py | evelink/__init__.py | """EVELink - Python bindings for the EVE API."""
import logging
from evelink import account
from evelink import api
from evelink import char
from evelink import constants
from evelink import corp
from evelink import eve
from evelink import map
from evelink import parsing
from evelink import server
# Implement NullHa... | """EVELink - Python bindings for the EVE API."""
import logging
from evelink import account
from evelink import api
from evelink import char
from evelink import constants
from evelink import corp
from evelink import eve
from evelink import map
from evelink import server
# Implement NullHandler because it was only ad... | Remove parsing from public interface | Remove parsing from public interface
| Python | mit | zigdon/evelink,FashtimeDotCom/evelink,bastianh/evelink,ayust/evelink,Morloth1274/EVE-Online-POCO-manager | ---
+++
@@ -9,7 +9,6 @@
from evelink import corp
from evelink import eve
from evelink import map
-from evelink import parsing
from evelink import server
# Implement NullHandler because it was only added in Python 2.7+. |
46df020f5f349ac02c509e334ffd7e1f5970915b | detectem/exceptions.py | detectem/exceptions.py | class DockerStartError(Exception):
pass
class NotNamedParameterFound(Exception):
pass
class SplashError(Exception):
def __init__(self, msg):
self.msg = 'Splash error: {}'.format(msg)
super().__init__(msg)
class NoPluginsError(Exception):
def __init__(self, msg):
self.msg = ... | class DockerStartError(Exception):
pass
class NotNamedParameterFound(Exception):
pass
class SplashError(Exception):
def __init__(self, msg):
self.msg = 'Splash error: {}'.format(msg)
super().__init__(self.msg)
class NoPluginsError(Exception):
def __init__(self, msg):
self.m... | Fix in tests for exception messages | Fix in tests for exception messages
| Python | mit | spectresearch/detectem | ---
+++
@@ -9,10 +9,10 @@
class SplashError(Exception):
def __init__(self, msg):
self.msg = 'Splash error: {}'.format(msg)
- super().__init__(msg)
+ super().__init__(self.msg)
class NoPluginsError(Exception):
def __init__(self, msg):
self.msg = msg
- super().__in... |
0aaa546435a261a03e27fee53a3c5f334cca6b66 | spacy/tests/regression/test_issue768.py | spacy/tests/regression/test_issue768.py | # coding: utf-8
from __future__ import unicode_literals
from ...language import Language
from ...attrs import LANG
from ...fr.language_data import TOKENIZER_EXCEPTIONS, STOP_WORDS
from ...language_data.punctuation import TOKENIZER_INFIXES, ALPHA
import pytest
@pytest.fixture
def fr_tokenizer_w_infix():
SPLIT_IN... | # coding: utf-8
from __future__ import unicode_literals
from ...language import Language
from ...attrs import LANG
from ...fr.language_data import get_tokenizer_exceptions, STOP_WORDS
from ...language_data.punctuation import TOKENIZER_INFIXES, ALPHA
import pytest
@pytest.fixture
def fr_tokenizer_w_infix():
SPLI... | Fix test after updating the French tokenizer stuff | Fix test after updating the French tokenizer stuff
| Python | mit | raphael0202/spaCy,aikramer2/spaCy,explosion/spaCy,aikramer2/spaCy,recognai/spaCy,banglakit/spaCy,banglakit/spaCy,raphael0202/spaCy,recognai/spaCy,recognai/spaCy,recognai/spaCy,honnibal/spaCy,explosion/spaCy,oroszgy/spaCy.hu,explosion/spaCy,Gregory-Howard/spaCy,spacy-io/spaCy,banglakit/spaCy,banglakit/spaCy,explosion/sp... | ---
+++
@@ -3,7 +3,7 @@
from ...language import Language
from ...attrs import LANG
-from ...fr.language_data import TOKENIZER_EXCEPTIONS, STOP_WORDS
+from ...fr.language_data import get_tokenizer_exceptions, STOP_WORDS
from ...language_data.punctuation import TOKENIZER_INFIXES, ALPHA
import pytest
@@ -20,7 +2... |
6f2db6743f431019a46a2b977cb17dd6f0622fbd | yolodex/urls.py | yolodex/urls.py | from django.conf.urls import patterns, url, include
from django.utils.translation import ugettext as _
from .views import (
RealmView,
EntityDetailView,
EntityNetworkView,
)
entity_urls = [
url(r'^$', RealmView.as_view(), name='overview'),
url(r'^(?P<type>[\w-]+)/(?P<slug>[\w-]+)/$',
Entit... | from django.conf.urls import patterns, url, include
from django.utils.translation import ugettext as _
from .views import (
RealmView,
EntityDetailView,
EntityNetworkView,
)
entity_urls = [
url(r'^$', RealmView.as_view(), name='overview'),
url(r'^(?P<type>[\w-]+)/(?P<slug>[\w-]+)/$',
Entit... | Fix name of entity graph url | Fix name of entity graph url | Python | mit | correctiv/django-yolodex,correctiv/django-yolodex,correctiv/django-yolodex | ---
+++
@@ -14,7 +14,7 @@
name='entity_detail'),
url(r'^(?P<type>[\w-]+)/(?P<slug>[\w-]+)/graph\.json$',
EntityNetworkView.as_view(),
- name='entity_detail'),
+ name='entity_graph_json'),
]
urlpatterns = patterns('', *entity_urls) |
9af4f3bc2ddc07e47f311ae51e20e3f99733ea35 | Orange/tests/test_regression.py | Orange/tests/test_regression.py | import unittest
import inspect
import pkgutil
import Orange
from Orange.data import Table
from Orange.regression import Learner
class RegressionLearnersTest(unittest.TestCase):
def all_learners(self):
regression_modules = pkgutil.walk_packages(
path=Orange.regression.__path__,
pre... | import unittest
import inspect
import pkgutil
import traceback
import Orange
from Orange.data import Table
from Orange.regression import Learner
class RegressionLearnersTest(unittest.TestCase):
def all_learners(self):
regression_modules = pkgutil.walk_packages(
path=Orange.regression.__path__... | Handle TypeError while testing all regression learners | Handle TypeError while testing all regression learners
| Python | bsd-2-clause | qPCR4vir/orange3,marinkaz/orange3,cheral/orange3,kwikadi/orange3,kwikadi/orange3,kwikadi/orange3,marinkaz/orange3,qPCR4vir/orange3,cheral/orange3,marinkaz/orange3,cheral/orange3,marinkaz/orange3,marinkaz/orange3,qPCR4vir/orange3,cheral/orange3,qPCR4vir/orange3,kwikadi/orange3,kwikadi/orange3,qPCR4vir/orange3,cheral/ora... | ---
+++
@@ -1,6 +1,7 @@
import unittest
import inspect
import pkgutil
+import traceback
import Orange
from Orange.data import Table
@@ -25,6 +26,10 @@
def test_adequacy_all_learners(self):
for learner in self.all_learners():
- learner = learner()
- table = Table("iris")
- ... |
441da7a34058733c298c81dbd97a35fca6e538e0 | pgpdump/__main__.py | pgpdump/__main__.py | import sys
import cProfile
from . import AsciiData, BinaryData
def parsefile(name):
with open(name) as infile:
if name.endswith('.asc'):
data = AsciiData(infile.read())
else:
data = BinaryData(infile.read())
counter = 0
for packet in data.packets():
counter ... | import sys
from . import AsciiData, BinaryData
def parsefile(name):
with open(name, 'rb') as infile:
if name.endswith('.asc'):
data = AsciiData(infile.read())
else:
data = BinaryData(infile.read())
counter = 0
for packet in data.packets():
counter += 1
... | Remove cProfile inclusion, always read file as binary | Remove cProfile inclusion, always read file as binary
Signed-off-by: Dan McGee <2591e5f46f28d303f9dc027d475a5c60d8dea17a@archlinux.org>
| Python | bsd-3-clause | toofishes/python-pgpdump | ---
+++
@@ -1,10 +1,9 @@
import sys
-import cProfile
from . import AsciiData, BinaryData
def parsefile(name):
- with open(name) as infile:
+ with open(name, 'rb') as infile:
if name.endswith('.asc'):
data = AsciiData(infile.read())
else:
@@ -12,6 +11,7 @@
counter = 0
... |
bbe86b97f38a3c99e8271a5f167223a965ef1ff0 | docs/conf.py | docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.... | Add link to source code in documentation | Add link to source code in documentation
| Python | mit | numberly/thingy | ---
+++
@@ -18,6 +18,7 @@
# ones.
extensions = [
"sphinx.ext.autodoc",
+ "sphinx.ext.viewcode",
]
# The master toctree document. |
cf2ae3c36c18ac00092736e076be0c4c09df6958 | sklearn_porter/language/go.py | sklearn_porter/language/go.py | # -*- coding: utf-8 -*-
from os.path import sep
KEY = 'go'
LABEL = 'Go'
DEPENDENCIES = ['go']
TEMP_DIR = 'go'
SUFFIX = 'go'
# go build -o tmp/estimator tmp/estimator.go
CMD_COMPILE = 'go build -o {dest_dir}' + sep + '{dest_file} {src_dir}' + sep + '{src_file}'
# tmp/estimator <args>
CMD_EXECUTE = '{dest_dir}' + s... | # -*- coding: utf-8 -*-
from os.path import sep
KEY = 'go'
LABEL = 'Go'
DEPENDENCIES = ['go']
TEMP_DIR = 'go'
SUFFIX = 'go'
# go build -o tmp/estimator tmp/estimator.go
CMD_COMPILE = 'go build -o {dest_dir}' + sep + '{dest_file} {src_dir}' + sep + '{src_file}'
# tmp/estimator <args>
CMD_EXECUTE = '{dest_dir}' + s... | Remove redundant parentheses around if conditions | feature/oop-api-refactoring: Remove redundant parentheses around if conditions
| Python | bsd-3-clause | nok/sklearn-porter | ---
+++
@@ -18,7 +18,7 @@
TEMPLATES = {
# if/else condition:
- 'if': 'if ({0} {1} {2}) {{',
+ 'if': 'if {0} {1} {2} {{',
'else': '} else {',
'endif': '}',
|
8b87a55a03422cc499b2f7cc168bcc0c15c0ae42 | mycli/clibuffer.py | mycli/clibuffer.py | from prompt_toolkit.buffer import Buffer
from prompt_toolkit.filters import Condition
class CLIBuffer(Buffer):
def __init__(self, always_multiline, *args, **kwargs):
self.always_multiline = always_multiline
@Condition
def is_multiline():
doc = self.document
return s... | from prompt_toolkit.buffer import Buffer
from prompt_toolkit.filters import Condition
class CLIBuffer(Buffer):
def __init__(self, always_multiline, *args, **kwargs):
self.always_multiline = always_multiline
@Condition
def is_multiline():
doc = self.document
return s... | Make \G or \g to end a query. | Make \G or \g to end a query.
| Python | bsd-3-clause | j-bennet/mycli,jinstrive/mycli,mdsrosa/mycli,evook/mycli,shoma/mycli,chenpingzhao/mycli,mdsrosa/mycli,D-e-e-m-o/mycli,evook/mycli,jinstrive/mycli,martijnengler/mycli,webwlsong/mycli,webwlsong/mycli,oguzy/mycli,suzukaze/mycli,oguzy/mycli,danieljwest/mycli,MnO2/rediscli,danieljwest/mycli,martijnengler/mycli,D-e-e-m-o/myc... | ---
+++
@@ -25,6 +25,8 @@
return (text.startswith('\\') or # Special Command
text.endswith(';') or # Ended with a semi-colon
+ text.endswith('\\g') or # Ended with \g
+ text.endswith('\\G') or # Ended with \G
(text == 'exit') or # Exit doesn't... |
f268b5e62ca8bbf1712225d4c8d6d38580f38fba | quantum/__init__.py | quantum/__init__.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/l... | Make the quantum top-level a namespace package. | Make the quantum top-level a namespace package.
Change-Id: I8fa596dedcc72fcec73972f6bf158e53c17b7e6d
| Python | apache-2.0 | netscaler/neutron,mahak/neutron,miyakz1192/neutron,takeshineshiro/neutron,NeCTAR-RC/neutron,apporc/neutron,klmitch/neutron,JioCloud/neutron,skyddv/neutron,swdream/neutron,rossella/neutron,CiscoSystems/quantum,CiscoSystems/QL3Proto,aristanetworks/arista-ovs-quantum,psiwczak/quantum,eayunstack/neutron,liqin75/vse-vpnaas-... | ---
+++
@@ -0,0 +1,19 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2011 OpenStack LLC
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
... | |
b02d7e1e288eeaf38cfc299765f4c940bad5ea36 | examples/add_misc_features.py | examples/add_misc_features.py | #!/usr/bin/env python
#
# Add a singleton feature to the misc column of all tokens of a certain form.
#
# Format
# add_misc_features.py filename > transform.conll
#
import argparse
import pyconll
parser = argparse.ArgumentParser()
parser.add_argument('filename', help='The name of the file to transform')
args = pa... | #!/usr/bin/env python
#
# Add a singleton feature to the misc column of all tokens of a certain form.
#
# Format
# add_misc_features.py filename > transform.conll
#
import argparse
import pyconll
parser = argparse.ArgumentParser()
parser.add_argument('filename', help='The name of the file to transform')
args = pa... | Update example with correct form, and with comment. | Update example with correct form, and with comment.
| Python | mit | pyconll/pyconll,pyconll/pyconll | ---
+++
@@ -19,7 +19,10 @@
for sentence in corpus:
for token in sentence:
if token.lemma == 'dog' and token.upos == 'VERB':
- token.misc['Polysemous'] = True
+ # Note: This means that 'Polysemous' will be present as a singleton
+ # in the token line. To remove 'Polysemo... |
94e822e67f3550710347f563ae1d32e301d2e08b | raven/processors.py | raven/processors.py | """
raven.core.processors
~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
class Processor(object):
def __init__(self, client):
self.client = client
def process(self, data, **kwargs):
resp = self.get_... | """
raven.core.processors
~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
class Processor(object):
def __init__(self, client):
self.client = client
def process(self, data, **kwargs):
resp = self.get... | Handle var names that are uppercase | Handle var names that are uppercase
| Python | bsd-3-clause | smarkets/raven-python,patrys/opbeat_python,ronaldevers/raven-python,ronaldevers/raven-python,recht/raven-python,danriti/raven-python,lepture/raven-python,Goldmund-Wyldebeast-Wunderliebe/raven-python,nikolas/raven-python,akalipetis/raven-python,johansteffner/raven-python,beniwohli/apm-agent-python,dbravender/raven-pytho... | ---
+++
@@ -5,6 +5,7 @@
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
+
class Processor(object):
def __init__(self, client):
@@ -16,6 +17,7 @@
data = resp
return data
+
class SantizePasswordsProcessor(Process... |
26a53141e844c11e7ff904af2620b7ee125b011d | diana/tracking.py | diana/tracking.py | from . import packet as p
class Tracker:
def __init__(self):
self.objects = {}
def update_object(self, record):
try:
oid = record['object']
except KeyError:
return
else:
self.objects.setdefault(oid, {}).update(record)
def remove_object(s... | from . import packet as p
class Tracker:
def __init__(self):
self.objects = {}
@property
def player_ship(self):
for _obj in self.objects.values():
if _obj['type'] == p.ObjectType.player_vessel:
return _obj
return {}
def update_object(self, record):
... | Add a convenience method to get the player ship | Add a convenience method to get the player ship
| Python | mit | prophile/libdiana | ---
+++
@@ -3,6 +3,13 @@
class Tracker:
def __init__(self):
self.objects = {}
+
+ @property
+ def player_ship(self):
+ for _obj in self.objects.values():
+ if _obj['type'] == p.ObjectType.player_vessel:
+ return _obj
+ return {}
def update_object(sel... |
7ca4b1652dc5fa35bbacc2d587addacc9ce9da83 | fuzzinator/call_job.py | fuzzinator/call_job.py | # Copyright (c) 2016 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.
import hashlib
class CallJob(object):
"""
Base class for jobs... | # Copyright (c) 2016-2018 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.
import hashlib
class CallJob(object):
"""
Base class for... | Prepare test hashing for complex types. | Prepare test hashing for complex types.
| Python | bsd-3-clause | renatahodovan/fuzzinator,renatahodovan/fuzzinator,renatahodovan/fuzzinator,renatahodovan/fuzzinator,akosthekiss/fuzzinator,akosthekiss/fuzzinator,akosthekiss/fuzzinator,akosthekiss/fuzzinator | ---
+++
@@ -1,4 +1,4 @@
-# Copyright (c) 2016 Renata Hodovan, Akos Kiss.
+# Copyright (c) 2016-2018 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
@@ -32,7 +32,7 @@
# Generate default hash ID for the test if does not ... |
73a4aca6e9c0c4c9ef53e498319bf754c6bb8edb | rippl/rippl/urls.py | rippl/rippl/urls.py | """rippl URL Configuration"""
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
from .registration.forms import RecaptchaRegView
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^accounts/register/$', RecaptchaRegView.as_view()),
... | """rippl URL Configuration"""
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
from .registration.forms import RecaptchaRegView
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^accounts/register/$', RecaptchaRegView.as_view()),
... | Fix line length to pass CI | Fix line length to pass CI | Python | mit | gnmerritt/dailyrippl,gnmerritt/dailyrippl,gnmerritt/dailyrippl,gnmerritt/dailyrippl | ---
+++
@@ -11,7 +11,10 @@
url(r'^accounts/', include('registration.backends.simple.urls')),
url(r'^$', TemplateView.as_view(template_name='index.html')),
- url(r'^mission_statement', TemplateView.as_view(template_name='mission_statement.html')),
+ url(
+ r'^mission_statement',
+ Templ... |
089b1c3ab27bb5d3c343d7787a357c49ff56bfc8 | docs/conf.py | docs/conf.py | import sys
from os.path import dirname, abspath
sys.path.insert(0, dirname(dirname(abspath(__file__))))
from django.conf import settings
settings.configure()
project = 'django-slack'
version = ''
release = ''
copyright = '2014, 2015 Chris Lamb'
author = 'lamby'
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.inte... | import sys
from os.path import dirname, abspath
sys.path.insert(0, dirname(dirname(abspath(__file__))))
from django.conf import settings
settings.configure()
project = 'django-slack'
version = ''
release = ''
copyright = '2014, 2015 Chris Lamb'
author = 'lamby'
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.inte... | Fix a badly indented line. (PEP8 E121) | Fix a badly indented line. (PEP8 E121)
| Python | bsd-3-clause | lamby/django-slack | ---
+++
@@ -21,6 +21,6 @@
exclude_trees = ['_build']
templates_path = ['_templates']
latex_documents = [
- ('index', '%s.tex' % project, html_title, author, 'manual', True),
+ ('index', '%s.tex' % project, html_title, author, 'manual', True),
]
intersphinx_mapping = {'http://docs.python.org/': None} |
1b9d453f6fe0d2128849f98922f082d6ccfbee69 | channelfilter.py | channelfilter.py | #!/usr/bin/env python
import os
import yaml
class ChannelFilter(object):
def __init__(self, path=None):
if path is None:
path = os.path.join(os.path.dirname(__file__), 'channels.yaml')
with open(path) as f:
self.config = yaml.load(f)
print(self.config)
@prope... | #!/usr/bin/env python
import os
import yaml
class ChannelFilter(object):
def __init__(self, path=None):
if path is None:
path = os.path.join(os.path.dirname(__file__), 'channels.yaml')
with open(path) as f:
self.config = yaml.load(f)
print(self.config)
@prope... | Fix channel filtering to work properly | Fix channel filtering to work properly
| Python | mit | wikimedia/labs-tools-wikibugs2,wikimedia/labs-tools-wikibugs2 | ---
+++
@@ -25,18 +25,18 @@
channels = [self.default_channel, self.firehose_channel] + list(self.config['channels'])
return list(set(channels))
- def channels_for(self, project):
+ def channels_for(self, projects):
"""
- :param project: Get all channels to spam for the given ... |
8ddc1e40dd505aeb1b28d05238fa198eb3260f94 | fireplace/cards/tgt/hunter.py | fireplace/cards/tgt/hunter.py | from ..utils import *
##
# Minions
# Ram Wrangler
class AT_010:
play = Find(FRIENDLY_MINIONS + BEAST) & Summon(CONTROLLER, RandomBeast())
##
# Spells
# Lock and Load
class AT_061:
play = Buff(FRIENDLY_HERO, "AT_061e")
class AT_061e:
events = OWN_SPELL_PLAY.on(
Give(CONTROLLER, RandomCollectible(card_class=C... | from ..utils import *
##
# Minions
# Ram Wrangler
class AT_010:
play = Find(FRIENDLY_MINIONS + BEAST) & Summon(CONTROLLER, RandomBeast())
# Stablemaster
class AT_057:
play = Buff(TARGET, "AT_057o")
# Brave Archer
class AT_059:
inspire = Find(CONTROLLER_HAND) | Hit(ENEMY_HERO, 2)
##
# Spells
# Powershot
cla... | Implement more TGT Hunter cards | Implement more TGT Hunter cards
| Python | agpl-3.0 | smallnamespace/fireplace,Ragowit/fireplace,Ragowit/fireplace,amw2104/fireplace,NightKev/fireplace,liujimj/fireplace,jleclanche/fireplace,Meerkov/fireplace,oftc-ftw/fireplace,liujimj/fireplace,amw2104/fireplace,Meerkov/fireplace,oftc-ftw/fireplace,beheh/fireplace,smallnamespace/fireplace | ---
+++
@@ -9,8 +9,23 @@
play = Find(FRIENDLY_MINIONS + BEAST) & Summon(CONTROLLER, RandomBeast())
+# Stablemaster
+class AT_057:
+ play = Buff(TARGET, "AT_057o")
+
+
+# Brave Archer
+class AT_059:
+ inspire = Find(CONTROLLER_HAND) | Hit(ENEMY_HERO, 2)
+
+
##
# Spells
+
+# Powershot
+class AT_056:
+ play = Hi... |
f17da7465592eede8be261ed3f997881f596ef18 | examples/helloworld/helloworld.py | examples/helloworld/helloworld.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import deepzoom
# Specify your source image
SOURCE = "helloworld.jpg"
# Create Deep Zoom Image creator with weird parameters
creator = deepzoom.ImageCreator(tile_size=512, tile_overlap=2, tile_format="png",
image_quality=0.8, resize_filter... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import deepzoom
# Specify your source image
SOURCE = "helloworld.jpg"
# Create Deep Zoom Image creator with weird parameters
creator = deepzoom.ImageCreator(tile_size=128, tile_overlap=2, tile_format="png",
image_quality=0.8, resize_filter... | Tweak example image conversion settings. | Tweak example image conversion settings.
| Python | bsd-3-clause | uekeueke/deepzoom.py,edsilv/deepzoom.py,uekeueke/deepzoom.py,edsilv/deepzoom.py | ---
+++
@@ -7,7 +7,7 @@
SOURCE = "helloworld.jpg"
# Create Deep Zoom Image creator with weird parameters
-creator = deepzoom.ImageCreator(tile_size=512, tile_overlap=2, tile_format="png",
+creator = deepzoom.ImageCreator(tile_size=128, tile_overlap=2, tile_format="png",
image_qual... |
26e0d89e5178fb05b95f56cbef58ac37bfa6f1d9 | camera_opencv.py | camera_opencv.py | import cv2
from base_camera import BaseCamera
class Camera(BaseCamera):
video_source = 0
@staticmethod
def set_video_source(source):
Camera.video_source = source
@staticmethod
def frames():
camera = cv2.VideoCapture(Camera.video_source)
if not camera.isOpened():
... | import os
import cv2
from base_camera import BaseCamera
class Camera(BaseCamera):
video_source = 0
def __init__(self):
if os.environ.get('OPENCV_CAMERA_SOURCE'):
Camera.set_video_source(int(os.environ['OPENCV_CAMERA_SOURCE']))
super(Camera, self).__init__()
@staticmethod
... | Use OPENCV_CAMERA_SOURCE environment variable to set source | Use OPENCV_CAMERA_SOURCE environment variable to set source
| Python | mit | miguelgrinberg/flask-video-streaming,miguelgrinberg/flask-video-streaming | ---
+++
@@ -1,9 +1,15 @@
+import os
import cv2
from base_camera import BaseCamera
class Camera(BaseCamera):
video_source = 0
+
+ def __init__(self):
+ if os.environ.get('OPENCV_CAMERA_SOURCE'):
+ Camera.set_video_source(int(os.environ['OPENCV_CAMERA_SOURCE']))
+ super(Camera, s... |
b41ac0e6a5f4518b261b9106c2fbce7c55b3b9a5 | python/test/test_survey_submit.py | python/test/test_survey_submit.py | #!/usr/bin/env python
import sys
sys.path += ['../']
from epidb.client import EpiDBClient
data = 'data'
client = EpiDBClient()
res = client.survey_submit(data)
print res
| #!/usr/bin/env python
import sys
sys.path += ['../']
from epidb.client import EpiDBClient
key = '0123456789abcdef0123456789abcdef01234567'
data = 'data'
client = EpiDBClient(key)
res = client.survey_submit(data)
print res
| Update example to use api-key. | [python] Update example to use api-key.
| Python | agpl-3.0 | ISIFoundation/influenzanet-epidb-client | ---
+++
@@ -5,9 +5,10 @@
from epidb.client import EpiDBClient
+key = '0123456789abcdef0123456789abcdef01234567'
data = 'data'
-client = EpiDBClient()
+client = EpiDBClient(key)
res = client.survey_submit(data)
print res |
8dc4245db8e64fd5024e1d6fe0bc1b230b2dce85 | server/cg/manage.py | server/cg/manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cg.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cg.settings.dev")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Set default settings to dev | Set default settings to dev
| Python | mit | pramodliv1/conceptgrapher,pramodliv1/conceptgrapher,pramodliv1/conceptgrapher | ---
+++
@@ -3,7 +3,7 @@
import sys
if __name__ == "__main__":
- os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cg.settings")
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cg.settings.dev")
from django.core.management import execute_from_command_line
|
f034f69a24cd2a4048e23c54c73badd0674eb1aa | views/base.py | views/base.py | from datetime import datetime, timedelta
from flask import Blueprint, render_template
from sqlalchemy import and_
from models import Event
blueprint = Blueprint("base", __name__)
@blueprint.route("/")
def index():
upcoming = Event.query.filter_by(published=True).order_by(Event.start_time).first()
return re... | from datetime import datetime, timedelta
from flask import Blueprint, render_template
from sqlalchemy import and_
from models import Event
blueprint = Blueprint("base", __name__)
@blueprint.route("/")
def index():
upcoming = Event.query.filter_by(published=True).order_by(Event.start_time).first()
return re... | Fix the events page, so that upcoming event shows up. | Fix the events page, so that upcoming event shows up.
| Python | mit | saseumn/website,saseumn/website | ---
+++
@@ -21,5 +21,8 @@
@blueprint.route("/events")
def events():
- eventlist = Event.query.filter(and_(Event.published is True, Event.start_time < (datetime.now() + timedelta(seconds=1)))).order_by(Event.start_time.desc()).all()
+ next_event = Event.query.filter(and_(Event.published == True, Event.start_... |
3f48d0fb0e44d35f29990c0d32c032ecee8fbe65 | conftest.py | conftest.py | import os
from django import get_version
from django.conf import settings
def pytest_report_header(config):
return 'django: ' + get_version()
def pytest_configure():
if not settings.configured:
os.environ['DJANGO_SETTINGS_MODULE'] = 'base.settings'
os.environ['DJANGO_CONFIGURATION'] = 'Test... | import os
from django import get_version
from django.conf import settings
def pytest_report_header(config):
return 'django: ' + get_version()
def pytest_configure():
import dotenv
dotenv.read_dotenv()
if not settings.configured:
os.environ['DJANGO_SETTINGS_MODULE'] = 'base.settings'
... | Read our .env when we test. | Read our .env when we test.
| Python | apache-2.0 | hello-base/web,hello-base/web,hello-base/web,hello-base/web | ---
+++
@@ -9,6 +9,9 @@
def pytest_configure():
+ import dotenv
+ dotenv.read_dotenv()
+
if not settings.configured:
os.environ['DJANGO_SETTINGS_MODULE'] = 'base.settings'
os.environ['DJANGO_CONFIGURATION'] = 'Testing' |
8a663ecc384a1b0d43f554b894571103348ad7ab | responsive_design_helper/views.py | responsive_design_helper/views.py | from django.views.generic import TemplateView
class ResponsiveTestView(TemplateView):
template_name = "responsive_design_helper/%s.html"
def get_template_names(self, **kwargs):
t = self.kwargs.get('type', 'all') or 'all'
return self.template_name % t
def get_context_data(self, **kwargs):... | from django.views.generic import TemplateView
class ResponsiveTestView(TemplateView):
template_name = "responsive_design_helper/%s.html"
def get_template_names(self, **kwargs):
t = self.kwargs.get('type', 'all') or 'all'
return self.template_name % t
def get_context_data(self, **kwargs):... | Adjust so it works properly with types | Adjust so it works properly with types
| Python | apache-2.0 | tswicegood/django-responsive-design-helper,tswicegood/django-responsive-design-helper | ---
+++
@@ -10,6 +10,6 @@
def get_context_data(self, **kwargs):
context = super(ResponsiveTestView, self).get_context_data(**kwargs)
- url_to_test = self.request.build_absolute_uri()[0:-len("responsive/")]
- context["url_to_test"] = url_to_test
+ url = self.request.build_absolute_... |
005ac5832a4992c2d1091505c2be10ae6ad34ef5 | seleniumbase/config/proxy_list.py | seleniumbase/config/proxy_list.py | """
Proxy Server "Phone Book".
Simplify running browser tests through a proxy server
by adding your frequently-used proxies here.
Now you can do something like this on the command line:
"pytest SOME_TEST.py --proxy=proxy1"
Format of PROXY_LIST server entries:
* "ip_address:port" OR "username:password@ip_address:po... | """
Proxy Server "Phone Book".
Simplify running browser tests through a proxy server
by adding your frequently-used proxies here.
Now you can do something like this on the command line:
"pytest SOME_TEST.py --proxy=proxy1"
Format of PROXY_LIST server entries:
* "ip_address:port" OR "username:password@ip_address:po... | Update the example proxy list | Update the example proxy list
| Python | mit | mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase | ---
+++
@@ -22,8 +22,8 @@
"""
PROXY_LIST = {
- "example1": "152.26.66.140:3128", # (Example) - set your own proxy here
- "example2": "64.235.204.107:8080", # (Example) - set your own proxy here
+ "example1": "152.179.12.86:3128", # (Example) - set your own proxy here
+ "example2": "176.9.79.126:312... |
eda35123356edd20b361aa2f1d1f20cc7b922e39 | settings_example.py | settings_example.py | import os
import re
from imap import EmailCheckError, EmailServer
from postgresql import DatabaseServer
CSV_FOLDER = os.getcwd()
# Restrict emails by sender.
EMAIL_FROM = 'sender@example.com'
# Restrict emails by subject.
EMAIL_SUBJECT_RE = re.compile(''.join([
r'(?P<year>\d{4})',
r'(?P<month>\d{2})',
r'(?P<day... | import os
import re
from imap import EmailCheckError, EmailServer
from postgresql import DatabaseServer
CSV_FOLDER = os.getcwd()
CSV_NAME_FORMAT = '{year}-{month}-{day}T{hour}{minute}.csv'
# Restrict emails by sender.
EMAIL_FROM = 'sender@example.com'
# Restrict emails by subject.
EMAIL_SUBJECT_RE = re.compile(''... | Add CSV file name format setting example | Add CSV file name format setting example
| Python | mit | AustralianAntarcticDataCentre/save_emails_to_files,AustralianAntarcticDataCentre/save_emails_to_files | ---
+++
@@ -6,6 +6,8 @@
CSV_FOLDER = os.getcwd()
+
+CSV_NAME_FORMAT = '{year}-{month}-{day}T{hour}{minute}.csv'
# Restrict emails by sender.
EMAIL_FROM = 'sender@example.com' |
020d6e2bff5975aad79833bdf28c6a791e7953d1 | instabrade/__init__.py | instabrade/__init__.py | from __future__ import absolute_import
from collections import namedtuple
import pbr.version
__version__ = pbr.version.VersionInfo('instabrade').version_string()
PageID = namedtuple("PageID", "name css_path attr attr_value")
LOG_IN_IDENTIFIER = PageID(name='Log In Page Identifier',
css_... | from __future__ import absolute_import
from collections import namedtuple
from pbr.version import VersionInfo
__version__ = VersionInfo('instabrade').semantic_version().release_string()
PageID = namedtuple("PageID", "name css_path attr attr_value")
LOG_IN_IDENTIFIER = PageID(name='Log In Page Identifier',
... | Update how version is determined | Update how version is determined
| Python | mit | levi-rs/instabrade | ---
+++
@@ -2,10 +2,9 @@
from collections import namedtuple
-import pbr.version
+from pbr.version import VersionInfo
-
-__version__ = pbr.version.VersionInfo('instabrade').version_string()
+__version__ = VersionInfo('instabrade').semantic_version().release_string()
PageID = namedtuple("PageID", "name css_pa... |
438d78058951179f947480b0340752fa9b372a9d | sqs.py | sqs.py | from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPClient
from tornado.httputil import url_concat
import datetime
import hashlib
import hmac
class SQSRequest(HTTPRequest):
"""SQS AWS Adapter for Tornado HTTP request"""
def __init__(self, *args, **kwargs):
super(SQSRequest, self).__init__... | from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPClient
from tornado.httputil import url_concat
import datetime
import hashlib
import hmac
class SQSRequest(HTTPRequest):
"""SQS AWS Adapter for Tornado HTTP request"""
def __init__(self, *args, **kwargs):
t = datetime.datetime.utcnow()
... | Add init code to deal with AWS HTTP API | Add init code to deal with AWS HTTP API
| Python | mit | MA3STR0/AsyncAWS | ---
+++
@@ -8,5 +8,16 @@
class SQSRequest(HTTPRequest):
"""SQS AWS Adapter for Tornado HTTP request"""
def __init__(self, *args, **kwargs):
+ t = datetime.datetime.utcnow()
+ method = kwargs.get('method', 'GET')
+ url = kwargs.get('url') or args[0]
+ params = sorted(url.split('?... |
d5c65f6ac2cdae3310f41efb9ab0a6d5cae63357 | kopytka/managers.py | kopytka/managers.py | from django.db import models
class PageQuerySet(models.QuerySet):
def published(self):
return self.filter(is_published=True)
| from django.db import models
from .transforms import SKeys
class PageQuerySet(models.QuerySet):
def published(self):
return self.filter(is_published=True)
def fragment_keys(self):
return self.annotate(keys=SKeys('fragments')).values_list('keys', flat=True)
| Add fragment_keys method to PageQuerySet | Add fragment_keys method to PageQuerySet
| Python | mit | funkybob/kopytka,funkybob/kopytka,funkybob/kopytka | ---
+++
@@ -1,7 +1,11 @@
from django.db import models
+from .transforms import SKeys
class PageQuerySet(models.QuerySet):
def published(self):
return self.filter(is_published=True)
+
+ def fragment_keys(self):
+ return self.annotate(keys=SKeys('fragments')).values_list('keys', flat=Tru... |
4bf7f15896677b1ffb5678710086e13ff0c3e094 | PyFVCOM/__init__.py | PyFVCOM/__init__.py | """
The FVCOM Python toolbox (PyFVCOM)
"""
__version__ = '1.6.2'
__author__ = 'Pierre Cazenave'
__credits__ = ['Pierre Cazenave']
__license__ = 'MIT'
__maintainer__ = 'Pierre Cazenave'
__email__ = 'pica@pml.ac.uk'
import inspect
from warnings import warn
# Import everything!
from PyFVCOM import buoy_tools
from PyFV... | """
The FVCOM Python toolbox (PyFVCOM)
"""
__version__ = '1.6.2'
__author__ = 'Pierre Cazenave'
__credits__ = ['Pierre Cazenave']
__license__ = 'MIT'
__maintainer__ = 'Pierre Cazenave'
__email__ = 'pica@pml.ac.uk'
import inspect
from warnings import warn
# Import everything!
from PyFVCOM import buoy_tools
from PyFV... | Fix sorting of the imports. | Fix sorting of the imports.
| Python | mit | pwcazenave/PyFVCOM | ---
+++
@@ -25,7 +25,7 @@
from PyFVCOM import stats_tools
from PyFVCOM import tidal_ellipse
from PyFVCOM import tide_tools
+from PyFVCOM import plot
from PyFVCOM import process_results
from PyFVCOM import read_results
-from PyFVCOM import plot
from PyFVCOM import utilities |
fcad1fa7187fe81d80b8861df2851402be01b667 | PyFVCOM/__init__.py | PyFVCOM/__init__.py | """
The FVCOM Python toolbox (PyFVCOM)
"""
__version__ = '2.0.0'
__author__ = 'Pierre Cazenave'
__credits__ = ['Pierre Cazenave']
__license__ = 'MIT'
__maintainer__ = 'Pierre Cazenave'
__email__ = 'pica@pml.ac.uk'
import inspect
from warnings import warn
# Import everything!
from PyFVCOM import buoy
from PyFVCOM im... | """
The FVCOM Python toolbox (PyFVCOM)
"""
__version__ = '2.0.0'
__author__ = 'Pierre Cazenave'
__credits__ = ['Pierre Cazenave', 'Michael Bedington']
__license__ = 'MIT'
__maintainer__ = 'Pierre Cazenave'
__email__ = 'pica@pml.ac.uk'
import inspect
from warnings import warn
# Import everything!
from PyFVCOM import... | Add Mike as a contributor. | Add Mike as a contributor.
| Python | mit | pwcazenave/PyFVCOM | ---
+++
@@ -5,7 +5,7 @@
__version__ = '2.0.0'
__author__ = 'Pierre Cazenave'
-__credits__ = ['Pierre Cazenave']
+__credits__ = ['Pierre Cazenave', 'Michael Bedington']
__license__ = 'MIT'
__maintainer__ = 'Pierre Cazenave'
__email__ = 'pica@pml.ac.uk' |
cf2615c2488198bd9f904a4e65ac4fc0e0d6c475 | insertion.py | insertion.py | import timeit
def insertion(_list):
'''Sorts a list via the insertion method.'''
if type(_list) is not list:
raise TypeError('Entire list must be numbers')
for i in range(1, len(_list)):
key = _list[i]
if not isinstance(key, int):
raise TypeError('Entire list must be nu... | import time
def timed_func(func):
"""Decorator for timing our traversal methods."""
def timed(*args, **kwargs):
start = time.time()
result = func(*args, **kwargs)
elapsed = time.time() - start
# print "time expired: %s" % elapsed
return (result, elapsed)
return time... | Add timing to show time complexity. | Add timing to show time complexity.
| Python | mit | bm5w/second_dataS | ---
+++
@@ -1,5 +1,18 @@
-import timeit
+import time
+
+def timed_func(func):
+ """Decorator for timing our traversal methods."""
+ def timed(*args, **kwargs):
+ start = time.time()
+ result = func(*args, **kwargs)
+ elapsed = time.time() - start
+ # print "time expired: %s" % elap... |
fb8db56ca83a18860ed1ae279d3f390456e224fe | cinder/brick/initiator/host_driver.py | cinder/brick/initiator/host_driver.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apac... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apac... | Check if dir exists before calling listdir | Check if dir exists before calling listdir
Changes along the way to how we clean up and detach after
copying an image to a volume exposed a problem in the cleanup
of the brick/initiator routines.
The clean up in the initiator detach was doing a blind listdir
of /dev/disk/by-path, however due to detach and cleanup bei... | Python | apache-2.0 | rickerc/cinder_audit,rickerc/cinder_audit | ---
+++
@@ -22,8 +22,10 @@
def get_all_block_devices(self):
"""Get the list of all block devices seen in /dev/disk/by-path/."""
+ files = []
dir = "/dev/disk/by-path/"
- files = os.listdir(dir)
+ if os.path.isdir(dir):
+ files = os.listdir(dir)
devices... |
d7157d2999a4d9a8f624c3b509726b49d9193a01 | conllu/compat.py | conllu/compat.py | try:
from io import StringIO
except ImportError:
from StringIO import StringIO
try:
FileNotFoundError = FileNotFoundError
except NameError:
FileNotFoundError = IOError
try:
from contextlib import redirect_stdout
except ImportError:
import contextlib
import sys
@contextlib.contextmanag... | from io import StringIO
try:
FileNotFoundError = FileNotFoundError
except NameError:
FileNotFoundError = IOError
try:
from contextlib import redirect_stdout
except ImportError:
import contextlib
import sys
@contextlib.contextmanager
def redirect_stdout(target):
original = sys.stdo... | Remove special case from StringIO. | Remove special case from StringIO.
| Python | mit | EmilStenstrom/conllu | ---
+++
@@ -1,7 +1,4 @@
-try:
- from io import StringIO
-except ImportError:
- from StringIO import StringIO
+from io import StringIO
try:
FileNotFoundError = FileNotFoundError |
d1e1ce5612e1437b2776043f3b6276be5b1d25a6 | csv_converter.py | csv_converter.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
class CsvConverter:
def __init__(self, csv_file_path):
self.csv_file_path = csv_file_path
self.rows = []
self.source_product_code = "product_code"
self.source_quantity = "quantity"
def clear(self):
self.rows = [... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
class CsvConverter:
def __init__(self, csv_file_path):
self.csv_file_path = csv_file_path
self.rows = []
self.source_product_code = "product_code"
self.source_quantity = "quantity"
def clear(self):
self.rows = [... | Add checking empty product code | Add checking empty product code
| Python | mit | stormaaja/csvconverter,stormaaja/csvconverter,stormaaja/csvconverter | ---
+++
@@ -29,8 +29,10 @@
self.target_quantity = target_quantity
def convertRow(self, row):
+ if not row[self.source_product_code]:
+ raise ValueError
return {
- 'product_code': int(row[self.source_product_code]),
+ 'product_code': row[self.source_prod... |
d78188713ffd3e36514ba0db5f74bae111e6a7dc | calc.py | calc.py | """calc.py: A simple calculator."""
import sys
def add_all(nums):
return sum(nums)
def multiply_all(nums):
return reduce(lambda a, b: a * b, nums)
if __name__ == '__main__':
command = sys.argv[1]
nums = map(float, sys.argv[2:])
if command == 'add':
print(add_all(nums))
elif command =... | """calc.py: A simple calculator."""
import sys
def add_all(nums):
return sum(nums)
def multiply_all(nums):
return reduce(lambda a, b: a * b, nums)
if __name__ == '__main__':
command = sys.argv[1]
nums = map(float, sys.argv[2:])
if command == 'add':
print(add_all(nums))
elif command =... | Add usage string for fallthrough cases | Add usage string for fallthrough cases
| Python | bsd-3-clause | mkuiper/calc-1 | ---
+++
@@ -15,3 +15,6 @@
print(add_all(nums))
elif command == 'multiply':
print(multiply_all(nums))
+ else:
+ usage = "calc.py [add|multiply] NUM1 [NUM2 [NUM3 [...]]]"
+ print(usage) |
b43504e09881a92525ae18ef76591f7c2ebe5f8c | newsman/watchdog/clean_process.py | newsman/watchdog/clean_process.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
clean zombie processes
"""
# @author chengdujin
# @contact chengdujin@gmail.com
# @created Aug. 22, 2013
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
import subprocess
def clean():
"""
kill zombie processes if there is any
"""
command ... | #!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
clean zombie processes
"""
# @author chengdujin
# @contact chengdujin@gmail.com
# @created Aug. 22, 2013
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
import subprocess
def clean():
"""
kill zombie processes if there is any
"""
command ... | Change process killing from -9 to -15 | Change process killing from -9 to -15
| Python | agpl-3.0 | chengdujin/newsman,chengdujin/newsman,chengdujin/newsman | ---
+++
@@ -23,7 +23,7 @@
command = "kill -HUP `ps -A -ostat,ppid | grep -e '^[Zz]' | awk '{print $2}'`"
subprocess.Popen(command, stderr=subprocess.PIPE, shell=True)
- command = "ps -xal | grep p[y]thon | grep '<defunct>' | awk '{print $4}' | xargs kill -9"
+ command = "ps -xal | grep p[y]thon | gr... |
3ac6f578397235e8eda686fe3589cda780af53d5 | ginga/qtw/Plot.py | ginga/qtw/Plot.py | #
# Plot.py -- Plotting function for Ginga FITS viewer.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
# GUI imports
from ginga.qtw.QtHelp import QtGui, QtCore
from g... | #
# Plot.py -- Plotting function for Ginga FITS viewer.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
# GUI imports
from ginga.qtw.QtHelp import QtGui, QtCore
from g... | Fix for import error with matplotlib Qt4Agg backend | Fix for import error with matplotlib Qt4Agg backend
| Python | bsd-3-clause | stscieisenhamer/ginga,ejeschke/ginga,sosey/ginga,Cadair/ginga,rupak0577/ginga,eteq/ginga,rajul/ginga,ejeschke/ginga,pllim/ginga,ejeschke/ginga,sosey/ginga,naojsoft/ginga,naojsoft/ginga,Cadair/ginga,rupak0577/ginga,rajul/ginga,eteq/ginga,stscieisenhamer/ginga,rupak0577/ginga,pllim/ginga,sosey/ginga,stscieisenhamer/ginga... | ---
+++
@@ -13,12 +13,12 @@
from ginga.toolkit import toolkit
import matplotlib
-if toolkit in ('qt', 'qt4'):
- from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg \
- as FigureCanvas
-elif toolkit == 'qt5':
+if toolkit == 'qt5':
# qt5 backend is not yet released in matplotlib stable
... |
8ccbddffc2c41cbe623439c76cfde7097f5fa801 | nighttrain/utils.py | nighttrain/utils.py | # Copyright 2017 Codethink Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | # Copyright 2017 Codethink Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | Fix crash when there are no includes for a task | Fix crash when there are no includes for a task
| Python | apache-2.0 | ssssam/nightbus,ssssam/nightbus | ---
+++
@@ -16,8 +16,8 @@
'''Utility functions.'''
-def ensure_list(string_or_list):
- if isinstance(string_or_list, str):
- return [string_or_list]
+def ensure_list(string_or_list_or_none):
+ if isinstance(string_or_list_or_none, str):
+ return [string_or_list_or_none]
else:
- re... |
f0b27af3cc09808146442c94df7c76127776acf8 | gslib/devshell_auth_plugin.py | gslib/devshell_auth_plugin.py | # -*- coding: utf-8 -*-
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | # -*- coding: utf-8 -*-
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | Fix provider check causing Devshell auth failure | Fix provider check causing Devshell auth failure
This commit builds on commit 13c4926, allowing Devshell credentials to
be used only with Google storage.
| Python | apache-2.0 | GoogleCloudPlatform/gsutil,GoogleCloudPlatform/gsutil,fishjord/gsutil,BrandonY/gsutil | ---
+++
@@ -30,7 +30,9 @@
capability = ['s3']
def __init__(self, path, config, provider):
- if provider != 'gs':
+ # Provider here is a boto.provider.Provider object (as opposed to the
+ # provider attribute of CloudApi objects, which is a string).
+ if provider.name != 'google':
# Devshell... |
519a5afc8c8561166f4d8fb0ca43f0ff35a0389b | addons/hr_payroll_account/__manifest__.py | addons/hr_payroll_account/__manifest__.py | #-*- coding:utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Payroll Accounting',
'category': 'Human Resources',
'description': """
Generic Payroll system Integrated with Accounting.
==================================================
* Expense Encoding
... | #-*- coding:utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Payroll Accounting',
'category': 'Human Resources',
'description': """
Generic Payroll system Integrated with Accounting.
==================================================
* Expense Encoding
... | Remove useless dependency to hr_expense | [IMP] hr_payroll_account: Remove useless dependency to hr_expense
| Python | agpl-3.0 | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo | ---
+++
@@ -11,7 +11,7 @@
* Payment Encoding
* Company Contribution Management
""",
- 'depends': ['hr_payroll', 'account', 'hr_expense'],
+ 'depends': ['hr_payroll', 'account'],
'data': ['views/hr_payroll_account_views.xml'],
'demo': ['data/hr_payroll_account_demo.xml'],
'test': ['... |
84f111f6b5029fc86645311866310b5de48a39e3 | mqo_program/__openerp__.py | mqo_program/__openerp__.py | # -*- coding: utf-8 -*-
{
'name': "MQO Programs",
'summary': """Manage programs""",
'description': """
MQO module for managing programs:
""",
'author': "Your Company",
'website': "http://www.yourcompany.com",
# Categories can be used to filter modules in modules list... | # -*- coding: utf-8 -*-
{
'name': "MQO Programs",
'summary': """Manage programs""",
'description': """
MQO module for managing programs:
""",
'author': "Your Company",
'website': "http://www.yourcompany.com",
# Categories can be used to filter modules in modules list... | Add required dependency to mqo_programs. | [IMP] Add required dependency to mqo_programs. | Python | agpl-3.0 | drummingbird/mqo,drummingbird/mqo | ---
+++
@@ -18,7 +18,7 @@
'version': '0.1',
# any module necessary for this one to work correctly
- 'depends': ['base'],
+ 'depends': ['base', 'mqo_website'],
# always loaded
'data': [ |
671a932682f37912b11413f989ad52cf6b046ed6 | basex-api/src/main/python/QueryExample.py | basex-api/src/main/python/QueryExample.py | # This example shows how queries can be executed in an iterative manner.
# Iterative evaluation will be slower, as more server requests are performed.
#
# Documentation: http://docs.basex.org/wiki/Clients
#
# (C) BaseX Team 2005-12, BSD License
import BaseXClient, time
try:
# create session
session = B... | # This example shows how queries can be executed in an iterative manner.
# Iterative evaluation will be slower, as more server requests are performed.
#
# Documentation: http://docs.basex.org/wiki/Clients
#
# (C) BaseX Team 2005-12, BSD License
import BaseXClient, time
try:
# create session
session = B... | Fix a bug on a query example for python | Fix a bug on a query example for python
Methods used by the former example, `query.more()` and `query.next()`, do not exist any longer.
I've modified them to `query.execute()`, according to `BaseXClient.py`, to make it run as good as it should be. | Python | bsd-3-clause | ksclarke/basex,deshmnnit04/basex,dimitarp/basex,joansmith/basex,joansmith/basex,dimitarp/basex,ksclarke/basex,drmacro/basex,dimitarp/basex,dimitarp/basex,BaseXdb/basex,joansmith/basex,vincentml/basex,drmacro/basex,joansmith/basex,BaseXdb/basex,BaseXdb/basex,JensErat/basex,joansmith/basex,JensErat/basex,ksclarke/basex,J... | ---
+++
@@ -16,9 +16,7 @@
input = "for $i in 1 to 10 return <xml>Text { $i }</xml>"
query = session.query(input)
- # loop through all results
- while query.more():
- print query.next()
+ print query.execute()
# close query object
query.close() |
c6cf2fbe34f536f4c2f25e7359c6cdf1d05a55cb | image_analysis.py | image_analysis.py | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 25 15:19:55 2017
@author: vostok
"""
import os
import tempfile
from astropy.io import fits
def extract_stars(input_array):
(infilehandle, infilepath) = tempfile.mkstemp(suffix='.fits')
os.close(infilehandle)
fits.writeto(infilepath, \
input... | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 25 15:19:55 2017
@author: vostok
"""
import os
import tempfile
from astropy.io import fits
def extract_stars(input_array):
(infilehandle, infilepath) = tempfile.mkstemp(suffix='.fits')
os.close(infilehandle)
fits.writeto(infilepath, \
input... | Fix extracted star coordinates from 1- to 0-based indexing | Fix extracted star coordinates from 1- to 0-based indexing
Note that center of first pixel is 0, ie. edge of first pixel is -0.5
| Python | mit | lkangas/python-tycho2 | ---
+++
@@ -25,5 +25,8 @@
result = fits.open(infilepath.replace('.fits', '.xy.fits'))[1].data
os.unlink(infilepath)
-
+
+ result['X'] -= 1
+ result['Y'] -= 1
+
return result |
5b4684b3a5b2c37c23fb83bc14ceda6cf7c01412 | ironic/tests/unit/__init__.py | ironic/tests/unit/__init__.py | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a ... | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a ... | Stop adding translation function to builtins | Stop adding translation function to builtins
In unittests __init__ translation function is still being added to
builtins, this is not required anymore as it is not being installed.
Change-Id: I19da395b72622a6db348f5a6dd569c7747eaa40d
| Python | apache-2.0 | SauloAislan/ironic,NaohiroTamura/ironic,openstack/ironic,pshchelo/ironic,hpproliant/ironic,devananda/ironic,ionutbalutoiu/ironic,dims/ironic,bacaldwell/ironic,ionutbalutoiu/ironic,bacaldwell/ironic,NaohiroTamura/ironic,openstack/ironic,pshchelo/ironic,dims/ironic,SauloAislan/ironic | ---
+++
@@ -27,8 +27,3 @@
import eventlet
eventlet.monkey_patch(os=False)
-
-# See http://code.google.com/p/python-nose/issues/detail?id=373
-# The code below enables nosetests to work with i18n _() blocks
-import six.moves.builtins as __builtin__
-setattr(__builtin__, '_', lambda x: x) |
35c66f3ade85b6b7b4e19c95b0d6a09e53b12bee | src/pip/_internal/models/index.py | src/pip/_internal/models/index.py | from pip._vendor.six.moves.urllib import parse as urllib_parse
class PackageIndex(object):
"""Represents a Package Index and provides easier access to endpoints
"""
def __init__(self, url, file_storage_domain):
super(PackageIndex, self).__init__()
self.url = url
self.netloc = urll... | from pip._vendor.six.moves.urllib import parse as urllib_parse
class PackageIndex(object):
"""Represents a Package Index and provides easier access to endpoints
"""
def __init__(self, url, file_storage_domain):
super(PackageIndex, self).__init__()
self.url = url
self.netloc = urll... | Fix a mistake made while merging | Fix a mistake made while merging
| Python | mit | xavfernandez/pip,rouge8/pip,pfmoore/pip,techtonik/pip,rouge8/pip,pradyunsg/pip,pypa/pip,rouge8/pip,xavfernandez/pip,xavfernandez/pip,sbidoul/pip,techtonik/pip,pypa/pip,pradyunsg/pip,pfmoore/pip,sbidoul/pip,techtonik/pip | ---
+++
@@ -17,7 +17,7 @@
# block such packages themselves
self.file_storage_domain = file_storage_domain
- def url_to_path(self, path):
+ def _url_to_path(self, path):
return urllib_parse.urljoin(self.url, path)
|
73660f4f539a1aeb520c33112cfc41183e4dd43a | luigi/tasks/rfam/clans_csv.py | luigi/tasks/rfam/clans_csv.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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 requir... | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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 requir... | Use MysqlQueryTask for getting clan data | Use MysqlQueryTask for getting clan data
| Python | apache-2.0 | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline | ---
+++
@@ -17,20 +17,21 @@
import luigi
-from databases.rfam.clans import parse
+from databases.rfam import clans
from tasks.config import rfam
-from tasks.utils.fetch import FetchTask
from tasks.utils.writers import CsvOutput
+from tasks.utils.mysql import MysqlQueryTask
class RfamClansCSV(luigi.Tas... |
d0ccfd4558b9dcf1610140c9df95cec284f0fbe3 | correos_project/correos/managers.py | correos_project/correos/managers.py | from email import message_from_string, utils
import json
from django.db import models
from dateutil.parser import parse
class EmailManager(models.Manager):
def create_from_message(self, mailfrom, rcpttos, data):
from .models import Recipient
message = message_from_string(data)
realnames =... | from email import message_from_string, utils
import json
from django.db import models
from dateutil.parser import parse
class EmailManager(models.Manager):
def create_from_message(self, mailfrom, rcpttos, data):
from .models import Recipient
message = message_from_string(data)
realnames =... | Use email username if no realname is found in header | Use email username if no realname is found in header
| Python | bsd-3-clause | transcode-de/correos,transcode-de/correos,transcode-de/correos | ---
+++
@@ -12,6 +12,8 @@
realnames = {}
for rcptto in message['To'].split(','):
realname, email = utils.parseaddr(rcptto)
+ if len(realname) == 0:
+ realname = email.split('@')[0]
realnames[email] = realname
emails = []
for rcptt... |
b8b18160e4dad9d87bfdf4207b3cf4841af0140d | examples/dot/dot.py | examples/dot/dot.py | """\
Usage:
dot.py [options] [<path>] [<address>]
dot.py -h | --help
dot.py --version
Where:
<path> is the file to serve
<address> is what to listen on, of the form <host>[:<port>], or just <port>
"""
import sys
from docopt import docopt
from path_and_address import resolve, split_address
def main(args=No... | """\
Usage:
dot.py [options] [<path>] [<address>]
dot.py -h | --help
dot.py --version
Where:
<path> is the file to serve
<address> is what to listen on, of the form <host>[:<port>], or just <port>
"""
import sys
from docopt import docopt
from path_and_address import resolve, split_address
def main(args=No... | Add validation to example script. | Add validation to example script.
| Python | mit | joeyespo/path-and-address | ---
+++
@@ -26,6 +26,12 @@
path, address = resolve(args['<path>'], args['<address>'])
host, port = split_address(address)
+ # Validate arguments
+ if address and not (host or port):
+ print 'Error: Invalid address', repr(address)
+ return
+
+ # Default values
if path is None:
... |
446a760261ce4f8e8e210b2a29324c749f2bfdfb | inspector/urls.py | inspector/urls.py | from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from cbv.views import HomeView, Sitemap
admin.autodiscover()
urlpatterns = [
url(r'^$', HomeView.as_view(), name='... | from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from cbv.views import HomeView, Sitemap
urlpatterns = [
url(r'^$', HomeView.as_view(), name='home'),
url(r'^proje... | Remove admin autodiscovery since Django does that for us now | Remove admin autodiscovery since Django does that for us now
| Python | bsd-2-clause | refreshoxford/django-cbv-inspector,refreshoxford/django-cbv-inspector,refreshoxford/django-cbv-inspector,refreshoxford/django-cbv-inspector | ---
+++
@@ -5,10 +5,6 @@
from django.views.generic import TemplateView
from cbv.views import HomeView, Sitemap
-
-
-admin.autodiscover()
-
urlpatterns = [
url(r'^$', HomeView.as_view(), name='home'), |
66091bae24425c633d60dabfa1d1ee85869b20cb | platformio/debug/config/native.py | platformio/debug/config/native.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | Disable GDB "startup-with-shell" only on Unix platform | Disable GDB "startup-with-shell" only on Unix platform
| Python | apache-2.0 | platformio/platformio-core,platformio/platformio-core,platformio/platformio | ---
+++
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from platformio.compat import IS_WINDOWS
from platformio.debug.config.base import DebugConfigBase
@@ -28,5 +29,6 @@
end
$INIT_BREAK
-set startup-with-shell off
-"""
+""" + (
+... |
e80817032456fe4fb6ea4735abc0ca0b5bc18ddd | facenet/__init__.py | facenet/__init__.py | # Copyright 2015 Carnegie Mellon University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | # Copyright 2015 Carnegie Mellon University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | Return the vector rather than printing it. | Python: Return the vector rather than printing it.
| Python | apache-2.0 | francisleunggie/openface,sahilshah/openface,cmusatyalab/openface,sahilshah/openface,cmusatyalab/openface,nmabhi/Webface,Alexx-G/openface,nhzandi/openface,nmabhi/Webface,xinfang/face-recognize,nhzandi/openface,nmabhi/Webface,francisleunggie/openface,xinfang/face-recognize,Alexx-G/openface,xinfang/face-recognize,Alexx-G/... | ---
+++
@@ -27,4 +27,4 @@
def forward(self, imgPath, timeout=10):
self.p.stdin.write(imgPath+"\n")
- print([float(x) for x in self.p.stdout.readline().strip().split(',')])
+ return [float(x) for x in self.p.stdout.readline().strip().split(',')] |
1feed219746a2963bddc6080a5d8e9e467e50fa7 | py/g1/networks/servers/g1/networks/servers/__init__.py | py/g1/networks/servers/g1/networks/servers/__init__.py | __all__ = [
'SocketServer',
]
import errno
import logging
from g1.asyncs.bases import servers
from g1.asyncs.bases import tasks
LOG = logging.getLogger(__name__)
LOG.addHandler(logging.NullHandler())
class SocketServer:
def __init__(self, socket, handler, max_connections=0):
self._socket = socket
... | __all__ = [
'SocketServer',
]
import errno
import logging
from g1.asyncs.bases import servers
from g1.asyncs.bases import tasks
LOG = logging.getLogger(__name__)
LOG.addHandler(logging.NullHandler())
class SocketServer:
def __init__(self, socket, handler, max_connections=0):
self._socket = socket
... | Add warning when server handler task queue is full | Add warning when server handler task queue is full
| Python | mit | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | ---
+++
@@ -36,6 +36,11 @@
async def _accept(self, queue):
while True:
+ if queue.is_full():
+ LOG.warning(
+ 'handler task queue is full; '
+ 'we cannot accept any new connections'
+ )
await queue.puttable()
... |
6cf5d7db54ee272fa9af66d45a504d5994693ae4 | tests/functional/test_configuration.py | tests/functional/test_configuration.py | """Tests for the config command
"""
from pip.status_codes import ERROR
from tests.lib.configuration_helpers import kinds, ConfigurationFileIOMixin
def test_no_options_passed_should_error(script):
result = script.pip('config', expect_error=True)
assert result.returncode == ERROR
class TestBasicLoading(Confi... | """Tests for the config command
"""
import pytest
import textwrap
from pip.status_codes import ERROR
from tests.lib.configuration_helpers import kinds, ConfigurationFileIOMixin
def test_no_options_passed_should_error(script):
result = script.pip('config', expect_error=True)
assert result.returncode == ERROR... | Add basic tests for configuration | Add basic tests for configuration
| Python | mit | zvezdan/pip,pypa/pip,xavfernandez/pip,xavfernandez/pip,techtonik/pip,pradyunsg/pip,RonnyPfannschmidt/pip,pradyunsg/pip,zvezdan/pip,RonnyPfannschmidt/pip,RonnyPfannschmidt/pip,rouge8/pip,sbidoul/pip,xavfernandez/pip,rouge8/pip,pfmoore/pip,zvezdan/pip,techtonik/pip,pypa/pip,sbidoul/pip,pfmoore/pip,rouge8/pip,techtonik/pi... | ---
+++
@@ -1,5 +1,8 @@
"""Tests for the config command
"""
+
+import pytest
+import textwrap
from pip.status_codes import ERROR
from tests.lib.configuration_helpers import kinds, ConfigurationFileIOMixin
@@ -12,13 +15,43 @@
class TestBasicLoading(ConfigurationFileIOMixin):
- def test_reads_user_file(se... |
5b71b9e86dc09fe21717a75e45748a81d833c632 | src/test-python.py | src/test-python.py | def test(options, buildout):
from subprocess import Popen, PIPE
import os
import sys
python = options['python']
if not os.path.exists(python):
raise IOError("There is no file at %s" % python)
if sys.platform == 'darwin':
output = Popen([python, "-c", "import platform; print (pla... | def test(options, buildout):
from subprocess import Popen, PIPE
import os
import sys
python = options['python']
if not os.path.exists(python):
raise IOError("There is no file at %s" % python)
if sys.platform == 'darwin':
output = Popen([python, "-c", "import platform; print (pla... | Check if the installed python2.4 have ssl support. | Check if the installed python2.4 have ssl support.
| Python | mit | upiq/plonebuild,upiq/plonebuild | ---
+++
@@ -10,3 +10,7 @@
output = Popen([python, "-c", "import platform; print (platform.mac_ver())"], stdout=PIPE).communicate()[0]
if not output.startswith("('10."):
raise IOError("Your python at %s doesn't return proper data for platform.mac_ver(), got: %s" % (python, output))
+ ... |
b3b28bd582d3f1e2ed5e646275760d1d0669acea | WikimediaUtilities.py | WikimediaUtilities.py | from urllib.request import urlopen
import Utilities
FILENAME_CUE = "File:"
IMAGE_LOCATION_CUE = '<div class="fullMedia"><a href="https://upload.wikimedia.org/wikipedia/commons/'
IMAGE_LOCATION_URL_START = 'https://upload.wikimedia.org/wikipedia/commons/'
def directUrlOfFile(mediaPageURL):
"""Returns (success, url... | from urllib.request import urlopen, quote
import Utilities
FILENAME_CUE = "File:"
IMAGE_LOCATION_CUE = '<div class="fullMedia"><a href="https://upload.wikimedia.org/wikipedia/commons/'
IMAGE_LOCATION_URL_START = 'https://upload.wikimedia.org/wikipedia/commons/'
def directUrlOfFile(mediaPageURL):
"""Returns (succe... | Use python's built in system for percent-encoding | Use python's built in system for percent-encoding
| Python | mit | alset333/PeopleLookerUpper | ---
+++
@@ -1,4 +1,4 @@
-from urllib.request import urlopen
+from urllib.request import urlopen, quote
import Utilities
FILENAME_CUE = "File:"
@@ -10,7 +10,7 @@
filenameStart = mediaPageURL.find(FILENAME_CUE) + len(FILENAME_CUE)
filename = mediaPageURL[filenameStart:]
- filename_percent_encoded = U... |
3ea008feb5ebd0e4e67952267aa5e3a0c5e13e89 | hoomd/operations.py | hoomd/operations.py | import hoomd.integrate
class Operations:
def __init__(self, simulation=None):
self.simulation = simulation
self._compute = list()
self._auto_schedule = False
self._scheduled = False
def add(self, op):
if isinstance(op, hoomd.integrate._integrator):
self._in... | import hoomd.integrate
class Operations:
def __init__(self, simulation=None):
self.simulation = simulation
self._compute = list()
self._auto_schedule = False
self._scheduled = False
def add(self, op):
if isinstance(op, hoomd.integrate._integrator):
self._in... | Add integrator property for Operations | Add integrator property for Operations
| Python | bsd-3-clause | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | ---
+++
@@ -48,3 +48,10 @@
@property
def scheduled(self):
return self._scheduled
+
+ @property
+ def integrator(self):
+ try:
+ return self._integrator
+ except AttributeError:
+ return None |
b6e532f01d852738f40eb8bedc89f5c056b2f62c | netbox/generate_secret_key.py | netbox/generate_secret_key.py | #!/usr/bin/env python
# This script will generate a random 50-character string suitable for use as a SECRET_KEY.
import random
charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*(-_=+)'
secure_random = random.SystemRandom()
print(''.join(secure_random.sample(charset, 50)))
| #!/usr/bin/env python
# This script will generate a random 50-character string suitable for use as a SECRET_KEY.
import secrets
charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*(-_=+)'
print(''.join(secrets.choice(charset) for _ in range(50)))
| Fix how SECRET_KEY is generated | Fix how SECRET_KEY is generated
Use secrets.choice instead of random.sample to generate the secret key. | Python | apache-2.0 | digitalocean/netbox,digitalocean/netbox,digitalocean/netbox,digitalocean/netbox | ---
+++
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# This script will generate a random 50-character string suitable for use as a SECRET_KEY.
-import random
+import secrets
charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*(-_=+)'
-secure_random = random.SystemRandom()
-print(''.join(se... |
7f649a9e4e90587bd88b4b83b648f76287610f16 | pytest_django_haystack.py | pytest_django_haystack.py | import pytest
__version__ = '0.1.1'
def pytest_configure(config):
# Register the marks
config.addinivalue_line(
'markers',
'haystack: Mark the test as using the django-haystack search engine, '
'rebuilding the index for each test.')
@pytest.fixture(autouse=True)
def _haystack_marke... | import pytest
__version__ = '0.1.1'
def pytest_configure(config):
# Register the marks
config.addinivalue_line(
'markers',
'haystack: Mark the test as using the django-haystack search engine, '
'rebuilding the index for each test.')
@pytest.fixture(autouse=True)
def _haystack_marke... | Move db fixture to the inside of the method | Move db fixture to the inside of the method
| Python | mit | rouge8/pytest-django-haystack | ---
+++
@@ -13,7 +13,7 @@
@pytest.fixture(autouse=True)
-def _haystack_marker(request, db):
+def _haystack_marker(request):
"""
Implement the 'haystack' marker.
@@ -24,6 +24,7 @@
if marker:
from pytest_django.lazy_django import skip_if_no_django
from django.core.management impo... |
e1ddf1806cf80bf14a6ebe5a2d928f375943a9e4 | alignak_backend/__init__.py | alignak_backend/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Alignak REST backend
This module is an Alignak REST backend
"""
# Application version and manifest
VERSION = (0, 4, 3)
__application__ = u"Alignak_Backend"
__short_version__ = '.'.join((str(each) for each in VERSION[:2]))
__version__ = '.'.join((str(each) for ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Alignak REST backend
This module is an Alignak REST backend
"""
# Application version and manifest
VERSION = (0, 4, 3)
__application__ = u"Alignak_Backend"
__short_version__ = '.'.join((str(each) for each in VERSION[:2]))
__version__ = '.'.join((str(each) fo... | Fix bad indentation that broke the PEP8 ! | Fix bad indentation that broke the PEP8 !
| Python | agpl-3.0 | Alignak-monitoring-contrib/alignak-backend,Alignak-monitoring-contrib/alignak-backend,Alignak-monitoring-contrib/alignak-backend,Alignak-monitoring-contrib/alignak-backend | ---
+++
@@ -4,8 +4,8 @@
"""
Alignak REST backend
-
- This module is an Alignak REST backend
+
+ This module is an Alignak REST backend
"""
# Application version and manifest
VERSION = (0, 4, 3) |
cf836d147c3f55261e41815fb1c5e0a4bd53d41a | resolver_test/__init__.py | resolver_test/__init__.py | # Copyright (c) 2011 Resolver Systems Ltd.
# All Rights Reserved
#
try:
import unittest2 as unittest
except ImportError:
import unittest
from datetime import timedelta
from mock import call
class ResolverTestMixins(object):
def assertCalledOnce(self, mock, *args, **kwargs):
if mock.call_args_lis... | # Copyright (c) 2011 Resolver Systems Ltd.
# All Rights Reserved
#
try:
import unittest2 as unittest
except ImportError:
import unittest
from datetime import timedelta
from mock import call
class ResolverTestMixins(object):
def assertCalledOnce(self, mock, *args, **kwargs):
if mock.call_args_lis... | Allow arbitrary kwargs for die utility function. by: Glenn, Giles | Allow arbitrary kwargs for die utility function. by: Glenn, Giles | Python | mit | pythonanywhere/resolver_test | ---
+++
@@ -42,7 +42,7 @@
def die(exception=None):
if exception is None:
exception = AssertionError('die called')
- def inner_die(*_):
+ def inner_die(*_, **__):
raise exception
return inner_die
|
fc37b45a461d8973f78a359016a458b5a3769689 | masters/master.client.v8.ports/master_site_config.py | masters/master.client.v8.ports/master_site_config.py | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""ActiveMaster definition."""
from config_bootstrap import Master
class V8Ports(Master.Master3):
base_app_url = 'https://v8-status.appspot.com'
tree_s... | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""ActiveMaster definition."""
from config_bootstrap import Master
class V8Ports(Master.Master3a):
base_app_url = 'https://v8-status.appspot.com'
tree_... | Switch new ports master to master3a | V8: Switch new ports master to master3a
BUG=595708
TBR=tandrii@chromium.org
Review URL: https://codereview.chromium.org/1854673002
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@299638 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | eunchong/build,eunchong/build,eunchong/build,eunchong/build | ---
+++
@@ -6,7 +6,7 @@
from config_bootstrap import Master
-class V8Ports(Master.Master3):
+class V8Ports(Master.Master3a):
base_app_url = 'https://v8-status.appspot.com'
tree_status_url = base_app_url + '/status'
store_revisions_url = base_app_url + '/revisions' |
b145b03b2569f4a82adefe57e843ef91384c47a4 | panoptes/state_machine/states/core.py | panoptes/state_machine/states/core.py | import time
import transitions
from panoptes.utils.logger import has_logger
@has_logger
class PanState(transitions.State):
""" Base class for PANOPTES transitions """
def __init__(self, *args, **kwargs):
name = kwargs.get('name', self.__class__)
self.panoptes = kwargs.get('panoptes', None)... | import time
import transitions
from panoptes.utils.logger import has_logger
@has_logger
class PanState(transitions.State):
""" Base class for PANOPTES transitions """
def __init__(self, *args, **kwargs):
name = kwargs.get('name', self.__class__)
self.panoptes = kwargs.get('panoptes', None)... | Raise exception for state not overriding main | Raise exception for state not overriding main
| Python | mit | joshwalawender/POCS,panoptes/POCS,panoptes/POCS,joshwalawender/POCS,AstroHuntsman/POCS,AstroHuntsman/POCS,AstroHuntsman/POCS,joshwalawender/POCS,AstroHuntsman/POCS,panoptes/POCS,panoptes/POCS | ---
+++
@@ -19,6 +19,5 @@
self._sleep_delay = 3 # seconds
def main(self, event_data):
- assert self.panoptes is not None
msg = "Must implement `main` method inside class {}. Exiting".format(self.name)
- self.panoptes.logger.warning(msg)
+ raise NotImplementedError(msg) |
3cfa4f48c6bf28ed4273004d9a44173ecb4b195c | parliament/templatetags/parliament.py | parliament/templatetags/parliament.py | from django import template
register = template.Library()
@register.filter(name='governing')
def governing(party, date):
return party.is_governing(date)
| from django import template
from ..models import Party, Statement
register = template.Library()
@register.filter(name='governing')
def governing(obj, date=None):
if isinstance(obj, Party):
assert date is not None, "Date must be supplied when 'govern' is called with a Party object"
return obj.is_go... | Allow governing templatetag to be called with a Statement object | Allow governing templatetag to be called with a Statement object
| Python | agpl-3.0 | kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu | ---
+++
@@ -1,8 +1,19 @@
from django import template
+from ..models import Party, Statement
register = template.Library()
@register.filter(name='governing')
-def governing(party, date):
- return party.is_governing(date)
-
+def governing(obj, date=None):
+ if isinstance(obj, Party):
+ assert date i... |
5c074950663d2e508fee0e015472e8460bf5b183 | rootpy/plotting/canvas.py | rootpy/plotting/canvas.py | """
This module implements python classes which inherit from
and extend the functionality of the ROOT canvas classes.
"""
import ctypes, ctypes.util
ctypes.cdll.LoadLibrary(ctypes.util.find_library("Gui"))
import ROOT
from ..core import Object
from .. import rootpy_globals as _globals
from .. import defaults, QROOT
... | """
This module implements python classes which inherit from
and extend the functionality of the ROOT canvas classes.
"""
import ROOT
from ..core import Object
from .. import rootpy_globals as _globals
from .. import defaults, QROOT
class _PadBase(Object):
def _post_init(self):
self.members = []
... | Remove code which should never have made it in | Remove code which should never have made it in
| Python | bsd-3-clause | rootpy/rootpy,kreczko/rootpy,kreczko/rootpy,kreczko/rootpy,rootpy/rootpy,ndawe/rootpy,rootpy/rootpy,ndawe/rootpy,ndawe/rootpy | ---
+++
@@ -2,9 +2,6 @@
This module implements python classes which inherit from
and extend the functionality of the ROOT canvas classes.
"""
-
-import ctypes, ctypes.util
-ctypes.cdll.LoadLibrary(ctypes.util.find_library("Gui"))
import ROOT
|
fc6ca51d4a865368f82c26426a2d6c8d8366e25d | tcconfig/tcshow.py | tcconfig/tcshow.py | #!/usr/bin/env python
# encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from __future__ import with_statement
import sys
try:
import json
except ImportError:
import simplejson as json
import six
import thutils
import tcconfig
import tcc... | #!/usr/bin/env python
# encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from __future__ import with_statement
import json
import sys
import six
import thutils
import tcconfig
import tcconfig.traffic_control
from ._common import verify_network_in... | Drop support for Python 2.6 | Drop support for Python 2.6
| Python | mit | thombashi/tcconfig,thombashi/tcconfig | ---
+++
@@ -7,13 +7,8 @@
from __future__ import absolute_import
from __future__ import with_statement
+import json
import sys
-
-try:
- import json
-except ImportError:
- import simplejson as json
-
import six
import thutils
|
2b892b58049bd2b99ae97b62149f88c8001c82ca | ceph_deploy/tests/test_cli_osd.py | ceph_deploy/tests/test_cli_osd.py | import pytest
import subprocess
def test_help(tmpdir, cli):
with cli(
args=['ceph-deploy', 'osd', '--help'],
stdout=subprocess.PIPE,
) as p:
result = p.stdout.read()
assert 'usage: ceph-deploy osd' in result
assert 'positional arguments' in result
assert 'optional argum... | import pytest
import subprocess
def test_help(tmpdir, cli):
with cli(
args=['ceph-deploy', 'osd', '--help'],
stdout=subprocess.PIPE,
) as p:
result = p.stdout.read()
assert 'usage: ceph-deploy osd' in result
assert 'positional arguments' in result
assert 'optional argum... | Remove unneeded creation of .conf file | [RM-11742] Remove unneeded creation of .conf file
Signed-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>
| Python | mit | trhoden/ceph-deploy,branto1/ceph-deploy,SUSE/ceph-deploy-to-be-deleted,branto1/ceph-deploy,ceph/ceph-deploy,SUSE/ceph-deploy,isyippee/ceph-deploy,ghxandsky/ceph-deploy,imzhulei/ceph-deploy,codenrhoden/ceph-deploy,codenrhoden/ceph-deploy,shenhequnying/ceph-deploy,zhouyuan/ceph-deploy,shenhequnying/ceph-deploy,ghxandsky/... | ---
+++
@@ -26,8 +26,6 @@
def test_bad_no_disk(tmpdir, cli):
- with tmpdir.join('ceph.conf').open('w'):
- pass
with pytest.raises(cli.Failed) as err:
with cli(
args=['ceph-deploy', 'osd'], |
913590519e05a6209efb1102649ea7aba4abfbf5 | airship/__init__.py | airship/__init__.py | import os
import json
from flask import Flask, render_template
def channels_json(station, escaped=False):
channels = [{"name": channel} for channel in station.channels()]
jsonbody = json.dumps(channels)
if escaped:
jsonbody = jsonbody.replace("</", "<\\/")
return jsonbody
def make_airship(s... | import os
import json
from flask import Flask, render_template
def jsonate(obj, escaped):
jsonbody = json.dumps(obj)
if escaped:
jsonbody = jsonbody.replace("</", "<\\/")
return jsonbody
def channels_json(station, escaped=False):
channels = [{"name": channel} for channel in station.channels... | Fix the grefs route in the airship server | Fix the grefs route in the airship server
| Python | mit | richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation | ---
+++
@@ -4,12 +4,21 @@
from flask import Flask, render_template
-def channels_json(station, escaped=False):
- channels = [{"name": channel} for channel in station.channels()]
- jsonbody = json.dumps(channels)
+def jsonate(obj, escaped):
+ jsonbody = json.dumps(obj)
if escaped:
jsonbody ... |
37953d6ee56fedbe5e03f738ddbf28c3433718e7 | onestop/registry.py | onestop/registry.py | """Read and write Onestop data."""
import sys
import os
import glob
import json
import argparse
import urllib
import mzgeohash
import util
import entities
import errors
class OnestopRegistry(object):
"""Onestop Registry."""
def __init__(self, path='.'):
"""Path to directory containing feeds."""
# Path to... | """Read and write Onestop data."""
import sys
import os
import glob
import json
import argparse
import urllib
import mzgeohash
import util
import entities
import errors
class OnestopRegistry(object):
"""Onestop Registry."""
def __init__(self, path=None):
"""Path to directory containing feeds."""
# Path t... | Fix bug where ONESTOP_REGISTRY env var was not checked | Fix bug where ONESTOP_REGISTRY env var was not checked
| Python | mit | transitland/transitland-python-client,srthurman/transitland-python-client | ---
+++
@@ -14,7 +14,7 @@
class OnestopRegistry(object):
"""Onestop Registry."""
- def __init__(self, path='.'):
+ def __init__(self, path=None):
"""Path to directory containing feeds."""
# Path to registry
self.path = path or os.getenv('ONESTOP_REGISTRY') or '.' |
06b7a81a0c89177e6ac1913cab65819b7b565754 | python/ssc/__init__.py | python/ssc/__init__.py | # outer __init__.py
"""
Implementation of some simple and dumb audio codecs, like Delta Modualtion
"""
from ssc.aux import pack, unpack
from ssc.dm import predictive_dm, decode_dm
from ssc.btc import lin2btc, btc2lin, calc_rc
from ssc.configure import *
| # outer __init__.py
"""
Implementation of some simple and dumb audio codecs, like Delta Modualtion
"""
from ssc.aux import pack, unpack
from ssc.dm import lin2dm, dm2lin, calc_a_value
from ssc.btc import lin2btc, btc2lin, calc_rc
| Update function names from dm.py and removed import to configure.py | Update function names from dm.py and removed import to configure.py
| Python | bsd-3-clause | Zardoz89/Simple-Sound-Codecs,Zardoz89/Simple-Sound-Codecs | ---
+++
@@ -4,7 +4,6 @@
"""
from ssc.aux import pack, unpack
-from ssc.dm import predictive_dm, decode_dm
+from ssc.dm import lin2dm, dm2lin, calc_a_value
from ssc.btc import lin2btc, btc2lin, calc_rc
-from ssc.configure import *
|
6d15230f46c22226f6a2e84ac41fc39e6c5c190b | linode/objects/linode/backup.py | linode/objects/linode/backup.py | from .. import DerivedBase, Property, Base
class Backup(DerivedBase):
api_name = 'backups'
api_endpoint = '/linode/instances/{linode_id}/backups/{id}'
derived_url_path = 'backups'
parent_id_name='linode_id'
properties = {
'id': Property(identifier=True),
'create_dt': Property(is_da... | from .. import DerivedBase, Property, Base
class Backup(DerivedBase):
api_name = 'backups'
api_endpoint = '/linode/instances/{linode_id}/backups/{id}'
derived_url_path = 'backups'
parent_id_name='linode_id'
properties = {
'id': Property(identifier=True),
'created': Property(is_date... | Fix datetime fields in Backup and SupportTicket | Fix datetime fields in Backup and SupportTicket
This closes #23.
| Python | bsd-3-clause | linode/python-linode-api,jo-tez/python-linode-api | ---
+++
@@ -8,9 +8,9 @@
properties = {
'id': Property(identifier=True),
- 'create_dt': Property(is_datetime=True),
+ 'created': Property(is_datetime=True),
'duration': Property(),
- 'finish_dt': Property(is_datetime=True),
+ 'finished': Property(is_datetime=True),
... |
19c087941e193b79b6f76e75cc024878ef8c7c6f | examples/test.py | examples/test.py | from nanomon import resources
from nanomon import registry
import logging
logging.basicConfig(level=logging.DEBUG)
webserver_group = resources.MonitoringGroup('webservers', port=80)
www1 = resources.Host('www1', monitoring_groups=[webserver_group,], port=443, type='m1.xlarge')
http_check = resources.Command('check_h... | from nanomon import resources
import logging
logging.basicConfig(level=logging.DEBUG)
webserver_group = resources.MonitoringGroup('webservers', port=80)
www1 = resources.Node('www1', monitoring_groups=[webserver_group,], port=443, type='m1.xlarge')
http_check = resources.Command('check_http',
'check_http {ho... | Update to use Node instead of Host | Update to use Node instead of Host
| Python | bsd-2-clause | cloudtools/nymms | ---
+++
@@ -1,12 +1,11 @@
from nanomon import resources
-from nanomon import registry
import logging
logging.basicConfig(level=logging.DEBUG)
webserver_group = resources.MonitoringGroup('webservers', port=80)
-www1 = resources.Host('www1', monitoring_groups=[webserver_group,], port=443, type='m1.xlarge')
+w... |
8b3538150bbd3aa1dea0ad060b32a35acb80c51a | common/test/acceptance/edxapp_pages/lms/find_courses.py | common/test/acceptance/edxapp_pages/lms/find_courses.py | """
Find courses page (main page of the LMS).
"""
from bok_choy.page_object import PageObject
from bok_choy.promise import BrokenPromise
from . import BASE_URL
class FindCoursesPage(PageObject):
"""
Find courses page (main page of the LMS).
"""
url = BASE_URL
def is_browser_on_page(self):
... | """
Find courses page (main page of the LMS).
"""
from bok_choy.page_object import PageObject
from bok_choy.promise import BrokenPromise
from . import BASE_URL
class FindCoursesPage(PageObject):
"""
Find courses page (main page of the LMS).
"""
url = BASE_URL
def is_browser_on_page(self):
... | Fix find courses page title in bok choy test suite | Fix find courses page title in bok choy test suite
| Python | agpl-3.0 | nttks/jenkins-test,Unow/edx-platform,amir-qayyum-khan/edx-platform,nttks/edx-platform,DNFcode/edx-platform,jbassen/edx-platform,morenopc/edx-platform,procangroup/edx-platform,atsolakid/edx-platform,itsjeyd/edx-platform,jazztpt/edx-platform,jamesblunt/edx-platform,eduNEXT/edunext-platform,jruiperezv/ANALYSE,stvstnfrd/ed... | ---
+++
@@ -15,7 +15,7 @@
url = BASE_URL
def is_browser_on_page(self):
- return self.browser.title == "edX"
+ return "edX" in self.browser.title
@property
def course_id_list(self): |
ad4b972667e9111c403c1d3726b2cde87fcbc88e | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name='natural',
version='0.1.4',
description='Convert data to their natural (human-readable) format',
long_description='''
Example Usage
=============
Basic usage::
>>> from natural.file import accessed
>>> print accessed(__file__)
... | #!/usr/bin/env python
from distutils.core import setup
setup(name='natural',
version='0.1.4',
description='Convert data to their natural (human-readable) format',
long_description='''
Example Usage
=============
Basic usage::
>>> from natural.file import accessed
>>> print accessed(__file__)
... | Use 2to3 for Python 3 | Use 2to3 for Python 3
| Python | mit | tehmaze/natural | ---
+++
@@ -41,4 +41,5 @@
url='https://github.com/tehmaze/natural',
packages=['natural'],
package_data={'natural': ['locale/*/LC_MESSAGES/*.mo']},
+ use_2to3=True,
) |
ffcc9d8c87ddc7fd386dd51c1fca1ac8b62d5828 | setup.py | setup.py | #!/usr/bin/env python
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(name='django-elect',
version='0.1',
description='A simple voting app for Django',
license='BSD',
author='Mason Malone',
author_email='mason.malone@gmail.com',
url='http:/... | #!/usr/bin/env python
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(name='django-elect',
version='0.1',
description='A simple voting app for Django',
license='BSD',
author='Mason Malone',
author_email='mason.malone@gmail.com',
url='http:/... | Update Django requirements for 1.8 | Update Django requirements for 1.8
| Python | bsd-3-clause | MasonM/django-elect,MasonM/django-elect,MasonM/django-elect | ---
+++
@@ -13,13 +13,13 @@
packages=find_packages(exclude=['example_project', 'example_project.*']),
include_package_data=True,
tests_require=[
- 'django>=1.6,<1.8',
+ 'django>=1.8,<1.9',
'freezegun',
'unittest2',
],
test_suite='runtests.runtests',
instal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.