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 |
|---|---|---|---|---|---|---|---|---|---|---|
4932279ce1b43162c8c37cabd4e62e0620f4e3ce | python/marvin/core/exceptions.py | python/marvin/core/exceptions.py | #!/usr/bin/env python
# encoding: utf-8
"""
exceptions.py
Licensed under a 3-clause BSD license.
Revision history:
13 Feb 2016 J. Sánchez-Gallego
Initial version
"""
from __future__ import division
from __future__ import print_function
__all__ = ['MarvinError', 'MarvinUserWarning', 'MarvinSkippedTestWa... | #!/usr/bin/env python
# encoding: utf-8
"""
exceptions.py
Licensed under a 3-clause BSD license.
Revision history:
13 Feb 2016 J. Sánchez-Gallego
Initial version
"""
from __future__ import division
from __future__ import print_function
__all__ = ['MarvinError', 'MarvinUserWarning', 'MarvinSkippedTestWa... | Fix another occurence of same typo | Fix another occurence of same typo | Python | bsd-3-clause | albireox/marvin,bretthandrews/marvin,albireox/marvin,sdss/marvin,albireox/marvin,sdss/marvin,sdss/marvin,albireox/marvin,bretthandrews/marvin,bretthandrews/marvin,bretthandrews/marvin,sdss/marvin | ---
+++
@@ -16,7 +16,7 @@
from __future__ import print_function
-__all__ = ['MarvinError', 'MarvinUserWarning', 'MarvinSkippedTestWargning',
+__all__ = ['MarvinError', 'MarvinUserWarning', 'MarvinSkippedTestWarning',
'MarvinNotImplemented', 'MarvinMissingDependency']
|
4db9c0139b42cdaf7c22ac2032b5edfec9394ce4 | mopidy/frontends/mpd/protocol/connection.py | mopidy/frontends/mpd/protocol/connection.py | from mopidy import settings
from mopidy.frontends.mpd.protocol import handle_pattern
from mopidy.frontends.mpd.exceptions import MpdPasswordError
@handle_pattern(r'^close$')
def close(context):
"""
*musicpd.org, connection section:*
``close``
Closes the connection to MPD.
"""
context.... | from mopidy import settings
from mopidy.frontends.mpd.protocol import handle_pattern
from mopidy.frontends.mpd.exceptions import MpdPasswordError
@handle_pattern(r'^close$')
def close(context):
"""
*musicpd.org, connection section:*
``close``
Closes the connection to MPD.
"""
context.... | Update TODO for MPD command 'kill' | Update TODO for MPD command 'kill'
| Python | apache-2.0 | dbrgn/mopidy,diandiankan/mopidy,rawdlite/mopidy,adamcik/mopidy,vrs01/mopidy,tkem/mopidy,ali/mopidy,ZenithDK/mopidy,vrs01/mopidy,pacificIT/mopidy,hkariti/mopidy,kingosticks/mopidy,bacontext/mopidy,glogiotatidis/mopidy,jodal/mopidy,kingosticks/mopidy,swak/mopidy,quartz55/mopidy,quartz55/mopidy,mopidy/mopidy,swak/mopidy,Z... | ---
+++
@@ -22,7 +22,9 @@
Kills MPD.
"""
- pass # TODO
+ # TODO We do not want to allow remote killing of Mopidy. We should throw an
+ # MPD exception here. Maybe using ACK_ERROR_PERMISSION.
+ pass
@handle_pattern(r'^password "(?P<password>[^"]+)"$')
def password_(context, password): |
e8fb50e265d62086fa2501f55e7763e49b775440 | scripts/generate-s3-post-url-data.py | scripts/generate-s3-post-url-data.py | #!/usr/bin/env python
"""
This script will create a presigned url and fields for POSTING to an s3 bucket. This allows someone without permissions
on the bucket to upload a file.
This script must be run by an entity with the right permissions on the bucket.
The url will expire after 600 seconds.
Usage:
scripts/genera... | #!/usr/bin/env python
"""
This script will create a presigned url and fields for POSTING to an s3 bucket. This allows someone without permissions
on the bucket to upload a file.
This script must be run by an entity with the right permissions on the bucket.
The url will expire after 600 seconds.
Usage:
scripts/genera... | Apply bucket-owner-read acl to uploaded db dumps | Apply bucket-owner-read acl to uploaded db dumps
As per https://docs.aws.amazon.com/AmazonS3/latest/dev/crr-troubleshoot.html
> By default, the bucket owner does not have any permissions on the objects created by <another> account. And the replication configuration replicates only the objects for which the bucket own... | Python | mit | alphagov/digitalmarketplace-aws,alphagov/digitalmarketplace-aws,alphagov/digitalmarketplace-aws | ---
+++
@@ -19,9 +19,9 @@
def generate_s3_post_data(bucket, filename):
s3 = boto3.client('s3')
- fields = {"acl": "private"}
+ fields = {"acl": "bucket-owner-read"}
conditions = [
- {"acl": "private"}
+ {"acl": "bucket-owner-read"}
]
post = s3.generate_presigned_post( |
5d57c43ba7a01dc0f94ab41e4014484d1b78c1cb | django_polymorphic_auth/admin.py | django_polymorphic_auth/admin.py | from django.conf import settings
from django.contrib import admin
from django_polymorphic_auth.models import User
from django_polymorphic_auth.usertypes.email.models import EmailUser
from django_polymorphic_auth.usertypes.username.models import UsernameUser
from polymorphic.admin import \
PolymorphicParentModelAdmi... | from django.conf import settings
from django.contrib import admin
from django.contrib.auth.forms import UserChangeForm
from django_polymorphic_auth.models import User
from django_polymorphic_auth.usertypes.email.models import EmailUser
from django_polymorphic_auth.usertypes.username.models import UsernameUser
from poly... | Integrate `UserChangeForm` so we get nice password fields. | Integrate `UserChangeForm` so we get nice password fields.
| Python | mit | whembed197923/django-polymorphic-auth,ixc/django-polymorphic-auth | ---
+++
@@ -1,5 +1,6 @@
from django.conf import settings
from django.contrib import admin
+from django.contrib.auth.forms import UserChangeForm
from django_polymorphic_auth.models import User
from django_polymorphic_auth.usertypes.email.models import EmailUser
from django_polymorphic_auth.usertypes.username.mode... |
998da5c8d68dff5ad612847a2d16fb6464e30bc2 | semillas_backend/users/models.py | semillas_backend/users/models.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.contrib.auth.models import AbstractUser
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.contrib.auth.models import AbstractUser
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy... | Test for uploading files to /media/ folder in S3 | Test for uploading files to /media/ folder in S3
| Python | mit | Semillas/semillas_platform,Semillas/semillas_backend,Semillas/semillas_platform,Semillas/semillas_backend,Semillas/semillas_backend,Semillas/semillas_platform,Semillas/semillas_backend,Semillas/semillas_platform | ---
+++
@@ -7,6 +7,8 @@
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from django.contrib.gis.db.models import PointField
+
+from .storage import user_store
@python_2_unicode_compatible
@@ -24,7 +26,8 @@
picture = models.ImageField(
... |
bcf7d7eb689ec4e926a659bce3bf8301c23bd7e0 | test/utu_test.py | test/utu_test.py | import utu
import unittest
def run_test(test):
runner = unittest.runner.TextTestRunner()
loader = unittest.loader.defaultTestLoader
test = loader.loadTestsFromTestCase(test)
runner.run(test)
class UtuTest(unittest.TestCase):
def test_sanity(self):
# XXX should work out why I cannot use an ... | import utu
import unittest
def invoke(test):
runner = unittest.runner.TextTestRunner()
loader = unittest.loader.defaultTestLoader
test = loader.loadTestsFromTestCase(test)
runner.run(test)
class UtuTest(unittest.TestCase):
def test_sanity(self):
# XXX should work out why I cannot use an or... | Rename run_test to invoke to avoid confusing nosetests | Rename run_test to invoke to avoid confusing nosetests
| Python | bsd-2-clause | p/utu | ---
+++
@@ -1,7 +1,7 @@
import utu
import unittest
-def run_test(test):
+def invoke(test):
runner = unittest.runner.TextTestRunner()
loader = unittest.loader.defaultTestLoader
test = loader.loadTestsFromTestCase(test)
@@ -16,7 +16,7 @@
def test_method(self):
state['tes... |
be093e7df91ca68e4e9c73e37d18042cc5029b87 | bootstrap/conf/salt/state/run-tracking-db/scripts/import_sample_data.py | bootstrap/conf/salt/state/run-tracking-db/scripts/import_sample_data.py | import pandas as pd
import sys
df = pd.read_csv(sys.argv[1])
df.columns = [c.lower() for c in df.columns]
from sqlalchemy import create_engine
engine = create_engine('postgresql://postgresql.service.consul:5432/germline_genotype_tracking')
try:
df.to_sql("pcawg_samples", engine)
except ValueError as e:
if s... | import pandas as pd
import sys
df = pd.read_csv(sys.argv[1])
df.columns = [c.lower() for c in df.columns]
from sqlalchemy import create_engine
engine = create_engine('postgresql://pcawg_admin:pcawg@postgresql.service.consul:5432/germline_genotype_tracking')
try:
df.to_sql("pcawg_samples", engine)
except ValueEr... | Add DB credentials to sqlalchemy connection. | Add DB credentials to sqlalchemy connection.
| Python | mit | llevar/germline-regenotyper,llevar/germline-regenotyper | ---
+++
@@ -6,7 +6,7 @@
df.columns = [c.lower() for c in df.columns]
from sqlalchemy import create_engine
-engine = create_engine('postgresql://postgresql.service.consul:5432/germline_genotype_tracking')
+engine = create_engine('postgresql://pcawg_admin:pcawg@postgresql.service.consul:5432/germline_genotype_track... |
6194e5b9cb1a07f96e1844155863fe622f11bb91 | ella/newman/context_processors.py | ella/newman/context_processors.py | from django.conf import settings
def newman_media(request):
"""
Inject NEWMAN_MEDIA_URL to template. Use NEWMAN_MEDIA_PREFIX value from
settings, if not available, use MEDIA_URL + 'newman_media/' combination
"""
uri = getattr(settings, 'NEWMAN_MEDIA_URL', None)
if not uri:
uri = getattr... | from django.conf import settings
def newman_media(request):
"""
Inject NEWMAN_MEDIA_URL to template. Use NEWMAN_MEDIA_PREFIX value from
settings, if not available, use MEDIA_URL + 'newman_media/' combination
"""
uri = getattr(settings, 'NEWMAN_MEDIA_PREFIX', None)
if not uri:
uri = geta... | Make code consistent with comments | Make code consistent with comments
| Python | bsd-3-clause | WhiskeyMedia/ella,petrlosa/ella,whalerock/ella,MichalMaM/ella,whalerock/ella,ella/ella,whalerock/ella,petrlosa/ella,MichalMaM/ella,WhiskeyMedia/ella | ---
+++
@@ -5,7 +5,7 @@
Inject NEWMAN_MEDIA_URL to template. Use NEWMAN_MEDIA_PREFIX value from
settings, if not available, use MEDIA_URL + 'newman_media/' combination
"""
- uri = getattr(settings, 'NEWMAN_MEDIA_URL', None)
+ uri = getattr(settings, 'NEWMAN_MEDIA_PREFIX', None)
if not uri:
... |
4f183ee9c24814cdb136f39effb9d932058650d5 | generate_resume.py | generate_resume.py | import argparse
import jinja2
import os
import types
import yaml
from debug.debug import dprint
def load_templates(template_dir=os.path.join(os.getcwd(), 'template')):
loader = jinja2.FileSystemLoader(template_dir)
environment = jinja2.environment.Environment(loader=loader)
return environment
if __name__... | import argparse
import jinja2
import os
import yaml
from debug.debug import dprint
def load_templates(template_dir=os.path.join(os.getcwd(), 'template')):
loader = jinja2.FileSystemLoader(template_dir)
environment = jinja2.environment.Environment(loader=loader)
return environment
if __name__ == "__main__... | Remove a ton of metaclass complexity | Remove a ton of metaclass complexity
If I'd read the jinja2 documentation, I'd have seen that dotted notation
is equivalent to subscript notation, which means metaclasses and
generated classes aren't necessary. At all.
Note-to-self for the future: RTFM.
| Python | mit | sjbarag/poorly-named-resume-generator,sjbarag/poorly-named-resume-generator | ---
+++
@@ -1,7 +1,6 @@
import argparse
import jinja2
import os
-import types
import yaml
from debug.debug import dprint
@@ -30,15 +29,8 @@
template = environment.get_template(os.path.join('plain_text',section+os.path.extsep+'txt'))
dprint("found template {}".format(te... |
f313c9c476f6ae441f65567552ed835e96c62cb3 | avocado/tests/settings.py | avocado/tests/settings.py | DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
MODELTREES = {
'default': {
'model': 'tests.Employee'
}
}
INSTALLED_APPS = (
'avocado',
'avocado.meta',
'avocado.tests',
)
COVERAGE_MODULES = (
'avocado.meta.formatters',
'avocado.meta.exporters... | DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
MODELTREES = {
'default': {
'model': 'tests.Employee'
}
}
INSTALLED_APPS = (
'avocado',
'avocado.meta',
'avocado.tests',
)
COVERAGE_MODULES = (
'avocado.meta.formatters',
'avocado.meta.exporters... | Add json exporter module to modules coveraged | Add json exporter module to modules coveraged | Python | bsd-2-clause | murphyke/avocado,murphyke/avocado,murphyke/avocado,murphyke/avocado | ---
+++
@@ -23,6 +23,7 @@
'avocado.meta.exporters._excel',
'avocado.meta.exporters._sas',
'avocado.meta.exporters._r',
+ 'avocado.meta.exporters._json',
# 'avocado.meta.logictree',
'avocado.meta.managers',
'avocado.meta.mixins', |
51b362ab66ed8a1a793dc9995a6f06067230085b | geomdl/__init__.py | geomdl/__init__.py | """ This package contains native Python implementations of several `The NURBS Book <http://www.springer.com/gp/book/9783642973857>`_ algorithms for generating B-spline / NURBS curves and surfaces. It also provides a data structure for storing elements required for evaluation these curves and surfaces.
Please follow the... | """ This package contains native Python implementations of several `The NURBS Book <http://www.springer.com/gp/book/9783642973857>`_ algorithms for generating B-spline / NURBS curves and surfaces. It also provides a data structure for storing elements required for evaluation these curves and surfaces.
Please follow the... | Disable import * as it seems to cause some unnecessary trouble | Disable import * as it seems to cause some unnecessary trouble
| Python | mit | orbingol/NURBS-Python,orbingol/NURBS-Python | ---
+++
@@ -16,15 +16,3 @@
"""
__version__ = "3.0.0"
-
-# Fixes "from geomdl import *" but this is not considered as a good practice
-# @see: https://docs.python.org/3/tutorial/modules.html#importing-from-a-package
-__all__ = ["BSpline.Curve",
- "BSpline.Curve2D",
- "BSpline.Surface",
- ... |
e71f23f0bef4307831b240ee162bd9e2cf84e212 | hoomd/pytest/dummy.py | hoomd/pytest/dummy.py | from hoomd.triggers import Trigger
from hoomd.meta import _Operation, _TriggeredOperation
class DummySimulation:
def __init__(self):
self.state = DummyState()
self.operations = DummyOperations()
self._cpp_sys = DummySystem()
class DummySystem:
def __init__(self):
self.dummy_l... | from hoomd.triggers import Trigger
from hoomd.meta import _Operation, _TriggeredOperation
class DummySimulation:
def __init__(self):
self.state = DummyState()
self.operations = DummyOperations()
self._cpp_sys = DummySystem()
class DummySystem:
def __init__(self):
self.dummy_l... | Include attach method in DummyOperation | Include attach method in DummyOperation
| Python | bsd-3-clause | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | ---
+++
@@ -59,7 +59,8 @@
This is for testing purposes.
'''
- pass
+ def attach(self, simulation):
+ self._cpp_obj = "cpp obj"
class DummyTriggeredOp(_TriggeredOperation): |
c5ae3a8708023039b877a47bcfedec6997ec1583 | geokey_wegovnow/conversions.py | geokey_wegovnow/conversions.py | """Methods for converting data between systems or formats."""
def make_cm_url(url):
"""Turns a Geokey url into a Community Maps url."""
protocol, address = url.split('//')
address_parts = address.split('/')
new_address_parts = []
for i, part in enumerate(address_parts):
if part == 'api':
... | """Methods for converting data between systems or formats."""
def make_cm_url(url):
"""Turns a Geokey url into a Community Maps url."""
protocol, address = url.split('//')
address_parts = address.split('/')
new_address_parts = []
for i, part in enumerate(address_parts):
if part == 'api':
... | Fix get_link_title for non-string keys and values. Include heading and main as possible titles. | Fix get_link_title for non-string keys and values.
Include heading and main as possible titles.
| Python | mit | ExCiteS/geokey-wegovnow,ExCiteS/geokey-wegovnow | ---
+++
@@ -24,10 +24,11 @@
return "Unknown title"
# Try plausible fields for link titles.
- possible_title_field_names = ['name', 'Name', 'title', 'Title']
+ possible_title_field_names = ['name', 'title', 'heading', 'main']
for title in possible_title_field_names:
- if title in prop... |
892b1f04ba6f6dde0953c061409fb4eb05935634 | bot/action/internationalization.py | bot/action/internationalization.py | import gettext
from bot.action.core.action import IntermediateAction
LOCALE_DIR = "locales"
TRANSLATION_DOMAIN = "telegram-bot"
DEFAULT_LANGUAGE = "en"
class InternationalizationAction(IntermediateAction):
def __init__(self):
super().__init__()
self.cached_translations = {}
self.default... | import gettext
from bot.action.core.action import IntermediateAction
LOCALE_DIR = "locales"
TRANSLATION_DOMAIN = "telegram-bot"
DEFAULT_LANGUAGE = "en"
CACHED_TRANSLATIONS = {}
class InternationalizationAction(IntermediateAction):
def __init__(self):
super().__init__()
self.default_translation... | Make CACHED_TRANSLATIONS global, fix get_value typo | Make CACHED_TRANSLATIONS global, fix get_value typo
| Python | agpl-3.0 | alvarogzp/telegram-bot,alvarogzp/telegram-bot | ---
+++
@@ -7,24 +7,27 @@
DEFAULT_LANGUAGE = "en"
+CACHED_TRANSLATIONS = {}
+
class InternationalizationAction(IntermediateAction):
def __init__(self):
super().__init__()
- self.cached_translations = {}
self.default_translation = self.__get_translation(DEFAULT_LANGUAGE)
de... |
62549a211ff41e2b84a9b085e784649efc76c5d9 | apps/domain/tests/conftest.py | apps/domain/tests/conftest.py | import pytest
import sys, os
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.append(myPath + "/../src/")
from app import create_app
@pytest.fixture(scope="function", autouse=True)
def app():
return create_app()
@pytest.fixture
def client(app):
return app.test_client()
| import pytest
import sys, os
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.append(myPath + "/../src/")
from app import create_app
@pytest.fixture(scope="function", autouse=True)
def app():
db_path = "sqlite:///databasenetwork.db"
return create_app(test_config={"SQLALCHEMY_DATABASE_URI": db_pa... | Update unit test app() fixture | Update unit test app() fixture
| Python | apache-2.0 | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | ---
+++
@@ -9,7 +9,8 @@
@pytest.fixture(scope="function", autouse=True)
def app():
- return create_app()
+ db_path = "sqlite:///databasenetwork.db"
+ return create_app(test_config={"SQLALCHEMY_DATABASE_URI": db_path})
@pytest.fixture |
7f53f8da79a41591498b73356770ff1cf417adf4 | byceps/services/country/service.py | byceps/services/country/service.py | """
byceps.services.country.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from __future__ import annotations
import codecs
from dataclasses import dataclass
import json
from flask import current_app
@dataclass(frozen=Tr... | """
byceps.services.country.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from __future__ import annotations
from dataclasses import dataclass
import json
from flask import current_app
@dataclass(frozen=True)
class Coun... | Remove unnecessary codec reader, fixes type issue | Remove unnecessary codec reader, fixes type issue
| Python | bsd-3-clause | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | ---
+++
@@ -7,7 +7,6 @@
"""
from __future__ import annotations
-import codecs
from dataclasses import dataclass
import json
@@ -23,11 +22,9 @@
def get_countries() -> list[Country]:
"""Load countries from JSON file."""
- reader = codecs.getreader('utf-8')
-
path = 'services/country/resources/co... |
6b49db80a4508c3cba7f410db8ed3f23b5234e3b | src/behavior/features/terrain.py | src/behavior/features/terrain.py | from lettuce import *
import requests
import json
tenantList = [ "511", "615", "634", "515" ]
def initialize():
with open("properties.json") as config_file:
world.config = json.load(config_file)
@before.each_scenario
def cleanContext(feature):
for tenant in tenantList:
url = world.config['targetUrl'] + ... | from lettuce import *
import requests
import json
import os
tenantList = [ "511", "615", "634", "515" ]
def initialize():
if os.getenv("LETTUCE_CONFIG"):
filename = os.getenv("LETTUCE_CONFIG")
else:
filename = "properties.json"
with open(filename) as config_file:
world.config = json.load(config_fi... | ADD Name of the configuration file in a environment variable | ADD Name of the configuration file in a environment variable
| Python | apache-2.0 | telefonicaid/fiware-keypass,telefonicaid/fiware-keypass,telefonicaid/fiware-keypass | ---
+++
@@ -1,12 +1,18 @@
from lettuce import *
import requests
import json
+import os
tenantList = [ "511", "615", "634", "515" ]
def initialize():
- with open("properties.json") as config_file:
+ if os.getenv("LETTUCE_CONFIG"):
+ filename = os.getenv("LETTUCE_CONFIG")
+ else:
+ filename = "prope... |
b9e2ee470308231f4ea4d23297f7b07fab711dba | django_lightweight_queue/task.py | django_lightweight_queue/task.py | from .job import Job
from .utils import get_backend
from . import app_settings
class task(object):
def __init__(self, queue='default'):
self.queue = queue
app_settings.WORKERS.setdefault(self.queue, 1)
def __call__(self, fn):
return TaskWrapper(fn, self.queue)
class TaskWrapper(obje... | from .job import Job
from .utils import get_backend
from . import app_settings
class task(object):
def __init__(self, queue='default', timeout=None):
self.queue = queue
self.timeout = timeout
app_settings.WORKERS.setdefault(self.queue, 1)
def __call__(self, fn):
return TaskWr... | Store a timeout value on the TaskWrapper, defaulting to no timeout. | Store a timeout value on the TaskWrapper, defaulting to no timeout.
Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@thread.com>
| Python | bsd-3-clause | lamby/django-lightweight-queue,prophile/django-lightweight-queue,thread/django-lightweight-queue,thread/django-lightweight-queue,prophile/django-lightweight-queue | ---
+++
@@ -4,18 +4,20 @@
from . import app_settings
class task(object):
- def __init__(self, queue='default'):
+ def __init__(self, queue='default', timeout=None):
self.queue = queue
+ self.timeout = timeout
app_settings.WORKERS.setdefault(self.queue, 1)
def __call__(self,... |
6bbcff384acf4ca5cb22aa80dc4032e3832817b2 | wsgi/flaskapp.py | wsgi/flaskapp.py | import json
import os
import ieeebot
from flask import Flask, request, abort
from storage import Storage
app = Flask(__name__)
app.config['PROPAGATE_EXCEPTIONS'] = True
ieeebot.logger.debug(ieeebot.TOKEN)
ieeebot.logger.debug(ieeebot.DATABASE_FILE)
@app.route('/ieeetestbot', methods=['POST'])
def hello():
upda... | import json
import os
import ieeebot
from flask import Flask, request, abort
from storage import Storage
app = Flask(__name__)
app.config['PROPAGATE_EXCEPTIONS'] = True
ieeebot.logger.debug(ieeebot.TOKEN)
ieeebot.logger.debug(ieeebot.DATABASE_FILE)
@app.route('/webhook/<token>', methods=['POST'])
def hello(token=N... | Use a dynamic url to secure webhook | Use a dynamic url to secure webhook
| Python | agpl-3.0 | ieeeugrsb/IEEEbot | ---
+++
@@ -12,16 +12,19 @@
ieeebot.logger.debug(ieeebot.TOKEN)
ieeebot.logger.debug(ieeebot.DATABASE_FILE)
-@app.route('/ieeetestbot', methods=['POST'])
-def hello():
- update = request.get_json(force=True)
- #ieeebot.logger.info(str(update))
-
- if update['update_id'] > ieeebot.last_update_id:
- ... |
cd3b92d75c331de13a25693822cac57dc82d8e81 | mla_game/apps/transcript/management/commands/fake_game_one_gameplay.py | mla_game/apps/transcript/management/commands/fake_game_one_gameplay.py | import random
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from ...models import (
Transcript, TranscriptPhraseVote
)
from ...tasks import update_transcript_stats
class Command(BaseCommand):
help = 'Creates random votes for 5 phrases in a random transcript'... | import random
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from ...models import (
Transcript, TranscriptPhraseVote
)
from ...tasks import update_transcript_stats
class Command(BaseCommand):
help = 'Creates random votes for 5 phrases in a random transcript'... | Use a smaller set of users in fake game two gameplay | Use a smaller set of users in fake game two gameplay
| Python | mit | WGBH/FixIt,WGBH/FixIt,WGBH/FixIt | ---
+++
@@ -13,8 +13,10 @@
help = 'Creates random votes for 5 phrases in a random transcript'
def handle(self, *args, **options):
- users = User.objects.all()
- transcript = Transcript.objects.random_transcript(in_progress=False).first()
+ users = User.objects.all()[:5]
+ trans... |
b850d8ef9ef2453445c14f4c78a058fe51211983 | trac/upgrades/db11.py | trac/upgrades/db11.py | import os.path
import shutil
sql = """
-- Remove empty values from the milestone list
DELETE FROM milestone WHERE COALESCE(name,'')='';
-- Add a description column to the version table, and remove unnamed versions
CREATE TEMP TABLE version_old AS SELECT * FROM version;
DROP TABLE version;
CREATE TABLE version (
... | import os.path
import shutil
sql = """
-- Remove empty values from the milestone list
DELETE FROM milestone WHERE COALESCE(name,'')='';
-- Add a description column to the version table, and remove unnamed versions
CREATE TEMP TABLE version_old AS SELECT * FROM version;
DROP TABLE version;
CREATE TABLE version (
... | Fix typo in upgrade script | Fix typo in upgrade script | Python | bsd-3-clause | pkdevbox/trac,pkdevbox/trac,pkdevbox/trac,pkdevbox/trac | ---
+++
@@ -32,11 +32,11 @@
cursor.execute(sql)
# Copy the new default wiki macros over to the environment
- from trac.siteconfig import __default_macro_dir__ as macro_dir
- for f in os.listdir(macro_dir):
+ from trac.siteconfig import __default_macros_dir__ as macros_dir
+ for f in os.listdir... |
1b0fbe54406f22017bd5f40cee52333f31807272 | hardware/sense_hat/marble_maze.py | hardware/sense_hat/marble_maze.py | # based on https://www.raspberrypi.org/learning/sense-hat-marble-maze/worksheet/
from sense_hat import SenseHat
import time
sense = SenseHat()
sense.clear()
time.sleep(0.5)
r = (255, 0, 0 )
b = (0,0,0)
maze = [[r,r,r,r,r,r,r,r],
[r,b,b,b,b,b,b,r],
[r,r,r,b,r,b,b,r],
[r,b,r,b,r,r,r,r],
... | # based on https://www.raspberrypi.org/learning/sense-hat-marble-maze/worksheet/
from sense_hat import SenseHat
import time
sense = SenseHat()
sense.clear()
time.sleep(0.5)
r = (255, 0, 0 )
b = (0,0,0)
w = (255, 255, 255 )
x = 1
y = 1
maze = [[r,r,r,r,r,r,r,r],
[r,b,b,b,b,b,b,r],
[r,r,r,b,r,b,b,r]... | Add static white marble to sense hat maze | Add static white marble to sense hat maze
| Python | mit | claremacrae/raspi_code,claremacrae/raspi_code,claremacrae/raspi_code | ---
+++
@@ -10,6 +10,10 @@
r = (255, 0, 0 )
b = (0,0,0)
+w = (255, 255, 255 )
+
+x = 1
+y = 1
maze = [[r,r,r,r,r,r,r,r],
[r,b,b,b,b,b,b,r],
@@ -21,3 +25,9 @@
[r,r,r,r,r,r,r,r]]
sense.set_pixels(sum(maze,[]))
+
+game_over = False
+
+while not game_over:
+ maze[y][x] = w
+ sense.set_pi... |
3d98b426b3eb9b1ddc42e4726f7b0c99c2e488e3 | scripts/generate_setup_builtin_functions.py | scripts/generate_setup_builtin_functions.py | # Copyright 2008 Paul Hodge
import os, string
def run(functionsDirectory, outputFilename):
print "dir is: " +functionsDirectory
files = os.listdir(functionsDirectory)
functionNames = []
for file in files:
if file.endswith('.cpp'):
function_name = os.path.split(file)[1][:-4]
... | # Copyright 2008 Paul Hodge
import os, string
def run(functionsDirectory, outputFilename):
print "dir is: " +functionsDirectory
files = os.listdir(functionsDirectory)
functionNames = []
for file in files:
if file.endswith('.cpp'):
function_name = os.path.split(file)[1][:-4]
... | Enforce consistent results for generated code | Enforce consistent results for generated code
| Python | mit | andyfischer/circa,andyfischer/circa,andyfischer/circa,andyfischer/circa | ---
+++
@@ -26,6 +26,9 @@
predeclarations = map(makePredeclaration, namespaces)
calls = map(makeCall, namespaces)
+
+ predeclarations.sort()
+ calls.sort()
output = string.Template(TEMPLATE).substitute({
'predeclarations':"\n".join(predeclarations), |
b89b6a3d609c29ed544e2ab6b0995932b475ef96 | admin/common_auth/forms.py | admin/common_auth/forms.py | from __future__ import absolute_import
from django import forms
from django.contrib.auth.models import Group
from osf.models import AdminProfile
class LoginForm(forms.Form):
email = forms.CharField(label=u'Email', required=True)
password = forms.CharField(
label=u'Password',
widget=forms.Pas... | from __future__ import absolute_import
from django import forms
from django.contrib.auth.models import Group
from osf.models import AdminProfile
class LoginForm(forms.Form):
email = forms.CharField(label=u'Email', required=True)
password = forms.CharField(
label=u'Password',
widget=forms.Pas... | Exclude collection groups from ADM UI | Exclude collection groups from ADM UI
| Python | apache-2.0 | Johnetordoff/osf.io,adlius/osf.io,adlius/osf.io,aaxelb/osf.io,Johnetordoff/osf.io,erinspace/osf.io,mfraezz/osf.io,CenterForOpenScience/osf.io,CenterForOpenScience/osf.io,brianjgeiger/osf.io,pattisdr/osf.io,mfraezz/osf.io,baylee-d/osf.io,cslzchen/osf.io,mattclark/osf.io,HalcyonChimera/osf.io,cslzchen/osf.io,mattclark/os... | ---
+++
@@ -21,8 +21,9 @@
osf_id = forms.CharField(required=True, max_length=5, min_length=5)
+ # TODO: Moving to guardian, find a better way to distinguish "admin-like" groups from object permission groups
group_perms = forms.ModelMultipleChoiceField(
- queryset=Group.objects.all(),
+ ... |
505e6ee2643dc9179565db5aad9bdddaea849b86 | shipyard/rules/third-party/haproxy/build.py | shipyard/rules/third-party/haproxy/build.py | from foreman import define_parameter
from templates import pods
(define_parameter('image-version')
.with_doc('HAProxy image version.')
.with_default('1.8.9'))
@pods.app_specifier
def haproxy_app(_):
return pods.App(
name='haproxy',
exec=[
'/usr/local/sbin/haproxy',
'-f... | from foreman import define_parameter
from templates import pods
(define_parameter('image-version')
.with_doc('HAProxy image version.')
.with_default('2.0.3'))
@pods.app_specifier
def haproxy_app(_):
return pods.App(
name='haproxy',
exec=[
'/usr/local/sbin/haproxy',
'-f... | Upgrade HAProxy to version 2.0.3 | Upgrade HAProxy to version 2.0.3
| Python | mit | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | ---
+++
@@ -5,7 +5,7 @@
(define_parameter('image-version')
.with_doc('HAProxy image version.')
- .with_default('1.8.9'))
+ .with_default('2.0.3'))
@pods.app_specifier |
20d355c52a73e38ae421aa3e4227c2c60d6ae2ff | ckanext/inventory/logic/schema.py | ckanext/inventory/logic/schema.py | from ckan.lib.navl.validators import ignore_empty, not_empty
from ckan.logic.validators import (
name_validator, boolean_validator, is_positive_integer, isodate,
group_id_exists)
def default_inventory_entry_schema():
schema = {
'id': [unicode, ignore_empty],
'title': [unicode, not_empty],
... | from ckan.lib.navl.validators import ignore_empty, not_empty
from ckan.logic.validators import (
name_validator, boolean_validator, natural_number_validator, isodate,
group_id_exists)
def default_inventory_entry_schema():
schema = {
'id': [unicode, ignore_empty],
'title': [unicode, not_emp... | Allow zeros for recurring interval | Allow zeros for recurring interval
| Python | apache-2.0 | govro/ckanext-inventory,govro/ckanext-inventory,govro/ckanext-inventory,govro/ckanext-inventory | ---
+++
@@ -1,6 +1,6 @@
from ckan.lib.navl.validators import ignore_empty, not_empty
from ckan.logic.validators import (
- name_validator, boolean_validator, is_positive_integer, isodate,
+ name_validator, boolean_validator, natural_number_validator, isodate,
group_id_exists)
@@ -10,7 +10,7 @@
... |
133a085f40f1536d5ebb26e912d15fa3bddcc82c | manager.py | manager.py | from cement.core.foundation import CementApp
import command
import util.config
util.config.Configuration()
class Manager(CementApp):
class Meta:
label = 'QLDS-Manager'
handlers = [
command.default.ManagerBaseController,
command.setup.SetupController
]
with Manage... | from cement.core.foundation import CementApp
import command
import util.config
class Manager(CementApp):
class Meta:
label = 'QLDS-Manager'
handlers = command.commands
with Manager() as app:
app.run()
| Use handlers defined in command package | Use handlers defined in command package
| Python | mit | rzeka/QLDS-Manager | ---
+++
@@ -2,16 +2,10 @@
import command
import util.config
-util.config.Configuration()
-
-
class Manager(CementApp):
class Meta:
label = 'QLDS-Manager'
- handlers = [
- command.default.ManagerBaseController,
- command.setup.SetupController
- ]
+ handlers... |
a8515cf56837ef3f32ea53003f88275a47c4d249 | src/pipeline.py | src/pipeline.py |
import os
import fnmatch
import re
import subprocess
import sys
import json
import imp
import time
class pipeline(object):
def __init__(self):
self.name = ''
self.taskId = ''
self.taskPath = ''
self.scriptPath = ''
self.inputPath = ''
self.outputPath = ''
se... |
import os
import fnmatch
import re
import subprocess
import sys
import json
import imp
import time
from pprint import pprint
class pipeline(object):
def __init__(self):
self.name = ''
self.taskId = ''
self.taskPath = ''
self.scriptPath = ''
self.inputPath = ''
self.... | Change the way to import package dynamically | Change the way to import package dynamically
| Python | mit | s4553711/HiScript | ---
+++
@@ -7,6 +7,7 @@
import json
import imp
import time
+from pprint import pprint
class pipeline(object):
def __init__(self):
@@ -37,7 +38,7 @@
def run(self):
for step in self.setting['step']:
- mod = imp.load_source(step["packageName"], './')
+ mod = __import__(st... |
86cd447a9d724489ed3c23157d411fa4a9208b30 | changes/jobs/cleanup_tasks.py | changes/jobs/cleanup_tasks.py | from __future__ import absolute_import
from datetime import datetime, timedelta
from changes.config import queue
from changes.constants import Status
from changes.models import Task
from changes.queue.task import TrackedTask, tracked_task
CHECK_TIME = timedelta(minutes=5)
@tracked_task
def cleanup_tasks():
"""... | from __future__ import absolute_import
from datetime import datetime, timedelta
from changes.config import queue
from changes.constants import Status
from changes.models import Task
from changes.queue.task import TrackedTask, tracked_task
CHECK_TIME = timedelta(minutes=60)
@tracked_task
def cleanup_tasks():
""... | Increase task check time to 1h | Increase task check time to 1h
| Python | apache-2.0 | wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes,dropbox/changes,wfxiang08/changes,bowlofstew/changes,bowlofstew/changes,dropbox/changes | ---
+++
@@ -7,7 +7,7 @@
from changes.models import Task
from changes.queue.task import TrackedTask, tracked_task
-CHECK_TIME = timedelta(minutes=5)
+CHECK_TIME = timedelta(minutes=60)
@tracked_task |
1172bb29cca80486fffcfda0dea61a12f643a2e9 | start_server.py | start_server.py | #!/usr/bin/env python3
# tsuserver3, an Attorney Online server
#
# Copyright (C) 2016 argoneus <argoneuscze@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the ... | #!/usr/bin/env python3
# tsuserver3, an Attorney Online server
#
# Copyright (C) 2016 argoneus <argoneuscze@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the ... | Install PyYAML automatically before starting server | Install PyYAML automatically before starting server
| Python | agpl-3.0 | Attorney-Online-Engineering-Task-Force/tsuserver3,Mariomagistr/tsuserver3 | ---
+++
@@ -19,6 +19,14 @@
from server.tsuserver import TsuServer3
+# Idiotproof setup
+def check_pyyaml():
+ try:
+ import yaml
+ except ImportError:
+ print("Couldn't import PyYAML. Installing it for you...")
+ import pip
+ pip.main(["install", "--user", "pyyaml"])
def main... |
c42393a99435278f577b508e204bdfe1a9a6ff68 | testproject/tablib_test/tests.py | testproject/tablib_test/tests.py | from django.test import TestCase
from django_tablib import ModelDataset, Field
from .models import TestModel
class DjangoTablibTestCase(TestCase):
def test_declarative_fields(self):
class TestModelDataset(ModelDataset):
field1 = Field()
field2 = Field(attribute='field1')
... | from django.test import TestCase
from django_tablib import ModelDataset, Field
from .models import TestModel
class DjangoTablibTestCase(TestCase):
def setUp(self):
TestModel.objects.create(field1='value')
def test_declarative_fields(self):
class TestModelDataset(ModelDataset):
f... | Test that declarative fields actually work. | Test that declarative fields actually work.
| Python | mit | ebrelsford/django-tablib,joshourisman/django-tablib,ebrelsford/django-tablib,joshourisman/django-tablib | ---
+++
@@ -6,6 +6,9 @@
class DjangoTablibTestCase(TestCase):
+ def setUp(self):
+ TestModel.objects.create(field1='value')
+
def test_declarative_fields(self):
class TestModelDataset(ModelDataset):
field1 = Field()
@@ -20,3 +23,5 @@
self.assertTrue('id' not in data.... |
3c60fd42d7ce84b0f90d80d6e04b46c8affb5ff5 | maedchenbund/views.py | maedchenbund/views.py | from django.shortcuts import render
from .models import Document
def documents(request):
docs = Document.objects.all().order_by("title")
return render(request, 'home.html', {'documents': docs})
| from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from .models import Document
@login_required
def documents(request):
docs = Document.objects.all().order_by("title")
return render(request, 'home.html', {'documents': docs})
| Add required login to maedchenbund | Add required login to maedchenbund
| Python | mit | n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb,n2o/dpb | ---
+++
@@ -1,8 +1,10 @@
+from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from .models import Document
+@login_required
def documents(request):
docs = Document.objects.all().order_by("title")
return render(request, 'home.html', {'documents': docs}) |
5bbef2ebbe959dd2dcfc53272305fa249acfa17d | functional/tests/test_examples.py | functional/tests/test_examples.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | Revert "Skip functional tests until they are fixed" | Revert "Skip functional tests until they are fixed"
This reverts commit 3946bf0e0186c8c2897f432029bad7873b6d03a0.
Change-Id: Ic21137b208991c9ce738e5bf3ad5e6965b69e166
| Python | apache-2.0 | dtroyer/python-openstackclient,openstack/python-openstackclient,redhat-openstack/python-openstackclient,redhat-openstack/python-openstackclient,BjoernT/python-openstackclient,BjoernT/python-openstackclient,openstack/python-openstackclient,dtroyer/python-openstackclient | ---
+++
@@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import testtools
-
from functional.common import test
@@ -23,10 +21,8 @@
# code, then execute will raise an error by default.
test.execute('python', test.EXAMPLE_D... |
e68dcc13d6152b15f2b7c5c151e03437d9cda314 | lib/python/mod_python/__init__.py | lib/python/mod_python/__init__.py | #
# Copyright 2004 Apache Software Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this file except in compliance with the License. You
# may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | #
# Copyright 2004 Apache Software Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this file except in compliance with the License. You
# may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | Fix for MODPYTHON-55 : added a version attribute to the mod_python package. | Fix for MODPYTHON-55 : added a version attribute to the mod_python package.
| Python | apache-2.0 | Distrotech/mod_python,Distrotech/mod_python,Distrotech/mod_python | ---
+++
@@ -19,3 +19,5 @@
__all__ = ["apache", "cgihandler", "psp",
"publisher", "util"]
+
+version = "3.2.0-dev-20050518" |
37f6d1a693134785dbfb2cb50b4b6e562be83f1e | collection_registry_client.py | collection_registry_client.py | import json
import sys, os
sys.path.insert(0, os.path.abspath('./python-tastypie-client'))
import tastypie_client
url_root = "http://vorol-dev.cdlib.org/"
path_collection_registry = "collection_registry/api/v1"
url_api = url_root+path_collection_registry
entrypoint_entrypoint_key = "list_entrypoint"
entrypoint_sch... | import sys, os
sys.path.insert(0, os.path.abspath('./python-tastypie-client'))
import tastypie_client
url_root = "http://vorol-dev.cdlib.org/"
path_collection_registry = "collection_registry/api/v1"
url_api = url_root+path_collection_registry
entrypoint_entrypoint_key = "list_entrypoint"
entrypoint_schema_key = "sc... | Remove json import, not needed yet | Remove json import, not needed yet
| Python | bsd-3-clause | mredar/ucldc_collection_registry_client | ---
+++
@@ -1,5 +1,3 @@
-import json
-
import sys, os
sys.path.insert(0, os.path.abspath('./python-tastypie-client'))
|
230d7745f2f1bbc5099e1288ab482c92262e4126 | examples/ndbc/buoy_type_request.py | examples/ndbc/buoy_type_request.py | # Copyright (c) 2018 Siphon Contributors.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
NDBC Buoy Data Request (of any type)
====================================
The NDBC keeps a 40-day recent rolling file for each buoy. This examples shows how to access
the oth... | # Copyright (c) 2018 Siphon Contributors.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
NDBC Buoy Data Request (of any type)
====================================
The NDBC keeps a 40-day recent rolling file for each buoy. This examples shows how to access
the oth... | Update NDBC example for removed buoy | MNT: Update NDBC example for removed buoy
| Python | bsd-3-clause | Unidata/siphon | ---
+++
@@ -13,11 +13,11 @@
####################################################
# Request the types of data available from a given buoy.
-data_aval = NDBC.buoy_data_types('41002')
+data_aval = NDBC.buoy_data_types('42002')
print(data_aval)
####################################################
# Get a pandas ... |
9ce2faa950086f95f5a9c1f3e4f22e0a52622d8f | luminoso_api/wrappers/account.py | luminoso_api/wrappers/account.py |
from .base import BaseWrapper
from .database import Database
from ..constants import URL_BASE
class Account(BaseWrapper):
"""An object encapsulating a billing account on Luminoso's servers"""
def __init__(self, acct_name, session):
"""Construct a wrapper around a particular account name
NOT... |
from .base import BaseWrapper
from .database import Database
from ..constants import URL_BASE
class Account(BaseWrapper):
"""An object encapsulating a billing account on Luminoso's servers"""
def __init__(self, acct_name, session):
"""Construct a wrapper around a particular account name
NOT... | Adjust Account.databases() to new return format | Adjust Account.databases() to new return format
| Python | mit | LuminosoInsight/luminoso-api-client-python | ---
+++
@@ -22,7 +22,7 @@
return [Account(acct, session) for acct in accounts['accounts']]
def databases(self):
- db_table = self._get('/.list_dbs/')
+ db_table = self._get('/.list_dbs/')['result']
dbs = {}
for db_name, db_meta in db_table.items():
path = s... |
ce889047cd06714c1da86daf787583e84a59956a | api/azure.py | api/azure.py | import os
from azure.storage import *
def store(image, entity, entity_id):
blob_service = BlobService(account_name='shnergledata',
account_key=os.environ['BLOB_KEY'])
myblob = image.read()
name = '/' + entity + '/' + entity_id
blob_service.put_blob('images', name, myblo... | import os
from azure.storage import BlobService
def store(image, entity, entity_id):
blob_service = BlobService(account_name='shnergledata',
account_key=os.environ['BLOB_KEY'])
myblob = image.read()
name = '/' + entity + '/' + entity_id
blob_service.put_blob('images', n... | Revert "The same thing, but their way haha" | Revert "The same thing, but their way haha"
This reverts commit ab12f6cc4593e81bc426a54e8aebc1671ac34e2a.
| Python | mit | shnergle/ShnergleServer | ---
+++
@@ -1,6 +1,6 @@
import os
-from azure.storage import *
+from azure.storage import BlobService
def store(image, entity, entity_id): |
8898f23a429112cd80e6a2c8321b0de44aeaee7e | blanc_basic_pages/forms.py | blanc_basic_pages/forms.py | from django import forms
from django.conf import settings
from mptt.forms import MPTTAdminForm
from .models import Page
TEMPLATE_CHOICES = getattr(settings, 'PAGE_TEMPLATES', (
('', 'Default'),
))
class PageAdminForm(MPTTAdminForm):
class Meta:
model = Page
exclude = ()
def __init__(s... | from django import forms
from django.conf import settings
from mptt.forms import MPTTAdminForm
from .models import Page
TEMPLATE_CHOICES = getattr(settings, 'PAGE_TEMPLATES', (
('', 'Default'),
))
class PageAdminForm(MPTTAdminForm):
class Meta:
model = Page
exclude = ()
widgets = {... | Use custom widget for template choices instead | Use custom widget for template choices instead
A bit more Djangonic than tweaking self.fields
| Python | bsd-3-clause | blancltd/blanc-basic-pages | ---
+++
@@ -15,10 +15,8 @@
class Meta:
model = Page
exclude = ()
-
- def __init__(self, *args, **kwargs):
- super(PageAdminForm, self).__init__(*args, **kwargs)
-
- # The list of templates is defined in settings, however as we can't have dynamic choices in
- # models due... |
408297aed41966b22d8486c559716b33bc2e2984 | bitbots_body_behavior/src/bitbots_body_behavior/decisions/ball_close.py | bitbots_body_behavior/src/bitbots_body_behavior/decisions/ball_close.py | from dynamic_stack_decider.abstract_decision_element import AbstractDecisionElement
class BallClose(AbstractDecisionElement):
def __init__(self, blackboard, dsd, parameters=None):
super(BallClose, self).__init__(blackboard, dsd, parameters)
self.ball_close_distance = parameters.get("distance", sel... | import math
from dynamic_stack_decider.abstract_decision_element import AbstractDecisionElement
class BallClose(AbstractDecisionElement):
def __init__(self, blackboard, dsd, parameters=None):
super(BallClose, self).__init__(blackboard, dsd, parameters)
self.ball_close_distance = parameters.get("di... | Add angles to ball close decision | Add angles to ball close decision
| Python | bsd-3-clause | bit-bots/bitbots_behaviour | ---
+++
@@ -1,3 +1,4 @@
+import math
from dynamic_stack_decider.abstract_decision_element import AbstractDecisionElement
@@ -5,6 +6,7 @@
def __init__(self, blackboard, dsd, parameters=None):
super(BallClose, self).__init__(blackboard, dsd, parameters)
self.ball_close_distance = parameters.... |
c24dc7db961b03c947a98454fc3e8655c5f938ff | functional_tests/test_all_users.py | functional_tests/test_all_users.py | from datetime import date
from django.core.urlresolvers import reverse
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.utils import formats
from selenium import webdriver
class HomeNewVisitorTest(StaticLiveServerTestCase):
def setUp(self):
self.browser = webdriver.Fire... | from datetime import date
from django.core.urlresolvers import reverse
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.utils import formats
from selenium import webdriver
class HomeNewVisitorTest(StaticLiveServerTestCase):
def setUp(self):
self.browser = webdriver.Fire... | Fix css and heading test also removed localization test as no longer required | Fix css and heading test also removed localization test as no longer required
| Python | mit | iAmMrinal0/django_moviealert,iAmMrinal0/django_moviealert,iAmMrinal0/django_moviealert | ---
+++
@@ -21,21 +21,14 @@
self.browser.get(self.get_full_url("home"))
self.assertIn("Alert", self.browser.title)
- def test_h1_css(self):
+ def test_h2_css(self):
self.browser.get(self.get_full_url("home"))
- h1 = self.browser.find_element_by_tag_name("h1")
- self.as... |
de6a32e4b9a94103c923188894da6455ca14956c | TopTenView.py | TopTenView.py | # coding: utf-8
# ui.View subclass for the top ten iTunes songs.
# Pull requests gladly accepted.
import feedparser, requests, ui
url = 'https://itunes.apple.com/us/rss/topsongs/limit=10/xml'
def get_image_urls(itunes_url):
for entry in feedparser.parse(itunes_url).entries:
yield entry['summary'].partit... | # coding: utf-8
# ui.View subclass for the top ten iTunes songs.
# Pull requests gladly accepted.
import feedparser, requests, ui
url = 'https://itunes.apple.com/us/rss/topsongs/limit=10/xml'
def get_image_urls(itunes_url):
for entry in feedparser.parse(itunes_url).entries:
yield entry['summary'].partit... | Move to buttons & remove hardcoding of image size | Move to buttons & remove hardcoding of image size | Python | apache-2.0 | cclauss/Pythonista_ui | ---
+++
@@ -17,10 +17,11 @@
for i, url in enumerate(image_urls):
button = ui.Button()
button.background_image = ui.Image.from_data(requests.get(url).content)
+ w, h = button.background_image.size
+ button.x = i % 5 * w
+ button.y = i / 5 * h
+ ... |
ceeb64c9e46a74f95178be88566fba3d7f080fa1 | mica/stats/tests/test_acq_stats.py | mica/stats/tests/test_acq_stats.py | from .. import acq_stats
def test_calc_stats():
acq_stats.calc_stats(17210)
| import tempfile
import os
from .. import acq_stats
def test_calc_stats():
acq_stats.calc_stats(17210)
def test_make_acq_stats():
"""
Save the acq stats for one obsid into a newly-created table
"""
# Get a temporary file, but then delete it, because _save_acq_stats will only
# make a new tab... | Add a test that makes a new acq stats database | Add a test that makes a new acq stats database
| Python | bsd-3-clause | sot/mica,sot/mica | ---
+++
@@ -1,5 +1,24 @@
+import tempfile
+import os
+
from .. import acq_stats
def test_calc_stats():
acq_stats.calc_stats(17210)
+
+
+def test_make_acq_stats():
+ """
+ Save the acq stats for one obsid into a newly-created table
+ """
+ # Get a temporary file, but then delete it, because _sav... |
dd0d047829e65e613e4d2e9ccd9a6411fa9e301f | test.py | test.py | from interruptingcow import timeout
import time
while True:
# simulate waiting for laser A
print("Waiting for laser A")
time.sleep(2)
print("laser A tripped")
try:
with timeout(.25, exception=RuntimeError):
# perform a potentially very slow operation
print("Wait for ... | from interruptingcow import timeout
import time
# def bTripped():
# +1 to DB
# continue
while True:
# simulate waiting for laser A
print("Waiting for laser A")
time.sleep(2)
print("laser A tripped")
# Real code would be:
# laserA.wait_for_dark()
try:
with timeout(.25, excep... | Add real code in comments. | Add real code in comments.
| Python | apache-2.0 | pjcoleman73/UVaLibRoomCount | ---
+++
@@ -1,17 +1,25 @@
from interruptingcow import timeout
import time
+
+# def bTripped():
+# +1 to DB
+# continue
while True:
# simulate waiting for laser A
print("Waiting for laser A")
time.sleep(2)
print("laser A tripped")
+ # Real code would be:
+ # laserA.wait_for_dark(... |
8c8307ff5313b1f6c69d976853f763daf2aece0c | test.py | test.py | """ Functions to call the api and test it """
import sys
import fenix
api = fenix.FenixAPISingleton()
print('Testing Fenix API SDK Python')
auth_url = api.get_authentication_url()
print(auth_url)
api.set_code(sys.argv[1])
print('Access token: ' + api.get_access_token())
print('Refresh token: ' + api.get_refresh_token... | """ Functions to call the api and test it """
import sys
import fenix
api = fenix.FenixAPISingleton()
print('Testing Fenix API SDK Python')
auth_url = api.get_authentication_url()
print(api.get_space('2465311230082'))
print(auth_url)
api.set_code(sys.argv[1])
print('Access token: ' + api.get_access_token())
print('Re... | Test now calls a public endpoint first | Test now calls a public endpoint first
| Python | mit | samfcmc/fenixedu-python-sdk | ---
+++
@@ -6,6 +6,7 @@
api = fenix.FenixAPISingleton()
print('Testing Fenix API SDK Python')
auth_url = api.get_authentication_url()
+print(api.get_space('2465311230082'))
print(auth_url)
api.set_code(sys.argv[1])
print('Access token: ' + api.get_access_token())
@@ -13,4 +14,3 @@
api._refresh_access_token()
... |
f74d57f4a05fa56b8668e371159affe37f4c38c3 | opentreemap/otm_comments/models.py | opentreemap/otm_comments/models.py | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from threadedcomments.models import ThreadedComment
from django.contrib.gis.db import models
from treemap.instance import Instance
class EnhancedThreadedComment(ThreadedComment):
... | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from threadedcomments.models import ThreadedComment
from django.contrib.gis.db import models
class EnhancedThreadedComment(ThreadedComment):
"""
This class wraps the Threade... | Fix circular dependency problem with django apps | Fix circular dependency problem with django apps
It looks like translation is importing *all other* django apps in the project
when it is used from treemap. This means that it will load apps that
depend on treemap when it is not finished import treemap. So while it
appears that treemap/otm1_migrator/otm_comments have ... | Python | agpl-3.0 | recklessromeo/otm-core,clever-crow-consulting/otm-core,maurizi/otm-core,recklessromeo/otm-core,maurizi/otm-core,RickMohr/otm-core,RickMohr/otm-core,recklessromeo/otm-core,RickMohr/otm-core,maurizi/otm-core,clever-crow-consulting/otm-core,recklessromeo/otm-core,RickMohr/otm-core,clever-crow-consulting/otm-core,maurizi/o... | ---
+++
@@ -7,8 +7,6 @@
from threadedcomments.models import ThreadedComment
from django.contrib.gis.db import models
-
-from treemap.instance import Instance
class EnhancedThreadedComment(ThreadedComment):
@@ -21,7 +19,7 @@
# We could retrieve this through the GenericForeignKey on ThreadedComment,
... |
905e9e7744d8d5d84978a913b2e641a9c4337912 | Do_not_deploy/query_outgoing_queue.py | Do_not_deploy/query_outgoing_queue.py | from kombu import Connection, Exchange, Queue
from flask import Flask
import os
app = Flask(__name__)
app.config.from_object(os.environ.get('SETTINGS'))
@app.route("/getnextqueuemessage")
#Gets the next message from target queue. Returns the signed JSON.
def get_last_queue_message():
#: By default messages sent ... | from kombu import Connection, Exchange, Queue
from flask import Flask
import os
app = Flask(__name__)
app.config.from_object(os.environ.get('SETTINGS'))
@app.route("/getnextqueuemessage")
#Gets the next message from target queue. Returns the signed JSON.
def get_last_queue_message():
#: By default messages sent ... | Return 404 if no message so we can poll from cucumber tests | Return 404 if no message so we can poll from cucumber tests | Python | mit | LandRegistry/register-publisher,LandRegistry/register-publisher | ---
+++
@@ -24,7 +24,7 @@
message.ack() #acknowledges message, ensuring its removal.
return signature
else:
- return "no message"
+ return "no message", 404
|
e3c660cc4b5e72af3f6155c2426555247a4699b5 | tests/test_ultrametric.py | tests/test_ultrametric.py | from viridis import tree
from six.moves import range
def test_split():
t = tree.Ultrametric(list(range(6)))
t.merge(0, 1, 0.1)
t.merge(6, 2, 0.2)
t.merge(3, 4, 0.3)
t.merge(8, 5, 0.4)
t.merge(7, 8, 0.5)
t.split(0, 2)
assert t.node[9]['num_leaves'] == 3
t.split(0, 4) # nothing to do
... | from viridis import tree
from six.moves import range
import pytest
@pytest.fixture
def base_tree():
t = tree.Ultrametric(list(range(6)))
t.merge(0, 1, 0.1)
t.merge(6, 2, 0.2)
t.merge(3, 4, 0.3)
t.merge(8, 5, 0.4)
t.merge(7, 8, 0.5)
return t
def test_split(base_tree):
t = base_tree
... | Update test to use pytest fixture | Update test to use pytest fixture
| Python | mit | jni/viridis | ---
+++
@@ -1,13 +1,21 @@
from viridis import tree
from six.moves import range
-def test_split():
+import pytest
+
+@pytest.fixture
+def base_tree():
t = tree.Ultrametric(list(range(6)))
t.merge(0, 1, 0.1)
t.merge(6, 2, 0.2)
t.merge(3, 4, 0.3)
t.merge(8, 5, 0.4)
t.merge(7, 8, 0.5)
+ ... |
7aa68e0f7c553a964725ddf63c8de44eff3b3f10 | lib/log_processor.py | lib/log_processor.py | import re
import snmpy
class log_processor(snmpy.plugin):
def create(self):
for k, v in sorted(self.conf['objects'].items()):
extra = {
'count': re.compile(v['count']),
'reset': re.compile(v['reset']) if 'reset' in v else None,
'start': int(v['sta... | import re
import snmpy
class log_processor(snmpy.plugin):
def create(self):
for k, v in sorted(self.conf['objects'].items()):
extra = {
'count': re.compile(v['count']),
'reset': re.compile(v['reset']) if 'reset' in v else None,
'start': int(v['... | Add reset on rotation support in log processor. | Add reset on rotation support in log processor.
| Python | mit | mk23/snmpy,mk23/snmpy | ---
+++
@@ -5,9 +5,10 @@
def create(self):
for k, v in sorted(self.conf['objects'].items()):
extra = {
- 'count': re.compile(v['count']),
- 'reset': re.compile(v['reset']) if 'reset' in v else None,
- 'start': int(v['start']) if 'start' in v else... |
d0edc9ef44555b35d9ae0d84e9b109b0d5705bdf | callisto_core/tests/reporting/test_pdf.py | callisto_core/tests/reporting/test_pdf.py | from io import BytesIO
import PyPDF2
from wizard_builder import view_helpers as wizard_builer_helpers
from .. import test_base
from ...reporting import report_delivery
# TODO: generate mock_report_data in wizard builder
mock_report_data = [
{'food options': ['vegetables', 'apples: red']},
{'do androids drea... | from io import BytesIO
import PyPDF2
from .. import test_base
from ...reporting import report_delivery
# TODO: generate mock_report_data in wizard builder
mock_report_data = [
{'food options': ['vegetables', 'apples: red']},
{'eat it now???': ['catte']},
{'do androids dream of electric sheep?': ['awdad']... | Revert "test not answered text present in report" | Revert "test not answered text present in report"
This reverts commit 7e6caad91969bafdaefa0fc60fdfe25a8d8d8ab2.
| Python | agpl-3.0 | project-callisto/callisto-core,project-callisto/callisto-core,SexualHealthInnovations/callisto-core,SexualHealthInnovations/callisto-core | ---
+++
@@ -1,8 +1,6 @@
from io import BytesIO
import PyPDF2
-
-from wizard_builder import view_helpers as wizard_builer_helpers
from .. import test_base
from ...reporting import report_delivery
@@ -10,6 +8,7 @@
# TODO: generate mock_report_data in wizard builder
mock_report_data = [
{'food options': [... |
af5ff98f150158e4f2e0bd2281229a6248a8fb52 | cdc/models.py | cdc/models.py | from django.db import models
from django.contrib.auth.models import User
class SiteUser(models.Model):
def __str__(self):
return self.user.username
# Using a OneToOneField so we can add the extra 'company' parameter to the user
# without extending or replacing Django's User model
user = models.OneToOneFiel... | from django.db import models
from django.contrib.auth.models import User
class SiteUser(models.Model):
def __str__(self):
return self.company + " | " + self.user.username
# Using a OneToOneField so we can add the extra 'company' parameter to the user
# without extending or replacing Django's User model
use... | Change siteuser string for clarity | Change siteuser string for clarity
| Python | mit | mgerst/cdc2-2015-www,ISEAGE-ISU/cdc2-2015-www,mg1065/cdc2-2015-www,mgerst/cdc2-2015-www,keaneokelley/Crippling-Debt-Corporation,keaneokelley/Crippling-Debt-Corporation,ISEAGE-ISU/cdc2-2015-www,mg1065/cdc2-2015-www | ---
+++
@@ -3,7 +3,7 @@
class SiteUser(models.Model):
def __str__(self):
- return self.user.username
+ return self.company + " | " + self.user.username
# Using a OneToOneField so we can add the extra 'company' parameter to the user
# without extending or replacing Django's User model
user = model... |
782a4b028c45d3cc37e6679ccc3d482f0518b4b7 | txircd/modules/cmode_t.py | txircd/modules/cmode_t.py | from twisted.words.protocols import irc
from txircd.modbase import Mode
class TopiclockMode(Mode):
def checkPermission(self, user, cmd, data):
if cmd != "TOPIC":
return data
if "topic" not in data:
return data
targetChannel = data["targetchan"]
if "t" in targetChannel.mode and not user.hasAccess(self.ir... | from twisted.words.protocols import irc
from txircd.modbase import Mode
class TopiclockMode(Mode):
def checkPermission(self, user, cmd, data):
if cmd != "TOPIC":
return data
if "topic" not in data:
return data
targetChannel = data["targetchan"]
if "t" in targetChannel.mode and not user.hasAccess(targetC... | Fix the order of parameters to hasAccess, which broke all topic changing when +t was set | Fix the order of parameters to hasAccess, which broke all topic changing when +t was set
| Python | bsd-3-clause | ElementalAlchemist/txircd,Heufneutje/txircd,DesertBus/txircd | ---
+++
@@ -8,7 +8,7 @@
if "topic" not in data:
return data
targetChannel = data["targetchan"]
- if "t" in targetChannel.mode and not user.hasAccess(self.ircd.servconfig["channel_minimum_level"]["TOPIC"], targetChannel.name):
+ if "t" in targetChannel.mode and not user.hasAccess(targetChannel.name, self.i... |
8ad7b5546e0afd25b55411851feee61e5377a71d | PrinterApplication.py | PrinterApplication.py | from Cura.Wx.WxApplication import WxApplication
class PrinterApplication(WxApplication):
def __init__(self):
super(PrinterApplication, self).__init__()
def run(self):
super(PrinterApplication, self).run()
| from Cura.Wx.WxApplication import WxApplication
from Cura.Wx.MainWindow import MainWindow
class PrinterApplication(WxApplication):
def __init__(self):
super(PrinterApplication, self).__init__()
def run(self):
window = MainWindow("Cura Printer")
window.Show()
super(Print... | Add a MainWindow class to Wx and use it in printer and scanner | Add a MainWindow class to Wx and use it in printer and scanner
| Python | agpl-3.0 | quillford/Cura,Curahelper/Cura,senttech/Cura,bq/Ultimaker-Cura,fxtentacle/Cura,hmflash/Cura,fieldOfView/Cura,derekhe/Cura,lo0ol/Ultimaker-Cura,totalretribution/Cura,DeskboxBrazil/Cura,totalretribution/Cura,derekhe/Cura,DeskboxBrazil/Cura,quillford/Cura,ynotstartups/Wanhao,hmflash/Cura,Curahelper/Cura,ad1217/Cura,fxtent... | ---
+++
@@ -1,8 +1,11 @@
from Cura.Wx.WxApplication import WxApplication
+from Cura.Wx.MainWindow import MainWindow
class PrinterApplication(WxApplication):
def __init__(self):
super(PrinterApplication, self).__init__()
def run(self):
+ window = MainWindow("Cura Printer")
+ ... |
5d5c944533d70c0c9c3385f3417b06d3d3060594 | MROCPdjangoForm/ocpipeline/mrpaths.py | MROCPdjangoForm/ocpipeline/mrpaths.py | #
# Code to load project paths
#
import os, sys
MR_BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "/Users/dmhembere44/MR-connectome" ))
MR_CMAPPER_PATH = os.path.join(MR_BASE_PATH, "cmapper" )
MR_MRCAP_PATH = os.path.join(MR_BASE_PATH, "mrcap" )
sys.path += [ MR_BASE_PATH, MR_CMAPPER_PATH, MR_MR... | #
# Code to load project paths
#
import os, sys
MR_BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.." ))
MR_CMAPPER_PATH = os.path.join(MR_BASE_PATH, "cmapper" )
MR_MRCAP_PATH = os.path.join(MR_BASE_PATH, "mrcap" )
sys.path += [ MR_BASE_PATH, MR_CMAPPER_PATH, MR_MRCAP_PATH ]
| Change to path, made relative | Change to path, made relative
Former-commit-id: f00bf782fad3f6ddc6d2c97a23ff4f087ad3a22f | Python | apache-2.0 | openconnectome/m2g,openconnectome/m2g,neurodata/ndgrutedb,openconnectome/m2g,neurodata/ndgrutedb,openconnectome/m2g,neurodata/ndgrutedb,neurodata/ndmg,openconnectome/m2g,neurodata/ndgrutedb,neurodata/ndgrutedb,neurodata/ndgrutedb,openconnectome/m2g,openconnectome/m2g,neurodata/ndgrutedb,neurodata/ndgrutedb,openconnecto... | ---
+++
@@ -4,7 +4,7 @@
import os, sys
-MR_BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "/Users/dmhembere44/MR-connectome" ))
+MR_BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.." ))
MR_CMAPPER_PATH = os.path.join(MR_BASE_PATH, "cmapper" )
MR_MRCAP_PATH = os.pat... |
91519c542b2fac085dc6b785a41d2fbdba91386c | business_requirement_deliverable_report/__openerp__.py | business_requirement_deliverable_report/__openerp__.py | # -*- coding: utf-8 -*-
# © 2016 Elico Corp (https://www.elico-corp.com).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Business Requirement Document Printout',
'summary': 'Print the Business Requirement Document for your customers',
'version': '8.0.5.0.1',
'category': ... | # -*- coding: utf-8 -*-
# © 2016 Elico Corp (https://www.elico-corp.com).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Business Requirement Document Printout',
'summary': 'Print the Business Requirement Document for your customers',
'version': '8.0.5.0.1',
'category': ... | Fix manifest: add OCA in the authors | Fix manifest: add OCA in the authors
Added OCA in the authors | Python | agpl-3.0 | YogeshMahera-SerpentCS/business-requirement,sudhir-serpentcs/business-requirement | ---
+++
@@ -7,7 +7,7 @@
'version': '8.0.5.0.1',
'category': 'Business Requirements Management',
'website': 'https://www.elico-corp.com',
- 'author': 'Elico Corp',
+ 'author': 'Elico Corp, Odoo Community Association (OCA)',
'license': 'AGPL-3',
'application': False,
'installable': T... |
23501afd09b13d1e5f33bdd60614fd9ac7210108 | oratioignoreparser.py | oratioignoreparser.py | import os
import re
class OratioIgnoreParser():
def __init__(self):
self.ignored_paths = ["oratiomodule.tar.gz"]
def load(self, oratio_ignore_path):
with open(oratio_ignore_path, "r") as f:
self.ignored_paths.extend([line.strip() for line in f])
def should_be_ignored(self, fi... | import os
import re
class OratioIgnoreParser():
def __init__(self):
self.ignored_paths = ["oratiomodule.tar.gz"]
def load(self, oratio_ignore_path):
with open(oratio_ignore_path, "r") as f:
self.ignored_paths.extend([line.strip() for line in f])
def extend_list(self, ignored_... | Add extend_list method to OratioIgnoreParser | Add extend_list method to OratioIgnoreParser
To make oratioignoreparser.py easily testable using unit tests.
| Python | mit | oratio-io/oratio-cli,oratio-io/oratio-cli | ---
+++
@@ -9,6 +9,9 @@
def load(self, oratio_ignore_path):
with open(oratio_ignore_path, "r") as f:
self.ignored_paths.extend([line.strip() for line in f])
+
+ def extend_list(self, ignored_paths_list):
+ self.ignored_paths.extend(ignored_paths_list)
def should_be_ignored(... |
efa5156a15d2fd945c406792065b3386aa61107e | package_deb_replace_version.py | package_deb_replace_version.py | import sys
def split(string, splitters):
final = [string]
for x in splitters:
for i,s in enumerate(final):
if x in s and x != s:
left, right = s.split(x, 1)
final[i] = left
final.insert(i + 1, x)
final.insert(i + 2, right)
return final
fullversion = sys.argv[1]
path = f"btsoot_{fullversion}/DE... | import sys
fullversion = sys.argv[1]
path = f"btsoot_{fullversion}/DEBIAN/control"
version = fullversion[1:]
version = version[1]
control_content = f"""Package: btsoot
Version: {version}
Section: base
Priority: optional
Architecture: i386
Depends: build-essential
Maintainer: Paul Kramme <pjkramme@gmail.com>
Descriptio... | Remove unecessary code Add first charakter remover | Remove unecessary code
Add first charakter remover
| Python | bsd-3-clause | paulkramme/btsoot | ---
+++
@@ -1,19 +1,8 @@
import sys
-
-def split(string, splitters):
- final = [string]
- for x in splitters:
- for i,s in enumerate(final):
- if x in s and x != s:
- left, right = s.split(x, 1)
- final[i] = left
- final.insert(i + 1, x)
- final.insert(i + 2, right)
- return final
fullversion = sys... |
874ed1f0d97794b56907cffef047d178696591a4 | tensorflow_datasets/testing/nyu_depth_v2.py | tensorflow_datasets/testing/nyu_depth_v2.py | import os
import h5py
import numpy as np
ref = h5py.File(
os.path.expanduser(
"~/tensorflow_datasets/downloads/extracted/TAR_GZ.datasets.lids.mit.edu_fastdept_nyudepthBjtXYu6zBBYUv0ByLqXPgFy4ygUuVvPRxjz9Ip5_97M.tar.gz/nyudepthv2/val/official/00001.h5"
),
"r",
)
rgb = ref["rgb"][:]
depth = ref["de... | import os
import h5py
import numpy as np
ref = h5py.File(
os.path.expanduser(
"~/tensorflow_datasets/downloads/extracted/TAR_GZ.datasets.lids.mit.edu_fastdept_nyudepthBjtXYu6zBBYUv0ByLqXPgFy4ygUuVvPRxjz9Ip5_97M.tar.gz/nyudepthv2/val/official/00001.h5"
),
"r",
)
rgb = ref["rgb"][:]
depth = ref["de... | Format with two spaces instead of four | Format with two spaces instead of four
| Python | apache-2.0 | tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets | ---
+++
@@ -16,5 +16,5 @@
depth_fake = np.ones(depth.shape).astype(depth.dtype) # np.zeros for val
with h5py.File("00001.h5", "w") as f: # 00001 and 00002 for train; 00001 for val
- f.create_dataset("rgb", data=rgb_fake, compression="gzip")
- f.create_dataset("depth", data=depth_fake, compression="gzip")
... |
1ce899d118b3d46a816c0fc5f2f1a6f0ca9670ed | addons/resource/models/res_company.py | addons/resource/models/res_company.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class ResCompany(models.Model):
_inherit = 'res.company'
resource_calendar_ids = fields.One2many(
'resource.calendar', 'company_id', 'Working Hours')
resourc... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class ResCompany(models.Model):
_inherit = 'res.company'
resource_calendar_ids = fields.One2many(
'resource.calendar', 'company_id', 'Working Hours')
resourc... | Set company_id on a resource.calendar on company creation | [IMP] resource: Set company_id on a resource.calendar on company creation
Purpose
=======
Currently, when creating a company, the resource calendar is created if not specified.
This lead to duplicated data. In Manufacturing > Configuration > Working Time, two same working time demo data('Standard 40 Hours/Week')
Sp... | Python | agpl-3.0 | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo | ---
+++
@@ -14,14 +14,20 @@
@api.model
def _init_data_resource_calendar(self):
- for company in self.search([('resource_calendar_id', '=', False)]):
- company.resource_calendar_id = self.env['resource.calendar'].create({'name': _('Standard 40 hours/week')}).id
+ self.search([('res... |
d3d9d5a7f23bfd95ecfb6c9609c2c0d4be503ae7 | branches/extracting_oxford/molly/molly/providers/apps/search/application_search.py | branches/extracting_oxford/molly/molly/providers/apps/search/application_search.py | import logging
from molly.apps.search.providers import BaseSearchProvider
from molly.conf import applications
logger = logging.getLogger('molly.providers.apps.search.application_search')
class ApplicationSearchProvider(BaseSearchProvider):
def __init__(self, application_names=None):
self.application_nam... | import logging
from molly.apps.search.providers import BaseSearchProvider
from molly.conf import applications
logger = logging.getLogger('molly.providers.apps.search.application_search')
class ApplicationSearchProvider(BaseSearchProvider):
def __init__(self, local_names=None):
self.local_names = local_n... | Update ApplicationSearchProvider to reflect conf.settings.Application changes. | Update ApplicationSearchProvider to reflect conf.settings.Application changes.
| Python | apache-2.0 | mollyproject/mollyproject,mollyproject/mollyproject,mollyproject/mollyproject | ---
+++
@@ -7,8 +7,8 @@
logger = logging.getLogger('molly.providers.apps.search.application_search')
class ApplicationSearchProvider(BaseSearchProvider):
- def __init__(self, application_names=None):
- self.application_names = application_names
+ def __init__(self, local_names=None):
+ self.lo... |
8b6eee19707a981fddfa2114be3d90353e049b33 | examples/undocumented/python/converter_stochasticproximityembedding.py | examples/undocumented/python/converter_stochasticproximityembedding.py | #!/usr/bin/env python
data = '../data/fm_train_real.dat'
parameter_list = [[data, 20]]
def converter_stochasticproximityembedding (data_fname, k):
try:
from shogun import RealFeatures,StochasticProximityEmbedding, SPE_GLOBAL, SPE_LOCAL, CSVFile
features = RealFeatures(CSVFile(data_fname))
converter = Stochast... | #!/usr/bin/env python
data = '../data/fm_train_real.dat'
parameter_list = [[data, 20]]
def converter_stochasticproximityembedding (data_fname, k):
try:
from shogun import RealFeatures,StochasticProximityEmbedding, SPE_GLOBAL, SPE_LOCAL, CSVFile
features = RealFeatures(CSVFile(data_fname))
converter = Stochast... | Use transform instead of embed | Use transform instead of embed
| Python | bsd-3-clause | karlnapf/shogun,lisitsyn/shogun,karlnapf/shogun,geektoni/shogun,geektoni/shogun,besser82/shogun,sorig/shogun,sorig/shogun,lisitsyn/shogun,besser82/shogun,lambday/shogun,geektoni/shogun,sorig/shogun,lambday/shogun,lambday/shogun,lambday/shogun,besser82/shogun,geektoni/shogun,lisitsyn/shogun,lisitsyn/shogun,geektoni/shog... | ---
+++
@@ -14,10 +14,10 @@
# Embed with local strategy
converter.set_k(k)
converter.set_strategy(SPE_LOCAL)
- converter.embed(features)
+ features = converter.transform(features)
# Embed with global strategy
converter.set_strategy(SPE_GLOBAL)
- converter.embed(features)
+ features = converter.tran... |
b7d5767df23aa9b0dcc5c32d83387a622bf9e9e0 | webapp/thing.py | webapp/thing.py | #!/usr/bin/env python
import RPi.GPIO as GPIO
LED_PIN = 23
SWITCH_PIN = 24
# new style class
class PiThing(object):
"""Raspberry Pi Internet 'Thing'."""
def __init__(self):
# use BCM numbering scheme when using Adafruit pi cobbler. Don't use board scheme.
GPIO.setmode(GPIO.BCM)
... | #!/usr/bin/env python
import RPi.GPIO as GPIO
LED_PIN = 23
SWITCH_PIN = 24
# new style class
class PiThing(object):
"""Raspberry Pi Internet 'Thing'."""
def __init__(self):
# use BCM numbering scheme when using Adafruit pi cobbler. Don't use board scheme.
GPIO.setmode(GPIO.BCM)
... | Fix gpio to uppercase GPIO | Fix gpio to uppercase GPIO
| Python | mit | beepscore/pi_thing,beepscore/pi_thing,beepscore/pi_thing | ---
+++
@@ -22,7 +22,7 @@
def read_switch(self):
"""returns true if switch is high, false if switch is low
"""
- return gpio.input(SWITCH_PIN)
+ return GPIO.input(SWITCH_PIN)
def set_led(self, value): |
49749403321d16f14ecf0f6f95d5511e5429d7a2 | actstream/__init__.py | actstream/__init__.py | try:
from actstream.signals import action
except:
pass
import django
__version__ = '1.4.0'
__author__ = 'Asif Saif Uddin, Justin Quick <justquick@gmail.com>'
if django.VERSION < (3, 2):
default_app_config = 'actstream.apps.ActstreamConfig'
| try:
from actstream.signals import action
except:
pass
import django
__version__ = '1.4.0'
__author__ = 'Asif Saif Uddin, Justin Quick <justquick@gmail.com>'
if django.VERSION >= (3, 2):
# The declaration is only needed for older Django versions
pass
else:
default_app_config = 'actstream.apps.Act... | Fix django app config default | Fix django app config default
| Python | bsd-3-clause | justquick/django-activity-stream,pombredanne/django-activity-stream,pombredanne/django-activity-stream,justquick/django-activity-stream | ---
+++
@@ -8,5 +8,8 @@
__version__ = '1.4.0'
__author__ = 'Asif Saif Uddin, Justin Quick <justquick@gmail.com>'
-if django.VERSION < (3, 2):
+if django.VERSION >= (3, 2):
+ # The declaration is only needed for older Django versions
+ pass
+else:
default_app_config = 'actstream.apps.ActstreamConfig' |
edc773bfd5d25a42fa2759631500fc4861557e57 | fireplace/cards/tgt/priest.py | fireplace/cards/tgt/priest.py | from ..utils import *
##
# Minions
# Holy Champion
class AT_011:
events = Heal().on(Buff(SELF, "AT_011e"))
# Spawn of Shadows
class AT_012:
inspire = Hit(ALL_HEROES, 4)
##
# Spells
# Power Word: Glory
class AT_013:
play = Buff(TARGET, "AT_013e")
class AT_013e:
events = Attack(OWNER).on(Heal(FRIENDLY_HERO, ... | from ..utils import *
##
# Minions
# Holy Champion
class AT_011:
events = Heal().on(Buff(SELF, "AT_011e"))
# Spawn of Shadows
class AT_012:
inspire = Hit(ALL_HEROES, 4)
# Shadowfiend
class AT_014:
events = Draw(CONTROLLER).on(Buff(Draw.Args.CARD, "AT_014e"))
# Wyrmrest Agent
class AT_116:
play = HOLDING_DR... | Implement more TGT Priest cards | Implement more TGT Priest cards
| Python | agpl-3.0 | oftc-ftw/fireplace,beheh/fireplace,smallnamespace/fireplace,Meerkov/fireplace,Ragowit/fireplace,smallnamespace/fireplace,oftc-ftw/fireplace,amw2104/fireplace,liujimj/fireplace,NightKev/fireplace,jleclanche/fireplace,Ragowit/fireplace,amw2104/fireplace,liujimj/fireplace,Meerkov/fireplace | ---
+++
@@ -12,6 +12,16 @@
# Spawn of Shadows
class AT_012:
inspire = Hit(ALL_HEROES, 4)
+
+
+# Shadowfiend
+class AT_014:
+ events = Draw(CONTROLLER).on(Buff(Draw.Args.CARD, "AT_014e"))
+
+
+# Wyrmrest Agent
+class AT_116:
+ play = HOLDING_DRAGON & Buff(SELF, "AT_116e")
## |
10dea74d7f7946e9bab8c99b489793708845183c | fireplace/cards/wog/hunter.py | fireplace/cards/wog/hunter.py | from ..utils import *
##
# Minions
class OG_179:
"Fiery Bat"
deathrattle = Hit(RANDOM_ENEMY_CHARACTER, 1)
class OG_292:
"Forlorn Stalker"
play = Buff(FRIENDLY_HAND + MINION + DEATHRATTLE, "OG_292e")
OG_292e = buff(+1, +1)
| from ..utils import *
##
# Minions
class OG_179:
"Fiery Bat"
deathrattle = Hit(RANDOM_ENEMY_CHARACTER, 1)
class OG_292:
"Forlorn Stalker"
play = Buff(FRIENDLY_HAND + MINION + DEATHRATTLE, "OG_292e")
OG_292e = buff(+1, +1)
##
# Spells
class OG_045:
"Infest"
play = Buff(FRIENDLY_MINIONS, "OG_045a")
class ... | Implement Infest, On the Hunt, Call of the Wild | Implement Infest, On the Hunt, Call of the Wild
| Python | agpl-3.0 | jleclanche/fireplace,beheh/fireplace,NightKev/fireplace | ---
+++
@@ -14,3 +14,30 @@
play = Buff(FRIENDLY_HAND + MINION + DEATHRATTLE, "OG_292e")
OG_292e = buff(+1, +1)
+
+
+##
+# Spells
+
+class OG_045:
+ "Infest"
+ play = Buff(FRIENDLY_MINIONS, "OG_045a")
+
+class OG_045a:
+ "Nerubian Spores"
+ deathrattle = Give(CONTROLLER, RandomBeast())
+ tags = {GameTag.DEATHRATT... |
df52bf506fdb6754d51c2320108bcd832a0dfc02 | django_twilio_sms/admin.py | django_twilio_sms/admin.py | from django.contrib import admin
from .models import *
class MessageAdmin(admin.ModelAdmin):
list_display = ('to_phone_number', 'from_phone_number', 'status', 'date_sent')
list_display_links = list_display
list_filter = ('status', 'date_sent')
date_hierarchy = 'date_sent'
ordering = ('-date_sent',... | from django.contrib import admin
from .models import *
class MessageAdmin(admin.ModelAdmin):
list_display = ('to_phone_number', 'from_phone_number', 'status', 'direction', 'date_sent')
list_display_links = list_display
list_filter = ('status', 'direction', 'date_sent')
date_hierarchy = 'date_sent'
... | Add direction to Message listing | Add direction to Message listing
| Python | bsd-3-clause | cfc603/django-twilio-sms-models | ---
+++
@@ -3,9 +3,9 @@
class MessageAdmin(admin.ModelAdmin):
- list_display = ('to_phone_number', 'from_phone_number', 'status', 'date_sent')
+ list_display = ('to_phone_number', 'from_phone_number', 'status', 'direction', 'date_sent')
list_display_links = list_display
- list_filter = ('status', '... |
9ef1c87ec752df3fb32cfe8ee94216e5eb3326fe | alg_quick_sort.py | alg_quick_sort.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def quick_sort(a_list):
"""Quick sort algortihm with list comprehension recursion."""
if len(a_list) <= 1:
return a_list
pivot_value = a_list[len(a_list) // 2]
left_list = [x for x in a... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def quick_sort(a_list):
"""Quick sort algortihm with list comprehension recursion.
Time complexity: O(n*logn).
"""
if len(a_list) <= 1:
return a_list
pivot_value = a_list[len(a... | Add to doc string: time complexity | Add to doc string: time complexity
| Python | bsd-2-clause | bowen0701/algorithms_data_structures | ---
+++
@@ -4,7 +4,10 @@
def quick_sort(a_list):
- """Quick sort algortihm with list comprehension recursion."""
+ """Quick sort algortihm with list comprehension recursion.
+
+ Time complexity: O(n*logn).
+ """
if len(a_list) <= 1:
return a_list
pivot_value = a_list[len(a_list... |
a71b60363a39414eac712210086ce51abeed41d0 | api/feedback/admin.py | api/feedback/admin.py | from django import forms
from django.contrib import admin
from feedback.models import Feedback
class FeedbackAdminForm(forms.ModelForm):
class Meta:
model = Feedback
fields = '__all__'
widgets = {
'comments': forms.Textarea(attrs={'cols': 80, 'rows': 5}),
'user_age... | from django import forms
from django.contrib import admin
from feedback.models import Feedback
class FeedbackAdminForm(forms.ModelForm):
class Meta:
model = Feedback
fields = '__all__'
widgets = {
'comments': forms.Textarea(attrs={'cols': 80, 'rows': 5}),
'user_age... | Order feedback by most recent | Order feedback by most recent
| Python | apache-2.0 | prattl/teamfinder,prattl/teamfinder,prattl/teamfinder,prattl/teamfinder | ---
+++
@@ -34,6 +34,9 @@
'redux_state',
'player__username',
)
+ ordering = (
+ '-created',
+ )
def get_type(self, obj):
return obj.get_type_display() |
90a024186928d98dfbd3db29d02d5eeba4a55415 | sql/src/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.py | sql/src/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.py | import sys
import os
import time
try:
import subprocess
except ImportError:
# use private copy for old Python versions
import MonetDBtesting.subprocess26 as subprocess
def server():
s = subprocess.Popen("%s --dbinit='include sql;' --set gdk_readonly=yes" % os.getenv('MSERVER'),
... | import sys
import os
import time
try:
import subprocess
except ImportError:
# use private copy for old Python versions
import MonetDBtesting.subprocess26 as subprocess
def server():
s = subprocess.Popen('%s "--dbinit=include sql;" --set gdk_readonly=yes' % os.getenv('MSERVER'),
... | Use double quotes to quote command arguments. The Windows command parser doesn't recognize single quotes. | Use double quotes to quote command arguments. The Windows command
parser doesn't recognize single quotes.
| Python | mpl-2.0 | zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb | ---
+++
@@ -8,7 +8,7 @@
import MonetDBtesting.subprocess26 as subprocess
def server():
- s = subprocess.Popen("%s --dbinit='include sql;' --set gdk_readonly=yes" % os.getenv('MSERVER'),
+ s = subprocess.Popen('%s "--dbinit=include sql;" --set gdk_readonly=yes' % os.getenv('MSERVER'),
... |
13f857978378df38a4d52cc92aec750c3804f069 | build.py | build.py | # OSU SPS Website Build Script
def loadFile( src, prefx ):
out = ""
for line in open( src, 'r' ):
out += prefx + line
return out
def outputFile( name, content ):
file = open( name, 'w' )
file.write( content )
file.close()
out_folder = "output/"
src_folder = "src/"
includes_folder ... | # OSU SPS Website Build Script
import os
def loadFile( src, prefx ):
out = ""
for line in open( src, 'r' ):
out += prefx + line
return out
def outputFile( name, content ):
file = open( name, 'w' )
file.write( content )
file.close()
out_folder = "output/"
src_folder = "src/"
inclu... | Remove need for static pages | Remove need for static pages
| Python | mit | GeekLogan/OSU-SPS-Website,GeekLogan/OSU-SPS-Website | ---
+++
@@ -1,4 +1,6 @@
# OSU SPS Website Build Script
+
+import os
def loadFile( src, prefx ):
out = ""
@@ -21,9 +23,11 @@
footer = loadFile( includes_folder + "footer.html", "" )
-names = [
- "index.html"
-]
+names = set()
+for name in os.listdir( src_folder ):
+ names.add( name )
+
+names.r... |
f34c230c93ea8c87a77c29dc1bf86aa450e87749 | build.py | build.py | #!/usr/bin/env python3
import glob
import time
import re
def readfile(fn):
with open(fn, 'Ur', encoding='utf8') as f:
return f.read()
def loaderString(var):
fn = var.group(1)
return readfile(fn).replace('\n', '\\n').replace('\'', '\\\'')
def loaderRaw(var):
fn = var.group(1)
return readf... | #!/usr/bin/env python
import glob
import time
import re
import io
def readfile(fn):
with io.open(fn, 'Ur', encoding='utf8') as f:
return f.read()
def loaderString(var):
fn = var.group(1)
return readfile(fn).replace('\n', '\\n').replace('\'', '\\\'')
def loaderRaw(var):
fn = var.group(1)
... | Use io.open to support python 2.x _and_ python 3 | Use io.open to support python 2.x _and_ python 3 | Python | isc | SpamapS/ingress-intel-total-conversion,fkloft/ingress-intel-total-conversion,Galfinite/ingress-intel-total-conversion,jonatkins/ingress-intel-total-conversion,meyerdg/ingress-intel-total-conversion,pleasantone/ingress-intel-total-conversion,MarkTraceur/ingress-intel-total-conversion,nikolawannabe/ingress-intel-total-co... | ---
+++
@@ -1,11 +1,12 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
import glob
import time
import re
+import io
def readfile(fn):
- with open(fn, 'Ur', encoding='utf8') as f:
+ with io.open(fn, 'Ur', encoding='utf8') as f:
return f.read()
def loaderString(var):
@@ -29,7 +30,7 @@
m = r... |
037fcccebae10f608f5a2711fbbc659411d6879b | okdataset/context.py | okdataset/context.py | """
DataSet context
"""
class DsContext(object):
def __init__(self, config="okdataset.yml"):
self.workers = 8
| import yaml
import os
"""
DataSet context
"""
class Context(object):
def __init__(self, config=os.path.dirname(os.path.realpath(__file__)) + "/../okdataset.yml"):
self.workers = 8
self.config = yaml.load(open(config).read())
| Put yaml config in Context. | Put yaml config in Context.
| Python | mit | anthonyserious/okdataset,anthonyserious/okdataset | ---
+++
@@ -1,6 +1,11 @@
+import yaml
+import os
+
"""
DataSet context
"""
-class DsContext(object):
- def __init__(self, config="okdataset.yml"):
+class Context(object):
+ def __init__(self, config=os.path.dirname(os.path.realpath(__file__)) + "/../okdataset.yml"):
self.workers = 8
+ self.co... |
1697d267633f981b7a6e1a14b5e5b9b05f3b8179 | imagersite/imager_images/tests.py | imagersite/imager_images/tests.py | from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.test import TestCase
import factory
from faker import Faker
from imager_profile.models import ImagerProfile
from .models import Album, Photo
# Create your tests here.
fake = Faker()
class UserFactory(factory.django.Djang... | from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.test import TestCase
import factory
from faker import Faker
from .models import Album, Photo
# Create your tests here.
fake = Faker()
class UserFactory(factory.django.DjangoModelFactory):
"""Create a fake user."""
... | Fix user, album factories; add setup for photo test case | Fix user, album factories; add setup for photo test case
| Python | mit | jesseklein406/django-imager,jesseklein406/django-imager,jesseklein406/django-imager | ---
+++
@@ -4,7 +4,6 @@
import factory
from faker import Faker
-from imager_profile.models import ImagerProfile
from .models import Album, Photo
# Create your tests here.
@@ -30,6 +29,7 @@
photo = factory.django.ImageField()
title = fake.sentence()
description = fake.text()
+ user = factory.... |
9b3f9b69efef93e5c56a0452ccff2e6195663c6b | imboclient/header/authenticate.py | imboclient/header/authenticate.py | import hmac, hashlib
class Authenticate:
def __init__(self, public_key, private_key, method, url, timestamp):
self._public_key = public_key
self._private_key = private_key
self.method = method
self.url = url
self.timestamp = timestamp
def _generate_auth_hash(self):
... | import hmac
import hashlib
class Authenticate:
def __init__(self, public_key, private_key, method, url, timestamp):
self._public_key = public_key
self._private_key = private_key
self.method = method
self.url = url
self.timestamp = timestamp
def _generate_auth_hash(sel... | Clean up PEP8 inconsistencies in header classes | Clean up PEP8 inconsistencies in header classes
| Python | mit | imbo/imboclient-python,imbo/imboclient-python,imbo/imboclient-python | ---
+++
@@ -1,4 +1,6 @@
-import hmac, hashlib
+import hmac
+import hashlib
+
class Authenticate:
def __init__(self, public_key, private_key, method, url, timestamp):
@@ -16,4 +18,3 @@
def headers(self):
signature = self._generate_auth_hash()
return {"Accept": "application/json", "X-Imbo... |
9537cb765776135bc6d2777b6f4f931724edea7f | project_name/project_name/urls.py | project_name/project_name/urls.py | from django.conf.urls import include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
from django.contrib import admin
from django.conf import settings
import views
admin.autodiscover()
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='{{project_name}}/ba... | from django.conf.urls import include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
from django.contrib import admin
from django.conf import settings
import views
import django.contrib.auth.views.login
admin.autodiscover()
urlpatterns = [
url(r'^$', TemplateView.as_... | Include django.contrib.auth.views.login in django 1.10 way | Include django.contrib.auth.views.login in django 1.10 way
| Python | mit | tom-henderson/django-template,tom-henderson/django-template | ---
+++
@@ -5,12 +5,13 @@
from django.conf import settings
import views
+import django.contrib.auth.views.login
admin.autodiscover()
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='{{project_name}}/base.html')),
- url(r'^login/$', 'django.contrib.auth.views.login'),
+ url(r'^login/... |
a0a4ba94cc76d5c4395d869fe5ea70caae14fa36 | pyroSAR/tests/test_snap_exe.py | pyroSAR/tests/test_snap_exe.py | import pytest
from contextlib import contextmanager
from pyroSAR._dev_config import ExamineExe
from pyroSAR.snap.auxil import ExamineSnap
@contextmanager
def not_raises(ExpectedException):
try:
yield
except ExpectedException:
raise AssertionError(
"Did raise exception {0} when it s... | from contextlib import contextmanager
import pytest
from pyroSAR._dev_config import ExamineExe
from pyroSAR.snap.auxil import ExamineSnap
@contextmanager
def not_raises(ExpectedException):
try:
yield
except ExpectedException:
raise AssertionError(
"Did raise exception {0} when i... | Add unit test to determine if the classes ExamineExe and ExamineSnap will work properly. | Add unit test to determine if the classes ExamineExe and ExamineSnap will work properly.
| Python | mit | johntruckenbrodt/pyroSAR,johntruckenbrodt/pyroSAR | ---
+++
@@ -1,7 +1,10 @@
+from contextlib import contextmanager
+
import pytest
-from contextlib import contextmanager
+
from pyroSAR._dev_config import ExamineExe
from pyroSAR.snap.auxil import ExamineSnap
+
@contextmanager
def not_raises(ExpectedException):
@@ -20,24 +23,25 @@
"An unexpected exc... |
584bfedf9c71bad0715b9d167c3e90ec588d5110 | pydarkstar/scrubbing/scrubber.py | pydarkstar/scrubbing/scrubber.py | from ..darkobject import DarkObject
from bs4 import BeautifulSoup
import requests
import logging
import time
class Scrubber(DarkObject):
def __init__(self):
super(Scrubber, self).__init__()
def scrub(self):
"""
Get item metadata.
"""
return {}
# noinspection PyBro... | from ..darkobject import DarkObject
from bs4 import BeautifulSoup
import requests
import logging
import time
import bs4
class Scrubber(DarkObject):
def __init__(self):
super(Scrubber, self).__init__()
def scrub(self):
"""
Get item metadata.
"""
return {}
# noinspe... | Add try accept block for bs4 features | Add try accept block for bs4 features
| Python | mit | AdamGagorik/pydarkstar | ---
+++
@@ -3,6 +3,7 @@
import requests
import logging
import time
+import bs4
class Scrubber(DarkObject):
@@ -43,7 +44,11 @@
raise
time.sleep(1)
- s = BeautifulSoup(handle, features='html5lib')
+ try:
+ s = BeautifulSoup(handle, features='html5... |
3bceae5afd3158e98e76dd0e228efc4d1396a433 | marvin/__init__.py | marvin/__init__.py | """
marvin
~~~~~~
This is the main entry point to marvin, the API endpoints for streamr.
"""
# pylint: disable=invalid-name
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.restful import Api
from os import path
db = SQLAlchemy()
api = Api()
def create_app(config_file=... | """
marvin
~~~~~~
This is the main entry point to marvin, the API endpoints for streamr.
"""
# pylint: disable=invalid-name
from flask import Flask, make_response
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.restful import Api
from os import path
import ujson
db = SQLAlchemy()
api = Api()... | Use ujson for encoding responses. | Use ujson for encoding responses.
| Python | mit | streamr/marvin,streamr/marvin,streamr/marvin | ---
+++
@@ -7,13 +7,21 @@
# pylint: disable=invalid-name
-from flask import Flask
+from flask import Flask, make_response
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.restful import Api
from os import path
+import ujson
+
db = SQLAlchemy()
api = Api()
+
+@api.representation('application/json... |
e096343aaaa916232633543d57431b7f3022215a | awscfncli/__main__.py | awscfncli/__main__.py | # -*- encoding: utf-8 -*-
__author__ = 'kotaimen'
__date__ = '28-Feb-2018'
"""Main cli entry point, called when awscfncli is run as a package,
imported in setuptools intergration.
cli package stucture:
Click main entry:
cli/main.py
Command groups:
cli/group_named/__init__.py
... | # -*- encoding: utf-8 -*-
__author__ = 'kotaimen'
__date__ = '28-Feb-2018'
"""Main cli entry point, called when awscfncli is run as a package,
imported in setuptools intergration.
cli package stucture:
Click main entry:
cli/main.py
Command groups:
cli/group_named/__init__.py
... | Add click automatic environment variable prefix. | Add click automatic environment variable prefix.
| Python | mit | Kotaimen/awscfncli,Kotaimen/awscfncli | ---
+++
@@ -24,7 +24,9 @@
def main():
- cfn_cli()
+ cfn_cli(
+ auto_envvar_prefix='CFN'
+ )
if __name__ == '__main__': |
9684af3ecb0fd26deef87e2509a5de892a62e5f1 | cloudsizzle/studyplanner/courselist/views.py | cloudsizzle/studyplanner/courselist/views.py | # Create your views here.
from django.shortcuts import render_to_response
from studyplanner.courselist.models import Course
from studyplanner.courselist.models import Faculty
from studyplanner.courselist.models import Department
def list_courses(request, faculty, department):
department = Department.objects.get(sl... | # Create your views here.
from django.shortcuts import render_to_response
from studyplanner.courselist.models import Course
from studyplanner.courselist.models import Faculty
from studyplanner.courselist.models import Department
def list_courses(request, faculty, department):
department = Department.objects.get(sl... | Add user object to template context. | Add user object to template context.
| Python | mit | jpvanhal/cloudsizzle,jpvanhal/cloudsizzle | ---
+++
@@ -7,22 +7,23 @@
def list_courses(request, faculty, department):
department = Department.objects.get(slug=department)
courses = department.courses.all()
- return render_to_response('list_courses.html', {
+ return render_to_response('list_courses.html', {'user': request.user,
'depart... |
c6c189ffe13f88d7310291c785ffe363f6c04423 | trayapp.py | trayapp.py |
# Github Tray App
import rumps
import config
import contribs
class GithubTrayApp(rumps.App):
def __init__(self):
super(GithubTrayApp, self).__init__('Github')
self.count = rumps.MenuItem('commits')
self.username = config.get_username()
self.menu = [
self.count,
... |
# Github Tray App
import rumps
import config
import contribs
class GithubTrayApp(rumps.App):
def __init__(self):
super(GithubTrayApp, self).__init__('Github')
self.count = rumps.MenuItem('commits')
self.username = config.get_username()
self.menu = [
self.count,
... | Update in the update function | Update in the update function
| Python | mit | chrisfosterelli/commitwatch | ---
+++
@@ -21,6 +21,7 @@
def update(self):
try:
+ print('Updating user')
num = str(contribs.get_contribs(self.username))
self.icon = 'github0.png' if num == '0' else 'github.png'
self.count.title = num + ' commits'
@@ -28,7 +29,6 @@
@rumps.tim... |
63e31d0594f3813a6d49191d94c4ec7ce6b66e3b | metatlas/tests/test_loader.py | metatlas/tests/test_loader.py | from __future__ import print_function
import tables
from metatlas.mzml_loader import mzml_to_hdf, get_test_data
def test_loader():
path = get_test_data()
out_file = 'test_loader.h5'
mzml_to_hdf(path, out_file_name=out_file)
fid = tables.open_file(out_file)
table = fid.root.spectra
assert t... | from __future__ import print_function
import tables
from metatlas.mzml_loader import mzml_to_hdf, get_test_data
def test_loader():
path = get_test_data()
out_file = 'test_loader.h5'
mzml_to_hdf(path, out_file_name=out_file)
fid = tables.open_file(out_file)
table = fid.root.spectra
assert t... | Fix the query test now that the hdf file order is fixed | Fix the query test now that the hdf file order is fixed
| Python | bsd-3-clause | metabolite-atlas/metatlas,metabolite-atlas/metatlas,metabolite-atlas/metatlas,aitatanit/metatlas,aitatanit/metatlas,biorack/metatlas,aitatanit/metatlas,biorack/metatlas | ---
+++
@@ -17,4 +17,4 @@
assert table[0][0] == 59.01387023925781
assert table[-1][0] == 1666.9520263671875
scan_time = [y['scan_time'] for y in table.where('(ms_level==1)')]
- assert len(scan_time) == 5082
+ assert len(scan_time) == 933367 |
89c97e1923ff481d82d7c6474874633a346ded1d | sigmapiweb/apps/UserInfo/admin.py | sigmapiweb/apps/UserInfo/admin.py | """
Admin config for UserInfo app.
"""
from django.contrib import admin
from common.utils import register_model_admins
from .models import PledgeClass, UserInfo
class UserInfoAdmin(admin.ModelAdmin):
"""
Class to represent the user info for an Admin
"""
search_fields = ['user__first_name', 'user__las... | """
Admin config for UserInfo app.
"""
from django.contrib import admin
from common.utils import register_model_admins
from .models import PledgeClass, UserInfo
class UserInfoAdmin(admin.ModelAdmin):
"""
Class to represent the user info for an Admin
"""
search_fields = ['user__first_name', 'user__las... | Fix quality violation in UserInfo | Fix quality violation in UserInfo
| Python | mit | sigmapi-gammaiota/sigmapi-web,sigmapi-gammaiota/sigmapi-web,sigmapi-gammaiota/sigmapi-web,sigmapi-gammaiota/sigmapi-web | ---
+++
@@ -16,7 +16,8 @@
field.name
for field in UserInfo._meta.fields
if field.name not in UserInfo.admin_display_excluded_fields
- ])
+ ])
+
admin.site.register(UserInfo, UserInfoAdmin)
|
fc67921095b85fc021482417415d935e8de55525 | chatexchange6/_logging26backport.py | chatexchange6/_logging26backport.py | import logging
from logging import *
class Logger26(logging.getLoggerClass()):
def getChild(self, suffix):
"""
(copied from module "logging" for Python 3.4)
Get a logger which is a descendant to this one.
This is a convenience method, such that
logging.getLogger('abc').... | import logging
from logging import *
class Logger(logging.Logger):
def getChild(self, suffix):
"""
(copied from module "logging" for Python 3.4)
Get a logger which is a descendant to this one.
This is a convenience method, such that
logging.getLogger('abc').getChild('de... | Implement backport of logging package for 2.6 | Implement backport of logging package for 2.6
debugging 3
| Python | apache-2.0 | Charcoal-SE/ChatExchange,Charcoal-SE/ChatExchange,ByteCommander/ChatExchange6,ByteCommander/ChatExchange6 | ---
+++
@@ -2,7 +2,7 @@
from logging import *
-class Logger26(logging.getLoggerClass()):
+class Logger(logging.Logger):
def getChild(self, suffix):
"""
@@ -26,4 +26,3 @@
return self.manager.getLogger(suffix)
-logging.setLoggerClass(Logger26) |
19ee49c57fd17f14efffd946019734f1cb4ed18e | pipes/s3/__main__.py | pipes/s3/__main__.py | """Add application.properties to Application's S3 Bucket directory."""
import logging
import argparse
from .create_archaius import init_properties
LOG = logging.getLogger(__name__)
def main():
"""Create application.properties for a given application."""
logging.basicConfig()
parser = argparse.ArgumentPar... | """Add application.properties to Application's S3 Bucket directory."""
import logging
import argparse
from .create_archaius import init_properties
LOG = logging.getLogger(__name__)
def main():
"""Create application.properties for a given application."""
logging.basicConfig()
parser = argparse.ArgumentPar... | Add build as a possible environment option | Add build as a possible environment option
| Python | apache-2.0 | gogoair/foremast,gogoair/foremast | ---
+++
@@ -19,7 +19,7 @@
help='Set DEBUG output')
parser.add_argument('-e',
'--env',
- choices=('dev', 'stage', 'prod'),
+ choices=('build', 'dev', 'stage', 'prod'),
default='dev',
... |
c7b7f3709fc958a2c694858c65a379cfcd54f72b | myflaskapp/tests/test_unit.py | myflaskapp/tests/test_unit.py | import unittest
import requests
class SmokeTest(unittest.TestCase):
def test_maths(self):
self.assertEquals(6, 2 + 4)
def test_home_page_is_about_todo_lists(self):
request = requests.get('http://localhost:5000')
self.assertTrue(
request.content.startswith(bytes('\n\n<!doct... | import unittest
import requests
class SmokeTest(unittest.TestCase):
def test_maths(self):
self.assertEquals(6, 2 + 4)
def test_home_page_is_about_todo_lists(self):
request = requests.get('http://localhost:5000')
self.assertTrue(
request.content.startswith(b'\n\n<!doctype h... | Use less verbose byte string syntax | Use less verbose byte string syntax
| Python | mit | terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python | ---
+++
@@ -9,13 +9,11 @@
def test_home_page_is_about_todo_lists(self):
request = requests.get('http://localhost:5000')
self.assertTrue(
- request.content.startswith(bytes('\n\n<!doctype html>\n', 'utf-8')))
+ request.content.startswith(b'\n\n<!doctype html>\n'))
... |
1a2527afdc5cb9c948ac74a9925d90709d6150cc | seleniumbase/fixtures/constants.py | seleniumbase/fixtures/constants.py | """
This class containts some frequently-used constants
"""
class Environment:
QA = "qa"
STAGING = "staging"
PRODUCTION = "production"
MASTER = "master"
LOCAL = "local"
TEST = "test"
class Files:
DOWNLOADS_FOLDER = "downloaded_files"
ARCHIVED_DOWNLOADS_FOLDER = "archived_files"
cla... | """
This class containts some frequently-used constants
"""
class Environment:
QA = "qa"
STAGING = "staging"
PRODUCTION = "production"
MASTER = "master"
LOCAL = "local"
TEST = "test"
class Files:
DOWNLOADS_FOLDER = "downloaded_files"
ARCHIVED_DOWNLOADS_FOLDER = "archived_files"
cla... | Remove "htmlunit" from browser options | Remove "htmlunit" from browser options
| Python | mit | mdmintz/SeleniumBase,mdmintz/seleniumspot,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/seleniumspot,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase | ---
+++
@@ -28,7 +28,6 @@
SAFARI = "safari"
GOOGLE_CHROME = "chrome"
PHANTOM_JS = "phantomjs"
- HTML_UNIT = "htmlunit"
VERSION = {
"firefox": None,
@@ -36,8 +35,7 @@
"edge": None,
"safari": None,
"chrome": None,
- "phantomjs": None,
- "htmluni... |
6ca85774de9532676b784646ecad3ef62b09ed5e | scripts/settings/fieldnames.py | scripts/settings/fieldnames.py | # Hexagons
HexID = 'HexID'
# ProviderServiceAreas
ServiceClass = 'ServiceClass'
ProvName = 'ProvName'
#Providers
Colloquial = 'Colloquial'
Code = 'Code'
URL = 'URL'
#Utilities
PROVIDER = 'PROVIDER'
WEBLINK = 'WEBLINK'
#Roads
CARTOCODE = 'CARTOCODE'
FULLNAME = 'FULLNAME'
#Drive Times
ToBreak = 'ToBreak'
Name = 'Nam... | # Hexagons
HexID = 'HexID'
# ProviderServiceAreas
ServiceClass = 'ServiceClass'
ProvName = 'ProvName'
#Providers
Colloquial = 'Colloquial'
Code = 'Code'
URL = 'URL'
#Utilities
PROVIDER = 'PROVIDER'
WEBLINK = 'WEBLINK'
#Roads
CARTOCODE = 'CARTOCODE'
FULLNAME = 'HWYNAME'
#Drive Times
ToBreak = 'ToBreak'
Name = 'Name... | Use HWYNAME for road names in report | Use HWYNAME for road names in report
Related to #36
| Python | mit | agrc/bb-econ,agrc/bb-econ,agrc/bb-econ | ---
+++
@@ -16,7 +16,7 @@
#Roads
CARTOCODE = 'CARTOCODE'
-FULLNAME = 'FULLNAME'
+FULLNAME = 'HWYNAME'
#Drive Times
ToBreak = 'ToBreak' |
020c13f3b39d495d50704317fe12ee4a4e735bb4 | kylin/_injector.py | kylin/_injector.py | from functools import wraps
from typing import Callable
from ._scope import Scope
class Injector(Callable):
"""
class decorator to inject dependencies into a callable decorated function
"""
def __init__(self, dependencies: dict, fun: Callable):
self.dependencies = dependencies
se... | from functools import wraps
from typing import Callable
from ._scope import Scope
class Injector(Callable):
"""
class decorator to inject dependencies into a callable decorated function
"""
def __init__(self, dependencies: dict, fun: Callable):
self.dependencies = dependencies
se... | Fix bug of self injection into injector function | Fix bug of self injection into injector function
| Python | mit | WatanukiRasadar/kylin | ---
+++
@@ -35,4 +35,6 @@
self.dependencies = dependencies
def __call__(self, fun: Callable):
- return wraps(fun).__call__(self.__injector__(self.dependencies, fun))
+ def call(*args, **kwargs):
+ return self.__injector__(self.dependencies, fun).__call__(*args, **kwargs)
+ ... |
291da4afa9f359dc4cfda6a683afdcead39d557b | simiki/conf_templates/fabfile.py | simiki/conf_templates/fabfile.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import os.path
from fabric.api import env, local, run
from fabric.colors import blue
import fabric.contrib.project as project
# Remote host and username
env.hosts = []
env.user = ""
env.colorize_errors = True
# Local outp... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import os.path
from sys import exit
from fabric.api import env, local, run
from fabric.colors import blue, red
import fabric.contrib.project as project
# Remote host and username
env.hosts = []
env.user = ""
env.colorize_e... | Fix serious problem using rsync | Fix serious problem using rsync
If env.remote_output not set, use rsync --delete option will
empty the whole remote system, this is a very serious problem!
| Python | mit | tankywoo/simiki,tankywoo/simiki,9p0le/simiki,9p0le/simiki,9p0le/simiki,zhaochunqi/simiki,tankywoo/simiki,zhaochunqi/simiki,zhaochunqi/simiki | ---
+++
@@ -5,8 +5,9 @@
import os
import os.path
+from sys import exit
from fabric.api import env, local, run
-from fabric.colors import blue
+from fabric.colors import blue, red
import fabric.contrib.project as project
# Remote host and username
@@ -21,6 +22,8 @@
# Remote path to deploy output
env.remote_... |
bcabd0e0766e1d8f93c86ac8102e71bec446ef20 | ynr/apps/sopn_parsing/management/commands/sopn_tooling_write_baseline.py | ynr/apps/sopn_parsing/management/commands/sopn_tooling_write_baseline.py | import json
import os
from candidates.models import Ballot
from bulk_adding.models import RawPeople
from django.core.management.base import BaseCommand
class Command(BaseCommand):
"""This command uses the ballots endpoint to loop over each
ballot and store each sopn pdf (uploaded_file) locally"""
def ad... | import json
import os
from django.db.models import Q
from candidates.models import Ballot
from bulk_adding.models import RawPeople
from django.core.management.base import BaseCommand
class Command(BaseCommand):
"""
Creates a JSON file to represent ballots that have an Officialdocument.
Only include ball... | Update which objects are used to write baseline file | Update which objects are used to write baseline file
| Python | agpl-3.0 | DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative | ---
+++
@@ -1,5 +1,7 @@
import json
import os
+
+from django.db.models import Q
from candidates.models import Ballot
from bulk_adding.models import RawPeople
@@ -7,8 +9,14 @@
class Command(BaseCommand):
- """This command uses the ballots endpoint to loop over each
- ballot and store each sopn pdf (up... |
92bbddc2901c5720042fcadbbceaa68642e7cf3d | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_tasks.py | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_tasks.py | import pytest
from celery.result import EagerResult
from {{ cookiecutter.project_slug }}.users.tasks import get_users_count
from {{ cookiecutter.project_slug }}.users.tests.factories import UserFactory
@pytest.mark.django_db
def test_user_count(settings):
"""A basic test to execute the get_users_count Celery tas... | import pytest
from celery.result import EagerResult
from {{ cookiecutter.project_slug }}.users.tasks import get_users_count
from {{ cookiecutter.project_slug }}.users.tests.factories import UserFactory
pytestmark = pytest.mark.django_db
def test_user_count(settings):
"""A basic test to execute the get_users_cou... | Change style for pytest marker | Change style for pytest marker
Update pytest.mark.django_db to be more consistent with rest of the project
| Python | bsd-3-clause | luzfcb/cookiecutter-django,pydanny/cookiecutter-django,trungdong/cookiecutter-django,ryankanno/cookiecutter-django,luzfcb/cookiecutter-django,pydanny/cookiecutter-django,luzfcb/cookiecutter-django,trungdong/cookiecutter-django,luzfcb/cookiecutter-django,ryankanno/cookiecutter-django,trungdong/cookiecutter-django,pydann... | ---
+++
@@ -4,8 +4,9 @@
from {{ cookiecutter.project_slug }}.users.tasks import get_users_count
from {{ cookiecutter.project_slug }}.users.tests.factories import UserFactory
+pytestmark = pytest.mark.django_db
-@pytest.mark.django_db
+
def test_user_count(settings):
"""A basic test to execute the get_user... |
01551a1985064f319600732197afeb93cb64a377 | locust/__init__.py | locust/__init__.py | from .user.sequential_taskset import SequentialTaskSet
from .user.task import task, TaskSet
from .user.users import HttpUser, User
from .user.wait_time import between, constant, constant_pacing
from .event import Events
events = Events()
__version__ = "1.0b1"
| from .user.sequential_taskset import SequentialTaskSet
from .user import wait_time
from .user.task import task, TaskSet
from .user.users import HttpUser, User
from .user.wait_time import between, constant, constant_pacing
from .event import Events
events = Events()
__version__ = "1.0b1"
| Add wait_time to locust python package namespace (to not break `from locust.wait_time import ...` imports) | Add wait_time to locust python package namespace (to not break `from locust.wait_time import ...` imports) | Python | mit | mbeacom/locust,locustio/locust,mbeacom/locust,locustio/locust,locustio/locust,mbeacom/locust,mbeacom/locust,locustio/locust | ---
+++
@@ -1,4 +1,5 @@
from .user.sequential_taskset import SequentialTaskSet
+from .user import wait_time
from .user.task import task, TaskSet
from .user.users import HttpUser, User
from .user.wait_time import between, constant, constant_pacing |
14462f42c8e187411e5875686ce8869bbd9b1fb7 | spectator/core/imagegenerators.py | spectator/core/imagegenerators.py | from imagekit import ImageSpec, register
from imagekit.processors import ResizeToFit
from spectator.core import app_settings
class Thumbnail(ImageSpec):
"Base class"
format = "JPEG"
options = {"quality": 60}
class ListThumbnail(Thumbnail):
"For displaying in lists of Publications, Events, etc."
... | from imagekit import ImageSpec, register
from imagekit.processors import ResizeToFit
from spectator.core import app_settings
class Thumbnail(ImageSpec):
"Base class"
format = "JPEG"
options = {"quality": 80}
class ListThumbnail(Thumbnail):
"For displaying in lists of Publications, Events, etc."
... | Increase thumbnail quality to 80 from 60 | Increase thumbnail quality to 80 from 60
Some of them were looking pretty compressed.
| Python | mit | philgyford/django-spectator,philgyford/django-spectator,philgyford/django-spectator | ---
+++
@@ -7,7 +7,7 @@
class Thumbnail(ImageSpec):
"Base class"
format = "JPEG"
- options = {"quality": 60}
+ options = {"quality": 80}
class ListThumbnail(Thumbnail): |
48be00323c57b6a61455d2591970e1380da8055c | libcloud/dns/providers.py | libcloud/dns/providers.py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | Remove route54 provider because the driver is not finished yet. | Remove route54 provider because the driver is not finished yet.
git-svn-id: 9ad005ce451fa0ce30ad6352b03eb45b36893355@1340889 13f79535-47bb-0310-9956-ffa450edef68
| Python | apache-2.0 | sergiorua/libcloud,Cloud-Elasticity-Services/as-libcloud,Cloud-Elasticity-Services/as-libcloud,mbrukman/libcloud,iPlantCollaborativeOpenSource/libcloud,sfriesel/libcloud,ByteInternet/libcloud,curoverse/libcloud,cryptickp/libcloud,schaubl/libcloud,t-tran/libcloud,carletes/libcloud,MrBasset/libcloud,ninefold/libcloud,jim... | ---
+++
@@ -26,9 +26,7 @@
Provider.RACKSPACE_US:
('libcloud.dns.drivers.rackspace', 'RackspaceUSDNSDriver'),
Provider.RACKSPACE_UK:
- ('libcloud.dns.drivers.rackspace', 'RackspaceUKDNSDriver'),
- Provider.ROUTE53:
- ('libcloud.dns.drivers.route53', 'Route53DNSDriver')
+ ('li... |
bd8fdf1dccc3660be3b8e020a637f94d21dc2b3a | gaphas/tests/test_state.py | gaphas/tests/test_state.py | from builtins import object
import unittest
from gaphas.state import reversible_pair, observed, _reverse
class SList(object):
def __init__(self):
self.l = list()
def add(self, node, before=None):
if before: self.l.insert(self.l.index(before), node)
else: self.l.append(node)
add = o... | from builtins import object
import unittest
from gaphas.state import reversible_pair, observed, _reverse
class SList(object):
def __init__(self):
self.l = list()
def add(self, node, before=None):
if before: self.l.insert(self.l.index(before), node)
else: self.l.append(node)
add = o... | Fix function object has no attribute __func__ | Fix function object has no attribute __func__
Signed-off-by: Dan Yeaw <2591e5f46f28d303f9dc027d475a5c60d8dea17a@yeaw.me>
| Python | lgpl-2.1 | amolenaar/gaphas | ---
+++
@@ -21,5 +21,5 @@
reversible_pair(SList.add, SList.remove, \
bind1={'before': lambda self, node: self.l[self.l.index(node)+1] })
- self.assertTrue(SList.add.__func__ in _reverse)
- self.assertTrue(SList.remove.__func__ in _reverse)
+ self.assertTrue(SList.add in _r... |
7cad00f02c2f86cbeb23755f47f9bf1d45be2f8e | logperfu.py | logperfu.py | import threading
import fresenius
import readline
import time
import sys
prompt = '> '
port = sys.argv[1]
fresbase = fresenius.FreseniusComm(port = port)
logfile = open('seringues.log', 'w')
def printrx():
while not logfile.closed:
origin, msg = fresbase.recvq.get()
logfile.write("{};{}\n".forma... | import threading
import fresenius
import readline
import time
import sys
from decimal import Decimal
prompt = '> '
port = sys.argv[1]
fresbase = fresenius.FreseniusComm(port = port)
logfile = open('seringues.log', 'w')
def printrx():
while not logfile.closed:
origin, msg = fresbase.recvq.get()
l... | Use decimal in the logger to get the most accurate time info | Use decimal in the logger to get the most accurate time info
| Python | isc | jaj42/infupy | ---
+++
@@ -3,6 +3,7 @@
import readline
import time
import sys
+from decimal import Decimal
prompt = '> '
@@ -14,7 +15,7 @@
def printrx():
while not logfile.closed:
origin, msg = fresbase.recvq.get()
- logfile.write("{};{}\n".format(time.time(), msg))
+ logfile.write("{};{}\n".for... |
b66fc000a2d1328f557fb2c563f99b4748bf88b1 | py101/boilerplate/__init__.py | py101/boilerplate/__init__.py | """"
Boilerplate Adventure
Author: Ignacio Avas (iavas@sophilabs.com)
"""
import codecs
import io
import sys
import unittest
from story.adventures import AdventureVerificationError, BaseAdventure
from story.translation import gettext as _
class TestOutput(unittest.TestCase):
"""Variables Adventure test"""
de... | """"
Boilerplate Adventure
Author: Ignacio Avas (iavas@sophilabs.com)
"""
import codecs
import io
import sys
import unittest
from story.adventures import AdventureVerificationError, BaseAdventure
from story.translation import gettext as _
class TestOutput(unittest.TestCase):
"""Variables Adventure test"""
de... | Comment out some boilerplate code, to prevent failures | Comment out some boilerplate code, to prevent failures
| Python | mit | sophilabs/py101 | ---
+++
@@ -30,8 +30,9 @@
def runTest(self):
"""Makes a simple test of the output"""
- code = compile(self.candidate_code, self.file_name, 'exec', optimize=0)
- exec(code)
+ #code = compile(self.candidate_code, self.file_name, 'exec', optimize=0)
+ #exec(code)
+ self... |
b2ebc5878f7113756970ef52ae8e0db4cc6e5cf2 | marbaloo_mako/__init__.py | marbaloo_mako/__init__.py | import cherrypy
from mako.lookup import TemplateLookup
class Tool(cherrypy.Tool):
_lookups = {}
def __init__(self):
cherrypy.Tool.__init__(self, 'before_handler',
self.callable,
priority=20)
def callable(self,
filenam... | import cherrypy
from mako.lookup import TemplateLookup
class Tool(cherrypy.Tool):
_lookups = {}
def __init__(self):
cherrypy.Tool.__init__(self, 'before_handler',
self.callable,
priority=40)
def callable(self,
filenam... | Increase tool priority, to keep space between cherrypy builtin tools like `json_out`. | Increase tool priority, to keep space between cherrypy builtin tools like `json_out`.
| Python | mit | marbaloo/marbaloo_mako | ---
+++
@@ -8,7 +8,7 @@
def __init__(self):
cherrypy.Tool.__init__(self, 'before_handler',
self.callable,
- priority=20)
+ priority=40)
def callable(self,
filename=None, |
f3299b3108c8fab7015541e9d9b1ef220a488f87 | onitu/escalator/server/__main__.py | onitu/escalator/server/__main__.py | import zmq
from .databases import Databases
from .worker import Worker
context = zmq.Context()
back_uri = 'inproc://workers'
proxy = zmq.devices.ThreadDevice(
device_type=zmq.QUEUE, in_type=zmq.DEALER, out_type=zmq.ROUTER
)
proxy.bind_out('tcp://*:4224')
proxy.bind_in(back_uri)
proxy.start()
databases = Databa... | import argparse
import zmq
from .databases import Databases
from .worker import Worker
parser = argparse.ArgumentParser("escalator")
parser.add_argument(
'--bind', default='tcp://*:4224',
help="Address to bind escalator server"
)
args = parser.parse_args()
context = zmq.Context()
back_uri = 'inproc://work... | Use command-line argument to bind server address | Use command-line argument to bind server address
| Python | mit | onitu/onitu,onitu/onitu,onitu/onitu | ---
+++
@@ -1,7 +1,17 @@
+import argparse
+
import zmq
from .databases import Databases
from .worker import Worker
+
+
+parser = argparse.ArgumentParser("escalator")
+parser.add_argument(
+ '--bind', default='tcp://*:4224',
+ help="Address to bind escalator server"
+)
+args = parser.parse_args()
context... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.