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 |
|---|---|---|---|---|---|---|---|---|---|---|
e9b422c74382d88787114796e7e4b6dfd2b25225 | codesharer/app.py | codesharer/app.py | from flask import Flask
from flaskext.redis import Redis
def create_app():
from codesharer.apps.classifier.views import frontend
app = Flask(__name__)
app.config.from_object('codesharer.conf.Config')
app.register_module(frontend)
db = Redis(app)
db.init_app(app)
app.db = db
ret... | from flask import Flask
from flaskext.redis import Redis
def create_app():
from codesharer.apps.snippets.views import frontend
app = Flask(__name__)
app.config.from_object('codesharer.conf.Config')
app.register_module(frontend)
db = Redis(app)
db.init_app(app)
app.db = db
retur... | Correct path to frontend views | Correct path to frontend views
| Python | apache-2.0 | disqus/codebox,disqus/codebox | ---
+++
@@ -2,7 +2,7 @@
from flaskext.redis import Redis
def create_app():
- from codesharer.apps.classifier.views import frontend
+ from codesharer.apps.snippets.views import frontend
app = Flask(__name__)
app.config.from_object('codesharer.conf.Config') |
a8a0dd55a5289825aae34aa45765ea328811523e | spotpy/unittests/test_fast.py | spotpy/unittests/test_fast.py | import unittest
try:
import spotpy
except ImportError:
import sys
sys.path.append(".")
import spotpy
from spotpy.examples.spot_setup_hymod_python import spot_setup
class TestFast(unittest.TestCase):
def setUp(self):
self.spot_setup = spot_setup()
self.rep = 200 # REP must be a... | import unittest
try:
import spotpy
except ImportError:
import sys
sys.path.append(".")
import spotpy
from spotpy.examples.spot_setup_hymod_python import spot_setup
# Test only untder Python 3 as Python >2.7.10 results in a strange fft error
if sys.version_info >= (3, 5):
class TestFast(unittest... | Exclude Fast test for Python 2 | Exclude Fast test for Python 2
| Python | mit | bees4ever/spotpy,bees4ever/spotpy,thouska/spotpy,thouska/spotpy,bees4ever/spotpy,thouska/spotpy | ---
+++
@@ -10,25 +10,26 @@
from spotpy.examples.spot_setup_hymod_python import spot_setup
+# Test only untder Python 3 as Python >2.7.10 results in a strange fft error
+if sys.version_info >= (3, 5):
-
-class TestFast(unittest.TestCase):
- def setUp(self):
-
- self.spot_setup = spot_setup()
- ... |
e736482bec7be7871bd4edd270f8c064961c20fc | setup.py | setup.py | #!/usr/bin/env python
from __future__ import unicode_literals
from setuptools import setup, find_packages
install_requires = [
"Jinja2",
"boto",
"flask",
"httpretty>=0.6.1",
"requests",
"xmltodict",
"six",
"werkzeug",
]
import sys
if sys.version_info < (2, 7):
# No buildint Ordere... | #!/usr/bin/env python
from __future__ import unicode_literals
from setuptools import setup, find_packages
install_requires = [
"Jinja2",
"boto>=2.20.0",
"flask",
"httpretty>=0.6.1",
"requests",
"xmltodict",
"six",
"werkzeug",
]
import sys
if sys.version_info < (2, 7):
# No buildin... | Update minimum support boto version. | Update minimum support boto version.
boto 2.20.0 introduces kinesis. alternatively, this requirement could be
relaxed by using conditional imports.
| Python | apache-2.0 | gjtempleton/moto,botify-labs/moto,dbfr3qs/moto,botify-labs/moto,heddle317/moto,braintreeps/moto,spulec/moto,rocky4570/moto,ZuluPro/moto,kennethd/moto,okomestudio/moto,Affirm/moto,alexdebrie/moto,Brett55/moto,riccardomc/moto,2mf/moto,heddle317/moto,rocky4570/moto,dbfr3qs/moto,botify-labs/moto,dbfr3qs/moto,2rs2ts/moto,js... | ---
+++
@@ -4,7 +4,7 @@
install_requires = [
"Jinja2",
- "boto",
+ "boto>=2.20.0",
"flask",
"httpretty>=0.6.1",
"requests", |
522b197500bffb748dc2daf3bf0ea448b3094af7 | example_config.py | example_config.py | """
File to easily switch between configurations between production and
development, etc.
"""
import os
# You must set each of these in your heroku environment with the heroku
# config:set command. See README.md for more information.
HEROKU_ENV_REQUIREMENTS = ('HEROKU', 'SECRET_KEY', 'GITHUB_CLIENT_ID',
... | """
File to easily switch between configurations between production and
development, etc.
"""
import os
# You must set each of these in your heroku environment with the heroku
# config:set command. See README.md for more information.
HEROKU_ENV_REQUIREMENTS = ('HEROKU', 'SECRET_KEY', 'GITHUB_CLIENT_ID',
... | Add another missing heroku config variable | Add another missing heroku config variable
| Python | agpl-3.0 | paulocheque/guides-cms,pluralsight/guides-cms,paulocheque/guides-cms,pluralsight/guides-cms,pluralsight/guides-cms,paulocheque/guides-cms | ---
+++
@@ -9,7 +9,8 @@
# You must set each of these in your heroku environment with the heroku
# config:set command. See README.md for more information.
HEROKU_ENV_REQUIREMENTS = ('HEROKU', 'SECRET_KEY', 'GITHUB_CLIENT_ID',
- 'GITHUB_SECRET', 'DATABASE_URL')
+ '... |
52841517a575ba7df354b809cb23bc2851c9fcd4 | exec_proc.py | exec_proc.py | #!/usr/bin/env python
# Copyright 2014 Boundary, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | #!/usr/bin/env python
# Copyright 2014 Boundary, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | Remove carriage returns from the output | Remove carriage returns from the output
| Python | apache-2.0 | jdgwartney/boundary-plugin-shell,boundary/boundary-plugin-shell,boundary/boundary-plugin-shell,jdgwartney/boundary-plugin-shell | ---
+++
@@ -35,12 +35,12 @@
if self.command == None:
raise ValueError
# Remove Carriage Returns
- command = self.command.strip('\r')
- args = shlex.split(command)
+ args = shlex.split(self.command)
if self.debug == True:
logging.info("command=\... |
5ab0c1c1323b2b12a19ef58de4c03236db84644d | cellcounter/accounts/urls.py | cellcounter/accounts/urls.py | from django.conf.urls import patterns, url
from cellcounter.accounts import views
urlpatterns = patterns('',
url('^new/$', views.RegistrationView.as_view(), name='register'),
url('^(?P<pk>[0-9]+)/$', views.UserDetailView.as_view(), name='user-detail'),
url('^(?P<pk>[0-9]+)/delete/$', views.UserDeleteView.... | from django.conf.urls import patterns, url
from cellcounter.accounts import views
urlpatterns = patterns('',
url('^new/$', views.RegistrationView.as_view(), name='register'),
url('^(?P<pk>[0-9]+)/$', views.UserDetailView.as_view(), name='user-detail'),
url('^(?P<pk>[0-9]+)/delete/$', views.UserDeleteView.... | Remove old views and replace with new PasswordResetConfirmView | Remove old views and replace with new PasswordResetConfirmView
| Python | mit | haematologic/cellcounter,haematologic/cellcounter,cellcounter/cellcounter,cellcounter/cellcounter,cellcounter/cellcounter,haematologic/cellcounter,cellcounter/cellcounter | ---
+++
@@ -9,12 +9,8 @@
url('^(?P<pk>[0-9]+)/edit/$', views.UserUpdateView.as_view(), name='user-update'),
url('^password/reset/$', views.PasswordResetView.as_view(),
name='password-reset'),
- url('^password/reset/done/$', views.password_reset_done, name='password-reset-done'),
url('^passw... |
f0acf5023db56e8011a6872f230514a69ec9f311 | extractor.py | extractor.py | import extractor.ui.mainapplication as ui
import Tkinter as tk
def main():
root = tk.Tk()
root.title('SNES Wolfenstein 3D Extractor')
root.minsize(400, 100)
ui.MainApplication(root).pack(side="top", fill="both", expand=True)
root.mainloop()
main()
| import extractor.ui.mainapplication as ui
import Tkinter as tk
def main():
## root = tk.Tk()
## root.title('SNES Wolfenstein 3D Extractor')
## root.minsize(400, 100)
## ui.MainApplication(root).pack(side="top", fill="both", expand=True)
## root.mainloop()
ui.MainApplication().mainloop()
main()
| Use new MainApplication Tk class. | Use new MainApplication Tk class.
| Python | mit | adambiser/snes-wolf3d-extractor | ---
+++
@@ -2,10 +2,11 @@
import Tkinter as tk
def main():
- root = tk.Tk()
- root.title('SNES Wolfenstein 3D Extractor')
- root.minsize(400, 100)
- ui.MainApplication(root).pack(side="top", fill="both", expand=True)
- root.mainloop()
+## root = tk.Tk()
+## root.title('SNES Wolfenstein 3D Ext... |
5e53f1e86fc7c4f1c7b42479684ac393c997ce52 | client/test/test-unrealcv.py | client/test/test-unrealcv.py | # TODO: Test robustness, test speed
import unittest, time, sys
from common_conf import *
from test_server import EchoServer, MessageServer
import argparse
import threading
from test_server import TestMessageServer
from test_client import TestClientWithDummyServer
from test_commands import TestCommands
from test_realist... | # TODO: Test robustness, test speed
import unittest, time, sys
from common_conf import *
from test_server import EchoServer, MessageServer
import argparse
import threading
from test_server import TestMessageServer
from test_client import TestClientWithDummyServer
from test_commands import TestCommands
from test_realist... | Fix exit code of unittest. | Fix exit code of unittest.
| Python | mit | qiuwch/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv | ---
+++
@@ -24,4 +24,5 @@
s = load(TestRealisticRendering); suites.append(s)
suite_obj = unittest.TestSuite(suites)
- unittest.TextTestRunner(verbosity = 2).run(suite_obj)
+ ret = not unittest.TextTestRunner(verbosity = 2).run(suite_obj).wasSucessful()
+ sys.exit(ret) |
ce9da309294f2520f297980d80773160f050e8bf | yubico/yubico_exceptions.py | yubico/yubico_exceptions.py | class YubicoError(Exception):
""" Base class for Yubico related exceptions. """
pass
class StatusCodeError(YubicoError):
def __init__(self, status_code):
self.status_code = status_code
def __str__(self):
return ('Yubico server returned the following status code: %s' %
... | __all___ = [
'YubicoError',
'StatusCodeError',
'InvalidClientIdError',
'SignatureVerificationError'
]
class YubicoError(Exception):
""" Base class for Yubico related exceptions. """
pass
class StatusCodeError(YubicoError):
def __init__(self, status_code):
self.status_code = statu... | Add __all__ in exceptions module. | Add __all__ in exceptions module. | Python | bsd-3-clause | Kami/python-yubico-client | ---
+++
@@ -1,3 +1,11 @@
+__all___ = [
+ 'YubicoError',
+ 'StatusCodeError',
+ 'InvalidClientIdError',
+ 'SignatureVerificationError'
+]
+
+
class YubicoError(Exception):
""" Base class for Yubico related exceptions. """
pass |
b20320301eb311bb1345061a8b74ac63495051b1 | tastydocs/urls.py | tastydocs/urls.py | from django.conf.urls.defaults import patterns
from views import doc
urlpatterns = patterns(
'',
(r'^api$', doc),
(r'^example/(?P<resource_name>\w+)/', 'tastydocs.views.example_data'),
)
| from django.conf.urls.defaults import patterns
from views import doc
urlpatterns = patterns(
'',
(r'^api/$', doc),
(r'^example/(?P<resource_name>\w+)/', 'tastydocs.views.example_data'),
)
| Add trailing slash to /docs/api/ url pattern. This provides more flexibility for end users in that they can choose to navigate to /docs/api or /docs/api/ successfully. Without the trailing slash in the url pattern, /docs/api/ returns a 404. | Add trailing slash to /docs/api/ url pattern. This provides more flexibility for end users in that they can choose to navigate to /docs/api or /docs/api/ successfully. Without the trailing slash in the url pattern, /docs/api/ returns a 404.
| Python | bsd-3-clause | juanique/django-tastydocs,juanique/django-tastydocs,juanique/django-tastydocs,juanique/django-tastydocs | ---
+++
@@ -3,6 +3,6 @@
urlpatterns = patterns(
'',
- (r'^api$', doc),
+ (r'^api/$', doc),
(r'^example/(?P<resource_name>\w+)/', 'tastydocs.views.example_data'),
) |
682f45ffd222dc582ee770a0326c962540657c68 | django_twilio/models.py | django_twilio/models.py | # -*- coding: utf-8 -*-
from django.db import models
from phonenumber_field.modelfields import PhoneNumberField
class Caller(models.Model):
"""A caller is defined uniquely by their phone number.
:param bool blacklisted: Designates whether the caller can use our
services.
:param char phone_number... | # -*- coding: utf-8 -*-
from django.db import models
from phonenumber_field.modelfields import PhoneNumberField
class Caller(models.Model):
"""A caller is defined uniquely by their phone number.
:param bool blacklisted: Designates whether the caller can use our
services.
:param char phone_number... | Fix an error in __unicode__ | Fix an error in __unicode__
__unicode__ name displaying incorrectly - FIXED
| Python | unlicense | rdegges/django-twilio,aditweb/django-twilio | ---
+++
@@ -16,4 +16,7 @@
phone_number = PhoneNumberField(unique=True)
def __unicode__(self):
- return str(self.phone_number) + ' (blacklisted)' if self.blacklisted else ''
+ name = str(self.phone_number)
+ if self.blacklisted:
+ name += ' (blacklisted)'
+ return nam... |
946f8ff1c475ebf6f339c4df5eb5f7069c5633e9 | apps/core/views.py | apps/core/views.py | from django.views.generic.detail import ContextMixin
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from apps.categories.models import Category
from apps.books.models import Book
class BaseView(ContextMixin):
"""docstring for BaseView"""
model = ... | from django.views.generic.detail import ContextMixin
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from apps.categories.models import Category
from apps.books.models import Book
class BaseView(ContextMixin):
"""docstring for BaseView"""
model = ... | Fix did not return HttpResponse when comment | Fix did not return HttpResponse when comment
| Python | mit | vuonghv/brs,vuonghv/brs,vuonghv/brs,vuonghv/brs | ---
+++
@@ -23,4 +23,4 @@
@method_decorator(login_required)
def dispatch(self, request, *args, **kwargs):
- super().dispatch(request, *args, **kwargs)
+ return super().dispatch(request, *args, **kwargs) |
4a782f94e8fe5a26e2998408c2cb013f2aebe9ac | contentcuration/contentcuration/migrations/0091_auto_20180724_2243.py | contentcuration/contentcuration/migrations/0091_auto_20180724_2243.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-07-24 22:43
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contentcuration', '0090_auto_20180724_1625'),
]
... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-07-24 22:43
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contentcuration', '0089_auto_20180706_2242'),
]
... | Remove reference to old, bad migration that was in my local tree. | Remove reference to old, bad migration that was in my local tree.
| Python | mit | jayoshih/content-curation,jayoshih/content-curation,jayoshih/content-curation,fle-internal/content-curation,DXCanas/content-curation,fle-internal/content-curation,DXCanas/content-curation,fle-internal/content-curation,fle-internal/content-curation,jayoshih/content-curation,DXCanas/content-curation,DXCanas/content-curat... | ---
+++
@@ -9,7 +9,7 @@
class Migration(migrations.Migration):
dependencies = [
- ('contentcuration', '0090_auto_20180724_1625'),
+ ('contentcuration', '0089_auto_20180706_2242'),
]
operations = [ |
69a8528801ae5c3fdde57b9766917fcf8690c54e | telephus/translate.py | telephus/translate.py | class APIMismatch(Exception):
pass
def translateArgs(request, api_version):
args = request.args
if request.method == 'system_add_keyspace' \
or request.method == 'system_update_keyspace':
args = adapt_ksdef_rf(args[0]) + args[1:]
return args
def postProcess(results, method):
if method ... | class APIMismatch(Exception):
pass
def translateArgs(request, api_version):
args = request.args
if request.method == 'system_add_keyspace' \
or request.method == 'system_update_keyspace':
adapted_ksdef = adapt_ksdef_rf(args[0])
args = (adapted_ksdef,) + args[1:]
return args
def pos... | Fix args manipulation in when translating ksdefs | Fix args manipulation in when translating ksdefs
| Python | mit | Metaswitch/Telephus,driftx/Telephus,ClearwaterCore/Telephus,driftx/Telephus,Metaswitch/Telephus,ClearwaterCore/Telephus | ---
+++
@@ -5,7 +5,8 @@
args = request.args
if request.method == 'system_add_keyspace' \
or request.method == 'system_update_keyspace':
- args = adapt_ksdef_rf(args[0]) + args[1:]
+ adapted_ksdef = adapt_ksdef_rf(args[0])
+ args = (adapted_ksdef,) + args[1:]
return args
def... |
172768dacc224f3c14e85f8e732209efe9ce075a | app/soc/models/project_survey.py | app/soc/models/project_survey.py | #!/usr/bin/python2.5
#
# Copyright 2009 the Melange authors.
#
# 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... | #!/usr/bin/python2.5
#
# Copyright 2009 the Melange authors.
#
# 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... | Set the default prefix for ProjectSurveys to gsoc_program. | Set the default prefix for ProjectSurveys to gsoc_program.
| Python | apache-2.0 | SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange | ---
+++
@@ -32,6 +32,5 @@
def __init__(self, *args, **kwargs):
super(ProjectSurvey, self).__init__(*args, **kwargs)
- # TODO: prefix has to be set to gsoc_program once data has been transferred
- self.prefix = 'program'
+ self.prefix = 'gsoc_program'
self.taking_access = 'student' |
48e15b8f99bb0714b7ec465a0131e452c67004e5 | Chapter4_TheGreatestTheoremNeverTold/top_pic_comments.py | Chapter4_TheGreatestTheoremNeverTold/top_pic_comments.py | import sys
import numpy as np
from IPython.core.display import Image
import praw
reddit = praw.Reddit("BayesianMethodsForHackers")
subreddit = reddit.get_subreddit( "pics" )
top_submissions = subreddit.get_top()
n_pic = int( sys.argv[1] ) if sys.argv[1] else 1
i = 0
while i < n_pic:
top_submission = top_su... | import sys
import numpy as np
from IPython.core.display import Image
import praw
reddit = praw.Reddit("BayesianMethodsForHackers")
subreddit = reddit.get_subreddit( "pics" )
top_submissions = subreddit.get_top()
n_pic = int( sys.argv[1] ) if len(sys.argv) > 1 else 1
i = 0
while i < n_pic:
top_submission = ... | Fix index to list when there is no 2nd element | Fix index to list when there is no 2nd element
| Python | mit | chengwliu/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers,ultinomics/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers,Fillll/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers,ifduyue/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers,jrmontag/Probabilistic-Programming-and-Bayesian-... | ---
+++
@@ -12,7 +12,7 @@
top_submissions = subreddit.get_top()
-n_pic = int( sys.argv[1] ) if sys.argv[1] else 1
+n_pic = int( sys.argv[1] ) if len(sys.argv) > 1 else 1
i = 0
while i < n_pic:
@@ -39,25 +39,25 @@
contents.append( comment.body )
except Exception as e:
... |
afd27c62049e87eaefbfb5f38c6b61b461656384 | formulae/token.py | formulae/token.py | class Token:
"""Representation of a single Token"""
def __init__(self, _type, lexeme, literal=None):
self.type = _type
self.lexeme = lexeme
self.literal = literal
def __repr__(self):
string_list = [
"'type': " + str(self.type),
"'lexeme': " + str(sel... | class Token:
"""Representation of a single Token"""
def __init__(self, _type, lexeme, literal=None):
self.type = _type
self.lexeme = lexeme
self.literal = literal
def __hash__(self):
return hash((self.type, self.lexeme, self.literal))
def __eq__(self, other):
i... | Add hash and eq methods to Token | Add hash and eq methods to Token
| Python | mit | bambinos/formulae | ---
+++
@@ -5,6 +5,18 @@
self.type = _type
self.lexeme = lexeme
self.literal = literal
+
+ def __hash__(self):
+ return hash((self.type, self.lexeme, self.literal))
+
+ def __eq__(self, other):
+ if not isinstance(other, type(self)):
+ return False
+ re... |
d012763c57450555d45385ed9b254f500388618e | automata/render.py | automata/render.py | import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.animation as animation
class AnimatedGif:
""" Setup various rendering things
"""
def __init__(self, dpi=100, colors="Purples"):
self.frames = []
self.fig = plt.figure(dpi=dpi)
plt.axis("off")... | import matplotlib
matplotlib.use('Agg')
import matplotlib.colors
import matplotlib.pyplot as plt
import matplotlib.animation as animation
class AnimatedGif:
""" Setup various rendering things
"""
def __init__(self, dpi=100, colors="Purples"):
self.frames = []
self.fig = plt.figure(dpi=dpi... | Use the same normlization for whole gif | Use the same normlization for whole gif
| Python | apache-2.0 | stevearm/automata | ---
+++
@@ -1,6 +1,7 @@
import matplotlib
matplotlib.use('Agg')
+import matplotlib.colors
import matplotlib.pyplot as plt
import matplotlib.animation as animation
@@ -13,6 +14,7 @@
self.fig = plt.figure(dpi=dpi)
plt.axis("off")
self.colors = colors
+ self.normalize = matplotl... |
ce7c31f3dd97716051b72951c7c745dd2c63efcd | plugins/audit_logs/server/__init__.py | plugins/audit_logs/server/__init__.py | import cherrypy
import logging
from girder import auditLogger
from girder.models.model_base import Model
from girder.api.rest import getCurrentUser
class Record(Model):
def initialize(self):
self.name = 'audit_log_record'
def validate(self, doc):
return doc
class AuditLogHandler(logging.Han... | import cherrypy
import datetime
import logging
from girder import auditLogger
from girder.models.model_base import Model
from girder.api.rest import getCurrentUser
class Record(Model):
def initialize(self):
self.name = 'audit_log_record'
def validate(self, doc):
return doc
class AuditLogHan... | Include timestamp in audit logs | Include timestamp in audit logs
| Python | apache-2.0 | RafaelPalomar/girder,data-exp-lab/girder,RafaelPalomar/girder,data-exp-lab/girder,girder/girder,kotfic/girder,RafaelPalomar/girder,Kitware/girder,manthey/girder,jbeezley/girder,manthey/girder,girder/girder,data-exp-lab/girder,kotfic/girder,RafaelPalomar/girder,Kitware/girder,Kitware/girder,data-exp-lab/girder,kotfic/gi... | ---
+++
@@ -1,4 +1,5 @@
import cherrypy
+import datetime
import logging
from girder import auditLogger
from girder.models.model_base import Model
@@ -20,7 +21,8 @@
'type': record.msg,
'details': record.details,
'ip': cherrypy.request.remote.ip,
- 'userId': user an... |
3453b7961fae365f833199c88c7395428fcdf788 | tensorpy/constants.py | tensorpy/constants.py | """ Defining constants for tensorpy use """
DOWNLOADS_FOLDER = "downloads_folder" # Folder created for downloaded files
MIN_W_H = 50 # Minimum width/height for classifying images on a page
MAX_THREADS = 4 # Total threads to spin up for classifying images on a page
MAX_IMAGES_PER_PAGE = 15 # Limit of image classifi... | """ Defining constants for tensorpy use """
DOWNLOADS_FOLDER = "downloads_folder" # Folder created for downloaded files
MIN_W_H = 50 # Minimum width/height for classifying images on a page
MAX_THREADS = 3 # Total threads to spin up for classifying images on a page
MAX_IMAGES_PER_PAGE = 15 # Limit of image classifi... | Set default max threads for multithreading to 3 | Set default max threads for multithreading to 3
| Python | mit | TensorPy/TensorPy,TensorPy/TensorPy | ---
+++
@@ -2,5 +2,5 @@
DOWNLOADS_FOLDER = "downloads_folder" # Folder created for downloaded files
MIN_W_H = 50 # Minimum width/height for classifying images on a page
-MAX_THREADS = 4 # Total threads to spin up for classifying images on a page
+MAX_THREADS = 3 # Total threads to spin up for classifying imag... |
b2069b2b4a07d82cc6831dde0e396d7dae79d23e | autopidact/view.py | autopidact/view.py | from gi.repository import Gtk, GdkPixbuf, GLib
import cv2
class View(Gtk.Window):
def __init__(self, title, camera, interval=200):
Gtk.Window.__init__(self)
self.set_title(title)
self.cam = camera
self.img = Gtk.Image()
self.add(self.img)
GLib.timeout_add(interval, self.update)
def update(self):
if se... | from gi.repository import Gtk, GdkPixbuf, GLib
import cv2
class View(Gtk.Window):
def __init__(self, title, camera, interval=200):
Gtk.Window.__init__(self)
self.set_title(title)
self.set_size_request(640, 480)
self.set_resizable(False)
self.cam = camera
self.img = Gtk.Image()
self.add(self.img)
GLib.... | Set an initial size and disallow resizing | Set an initial size and disallow resizing
| Python | mit | fkmclane/AutoPidact | ---
+++
@@ -5,6 +5,8 @@
def __init__(self, title, camera, interval=200):
Gtk.Window.__init__(self)
self.set_title(title)
+ self.set_size_request(640, 480)
+ self.set_resizable(False)
self.cam = camera
self.img = Gtk.Image()
self.add(self.img) |
fb01aa54032b7ab73dcd5a3e73d4ece5f36517e2 | locations/tasks.py | locations/tasks.py | from future.standard_library import install_aliases
install_aliases() # noqa
from urllib.parse import urlparse
from celery.task import Task
from django.conf import settings
from seed_services_client import IdentityStoreApiClient
from .models import Parish
class SyncLocations(Task):
"""
Has a look at all th... | from future.standard_library import install_aliases
install_aliases() # noqa
from urllib.parse import urlparse
from celery.task import Task
from django.conf import settings
from seed_services_client import IdentityStoreApiClient
from .models import Parish
class SyncLocations(Task):
"""
Has a look at all th... | Add comment to explain pagination handling | Add comment to explain pagination handling
| Python | bsd-3-clause | praekelt/familyconnect-registration,praekelt/familyconnect-registration | ---
+++
@@ -23,6 +23,7 @@
while True:
for identity in identities.get('results', []):
yield identity
+ # If there is a next page, extract the querystring and get it
if identities.get('next') is not None:
qs = urlparse(identities['next']).q... |
e9fc291faca8af35398b958d046e951aa8471cbf | apps/core/tests/test_factories.py | apps/core/tests/test_factories.py | from .. import factories
from . import CoreFixturesTestCase
class AnalysisFactoryTestCase(CoreFixturesTestCase):
def test_new_factory_with_Experiments(self):
experiments = factories.ExperimentFactory.create_batch(3)
# build
analysis = factories.AnalysisFactory.build(experiments=experime... | from .. import factories, models
from . import CoreFixturesTestCase
class AnalysisFactoryTestCase(CoreFixturesTestCase):
def test_new_factory_with_Experiments(self):
experiments = factories.ExperimentFactory.create_batch(3)
# build
analysis = factories.AnalysisFactory.build(experiments=... | Fix broken test since models new default ordering | Fix broken test since models new default ordering
| Python | bsd-3-clause | Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel | ---
+++
@@ -1,4 +1,4 @@
-from .. import factories
+from .. import factories, models
from . import CoreFixturesTestCase
@@ -15,8 +15,13 @@
# create
analysis = factories.AnalysisFactory(experiments=experiments)
- experiments_ids = list(
- analysis.experiments.values_list('id',... |
f4e36132448a4a55bff5660b3f5a669e0095ecc5 | awx/main/models/activity_stream.py | awx/main/models/activity_stream.py | # Copyright (c) 2013 AnsibleWorks, Inc.
# All Rights Reserved.
from django.db import models
class ActivityStream(models.Model):
'''
Model used to describe activity stream (audit) events
'''
OPERATION_CHOICES = [
('create', _('Entity Created')),
('update', _("Entity Updated")),
... | # Copyright (c) 2013 AnsibleWorks, Inc.
# All Rights Reserved.
from django.db import models
from django.utils.translation import ugettext_lazy as _
class ActivityStream(models.Model):
'''
Model used to describe activity stream (audit) events
'''
class Meta:
app_label = 'main'
OPERATION_... | Fix up some issues with supporting schema migration | Fix up some issues with supporting schema migration
| Python | apache-2.0 | wwitzel3/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,snahelou/awx,snahelou/awx,wwitzel3/awx | ---
+++
@@ -3,11 +3,16 @@
from django.db import models
+from django.utils.translation import ugettext_lazy as _
class ActivityStream(models.Model):
'''
Model used to describe activity stream (audit) events
'''
+
+ class Meta:
+ app_label = 'main'
+
OPERATION_CHOICES = [
... |
29eb3661ace0f3dd62d210621ebd24ef95261162 | src/listen.py | src/listen.py |
import redis
import re
from common import get_db
from datetime import datetime
MSGPATTERN = re.compile('^(\w+)\|(\d)\|([\s\S]*)$')
CHANNEL = 'logfire'
def listen(args):
global MSGPATTERN
rserver = redis.Redis('localhost')
pubsub = rserver.pubsub()
pubsub.subscribe(CHANNEL)
db = get_db(args.mongohost)
... |
import redis
import re
from common import get_db
from datetime import datetime
MSGPATTERN = re.compile('^(\w+)\|(\d)\|([\s\S]*)$')
CHANNEL = 'logfire'
def listen(args):
global MSGPATTERN
rserver = redis.Redis('localhost')
pubsub = rserver.pubsub()
pubsub.subscribe(CHANNEL)
db = get_db(args.mongohost)
... | Make sure timestamp of log message is UTC when it goes into DB | Make sure timestamp of log message is UTC when it goes into DB
| Python | mit | jay3sh/logfire,jay3sh/logfire | ---
+++
@@ -25,6 +25,6 @@
level = int(match.group(2))
message = match.group(3)
db.insert(dict(
- tstamp=datetime.now(),comp=component,lvl=level,msg=message))
+ tstamp=datetime.utcnow(),comp=component,lvl=level,msg=message))
except Exception, e:
print e, packet |
941ab0315d71fbea552b0ab12d75e4d8968adfce | cube2sphere/blender_init.py | cube2sphere/blender_init.py | __author__ = 'Xyene'
import bpy
import sys
import math
bpy.context.scene.cycles.resolution_x = int(sys.argv[-5])
bpy.context.scene.cycles.resolution_y = int(sys.argv[-4])
for i, name in enumerate(['bottom', 'top', 'left', 'right', 'back', 'front']):
bpy.data.images[name].filepath = "%s" % sys.argv[-6 - i]
came... | __author__ = 'Xyene'
import bpy
import sys
import math
for scene in bpy.data.scenes:
scene.render.resolution_x = int(sys.argv[-5])
scene.render.resolution_y = int(sys.argv[-4])
scene.render.resolution_percentage = 100
scene.render.use_border = False
for i, name in enumerate(['bottom', 'top', 'left',... | Change the way we pass resolution to blender | Change the way we pass resolution to blender | Python | agpl-3.0 | Xyene/cube2sphere | ---
+++
@@ -5,8 +5,11 @@
import math
-bpy.context.scene.cycles.resolution_x = int(sys.argv[-5])
-bpy.context.scene.cycles.resolution_y = int(sys.argv[-4])
+for scene in bpy.data.scenes:
+ scene.render.resolution_x = int(sys.argv[-5])
+ scene.render.resolution_y = int(sys.argv[-4])
+ scene.render.resolut... |
ad8d69e4c5447297db535f8ca9d1ac00e85f01e8 | httpbin/runner.py | httpbin/runner.py | # -*- coding: utf-8 -*-
"""
httpbin.runner
~~~~~~~~~~~~~~
This module serves as a command-line runner for httpbin, powered by
gunicorn.
"""
import sys
from gevent.wsgi import WSGIServer
from httpbin import app
def main():
try:
port = int(sys.argv[1])
except (KeyError, ValueError, IndexError):
... | # -*- coding: utf-8 -*-
"""
httpbin.runner
~~~~~~~~~~~~~~
This module serves as a command-line runner for httpbin, powered by
gunicorn.
"""
import sys
from gevent.pywsgi import WSGIServer
from httpbin import app
def main():
try:
port = int(sys.argv[1])
except (KeyError, ValueError, IndexError):
... | Use pywsgi.py instead of wsgi (better chunked handling) | Use pywsgi.py instead of wsgi (better chunked handling)
| Python | isc | ewdurbin/httpbin,luhkevin/httpbin,Jaccorot/httpbin,yemingm/httpbin,shaunstanislaus/httpbin,mozillazg/bustard-httpbin,postmanlabs/httpbin,logonmy/httpbin,admin-zhx/httpbin,vscarpenter/httpbin,Lukasa/httpbin,Lukasa/httpbin,ashcoding/httpbin,yangruiyou85/httpbin,pestanko/httpbin,luosam1123/httpbin,mansilladev/httpbin,moja... | ---
+++
@@ -11,7 +11,7 @@
import sys
-from gevent.wsgi import WSGIServer
+from gevent.pywsgi import WSGIServer
from httpbin import app
|
8ddbd0b39687f46637041848ab7190bcefd57b68 | pyramid_mongodb/__init__.py | pyramid_mongodb/__init__.py | """
simplified mongodb integration
1. Add two lines to app/__init__.py ( the import and the call to initialize_mongo_db )
import python_mongodb
def main(global_config, **settings):
## ...
# Initialize mongodb , which is a subscriber
python_mongodb.initialize_mongo_db( config , settin... | """
simplified mongodb integration
1. Add two lines to app/__init__.py ( the import and the call to initialize_mongo_db )
import python_mongodb
def main(global_config, **settings):
## ...
# Initialize mongodb , which is a subscriber
python_mongodb.initialize_mongo_db( config , settin... | Use set_request_property instead of subscriber to improve performance | Use set_request_property instead of subscriber to improve performance
| Python | mit | niallo/pyramid_mongodb | ---
+++
@@ -11,13 +11,13 @@
python_mongodb.initialize_mongo_db( config , settings )
## ...
return config.make_wsgi_app()
-
+
2. in each of your envinronment.ini files, have:
mongodb.use = true
mongodb.uri = mongodb://localhost
mongodb.name = myapp
-
+
if "mongodb.use... |
92c024c2112573e4c4b2d1288b1ec3c7a40bc670 | test/test_uploader.py | test/test_uploader.py | import boto3
from os import path
from lambda_uploader import uploader, config
from moto import mock_s3
EX_CONFIG = path.normpath(path.join(path.dirname(__file__),
'../test/configs'))
@mock_s3
def test_s3_upload():
mock_bucket = 'mybucket'
conn = boto3.resource('s3')
conn.create... | import boto3
from os import path
from lambda_uploader import uploader, config
from moto import mock_s3
EX_CONFIG = path.normpath(path.join(path.dirname(__file__),
'../test/configs'))
@mock_s3
def test_s3_upload():
mock_bucket = 'mybucket'
conn = boto3.resource('s3')
conn.create... | Add additional assertion that the file we uploaded is correct | Add additional assertion that the file we uploaded is correct
We should pull back down the S3 bucket file and be sure it's the same, proving we used the boto3 API correctly. We should probably, at some point, also upload a _real_ zip file and not just a plaintext file.
| Python | apache-2.0 | rackerlabs/lambda-uploader,dsouzajude/lambda-uploader | ---
+++
@@ -20,3 +20,11 @@
upldr = uploader.PackageUploader(conf, None)
upldr._upload_s3(path.join(path.dirname(__file__), 'dummyfile'))
+
+ # fetch the contents back out, be sure we truly uploaded the dummyfile
+ retrieved_bucket = conn.Object(
+ mock_bucket,
+ conf.s3_package_name()
... |
cc4b68c7eccf05ca32802022b2abfd31b51bce32 | chef/exceptions.py | chef/exceptions.py | # Exception hierarchy for chef
# Copyright (c) 2010 Noah Kantrowitz <noah@coderanger.net>
class ChefError(Exception):
"""Top-level Chef error."""
class ChefServerError(ChefError):
"""An error from a Chef server. May include a HTTP response code."""
def __init__(self, message, code=None):
ChefError... | # Exception hierarchy for chef
# Copyright (c) 2010 Noah Kantrowitz <noah@coderanger.net>
class ChefError(Exception):
"""Top-level Chef error."""
class ChefServerError(ChefError):
"""An error from a Chef server. May include a HTTP response code."""
def __init__(self, message, code=None):
super(Ch... | Use super() for great justice. | Use super() for great justice.
| Python | apache-2.0 | Scalr/pychef,Scalr/pychef,cread/pychef,dipakvwarade/pychef,dipakvwarade/pychef,cread/pychef,coderanger/pychef,coderanger/pychef,jarosser06/pychef,jarosser06/pychef | ---
+++
@@ -6,7 +6,8 @@
class ChefServerError(ChefError):
"""An error from a Chef server. May include a HTTP response code."""
+
def __init__(self, message, code=None):
- ChefError.__init__(self, message)
+ super(ChefError, self).__init__(message)
self.code = code
-
+ |
f11d7232486a92bf5e9dba28432ee2ed97e02da4 | print_web_django/api/views.py | print_web_django/api/views.py | from rest_framework import viewsets
from . import serializers, models
class PrintJobViewSet(viewsets.ModelViewSet):
serializer_class = serializers.PrintJobSerializer
def get_queryset(self):
return self.request.user.printjobs.all()
def perform_create(self, serializer):
# need to also pass... | from rest_framework import viewsets
from . import serializers, models
class PrintJobViewSet(viewsets.ModelViewSet):
serializer_class = serializers.PrintJobSerializer
def get_queryset(self):
return self.request.user.printjobs.all().order_by('-created')
def perform_create(self, serializer):
... | Sort by descending date created (new first) | Sort by descending date created (new first)
| Python | mit | aabmass/print-web,aabmass/print-web,aabmass/print-web | ---
+++
@@ -6,7 +6,7 @@
serializer_class = serializers.PrintJobSerializer
def get_queryset(self):
- return self.request.user.printjobs.all()
+ return self.request.user.printjobs.all().order_by('-created')
def perform_create(self, serializer):
# need to also pass the requests ... |
97d6f5e7b346944ac6757fd4570bfbc7dcf52425 | survey/admin.py | survey/admin.py | # -*- coding: utf-8 -*-
from django.contrib import admin
from survey.models import Answer, Category, Question, Response, Survey
from .actions import make_published
class QuestionInline(admin.TabularInline):
model = Question
ordering = ("order", "category")
extra = 1
class CategoryInline(admin.Tabular... | # -*- coding: utf-8 -*-
from django.contrib import admin
from survey.actions import make_published
from survey.models import Answer, Category, Question, Response, Survey
class QuestionInline(admin.TabularInline):
model = Question
ordering = ("order", "category")
extra = 1
class CategoryInline(admin.Ta... | Fix Attempted relative import beyond top-level package | Fix Attempted relative import beyond top-level package
| Python | agpl-3.0 | Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey | ---
+++
@@ -2,9 +2,8 @@
from django.contrib import admin
+from survey.actions import make_published
from survey.models import Answer, Category, Question, Response, Survey
-
-from .actions import make_published
class QuestionInline(admin.TabularInline): |
a03eb91088943a4b3ed0ae5fc87b104562a4a645 | location_field/urls.py | location_field/urls.py | try:
from django.conf.urls import patterns # Django>=1.6
except ImportError:
from django.conf.urls.defaults import patterns # Django<1.6
import os
app_dir = os.path.dirname(__file__)
urlpatterns = patterns(
'',
(r'^media/(.*)$', 'django.views.static.serve', {
'document_root': '%s/media' % a... | from django.conf.urls import patterns
import os
app_dir = os.path.dirname(__file__)
urlpatterns = patterns(
'',
(r'^media/(.*)$', 'django.views.static.serve', {
'document_root': '%s/media' % app_dir}),
)
| Drop support for Django 1.6 | Drop support for Django 1.6
| Python | mit | Mixser/django-location-field,recklessromeo/django-location-field,Mixser/django-location-field,voodmania/django-location-field,recklessromeo/django-location-field,undernewmanagement/django-location-field,voodmania/django-location-field,caioariede/django-location-field,caioariede/django-location-field,undernewmanagement/... | ---
+++
@@ -1,7 +1,4 @@
-try:
- from django.conf.urls import patterns # Django>=1.6
-except ImportError:
- from django.conf.urls.defaults import patterns # Django<1.6
+from django.conf.urls import patterns
import os
|
f292cfa783bcc30c2625b340ad763db2723ce056 | test/test_db.py | test/test_db.py | from piper.db import DbCLI
import mock
class DbCLIBase(object):
def setup_method(self, method):
self.cli = DbCLI(mock.Mock())
self.ns = mock.Mock()
self.config = mock.Mock()
class TestDbCLIRun(DbCLIBase):
def test_plain_run(self):
self.cli.cls.init = mock.Mock()
ret ... | from piper.db import DbCLI
from piper.db import DatabaseBase
import mock
import pytest
class DbCLIBase(object):
def setup_method(self, method):
self.cli = DbCLI(mock.Mock())
self.ns = mock.Mock()
self.config = mock.Mock()
class TestDbCLIRun(DbCLIBase):
def test_plain_run(self):
... | Add tests for DatabaseBase abstraction | Add tests for DatabaseBase abstraction
| Python | mit | thiderman/piper | ---
+++
@@ -1,6 +1,8 @@
from piper.db import DbCLI
+from piper.db import DatabaseBase
import mock
+import pytest
class DbCLIBase(object):
@@ -17,3 +19,14 @@
assert ret == 0
self.cli.cls.init.assert_called_once_with(self.ns, self.config)
+
+
+class TestDatabaseBaseInit(object):
+ def se... |
1fbb79762c7e8342e840f0c1bc95c99fd981b81d | dariah_contributions/urls.py | dariah_contributions/urls.py | from django.conf.urls import patterns, url
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from .models import Contribution
from .views import ContributionCreate, ContributionDelete, ContributionUpdate, ContributionRDF
urlpatterns = patterns('',
url(r'^(all)?/$',... | from django.conf.urls import patterns, url
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from .models import Contribution
from .views import ContributionCreate, ContributionDelete, ContributionUpdate, ContributionRDF
urlpatterns = patterns('',
url(r'^(all/)?$',... | Fix the 'contribution/all' or 'contribution/' URL. | Fix the 'contribution/all' or 'contribution/' URL.
| Python | apache-2.0 | DANS-KNAW/dariah-contribute,DANS-KNAW/dariah-contribute | ---
+++
@@ -7,7 +7,7 @@
urlpatterns = patterns('',
- url(r'^(all)?/$', ListView.as_view(model=Contribution, queryset=Contribution.published.all()), name='list'),
+ url(r'^(all/)?$', ListView.as_view(model=Contribution, queryset=Contribution.published.all()), name='list'),
# example: /contribution/
... |
63c2cc935d3c97ecb8b297ae387bfdf719cf1350 | apps/admin/forms.py | apps/admin/forms.py | from django.contrib.auth.models import User
from django import forms
from apps.categories.models import *
from apps.books.models import *
class LoginForm(forms.ModelForm):
"""docstring for LoginForm"""
class Meta:
model = User
fields = ['username', 'password']
class CategoryForm(forms.ModelFo... | from django.contrib.auth.models import User
from django import forms
from apps.categories.models import *
from apps.books.models import *
class CategoryForm(forms.ModelForm):
"""docstring for CategoryForm"""
class Meta:
model = Category
fields = '__all__'
class BookForm(forms... | Remove unused FormLogin in admin app | [REMOVE] Remove unused FormLogin in admin app
| Python | mit | vuonghv/brs,vuonghv/brs,vuonghv/brs,vuonghv/brs | ---
+++
@@ -4,11 +4,6 @@
from apps.categories.models import *
from apps.books.models import *
-class LoginForm(forms.ModelForm):
- """docstring for LoginForm"""
- class Meta:
- model = User
- fields = ['username', 'password']
class CategoryForm(forms.ModelForm):
"""docstring for Ca... |
0d33acf31254714b3a9f76d3fe97c77e7270c110 | tests/_utils.py | tests/_utils.py | """Utilities for tests.
"""
import codecs
import codecs
import os
import re
def strip_ansi(string):
"""Strip ANSI encoding from given string.
Parameters
----------
string : str
String from which encoding needs to be removed
Returns
-------
str
Encoding free string... | """Utilities for tests.
"""
import errno
import codecs
import os
import re
def strip_ansi(string):
"""Strip ANSI encoding from given string.
Parameters
----------
string : str
String from which encoding needs to be removed
Returns
-------
str
Encoding free string
... | Test Utils: Cleans up the code | Test Utils: Cleans up the code
| Python | mit | manrajgrover/halo,ManrajGrover/halo | ---
+++
@@ -1,6 +1,6 @@
"""Utilities for tests.
"""
-import codecs
+import errno
import codecs
import os
import re |
6f464e422befe22e56bb759a7ac7ff52a353c6d9 | accountant/functional_tests/test_layout_and_styling.py | accountant/functional_tests/test_layout_and_styling.py | # -*- coding: utf-8 -*-
import unittest
from .base import FunctionalTestCase
from .pages import game
class StylesheetTests(FunctionalTestCase):
def test_color_css_loaded(self):
self.story('Create a game')
self.browser.get(self.live_server_url)
page = game.Homepage(self.browser)
page... | # -*- coding: utf-8 -*-
import unittest
from .base import FunctionalTestCase
from .pages import game
class StylesheetTests(FunctionalTestCase):
def test_color_css_loaded(self):
self.story('Create a game')
self.browser.get(self.live_server_url)
page = game.Homepage(self.browser)
page... | Test is loaded CSS is applied | Test is loaded CSS is applied
| Python | mit | XeryusTC/18xx-accountant,XeryusTC/18xx-accountant,XeryusTC/18xx-accountant,XeryusTC/18xx-accountant,XeryusTC/18xx-accountant | ---
+++
@@ -20,3 +20,7 @@
self.assertTrue(any('css/main.css' in s.get_attribute('href')
for s in page.stylesheets))
+
+ # Test constant to see if css actually gets loaded
+ self.assertEqual('rgb(55, 71, 79)',
+ page.bank_cash.value_of_css_property('border-color')) |
517f53dc91164f4249de9dbaf31be65df02ffde7 | numpy/fft/setup.py | numpy/fft/setup.py |
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('fft', parent_package, top_path)
config.add_data_dir('tests')
# Configure pocketfft_internal
config.add_extension('_pocketfft_internal',
sources=... | import sys
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('fft', parent_package, top_path)
config.add_data_dir('tests')
# AIX needs to be told to use large file support - at all times
defs = [('_LARGE_FILES', None)] i... | Add _LARGE_FILES to def_macros[] when platform is AIX (gh-15938) | BUG: Add _LARGE_FILES to def_macros[] when platform is AIX (gh-15938)
AIX needs to be told to use large file support at all times. Fixes parts of gh-15801. | Python | bsd-3-clause | mhvk/numpy,pbrod/numpy,mattip/numpy,anntzer/numpy,numpy/numpy,numpy/numpy,pbrod/numpy,rgommers/numpy,numpy/numpy,endolith/numpy,abalkin/numpy,pdebuyl/numpy,grlee77/numpy,mattip/numpy,grlee77/numpy,pdebuyl/numpy,charris/numpy,charris/numpy,seberg/numpy,pbrod/numpy,grlee77/numpy,anntzer/numpy,jakirkham/numpy,seberg/numpy... | ---
+++
@@ -1,3 +1,4 @@
+import sys
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
@@ -5,9 +6,12 @@
config.add_data_dir('tests')
+ # AIX needs to be told to use large file support - at all times
+ defs = [('_LARGE_FILES', None)] if sys.pl... |
8a522bc92bbf5bee8bc32a0cc332dc77fa86fcd6 | drcontroller/http_server.py | drcontroller/http_server.py | import eventlet
import os
import commands
from eventlet import wsgi
from paste.deploy import loadapp
def main():
conf = "conf/api-paste.ini"
appname = "main"
commands.getoutput('mkdir -p ../logs')
app = loadapp("config:%s" % os.path.abspath(conf), appname)
wsgi.server(eventlet.listen(('', 80)), a... | import eventlet
import os
import commands
from eventlet import wsgi
from paste.deploy import loadapp
# Monkey patch socket, time, select, threads
eventlet.patcher.monkey_patch(all=False, socket=True, time=True,
select=True, thread=True, os=True)
def main():
conf = "conf/api-paste.i... | Update http server to un-blocking | Update http server to un-blocking
| Python | apache-2.0 | fs714/drcontroller | ---
+++
@@ -3,6 +3,11 @@
import commands
from eventlet import wsgi
from paste.deploy import loadapp
+
+
+# Monkey patch socket, time, select, threads
+eventlet.patcher.monkey_patch(all=False, socket=True, time=True,
+ select=True, thread=True, os=True)
def main(): |
9bc9b2ea4a53e27b4d9f5f55e2c36fe483ab2de5 | pylancard/trainer.py | pylancard/trainer.py | import logging
import random
DIRECT = 'direct'
REVERSE = 'reverse'
LOG = logging.getLogger(__name__)
class Trainer:
def __init__(self, store, kind=DIRECT):
self.store = store
if kind == DIRECT:
self._words = list(store.direct_index.items())
self._plugin = store.meaning_p... | import logging
import random
DIRECT = 'direct'
REVERSE = 'reverse'
LOG = logging.getLogger(__name__)
class Trainer:
def __init__(self, store, kind=DIRECT):
self.store = store
if kind == DIRECT:
self._words = list(store.direct_index.items())
self._plugin = store.meaning_p... | Initialize random sequence of words when starting training, so that words do not repeat | Initialize random sequence of words when starting training, so that words do not repeat
| Python | bsd-2-clause | dtantsur/pylancard | ---
+++
@@ -20,6 +20,7 @@
else:
raise ValueError("Expected kind, got %r", kind)
self.challenge = self.answer = None
+ self._init()
def check(self, answer):
converted = self._plugin.convert_word(answer.strip())
@@ -33,6 +34,18 @@
return True
def... |
620bf504292583b2547cf7489eeeaaa582ddad77 | indra/tests/test_ctd.py | indra/tests/test_ctd.py | import os
from indra.statements import *
from indra.sources import ctd
from indra.sources.ctd.processor import CTDChemicalGeneProcessor
HERE = os.path.dirname(os.path.abspath(__file__))
def test_statement_type_mapping():
st = CTDChemicalGeneProcessor.get_statement_types(
'decreases^phosphorylation', 'X',... | import os
from indra.statements import *
from indra.sources import ctd
from indra.sources.ctd.processor import CTDChemicalGeneProcessor
HERE = os.path.dirname(os.path.abspath(__file__))
def test_statement_type_mapping():
st = CTDChemicalGeneProcessor.get_statement_types(
'decreases^phosphorylation', 'X',... | Fix and extend test conditions | Fix and extend test conditions
| Python | bsd-2-clause | sorgerlab/indra,sorgerlab/belpy,johnbachman/indra,bgyori/indra,sorgerlab/indra,johnbachman/indra,sorgerlab/indra,johnbachman/indra,sorgerlab/belpy,bgyori/indra,bgyori/indra,sorgerlab/belpy | ---
+++
@@ -21,4 +21,10 @@
def test_chemical_gene():
fname = os.path.join(HERE, 'ctd_chem_gene_20522546.tsv')
cp = ctd.process_tsv(fname, 'chemical_gene')
- assert len(cp.statements) == 4, cp.statements
+ assert len(cp.statements) == 3, cp.statements
+ assert isinstance(cp.statements[0], Dephospho... |
0e2270415b287cb643cff5023dcaacbcb2d5e3fc | translators/google.py | translators/google.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import requests
def save_google_translation(queue, source_text, client_id, client_secret, translate_from='et', translate_to='en'):
translation = ''
try:
begin = time.time()
translation = google_translation(source_text,
... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import requests
import json
def save_google_translation(queue, source_text, translate_from='et', translate_to='en'):
translation = ''
try:
begin = time.time()
translation = google_translation(source_text,
... | Fix Google Translator request & processing | Fix Google Translator request & processing
| Python | mit | ChameleonTartu/neurotolge,ChameleonTartu/neurotolge,ChameleonTartu/neurotolge | ---
+++
@@ -3,9 +3,9 @@
import time
import requests
+import json
-
-def save_google_translation(queue, source_text, client_id, client_secret, translate_from='et', translate_to='en'):
+def save_google_translation(queue, source_text, translate_from='et', translate_to='en'):
translation = ''
try:
@@ -2... |
0f018ec9bfd0c93d980b232af325be453c065632 | qsimcirq/_version.py | qsimcirq/_version.py | """The version number defined here is read automatically in setup.py."""
__version__ = "0.14.0"
| """The version number defined here is read automatically in setup.py."""
__version__ = "0.14.1.dev20220804"
| Update to dev version 0.14.1+dev20220804 | Update to dev version 0.14.1+dev20220804 | Python | apache-2.0 | quantumlib/qsim,quantumlib/qsim,quantumlib/qsim,quantumlib/qsim | ---
+++
@@ -1,3 +1,3 @@
"""The version number defined here is read automatically in setup.py."""
-__version__ = "0.14.0"
+__version__ = "0.14.1.dev20220804" |
0a2dc53cd388f73064bb66e794e3af5f3e48a92f | bot/setup.py | bot/setup.py | from setuptools import setup, find_packages
PACKAGE_NAME = "ReviewBot"
VERSION = "0.1"
setup(name=PACKAGE_NAME,
version=VERSION,
description="ReviewBot, the automated code reviewer",
author="Steven MacLeod",
author_email="steven@smacleod.ca",
packages=find_packages(),
entry_points... | from setuptools import setup, find_packages
PACKAGE_NAME = "ReviewBot"
VERSION = "0.1"
setup(name=PACKAGE_NAME,
version=VERSION,
description="ReviewBot, the automated code reviewer",
author="Steven MacLeod",
author_email="steven@smacleod.ca",
packages=find_packages(),
entry_points... | Update the required version of Celery | Update the required version of Celery
| Python | mit | reviewboard/ReviewBot,reviewboard/ReviewBot,reviewboard/ReviewBot,reviewboard/ReviewBot | ---
+++
@@ -16,7 +16,7 @@
]
},
install_requires=[
- 'celery>=2.5',
+ 'celery>=3.0',
'pep8>=0.7.0',
],
) |
1c86e9164d9df9cbb75b520b9700a5621a1116f9 | bqx/_func.py | bqx/_func.py | from .parts import Column
def BETWEEN(expr1, expr2, expr3):
return Column('%s BETWEEN %s AND %s' % (_actual_n(expr1), _actual_n(expr2), _actual_n(expr3)))
def CAST(type1, type2):
return Column('CAST(%s AS %s)' % (type1, type2))
def CONCAT(*args):
arg = [_actual_n(a) for a in args]
arg = ', '.join(... | from .parts import Column
def BETWEEN(expr1, expr2, expr3):
return Column('%s BETWEEN %s AND %s' % (_actual_n(expr1), _actual_n(expr2), _actual_n(expr3)))
def CAST(type1, type2):
return Column('CAST(%s AS %s)' % (type1, type2))
def CONCAT(*args):
arg = [_actual_n(a) for a in args]
arg = ', '.join(... | Fix columns not to be converted into str | Fix columns not to be converted into str
| Python | bsd-3-clause | fuller-inc/bqx | ---
+++
@@ -37,6 +37,6 @@
if isinstance(col, str):
return "'%s'" % col
elif isinstance(col, Column):
- return col.real_name
+ return str(col.real_name)
else:
return str(col) |
4e8dc0ca41ee1e21a75a3e803c3b2b223d9f14cb | users/managers.py | users/managers.py | from django.utils import timezone
from django.contrib.auth.models import BaseUserManager
from model_utils.managers import InheritanceQuerySet
from .conf import settings
class UserManager(BaseUserManager):
def _create_user(self, email, password,
is_staff, is_superuser, **extra_fields):
... | from django.utils import timezone
from django.contrib.auth.models import BaseUserManager
from model_utils.managers import InheritanceQuerySet
from .conf import settings
class UserManager(BaseUserManager):
def _create_user(self, email, password,
is_staff, is_superuser, **extra_fields):
... | Fix issue with create_superuser method on UserManager | Fix issue with create_superuser method on UserManager
| Python | bsd-3-clause | mishbahr/django-users2,mishbahr/django-users2 | ---
+++
@@ -33,7 +33,7 @@
def create_superuser(self, email, password, **extra_fields):
return self._create_user(email, password, True, True,
- **extra_fields)
+ is_active=True, **extra_fields)
class UserInheritanceManager(UserManager... |
818e15028c4dd158fa93fe4bcd351255585c2f4f | src/model/predict_rf_model.py | src/model/predict_rf_model.py | import numpy as np
import pandas as pd
import sys
import os
from sklearn.externals import joblib
from sklearn.ensemble import RandomForestClassifier
scriptpath = os.path.dirname(os.path.realpath(sys.argv[0])) + '/../'
sys.path.append(os.path.abspath(scriptpath))
import utils
parameter_str = '_'.join(['top', str(utils... | import numpy as np
import pandas as pd
import sys
import os
from sklearn.externals import joblib
from sklearn.ensemble import RandomForestClassifier
scriptpath = os.path.dirname(os.path.realpath(sys.argv[0])) + '/../'
sys.path.append(os.path.abspath(scriptpath))
import utils
parameter_str = '_'.join(['top', str(utils... | Handle missing value in predit rf | Handle missing value in predit rf
| Python | bsd-3-clause | parkerzf/kaggle-expedia,parkerzf/kaggle-expedia,parkerzf/kaggle-expedia | ---
+++
@@ -13,7 +13,10 @@
cforest = joblib.load(utils.model_path + 'rf_all_without_time_' + parameter_str +'.pkl')
test = joblib.load(utils.processed_data_path + 'test_all_' + parameter_str +'.pkl')
-X_test = test.ix[:,1:]
+#X_test = test.ix[:,1:]
+X_test = test.ix[:9,1:]
+
+X_test.fillna(-1, inplace=True)
pr... |
a9fb1bb437e27f0bcd5a382e82f100722d9f0688 | data_structures/circular_buffer.py | data_structures/circular_buffer.py | from .transition import Transition
class CircularBuffer(object):
def __init__(self, capacity=100000):
self.capacity = capacity
self.memory = []
self.position = 0
def push(self, *args):
if len(self.memory) < self.capacity:
self.memory.append(Transition(*args))
... | from .transition import Transition
class CircularBuffer(object):
def __init__(self, capacity=100000):
self.capacity = capacity
self.memory = []
self.position = 0
def push(self, *args):
if len(self.memory) < self.capacity:
self.memory.append(Transition(*args))
... | Fix index. Caught by Tudor. | Fix index. Caught by Tudor.
| Python | mit | floringogianu/categorical-dqn | ---
+++
@@ -12,7 +12,7 @@
self.memory.append(Transition(*args))
else:
self.memory[self.position] = Transition(*args)
- self.position = self.position % self.capacity
+ self.position = (self.position + 1) % self.capacity
def get_batch(self):
return self.m... |
7cda2fe25dd65b3120f177d331088ce7733d1c6c | server.py | server.py | from japronto import Application
from services.articles import ArticleService
from mongoengine import *
article_service = ArticleService()
def index(req):
"""
The main index
"""
return req.Response(text='You reached the index!')
def articles(req):
"""
Get alll articles
"""
docs = article_service.all()
ret... | from japronto import Application
from services.articles import ArticleService
from mongoengine import *
article_service = ArticleService()
def index(req):
"""
The main index
"""
return req.Response(text='You reached the index!')
def articles(req):
"""
Get alll articles
"""
docs = article_service.all()
ret... | Increase request buffer as workaround for stackoverflow in asyncio | Increase request buffer as workaround for stackoverflow in asyncio
| Python | mit | azzuwan/PyApiServerExample | ---
+++
@@ -21,10 +21,13 @@
"""
Retrieve articles by keywords
"""
+ #AsyncIO buffer problem
+ req.transport.set_write_buffer_limits=4096
+
words = req.match_dict['keywords']
docs = article_service.keywords(words)
headers = {'Content-Type': 'application/json'}
- body = docs.to_json().encode()
+ body = d... |
8cc8f9a1535a2361c27e9411f9163ecd2a9958d5 | utils/__init__.py | utils/__init__.py |
import pymongo
connection = pymongo.MongoClient("mongodb://localhost")
db = connection.vcf_explorer
import database
import parse_vcf
import filter_vcf
import query
|
import pymongo
import config #config.py
connection = pymongo.MongoClient(host=config.MONGODB_HOST, port=config.MONGODB_PORT)
db = connection[config.MONGODB_NAME]
import database
import parse_vcf
import filter_vcf
import query
| Set mongodb settings using config.py | Set mongodb settings using config.py
| Python | mit | CuppenResearch/vcf-explorer,CuppenResearch/vcf-explorer,CuppenResearch/vcf-explorer,CuppenResearch/vcf-explorer | ---
+++
@@ -1,8 +1,10 @@
import pymongo
-connection = pymongo.MongoClient("mongodb://localhost")
-db = connection.vcf_explorer
+import config #config.py
+
+connection = pymongo.MongoClient(host=config.MONGODB_HOST, port=config.MONGODB_PORT)
+db = connection[config.MONGODB_NAME]
import database
import parse_v... |
2206681a89346970b71ca8d0ed1ff60a861b2ff9 | doc/examples/plot_pyramid.py | doc/examples/plot_pyramid.py | """
====================
Build image pyramids
====================
This example shows how to build image pyramids.
"""
import numpy as np
import matplotlib.pyplot as plt
from skimage import data
from skimage import img_as_float
from skimage.transform import build_gaussian_pyramid
image = data.lena()
rows, cols, di... | """
====================
Build image pyramids
====================
The `build_gauassian_pyramid` function takes an image and yields successive
images shrunk by a constant scale factor. Image pyramids are often used, e.g.,
to implement algorithms for denoising, texture discrimination, and scale-
invariant detection.
""... | Update pyramid example with longer description | Update pyramid example with longer description
| Python | bsd-3-clause | chintak/scikit-image,paalge/scikit-image,keflavich/scikit-image,SamHames/scikit-image,jwiggins/scikit-image,bsipocz/scikit-image,keflavich/scikit-image,rjeli/scikit-image,vighneshbirodkar/scikit-image,SamHames/scikit-image,youprofit/scikit-image,chintak/scikit-image,dpshelio/scikit-image,Midafi/scikit-image,WarrenWecke... | ---
+++
@@ -3,7 +3,10 @@
Build image pyramids
====================
-This example shows how to build image pyramids.
+The `build_gauassian_pyramid` function takes an image and yields successive
+images shrunk by a constant scale factor. Image pyramids are often used, e.g.,
+to implement algorithms for denoising, t... |
1454b42049e94db896aab99e2dd1b286ca2d04e3 | convert-bookmarks.py | convert-bookmarks.py | #!/usr/bin/env python
#
# Convert browser bookmark export (NETSCAPE-Bookmark-file-1 format) to json
#
from argparse import ArgumentParser
from bs4 import BeautifulSoup
from datetime import datetime, timezone
import json
parser = ArgumentParser(description='Convert Netscape bookmarks to JSON')
parser.add_argument(dest... | #!/usr/bin/env python
#
# Convert browser bookmark export (NETSCAPE-Bookmark-file-1 format) to json
#
from argparse import ArgumentParser
from bs4 import BeautifulSoup
from datetime import datetime, timezone
import json
parser = ArgumentParser(description='Convert Netscape bookmarks to JSON')
parser.add_argument(dest... | Add options for add date and tags. | Add options for add date and tags.
| Python | mit | jhh/netscape-bookmark-converter | ---
+++
@@ -11,10 +11,11 @@
parser = ArgumentParser(description='Convert Netscape bookmarks to JSON')
parser.add_argument(dest='filenames', metavar='filename', nargs='*')
parser.add_argument('-t', '--tag', metavar='tag', dest='tags',
- action='append', help='add tags to bookmarks')
+ ... |
82daed35cb328590e710800672fc3524c226d166 | feder/letters/tests/base.py | feder/letters/tests/base.py | import email
from os.path import dirname, join
from django.utils import six
from django_mailbox.models import Mailbox
from feder.letters.signals import MessageParser
class MessageMixin(object):
def setUp(self):
self.mailbox = Mailbox.objects.create(from_email='from@example.com')
super(MessageMix... | import email
from os.path import dirname, join
from django.utils import six
from django_mailbox.models import Mailbox
from feder.letters.signals import MessageParser
class MessageMixin(object):
def setUp(self):
self.mailbox = Mailbox.objects.create(from_email='from@example.com')
super(MessageMix... | Fix detect Git-LFS in tests | Fix detect Git-LFS in tests
| Python | mit | watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder | ---
+++
@@ -21,7 +21,7 @@
path = MessageMixin._get_email_path(filename)
for line in open('git-lfs.github.com', 'r'):
if 'git-lfs' in line:
- raise new Exception("File '{}' not downloaded. Only Git-LFS reference available. Perform 'git lfs pull'.".format(filename))
+ ... |
dabb6e7b3855d93df74d690607432e27b5d9c82f | ipython/profile/00_import_sciqnd.py | ipython/profile/00_import_sciqnd.py | import cPickle as pickle
import glob
import json
import math
import os
import sys
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy as sp
import scipy.io
import scipy.stats
import skimage
import skimage.transform
import skimage.io
import cv2
# The following ... | import cPickle as pickle
import glob
import json
import math
import os
import sys
import cv2
import h5py
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy as sp
import scipy.io
import scipy.stats
import skimage
import skimage.transform
import skimage.io
# The... | Add h5py on sciqnd ipython profile | Add h5py on sciqnd ipython profile
| Python | mit | escorciav/linux-utils,escorciav/linux-utils | ---
+++
@@ -5,6 +5,8 @@
import os
import sys
+import cv2
+import h5py
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
@@ -16,8 +18,6 @@
import skimage.transform
import skimage.io
-import cv2
-
# The following lines call magic commands
get_ipython().run_line_magic(u"pdb", u"")
... |
6cd7e79fc32ebf75776ab0bcf367854d76dd5e03 | src/redditsubscraper/items.py | src/redditsubscraper/items.py | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import scrapy
class Post(scrapy.Item):
"""
A model representing a single Reddit post.
"""
id = scrapy.Field()
class Comment(scrapy.Item):
"""
A model representing a single Reddit comment
"""
id = scrapy.Field()
parent_id = scrapy.... | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import scrapy
class Post(scrapy.Item):
"""
A model representing a single Reddit post.
"""
"""An id encoded in base-36 without any prefixes."""
id = scrapy.Field()
class Comment(scrapy.Item):
"""
A model representing a single Reddit comme... | Add comments to item fields. | Add comments to item fields.
| Python | mit | rfkrocktk/subreddit-scraper | ---
+++
@@ -8,6 +8,8 @@
"""
A model representing a single Reddit post.
"""
+
+ """An id encoded in base-36 without any prefixes."""
id = scrapy.Field()
@@ -15,7 +17,10 @@
"""
A model representing a single Reddit comment
"""
+
+ """An id encoded in base-36 without any prefi... |
b590ddd735131faa3fd1bdc91b1866e1bd7b0738 | us_ignite/snippets/management/commands/snippets_load_fixtures.py | us_ignite/snippets/management/commands/snippets_load_fixtures.py | from django.core.management.base import BaseCommand
from us_ignite.snippets.models import Snippet
FIXTURES = [
{
'slug': 'home-box',
'name': 'Up next:',
'body': '',
'url_text': 'Get involved',
'url': '',
},
]
class Command(BaseCommand):
def handle(self, *args, *... | from django.core.management.base import BaseCommand
from us_ignite.snippets.models import Snippet
FIXTURES = [
{
'slug': 'home-box',
'name': 'UP NEXT: LOREM IPSUM',
'body': '',
'url_text': 'GET INVOLVED',
'url': '',
},
{
'slug': 'featured',
'name': ... | Add featured homepage initial fixture. | Add featured homepage initial fixture.
| Python | bsd-3-clause | us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite | ---
+++
@@ -6,9 +6,16 @@
FIXTURES = [
{
'slug': 'home-box',
- 'name': 'Up next:',
+ 'name': 'UP NEXT: LOREM IPSUM',
'body': '',
- 'url_text': 'Get involved',
+ 'url_text': 'GET INVOLVED',
+ 'url': '',
+ },
+ {
+ 'slug': 'featured',
+ 'name... |
d37f91f50dd6c0c3202258daca95ee6ee111688f | pyjswidgets/pyjamas/ui/Focus.oldmoz.py | pyjswidgets/pyjamas/ui/Focus.oldmoz.py |
def ensureFocusHandler():
JS("""
return (focusHandler !== null) ? focusHandler : (focusHandler =
@{{createFocusHandler}}());
""")
def createFocusHandler():
JS("""
return function(evt) {
// This function is called directly as an event handler, so 'this' is
// set up by the b... |
def ensureFocusHandler():
JS("""
return (focusHandler !== null) ? focusHandler : (focusHandler =
@{{createFocusHandler}}());
""")
def createFocusHandler():
JS("""
return function(evt) {
// This function is called directly as an event handler, so 'this' is
// set up by the b... | Fix for IE 11 (Focus) | Fix for IE 11 (Focus)
IE presents itself as mozilla, so it trips on the bug.
| Python | apache-2.0 | gpitel/pyjs,spaceone/pyjs,lancezlin/pyjs,spaceone/pyjs,lancezlin/pyjs,pombredanne/pyjs,pyjs/pyjs,Hasimir/pyjs,gpitel/pyjs,pyjs/pyjs,spaceone/pyjs,pyjs/pyjs,Hasimir/pyjs,lancezlin/pyjs,pyjs/pyjs,pombredanne/pyjs,gpitel/pyjs,Hasimir/pyjs,gpitel/pyjs,spaceone/pyjs,pombredanne/pyjs,lancezlin/pyjs,pombredanne/pyjs,Hasimir/p... | ---
+++
@@ -43,6 +43,4 @@
""")
def createFocusable():
- ensureFocusHandler()
- return createFocusable0()
-
+ return createFocusable0(ensureFocusHandler()) |
f7373a4c2adc74fc2ff18a7c441a978b6982df89 | pip/utils/packaging.py | pip/utils/packaging.py | from __future__ import absolute_import
import logging
import sys
from pip._vendor import pkg_resources
from pip._vendor.packaging import specifiers
from pip._vendor.packaging import version
logger = logging.getLogger(__name__)
def get_metadata(dist):
if (isinstance(dist, pkg_resources.DistInfoDistribution) and... | from __future__ import absolute_import
import logging
import sys
from pip._vendor import pkg_resources
from pip._vendor.packaging import specifiers
from pip._vendor.packaging import version
logger = logging.getLogger(__name__)
def get_metadata(dist):
if (isinstance(dist, pkg_resources.DistInfoDistribution) and... | Update check_requires_python and describe behavior in docstring | Update check_requires_python and describe behavior in docstring
| Python | mit | pradyunsg/pip,fiber-space/pip,atdaemon/pip,RonnyPfannschmidt/pip,techtonik/pip,rouge8/pip,xavfernandez/pip,fiber-space/pip,rouge8/pip,pradyunsg/pip,zvezdan/pip,techtonik/pip,pypa/pip,sigmavirus24/pip,sigmavirus24/pip,RonnyPfannschmidt/pip,zvezdan/pip,benesch/pip,rouge8/pip,atdaemon/pip,pfmoore/pip,pypa/pip,sbidoul/pip,... | ---
+++
@@ -19,6 +19,13 @@
def check_requires_python(requires_python):
+ """
+ Check if the python version in used match the `requires_python` specifier passed.
+
+ Return `True` if the version of python in use matches the requirement.
+ Return `False` if the version of python in use does not matches... |
3d5fd3233ecaf2bae5fbd5a1ae349c55d2f4cdc7 | scistack/scistack.py | scistack/scistack.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SciStack: the web app to build docker containers for reproducable science
"""
import os
import flask
app = flask.Flask(__name__)
@app.route("/")
def hello():
return "Choose a domain!"
if __name__ == "__main__":
app.run()
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SciStack: the web app to build docker containers for reproducable science
"""
import os
import flask
import inspect
app = flask.Flask(__name__, static_url_path='')
# Home of any pre-build docker files
docker_file_path = os.path.join(os.path.dirname(os.path.abspath(
... | Return pre-built dockerfile to user | Return pre-built dockerfile to user
| Python | mit | callaghanmt/research-stacks,callaghanmt/research-stacks,callaghanmt/research-stacks | ---
+++
@@ -7,13 +7,24 @@
"""
import os
import flask
+import inspect
-app = flask.Flask(__name__)
+app = flask.Flask(__name__, static_url_path='')
+
+# Home of any pre-build docker files
+docker_file_path = os.path.join(os.path.dirname(os.path.abspath(
+ inspect.getfile(inspect.currentframe()))), "..", "docke... |
834d02d65b0d71bd044b18b0be031751a8c1a7de | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
NODE_VERSION = 'v0.11.10'
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = '607907aed2c1dcdd3b5968a756a990ba3f47bca7'
| #!/usr/bin/env python
NODE_VERSION = 'v0.11.10'
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = '276722e68bb643e3ae3b468b701c276aeb884838'
| Upgrade libchromiumcontent: Add support for acceptsFirstMouse. | Upgrade libchromiumcontent: Add support for acceptsFirstMouse.
| Python | mit | bbondy/electron,greyhwndz/electron,Neron-X5/electron,jacksondc/electron,baiwyc119/electron,brave/electron,tinydew4/electron,trigrass2/electron,pirafrank/electron,arturts/electron,RobertJGabriel/electron,takashi/electron,wan-qy/electron,hokein/atom-shell,digideskio/electron,tincan24/electron,jonatasfreitasv/electron,ben... | ---
+++
@@ -2,4 +2,4 @@
NODE_VERSION = 'v0.11.10'
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
-LIBCHROMIUMCONTENT_COMMIT = '607907aed2c1dcdd3b5968a756a990ba3f47bca7'
+LIBCHROMIUMCONTENT_COMMIT = '276722e68bb643e3ae3b468b701c276aeb884838' |
099eb53d3c7a4be19fd79f11c9ccf52faff300d4 | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'e4b283c22236560fd289fe59c03e50adf39e7c4b'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
... | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'aa87035cc012ce0d533bb56b947bca81a6e71b82'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
... | Upgrade libchromiumcontent to fix generating node.lib | Upgrade libchromiumcontent to fix generating node.lib
| Python | mit | setzer777/electron,dkfiresky/electron,carsonmcdonald/electron,davazp/electron,michaelchiche/electron,gerhardberger/electron,systembugtj/electron,renaesop/electron,mirrh/electron,bbondy/electron,subblue/electron,Andrey-Pavlov/electron,joaomoreno/atom-shell,bpasero/electron,hokein/atom-shell,bpasero/electron,benweissmann... | ---
+++
@@ -4,7 +4,7 @@
import sys
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
-LIBCHROMIUMCONTENT_COMMIT = 'e4b283c22236560fd289fe59c03e50adf39e7c4b'
+LIBCHROMIUMCONTENT_COMMIT = 'aa87035cc012ce0d533bb56b947bca81a6e71b82'
ARCH = {
'cygwin': '32bit', |
f2071eb5781f4dfa4cacbcd9f0d1c71412ba80b1 | constants.py | constants.py | # Store various constants here
# Maximum file upload size (in bytes).
MAX_CONTENT_LENGTH = 1 * 1024 * 1024 * 1024
# Authentication constants
PWD_HASH_ALGORITHM = 'pbkdf2_sha256'
SALT_SIZE = 24
MIN_PASSWORD_LENGTH = 8
MAX_PASSWORD_LENGTH = 1024
HASH_ROUNDS = 50000
PWD_RESET_KEY_LENGTH = 32
# Length of time before reco... | # Store various constants here
# Maximum file upload size (in bytes).
MAX_CONTENT_LENGTH = 1 * 1024 * 1024 * 1024
# Authentication constants
PWD_HASH_ALGORITHM = 'pbkdf2_sha256'
SALT_SIZE = 24
MIN_PASSWORD_LENGTH = 8
MAX_PASSWORD_LENGTH = 1024
HASH_ROUNDS = 100000
PWD_RESET_KEY_LENGTH = 32
# Length of time before rec... | Set hash rounds back to 100000 | Set hash rounds back to 100000
- Installed python-m2crypto package which speeds up pbkdf2 enough that
100K rounds is fine again.
| Python | mit | RuddockHouse/RuddockWebsite,RuddockHouse/RuddockWebsite,RuddockHouse/RuddockWebsite | ---
+++
@@ -8,7 +8,7 @@
SALT_SIZE = 24
MIN_PASSWORD_LENGTH = 8
MAX_PASSWORD_LENGTH = 1024
-HASH_ROUNDS = 50000
+HASH_ROUNDS = 100000
PWD_RESET_KEY_LENGTH = 32
# Length of time before recovery key expires, in minutes.
PWD_RESET_KEY_EXPIRATION = 1440 |
3a78496f350c904ce64d30f422dfae8b6bc879c3 | flask_api/tests/runtests.py | flask_api/tests/runtests.py | import unittest
import sys
import subprocess
if __name__ == '__main__':
if len(sys.argv) > 1:
unittest.main(module='flask_api.tests')
else:
subprocess.call([sys.executable, '-m', 'unittest', 'discover'])
| import unittest
if __name__ == '__main__':
unittest.main(module='flask_api.tests')
| Simplify test execution to restore coverage measurement | Simplify test execution to restore coverage measurement
| Python | bsd-2-clause | theskumar-archive/flask-api,theskumar-archive/flask-api,theskumar-archive/flask-api,theskumar-archive/flask-api | ---
+++
@@ -1,10 +1,5 @@
import unittest
-import sys
-import subprocess
if __name__ == '__main__':
- if len(sys.argv) > 1:
- unittest.main(module='flask_api.tests')
- else:
- subprocess.call([sys.executable, '-m', 'unittest', 'discover'])
+ unittest.main(module='flask_api.tests') |
dcb8add6685dfb7dff626742b17ce03e013e72a1 | src/enrich/kucera_francis_enricher.py | src/enrich/kucera_francis_enricher.py | __author__ = 's7a'
# All imports
from extras import KuceraFrancis
from resource import Resource
from os import path
# The Kucera Francis enrichment class
class KuceraFrancisEnricher:
# Constructor for the Kucera Francis Enricher
def __init__(self):
self.kf = KuceraFrancis(path.join('data', 'kucera_f... | __author__ = 's7a'
# All imports
from extras import StemmedKuceraFrancis
from resource import Resource
from os import path
# The Kucera Francis enrichment class
class KuceraFrancisEnricher:
# Constructor for the Kucera Francis Enricher
def __init__(self):
self.kf = StemmedKuceraFrancis(path.join('da... | Use stemmed Kucera Francis for Enrichment | Use stemmed Kucera Francis for Enrichment
| Python | mit | Somsubhra/Simplify,Somsubhra/Simplify,Somsubhra/Simplify | ---
+++
@@ -1,7 +1,7 @@
__author__ = 's7a'
# All imports
-from extras import KuceraFrancis
+from extras import StemmedKuceraFrancis
from resource import Resource
from os import path
@@ -11,7 +11,7 @@
# Constructor for the Kucera Francis Enricher
def __init__(self):
- self.kf = KuceraFrancis... |
d57844d1d6b2172fe196db4945517a5b3a68d343 | satchless/process/__init__.py | satchless/process/__init__.py | class InvalidData(Exception):
"""
Raised for by step validation process
"""
pass
class Step(object):
"""
A single step in a multistep process
"""
def validate(self):
raise NotImplementedError() # pragma: no cover
class ProcessManager(object):
"""
A multistep process ... | class InvalidData(Exception):
"""
Raised for by step validation process
"""
pass
class Step(object):
"""
A single step in a multistep process
"""
def validate(self):
raise NotImplementedError() # pragma: no cover
class ProcessManager(object):
"""
A multistep process ... | Check explicit that next step is None | Check explicit that next step is None
| Python | bsd-3-clause | taedori81/satchless | ---
+++
@@ -39,7 +39,7 @@
return errors
def is_complete(self):
- return not self.get_next_step()
+ return self.get_next_step() is None
def __getitem__(self, step_id):
for step in self: |
221a84d52e5165013a5c7eb0b00c3ebcae294c8a | dashboard_app/extension.py | dashboard_app/extension.py | from lava_server.extension import LavaServerExtension
class DashboardExtension(LavaServerExtension):
@property
def app_name(self):
return "dashboard_app"
@property
def name(self):
return "Dashboard"
@property
def main_view_name(self):
return "dashboard_app.views.bund... | from lava_server.extension import LavaServerExtension
class DashboardExtension(LavaServerExtension):
@property
def app_name(self):
return "dashboard_app"
@property
def name(self):
return "Dashboard"
@property
def main_view_name(self):
return "dashboard_app.views.bund... | Add support for configuring data views and reports | Add support for configuring data views and reports
| Python | agpl-3.0 | Linaro/lava-server,OSSystems/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server,Linaro/lava-server | ---
+++
@@ -35,4 +35,9 @@
'linaro_django_pagination.middleware.PaginationMiddleware')
settings['RESTRUCTUREDTEXT_FILTER_SETTINGS'] = {
"initial_header_level": 4}
- # TODO: Add dataview database support
+
+ def contribute_to_settings_ex(self, settings_module, settings_objec... |
0003ee31f78d7861713a2bb7daacb9701b26a1b9 | cinder/wsgi/wsgi.py | cinder/wsgi/wsgi.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
# di... | # 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
# di... | Initialize osprofiler in WSGI application | Initialize osprofiler in WSGI application
This patch adds missing initialization of OSProfiler
when Cinder API is running as WSGI application.
Change-Id: Ifaffa2d58eeadf5d47fafbdde5538d26bcd346a6
| Python | apache-2.0 | Datera/cinder,phenoxim/cinder,mahak/cinder,openstack/cinder,j-griffith/cinder,Datera/cinder,j-griffith/cinder,mahak/cinder,openstack/cinder,phenoxim/cinder | ---
+++
@@ -29,7 +29,9 @@
# Need to register global_opts
from cinder.common import config
+from cinder.common import constants
from cinder import rpc
+from cinder import service
from cinder import version
CONF = cfg.CONF
@@ -43,4 +45,6 @@
config.set_middleware_defaults()
rpc.init(CONF)
+ servi... |
ef50e82c3c1f49d63d013ac538d932d40c430a46 | pyradiator/endpoint.py | pyradiator/endpoint.py | import queue
import threading
class Producer(object):
def __init__(self, period_in_seconds, queue, function):
self._period_in_seconds = period_in_seconds
self._queue = queue
self._function = function
self._event = threading.Event()
self._thread = threading.Thread(target=se... | try:
import queue
except ImportError:
import Queue
import threading
class Producer(object):
def __init__(self, period_in_seconds, queue, function):
self._period_in_seconds = period_in_seconds
self._queue = queue
self._function = function
self._event = threading.Event()
... | Handle import error on older python versions | Handle import error on older python versions
| Python | mit | crashmaster/pyradiator | ---
+++
@@ -1,4 +1,7 @@
-import queue
+try:
+ import queue
+except ImportError:
+ import Queue
import threading
|
91556f15e64f2407d77ab6ea35d74abccc9f1984 | pystitch/dmc_colors.py | pystitch/dmc_colors.py | import csv
import os
import color
def _GetDataDirPath():
return os.path.join(os.path.dirname(__file__), 'data')
def _GetCsvPath():
return os.path.join(_GetDataDirPath(), 'dmccolors.csv')
def _GetCsvString():
with open(_GetCsvPath()) as f:
return f.read().strip()
def _CreateDmcColorFromRow(row):
print ro... | import csv
import os
import color
def _GetDataDirPath():
return os.path.join(os.path.dirname(__file__), 'data')
def _GetCsvPath():
return os.path.join(_GetDataDirPath(), 'dmccolors.csv')
def _GetCsvString():
with open(_GetCsvPath()) as f:
return f.read().strip()
def _CreateDmcColorFromRow(row):
number =... | Add functionality to build the DMCColors set. | Add functionality to build the DMCColors set.
| Python | apache-2.0 | nanaze/pystitch,nanaze/pystitch | ---
+++
@@ -13,12 +13,36 @@
return f.read().strip()
def _CreateDmcColorFromRow(row):
- print row
number = int(row[0])
name = row[1]
hex_color = row[5]
- red, green, blue = color.RGBColorFromHexString(hex_color)
+ red, green, blue = color.RGBTupleFromHexString(hex_color)
return DMCColor(number, ... |
511a133599b86deae83d9ad8a3f7a7c5c45e07bf | core/views.py | core/views.py | from django.shortcuts import render
from django.http import Http404
from django.contrib.messages import success
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailcore.models import Page
from .models import HomePage, StaticPage
from category.models import Category
from .forms import ContactFo... | from django.shortcuts import render
from django.http import Http404
from django.contrib.messages import success
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailcore.models import Page
from .models import HomePage, StaticPage
from category.models import Category
from .forms import ContactFo... | Clear the contact form after it has been successfully posted. | Clear the contact form after it has been successfully posted.
| Python | bsd-3-clause | PARINetwork/pari,PARINetwork/pari,PARINetwork/pari,PARINetwork/pari | ---
+++
@@ -40,6 +40,7 @@
if form.is_valid():
form.save()
success(request, _("Your query has successfully been sent"))
+ form = ContactForm()
else:
form = ContactForm()
return render(request, "core/contact_us.html", { |
7cb68f6a749a38fef9820004a857e301c12a3044 | morenines/util.py | morenines/util.py | import os
import hashlib
from fnmatch import fnmatchcase
def get_files(index):
paths = []
for dirpath, dirnames, filenames in os.walk(index.headers['root_path']):
# Remove ignored directories
dirnames = [d for d in dirnames if not index.ignores.match(d)]
for filename in (f for f in ... | import os
import hashlib
def get_files(index):
paths = []
for dirpath, dirnames, filenames in os.walk(index.headers['root_path']):
# Remove ignored directories
dirnames[:] = [d for d in dirnames if not index.ignores.match(d)]
for filename in (f for f in filenames if not index.ignores... | Fix in-place os.walk() dirs modification | Fix in-place os.walk() dirs modification
| Python | mit | mcgid/morenines,mcgid/morenines | ---
+++
@@ -1,7 +1,5 @@
import os
import hashlib
-
-from fnmatch import fnmatchcase
def get_files(index):
@@ -9,7 +7,7 @@
for dirpath, dirnames, filenames in os.walk(index.headers['root_path']):
# Remove ignored directories
- dirnames = [d for d in dirnames if not index.ignores.match(d)]... |
c157ddeae7131e4141bca43857730103617b42c4 | froide/upload/serializers.py | froide/upload/serializers.py | from rest_framework import serializers
from .models import Upload
class UploadSerializer(serializers.ModelSerializer):
class Meta:
model = Upload
fields = '__all__'
| from rest_framework import serializers
from .models import Upload
class UploadSerializer(serializers.ModelSerializer):
class Meta:
model = Upload
fields = '__all__'
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['guid'].required = True
| Make guid required in upload API | Make guid required in upload API | Python | mit | stefanw/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,fin/froide,stefanw/froide | ---
+++
@@ -7,3 +7,7 @@
class Meta:
model = Upload
fields = '__all__'
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.fields['guid'].required = True |
1d32debc1ea2ce8d11c8bc1abad048d6e4937520 | froide_campaign/listeners.py | froide_campaign/listeners.py | from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
from .consumers import PRESENCE_ROOM
from .models import Campaign
def connect_info_object(sender, **kwargs):
reference = kwargs.get('reference')
if not reference:
return
if not reference.startswith('campaign:'):
... | from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
from .consumers import PRESENCE_ROOM
from .models import Campaign
def connect_info_object(sender, **kwargs):
reference = kwargs.get('reference')
if not reference:
return
if not reference.startswith('campaign:'):
... | Fix non-iobj campaign request connection | Fix non-iobj campaign request connection | Python | mit | okfde/froide-campaign,okfde/froide-campaign,okfde/froide-campaign | ---
+++
@@ -15,6 +15,9 @@
try:
campaign, ident = campaign_value.split('@', 1)
except (ValueError, IndexError):
+ return
+
+ if not ident:
return
try: |
83bc5fbaff357b43c49f948ec685e7ab067b8f78 | core/urls.py | core/urls.py |
from django.conf.urls.defaults import *
urlpatterns = patterns("core.views",
url("^airport_list/(?P<south>.*)/(?P<west>.*)/(?P<north>.*)/(?P<east>.*)/",
"airports_for_boundary", name="airports_for_boundary"),
)
|
from django.conf.urls.defaults import *
urlpatterns = patterns("core.views",
url("^airport/list/(?P<south>.*)/(?P<west>.*)/(?P<north>.*)/(?P<east>.*)/",
"airports_for_boundary", name="airports_for_boundary"),
)
| Change URL pattern for airport list. | Change URL pattern for airport list.
| Python | bsd-2-clause | stephenmcd/ratemyflight,stephenmcd/ratemyflight | ---
+++
@@ -3,7 +3,7 @@
urlpatterns = patterns("core.views",
- url("^airport_list/(?P<south>.*)/(?P<west>.*)/(?P<north>.*)/(?P<east>.*)/",
+ url("^airport/list/(?P<south>.*)/(?P<west>.*)/(?P<north>.*)/(?P<east>.*)/",
"airports_for_boundary", name="airports_for_boundary"),
)
|
de1ff8a480cc6d6e86bb179e6820ab9f21145679 | byceps/services/user/event_service.py | byceps/services/user/event_service.py | """
byceps.services.user.event_service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from datetime import datetime
from typing import Sequence
from ...database import db
from ...typing import UserID
from .models.event import UserEv... | """
byceps.services.user.event_service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from datetime import datetime
from typing import Optional, Sequence
from ...database import db
from ...typing import UserID
from .models.event imp... | Allow to provide a custom `occurred_at` value when building a user event | Allow to provide a custom `occurred_at` value when building a user event
| Python | bsd-3-clause | homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps | ---
+++
@@ -7,7 +7,7 @@
"""
from datetime import datetime
-from typing import Sequence
+from typing import Optional, Sequence
from ...database import db
from ...typing import UserID
@@ -23,12 +23,13 @@
db.session.commit()
-def _build_event(event_type: str, user_id: UserID, data: UserEventData
- ... |
e4b2d60af93fd84407eb7107497b2b500d79f9d7 | calexicon/dates/tests/test_distant.py | calexicon/dates/tests/test_distant.py | import unittest
from datetime import date as vanilla_date, timedelta
from calexicon.dates import DistantDate
class TestDistantDate(unittest.TestCase):
def test_subtraction(self):
dd = DistantDate(10000, 1, 1)
self.assertIsInstance(dd - vanilla_date(9999, 1, 1), timedelta)
self.assertIsIn... | import unittest
from datetime import date as vanilla_date, timedelta
from calexicon.calendars import ProlepticJulianCalendar
from calexicon.dates import DateWithCalendar, DistantDate
class TestDistantDate(unittest.TestCase):
def test_subtraction(self):
dd = DistantDate(10000, 1, 1)
self.assertIs... | Add a passing test for equality. | Add a passing test for equality.
Narrow down problems with constructing a date far in the future.
| Python | apache-2.0 | jwg4/qual,jwg4/calexicon | ---
+++
@@ -2,7 +2,8 @@
from datetime import date as vanilla_date, timedelta
-from calexicon.dates import DistantDate
+from calexicon.calendars import ProlepticJulianCalendar
+from calexicon.dates import DateWithCalendar, DistantDate
class TestDistantDate(unittest.TestCase):
def test_subtraction(self):
@... |
1f2d8fadd114106cefbc23060f742163be415376 | cherrypy/process/__init__.py | cherrypy/process/__init__.py | """Site container for an HTTP server.
A Web Site Process Bus object is used to connect applications, servers,
and frameworks with site-wide services such as daemonization, process
reload, signal handling, drop privileges, PID file management, logging
for all of these, and many more.
The 'plugins' module defines a few... | """Site container for an HTTP server.
A Web Site Process Bus object is used to connect applications, servers,
and frameworks with site-wide services such as daemonization, process
reload, signal handling, drop privileges, PID file management, logging
for all of these, and many more.
The 'plugins' module defines a few... | Use __all__ to avoid linter errors | Use __all__ to avoid linter errors
| Python | bsd-3-clause | Safihre/cherrypy,Safihre/cherrypy,cherrypy/cherrypy,cherrypy/cherrypy | ---
+++
@@ -10,5 +10,8 @@
for each class.
"""
-from cherrypy.process.wspbus import bus # noqa
-from cherrypy.process import plugins, servers # noqa
+from .wspbus import bus
+from . import plugins, servers
+
+
+__all__ = ('bus', 'plugins', 'servers') |
9deef39639bd42d6a6c91f6aafdf8e92a73a605d | fortdepend/preprocessor.py | fortdepend/preprocessor.py | import io
import pcpp
class FortranPreprocessor(pcpp.Preprocessor):
def __init__(self):
super(pcpp.Preprocessor, self).__init__()
def parse_to_string_lines(self, text):
with io.StringIO() as f:
self.parse(text)
self.write(f)
f.seek(0)
result = f... | import io
import pcpp
class FortranPreprocessor(pcpp.Preprocessor):
def __init__(self):
super(FortranPreprocessor, self).__init__()
def parse_to_string_lines(self, text):
with io.StringIO() as f:
self.parse(text)
self.write(f)
f.seek(0)
result =... | Fix super() call (properly) for py2.7 | Fix super() call (properly) for py2.7
| Python | mit | ZedThree/fort_depend.py,ZedThree/fort_depend.py | ---
+++
@@ -4,7 +4,7 @@
class FortranPreprocessor(pcpp.Preprocessor):
def __init__(self):
- super(pcpp.Preprocessor, self).__init__()
+ super(FortranPreprocessor, self).__init__()
def parse_to_string_lines(self, text):
with io.StringIO() as f: |
0a234829ecdde1483273d0f6fb249cc9fc0425d5 | ffmpeg_process.py | ffmpeg_process.py | # coding: utf-8
import logging
import psutil
from subprocess import PIPE
class FfmpegProcess(object):
def __init__(self):
self._cmdline = None
self._process = None
self._paused = False
def run(self):
if self._cmdline is None:
logging.debug('cmdline is not yet defin... | # coding: utf-8
import logging
import psutil
from subprocess import PIPE
class FfmpegProcess(object):
def __init__(self):
self._cmdline = None
self._process = None
self._paused = False
def run(self):
if self._cmdline is None:
logging.debug('cmdline is not yet defin... | Implement pause property more accurately | Implement pause property more accurately
| Python | mit | dkrikun/ffmpeg-rcd | ---
+++
@@ -55,7 +55,7 @@
@property
def paused(self):
- return self._paused
+ return self._paused and self.running
@property
def cmdline(self): |
2649e2e6a2d79febad14e0728c65b1429beb8858 | spotpy/unittests/test_fast.py | spotpy/unittests/test_fast.py | import unittest
try:
import spotpy
except ImportError:
import sys
sys.path.append(".")
import spotpy
from spotpy.examples.spot_setup_hymod_python import spot_setup
class TestFast(unittest.TestCase):
def setUp(self):
self.spot_setup = spot_setup()
self.rep = 800 # REP must be a... | import unittest
try:
import spotpy
except ImportError:
import sys
sys.path.append(".")
import spotpy
from spotpy.examples.spot_setup_hymod_python import spot_setup
class TestFast(unittest.TestCase):
def setUp(self):
self.spot_setup = spot_setup()
self.rep = 200 # REP must be a... | Reduce amounts of runs for fast test analysis | Reduce amounts of runs for fast test analysis
| Python | mit | thouska/spotpy,bees4ever/spotpy,thouska/spotpy,bees4ever/spotpy,bees4ever/spotpy,thouska/spotpy | ---
+++
@@ -16,7 +16,7 @@
def setUp(self):
self.spot_setup = spot_setup()
- self.rep = 800 # REP must be a multiply of amount of parameters which are in 7 if using hymod
+ self.rep = 200 # REP must be a multiply of amount of parameters which are in 7 if using hymod
self.timeout ... |
6dc4314f1c5510a6e5f857d739956654909d97b2 | pronto/__init__.py | pronto/__init__.py | # coding: utf-8
"""a Python frontend to ontologies
"""
from __future__ import absolute_import
from __future__ import unicode_literals
__version__ = 'dev'
__author__ = 'Martin Larralde'
__author_email__ = 'martin.larralde@ens-paris-saclay.fr'
__license__ = "MIT"
from .ontology import Ontology
from .term import Term, T... | # coding: utf-8
"""a Python frontend to ontologies
"""
from __future__ import absolute_import
from __future__ import unicode_literals
__version__ = 'dev'
__author__ = 'Martin Larralde'
__author_email__ = 'martin.larralde@ens-paris-saclay.fr'
__license__ = "MIT"
from .ontology import Ontology
from .term import Term, T... | Add `Description` to top-level imports | Add `Description` to top-level imports
| Python | mit | althonos/pronto | ---
+++
@@ -13,6 +13,7 @@
from .term import Term, TermList
from .relationship import Relationship
from .synonym import Synonym, SynonymType
+from .description import Description
# Dynamically get the version of the installed module
try: |
1e47f79647baffd62d2a434710fe98b3c2247f28 | tests/pgcomplex_app/models.py | tests/pgcomplex_app/models.py | # -*- coding: utf-8 -*-
from django.db import models
from django_orm.postgresql.fields.arrays import ArrayField
from django_orm.postgresql.fields.interval import IntervalField
from django_orm.postgresql.fields.bytea import ByteaField
from django_orm.postgresql.manager import PgManager
class IntModel(models.Model):
... | # -*- coding: utf-8 -*-
from django.db import models
from django_orm.postgresql.fields.arrays import ArrayField
from django_orm.postgresql.fields.interval import IntervalField
from django_orm.postgresql.fields.bytea import ByteaField
from django_orm.manager import Manager
class IntModel(models.Model):
lista = Arr... | Fix tests with last changes on api. | Fix tests with last changes on api.
| Python | bsd-3-clause | EnTeQuAk/django-orm,EnTeQuAk/django-orm | ---
+++
@@ -4,31 +4,31 @@
from django_orm.postgresql.fields.arrays import ArrayField
from django_orm.postgresql.fields.interval import IntervalField
from django_orm.postgresql.fields.bytea import ByteaField
-from django_orm.postgresql.manager import PgManager
+from django_orm.manager import Manager
class IntMod... |
035d871399a5e9a60786332b2a8c42fbea98397f | docker/settings.py | docker/settings.py | from .base_settings import *
import os
INSTALLED_APPS += [
'data_aggregator.apps.DataAggregatorConfig',
'webpack_loader',
]
if os.getenv('ENV') == 'localdev':
DEBUG = True
DATA_AGGREGATOR_ACCESS_GROUP = 'u_test_group'
DATA_AGGREGATOR_THREADING_ENABLED = False
RESTCLIENTS_DAO_CACHE_CLASS = None... | from .base_settings import *
import os
INSTALLED_APPS += [
'data_aggregator.apps.DataAggregatorConfig',
'webpack_loader',
]
if os.getenv('ENV') == 'localdev':
DEBUG = True
DATA_AGGREGATOR_ACCESS_GROUP = 'u_test_group'
DATA_AGGREGATOR_THREADING_ENABLED = False
RESTCLIENTS_DAO_CACHE_CLASS = None... | Revert "Increase rest client pool size to 100" | Revert "Increase rest client pool size to 100"
| Python | apache-2.0 | uw-it-aca/canvas-analytics,uw-it-aca/canvas-analytics,uw-it-aca/canvas-analytics,uw-it-aca/canvas-analytics | ---
+++
@@ -23,5 +23,5 @@
}
}
-RESTCLIENTS_CANVAS_POOL_SIZE = 100
+RESTCLIENTS_CANVAS_POOL_SIZE = 50
ACADEMIC_CANVAS_ACCOUNT_ID = '84378' |
7665e2b0af042948dfc7a1814275cd3309f5f6cf | pages/tests/__init__.py | pages/tests/__init__.py | """Django page CMS test suite module"""
from djangox.test.depth import alltests
def suite():
return alltests(__file__, __name__)
| """Django page CMS test suite module"""
import unittest
def suite():
suite = unittest.TestSuite()
from pages.tests.test_functionnal import FunctionnalTestCase
from pages.tests.test_unit import UnitTestCase
from pages.tests.test_regression import RegressionTestCase
from pages.tests.test_pages_link i... | Remove the dependency to django-unittest-depth | Remove the dependency to django-unittest-depth
| Python | bsd-3-clause | remik/django-page-cms,oliciv/django-page-cms,remik/django-page-cms,remik/django-page-cms,pombredanne/django-page-cms-1,batiste/django-page-cms,batiste/django-page-cms,akaihola/django-page-cms,oliciv/django-page-cms,remik/django-page-cms,pombredanne/django-page-cms-1,akaihola/django-page-cms,akaihola/django-page-cms,bat... | ---
+++
@@ -1,5 +1,16 @@
"""Django page CMS test suite module"""
-from djangox.test.depth import alltests
+import unittest
def suite():
- return alltests(__file__, __name__)
+ suite = unittest.TestSuite()
+ from pages.tests.test_functionnal import FunctionnalTestCase
+ from pages.tests.test_unit impor... |
8dccce77f6c08a7c20f38b9f1bacc27b71ab56a1 | examples/web/wiki/macros/utils.py | examples/web/wiki/macros/utils.py | """Utils macros
Utility macros
"""
def macros(macro, environ, *args, **kwargs):
"""Return a list of available macros"""
s = "\n".join(["* %s" % k for k in environ["macros"].keys()])
return environ["parser"].generate(s, environ=environ)
| """Utils macros
Utility macros
"""
from inspect import getdoc
def macros(macro, environ, *args, **kwargs):
"""Return a list of available macros"""
macros = environ["macros"].items()
s = "\n".join(["== %s ==\n%s\n" % (k, getdoc(v)) for k, v in macros])
return environ["parser"].generate(s, environ=en... | Change the output of <<macros>> | examples/web/wiki: Change the output of <<macros>>
| Python | mit | treemo/circuits,eriol/circuits,treemo/circuits,eriol/circuits,nizox/circuits,treemo/circuits,eriol/circuits | ---
+++
@@ -3,9 +3,12 @@
Utility macros
"""
+from inspect import getdoc
+
def macros(macro, environ, *args, **kwargs):
"""Return a list of available macros"""
- s = "\n".join(["* %s" % k for k in environ["macros"].keys()])
+ macros = environ["macros"].items()
+ s = "\n".join(["== %s ==\n%s\n" % (... |
38833f68daabe845650250e3edf9cb4b3cc9cb62 | events/templatetags/humantime.py | events/templatetags/humantime.py | # -*- encoding:utf-8 -*-
# Template tag
from django.template.defaultfilters import stringfilter
from datetime import datetime, timedelta
from django import template
register = template.Library()
@register.filter
def event_time(start, end):
today = datetime.today ()
result = ""
if start == today:
... | # -*- encoding:utf-8 -*-
# Template tag
from django.template.defaultfilters import stringfilter
from datetime import datetime, timedelta
from django import template
import locale
register = template.Library()
@register.filter
def event_time(start, end):
today = datetime.today ()
result = ""
# Hack! get t... | Print date in fr_CA locale | hack: Print date in fr_CA locale
| Python | agpl-3.0 | mlhamel/agendadulibre,mlhamel/agendadulibre,vcorreze/agendaEteAccoord,mlhamel/agendadulibre,vcorreze/agendaEteAccoord,vcorreze/agendaEteAccoord | ---
+++
@@ -3,6 +3,7 @@
from django.template.defaultfilters import stringfilter
from datetime import datetime, timedelta
from django import template
+import locale
register = template.Library()
@@ -11,10 +12,14 @@
today = datetime.today ()
result = ""
+ # Hack! get the correct user local from t... |
e715dd65d3adf74624bc2102afd6a6d8f8706da6 | dlm/models/components/linear.py | dlm/models/components/linear.py | import numpy
import theano
import theano.tensor as T
class Linear():
def __init__(self, rng, input, n_in, n_out, W=None, b=None):
self.input = input
if W is None:
W_values = numpy.asarray(
rng.uniform(
low = -0.01, #low=-numpy.sqrt(6. / (n_in + n_out)),
high = 0.01, #high=numpy.sqrt(6. / (n_in... | import numpy
import theano
import theano.tensor as T
class Linear():
def __init__(self, rng, input, n_in, n_out, W_values=None, b_values=None):
self.input = input
if W_values is None:
W_values = numpy.asarray(
rng.uniform(
low = -0.01, #low=-numpy.sqrt(6. / (n_in + n_out)),
high = 0.01, #high=... | Initialize from argument or using a uniform distribution | Initialize from argument or using a uniform distribution
| Python | mit | nusnlp/corelm | ---
+++
@@ -4,11 +4,11 @@
class Linear():
- def __init__(self, rng, input, n_in, n_out, W=None, b=None):
+ def __init__(self, rng, input, n_in, n_out, W_values=None, b_values=None):
self.input = input
- if W is None:
+ if W_values is None:
W_values = numpy.asarray(
rng.uniform(
low = -0.0... |
e0091310ffdb39127f7138966026445b0bac53fc | salt/states/rdp.py | salt/states/rdp.py | # -*- coding: utf-8 -*-
'''
Manage RDP Service on Windows servers
'''
def __virtual__():
'''
Load only if network_win is loaded
'''
return 'rdp' if 'rdp.enable' in __salt__ else False
def enabled(name):
'''
Enable RDP the service on the server
'''
ret = {'name': name,
'res... | # -*- coding: utf-8 -*-
'''
Manage RDP Service on Windows servers
'''
def __virtual__():
'''
Load only if network_win is loaded
'''
return 'rdp' if 'rdp.enable' in __salt__ else False
def enabled(name):
'''
Enable RDP the service on the server
'''
ret = {'name': name,
'res... | Return proper results for 'test=True' | Return proper results for 'test=True'
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -25,7 +25,7 @@
ret['changes'] = {'enabled rdp': True}
if __opts__['test']:
- ret['result'] = None
+ ret['result'] = stat
return ret
ret['result'] = __salt__['rdp.enable']()
@@ -46,6 +46,7 @@
ret['changes'] = {'disable rdp': True}
if __opts__['te... |
1a3c251abe2e8ebf3020a21a3449abae6b04c2b1 | perf/tests/test_system.py | perf/tests/test_system.py | import os.path
import sys
from perf.tests import get_output
from perf.tests import unittest
class SystemTests(unittest.TestCase):
def test_show(self):
args = [sys.executable, '-m', 'perf', 'system', 'show']
proc = get_output(args)
regex = ('(Run "%s -m perf system tune" to tune the syste... | import os.path
import sys
from perf.tests import get_output
from perf.tests import unittest
class SystemTests(unittest.TestCase):
def test_show(self):
args = [sys.executable, '-m', 'perf', 'system', 'show']
proc = get_output(args)
regex = ('(Run "%s -m perf system tune" to tune the syste... | Fix test_show test to support tuned systems | Fix test_show test to support tuned systems
| Python | mit | vstinner/pyperf,haypo/perf | ---
+++
@@ -16,7 +16,9 @@
% os.path.basename(sys.executable))
self.assertRegex(proc.stdout, regex, msg=proc)
- self.assertEqual(proc.returncode, 2, msg=proc)
+ # The return code is either 0 if the system is tuned or 2 if the
+ # system isn't
+ self.assertIn(pro... |
141eb2a647490142adf017d3a755d03ab89ed687 | jrnl/plugins/tag_exporter.py | jrnl/plugins/tag_exporter.py | #!/usr/bin/env python
# encoding: utf-8
from __future__ import absolute_import, unicode_literals
from .text_exporter import TextExporter
from .util import get_tags_count
class TagExporter(TextExporter):
"""This Exporter can convert entries and journals into json."""
names = ["tags"]
extension = "tags"
... | #!/usr/bin/env python
# encoding: utf-8
from __future__ import absolute_import, unicode_literals
from .text_exporter import TextExporter
from .util import get_tags_count
class TagExporter(TextExporter):
"""This Exporter can lists the tags for entries and journals, exported as a plain text file."""
names = ["... | Update `Tag` exporter code documentation. | Update `Tag` exporter code documentation.
| Python | mit | maebert/jrnl,notbalanced/jrnl,philipsd6/jrnl,MinchinWeb/jrnl | ---
+++
@@ -7,18 +7,18 @@
class TagExporter(TextExporter):
- """This Exporter can convert entries and journals into json."""
+ """This Exporter can lists the tags for entries and journals, exported as a plain text file."""
names = ["tags"]
extension = "tags"
@classmethod
def export_en... |
093c9065de9e0e08f248bbb84696bf30309bd536 | examples/parallel/timer.py | examples/parallel/timer.py | import rx
import concurrent.futures
import time
seconds = [5, 1, 2, 4, 3]
def sleep(t):
time.sleep(t)
return t
def output(result):
print '%d seconds' % result
with concurrent.futures.ProcessPoolExecutor(5) as executor:
rx.Observable.from_(seconds).flat_map(
lambda s: executor.submit(sleep,... | from __future__ import print_function
import rx
import concurrent.futures
import time
seconds = [5, 1, 2, 4, 3]
def sleep(t):
time.sleep(t)
return t
def output(result):
print('%d seconds' % result)
with concurrent.futures.ProcessPoolExecutor(5) as executor:
rx.Observable.from_(seconds).flat_map(
... | Fix parallel example for Python 3 | Fix parallel example for Python 3
| Python | mit | dbrattli/RxPY,ReactiveX/RxPY,ReactiveX/RxPY | ---
+++
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
import rx
import concurrent.futures
import time
@@ -11,7 +13,7 @@
def output(result):
- print '%d seconds' % result
+ print('%d seconds' % result)
with concurrent.futures.ProcessPoolExecutor(5) as executor:
rx.Observable.from_(seco... |
efeb8bbf351f8c2c25be15b5ca32d5f76ebdd4ef | launch_control/models/hw_device.py | launch_control/models/hw_device.py | """
Module with the HardwareDevice model.
"""
from launch_control.utils.json import PlainOldData
class HardwareDevice(PlainOldData):
"""
Model representing any HardwareDevice
A device is just a "device_type" attribute with a bag of properties
and a human readable description. Individual device types... | """
Module with the HardwareDevice model.
"""
from launch_control.utils.json import PlainOldData
class HardwareDevice(PlainOldData):
"""
Model representing any HardwareDevice
A device is just a "device_type" attribute with a bag of properties
and a human readable description. Individual device types... | Fix slot name in HardwareDevice | Fix slot name in HardwareDevice
| Python | agpl-3.0 | Linaro/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server,OSSystems/lava-server,Linaro/lava-server,OSSystems/lava-server | ---
+++
@@ -34,7 +34,7 @@
DEVICE_PCI = "device.pci"
DEVICE_BOARD = "device.board"
- __slots__ = ('device_type', 'desc', 'attributes')
+ __slots__ = ('device_type', 'description', 'attributes')
def __init__(self, device_type, description, attributes=None):
self.device_type = device_ty... |
351dd3d0540b6169a58897f9cb2ec6b1c20d57a5 | core/forms/games.py | core/forms/games.py | from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, HTML, Submit, Button, Fieldset
from django.forms import ModelForm, Textarea
from core.models import Game
class GameForm(ModelForm):
class Meta:
model = Game
exclude = [... | from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, HTML, Submit, Button, Fieldset
from django.forms import ModelForm, Textarea
from core.models import Game
class GameForm(ModelForm):
class Meta:
model = Game
exclude = [... | Remove unused field from game form | Remove unused field from game form
| Python | mit | joshsamara/game-website,joshsamara/game-website,joshsamara/game-website | ---
+++
@@ -21,7 +21,6 @@
'{{ heading }}',
'name',
'description',
- 'link',
HTML("""{% if form.image.value %}<img class="img-responsive" src="{{ MEDIA_URL }}{{ form.image.value }}">
{% endif %}"""),
'i... |
26b66a830fd9322dcc826fee2f1924670ea6c976 | tests/functional/test_requests.py | tests/functional/test_requests.py | import pytest
from tests.lib import PipTestEnvironment
@pytest.mark.network
def test_timeout(script: PipTestEnvironment) -> None:
result = script.pip(
"--timeout",
"0.0001",
"install",
"-vvv",
"INITools",
expect_error=True,
)
assert (
"Could not fet... | import pytest
from tests.lib import PipTestEnvironment
@pytest.mark.network
def test_timeout(script: PipTestEnvironment) -> None:
result = script.pip(
"--timeout",
"0.00001",
"install",
"-vvv",
"INITools",
expect_error=True,
)
assert (
"Could not fe... | Decrease timeout to make test less flaky | Decrease timeout to make test less flaky
| Python | mit | pypa/pip,pradyunsg/pip,sbidoul/pip,sbidoul/pip,pfmoore/pip,pradyunsg/pip,pypa/pip,pfmoore/pip | ---
+++
@@ -7,7 +7,7 @@
def test_timeout(script: PipTestEnvironment) -> None:
result = script.pip(
"--timeout",
- "0.0001",
+ "0.00001",
"install",
"-vvv",
"INITools", |
51f6272870e4e72d2364b2c2f660457b5c9286ef | doc/sample_code/search_forking_pro.py | doc/sample_code/search_forking_pro.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
sys.path.append('./../../')
from pyogi.ki2converter import *
from pyogi.kifu import *
if __name__ == '__main__':
for n in range(0, 50000):
n1 = (n // 10000)
n2 = int(n < 10000)
relpath = '~/data/shogi/2chkifu/{... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import pandas as pd
sys.path.append('./../../')
from pyogi.ki2converter import *
from pyogi.kifu import *
if __name__ == '__main__':
res_table = []
for n in range(0, 50000):
n1 = (n // 10000)
n2 = int(n < 10000)
... | Add sum up part using pd.crosstab | Add sum up part using pd.crosstab
| Python | mit | tosh1ki/pyogi,tosh1ki/pyogi | ---
+++
@@ -3,6 +3,7 @@
import os
import sys
+import pandas as pd
sys.path.append('./../../')
from pyogi.ki2converter import *
@@ -10,6 +11,8 @@
if __name__ == '__main__':
+
+ res_table = []
for n in range(0, 50000):
@@ -27,8 +30,23 @@
csa = ki2converter.to_csa()
+ if ... |
4db93f27d6d4f9b05b33af96bff15108272df6ce | src/webapp/public.py | src/webapp/public.py | import json
from flask import Blueprint, render_template
import database as db
from database.model import Team
bp = Blueprint('public', __name__)
@bp.route("/map")
def map_page():
return render_template("public/map.html")
@bp.route("/map_teams")
def map_teams():
qry = db.session.query(Team).filter_by(conf... | import json
from flask import Blueprint, render_template
import database as db
from database.model import Team
bp = Blueprint('public', __name__)
@bp.route("/map")
def map_page():
return render_template("public/map.html")
@bp.route("/map_teams")
def map_teams():
qry = db.session.query(Team).filter_by(conf... | Add multi team output in markers | Add multi team output in markers
Signed-off-by: Dominik Pataky <46f1a0bd5592a2f9244ca321b129902a06b53e03@netdecorator.org>
| Python | bsd-3-clause | eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system | ---
+++
@@ -15,10 +15,17 @@
@bp.route("/map_teams")
def map_teams():
qry = db.session.query(Team).filter_by(confirmed=True).filter_by(deleted=False).filter_by(backup=False)
- data = []
+ data_dict = {}
for item in qry:
if item.location is not None:
- data.append({"lat": item.loca... |
3885e8fd36f419976d0b002c391dc246588929c7 | admin/metrics/views.py | admin/metrics/views.py | from django.views.generic import TemplateView
from admin.base.settings import KEEN_CREDENTIALS
from admin.base.utils import OSFAdmin
class MetricsView(OSFAdmin, TemplateView):
template_name = 'metrics/osf_metrics.html'
def get_context_data(self, **kwargs):
kwargs.update(KEEN_CREDENTIALS.copy())
... | from django.views.generic import TemplateView
from django.contrib.auth.mixins import PermissionRequiredMixin
from admin.base.settings import KEEN_CREDENTIALS
from admin.base.utils import OSFAdmin
class MetricsView(OSFAdmin, TemplateView, PermissionRequiredMixin):
template_name = 'metrics/osf_metrics.html'
... | Add view metrics permission to metrics view | Add view metrics permission to metrics view
| Python | apache-2.0 | sloria/osf.io,monikagrabowska/osf.io,brianjgeiger/osf.io,sloria/osf.io,erinspace/osf.io,TomBaxter/osf.io,mfraezz/osf.io,chrisseto/osf.io,crcresearch/osf.io,adlius/osf.io,laurenrevere/osf.io,monikagrabowska/osf.io,acshi/osf.io,crcresearch/osf.io,cwisecarver/osf.io,icereval/osf.io,cwisecarver/osf.io,aaxelb/osf.io,adlius/... | ---
+++
@@ -1,4 +1,5 @@
from django.views.generic import TemplateView
+from django.contrib.auth.mixins import PermissionRequiredMixin
from admin.base.settings import KEEN_CREDENTIALS
@@ -6,8 +7,9 @@
from admin.base.utils import OSFAdmin
-class MetricsView(OSFAdmin, TemplateView):
+class MetricsView(OSFAdmi... |
d10720d1dd7997b5e1543cb27f2cd3e1088f30f5 | server/fulltext.py | server/fulltext.py | #!/usr/bin/env python
# encoding: utf-8
"""
"""
from bottle import route, run, template, request
import urllib2
import urllib
import sys
import os
from whoosh.index import create_in, open_dir
from whoosh.fields import *
from whoosh.qparser import QueryParser, MultifieldParser
from whoosh.query import *
@route('/')
... | #!/usr/bin/env python
# encoding: utf-8
"""
"""
from bottle import route, run, template, request
import urllib2
import urllib
import sys
import os
from whoosh.index import create_in, open_dir
from whoosh.fields import *
from whoosh.qparser import QueryParser, MultifieldParser
from whoosh.query import *
@route('/')
... | Add advanced search by select type or status | Add advanced search by select type or status
| Python | bsd-2-clause | klokantech/epsg.io,dudaerich/epsg.io,dudaerich/epsg.io,klokantech/epsg.io,klokantech/epsg.io,dudaerich/epsg.io,dudaerich/epsg.io,klokantech/epsg.io | ---
+++
@@ -26,6 +26,15 @@
with ix.searcher(closereader=False) as searcher:
parser = MultifieldParser(["code","name","area","type"], ix.schema)
query = request.POST.get('fulltext').strip()
+ select = request.POST.get('type').strip()
+ status = request.POST.get('invalid')
+ print status, "status"... |
a01a3f9c07e0e5d93fc664df118c6085668410c1 | test/test_url_subcommand.py | test/test_url_subcommand.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import print_function
import responses
import simplesqlite
from click.testing import CliRunner
from sqlitebiter._enum import ExitCode
from sqlitebiter.sqlitebiter import cmd
from .common import print_traceback
... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import print_function
import responses
import simplesqlite
from click.testing import CliRunner
from sqlitebiter._enum import ExitCode
from sqlitebiter.sqlitebiter import cmd
from .common import print_traceback
... | Fix a test class name | Fix a test class name
| Python | mit | thombashi/sqlitebiter,thombashi/sqlitebiter | ---
+++
@@ -16,7 +16,7 @@
from .dataset import complex_json
-class Test_TableUrlLoader(object):
+class Test_url_subcommand(object):
@responses.activate
def test_normal(self): |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.