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 |
|---|---|---|---|---|---|---|---|---|---|---|
9904e3843b2efca908845d57033b13f35c2e2a4d | st2auth_pam_backend/__init__.py | st2auth_pam_backend/__init__.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | Fix code so import works under Python 3. | Fix code so import works under Python 3.
| Python | apache-2.0 | StackStorm/st2-auth-backend-pam,StackStorm/st2-auth-backend-pam | ---
+++
@@ -13,7 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from pam_backend import PAMAuthenticationBackend
+from __future__ import absolute_import
+
+from .pam_backend import PAMAuthenticationBackend
__all__ = [
'PAMAuthenticationBack... |
4b7466e3798dea0b3edf94c1e5cc376ba7615d2f | events/models.py | events/models.py | from django.db import models
from django.conf import settings
# Create your models here.
#Events :
# Des users peuvent participer à un event
# Les gens peuvnet être "intéressés"
# Utiliser https://github.com/thoas/django-sequere ?
# API hackeragenda
class Event(models.Model):
STATUS_CHOICES = (
... | from django.db import models
from django.conf import settings
# Create your models here.
#Events :
# Des users peuvent participer à un event
# Les gens peuvnet être "intéressés"
# Utiliser https://github.com/thoas/django-sequere ?
# API hackeragenda
class Event(models.Model):
STATUS_CHOICES = (
... | Add a description to an event | [add] Add a description to an event
| Python | agpl-3.0 | UrLab/incubator,UrLab/incubator,UrLab/incubator,UrLab/incubator | ---
+++
@@ -21,3 +21,5 @@
title = models.CharField(max_length=300)
status = models.CharField(max_length=1, choices=STATUS_CHOICES)
organizer = models.ForeignKey(settings.AUTH_USER_MODEL)
+ description = models.TextField()
+ |
ca4d5ac415c16594afff5e8c39c732f58e1e3de2 | recommender/__init__.py | recommender/__init__.py | from .similarity_measure import (
cosine,
euclidean_distance,
pearson_correlation
)
from .similar_item import (
find_similar_item,
preferance_space_transform,
user_match
)
__all__=[
'dataHandle',
'recommenderEngine',
'similarItem',
'similarityMeasure'
]
__version__ = '1.0.0'
| from .similarity_measure import (
cosine,
euclidean_distance,
pearson_correlation
)
from .similar_item import (
find_similar_item,
preference_space_transform,
user_match
)
__all__=[
'dataHandle',
'recommenderEngine',
'similarItem',
'similarityMeasure'
]
__version__ = '1.0.0'
| Update function name to correct spelling | Update function name to correct spelling
Signed-off-by: Tran Ly Vu <0555cc0f3d5a46ac8c0e84ddf31443494c66bd55@gmail.com>
| Python | apache-2.0 | tranlyvu/recommender | ---
+++
@@ -6,7 +6,7 @@
from .similar_item import (
find_similar_item,
- preferance_space_transform,
+ preference_space_transform,
user_match
)
|
b5acf414e9fcbecee8da15e2757a60ce10cc5c10 | examples/last.py | examples/last.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import misp_url, misp_key
import argparse
import os
import json
# Usage for pipe masters: ./last.py -l 5h | jq .
def init(url, key):
return PyMISP(url, key, True, 'json')
def download_last(m, last, out=None):
result = m.dow... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import misp_url, misp_key
import argparse
import os
import json
# Usage for pipe masters: ./last.py -l 5h | jq .
def init(url, key):
return PyMISP(url, key, True, 'json')
def download_last(m, last, out=None):
result = m.dow... | Fix KeyError when no results in time period | Fix KeyError when no results in time period
Fix a KeyError when no results were found for the specified time period.
| Python | bsd-2-clause | pombredanne/PyMISP,iglocska/PyMISP | ---
+++
@@ -18,8 +18,12 @@
def download_last(m, last, out=None):
result = m.download_last(last)
if out is None:
- for e in result['response']:
- print(json.dumps(e) + '\n')
+ if 'response' in result:
+ for e in result['response']:
+ print(json.dumps(e) + '... |
af21288fb4245fc56a0b182331cd4db724e05e62 | app/accounts/admin.py | app/accounts/admin.py | from django.contrib import admin
from .models import UserProfile
admin.site.register(UserProfile)
| from django.contrib import admin
from .models import UserProfile
@admin.register(UserProfile)
class UserProfileAdmin(admin.ModelAdmin):
fieldsets = [
('User Profile', {
'fields': ('user', 'custom_auth_id', 'facebook_oauth_id',
'google_oauth_id', 'twitter_oauth_id',),
... | Add description for Userprofile model | Add description for Userprofile model
| Python | mit | teamtaverna/core | ---
+++
@@ -3,4 +3,12 @@
from .models import UserProfile
-admin.site.register(UserProfile)
+@admin.register(UserProfile)
+class UserProfileAdmin(admin.ModelAdmin):
+ fieldsets = [
+ ('User Profile', {
+ 'fields': ('user', 'custom_auth_id', 'facebook_oauth_id',
+ 'google... |
4d2ef07c64603e99f05f2233382dc2a7c5bff5ba | website/members/tests.py | website/members/tests.py | from django.contrib.auth.models import User
from django.test import TestCase
from datetime import datetime
from members.models import Member
class MemberTest(TestCase):
def setUp(self):
self.user = User.objects.create(username='test')
self.member = Member.objects.create(user=self.user)
se... | from django.contrib.auth.models import User
from django.test import TestCase
from datetime import datetime
from members.models import Member, StudyProgram
class MemberTest(TestCase):
def setUp(self):
self.user = User.objects.create(username='test')
self.member = Member.objects.create(user=self.us... | Add test for StudyProgram deletion | :green_heart: Add test for StudyProgram deletion
| Python | agpl-3.0 | Dekker1/moore,UTNkar/moore,Dekker1/moore,UTNkar/moore,Dekker1/moore,UTNkar/moore,Dekker1/moore,UTNkar/moore | ---
+++
@@ -2,7 +2,7 @@
from django.test import TestCase
from datetime import datetime
-from members.models import Member
+from members.models import Member, StudyProgram
class MemberTest(TestCase):
@@ -31,3 +31,14 @@
'19990709-1234', self.member.person_number(),
'Person numbers are... |
57b45988072cdc57d90ea11d673b283a5473cd14 | routes.py | routes.py | from flask import Flask, render_template, request
from models import db
from forms import SignupForm
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://localhost/strabo'
db.init_app(app)
app.secret_key = ""
@app.route("/")
def index():
return render_template("index.html")
@app.route("/ab... | from flask import Flask, render_template, request
from models import db, User
from forms import SignupForm
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://localhost/strabo'
db.init_app(app)
app.secret_key = ""
@app.route("/")
def index():
return render_template("index.html")
@app.rout... | Add new user form data to db | Add new user form data to db
| Python | apache-2.0 | cristobal23/strabo,cristobal23/strabo | ---
+++
@@ -1,5 +1,5 @@
from flask import Flask, render_template, request
-from models import db
+from models import db, User
from forms import SignupForm
app = Flask(__name__)
@@ -25,7 +25,10 @@
if form.validate() == False:
return render_template('signup.html', form=form)
else:
- return "S... |
019c13489eceb315f7a0edb72296f32c35339d93 | joulupukki/api/controllers/v3/v3.py | joulupukki/api/controllers/v3/v3.py | import importlib
import pecan
from joulupukki.api.controllers.v3.users import UsersController
from joulupukki.api.controllers.v3.projects import ProjectsController
from joulupukki.api.controllers.v3.stats import StatsController
from joulupukki.api.controllers.v3.auth import AuthController
authcontroller = importlib.... | import importlib
import pecan
from joulupukki.api.controllers.v3.users import UsersController
from joulupukki.api.controllers.v3.projects import ProjectsController
from joulupukki.api.controllers.v3.stats import StatsController
from joulupukki.api.controllers.v3.auth import AuthController
class V3Controller(object):... | Fix api starting with auth set | Fix api starting with auth set
| Python | agpl-3.0 | jlpk/joulupukki-api | ---
+++
@@ -6,8 +6,6 @@
from joulupukki.api.controllers.v3.projects import ProjectsController
from joulupukki.api.controllers.v3.stats import StatsController
from joulupukki.api.controllers.v3.auth import AuthController
-
-authcontroller = importlib.import_module('joulupukki.api.controllers.v3.' + pecan.conf.auth)... |
4257381997e8ac6968713f1bad96019f977bafc9 | server.py | server.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import tweepy, time, sys, os
from ConfigParser import SafeConfigParser
parser = SafeConfigParser()
parser.read('secrets.cfg')
#enter the corresponding information from your Twitter application:
CONSUMER_KEY = parser.get('bug_tracker', 'CONSUMER_KEY')
CONSUMER_SECRET = pa... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import tweepy, time, sys, os
from ConfigParser import SafeConfigParser
parser = SafeConfigParser()
parser.read('secrets.cfg')
#enter the corresponding information from your Twitter application:
CONSUMER_KEY = parser.get('Twitter', 'CONSUMER_KEY')
CONSUMER_SECRET = parser... | Fix config parsing. Tweeting works | Fix config parsing. Tweeting works
| Python | mit | premgane/agolo-twitterbot,premgane/agolo-twitterbot | ---
+++
@@ -8,10 +8,10 @@
parser.read('secrets.cfg')
#enter the corresponding information from your Twitter application:
-CONSUMER_KEY = parser.get('bug_tracker', 'CONSUMER_KEY')
-CONSUMER_SECRET = parser.get('bug_tracker', 'CONSUMER_SECRET')
-ACCESS_KEY = parser.get('bug_tracker', 'ACCESS_KEY')
-ACCESS_SECRET = ... |
9f512fd6f3c7d2928c66062002b18b7bb13a5653 | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jon LaBelle
# Copyright (c) 2018 Jon LaBelle
#
# License: MIT
#
"""This module exports the Markdownlint plugin class."""
from SublimeLinter.lint import NodeLinter, util
class Markdownlint(NodeLinter):
"""Provi... | #
# linter.py
# Markdown Linter for SublimeLinter, a code checking framework
# for Sublime Text 3
#
# Written by Jon LaBelle
# Copyright (c) 2018 Jon LaBelle
#
# License: MIT
#
"""This module exports the Markdownlint plugin class."""
from SublimeLinter.lint import NodeLinter, util
class Markdownlint(NodeLinter):
... | Remove the "3" from SublimeLinter3 | Remove the "3" from SublimeLinter3
| Python | mit | jonlabelle/SublimeLinter-contrib-markdownlint,jonlabelle/SublimeLinter-contrib-markdownlint | ---
+++
@@ -1,6 +1,7 @@
#
# linter.py
-# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
+# Markdown Linter for SublimeLinter, a code checking framework
+# for Sublime Text 3
#
# Written by Jon LaBelle
# Copyright (c) 2018 Jon LaBelle |
5decd7e68c6454e455bc1debe232ea37f7260c58 | mixins.py | mixins.py | class DepthSerializerMixin(object):
"""Custom method 'get_serializer_class', set attribute 'depth' based on query parameter in the url"""
def get_serializer_class(self):
serializer_class = self.serializer_class
query_params = self.request.QUERY_PARAMS
depth = query_params.get('__depth', None)
serializer_cla... | class DepthSerializerMixin(object):
"""Custom method 'get_serializer_class', set attribute 'depth' based on query parameter in the url"""
def get_serializer_class(self, *args, **kwargs):
serializer_class = super(DepthSerializerMixin, self).get_serializer_class(*args, **kwargs)
query_params = self.request.QUERY_... | Call method 'get_serializer_class' of the Class parent | Call method 'get_serializer_class' of the Class parent
| Python | mit | krescruz/depth-serializer-mixin | ---
+++
@@ -1,8 +1,8 @@
class DepthSerializerMixin(object):
"""Custom method 'get_serializer_class', set attribute 'depth' based on query parameter in the url"""
- def get_serializer_class(self):
- serializer_class = self.serializer_class
+ def get_serializer_class(self, *args, **kwargs):
+ serializer_class =... |
bed9e520a371a99132e05511f110a141d22d2a7f | tests/integration/test_proxy.py | tests/integration/test_proxy.py | # -*- coding: utf-8 -*-
'''Test using a proxy.'''
# External imports
import multiprocessing
import SocketServer
import SimpleHTTPServer
import pytest
requests = pytest.importorskip("requests")
from six.moves.urllib.request import urlopen
# Internal imports
import vcr
class Proxy(SimpleHTTPServer.SimpleHTTPRequestH... | # -*- coding: utf-8 -*-
'''Test using a proxy.'''
# External imports
import multiprocessing
import pytest
requests = pytest.importorskip("requests")
from six.moves import socketserver, SimpleHTTPServer
from six.moves.urllib.request import urlopen
# Internal imports
import vcr
class Proxy(SimpleHTTPServer.SimpleHTT... | Fix `socketserver` for Python 3 | Fix `socketserver` for Python 3
| Python | mit | graingert/vcrpy,kevin1024/vcrpy,graingert/vcrpy,kevin1024/vcrpy | ---
+++
@@ -3,11 +3,10 @@
# External imports
import multiprocessing
-import SocketServer
-import SimpleHTTPServer
import pytest
requests = pytest.importorskip("requests")
+from six.moves import socketserver, SimpleHTTPServer
from six.moves.urllib.request import urlopen
# Internal imports
@@ -26,7 +25,7 @@... |
ff618ea57b8f3d71772bcef5f7fecf9eceae4e3d | scripts/upsrv_schema.py | scripts/upsrv_schema.py | #!/usr/bin/python
# Copyright (c) 2006 rPath, Inc
# All rights reserved
import sys
import os
import pwd
from conary.server import schema
from conary.lib import cfgtypes
from conary.repository.netrepos.netserver import ServerConfig
from conary import dbstore
cnrPath = '/srv/conary/repository.cnr'
cfg = ServerConfig(... | #!/usr/bin/python
# Copyright (c) 2006 rPath, Inc
# All rights reserved
import sys
import os
import pwd
from conary.server import schema
from conary.lib import cfgtypes, tracelog
from conary.repository.netrepos.netserver import ServerConfig
from conary import dbstore
cnrPath = '/srv/conary/repository.cnr'
cfg = Ser... | Set log level to 2 when migrating so there is some indication it is running | Set log level to 2 when migrating so there is some indication it is running
| Python | apache-2.0 | sassoftware/rbm,sassoftware/rbm,sassoftware/rbm | ---
+++
@@ -7,13 +7,15 @@
import os
import pwd
from conary.server import schema
-from conary.lib import cfgtypes
+from conary.lib import cfgtypes, tracelog
from conary.repository.netrepos.netserver import ServerConfig
from conary import dbstore
cnrPath = '/srv/conary/repository.cnr'
cfg = ServerConfig()
+
... |
85e77bc7a4706ed1b25d4d53e71ca22beafed411 | sidertests/test_sider.py | sidertests/test_sider.py | import doctest
import os
def test_doctest_types():
from sider import types
assert 0 == doctest.testmod(types)[0]
def test_doctest_datetime():
from sider import datetime
assert 0 == doctest.testmod(datetime)[0]
exttest_count = 0
def test_ext():
from sider.ext import _exttest
assert _extte... | import os
exttest_count = 0
def test_ext():
from sider.ext import _exttest
assert _exttest.ext_loaded == 'yes'
assert exttest_count == 1
from sider import ext
assert ext._exttest is _exttest
try:
import sider.ext._noexttest
except ImportError as e:
assert str(e) == "No mo... | Drop useless tests that invoking doctests | Drop useless tests that invoking doctests
| Python | mit | longfin/sider,dahlia/sider,longfin/sider | ---
+++
@@ -1,15 +1,4 @@
-import doctest
import os
-
-
-def test_doctest_types():
- from sider import types
- assert 0 == doctest.testmod(types)[0]
-
-
-def test_doctest_datetime():
- from sider import datetime
- assert 0 == doctest.testmod(datetime)[0]
exttest_count = 0 |
7b13749feea6c798fb6221ae78ba89033fbd2c45 | tests/test_actions/test_init.py | tests/test_actions/test_init.py | from tests.test_actions import *
from ltk import actions, exceptions
import unittest
class TestInitAction(unittest.TestCase):
def test_uninitialized(self):
# todo create dir outside so folder not initialized
self.assertRaises(exceptions.UninitializedError, actions.Action, os.getcwd())
def tes... | from tests.test_actions import *
from ltk import actions, exceptions
import unittest
class TestInitAction(unittest.TestCase):
def test_uninitialized(self):
# todo create dir outside so folder not initialized
os.chdir('/')
self.assertRaises(exceptions.UninitializedError, actions.Action, os.... | Change directory to test uninitialized project | Change directory to test uninitialized project
| Python | mit | Lingotek/translation-utility,Lingotek/translation-utility,Lingotek/client,Lingotek/filesystem-connector,Lingotek/client,Lingotek/filesystem-connector | ---
+++
@@ -6,6 +6,7 @@
def test_uninitialized(self):
# todo create dir outside so folder not initialized
+ os.chdir('/')
self.assertRaises(exceptions.UninitializedError, actions.Action, os.getcwd())
def test_init_host(self):
@@ -50,5 +51,5 @@
assert action.doc_manager
... |
1010cb2c4a4930254e2586949314aa0bb6b89b3d | tests/test_solver_constraint.py | tests/test_solver_constraint.py | import pytest
from gaphas.solver import Constraint, MultiConstraint, Variable
@pytest.fixture
def handler():
events = []
def handler(e):
events.append(e)
handler.events = events # type: ignore[attr-defined]
return handler
def test_constraint_propagates_variable_changed(handler):
v = ... | import pytest
from gaphas.solver import Constraint, MultiConstraint, Variable
@pytest.fixture
def handler():
events = []
def handler(e):
events.append(e)
handler.events = events # type: ignore[attr-defined]
return handler
def test_constraint_propagates_variable_changed(handler):
v = ... | Test default case for constraint.solve() | Test default case for constraint.solve()
| Python | lgpl-2.1 | amolenaar/gaphas | ---
+++
@@ -33,3 +33,11 @@
v.value = 3
assert handler.events == [c]
+
+
+def test_default_constraint_can_not_solve():
+ v = Variable()
+ c = Constraint(v)
+
+ with pytest.raises(NotImplementedError):
+ c.solve() |
2e040a77b70b4a07227f5aa3cb3aee6b8c84f4e0 | src/livedumper/common.py | src/livedumper/common.py | "Common functions that may be used everywhere"
from __future__ import print_function
import os
import sys
from distutils.util import strtobool
def yes_no_query(question):
"""Ask the user *question* for 'yes' or 'no'; ask again until user
inputs a valid option.
Returns:
'True' if user answered 'y', ... | "Common functions that may be used everywhere"
from __future__ import print_function
import os
import sys
from distutils.util import strtobool
try:
input = raw_input
except NameError:
pass
def yes_no_query(question):
"""Ask the user *question* for 'yes' or 'no'; ask again until user
inputs a valid ... | Fix Python 2 compatibility, again | Fix Python 2 compatibility, again
| Python | bsd-2-clause | m45t3r/livedumper | ---
+++
@@ -5,6 +5,11 @@
import os
import sys
from distutils.util import strtobool
+
+try:
+ input = raw_input
+except NameError:
+ pass
def yes_no_query(question): |
a76101c9ad416323b9379d48adb61c804a5454c0 | localized_fields/admin.py | localized_fields/admin.py | from . import widgets
from .fields import LocalizedField, LocalizedCharField, LocalizedTextField, \
LocalizedFileField
FORMFIELD_FOR_LOCALIZED_FIELDS_DEFAULTS = {
LocalizedField: {'widget': widgets.AdminLocalizedFieldWidget},
LocalizedCharField: {'widget': widgets.AdminLocalizedCharFieldWidget},
Local... | from django.contrib.admin import ModelAdmin
from . import widgets
from .fields import LocalizedField, LocalizedCharField, LocalizedTextField, \
LocalizedFileField
FORMFIELD_FOR_LOCALIZED_FIELDS_DEFAULTS = {
LocalizedField: {'widget': widgets.AdminLocalizedFieldWidget},
LocalizedCharField: {'widget': widg... | Fix LocalizedFieldsAdminMixin not having a base class | Fix LocalizedFieldsAdminMixin not having a base class
This was a breaking change and broke a lot of projects.
| Python | mit | SectorLabs/django-localized-fields,SectorLabs/django-localized-fields,SectorLabs/django-localized-fields | ---
+++
@@ -1,3 +1,5 @@
+from django.contrib.admin import ModelAdmin
+
from . import widgets
from .fields import LocalizedField, LocalizedCharField, LocalizedTextField, \
LocalizedFileField
@@ -11,7 +13,7 @@
}
-class LocalizedFieldsAdminMixin:
+class LocalizedFieldsAdminMixin(ModelAdmin):
"""Mixin fo... |
8ccffcf02cd5ba8352bc8182d7be13ea015332ca | plinth/utils.py | plinth/utils.py | #
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | #
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | Add utility method to lazy format lazy string | Add utility method to lazy format lazy string
This method is useful to format strings that are lazy (such as those in
Forms).
| Python | agpl-3.0 | freedomboxtwh/Plinth,harry-7/Plinth,kkampardi/Plinth,vignanl/Plinth,vignanl/Plinth,freedomboxtwh/Plinth,kkampardi/Plinth,harry-7/Plinth,harry-7/Plinth,freedomboxtwh/Plinth,vignanl/Plinth,freedomboxtwh/Plinth,kkampardi/Plinth,kkampardi/Plinth,freedomboxtwh/Plinth,vignanl/Plinth,harry-7/Plinth,harry-7/Plinth,kkampardi/Pl... | ---
+++
@@ -20,6 +20,7 @@
"""
import importlib
+from django.utils.functional import lazy
def import_from_gi(library, version):
@@ -34,3 +35,12 @@
package.require_version(library, version)
return importlib.import_module(package_name + '.repository.' + library)
+
+
+def _format_lazy(string, *args, ... |
3313d611d7cc66bf607a341a5d9a6a5d96dfbec5 | clowder_server/emailer.py | clowder_server/emailer.py | import os
import requests
from django.core.mail import send_mail
from clowder_account.models import ClowderUser
ADMIN_EMAIL = 'admin@clowder.io'
def send_alert(company, name):
for user in ClowderUser.objects.filter(company=company, allow_email_notifications=True):
subject = 'FAILURE: %s' % (name)
... | import os
import requests
from django.core.mail import send_mail
from clowder_account.models import ClowderUser
ADMIN_EMAIL = 'admin@clowder.io'
def send_alert(company, name):
slack_sent = False
for user in ClowderUser.objects.filter(company=company, allow_email_notifications=True):
subject = 'FAILUR... | Rename bot and prevent channel spamming | Rename bot and prevent channel spamming
| Python | agpl-3.0 | keithhackbarth/clowder_server,keithhackbarth/clowder_server,keithhackbarth/clowder_server,keithhackbarth/clowder_server | ---
+++
@@ -7,12 +7,14 @@
ADMIN_EMAIL = 'admin@clowder.io'
def send_alert(company, name):
+ slack_sent = False
for user in ClowderUser.objects.filter(company=company, allow_email_notifications=True):
subject = 'FAILURE: %s' % (name)
body = subject
- if user.company_id == 86:
+ ... |
a8823bdc00c83c72352985706f6503557540ae9d | src/ocspdash/web/wsgi.py | src/ocspdash/web/wsgi.py | # -*- coding: utf-8 -*-
"""This file should be used to run the flask app with something like Gunicorn.
For example: gunicorn -b 0.0.0.0:8000 ocspdash.web.run:app
This file should NOT be imported anywhere, though, since it would instantiate the app.
"""
from ocspdash.web import create_application
app = create_appli... | # -*- coding: utf-8 -*-
"""This file should be used to run the flask app with something like Gunicorn.
For example: gunicorn -b 0.0.0.0:8000 ocspdash.web.wsgi:app
This file should NOT be imported anywhere, though, since it would instantiate the app.
"""
from ocspdash.web import create_application
app = create_appl... | Update Charlie's stupid wrong documentation. | Update Charlie's stupid wrong documentation.
I can't promise it's right now, though, cuz I didn't test it either.
🎉🎉🎉
| Python | mit | scolby33/OCSPdash,scolby33/OCSPdash,scolby33/OCSPdash | ---
+++
@@ -2,7 +2,7 @@
"""This file should be used to run the flask app with something like Gunicorn.
-For example: gunicorn -b 0.0.0.0:8000 ocspdash.web.run:app
+For example: gunicorn -b 0.0.0.0:8000 ocspdash.web.wsgi:app
This file should NOT be imported anywhere, though, since it would instantiate the app.... |
aafcc59ef14fe5af39a06e87bc44546a9da56fb6 | lazy_helpers.py | lazy_helpers.py | # Lazy objects, for the serializer to find them we put them here
class LazyDriver(object):
_driver = None
@classmethod
def get(cls):
if cls._driver is None:
from selenium import webdriver
# Configure headless mode
options = webdriver.ChromeOptions() #Oops
... | # Lazy objects, for the serializer to find them we put them here
class LazyDriver(object):
_driver = None
@classmethod
def get(cls):
import os
if cls._driver is None:
from selenium import webdriver
# Configure headless mode
options = webdriver.ChromeOpti... | Add some more arguments for chrome driver | Add some more arguments for chrome driver
| Python | apache-2.0 | holdenk/diversity-analytics,holdenk/diversity-analytics | ---
+++
@@ -5,11 +5,14 @@
@classmethod
def get(cls):
+ import os
if cls._driver is None:
from selenium import webdriver
# Configure headless mode
options = webdriver.ChromeOptions() #Oops
options.add_argument('headless')
+ chro... |
92438a5450bc644f066a941efe16ec07cf3c129a | httoop/codecs/codec.py | httoop/codecs/codec.py | # -*- coding: utf-8 -*-
from httoop.util import Unicode
class Codec(object):
@classmethod
def decode(cls, data, charset=None, mimetype=None): # pragma: no cover
if isinstance(data, bytes):
data = data.decode(charset) if charset is not None else data.decode()
@classmethod
def encode(cls, data, charset=None... | # -*- coding: utf-8 -*-
from httoop.util import Unicode
class Codec(object):
@classmethod
def decode(cls, data, charset=None, mimetype=None): # pragma: no cover
if isinstance(data, bytes):
data = data.decode(charset or 'ascii')
return data
@classmethod
def encode(cls, data, charset=None, mimetype=None):... | Make encoding and decoding strict | Make encoding and decoding strict
* programmers must know what kind of data they use
* don't guess encodings anymore
| Python | mit | spaceone/httoop,spaceone/httoop,spaceone/httoop | ---
+++
@@ -7,12 +7,13 @@
@classmethod
def decode(cls, data, charset=None, mimetype=None): # pragma: no cover
if isinstance(data, bytes):
- data = data.decode(charset) if charset is not None else data.decode()
+ data = data.decode(charset or 'ascii')
+ return data
@classmethod
def encode(cls, data,... |
c7723ff6d7f43330786e84802ef0bacf70d4ba67 | instatrace/commands.py | instatrace/commands.py | # Copyright (C) 2010 Peter Teichman
import logging
import os
import sys
import time
from .stats import Histogram, Statistics
log = logging.getLogger("instatrace")
class HistogramsCommand:
@classmethod
def add_subparser(cls, parser):
subparser = parser.add_parser("histograms", help="Stat histograms")... | # Copyright (C) 2010 Peter Teichman
import logging
import os
import sys
import time
from .stats import Histogram, Statistics
log = logging.getLogger("instatrace")
class HistogramsCommand:
@classmethod
def add_subparser(cls, parser):
subparser = parser.add_parser("histograms", help="Stat histograms")... | Add a --filter flag to histograms | Add a --filter flag to histograms
This ignores any lines in the input that don't contain "INSTATRACE: "
and removes anything preceding that string before handling the sample.
| Python | mit | pteichman/instatrace | ---
+++
@@ -13,8 +13,11 @@
@classmethod
def add_subparser(cls, parser):
subparser = parser.add_parser("histograms", help="Stat histograms")
+ subparser.add_argument("--filter", action="store_true",
+ help="Filter out any lines that don't contain INSTATRACE")
... |
504c7ad1a436af356ca73e2fe8934018e3a7547d | manage.py | manage.py | from vulyk.control import cli
if __name__ == '__main__':
cli()
| #!/usr/bin/env python
# -*- coding=utf-8 -*-
from vulyk.control import cli
if __name__ == '__main__':
cli()
| Make it more executable than it was | Make it more executable than it was
| Python | bsd-3-clause | mrgambal/vulyk,mrgambal/vulyk,mrgambal/vulyk | ---
+++
@@ -1,3 +1,6 @@
+#!/usr/bin/env python
+# -*- coding=utf-8 -*-
+
from vulyk.control import cli
if __name__ == '__main__': |
d5a59b79a3b3d6c2209eb9dc486a40d635aa6778 | solum/builder/config.py | solum/builder/config.py | # Copyright 2014 - Rackspace Hosting
#
# 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 ... | # Copyright 2014 - Rackspace Hosting
#
# 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 ... | Add missing Auth hook to image builder | Add missing Auth hook to image builder
Change-Id: I73f17c17a1f4d530c0351dacc2b10fbdcf3122e0
| Python | apache-2.0 | gilbertpilz/solum,stackforge/solum,gilbertpilz/solum,ed-/solum,openstack/solum,gilbertpilz/solum,openstack/solum,ed-/solum,stackforge/solum,devdattakulkarni/test-solum,gilbertpilz/solum,devdattakulkarni/test-solum,ed-/solum,ed-/solum | ---
+++
@@ -12,11 +12,14 @@
# License for the specific language governing permissions and limitations
# under the License.
+from solum.api import auth
+
# Pecan Application Configurations
app = {
'root': 'solum.builder.controllers.root.RootController',
'modules': ['solum.builder'],
'debug': True,... |
51d371918d0ffb5cc96c6faa67fb0a5cd3cf58ae | manage.py | manage.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Management command entry point for working with migrations
"""
import sys
import django
from django.conf import settings
INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"addendum",
]
try:
import so... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Management command entry point for working with migrations
"""
import sys
import django
from django.conf import settings
INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.admin",
"django.contrib.contenttypes",
"django.contrib.sites",
"adde... | Add contrib.admin to locally installed apps | Add contrib.admin to locally installed apps
| Python | bsd-2-clause | bennylope/django-addendum,bennylope/django-addendum | ---
+++
@@ -11,6 +11,7 @@
INSTALLED_APPS = [
"django.contrib.auth",
+ "django.contrib.admin",
"django.contrib.contenttypes",
"django.contrib.sites",
"addendum", |
b66b63d2a9a6919f3e735d46881740d27bcdc8a6 | piper/process.py | piper/process.py | import subprocess as sub
import logbook
class Process(object):
"""
Helper class for running processes
"""
def __init__(self, cmd):
self.cmd = cmd
self.proc = None
self.success = None
self.log = logbook.Logger(self.__class__.__name__)
def setup(self):
""... | import subprocess as sub
import logbook
class Process(object):
"""
Helper class for running processes
"""
def __init__(self, cmd):
self.cmd = cmd
self.popen = None
self.success = None
self.log = logbook.Logger(self.cmd)
def setup(self):
"""
Setu... | Change logging setup for Process() | Change logging setup for Process()
Also fix usage of badly named .proc variable.
| Python | mit | thiderman/piper | ---
+++
@@ -12,9 +12,9 @@
def __init__(self, cmd):
self.cmd = cmd
- self.proc = None
+ self.popen = None
self.success = None
- self.log = logbook.Logger(self.__class__.__name__)
+ self.log = logbook.Logger(self.cmd)
def setup(self):
"""
@@ -22,7 +22... |
54a6e1463104b87a51d17f937c286721cf84466a | democracy_club/apps/donations/middleware.py | democracy_club/apps/donations/middleware.py | from django.http import HttpResponseRedirect
from .forms import DonationForm
from .helpers import GoCardlessHelper
class DonationFormMiddleware(object):
def get_initial(self):
return {
'payment_type': 'subscription',
'amount': 10,
}
def form_valid(self, request, form)... | from django.http import HttpResponseRedirect
from .forms import DonationForm
from .helpers import GoCardlessHelper, PAYMENT_UNITS
class DonationFormMiddleware(object):
def get_initial(self, request):
suggested_donation = request.GET.get('suggested_donation', 3)
form_initial = {
'payme... | Allow altering the donation amount via a link and default to £3 | Allow altering the donation amount via a link and default to £3
| Python | bsd-3-clause | DemocracyClub/Website,DemocracyClub/Website,DemocracyClub/Website,DemocracyClub/Website | ---
+++
@@ -1,15 +1,21 @@
from django.http import HttpResponseRedirect
from .forms import DonationForm
-from .helpers import GoCardlessHelper
+from .helpers import GoCardlessHelper, PAYMENT_UNITS
class DonationFormMiddleware(object):
- def get_initial(self):
- return {
+ def get_initial(self, re... |
7fe8df63288d72fba98fee2cf73a16c0a0b8e326 | tests/functional/conftest.py | tests/functional/conftest.py | import httpretty
import pytest
import webtest
from via.app import create_app
@pytest.fixture
def test_app(pyramid_settings):
return webtest.TestApp(create_app(None, **pyramid_settings))
@pytest.fixture
def checkmate_pass(pyramid_settings):
httpretty.register_uri(
httpretty.GET, "http://localhost:90... | import httpretty
import pytest
import webtest
from via.app import create_app
@pytest.fixture
def test_app(pyramid_settings):
return webtest.TestApp(create_app(None, **pyramid_settings))
@pytest.fixture
def checkmate_pass(pyramid_settings):
httpretty.register_uri(
httpretty.GET, "http://localhost:90... | Work around a `httpretty` bug when returning None as the body | Work around a `httpretty` bug when returning None as the body
I'm not sure if this is a bug or not. The docs state this must be
a string. So this is as empty as we can get.
| Python | bsd-2-clause | hypothesis/via,hypothesis/via,hypothesis/via | ---
+++
@@ -13,5 +13,5 @@
@pytest.fixture
def checkmate_pass(pyramid_settings):
httpretty.register_uri(
- httpretty.GET, "http://localhost:9099/api/check", status=204, body=None
+ httpretty.GET, "http://localhost:9099/api/check", status=204, body=""
) |
c0c1f964892289dd240de4d6121ebdda6c1753c1 | penchy/jvms.py | penchy/jvms.py | class JVM(object):
"""
Base class for JVMs.
Inheriting classes must implement:
- ``get_commandline(*args, **options)`` to return a commandline that
contains the options and runs the JVM
"""
def get_commandline(self, *args, **options):
"""
Return a commandline that ca... | class JVM(object):
"""
This class represents a JVM.
"""
def __init__(self, path, options=""):
"""
:param path: path to jvm executable relative to basepath
:param options: string of options that will be passed to jvm
"""
self.basepath = '/'
self.path = pa... | Move to new jvm specification. | Move to new jvm specification.
Signed-off-by: Michael Markert <5eb998b7ac86da375651a4cd767b88c9dad25896@googlemail.com>
| Python | mit | fhirschmann/penchy,fhirschmann/penchy | ---
+++
@@ -1,38 +1,69 @@
class JVM(object):
"""
- Base class for JVMs.
+ This class represents a JVM.
+ """
- Inheriting classes must implement:
- - ``get_commandline(*args, **options)`` to return a commandline that
- contains the options and runs the JVM
+ def __init__(self, pat... |
3ca9ae145e70a3339028d9de55544da739a86899 | cura/CameraAnimation.py | cura/CameraAnimation.py | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from PyQt5.QtCore import QVariantAnimation, QEasingCurve
from PyQt5.QtGui import QVector3D
from UM.Math.Vector import Vector
from UM.Logger import Logger
class CameraAnimation(QVariantAnimation):
def __init__(self, ... | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from PyQt5.QtCore import QVariantAnimation, QEasingCurve
from PyQt5.QtGui import QVector3D
from UM.Math.Vector import Vector
from UM.Logger import Logger
class CameraAnimation(QVariantAnimation):
def __init__(self, ... | Undo logging and splitting up QVector3D. CURA-3334 | Undo logging and splitting up QVector3D. CURA-3334
| Python | agpl-3.0 | hmflash/Cura,fieldOfView/Cura,Curahelper/Cura,ynotstartups/Wanhao,hmflash/Cura,Curahelper/Cura,fieldOfView/Cura,ynotstartups/Wanhao | ---
+++
@@ -20,16 +20,9 @@
self._camera_tool = camera_tool
def setStart(self, start):
- Logger.log("d", "Camera start: %s %s %s" % (start.x, start.y, start.z))
- vec = QVector3D() #QVector3D(start.x, start.y, start.z)
- vec.setX(start.x)
- vec.setY(start.y)
- vec.se... |
b870f61d131483dd42b3302057351f2461b2cfc6 | tests/test_enrichment_fdr.py | tests/test_enrichment_fdr.py |
import os
def test():
"""Test to find this error below.
Traceback (most recent call last):
File "../scripts/find_enrichment.py", line 130, in <module>
study=study, methods=methods)
File "../scripts/../goatools/go_enrichment.py", line 93, in __init__
self.run_study(stu... |
import os
def test():
"""Ensure that a study with only unknown GO Terms will run gracefully."""
os.system("python {SCR} --alpha=0.05 {STUDY} {POP} {ASSN} --fdr --obo={OBO}".format(
SCR="../scripts/find_enrichment.py",
OBO="../go-basic.obo",
STUDY="data/study_unknown",
POP="../data/population",
... | Make Test description more elegant. | Make Test description more elegant.
| Python | bsd-2-clause | fidelram/goatools,mfiers/goatools,lileiting/goatools,tanghaibao/goatools,mfiers/goatools,tanghaibao/goatools,fidelram/goatools,lileiting/goatools | ---
+++
@@ -2,17 +2,7 @@
import os
def test():
- """Test to find this error below.
-
- Traceback (most recent call last):
- File "../scripts/find_enrichment.py", line 130, in <module>
- study=study, methods=methods)
- File "../scripts/../goatools/go_enrichment.py", line 93, in __i... |
fda563e9661c0a65256ba6b1a7416a0f4171f18e | sentence_transformers/readers/InputExample.py | sentence_transformers/readers/InputExample.py | from typing import Union, List
class InputExample:
"""
Structure for one input example with texts, the label and a unique id
"""
def __init__(self, guid: str = '', texts: Union[List[str], List[int]] = [], label: Union[int, float] = None):
"""
Creates one InputExample with the given tex... | from typing import Union, List
class InputExample:
"""
Structure for one input example with texts, the label and a unique id
"""
def __init__(self, guid: str = '', texts: List[str] = None, texts_tokenized: List[List[int]] = None, label: Union[int, float] = None):
"""
Creates one InputE... | Add field for pre-tokenized texts | Add field for pre-tokenized texts
| Python | apache-2.0 | UKPLab/sentence-transformers | ---
+++
@@ -5,7 +5,7 @@
"""
Structure for one input example with texts, the label and a unique id
"""
- def __init__(self, guid: str = '', texts: Union[List[str], List[int]] = [], label: Union[int, float] = None):
+ def __init__(self, guid: str = '', texts: List[str] = None, texts_tokenized: List... |
08199327c411663a199ebf36379e88a514935399 | chdb.py | chdb.py | import sqlite3
DB_FILENAME = 'citationhunt.sqlite3'
def init_db():
return sqlite3.connect(DB_FILENAME)
def reset_db():
db = init_db()
with db:
db.execute('''
DROP TABLE categories
''')
db.execute('''
DROP TABLE articles
''')
db.execute('''
... | import sqlite3
DB_FILENAME = 'citationhunt.sqlite3'
def init_db():
return sqlite3.connect(DB_FILENAME)
def reset_db():
db = init_db()
with db:
db.execute('''
DROP TABLE IF EXISTS categories
''')
db.execute('''
DROP TABLE IF EXISTS articles
''')
... | Revert "Remove IF EXISTS from DROP TABLE when resetting the db." | Revert "Remove IF EXISTS from DROP TABLE when resetting the db."
This reverts commit a7dce25964cd740b0d0db86b255ede60c913e73d.
| Python | mit | jhsoby/citationhunt,Stryn/citationhunt,jhsoby/citationhunt,Stryn/citationhunt,jhsoby/citationhunt,jhsoby/citationhunt,Stryn/citationhunt,Stryn/citationhunt | ---
+++
@@ -10,16 +10,16 @@
with db:
db.execute('''
- DROP TABLE categories
+ DROP TABLE IF EXISTS categories
''')
db.execute('''
- DROP TABLE articles
+ DROP TABLE IF EXISTS articles
''')
db.execute('''
- DROP ... |
3e28adb3b32e1c88e9295c44e79840ebfe67f83f | py/foxgami/db.py | py/foxgami/db.py | import functools
from sqlalchemy import create_engine
@functools.lru_cache()
def engine():
return create_engine('postgresql://foxgami:foxgami@localhost/foxgami')
def query(sql, args=()):
e = engine()
result = e.execute(sql, tuple(args))
if result:
return list(result)
def query_single(sql,... | import functools
from sqlalchemy import create_engine
@functools.lru_cache()
def engine():
return create_engine('postgresql://foxgami:foxgami@localhost/foxgami')
def query(sql, args=()):
e = engine()
result = e.execute(sql, tuple(args))
if result.returns_rows:
return list(result)
def quer... | Use .returns_rows to determine if we should return list type | Use .returns_rows to determine if we should return list type
| Python | mit | flubstep/foxgami.com,flubstep/foxgami.com | ---
+++
@@ -10,7 +10,7 @@
def query(sql, args=()):
e = engine()
result = e.execute(sql, tuple(args))
- if result:
+ if result.returns_rows:
return list(result)
|
b3f3325484426e2f77dc2df092c316ed38584970 | test/proper_noun_test.py | test/proper_noun_test.py |
from jargonprofiler.util import tag_proper_nouns
from jargonprofiler.munroe import munroe_score
def test_proper_noun_in_sentance():
assert tag_proper_nouns("My name is Eilis.") == set(["Eilis"])
def test_proper_noun_begins_sentance():
assert tag_proper_nouns("Eilis is a girl") == set(["Eilis"])
def test_... |
from jargonprofiler.util import tag_proper_nouns
from jargonprofiler.munroe import munroe_score
def test_proper_noun_in_sentance():
assert tag_proper_nouns("My name is Eilis.") == set(["Eilis"])
def test_proper_noun_begins_sentance():
assert tag_proper_nouns("Eilis is a girl") == set(["Eilis"])
def test_... | Update test now 'is' is a common word | Update test now 'is' is a common word
| Python | mit | ejh243/MunroeJargonProfiler,ejh243/MunroeJargonProfiler | ---
+++
@@ -13,4 +13,4 @@
def test_munroe_with_proper_nouns():
result = munroe_score("Eilis is a small girl")
- assert result["score"] == 0.75
+ assert result["score"] == 1.0 |
50d8ad485549159d2186df2b6b01aee21e51cbc2 | notebooks/machine_learning/track_meta.py | notebooks/machine_learning/track_meta.py | # See also examples/example_track/example_meta.py for a longer, commented example
track = dict(
author_username='dansbecker',
)
lessons = [
dict(topic='How Models Work'),
dict(topic='Explore Your Data')
]
notebooks = [
dict(
filename='tut1.ipynb',
lesson_idx=0,
type='tu... | # See also examples/example_track/example_meta.py for a longer, commented example
track = dict(
author_username='dansbecker',
)
lessons = [
dict(topic='how models work'),
dict(topic='exploring your data'),
dict(topic='building your first machine learning model'),
]
notebooks = [
dict(
... | Add third lesson and reword lesson topics | Add third lesson and reword lesson topics
| Python | apache-2.0 | Kaggle/learntools,Kaggle/learntools | ---
+++
@@ -4,8 +4,9 @@
)
lessons = [
- dict(topic='How Models Work'),
- dict(topic='Explore Your Data')
+ dict(topic='how models work'),
+ dict(topic='exploring your data'),
+ dict(topic='building your first machine learning model'),
]
notebooks = [
@@ -29,6 +30,21 @@
... |
939a3be5b24715aae5fd334e6529ec96e1612def | allauth/socialaccount/providers/reddit/provider.py | allauth/socialaccount/providers/reddit/provider.py | from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class RedditAccount(ProviderAccount):
def to_str(self):
dflt = super(RedditAccount, self).to_str()
name = self.account.extra_data.get("name", dflt)
re... | from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class RedditAccount(ProviderAccount):
def to_str(self):
dflt = super(RedditAccount, self).to_str()
name = self.account.extra_data.get("name", dflt)
re... | Use Reddit name as username | chore(reddit): Use Reddit name as username
Using Reddit's screen name as username instead of first name will allow the sign to skip one more field. | Python | mit | pennersr/django-allauth,rsalmaso/django-allauth,pennersr/django-allauth,rsalmaso/django-allauth,rsalmaso/django-allauth,pennersr/django-allauth | ---
+++
@@ -18,7 +18,7 @@
return data["name"]
def extract_common_fields(self, data):
- return dict(name=data.get("name"))
+ return dict(username=data.get("name"))
def get_default_scope(self):
scope = ["identity"] |
d0380db930dbf145108a7ef0330dd19475f7fdee | test_arrange_schedule.py | test_arrange_schedule.py | from arrange_schedule import *
def test_read_system_setting():
keys = ['board_py_dir','shutdown','max_db_log','min_db_activity']
system_setting = read_system_setting()
for key in keys:
assert key in system_setting
return system_setting
def test_crawler_cwb_img(system_setting):
send_msg = ... | from arrange_schedule import *
def test_read_system_setting():
keys = ['board_py_dir','shutdown','max_db_log','min_db_activity']
system_setting = read_system_setting()
for key in keys:
assert key in system_setting
return system_setting
def test_read_arrange_mode():
keys = ['arrange_sn','a... | Add test case for read_arrange_mode() | Add test case for read_arrange_mode()
| Python | apache-2.0 | Billy4195/electronic-blackboard,SWLBot/electronic-blackboard,stvreumi/electronic-blackboard,chenyang14/electronic-blackboard,SWLBot/electronic-blackboard,Billy4195/electronic-blackboard,stvreumi/electronic-blackboard,chenyang14/electronic-blackboard,stvreumi/electronic-blackboard,Billy4195/electronic-blackboard,stvreum... | ---
+++
@@ -7,6 +7,12 @@
for key in keys:
assert key in system_setting
return system_setting
+
+def test_read_arrange_mode():
+ keys = ['arrange_sn','arrange_mode','condition']
+ receive_msg = read_arrange_mode()
+ for key in keys:
+ assert key in receive_msg
def test_crawler_cwb... |
3d46ec43570013bd68135126127c4027e25e3cfa | shapely/geos.py | shapely/geos.py | """
Exports the libgeos_c shared lib, GEOS-specific exceptions, and utilities.
"""
import atexit
from ctypes import CDLL, CFUNCTYPE, c_char_p
import os, sys
# The GEOS shared lib
if os.name == 'nt':
dll = 'libgeos_c-1.dll'
else:
dll = 'libgeos_c.so'
lgeos = CDLL(dll)
# Exceptions
class ReadingError(Except... | """
Exports the libgeos_c shared lib, GEOS-specific exceptions, and utilities.
"""
import atexit
from ctypes import CDLL, CFUNCTYPE, c_char_p
import sys
# The GEOS shared lib
if sys.platform == 'win32':
dll = 'libgeos_c-1.dll'
elif sys.platform == 'darwin':
dll = 'libgeos_c.dylib'
else:
dll = 'libgeos_c.... | Add untested support for the darwin platform | Add untested support for the darwin platform
git-svn-id: 30e8e193f18ae0331cc1220771e45549f871ece9@762 b426a367-1105-0410-b9ff-cdf4ab011145
| Python | bsd-3-clause | abali96/Shapely,jdmcbr/Shapely,abali96/Shapely,mouadino/Shapely,jdmcbr/Shapely,mouadino/Shapely,mindw/shapely,mindw/shapely | ---
+++
@@ -4,12 +4,14 @@
import atexit
from ctypes import CDLL, CFUNCTYPE, c_char_p
-import os, sys
+import sys
# The GEOS shared lib
-if os.name == 'nt':
+if sys.platform == 'win32':
dll = 'libgeos_c-1.dll'
+elif sys.platform == 'darwin':
+ dll = 'libgeos_c.dylib'
else:
dll = 'libgeos_c.so'
... |
4c3e9723f67448e93da65ff10142a98176cebe9b | publishconf.py | publishconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = 'https://pappasam.github.io'
RELATIVE_URLS = False
FEED_ALL_ATOM = 'feeds/all.atom.xml'
CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'
DELETE_OUTPUT_D... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = 'https://softwarejourneyman.com'
RELATIVE_URLS = False
FEED_ALL_ATOM = 'feeds/all.atom.xml'
CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'
DELETE_OUTP... | Change publish site to softwarejourneyman.com | Change publish site to softwarejourneyman.com
| Python | mit | pappasam/pappasam.github.io,pappasam/pappasam.github.io | ---
+++
@@ -7,7 +7,7 @@
sys.path.append(os.curdir)
from pelicanconf import *
-SITEURL = 'https://pappasam.github.io'
+SITEURL = 'https://softwarejourneyman.com'
RELATIVE_URLS = False
FEED_ALL_ATOM = 'feeds/all.atom.xml' |
e4427016abdc7ef146cd7550f2ac1dace07be442 | plinky.py | plinky.py | from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run(debug=True)
| from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
| Remove debug flag from app | Remove debug flag from app
| Python | mit | RaspberryPiFoundation/plinky,CodeClub/plinky,codecleaner/plinky,codecleaner/plinky,CodeClub/plinky,martinpeck/plinky,martinpeck/plinky,RaspberryPiFoundation/plinky,RaspberryPiFoundation/plinky | ---
+++
@@ -6,4 +6,4 @@
return "Hello World!"
if __name__ == "__main__":
- app.run(debug=True)
+ app.run() |
5998d66442ac0881309005a7bdbedc4ff91b0ea6 | hs_core/management/commands/solr_queries.py | hs_core/management/commands/solr_queries.py | """
This prints the state of a facet query.
It is used for debugging the faceting system.
"""
from django.core.management.base import BaseCommand
from haystack.query import SearchQuerySet
from hs_core.discovery_parser import ParseSQ
class Command(BaseCommand):
help = "Print debugging information about logical fi... | """
This prints the state of a facet query.
It is used for debugging the faceting system.
"""
from django.core.management.base import BaseCommand
from haystack.query import SearchQuerySet
from hs_core.discovery_parser import ParseSQ
class Command(BaseCommand):
help = "Print debugging information about logical fi... | Clean up response to no queries. | Clean up response to no queries.
| Python | bsd-3-clause | hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare | ---
+++
@@ -35,7 +35,3 @@
else:
print("no queries to try")
- query = 'author:"Tarboton, David"'
- parser = ParseSQ()
- parsed = parser.parse(query)
- print("QUERY '{}' PARSED {}".format(query, str(parsed))) |
67f3694254e08331152cd410dec128c11e965222 | daisyproducer/settings.py | daisyproducer/settings.py | from settings_common import *
PACKAGE_VERSION = "0.5"
DEBUG = TEMPLATE_DEBUG = True
DAISY_PIPELINE_PATH = os.path.join(PROJECT_DIR, '..', '..', 'tmp', 'pipeline')
EXTERNAL_PATH = os.path.join(PROJECT_DIR, '..', '..', 'tmp')
SERVE_STATIC_FILES = True
# the following is an idea from https://code.djangoproject.com/wi... | from settings_common import *
PACKAGE_VERSION = "0.5"
DEBUG = TEMPLATE_DEBUG = True
DAISY_PIPELINE_PATH = os.path.join(PROJECT_DIR, '..', '..', '..', 'tmp', 'pipeline')
EXTERNAL_PATH = os.path.join(PROJECT_DIR, '..', '..', '..', 'tmp')
SERVE_STATIC_FILES = True
# the following is an idea from https://code.djangopr... | Fix the path to external tools | Fix the path to external tools
| Python | agpl-3.0 | sbsdev/daisyproducer,sbsdev/daisyproducer,sbsdev/daisyproducer,sbsdev/daisyproducer | ---
+++
@@ -4,8 +4,8 @@
DEBUG = TEMPLATE_DEBUG = True
-DAISY_PIPELINE_PATH = os.path.join(PROJECT_DIR, '..', '..', 'tmp', 'pipeline')
-EXTERNAL_PATH = os.path.join(PROJECT_DIR, '..', '..', 'tmp')
+DAISY_PIPELINE_PATH = os.path.join(PROJECT_DIR, '..', '..', '..', 'tmp', 'pipeline')
+EXTERNAL_PATH = os.path.join(P... |
9fd54adcbd1d21232306d15dc7c6a786c867e455 | src/som/compiler/sourcecode_compiler.py | src/som/compiler/sourcecode_compiler.py | import os
def compile_class_from_file(path, filename, system_class, universe):
return _SourcecodeCompiler().compile(path, filename, system_class, universe)
def compile_class_from_string(stmt, system_class, universe):
return _SourcecodeCompiler().compile_class_string(stmt, system_class, universe)
class _Sourc... | import os
from StringIO import StringIO
def compile_class_from_file(path, filename, system_class, universe):
return _SourcecodeCompiler().compile(path, filename, system_class, universe)
def compile_class_from_string(stmt, system_class, universe):
return _SourcecodeCompiler().compile_class_string(stmt, system_... | Use Python file objects directly as input | Use Python file objects directly as input
- fix wrong separator between path and filename
Signed-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de>
| Python | mit | SOM-st/PySOM,SOM-st/RPySOM,smarr/RTruffleSOM,smarr/PySOM,SOM-st/RTruffleSOM,smarr/PySOM,SOM-st/RPySOM,SOM-st/PySOM,smarr/RTruffleSOM,SOM-st/RTruffleSOM | ---
+++
@@ -1,4 +1,5 @@
import os
+from StringIO import StringIO
def compile_class_from_file(path, filename, system_class, universe):
return _SourcecodeCompiler().compile(path, filename, system_class, universe)
@@ -12,13 +13,11 @@
self._parser = None
def compile(self, path, filename, syst... |
9b10bd93191913aaedaa28fc693620a6c2e6d203 | pml/load_csv.py | pml/load_csv.py | import os
import csv
from pml import lattice, element, device
def load(directory, name, control_system):
lat = lattice.Lattice(name, control_system)
with open(os.path.join(directory, 'elements.csv')) as elements:
csv_reader = csv.DictReader(elements)
for item in csv_reader:
e = ele... | import os
import csv
from pml import lattice, element, device
def load(directory, mode, control_system):
lat = lattice.Lattice(mode, control_system)
with open(os.path.join(directory, mode, 'elements.csv')) as elements:
csv_reader = csv.DictReader(elements)
for item in csv_reader:
e... | Simplify the way modes are loaded into a lattice | Simplify the way modes are loaded into a lattice
| Python | apache-2.0 | willrogers/pml,willrogers/pml | ---
+++
@@ -3,9 +3,9 @@
from pml import lattice, element, device
-def load(directory, name, control_system):
- lat = lattice.Lattice(name, control_system)
- with open(os.path.join(directory, 'elements.csv')) as elements:
+def load(directory, mode, control_system):
+ lat = lattice.Lattice(mode, control_s... |
1619ba48666be69710cd6bcbffe663cd1f7c1066 | troposphere/codeguruprofiler.py | troposphere/codeguruprofiler.py | # Copyright (c) 2020, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject
class ProfilingGroup(AWSObject):
resource_type = "AWS::CodeGuruProfiler::ProfilingGroup"
props = {
'AgentPermissions': (dict, False),
'ProfilingGroupName': (b... | # Copyright (c) 2012-2019, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
# Resource specification version: 16.1.0
from . import AWSObject
class ProfilingGroup(AWSObject):
resource_type = "AWS::CodeGuruProfiler::Prof... | Add AWS::CodeGuruProfiler::ProfilingGroup.ComputePlatform per 2020-07-09 update | Add AWS::CodeGuruProfiler::ProfilingGroup.ComputePlatform per 2020-07-09 update
| Python | bsd-2-clause | cloudtools/troposphere,cloudtools/troposphere | ---
+++
@@ -1,7 +1,11 @@
-# Copyright (c) 2020, Mark Peek <mark@peek.org>
+# Copyright (c) 2012-2019, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
+#
+# *** Do not modify - this file is autogenerated ***
+# Resource specification version: 16.1.0
+
from . import AWSObje... |
227ae986590bf2d5daa5aef028f5f4cd4c1e8917 | tests/xtests/base.py | tests/xtests/base.py | from django.test import TestCase
from django.contrib.auth.models import User
from django.test.client import RequestFactory
class BaseTest(TestCase):
def setUp(self):
self.factory = RequestFactory()
def _create_superuser(self, username):
return User.objects.create(username=username, is_superus... | from django.test import TestCase
from django.contrib.auth.models import User
from django.test.client import RequestFactory
class BaseTest(TestCase):
def setUp(self):
self.factory = RequestFactory()
def _create_superuser(self, username):
return User.objects.create(username=username, is_superus... | Add session in tests Mock HttpRequest | Add session in tests Mock HttpRequest
| Python | bsd-3-clause | alexsilva/django-xadmin,jneight/django-xadmin,merlian/django-xadmin,pobear/django-xadmin,cupen/django-xadmin,wbcyclist/django-xadmin,cgcgbcbc/django-xadmin,pobear/django-xadmin,t0nyren/django-xadmin,t0nyren/django-xadmin,marguslaak/django-xadmin,t0nyren/django-xadmin,vincent-fei/django-xadmin,iedparis8/django-xadmin,vi... | ---
+++
@@ -13,4 +13,5 @@
def _mocked_request(self, url, user='admin'):
request = self.factory.get(url)
request.user = isinstance(user, User) and user or self._create_superuser(user)
+ request.session = {}
return request |
58846603f8a5310bb0e6e1eaa9f9f599c315b041 | django_webtest/response.py | django_webtest/response.py | # -*- coding: utf-8 -*-
from django.test import Client
from django.http import SimpleCookie
from webtest import TestResponse
from django_webtest.compat import urlparse
class DjangoWebtestResponse(TestResponse):
"""
WebOb's Response quacking more like django's HttpResponse.
This is here to make more django... | # -*- coding: utf-8 -*-
from django.test import Client
from django.http import SimpleCookie
from webtest import TestResponse
from django_webtest.compat import urlparse
class DjangoWebtestResponse(TestResponse):
"""
WebOb's Response quacking more like django's HttpResponse.
This is here to make more django... | Add url property to DjangoWebtestResponse so assertRedirects works in 1.6. | Add url property to DjangoWebtestResponse so assertRedirects works in 1.6.
| Python | mit | kmike/django-webtest,helenst/django-webtest,vaad2/django-webtest,django-webtest/django-webtest,abbottc/django-webtest,kharandziuk/django-webtest,abbottc/django-webtest,MikeAmy/django-webtest,andrewyoung1991/django-webtest,helenst/django-webtest,yrik/django-webtest,andrewyoung1991/django-webtest,andriisoldatenko/django-... | ---
+++
@@ -26,6 +26,10 @@
return self.body
@property
+ def url(self):
+ return self['location']
+
+ @property
def client(self):
client = Client()
client.cookies = SimpleCookie() |
124487f204c5dedea471bd2c45ad8b929ff7fae0 | app/clients/sms/loadtesting.py | app/clients/sms/loadtesting.py | import logging
from flask import current_app
from app.clients.sms.firetext import (
FiretextClient
)
logger = logging.getLogger(__name__)
class LoadtestingClient(FiretextClient):
'''
Loadtest sms client.
'''
def init_app(self, config, statsd_client, *args, **kwargs):
super(FiretextClie... | import logging
from flask import current_app
from app.clients.sms.firetext import (
FiretextClient
)
logger = logging.getLogger(__name__)
class LoadtestingClient(FiretextClient):
'''
Loadtest sms client.
'''
def init_app(self, config, statsd_client, *args, **kwargs):
super(FiretextClie... | Fix from number on Load testing client | Fix from number on Load testing client
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -18,7 +18,7 @@
super(FiretextClient, self).__init__(*args, **kwargs)
self.current_app = current_app
self.api_key = config.config.get('LOADTESTING_API_KEY')
- self.from_number = config.config.get('LOADTESTING_NUMBER')
+ self.from_number = config.config.get('FROM_NUMB... |
b394f79132d952be20baf15725715691ace69ced | web/slas-web/web/urls.py | web/slas-web/web/urls.py | """web URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based v... | """web URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based v... | Change web admin page title | Change web admin page title
| Python | mit | chyla/slas,chyla/pat-lms,chyla/slas,chyla/pat-lms,chyla/slas,chyla/pat-lms,chyla/slas,chyla/slas,chyla/pat-lms,chyla/pat-lms,chyla/slas,chyla/pat-lms,chyla/slas,chyla/pat-lms | ---
+++
@@ -29,3 +29,5 @@
url(r'^user/logout/$', 'web.views.user_logout'),
url(r'^user/invalid_login/$', 'web.views.user_invalid_login'),
]
+
+admin.site.site_header = 'SLAS web module administration tool' |
e836f3c558085aa0a1275546ac45b8146254ee6b | test/default.py | test/default.py | from mock import MagicMock
import pbclient
class TestDefault(object):
"""Test class for pbs.helpers."""
error = {"action": "GET",
"exception_cls": "NotFound",
"exception_msg": "(NotFound)",
"status": "failed",
"status_code": 404,
"target": "/api... | """Test module for pbs client."""
from mock import MagicMock
import pbclient
class TestDefault(object):
"""Test class for pbs.helpers."""
config = MagicMock()
config.server = 'http://server'
config.api_key = 'apikey'
config.pbclient = pbclient
config.project = {'name': 'name',
... | Refactor error as a property. | Refactor error as a property.
| Python | agpl-3.0 | PyBossa/pbs,PyBossa/pbs,PyBossa/pbs | ---
+++
@@ -1,23 +1,35 @@
+"""Test module for pbs client."""
from mock import MagicMock
import pbclient
+
+
class TestDefault(object):
"""Test class for pbs.helpers."""
-
- error = {"action": "GET",
- "exception_cls": "NotFound",
- "exception_msg": "(NotFound)",
- "sta... |
fc561301c3a3aea79043348a01e6a468a5693d3e | tests/test_importable.py | tests/test_importable.py | """Basic set of tests to ensure entire code base is importable"""
import pytest
def test_importable():
"""Simple smoketest to ensure all isort modules are importable"""
import isort
import isort._future
import isort._future._dataclasses
import isort._version
import isort.api
import isort.c... | """Basic set of tests to ensure entire code base is importable"""
import pytest
def test_importable():
"""Simple smoketest to ensure all isort modules are importable"""
import isort
import isort._future
import isort._future._dataclasses
import isort._version
import isort.api
import isort.c... | Remove no longer needed import check | Remove no longer needed import check
| Python | mit | PyCQA/isort,PyCQA/isort | ---
+++
@@ -10,7 +10,6 @@
import isort._version
import isort.api
import isort.comments
- import isort.compat
import isort.exceptions
import isort.finders
import isort.format |
e3aa12af05003222b295a4cea39a1c05c911024a | main.py | main.py | from connect_four import ConnectFour
def main():
""" Play a game!
"""
connect_four = ConnectFour()
# start the game
connect_four.start()
if __name__ == "__main__": # Default "main method" idiom.
main() | from connect_four import ConnectFour
def main():
""" Play a game!
"""
connect_four = ConnectFour()
menu_choice = 1
while menu_choice == 1:
# start the game
connect_four.start_new()
# menu
print("Menu")
print("1 - Play again")
print("2 - Quit")
... | Add menu to start new game and quit | Add menu to start new game and quit
| Python | mit | LouisBarranqueiro/ia-connect-four-game | ---
+++
@@ -1,11 +1,20 @@
from connect_four import ConnectFour
+
def main():
""" Play a game!
"""
connect_four = ConnectFour()
- # start the game
- connect_four.start()
+ menu_choice = 1
+ while menu_choice == 1:
+ # start the game
+ connect_four.start_new()
+ # men... |
08c2e9144e605063ac3c6313efe639eb7139ba75 | main.py | main.py | # Fox, rewritten in Python for literally no reason at all.
import discord
import asyncio
print("Just a moment, Fox is initializing...")
fox = discord.Client()
@fox.event
async def on_ready():
print('Fox is ready!')
print('Fox username: ' + fox.user.name)
print('Fox user ID: ' + fox.user.id)
print('--... | # Fox, rewritten in Python for literally no reason at all.
import discord
import asyncio
import plugins
import plugins.core
print("Just a moment, Fox is initializing...")
fox = discord.Client()
@fox.event
async def on_ready():
print('Fox is ready!')
print('Fox username: ' + fox.user.name)
print('Fox u... | Add import statements for plugin system | Add import statements for plugin system
Signed-off-by: Reed <f5cabf8735907151a446812c9875d6c0c712d847@plusreed.com>
| Python | mit | plusreed/foxpy | ---
+++
@@ -1,10 +1,15 @@
# Fox, rewritten in Python for literally no reason at all.
+
import discord
import asyncio
+import plugins
+import plugins.core
+
print("Just a moment, Fox is initializing...")
fox = discord.Client()
+
@fox.event
async def on_ready(): |
ddc82357cafbf58822f4d98f484fbe4dd860743e | sqlviz.py | sqlviz.py | #! usr/bin/env python3
from docopt import docopt
from matplotlib import pyplot
import re
class Schema:
"""
Wraps the SQL source code for a schema and provides methods to get information about that schema.
"""
table_def = re.compile(r"CREATE TABLE|create table")
def __init__(self, source):
... | #! usr/bin/env python3
from docopt import docopt
from matplotlib import pyplot
import re
class Schema:
"""
Wraps the SQL source code for a schema and provides methods to get information about that schema.
"""
table_def = re.compile(r"CREATE TABLE|create table")
def __init__(self, source):
... | Fix reference to static var | Fix reference to static var | Python | mit | hawkw/sqlviz | ---
+++
@@ -21,7 +21,7 @@
"""
Returns the number of tables defined in the schema
"""
- return len(table_def.findall(source))
+ return len(Schema.table_def.findall(source))
def n_keys(self):
""" |
cc08100734df4eea053758a04610d889ced8c476 | dataportal/utils/diagnostics.py | dataportal/utils/diagnostics.py | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from collections import OrderedDict
import importlib
import sys
import six
def watermark():
"""
Give the version of each of the dependencies -- useful for bug reports.
Returns
-------
resu... | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from collections import OrderedDict
import importlib
import sys
import six
def watermark():
"""
Give the version of each of the dependencies -- useful for bug reports.
Returns
-------
resu... | Make watermark more resilient to err on import. | ENN: Make watermark more resilient to err on import.
| Python | bsd-3-clause | tacaswell/dataportal,NSLS-II/dataportal,tacaswell/dataportal,danielballan/dataportal,danielballan/datamuxer,danielballan/datamuxer,ericdill/datamuxer,danielballan/dataportal,ericdill/databroker,ericdill/datamuxer,NSLS-II/dataportal,NSLS-II/datamuxer,ericdill/databroker | ---
+++
@@ -23,23 +23,23 @@
for package_name in packages:
try:
package = importlib.import_module(package_name)
+ version = package.__version__
except ImportError:
result[package_name] = None
- else:
- try:
- version = package... |
9ea9b0bed617dc8a309c0d2dd90f02ffbc34edbc | client/bin/daemon.py | client/bin/daemon.py | #!/usr/bin/python
import time
import subprocess
from os import path, chdir, getcwd
import requests
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
class ProjectEventHandler(FileSystemEventHandler):
def on_any_event(self, event):
print('Dispatching request.')
... | #!/usr/bin/python
import time
import subprocess
from os import path, chdir, getcwd
import requests
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
class ProjectEventHandler(FileSystemEventHandler):
def on_any_event(self, event):
print('Dispatching request.')
... | Fix POSTing from the client | Fix POSTing from the client
| Python | agpl-3.0 | strugee/realtime.recurse.com,strugee/realtime.recurse.com,strugee/realtime.recurse.com | ---
+++
@@ -18,8 +18,9 @@
repo_url = subprocess.check_output(['git', 'remote', 'get-url', 'origin'], universal_newlines=True)
chdir(cwd)
- payload = { 'action': 'edit', 'repo_url': repo_url }
- r = requests.post('http://localhost:8000', json=payload)
+ payload = { 'action': 'e... |
c95fdbeb145e5bcef2ded646c2319b58ae9e996d | rpg_base/urls.py | rpg_base/urls.py | from django.conf.urls import include, url
from rpg_base.views import *
urlpatterns = [
# Examples:
# url(r'^$', 'django_rpg.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^campaign/$', campaign.index, name='index'),
url(r'^campaign/(?P<pk>[0-9]+)/$', campaign.view, name='... | from django.conf.urls import include, url
from rpg_base.views import *
urlpatterns = [
# Examples:
# url(r'^$', 'django_rpg.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^campaign/$', campaign.index, name='campaign_index'),
url(r'^campaign/(?P<pk>[0-9]+)/$', campaign.vie... | Change name for campaign index url | Change name for campaign index url
| Python | mit | ncphillips/django_rpg,ncphillips/django_rpg | ---
+++
@@ -6,7 +6,7 @@
# url(r'^$', 'django_rpg.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
- url(r'^campaign/$', campaign.index, name='index'),
+ url(r'^campaign/$', campaign.index, name='campaign_index'),
url(r'^campaign/(?P<pk>[0-9]+)/$', campaign.view, name='campaign... |
5203ecdaf839f58e7f00ef74fec9dbecbeb52583 | tests/backends/__init__.py | tests/backends/__init__.py | from mopidy.models import Track
class BaseCurrentPlaylistControllerTest(object):
uris = []
backend_class = None
def setUp(self):
self.backend = self.backend_class()
def test_add(self):
playlist = self.backend.current_playlist
for uri in self.uris:
playlist.add(uri... | from mopidy.models import Track
class BaseCurrentPlaylistControllerTest(object):
uris = []
backend_class = None
def setUp(self):
self.backend = self.backend_class()
def test_uri_set(self):
self.assert_(self.uris)
def test_add(self):
playlist = self.backend.current_playlis... | Add test to check that uris are set | Add test to check that uris are set
| Python | apache-2.0 | kingosticks/mopidy,abarisain/mopidy,mopidy/mopidy,kingosticks/mopidy,dbrgn/mopidy,SuperStarPL/mopidy,ZenithDK/mopidy,jodal/mopidy,pacificIT/mopidy,diandiankan/mopidy,glogiotatidis/mopidy,pacificIT/mopidy,diandiankan/mopidy,abarisain/mopidy,ZenithDK/mopidy,dbrgn/mopidy,SuperStarPL/mopidy,diandiankan/mopidy,bencevans/mop... | ---
+++
@@ -6,6 +6,9 @@
def setUp(self):
self.backend = self.backend_class()
+
+ def test_uri_set(self):
+ self.assert_(self.uris)
def test_add(self):
playlist = self.backend.current_playlist |
462b6878507e3928068745cccc80720e8699dafa | server.py | server.py | from flask import Flask
from SPARQLWrapper import SPARQLWrapper, JSON
from flask import request
from flask.ext.cors import CORS
app = Flask(__name__)
CORS(app)
@app.route('/')
def hello_world():
auth = request.authorization
sparql = SPARQLWrapper('https://knowledgestore2.fbk.eu/nwr/dutchhouse/sparql')
spa... | from flask import Flask
from SPARQLWrapper import SPARQLWrapper, JSON
from flask import request, jsonify
from flask.ext.cors import CORS
app = Flask(__name__)
CORS(app)
@app.route('/')
def hello_world():
auth = request.authorization
sparql = SPARQLWrapper('https://knowledgestore2.fbk.eu/nwr/dutchhouse/sparql'... | Return json object in flask app | Return json object in flask app
Instead of a string, the flask app now returns the json object retrieved
from the knowledge store.
| Python | apache-2.0 | NLeSC/EmbodiedEmotions,NLeSC/EmbodiedEmotions,NLeSC/UncertaintyVisualization,NLeSC/UncertaintyVisualization,NLeSC/EmbodiedEmotions | ---
+++
@@ -1,6 +1,6 @@
from flask import Flask
from SPARQLWrapper import SPARQLWrapper, JSON
-from flask import request
+from flask import request, jsonify
from flask.ext.cors import CORS
app = Flask(__name__)
@@ -16,8 +16,7 @@
sparql.setCredentials(auth.username, auth.password)
sparql.setReturnForma... |
c5f75072707dbe9a723ffbff71ab01d0519b6baa | tools/generateDataset.py | tools/generateDataset.py | import numpy as np
import os
import sys
import time
from unrealcv import client
class Dataset(object):
def __init__(self,folder,nberOfImages):
self.folder=folder
self.nberOfImages=nberOfImages
self.client.connect()
def scan():
try:
p=self.client.request('vget /c... | import numpy as np
import os
import sys
import time
from unrealcv import client
class Dataset(object):
def __init__(self,folder,nberOfImages):
self.folder=folder
self.nberOfImages=nberOfImages
self.client.connect()
def scan():
try:
p=self.client.request('vget /c... | Structure of data generator iimproved | :muscle: Structure of data generator iimproved
Structure of dataset generator improved
| Python | bsd-2-clause | fkenghagho/RobotVQA | ---
+++
@@ -19,5 +19,5 @@
p=self.client.request('vget /camera/0/object_mask '+a)
print p
except Exception,e:
- print 'Image not saved: error occured, '+str(e)
+ print 'Image could not be saved not saved: error occured, '+str(e)
|
0f2bc9cc1216dfd1e5a8f2aa8467428dc2be6781 | scikits/learn/pyem/misc.py | scikits/learn/pyem/misc.py | # Last Change: Sat Jun 09 07:00 PM 2007 J
#========================================================
# Constants used throughout the module (def args, etc...)
#========================================================
# This is the default dimension for representing confidence ellipses
DEF_VIS_DIM = [0, 1]
DEF_ELL_NP = ... | # Last Change: Sat Jun 09 08:00 PM 2007 J
#========================================================
# Constants used throughout the module (def args, etc...)
#========================================================
# This is the default dimension for representing confidence ellipses
DEF_VIS_DIM = (0, 1)
DEF_ELL_NP = ... | Set def arguments to immutable to avoid nasty side effect. | Set def arguments to immutable to avoid nasty side effect.
From: cdavid <cdavid@cb17146a-f446-4be1-a4f7-bd7c5bb65646>
git-svn-id: a2d1b0e147e530765aaf3e1662d4a98e2f63c719@110 22fbfee3-77ab-4535-9bad-27d1bd3bc7d8
| Python | bsd-3-clause | f3r/scikit-learn,cainiaocome/scikit-learn,tmhm/scikit-learn,schets/scikit-learn,chrsrds/scikit-learn,theoryno3/scikit-learn,harshaneelhg/scikit-learn,waterponey/scikit-learn,mayblue9/scikit-learn,larsmans/scikit-learn,florian-f/sklearn,IshankGulati/scikit-learn,etkirsch/scikit-learn,arabenjamin/scikit-learn,IssamLaradj... | ---
+++
@@ -1,10 +1,10 @@
-# Last Change: Sat Jun 09 07:00 PM 2007 J
+# Last Change: Sat Jun 09 08:00 PM 2007 J
#========================================================
# Constants used throughout the module (def args, etc...)
#========================================================
# This is the default dime... |
726beb71b45c7320b4e2e883f246d389709efe19 | run_tracker.py | run_tracker.py | import sys
from cloudtracker import main
def run_tracker(input_dir):
print( " Running the cloud-tracking algorithm... " )
print( " Input dir: \"" + input_dir + "\" \n" )
main.main(input_dir)
print( "\n Entrainment analysis completed " )
if __name__ == '__main__':
if len(sys.argv) == 1:
... | import sys, json
from cloudtracker import main as tracker_main
def run_tracker(input):
print( " Running the cloud-tracking algorithm... " )
print( " Input dir: \"" + input + "\" \n" )
# Read .json configuration file
with open('model_config.json', 'r') as json_file:
config = json.load(json... | Read .json file from starter | Read .json file from starter
| Python | bsd-2-clause | lorenghoh/loh_tracker | ---
+++
@@ -1,11 +1,16 @@
-import sys
-from cloudtracker import main
+import sys, json
+
+from cloudtracker import main as tracker_main
-def run_tracker(input_dir):
+def run_tracker(input):
print( " Running the cloud-tracking algorithm... " )
- print( " Input dir: \"" + input_dir + "\" \n" )
+ print(... |
116708c5458b68110e75a593a0edaa0298bb5586 | cyder/core/fields.py | cyder/core/fields.py | from django.db.models import CharField
from django.core.exceptions import ValidationError
from cyder.cydhcp.validation import validate_mac
class MacAddrField(CharField):
"""A general purpose MAC address field
This field holds a MAC address. clean() removes colons and hyphens from the
field value, raising... | from django.db.models import CharField, NOT_PROVIDED
from django.core.exceptions import ValidationError
from south.modelsinspector import add_introspection_rules
from cyder.cydhcp.validation import validate_mac
class MacAddrField(CharField):
"""A general purpose MAC address field
This field holds a MAC addre... | Add introspection rule; prevent South weirdness | Add introspection rule; prevent South weirdness
| Python | bsd-3-clause | drkitty/cyder,murrown/cyder,OSU-Net/cyder,akeym/cyder,murrown/cyder,murrown/cyder,zeeman/cyder,drkitty/cyder,OSU-Net/cyder,drkitty/cyder,zeeman/cyder,akeym/cyder,OSU-Net/cyder,akeym/cyder,akeym/cyder,OSU-Net/cyder,drkitty/cyder,zeeman/cyder,murrown/cyder,zeeman/cyder | ---
+++
@@ -1,5 +1,6 @@
-from django.db.models import CharField
+from django.db.models import CharField, NOT_PROVIDED
from django.core.exceptions import ValidationError
+from south.modelsinspector import add_introspection_rules
from cyder.cydhcp.validation import validate_mac
@@ -23,11 +24,6 @@
else:
... |
f2312d1546eb3f6de75cc03a2dabb427a2174e17 | examples/sequencealignment.py | examples/sequencealignment.py | # Create sequences to be aligned.
from alignment.sequence import Sequence
a = Sequence("what a beautiful day".split())
b = Sequence("what a disappointingly bad day".split())
print "Sequence A:", a
print "Sequence B:", b
print
# Create a vocabulary and encode the sequences.
from alignment.vocabulary import Vocabulary
v... | from alignment.sequence import Sequence
from alignment.vocabulary import Vocabulary
from alignment.sequencealigner import SimpleScoring, GlobalSequenceAligner
# Create sequences to be aligned.
a = Sequence("what a beautiful day".split())
b = Sequence("what a disappointingly bad day".split())
print "Sequence A:", a
pr... | Update the sequence alignment example. | Update the sequence alignment example.
| Python | bsd-3-clause | eseraygun/python-entities,eseraygun/python-alignment | ---
+++
@@ -1,5 +1,9 @@
+from alignment.sequence import Sequence
+from alignment.vocabulary import Vocabulary
+from alignment.sequencealigner import SimpleScoring, GlobalSequenceAligner
+
+
# Create sequences to be aligned.
-from alignment.sequence import Sequence
a = Sequence("what a beautiful day".split())
b = S... |
5b9e168b4a855197b07527c468ef6b60c50ec0c7 | avalanche/__init__.py | avalanche/__init__.py | from avalanche import benchmarks
from avalanche import evaluation
from avalanche import logging
from avalanche import models
from avalanche import training
__version__ = "0.1.0a0"
_dataset_add = None
def _avdataset_radd(self, other, *args, **kwargs):
from avalanche.benchmarks.utils import Avalanch... | from avalanche import benchmarks
from avalanche import evaluation
from avalanche import logging
from avalanche import models
from avalanche import training
__version__ = "0.2.0"
_dataset_add = None
def _avdataset_radd(self, other, *args, **kwargs):
from avalanche.benchmarks.utils import AvalancheD... | Set package version to 0.2.0 | Set package version to 0.2.0 | Python | mit | ContinualAI/avalanche,ContinualAI/avalanche | ---
+++
@@ -5,7 +5,7 @@
from avalanche import training
-__version__ = "0.1.0a0"
+__version__ = "0.2.0"
_dataset_add = None
|
d584ccea9fe985fa230c937ee2e6a03ef6b99967 | audio_pipeline/util/__init__.py | audio_pipeline/util/__init__.py | from . import Exceptions
from . import MBInfo
from . import Tag
from . import Util
from . import format
from . import Discogs
import re
# unknown artist input pattern:
class Utilities:
unknown_artist_pattern = re.compile(r'unknown artist|^\s*$', flags=re.I)
@classmethod
def know_artist_name(cls, artist):... | from . import Exceptions
from . import MBInfo
from . import Tag
from . import Util
from . import format
from . import Discogs
import re
# unknown artist input pattern:
class Utilities:
unknown_artist_pattern = re.compile(r'unknown artist|^\s*$', flags=re.I)
@classmethod
def know_artist_name(cls, artist):... | Check to make sure artist is not None, or evil will occur... | Check to make sure artist is not None, or evil will occur...
| Python | mit | hidat/audio_pipeline | ---
+++
@@ -18,5 +18,5 @@
:param artist:
:return:
"""
- unknown_artist = not (artist or artist.isspace() or cls.unknown_artist_pattern.search(artist))
+ unknown_artist = artist is None or not (artist or artist.isspace() or cls.unknown_artist_pattern.search(artist))
re... |
19e9080f06aa2264e77b65a9c1ad6d30e6b7da4c | app/aflafrettir/routes.py | app/aflafrettir/routes.py | from flask import render_template
from . import aflafrettir
from ..models import User, Category, Post
@aflafrettir.route('/')
def index():
categories = Category.get_all_active()
posts = Post.get_all()
return render_template('aflafrettir/index.html',
categories=categories,
... | from flask import render_template
from . import aflafrettir
from ..models import User, Category, Post
@aflafrettir.route('/frettir')
@aflafrettir.route('/', alias=True)
def index():
categories = Category.get_all_active()
posts = Post.get_all()
return render_template('aflafrettir/index.html',
... | Add a route for displaying posts by categories | Add a route for displaying posts by categories
| Python | mit | finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is | ---
+++
@@ -3,7 +3,8 @@
from . import aflafrettir
from ..models import User, Category, Post
-@aflafrettir.route('/')
+@aflafrettir.route('/frettir')
+@aflafrettir.route('/', alias=True)
def index():
categories = Category.get_all_active()
posts = Post.get_all()
@@ -11,6 +12,14 @@
c... |
1e5d549b6fdf62c1016451f9dfe566c9546b2f38 | bcbio/bed/__init__.py | bcbio/bed/__init__.py | import pybedtools as bt
import six
def concat(bed_files, catted=None):
"""
recursively concat a set of BED files, returning a
sorted bedtools object of the result
"""
if len(bed_files) == 0:
if catted:
return catted.sort()
else:
return catted
if not catt... | import pybedtools as bt
import six
def concat(bed_files, catted=None):
"""
recursively concat a set of BED files, returning a
sorted bedtools object of the result
"""
bed_files = [x for x in bed_files if x]
if len(bed_files) == 0:
if catted:
# move to a .bed extension for do... | Move the file to have an extension of .bed. | Move the file to have an extension of .bed.
A lot of tools detect what type of file it is by the extension,
so this lets us pass on the BedTool.fn as the filename and
not break things.
| Python | mit | guillermo-carrasco/bcbio-nextgen,lbeltrame/bcbio-nextgen,gifford-lab/bcbio-nextgen,Cyberbio-Lab/bcbio-nextgen,vladsaveliev/bcbio-nextgen,brainstorm/bcbio-nextgen,mjafin/bcbio-nextgen,lbeltrame/bcbio-nextgen,elkingtonmcb/bcbio-nextgen,brainstorm/bcbio-nextgen,fw1121/bcbio-nextgen,verdurin/bcbio-nextgen,lpantano/bcbio-ne... | ---
+++
@@ -6,9 +6,15 @@
recursively concat a set of BED files, returning a
sorted bedtools object of the result
"""
+ bed_files = [x for x in bed_files if x]
if len(bed_files) == 0:
if catted:
- return catted.sort()
+ # move to a .bed extension for downstream too... |
8abf65d6b364bd71e8aa32e25d319c77d716a85f | bin/verify_cached_graphs.py | bin/verify_cached_graphs.py | #!/usr/bin/env python
import sys
from pprint import pprint as pp
from cc.payment import flow
def verify():
for ignore_balances in (True, False):
graph = flow.build_graph(ignore_balances)
cached = flow.get_cached_graph(ignore_balances)
diff = compare(cached, graph)
if diff:
... | #!/usr/bin/env python
import sys
from pprint import pprint as pp
from cc.payment import flow
def verify():
for ignore_balances in (True, False):
cached = flow.get_cached_graph(ignore_balances)
if not cached:
continue
graph = flow.build_graph(ignore_balances)
diff = com... | Fix cached graph verifier tool to handle case where no graph is cached ATM. | Fix cached graph verifier tool to handle case where no graph is cached ATM.
| Python | agpl-3.0 | rfugger/villagescc,rfugger/villagescc,rfugger/villagescc,rfugger/villagescc | ---
+++
@@ -7,8 +7,10 @@
def verify():
for ignore_balances in (True, False):
+ cached = flow.get_cached_graph(ignore_balances)
+ if not cached:
+ continue
graph = flow.build_graph(ignore_balances)
- cached = flow.get_cached_graph(ignore_balances)
diff = compar... |
5d63656e9b03aaed2ef9042ff61a86bc4b8ee715 | django_rq/decorators.py | django_rq/decorators.py | from django.utils import six
from rq.decorators import job as _rq_job
from .queues import get_queue
def job(func_or_queue, connection=None, *args, **kwargs):
"""
The same as RQ's job decorator, but it works automatically works out
the ``connection`` argument from RQ_QUEUES.
And also, it allows simpl... | from rq.decorators import job as _rq_job
from .queues import get_queue
def job(func_or_queue, connection=None, *args, **kwargs):
"""
The same as RQ's job decorator, but it works automatically works out
the ``connection`` argument from RQ_QUEUES.
And also, it allows simplified ``@job`` syntax to put ... | Add a fallback for older Django versions that doesn't come with "six" | Add a fallback for older Django versions that doesn't come with "six"
| Python | mit | meteozond/django-rq,sbussetti/django-rq,sbussetti/django-rq,ui/django-rq,viaregio/django-rq,1024inc/django-rq,meteozond/django-rq,lechup/django-rq,ui/django-rq,mjec/django-rq,1024inc/django-rq,ryanisnan/django-rq,ryanisnan/django-rq,viaregio/django-rq,mjec/django-rq,lechup/django-rq | ---
+++
@@ -1,4 +1,3 @@
-from django.utils import six
from rq.decorators import job as _rq_job
from .queues import get_queue
@@ -19,7 +18,14 @@
func = None
queue = func_or_queue
- if isinstance(queue, six.string_types):
+ try:
+ from django.utils import six
+ string_type = ... |
34da1ea604d1aea4fcefae188f259df4bd8119a5 | indra/sources/crog/processor.py | indra/sources/crog/processor.py | # -*- coding: utf-8 -*-
"""Processor for the `Chemical Roles Graph (CRoG)
<https://github.com/chemical-roles/chemical-roles>`_.
"""
from typing import Optional
from ..utils import RemoteProcessor
__all__ = [
'CrogProcessor',
]
CROG_URL = 'https://raw.githubusercontent.com/chemical-roles/' \
'chemica... | # -*- coding: utf-8 -*-
"""Processor for the `Chemical Roles Graph (CRoG)
<https://github.com/chemical-roles/chemical-roles>`_.
"""
from typing import Optional
from ..utils import RemoteProcessor
__all__ = [
'CrogProcessor',
]
CROG_URL = 'https://raw.githubusercontent.com/chemical-roles/' \
'chemica... | Add space after EC prefix | Add space after EC prefix
Co-authored-by: Charles Tapley Hoyt <71cbf5b94f8862eb69e356b36e0cdaee3e60b67f@gmail.com> | Python | bsd-2-clause | johnbachman/indra,bgyori/indra,sorgerlab/belpy,sorgerlab/belpy,bgyori/indra,sorgerlab/indra,johnbachman/indra,bgyori/indra,sorgerlab/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra | ---
+++
@@ -39,4 +39,4 @@
# have the EC prefix in their name
for agent in stmt.real_agent_list():
if agent.name == agent.db_refs.get('ECCODE'):
- agent.name = 'EC%s' % agent.name
+ agent.name = 'EC %s' % agent.name |
bd1719885b1328c5aca34bc8d78b761e846f4037 | tests/query_test/test_decimal_queries.py | tests/query_test/test_decimal_queries.py | #!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
# Targeted tests for decimal type.
#
import logging
import pytest
from copy import copy
from tests.common.test_vector import *
from tests.common.impala_test_suite import *
class TestDecimalQueries(ImpalaTestSuite):
BATCH_SIZES = [0, 1]
... | #!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
# Targeted tests for decimal type.
#
import logging
import pytest
from copy import copy
from tests.common.test_vector import *
from tests.common.impala_test_suite import *
class TestDecimalQueries(ImpalaTestSuite):
BATCH_SIZES = [0, 1]
... | Fix the ASAN build by xfailing test_decimal when ASAN_OPTIONS is set. | Fix the ASAN build by xfailing test_decimal when ASAN_OPTIONS is set.
Adding decimal columns crashes an ASAN built impalad. This change skips the test.
Change-Id: Ic94055a3f0d00f89354177de18bc27d2f4cecec2
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2532
Reviewed-by: Ishaan Joshi <d1d1e60202ec9f2503deb1b724986485... | Python | apache-2.0 | cchanning/Impala,XiaominZhang/Impala,tempbottle/Impala,cgvarela/Impala,kapilrastogi/Impala,grundprinzip/Impala,scalingdata/Impala,bratatidas9/Impala-1,mapr/impala,ImpalaToGo/ImpalaToGo,cchanning/Impala,lnliuxing/Impala,gerashegalov/Impala,theyaa/Impala,lirui-intel/Impala,bowlofstew/Impala,ImpalaToGo/ImpalaToGo,gerasheg... | ---
+++
@@ -29,6 +29,8 @@
v.get_value('table_format').file_format == 'parquet')
def test_queries(self, vector):
+ if os.environ.get('ASAN_OPTIONS') == 'handle_segv=0':
+ pytest.xfail(reason="IMPALA-959: Sum on a decimal column fails ASAN")
new_vector = copy(vector)
new_vector.get_valu... |
9611fcd38c8d75b1c101870ae59de3db326c6951 | pyfive/tests/test_pyfive.py | pyfive/tests/test_pyfive.py |
import numpy as np
from numpy.testing import assert_array_equal
import pyfive
import h5py
def test_read_basic_example():
# reading with HDF5
hfile = h5py.File('basic_example.hdf5', 'r')
assert hfile['/example'].attrs['foo'] == 99.5
assert hfile['/example'].attrs['bar'] == 42
np.testing.assert_ar... | """ Unit tests for pyfive. """
import os
import numpy as np
from numpy.testing import assert_array_equal
import pyfive
import h5py
DIRNAME = os.path.dirname(__file__)
BASIC_HDF5_FILE = os.path.join(DIRNAME, 'basic_example.hdf5')
BASIC_NETCDF4_FILE = os.path.join(DIRNAME, 'basic_example.nc')
def test_read_basic_exa... | Make unit tests path aware | Make unit tests path aware
| Python | bsd-3-clause | jjhelmus/pyfive | ---
+++
@@ -1,3 +1,5 @@
+""" Unit tests for pyfive. """
+import os
import numpy as np
from numpy.testing import assert_array_equal
@@ -5,10 +7,15 @@
import pyfive
import h5py
+DIRNAME = os.path.dirname(__file__)
+BASIC_HDF5_FILE = os.path.join(DIRNAME, 'basic_example.hdf5')
+BASIC_NETCDF4_FILE = os.path.join(... |
2cc8a541814cc353e7b60767afd2128dce38918a | tests/test_plugins/test_plugin/server.py | tests/test_plugins/test_plugin/server.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | Fix failing python style test | Fix failing python style test
| Python | apache-2.0 | jbeezley/girder,jcfr/girder,RafaelPalomar/girder,opadron/girder,Kitware/girder,essamjoubori/girder,RafaelPalomar/girder,adsorensen/girder,Xarthisius/girder,adsorensen/girder,data-exp-lab/girder,jcfr/girder,girder/girder,opadron/girder,Xarthisius/girder,data-exp-lab/girder,jcfr/girder,kotfic/girder,manthey/girder,msmole... | ---
+++
@@ -45,7 +45,8 @@
def load(info):
- info['serverRoot'], info['serverRoot'].girder = CustomAppRoot(), info['serverRoot']
+ info['serverRoot'], info['serverRoot'].girder = (
+ CustomAppRoot(), info['serverRoot'])
info['serverRoot'].api = info['serverRoot'].girder.api
del info['server... |
db99f77edfb7318ee3b4a443a98c837611054515 | utils/fields.py | utils/fields.py | import json
from django.contrib.postgres.forms.jsonb import InvalidJSONInput, JSONField
class JSONPrettyField(JSONField):
def __init__(self, *args, **kwargs):
self.__indent = kwargs.pop('indent', 2)
super().__init__(*args, **kwargs)
def prepare_value(self, value):
if isinstance(value... | import json
from django.contrib.postgres.forms.jsonb import InvalidJSONInput, JSONField
from django.forms import ValidationError
class JSONPrettyField(JSONField):
def __init__(self, *args, **kwargs):
self.__indent = kwargs.pop('indent', 2)
self.__dict_only = kwargs.pop('dict_only', False)
... | Add list_only and dict_only to JSONPrettyField | Add list_only and dict_only to JSONPrettyField
| Python | mit | bulv1ne/django-utils,bulv1ne/django-utils | ---
+++
@@ -1,14 +1,26 @@
import json
from django.contrib.postgres.forms.jsonb import InvalidJSONInput, JSONField
+from django.forms import ValidationError
class JSONPrettyField(JSONField):
def __init__(self, *args, **kwargs):
self.__indent = kwargs.pop('indent', 2)
+ self.__dict_only = ... |
30b6a5364dc22261a4d47aec2e0a77e0c5b8ccd4 | wsme/release.py | wsme/release.py | name = "WSME"
version = "0.1.0a2"
description = "Web Services Made Easy"
long_description = """
Web Service Made Easy is a pure-wsgi and modular rewrite of TGWebServices.
"""
author = "Christophe de Vienne"
email = "cdevienne@gmail.com"
url = "http://bitbucket.org/cdevienne/wsme"
license = "MIT"
| name = "WSME"
version = "0.1.0a3"
description = "Web Services Made Easy"
long_description = """
Web Service Made Easy is a pure-wsgi and modular rewrite of TGWebServices.
"""
author = "Christophe de Vienne"
email = "python-wsme@googlegroups.com"
url = "http://bitbucket.org/cdevienne/wsme"
license = "MIT"
| Update the contact mail and version | Update the contact mail and version
| Python | mit | stackforge/wsme | ---
+++
@@ -1,5 +1,5 @@
name = "WSME"
-version = "0.1.0a2"
+version = "0.1.0a3"
description = "Web Services Made Easy"
long_description = """
@@ -7,7 +7,7 @@
"""
author = "Christophe de Vienne"
-email = "cdevienne@gmail.com"
+email = "python-wsme@googlegroups.com"
url = "http://bitbucket.org/cdevienne/wsm... |
49263d5e43be6ab9a5c3faf2ee6478840526cccb | flatten-array/flatten_array.py | flatten-array/flatten_array.py | def flatten(lst):
"""Completely flatten an arbitrarily-deep list"""
return [*_flatten(lst)]
def _flatten(lst):
"""Generator for flattening arbitrarily-deep lists"""
if isinstance(lst, (list, tuple)):
for item in lst:
if item is None:
continue
else:
... | def flatten(lst):
"""Completely flatten an arbitrarily-deep list"""
return [*_flatten(lst)]
def _flatten(lst):
"""Generator for flattening arbitrarily-deep lists"""
for item in lst:
if isinstance(item, (list, tuple)):
yield from _flatten(item)
elif item is not None:
... | Tidy and simplify generator code | Tidy and simplify generator code
| Python | agpl-3.0 | CubicComet/exercism-python-solutions | ---
+++
@@ -5,11 +5,8 @@
def _flatten(lst):
"""Generator for flattening arbitrarily-deep lists"""
- if isinstance(lst, (list, tuple)):
- for item in lst:
- if item is None:
- continue
- else:
- yield from _flatten(item)
- else:
- yield ls... |
614ab31af817fa9775fe2aa904687456656bf6fc | tags/fields.py | tags/fields.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.db.models.fields import CharField
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from tags.models import Tag
@python_2_unicode_compatible
class TagField(CharField):
def __init__(self,
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.db.models.fields import CharField
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from tags.models import Tag
@python_2_unicode_compatible
class TagField(CharField):
def __init__(self,
... | Set except import error on add introspection rules south | Set except import error on add introspection rules south
| Python | mit | avelino/django-tags | ---
+++
@@ -40,6 +40,6 @@
try:
from south.modelsinspector import add_introspection_rules
add_introspection_rules([], ["^tags\.fields\.TagField"])
-except:
+except ImportError:
pass
|
8934730ac2702d2c88d96ed8bb015f7c6e65566b | js2xml/__init__.py | js2xml/__init__.py | import lxml.etree
from js2xml.parser import CustomParser as Parser
from js2xml.xmlvisitor import XmlVisitor
_parser = Parser()
_visitor = XmlVisitor()
def parse(text, encoding="utf8", debug=False):
if encoding not in (None, "utf8"):
text = text.decode(encoding)
tree = _parser.parse(text if not isinsta... | import lxml.etree
from js2xml.parser import CustomParser as Parser
from js2xml.xmlvisitor import XmlVisitor
import js2xml.jsonlike as jsonlike
_parser = Parser()
_visitor = XmlVisitor()
def parse(text, encoding="utf8", debug=False):
if encoding not in (None, "utf8"):
text = text.decode(encoding)
tree ... | Allow js2xml.jsonlike... when importing js2xml only | Allow js2xml.jsonlike... when importing js2xml only
| Python | mit | redapple/js2xml,redapple/js2xml,redapple/js2xml,redapple/js2xml | ---
+++
@@ -1,6 +1,7 @@
import lxml.etree
from js2xml.parser import CustomParser as Parser
from js2xml.xmlvisitor import XmlVisitor
+import js2xml.jsonlike as jsonlike
_parser = Parser()
_visitor = XmlVisitor() |
be03357a9d18a4a6174c075db1fdd786100925aa | lat_lng.py | lat_lng.py | from math import atan, tan, radians
def lat_lng(lat, lng):
"""
Return corrected lat/lng.
Lat: -90 to 90
Lng: -180 to 180
"""
# lat
# if lat > 180: # reduce to value less than 180
# lat = lat - (lat//180)*180
# if lat < -180: # increase to value greater than -180
# ... | from math import atan, tan, radians, degrees
def lat_lng(lat, lng):
"""
Return corrected lat/lng.
Lat: -90 to 90
Lng: -180 to 180
"""
# lat
# if lat > 180: # reduce to value less than 180
# lat = lat - (lat//180)*180
# if lat < -180: # increase to value greater than -180
... | Change output back to degrees. | Change output back to degrees.
| Python | mit | bm5w/lat_lng | ---
+++
@@ -1,4 +1,4 @@
-from math import atan, tan, radians
+from math import atan, tan, radians, degrees
def lat_lng(lat, lng):
@@ -17,6 +17,6 @@
# if lat > 90.0:
# amt_gt_90 = lat - (lat//90)*90
# lat = 90 - amt_gt_90
- lng = -2*atan(1/tan((radians(lng)-180)/2))
+ lng = degrees(-2... |
f16e8d0bd0765e4d4a8e0f917bf0325a772a1a23 | rbm2m/models/record.py | rbm2m/models/record.py | # -*- coding: utf-8 -*-
from sqlalchemy import (Column, Integer, String, DateTime, ForeignKey)
from sqlalchemy.orm import relationship, backref
from .base import Base
class Record(Base):
__tablename__ = 'records'
id = Column(Integer, primary_key=True, autoincrement=False)
genre_id = Column(Integer, Fore... | # -*- coding: utf-8 -*-
from sqlalchemy import (Column, Integer, String, DateTime, ForeignKey)
from sqlalchemy.orm import relationship, backref
from .base import Base
class Record(Base):
__tablename__ = 'records'
id = Column(Integer, primary_key=True, autoincrement=False)
genre_id = Column(Integer, Fore... | Increase description max length to 2500 characters | Increase description max length to 2500 characters
| Python | apache-2.0 | notapresent/rbm2m,notapresent/rbm2m | ---
+++
@@ -14,7 +14,7 @@
artist = Column(String(250), nullable=False)
title = Column(String(250), nullable=False)
label = Column(String(250), nullable=False)
- notes = Column(String(500))
+ notes = Column(String(2500))
grade = Column(String(16), nullable=False)
format = Column(String(2... |
4657ecdf6889684cf83c77f34233d8bd3ba852a2 | tests/events/test_models.py | tests/events/test_models.py | # -*- coding: utf-8 -*-
import pytest
from components.events.models import Event, Performance, Venue
from components.events.factories import (EventFactory, PerformanceFactory,
VenueFactory)
pytestmark = pytest.mark.django_db
class TestEvents:
def test_factory(self):
factory = EventFactory()
... | # -*- coding: utf-8 -*-
import datetime
import pytest
from components.events.models import Event, Performance, Venue
from components.events.factories import (EventFactory, PerformanceFactory,
VenueFactory)
pytestmark = pytest.mark.django_db
class TestEvents:
def test_factory(self):
factory = EventFa... | Test string representations and get_absolute_url() calls. | Test string representations and get_absolute_url() calls.
| Python | apache-2.0 | hello-base/web,hello-base/web,hello-base/web,hello-base/web | ---
+++
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
+import datetime
import pytest
from components.events.models import Event, Performance, Venue
@@ -14,6 +15,11 @@
assert isinstance(factory, Event)
assert 'event' in factory.romanized_name
+ def test_get_absolute_url(self, client):
+ fa... |
dfefb21bd170bf253f0d07dba2931de82ed0b1e8 | tests/conftest.py | tests/conftest.py | import os.path
import pytest
def pytest_collection_modifyitems(items):
for item in items:
module_path = os.path.relpath(
item.module.__file__,
os.path.commonprefix([__file__, item.module.__file__]),
)
module_root_dir = module_path.split(os.sep)[0]
if modul... | import os.path
import pytest
@pytest.yield_fixture
def tmpdir(request, tmpdir):
try:
yield tmpdir
finally:
tmpdir.remove(ignore_errors=True)
def pytest_collection_modifyitems(items):
for item in items:
module_path = os.path.relpath(
item.module.__file__,
... | Fix tmpdir fixture to remove all the sutff (normally it keeps the last 3, which is a lot). | Fix tmpdir fixture to remove all the sutff (normally it keeps the last 3, which is a lot).
| Python | mit | ionelmc/virtualenv,ionelmc/virtualenv,ionelmc/virtualenv | ---
+++
@@ -1,6 +1,14 @@
import os.path
import pytest
+
+
+@pytest.yield_fixture
+def tmpdir(request, tmpdir):
+ try:
+ yield tmpdir
+ finally:
+ tmpdir.remove(ignore_errors=True)
def pytest_collection_modifyitems(items): |
34754e91a398e35f0e7d16bbd591c5b4a496536a | src/commons.py | src/commons.py |
from contextlib import contextmanager
from sympy import Eq, Lambda, Function, Indexed
def define(let, be, **kwds):
return Eq(let, be, **kwds)
@contextmanager
def lift_to_Lambda(eq, return_eq=False, lhs_handler=lambda args: []):
lhs = eq.lhs
args = (lhs.args[1:] if isinstance(lhs, Indexed) else
... | from contextlib import contextmanager, redirect_stdout
from sympy import Eq, Lambda, Function, Indexed, latex
def define(let, be, **kwds):
return Eq(let, be, **kwds)
@contextmanager
def lift_to_Lambda(eq, return_eq=False, lhs_handler=lambda args: []):
lhs = eq.lhs
args = (lhs.args[1:] if isinstance(lhs, ... | Add a definition about saving latex representation of a term in a file capturing `print` stdout. | Add a definition about saving latex representation of a term in a file capturing `print` stdout.
| Python | mit | massimo-nocentini/simulation-methods,massimo-nocentini/simulation-methods | ---
+++
@@ -1,7 +1,6 @@
+from contextlib import contextmanager, redirect_stdout
-from contextlib import contextmanager
-
-from sympy import Eq, Lambda, Function, Indexed
+from sympy import Eq, Lambda, Function, Indexed, latex
def define(let, be, **kwds):
return Eq(let, be, **kwds)
@@ -13,3 +12,9 @@
... |
c33e9cbf0f08c4ec93c9aeea899d93ac257b9bea | sysrev/tests.py | sysrev/tests.py | from django.test import TestCase
from api import PubMed
from sysrev.models import Review
class PubmedQueryTestCase(TestCase):
def test_query(self):
result = PubMed.query("smoking")
self.assertGreater(result[u'Count'], 25000, "Expected >25000 results for smoking")
def test_paper(self):
... | from django.test import TestCase
from api import PubMed
from sysrev.models import Review
class PubmedQueryTestCase(TestCase):
def test_query(self):
result = PubMed.query("smoking")
self.assertGreater(result[u'Count'], 25000, "Expected >25000 results for smoking")
def test_paper(self):
... | Add (failing) test for ADHD query. Returns results on site, not through API. Needs investigation | Add (failing) test for ADHD query. Returns results on site, not through API. Needs investigation
| Python | mit | iliawnek/SystematicReview,iliawnek/SystematicReview,iliawnek/SystematicReview,iliawnek/SystematicReview | ---
+++
@@ -22,3 +22,8 @@
print result.title
self.assertEquals("[A Meta-analysis on Acupuncture Treatment of Attention Deficit/Hyperactivity Disorder].",
result.title)
+
+ def test_adhd_query(self):
+ query = """(adhd OR adhs OR addh) AND (child OR adolescent) AN... |
8922e6ff0570fc3b073746b01e6ee1d963315448 | udger/__init__.py | udger/__init__.py | from .parser import Udger
__version__ = '4.0.1'
__all__ = ['Udger']
| from .parser import Udger
__version__ = '4.0.2'
__all__ = ['Udger']
| Allow MutableMapping for python >= 3.10 | Allow MutableMapping for python >= 3.10
| Python | mit | udger/udger-python | ---
+++
@@ -1,5 +1,5 @@
from .parser import Udger
-__version__ = '4.0.1'
+__version__ = '4.0.2'
__all__ = ['Udger'] |
f2396815912b1698c4969d86d1f4176122489222 | taemin/plugin.py | taemin/plugin.py | """ Base class for all taemin plugin """
class TaeminPlugin(object):
helper = {}
def __init__(self, taemin):
self.taemin = taemin
def start(self):
pass
def stop(self):
pass
def on_join(self, connection):
pass
def on_pubmsg(self, msg):
pass
def o... | """ Base class for all taemin plugin """
import itertools
MAX_MSG_LENGTH = 400
class TaeminPlugin(object):
helper = {}
def __init__(self, taemin):
self.taemin = taemin
def start(self):
pass
def stop(self):
pass
def on_join(self, connection):
pass
def on_pu... | Split privmsg if their are too long | Split privmsg if their are too long
| Python | mit | ningirsu/taemin,ningirsu/taemin | ---
+++
@@ -1,4 +1,8 @@
""" Base class for all taemin plugin """
+
+import itertools
+
+MAX_MSG_LENGTH = 400
class TaeminPlugin(object):
helper = {}
@@ -30,12 +34,17 @@
def privmsg(self, chan, msg):
""" Send a message to a chan or an user """
+ if not msg:
+ return
+
... |
6c93bfc862ceb598747531dc5aef4f9445162e68 | src/config/api-server/setup.py | src/config/api-server/setup.py | #
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
from setuptools import setup
setup(
name='vnc_cfg_api_server',
version='0.1dev',
packages=[
'vnc_cfg_api_server',
'vnc_cfg_api_server.gen',
],
package_data={'': ['*.html', '*.css', '*.xml']},
zip_safe=False,
... | #
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
from setuptools import setup
setup(
name='vnc_cfg_api_server',
version='0.1dev',
packages=[
'vnc_cfg_api_server',
'vnc_cfg_api_server.gen',
],
package_data={'': ['*.html', '*.css', '*.xml']},
zip_safe=False,
... | Remove strong dependency to geventhttpclient>=1.0a | [geventhttpclient] Remove strong dependency to geventhttpclient>=1.0a
We can remove the strong dependency on 1.0a, Deepinder Setia manage this
fix in https://bugs.launchpad.net/opencontrail/+bug/1306715
Refs: http://lists.opencontrail.org/pipermail/dev_lists.opencontrail.org/2014-April/000930.html
And already merged... | Python | apache-2.0 | reiaaoyama/contrail-controller,nischalsheth/contrail-controller,rombie/contrail-controller,cloudwatt/contrail-controller,sajuptpm/contrail-controller,tcpcloud/contrail-controller,cloudwatt/contrail-controller,Juniper/contrail-dev-controller,DreamLab/contrail-controller,DreamLab/contrail-controller,srajag/contrail-contr... | ---
+++
@@ -16,7 +16,7 @@
install_requires=[
'lxml>=2.3.2',
'gevent==0.13.6',
- 'geventhttpclient==1.0a',
+ 'geventhttpclient>=1.0a',
'pycassa>=1.7.2',
'netaddr>=0.7.5',
'bitarray==0.8.0', |
c52a39b8a89e1fc8bfe607d2bfa92970d7ae17ad | evelink/parsing/assets.py | evelink/parsing/assets.py | from evelink import api
from evelink import constants
def parse_assets(api_result):
def handle_rowset(rowset, parent_location):
results = []
for row in rowset.findall('row'):
item = {'id': int(row.attrib['itemID']),
'item_type_id': int(row.attrib['typeID']),
... | from evelink import api
from evelink import constants
def parse_assets(api_result):
def handle_rowset(rowset, parent_location):
results = []
for row in rowset.findall('row'):
item = {'id': int(row.attrib['itemID']),
'item_type_id': int(row.attrib['typeID']),
... | Fix test involving Element object | Fix test involving Element object
| Python | mit | zigdon/evelink,FashtimeDotCom/evelink,Morloth1274/EVE-Online-POCO-manager,ayust/evelink,bastianh/evelink | ---
+++
@@ -13,7 +13,7 @@
'packaged': row.attrib['singleton'] == '0',
}
contents = row.find('rowset')
- if contents:
+ if contents is not None:
item['contents'] = handle_rowset(contents, item['location_id'])
results.app... |
07999d1f24acbbfde50fe94897054e7c8df7fea1 | api/jsonstore.py | api/jsonstore.py | import json
import os
import tempfile
def store(data, directory="/var/www/luke/wikipedia/graphs/"):
try:
json.loads(data)
except ValueError:
return "not-json"
tf = tempfile.mkstemp(prefix="", dir=directory)[1]
with open(tf, "w") as f:
f.write(data)
return tf
if __name__ ... | import json
import os
import tempfile
def store(data, directory="/var/www/luke/wikipedia/graphs/"):
try:
json.loads(data)
except ValueError:
return "not-json"
tf = tempfile.mkstemp(prefix="", dir=directory)[1]
with open(tf, "w") as f:
f.write(data)
return os.path.split(tf... | Tweak JSON api return value to be friendlier | Tweak JSON api return value to be friendlier
| Python | mit | controversial/wikipedia-map,controversial/wikipedia-map,controversial/wikipedia-map | ---
+++
@@ -13,7 +13,7 @@
with open(tf, "w") as f:
f.write(data)
- return tf
+ return os.path.split(tf)[1]
if __name__ == "__main__":
print(store('{}')) |
56e3225329d2f7fae37139ec1d6727784718d339 | test_portend.py | test_portend.py | import socket
import pytest
import portend
def socket_infos():
"""
Generate addr infos for connections to localhost
"""
host = None
port = portend.find_available_local_port()
family = socket.AF_UNSPEC
socktype = socket.SOCK_STREAM
return socket.getaddrinfo(host, port, family, socktype)
def id_for_info(inf... | import socket
import pytest
import portend
def socket_infos():
"""
Generate addr infos for connections to localhost
"""
host = None # all available interfaces
port = portend.find_available_local_port()
family = socket.AF_UNSPEC
socktype = socket.SOCK_STREAM
return socket.getaddrinfo(host, port, family, soc... | Add indication of what None means | Add indication of what None means
| Python | mit | jaraco/portend | ---
+++
@@ -9,7 +9,7 @@
"""
Generate addr infos for connections to localhost
"""
- host = None
+ host = None # all available interfaces
port = portend.find_available_local_port()
family = socket.AF_UNSPEC
socktype = socket.SOCK_STREAM |
6bb3321c0a2e4221d08f39e46e1d21220361cdc6 | shuup_tests/api/conftest.py | shuup_tests/api/conftest.py | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2018, Shuup Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django.conf import settings
def pytest_runtest_setup(item):
sett... | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2018, Shuup Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django.conf import settings
ORIGINAL_SETTINGS = []
def pytest_runt... | Fix unit test by adding back front apps after API tests | Fix unit test by adding back front apps after API tests
| Python | agpl-3.0 | shoopio/shoop,shoopio/shoop,shoopio/shoop | ---
+++
@@ -8,5 +8,14 @@
from django.conf import settings
+ORIGINAL_SETTINGS = []
+
+
def pytest_runtest_setup(item):
+ global ORIGINAL_SETTINGS
+ ORIGINAL_SETTINGS = [item for item in settings.INSTALLED_APPS]
settings.INSTALLED_APPS = [app for app in settings.INSTALLED_APPS if "shuup.front" not in a... |
de4df4feb7f38577bb3db8852610398ecc238870 | stella/llvm.py | stella/llvm.py | from llvm import *
from llvm.core import *
from llvm.ee import *
import logging
tp_int = Type.int()
tp_float = Type.float()
def py_type_to_llvm(tp):
if tp == int:
return tp_int
elif tp == float:
return tp_float
else:
raise TypeError("Unknown type " + tp)
def get_generic_value(tp, ... | from llvm import *
from llvm.core import *
from llvm.ee import *
import logging
tp_int = Type.int(64)
tp_float = Type.float()
def py_type_to_llvm(tp):
if tp == int:
return tp_int
elif tp == float:
return tp_float
else:
raise TypeError("Unknown type " + tp)
def get_generic_value(tp... | Change types to get the tests to complete. | Change types to get the tests to complete.
| Python | apache-2.0 | squisher/stella,squisher/stella,squisher/stella,squisher/stella | ---
+++
@@ -4,7 +4,7 @@
import logging
-tp_int = Type.int()
+tp_int = Type.int(64)
tp_float = Type.float()
def py_type_to_llvm(tp):
if tp == int:
@@ -22,7 +22,7 @@
def llvm_to_py(tp, val):
if tp == int:
- return val.as_int()
+ return val.as_int_signed()
elif tp == float:
... |
46ea832db6db8a98c5b9f5a58a37bfed16a27a10 | app/actions/peptable/base.py | app/actions/peptable/base.py | from app.dataformats import peptable as peptabledata
from app.dataformats import mzidtsv as psmtsvdata
def add_peptide(allpeps, psm, scorecol=False, fncol=None, new=False,
track_psms=True):
peptide = {'score': psm[scorecol],
'line': psm,
'psms': []
}
... | from app.dataformats import mzidtsv as psmtsvdata
def add_peptide(allpeps, psm, key, scorecol=False, fncol=None, new=False,
track_psms=True):
peptide = {'score': psm[scorecol],
'line': psm,
'psms': []
}
if track_psms:
if not new:
... | Use input param key instead of using HEADER field | Use input param key instead of using HEADER field
| Python | mit | glormph/msstitch | ---
+++
@@ -1,8 +1,7 @@
-from app.dataformats import peptable as peptabledata
from app.dataformats import mzidtsv as psmtsvdata
-def add_peptide(allpeps, psm, scorecol=False, fncol=None, new=False,
+def add_peptide(allpeps, psm, key, scorecol=False, fncol=None, new=False,
track_psms=True):
... |
02f7edc042b46f091663fc12451aa043106f4f38 | correctiv_justizgelder/urls.py | correctiv_justizgelder/urls.py | from functools import wraps
from django.conf.urls import patterns, url
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.cache import cache_page
from .views import OrganisationSearchView, OrganisationDetail
CACHE_TIME = 15 * 60
def c(view):
@wraps(view)
def cache_page_ano... | from functools import wraps
from django.conf.urls import url
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.cache import cache_page
from .views import OrganisationSearchView, OrganisationDetail
CACHE_TIME = 15 * 60
def c(view):
@wraps(view)
def cache_page_anonymous(req... | Update urlpatterns and remove old patterns pattern | Update urlpatterns and remove old patterns pattern | Python | mit | correctiv/correctiv-justizgelder,correctiv/correctiv-justizgelder | ---
+++
@@ -1,6 +1,6 @@
from functools import wraps
-from django.conf.urls import patterns, url
+from django.conf.urls import url
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.cache import cache_page
@@ -18,9 +18,9 @@
return cache_page_anonymous
-urlpatterns = pa... |
db9703ef5cb277e4556d94503c581cbdf46a8419 | api/addons/serializers.py | api/addons/serializers.py | from rest_framework import serializers as ser
from api.base.serializers import JSONAPISerializer, LinksField
from api.base.utils import absolute_reverse
class NodeAddonFolderSerializer(JSONAPISerializer):
"""
Overrides AddonSettingsSerializer to return node-specific fields
"""
class Meta:
type_... | from rest_framework import serializers as ser
from api.base.serializers import JSONAPISerializer, LinksField
from api.base.utils import absolute_reverse
class NodeAddonFolderSerializer(JSONAPISerializer):
class Meta:
type_ = 'node_addon_folders'
id = ser.CharField(source='provider', read_only=True)
... | Remove other docstring of lies | Remove other docstring of lies
| Python | apache-2.0 | chennan47/osf.io,CenterForOpenScience/osf.io,pattisdr/osf.io,brianjgeiger/osf.io,HalcyonChimera/osf.io,alexschiller/osf.io,saradbowman/osf.io,chrisseto/osf.io,cwisecarver/osf.io,acshi/osf.io,monikagrabowska/osf.io,Johnetordoff/osf.io,Nesiehr/osf.io,mluo613/osf.io,adlius/osf.io,sloria/osf.io,icereval/osf.io,adlius/osf.i... | ---
+++
@@ -3,9 +3,6 @@
from api.base.utils import absolute_reverse
class NodeAddonFolderSerializer(JSONAPISerializer):
- """
- Overrides AddonSettingsSerializer to return node-specific fields
- """
class Meta:
type_ = 'node_addon_folders'
|
f64582d7b254e5b4861a0d06ea40f9e608e3cc30 | modules/urlparser/twitter.py | modules/urlparser/twitter.py | import re
import urllib2
import traceback
try:
import simplejson as json
except ImportError:
import json
class Twitter(object):
"""Checks incoming messages for Twitter urls and calls the Twitter API to
retrieve the tweet.
TODO:
Implement commands for Twitter functionality
"""
pa... | import re
import urllib2
import traceback
try:
import simplejson as json
except ImportError:
import json
class Twitter(object):
"""Checks incoming messages for Twitter urls and calls the Twitter API to
retrieve the tweet.
TODO:
Implement commands for Twitter functionality
"""
pa... | Change regex, added some non-catching groups | Change regex, added some non-catching groups
| Python | mit | billyvg/piebot | ---
+++
@@ -15,7 +15,7 @@
Implement commands for Twitter functionality
"""
- pattern = re.compile("http(s|)://(www\.|)twitter.com/(?:#!/|)[^/]+/status/([0-9]+)")
+ pattern = re.compile("http(?:s|)://(?:mobile\.|)(?:www\.|)twitter.com/(?:#!/|)[^/]+/status/([0-9]+)")
def __init__(self, *arg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.