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 |
|---|---|---|---|---|---|---|---|---|---|---|
91229ab93609f66af866f7ef87b576a84546aeab | api/base/parsers.py | api/base/parsers.py | from rest_framework.parsers import JSONParser
from api.base.renderers import JSONAPIRenderer
from api.base.exceptions import JSONAPIException
class JSONAPIParser(JSONParser):
"""
Parses JSON-serialized data. Overrides media_type.
"""
media_type = 'application/vnd.api+json'
renderer_class = JSONAPI... | from rest_framework.parsers import JSONParser
from rest_framework.exceptions import ParseError
from api.base.renderers import JSONAPIRenderer
from api.base.exceptions import JSONAPIException
class JSONAPIParser(JSONParser):
"""
Parses JSON-serialized data. Overrides media_type.
"""
media_type = 'appli... | Raise Parse Error if request data is not a dictionary | Raise Parse Error if request data is not a dictionary
| Python | apache-2.0 | mluo613/osf.io,adlius/osf.io,alexschiller/osf.io,samanehsan/osf.io,doublebits/osf.io,Ghalko/osf.io,rdhyee/osf.io,GageGaskins/osf.io,erinspace/osf.io,samanehsan/osf.io,caneruguz/osf.io,HalcyonChimera/osf.io,amyshi188/osf.io,doublebits/osf.io,caseyrygt/osf.io,adlius/osf.io,caneruguz/osf.io,kwierman/osf.io,erinspace/osf.i... | ---
+++
@@ -1,4 +1,5 @@
from rest_framework.parsers import JSONParser
+from rest_framework.exceptions import ParseError
from api.base.renderers import JSONAPIRenderer
from api.base.exceptions import JSONAPIException
@@ -15,16 +16,18 @@
Parses the incoming bytestream as JSON and returns the resulting dat... |
bdbff5ea5548067713951a85b05f3818e537c8d4 | streamparse/bootstrap/project/src/bolts/wordcount.py | streamparse/bootstrap/project/src/bolts/wordcount.py | from __future__ import absolute_import, print_function, unicode_literals
from collections import Counter
from streamparse.bolt import Bolt
class WordCounter(Bolt):
def initialize(self, conf, ctx):
self.counts = Counter()
def process(self, tup):
word = tup.values[0]
self.counts[word] ... | from __future__ import absolute_import, print_function, unicode_literals
from collections import Counter
from streamparse.bolt import Bolt
class WordCounter(Bolt):
AUTO_ACK = True # automatically acknowledge tuples after process()
AUTO_ANCHOR = True # automatically anchor tuples to current tuple
AUTO_... | Update quickstart project to use AUTO_* | Update quickstart project to use AUTO_*
| Python | apache-2.0 | crohling/streamparse,petchat/streamparse,petchat/streamparse,eric7j/streamparse,msmakhlouf/streamparse,codywilbourn/streamparse,Parsely/streamparse,codywilbourn/streamparse,msmakhlouf/streamparse,scrapinghub/streamparse,Parsely/streamparse,petchat/streamparse,phanib4u/streamparse,petchat/streamparse,scrapinghub/streamp... | ---
+++
@@ -3,7 +3,12 @@
from collections import Counter
from streamparse.bolt import Bolt
+
class WordCounter(Bolt):
+
+ AUTO_ACK = True # automatically acknowledge tuples after process()
+ AUTO_ANCHOR = True # automatically anchor tuples to current tuple
+ AUTO_FAIL = True # automatically fail tupl... |
95988fc4e5d7b5b5fa3235000ad9680c168c485c | aiospamc/__init__.py | aiospamc/__init__.py | #!/usr/bin/env python3
'''aiospamc package.
An asyncio-based library to communicate with SpamAssassin's SPAMD service.'''
from aiospamc.client import Client
__all__ = ('Client',
'MessageClassOption',
'ActionOption')
__author__ = 'Michael Caley'
__copyright__ = 'Copyright 2016, 2017 Michael Ca... | #!/usr/bin/env python3
'''aiospamc package.
An asyncio-based library to communicate with SpamAssassin's SPAMD service.'''
from aiospamc.client import Client
from aiospamc.options import ActionOption, MessageClassOption
__all__ = ('Client',
'MessageClassOption',
'ActionOption')
__author__ = 'M... | Add import ActionOption and MessageClassOption to __all__ | Add import ActionOption and MessageClassOption to __all__
| Python | mit | mjcaley/aiospamc | ---
+++
@@ -5,6 +5,7 @@
An asyncio-based library to communicate with SpamAssassin's SPAMD service.'''
from aiospamc.client import Client
+from aiospamc.options import ActionOption, MessageClassOption
__all__ = ('Client',
'MessageClassOption', |
f1793ed8a494701271b4a4baff8616e9c6202e80 | message_view.py | message_view.py | import sublime
import sublime_plugin
PANEL_NAME = "SublimeLinter Messages"
OUTPUT_PANEL = "output." + PANEL_NAME
def plugin_unloaded():
for window in sublime.windows():
window.destroy_output_panel(PANEL_NAME)
class SublimeLinterDisplayPanelCommand(sublime_plugin.WindowCommand):
def run(self, msg=""... | import sublime
import sublime_plugin
PANEL_NAME = "SublimeLinter Messages"
OUTPUT_PANEL = "output." + PANEL_NAME
def plugin_unloaded():
for window in sublime.windows():
window.destroy_output_panel(PANEL_NAME)
class SublimeLinterDisplayPanelCommand(sublime_plugin.WindowCommand):
def run(self, msg=""... | Append messages if message view is currently open | Append messages if message view is currently open
| Python | mit | SublimeLinter/SublimeLinter3,SublimeLinter/SublimeLinter3 | ---
+++
@@ -12,14 +12,27 @@
class SublimeLinterDisplayPanelCommand(sublime_plugin.WindowCommand):
def run(self, msg=""):
- panel_view = self.window.create_output_panel(PANEL_NAME)
+ window = self.window
+
+ if is_panel_active(window):
+ panel_view = window.find_output_panel(PAN... |
4803578ebb306e2e142b629d98cb82899c0b0270 | authorize/__init__.py | authorize/__init__.py | import xml.etree.ElementTree as E
from authorize.configuration import Configuration
from authorize.address import Address
from authorize.bank_account import BankAccount
from authorize.batch import Batch
from authorize.credit_card import CreditCard
from authorize.customer import Customer
from authorize.environment impo... | import xml.etree.ElementTree as E
from authorize.configuration import Configuration
from authorize.address import Address
from authorize.bank_account import BankAccount
from authorize.batch import Batch
from authorize.credit_card import CreditCard
from authorize.customer import Customer
from authorize.environment impo... | Fix monkey patching to pass kwargs required by Python 3.4 | Fix monkey patching to pass kwargs required by Python 3.4
| Python | mit | aryeh/py-authorize,uglycitrus/py-authorize,vcatalano/py-authorize | ---
+++
@@ -17,9 +17,9 @@
# Monkeypatch the ElementTree module so that we can use CDATA element types
E._original_serialize_xml = E._serialize_xml
-def _serialize_xml(write, elem, *args):
+def _serialize_xml(write, elem, *args, **kwargs):
if elem.tag == '![CDATA[':
write('<![CDATA[%s]]>' % elem.text... |
052a29030c0665f5724b0fe83550ce7d81202002 | incuna_test_utils/testcases/urls.py | incuna_test_utils/testcases/urls.py | import warnings
from django.core.urlresolvers import resolve, reverse
from django.test import TestCase
class URLTestMixin(object):
def assert_url_matches_view(self, view, expected_url, url_name,
url_args=None, url_kwargs=None):
"""
Assert a view's url is correctly ... | import warnings
from django.core.urlresolvers import resolve, reverse
from django.test import TestCase
class URLTestMixin(object):
def assert_url_matches_view(self, view, expected_url, url_name,
url_args=None, url_kwargs=None):
"""
Assert a view's url is correctly ... | Fix check for cls attribute | Fix check for cls attribute
* If resolved_view has a cls attribute then view should already be a
class.
| Python | bsd-2-clause | incuna/incuna-test-utils,incuna/incuna-test-utils | ---
+++
@@ -19,7 +19,7 @@
resolved_view = resolve(expected_url).func
- if hasattr(view, 'cls'):
+ if hasattr(resolved_view, 'cls'):
self.assertEqual(resolved_view.cls, view)
else:
self.assertEqual(resolved_view.__name__, view.__name__) |
e8dd4ca8bd51b84d5d7d5a6a1c4144475e066bf1 | zabbix.py | zabbix.py | import requests
class Api(object):
def __init__(self, server='http://localhost/zabbix'):
self.session = requests.Session()
self.session.headers.update({
'Content-Type': 'application/json'
})
self.url = server + '/api_jsonrpc.php'
self.auth = ''
self.id = ... | import requests
class ZabbixError(Exception):
pass
class Api(object):
def __init__(self, server='http://localhost/zabbix'):
self.session = requests.Session()
self.session.headers.update({
'Content-Type': 'application/json'
})
self.url = server + '/api_jsonrpc.php'
... | Create do_requestion function to be used by other methods. | Create do_requestion function to be used by other methods.
| Python | apache-2.0 | supasate/PythonZabbixApi | ---
+++
@@ -1,4 +1,7 @@
import requests
+
+class ZabbixError(Exception):
+ pass
class Api(object):
def __init__(self, server='http://localhost/zabbix'):
@@ -10,3 +13,21 @@
self.auth = ''
self.id = 0
+ def do_request(self, method, params=None):
+ json_payload = {
+ ... |
1b20116059b21905688b7fd6153ecd7c42bdc4a1 | parseSAMOutput.py | parseSAMOutput.py | #!python
# Load libraries
import sys, getopt
import pysam
import libPipeline
# Set constants
helpMsg ='''
SYNOPSIS
parseSAMOutput
parseSAMOutput [OPTIONS] SAMFILE
#
DESCRIPTION
parseSAMOutput.py
Parses SAM alignments into paired-end read summaries.
Prints results to stdout.
OPTIONS
--rmdup Rem... | #!python
# Load libraries
import sys, getopt
import pysam
import libPipeline
# Set constants
helpMsg ='''
SYNOPSIS
parseSAMOutput
parseSAMOutput [OPTIONS] SAMFILE
#
DESCRIPTION
parseSAMOutput.py
Parses SAM alignments into paired-end read summaries.
Prints results to stdout.
OPTIONS
--rmdup Rem... | Fix rmdup handling in wrapper script. | Fix rmdup handling in wrapper script.
| Python | apache-2.0 | awblocker/paired-end-pipeline,awblocker/paired-end-pipeline | ---
+++
@@ -48,5 +48,5 @@
print >> sys.stderr, "Error -- need path to SAM file"
sys.exit(1)
- libPipeline.processSAMOutput(alignmentPath, sys.stdout)
+ libPipeline.processSAMOutput(alignmentPath, sys.stdout, rmdup=rmdup)
|
ddf0ff2c72a8026c6cf90bc51b1c9fc8d68a003f | apicore/oasschema.py | apicore/oasschema.py | import jsonschema
def validate(data, schema):
try:
jsonschema.validate(data, schema)
except jsonschema.exceptions.ValidationError:
return False
if schema["type"] == "object":
allowed = list(schema["properties"].keys())
for key in data.keys():
if key not in allo... | import jsonschema
def validate(data, schema):
try:
jsonschema.validate(data, schema)
except jsonschema.exceptions.ValidationError:
return False
# TODO if $ref or
if "type" in schema and schema["type"] == "object":
allowed = list(schema["properties"].keys())
for key in ... | FIX schema type not object | FIX schema type not object
| Python | mit | meezio/apicore,meezio/apicore | ---
+++
@@ -7,7 +7,8 @@
except jsonschema.exceptions.ValidationError:
return False
- if schema["type"] == "object":
+ # TODO if $ref or
+ if "type" in schema and schema["type"] == "object":
allowed = list(schema["properties"].keys())
for key in data.keys():
if k... |
613a6f7947b46b9a6c4c679b638d1c4d946b644d | neutron/conf/policies/network_ip_availability.py | neutron/conf/policies/network_ip_availability.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed u... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed u... | Implement secure RBAC for the network IP availability | Implement secure RBAC for the network IP availability
This commit updates the network IP availability policies to understand scope
checking and account for a read-only role. This is part of a broader series of
changes across OpenStack to provide a consistent RBAC experience and improve
security.
Change-Id: Ia965e549e... | Python | apache-2.0 | openstack/neutron,mahak/neutron,mahak/neutron,mahak/neutron,openstack/neutron,openstack/neutron | ---
+++
@@ -10,17 +10,23 @@
# License for the specific language governing permissions and limitations
# under the License.
+from oslo_log import versionutils
from oslo_policy import policy
from neutron.conf.policies import base
+DEPRECATED_REASON = """
+The network IP availability API now support system s... |
3f9623766b58c02b21abb967315bfe30a2b3974f | tests/TestTransaction.py | tests/TestTransaction.py | import Transaction
import unittest
class TestTransaction(unittest.TestCase) :
def setUp(self) :
self.test_object = Transaction.Transaction()
def tearDown(self) :
pass
def test_not_None(self) :
self.assertIsNotNone(self.test_object)
def test_can_assign_data(self) :
s... | import Transaction
import unittest
class TestTransaction(unittest.TestCase) :
def setUp(self) :
self.test_object = Transaction.Transaction()
def tearDown(self) :
pass
def test_not_None(self) :
self.assertIsNotNone(self.test_object)
def test_can_assign_data(self) :
s... | Add test to clarify equality/is behavior | Add test to clarify equality/is behavior
| Python | apache-2.0 | mattdeckard/wherewithal | ---
+++
@@ -17,3 +17,22 @@
self.test_object['foo'] = 'bar'
self.assertIn('foo', self.test_object)
self.assertEqual(self.test_object['foo'], 'bar')
+
+ def test_different_transactions_are_not_each_other(self) :
+ emptyTransaction = Transaction.Transaction()
+ self.assertIsNo... |
2728f33a0c8477d75b3716ea39fe2e3c8db9378d | tests/test_OrderedSet.py | tests/test_OrderedSet.py | from twisted.trial import unittest
from better_od import OrderedSet
class TestOrderedSet(unittest.TestCase):
def setUp(self):
self.values = 'abcddefg'
self.s = OrderedSet(self.values)
def test_order(self):
expected = list(enumerate('abcdefg'))
self.assertEquals(list(enumerate... | from twisted.trial import unittest
from better_od import OrderedSet
class TestOrderedSet(unittest.TestCase):
def setUp(self):
self.s = OrderedSet('abcdefg')
def test_order(self):
expected = list(enumerate('abcdefg'))
self.assertEquals(list(enumerate(self.s)), expected)
def test_... | Add OrderedSet mutation tests. Refactor tests. | Add OrderedSet mutation tests. Refactor tests.
Refactored the tests to rely less on setUp because I've got to test
mutating the objects.
| Python | mit | JustusW/BetterOrderedDict,therealfakemoot/collections2 | ---
+++
@@ -5,12 +5,16 @@
class TestOrderedSet(unittest.TestCase):
def setUp(self):
- self.values = 'abcddefg'
- self.s = OrderedSet(self.values)
+ self.s = OrderedSet('abcdefg')
def test_order(self):
expected = list(enumerate('abcdefg'))
self.assertEquals(list(en... |
756860e325edd06eb98bed7c6fd5fa6c4a78243e | tests/test_migrations.py | tests/test_migrations.py | """
Tests that migrations are not missing
"""
try:
from io import StringIO
except ImportError:
from StringIO import StringIO
import pytest
from django.core.management import call_command
def test_no_missing_migrations():
"""Check no model changes have been made since the last `./manage.py makemigration... | """
Tests that migrations are not missing
"""
try:
from io import StringIO
except ImportError:
from StringIO import StringIO
import pytest
from django.core.management import call_command
@pytest.mark.django_db
def test_no_missing_migrations():
"""Check no model changes have been made since the last `./... | Add missing pytest DB marker | Add missing pytest DB marker
| Python | bsd-2-clause | bennylope/django-organizations,bennylope/django-organizations | ---
+++
@@ -12,6 +12,7 @@
from django.core.management import call_command
+@pytest.mark.django_db
def test_no_missing_migrations():
"""Check no model changes have been made since the last `./manage.py makemigrations`.
|
d4003a3b07e4ead9bccbc6a9c8ff835970ad99a3 | pymatgen/core/design_patterns.py | pymatgen/core/design_patterns.py | # coding: utf-8
from __future__ import division, unicode_literals
"""
This module defines some useful design patterns.
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.com"
__status__ = "Producti... | # coding: utf-8
from __future__ import division, unicode_literals
"""
This module defines some useful design patterns.
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.com"
__status__ = "Producti... | Move NullFile and NullStream to monty | Move NullFile and NullStream to monty
Former-commit-id: 5492c3519fdfc444fd8cbb92cbf4b9c67c8a0883 [formerly 4aa6714284cb45a2747cea8e0f38e8fbcd8ec0bc]
Former-commit-id: e6119512027c605a8277d0a99f37a6ab0d73b6c7 | Python | mit | xhqu1981/pymatgen,tallakahath/pymatgen,fraricci/pymatgen,aykol/pymatgen,mbkumar/pymatgen,ndardenne/pymatgen,czhengsci/pymatgen,blondegeek/pymatgen,czhengsci/pymatgen,czhengsci/pymatgen,gVallverdu/pymatgen,nisse3000/pymatgen,dongsenfo/pymatgen,aykol/pymatgen,johnson1228/pymatgen,montoyjh/pymatgen,gpetretto/pymatgen,Bism... | ---
+++
@@ -25,19 +25,3 @@
return name
raise AttributeError
-
-class NullFile(object):
- """A file object that is associated to /dev/null."""
- def __new__(cls):
- import os
- return open(os.devnull, 'w')
-
- def __init__(self):
- """no-op"""
-
-
-class NullStream... |
e69a23abc438b1f527cf9247bc210874eb227253 | pyshelf/artifact_list_manager.py | pyshelf/artifact_list_manager.py | from pyshelf.cloud.stream_iterator import StreamIterator
from flask import Response
class ArtifactListManager(object):
def __init__(self, container):
self.container = container
def get_artifact(self, path):
"""
Gets artifact or artifact list information.
Args:
... | from pyshelf.cloud.stream_iterator import StreamIterator
from flask import Response
class ArtifactListManager(object):
def __init__(self, container):
self.container = container
def get_artifact(self, path):
"""
Gets artifact or artifact list information.
Args:
... | Fix relative portion of link. | Fix relative portion of link.
| Python | mit | kyle-long/pyshelf,kyle-long/pyshelf,not-nexus/shelf,not-nexus/shelf | ---
+++
@@ -23,11 +23,11 @@
links = []
for child in child_list:
title = child.name
- path = "/artifact/" + title
+ url = "/artifact/" + title
rel = "child"
if child.name == path:
... |
c4903f5b631bba21e17be1b7deb118c0c9571432 | Lab3/PalindromeExercise.py | Lab3/PalindromeExercise.py | # Asks the user for input of the word and makes it lower case.
normStr = raw_input("Enter the word:\n").lower();
# Inverts the string so it can compare it with the original input.
invertStr = normStr[::-1];
| # Asks the user for input of the word and makes it lower case.
normStr = raw_input("Enter the word:\n").lower();
# Inverts the string so it can compare it with the original input.
invertStr = normStr[::-1];
# Tests if the string is a palindrome. If so, it prints True. Else, prints False.
if normStr == invertStr:
pri... | Test added. Program should be complete. | Test added. Program should be complete.
| Python | mit | lgomie/dt228-3B-cloud-repo | ---
+++
@@ -3,3 +3,8 @@
# Inverts the string so it can compare it with the original input.
invertStr = normStr[::-1];
+# Tests if the string is a palindrome. If so, it prints True. Else, prints False.
+if normStr == invertStr:
+ print 'True';
+else:
+ print 'False'; |
98eead2549f4a2793011ffe8107e64530ddbf782 | runtests.py | runtests.py | #!/usr/bin/env python
import sys
from os.path import abspath, dirname
import django
from django.conf import settings
sys.path.insert(0, abspath(dirname(__file__)))
if not settings.configured:
settings.configure(
INSTALLED_APPS=(
'django.contrib.contenttypes',
'django.contrib.ses... | #!/usr/bin/env python
import sys
from os.path import abspath, dirname
import django
from django.conf import settings
sys.path.insert(0, abspath(dirname(__file__)))
if not settings.configured:
settings.configure(
INSTALLED_APPS=(
'django.contrib.contenttypes',
'django.contrib.ses... | Add missing auth middleware for 1.7 tests | Add missing auth middleware for 1.7 tests
| Python | mit | treyhunner/django-relatives,treyhunner/django-relatives | ---
+++
@@ -24,6 +24,10 @@
'ENGINE': 'django.db.backends.sqlite3',
}
},
+ MIDDLEWARE_CLASSES=[
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ ],
ROOT_URLCONF='r... |
de02f354e406e5b9a3f742697d3979d54b9ee581 | fvserver/urls.py | fvserver/urls.py | from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^macnamer/', include('macnamer.foo.urls')),
url(r'^login/$', 'django.contrib.auth.views.login'),... | from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^macnamer/', include('macnamer.foo.urls')),
url(r'^login/$', 'django.contrib.auth.views.login'),
... | Update password functions for Django 1.8 | Update password functions for Django 1.8
| Python | apache-2.0 | grahamgilbert/Crypt-Server,squarit/Crypt-Server,arubdesu/Crypt-Server,grahamgilbert/Crypt-Server,squarit/Crypt-Server,arubdesu/Crypt-Server,squarit/Crypt-Server,arubdesu/Crypt-Server,squarit/Crypt-Server,grahamgilbert/Crypt-Server,grahamgilbert/Crypt-Server | ---
+++
@@ -6,12 +6,12 @@
urlpatterns = patterns('',
# Examples:
-
+
# url(r'^macnamer/', include('macnamer.foo.urls')),
url(r'^login/$', 'django.contrib.auth.views.login'),
url(r'^logout/$', 'django.contrib.auth.views.logout_then_login'),
- url(r'^changepassword/$', 'django.contrib.auth... |
cc8f0760aa5497d2285dc85c6f3c17c6ce327c35 | core/__init__.py | core/__init__.py | # Offer forward compatible imports of datastore_rpc and datastore_query.
import logging
try:
from google.appengine.datastore import datastore_rpc
from google.appengine.datastore import datastore_query
logging.info('Imported official google datastore_{rpc,query}')
except ImportError:
logging.warning('Importing... | # Offer forward compatible imports of datastore_rpc and datastore_query.
import logging
import sys
try:
from google.appengine.datastore import datastore_rpc
from google.appengine.datastore import datastore_query
sys.modules['core.datastore_rpc'] = datastore_rpc
sys.modules['core.datastore_query'] = datastore_... | Make official google imports actually work. | Make official google imports actually work.
| Python | apache-2.0 | GoogleCloudPlatform/datastore-ndb-python,GoogleCloudPlatform/datastore-ndb-python | ---
+++
@@ -1,10 +1,13 @@
# Offer forward compatible imports of datastore_rpc and datastore_query.
import logging
+import sys
try:
from google.appengine.datastore import datastore_rpc
from google.appengine.datastore import datastore_query
+ sys.modules['core.datastore_rpc'] = datastore_rpc
+ sys.module... |
c566fa8f49ea826b29937c9c128350494eb10bf6 | rrd/__init__.py | rrd/__init__.py | #-*- coding:utf-8 -*-
import os
from flask import Flask
#-- create app --
app = Flask(__name__)
app.config.from_object("rrd.config")
@app.errorhandler(Exception)
def all_exception_handler(error):
print "exception: %s" %error
return u'dashboard 暂时无法访问,请联系管理员', 500
from view import api, chart, screen, index
| #-*- coding:utf-8 -*-
import os
from flask import Flask
from flask import request
from flask import redirect
#-- create app --
app = Flask(__name__)
app.config.from_object("rrd.config")
@app.errorhandler(Exception)
def all_exception_handler(error):
print "exception: %s" %error
return u'dashboard 暂时无法访问,请联系管理员... | Add before_request and it works for this bug | Add before_request and it works for this bug
Check if the signature exists. Redirect to the login page if it doesn't. I took `rrd/view/index.py` as the reference
| Python | apache-2.0 | Cepave/dashboard,Cepave/dashboard,Cepave/dashboard,Cepave/dashboard | ---
+++
@@ -1,6 +1,8 @@
#-*- coding:utf-8 -*-
import os
from flask import Flask
+from flask import request
+from flask import redirect
#-- create app --
app = Flask(__name__)
@@ -12,3 +14,9 @@
return u'dashboard 暂时无法访问,请联系管理员', 500
from view import api, chart, screen, index
+
+@app.before_request
+def ... |
22d08aa11216d8ee367f8b4a11a14e08b3917dfd | flask_perm/admin.py | flask_perm/admin.py | # -*- coding: utf-8 -*-
from flask import Blueprint, render_template, current_app, url_for, redirect, request, flash
bp = Blueprint('perm-admin', __name__, template_folder='templates', static_folder='static')
@bp.route('/')
def index():
if not bp.perm.has_perm_admin_logined():
return redirect(url_for('pe... | # -*- coding: utf-8 -*-
from flask import Blueprint, render_template, current_app, url_for, redirect, request, flash
bp = Blueprint('perm-admin', __name__, template_folder='templates', static_folder='static')
@bp.route('/')
def index():
if not current_app.extensions['perm'].has_perm_admin_logined():
retu... | Use app.extensions to get perm reference. | Use app.extensions to get perm reference.
| Python | mit | soasme/flask-perm,soasme/flask-perm,soasme/flask-perm | ---
+++
@@ -6,7 +6,7 @@
@bp.route('/')
def index():
- if not bp.perm.has_perm_admin_logined():
+ if not current_app.extensions['perm'].has_perm_admin_logined():
return redirect(url_for('perm-admin.login'))
render_data = {
@@ -22,8 +22,9 @@
if request.method == 'POST':
username ... |
614a5de89a5746e95dc14f371d001c5a9056f646 | passwordhash.py | passwordhash.py | #!/usr/bin/env python
# Password Hashing Module for Linux
# Author: Dave Russell Jr (drussell393)
from getpass import getpass
import crypt
# If you like Python 2, please to be importing.
import os
import binascii
password = getpass('Enter your desired password, Harry: ')
passwordConfirm = getpass('Confirm your passw... | #!/usr/bin/env python3
# Password Hashing Module for Linux
# Author: Dave Russell Jr (drussell393)
from getpass import getpass
import crypt
# If you like Python 2, please to be importing.
#import os
#import binascii
password = getpass('Enter your desired password, Harry: ')
passwordConfirm = getpass('Confirm your pa... | Make changes to default to Python3 | Make changes to default to Python3
Since we have undoubtedly moved to Python3 for the most part within the community, this should be Python3 by default. We make Python2 users work harder now.
| Python | mit | drussell393/Linux-Password-Hash | ---
+++
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Password Hashing Module for Linux
# Author: Dave Russell Jr (drussell393)
@@ -6,18 +6,18 @@
import crypt
# If you like Python 2, please to be importing.
-import os
-import binascii
+#import os
+#import binascii
password = getpass('Ent... |
4735804f4951835e4e3c7d116628344bddf45aa3 | atomicpress/admin.py | atomicpress/admin.py | # -*- coding: utf-8 -*-
from flask import current_app
from flask_admin.contrib.fileadmin import FileAdmin
from flask_admin import AdminIndexView, expose, Admin
from flask_admin.contrib.sqla import ModelView
from atomicpress import models
from atomicpress.app import db
class HomeView(AdminIndexView):
@expose("/")... | # -*- coding: utf-8 -*-
from flask import current_app
from flask_admin.contrib.fileadmin import FileAdmin
from flask_admin import AdminIndexView, expose, Admin
from flask_admin.contrib.sqla import ModelView
from atomicpress import models
from atomicpress.app import db
class HomeView(AdminIndexView):
@expose("/")... | Update post view sorting (so latest comes first) | Update post view sorting (so latest comes first)
| Python | mit | marteinn/AtomicPress,marteinn/AtomicPress,marteinn/AtomicPress,marteinn/AtomicPress | ---
+++
@@ -14,6 +14,10 @@
return self.render('admin/home.html')
+class PostView(ModelView):
+ column_default_sort = ('date', True)
+
+
def create_admin():
app = current_app._get_current_object()
admin = Admin(app, "AtomicPress", index_view=HomeView(name='Home'))
@@ -21,7 +25,7 @@
admi... |
3a204de33589de943ff09525895812530baac0b2 | saylua/modules/pets/models/db.py | saylua/modules/pets/models/db.py | from google.appengine.ext import ndb
# This is to store alternate linart versions of the same pets
class SpeciesVersion(ndb.Model):
name = ndb.StringProperty()
base_image = ndb.StringProperty()
base_psd = ndb.StringProperty()
default_image = ndb.StringProperty()
# Pets are divided into species and spe... | from google.appengine.ext import ndb
# This is to store alternate linart versions of the same pets
class SpeciesVersion(ndb.Model):
name = ndb.StringProperty()
base_image = ndb.StringProperty()
base_psd = ndb.StringProperty()
default_image = ndb.StringProperty()
# Pets are divided into species and spe... | Update to pet model for provisioner | Update to pet model for provisioner
| Python | agpl-3.0 | saylua/SayluaV2,saylua/SayluaV2,LikeMyBread/Saylua,LikeMyBread/Saylua,saylua/SayluaV2,LikeMyBread/Saylua,LikeMyBread/Saylua | ---
+++
@@ -9,25 +9,26 @@
# Pets are divided into species and species are divided into variations
class Species(ndb.Model):
- name = ndb.StringProperty(indexed=True)
- versions = ndb.StructuredProperty(SpeciesVersion, repeated=True)
- description = ndb.StringProperty()
+ name = ndb.StringProperty()
+ ... |
a77ead1975050938c8557979f54683829747bf0f | addons/sale_stock/migrations/8.0.1.0/pre-migration.py | addons/sale_stock/migrations/8.0.1.0/pre-migration.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, a suite of business apps
# This module Copyright (C) 2014 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Af... | # -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, a suite of business apps
# This module Copyright (C) 2014 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Af... | Fix table name error in sale_stock column renames | Fix table name error in sale_stock column renames
| Python | agpl-3.0 | blaggacao/OpenUpgrade,sebalix/OpenUpgrade,OpenUpgrade-dev/OpenUpgrade,hifly/OpenUpgrade,kirca/OpenUpgrade,sebalix/OpenUpgrade,blaggacao/OpenUpgrade,kirca/OpenUpgrade,bwrsandman/OpenUpgrade,hifly/OpenUpgrade,Endika/OpenUpgrade,kirca/OpenUpgrade,OpenUpgrade/OpenUpgrade,pedrobaeza/OpenUpgrade,grap/OpenUpgrade,damdam-s/Ope... | ---
+++
@@ -22,7 +22,7 @@
from openerp.openupgrade import openupgrade
column_renames = {
- 'sale.order.line': [('procurement_id', None)]}
+ 'sale_order_line': [('procurement_id', None)]}
@openupgrade.migrate() |
8eb936799a320e9b68bffe58b04da941eba2268e | setup.py | setup.py | from setuptools import find_packages, setup
setup(
version='4.0.2',
name='incuna-groups',
packages=find_packages(),
include_package_data=True,
install_requires=[
'django_crispy_forms>=1.4.0,<2',
'django-polymorphic>=1.2,<1.3',
'incuna-pagination>=0.1.1,<1',
],
descr... | from setuptools import find_packages, setup
setup(
version='4.0.2',
name='incuna-groups',
packages=find_packages(),
include_package_data=True,
install_requires=[
'django_crispy_forms>=1.6.1,<2',
'django-polymorphic>=1.2,<1.3',
'incuna-pagination>=0.1.1,<1',
],
descr... | Use a newer crispy_forms version. | Use a newer crispy_forms version.
| Python | bsd-2-clause | incuna/incuna-groups,incuna/incuna-groups | ---
+++
@@ -7,7 +7,7 @@
packages=find_packages(),
include_package_data=True,
install_requires=[
- 'django_crispy_forms>=1.4.0,<2',
+ 'django_crispy_forms>=1.6.1,<2',
'django-polymorphic>=1.2,<1.3',
'incuna-pagination>=0.1.1,<1',
], |
4aeb2e57a05491973c761eb169a42cb5e1e32737 | gtr/__init__.py | gtr/__init__.py | __all__ = [
"gtr.services.funds.Funds"
]
__version__ = "0.1.0"
from gtr.services.base import _Service
from gtr.services.funds import Funds
from gtr.services.organisations import Organisations
from gtr.services.persons import Persons
from gtr.services.projects import Projects
| __all__ = [
"gtr.services.funds.Funds",
"gtr.services.organisations.Organisations",
"gtr.services.persons.Persons",
"gtr.services.projects.Projects"
]
__version__ = "0.1.0"
from gtr.services.base import _Service
from gtr.services.funds import Funds
from gtr.services.organisations import Organisations
f... | Add all service Classes to import | Add all service Classes to import
| Python | apache-2.0 | nestauk/gtr | ---
+++
@@ -1,5 +1,8 @@
__all__ = [
- "gtr.services.funds.Funds"
+ "gtr.services.funds.Funds",
+ "gtr.services.organisations.Organisations",
+ "gtr.services.persons.Persons",
+ "gtr.services.projects.Projects"
]
__version__ = "0.1.0"
|
1d84a3b58aa752834aed31123dd16e3bfa723609 | tests/storage_adapter_tests/test_storage_adapter.py | tests/storage_adapter_tests/test_storage_adapter.py | from unittest import TestCase
from chatterbot.storage import StorageAdapter
class StorageAdapterTestCase(TestCase):
"""
This test case is for the StorageAdapter base class.
Although this class is not intended for direct use,
this test case ensures that exceptions requiring
basic functionality are ... | from unittest import TestCase
from chatterbot.storage import StorageAdapter
class StorageAdapterTestCase(TestCase):
"""
This test case is for the StorageAdapter base class.
Although this class is not intended for direct use,
this test case ensures that exceptions requiring
basic functionality are ... | Remove tests for storage adapter methods being removed. | Remove tests for storage adapter methods being removed.
| Python | bsd-3-clause | vkosuri/ChatterBot,gunthercox/ChatterBot | ---
+++
@@ -17,10 +17,6 @@
def test_count(self):
with self.assertRaises(StorageAdapter.AdapterMethodNotImplementedError):
self.adapter.count()
-
- def test_find(self):
- with self.assertRaises(StorageAdapter.AdapterMethodNotImplementedError):
- self.adapter.find('')
... |
2d95f8fe9c9e9edf5b1a0b5dee2992187b0d89ed | src/pytest_django_lite/plugin.py | src/pytest_django_lite/plugin.py | import os
import pytest
try:
from django.conf import settings
except ImportError:
settings = None # NOQA
def is_configured():
if settings is None:
return False
return settings.configured or os.environ.get('DJANGO_SETTINGS_MODULE')
@pytest.fixture(autouse=True, scope='session')
def _django_... | import os
import pytest
try:
from django.conf import settings
except ImportError:
settings = None # NOQA
def is_configured():
if settings is None:
return False
return settings.configured or os.environ.get('DJANGO_SETTINGS_MODULE')
@pytest.fixture(autouse=True, scope='session')
def _django_... | Deal with the Django app refactoring. | Deal with the Django app refactoring.
| Python | apache-2.0 | pombredanne/pytest-django-lite,dcramer/pytest-django-lite | ---
+++
@@ -20,6 +20,12 @@
from django.test.simple import DjangoTestSuiteRunner
+ try:
+ import django
+ django.setup()
+ except AttributeError:
+ pass
+
runner = DjangoTestSuiteRunner(interactive=False)
runner.setup_test_environment()
request.addfinalizer(runner.tea... |
2f152c5036d32a780741edd8fb6ce75684728824 | singleuser/user-config.py | singleuser/user-config.py | import os
mylang = 'test'
family = 'wikipedia'
# Not defining any extra variables here at all since that causes pywikibot
# to issue a warning about potential misspellings
if os.path.exists(os.path.expanduser('~/user-config.py')):
with open(os.path.expanduser('~/user-config.py'), 'r') as f:
exec(
... | import os
mylang = 'test'
family = 'wikipedia'
custom_path = os.path.expanduser('~/user-config.py')
if os.path.exists(custom_path):
with open(custom_path, 'r') as f:
exec(compile(f.read(), custom_path, 'exec'), globals())
# Things that should be non-easily-overridable
usernames['*']['*'] = os.environ['J... | Revert "Do not introduce extra variables" | Revert "Do not introduce extra variables"
Since the 'f' is considered an extra variable and introduces
a warning anyway :( Let's fix this the right way
This reverts commit a03de68fb772d859098327d0e54a219fe4507072.
| Python | mit | yuvipanda/paws,yuvipanda/paws | ---
+++
@@ -4,13 +4,10 @@
family = 'wikipedia'
-# Not defining any extra variables here at all since that causes pywikibot
-# to issue a warning about potential misspellings
-if os.path.exists(os.path.expanduser('~/user-config.py')):
- with open(os.path.expanduser('~/user-config.py'), 'r') as f:
- exec... |
2d4016d8e4245a6e85c2bbea012d13471718b1b0 | journal/views.py | journal/views.py | from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View
from django.http import JsonResponse
from rest_framework.parsers import JSONParser
from .models import Entry
from .serializers import EntrySerializer
@method_decorator(csrf... | from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View
from django.http import JsonResponse
from rest_framework.parsers import JSONParser
from .models import Entry
from .serializers import EntrySerializer
@method_decorator(csrf... | Add a way to specific tag. | Add a way to specific tag.
| Python | agpl-3.0 | etesync/journal-manager | ---
+++
@@ -13,21 +13,22 @@
class RestView(View):
def get(self, request):
last = request.GET.get('last', None)
- if last is None:
- entries = Entry.objects.all()
- else:
- last_entry = Entry.objects.get(uuid=last)
- entries = Entry.objects.filter(id__gt=la... |
a4c9dd451062b83b907a350ea30f2d36badb6522 | parsers/__init__.py | parsers/__init__.py | import importlib
parsers = """
singtao.STParser
apple.AppleParser
""".split()
parser_dict = {}
# Import the parser and fill in parser_dict: domain -> parser
for parser_name in parsers:
module, class_name = parser_name.rsplit('.', 1)
parser = getattr(importlib.import_module('parsers.' + module), class_name)
... | import importlib
parsers = """
singtao.STParser
apple.AppleParser
tvb.TVBParser
""".split()
parser_dict = {}
# Import the parser and fill in parser_dict: domain -> parser
for parser_name in parsers:
module, class_name = parser_name.rsplit('.', 1)
parser = getattr(importlib.import_module('parsers.' + module),... | Add tvb Parser to the init | Add tvb Parser to the init
| Python | mit | code4hk/hk-news-scrapper | ---
+++
@@ -3,6 +3,7 @@
parsers = """
singtao.STParser
apple.AppleParser
+tvb.TVBParser
""".split()
parser_dict = {} |
a90889b773010d2fe2ed1dff133f951c0b5baea4 | demo/__init__.py | demo/__init__.py | """Package for PythonTemplateDemo."""
__project__ = 'PythonTemplateDemo'
__version__ = '0.0.0'
VERSION = __project__ + '-' + __version__
PYTHON_VERSION = 2, 7
import sys
if not sys.version_info >= PYTHON_VERSION: # pragma: no cover (manual test)
exit("Python {}.{}+ is required.".format(*PYTHON_VERSION))
| """Package for PythonTemplateDemo."""
import sys
__project__ = 'PythonTemplateDemo'
__version__ = '0.0.0'
VERSION = __project__ + '-' + __version__
PYTHON_VERSION = 2, 7
if not sys.version_info >= PYTHON_VERSION: # pragma: no cover (manual test)
exit("Python {}.{}+ is required.".format(*PYTHON_VERSION))
| Deploy Travis CI build 387 to GitHub | Deploy Travis CI build 387 to GitHub
| Python | mit | jacebrowning/template-python-demo | ---
+++
@@ -1,4 +1,6 @@
"""Package for PythonTemplateDemo."""
+
+import sys
__project__ = 'PythonTemplateDemo'
__version__ = '0.0.0'
@@ -7,6 +9,5 @@
PYTHON_VERSION = 2, 7
-import sys
if not sys.version_info >= PYTHON_VERSION: # pragma: no cover (manual test)
exit("Python {}.{}+ is required.".format(*... |
7e738ddbc1a4585f92e605369f8d6dc1d986dbec | scripts/get_cuda_version.py | scripts/get_cuda_version.py | import os
nvcc_version_cmd = 'nvcc -V > output.txt'
os.system(nvcc_version_cmd)
with open('output.txt') as f:
lines = f.readlines()
for line in lines:
if ", release" in line:
start = line.index(', release') + 10
end = line.index('.', start)
result = line[start:end]
... | import os
nvcc_version_cmd = 'nvcc -V > output.txt'
os.system(nvcc_version_cmd)
with open('output.txt') as f:
lines = f.readlines()
for line in lines:
if ", release" in line:
start = line.index(', release') + 10
end = line.index('.', start)
result = line[start:end]
... | Remove output.txt file after done | Remove output.txt file after done
After we are done detecting nvcc version, let's delete the temporary output.txt file. | Python | mit | GOMC-WSU/GOMC,GOMC-WSU/GOMC,GOMC-WSU/GOMC,GOMC-WSU/GOMC,GOMC-WSU/GOMC | ---
+++
@@ -11,4 +11,5 @@
end = line.index('.', start)
result = line[start:end]
print(result)
+ os.remove("output.txt")
quit() |
7a37e7ab531c151b6426dcf04647e063f3c0b0d6 | service/urls.py | service/urls.py | from django.conf.urls import url, include
from rest_framework import routers
import service.authors.views
import service.friendrequest.views
import service.users.views
import service.nodes.views
import service.posts.views
router = routers.DefaultRouter()
router.register(r'users', service.users.views.UserViewSet)
rout... | from django.conf.urls import url, include
from rest_framework import routers
import service.authors.views
import service.friendrequest.views
import service.users.views
import service.nodes.views
import service.posts.views
router = routers.DefaultRouter()
router.register(r'users', service.users.views.UserViewSet)
rout... | Fix bug caused by giving post detail view a new name | Fix bug caused by giving post detail view a new name
| Python | apache-2.0 | TeamAADGT/CMPUT404-project-socialdistribution,TeamAADGT/CMPUT404-project-socialdistribution,TeamAADGT/CMPUT404-project-socialdistribution | ---
+++
@@ -21,6 +21,6 @@
url(r'^friendrequest/', service.friendrequest.views.friendrequest, name='friend-request'),
url(r'^posts/', service.posts.views.PublicPostsList.as_view(), name='public-posts-list'),
url(r'^posts/(?P<pk>[0-9a-z\\-]+)/', service.posts.views.AllPostsViewSet.as_view({"get": "retrie... |
a6f0b0db3e32c71e89d73db8997308e67aae294f | setup_cython.py | setup_cython.py | from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
core = Extension(
'geopy.core',
["geopy/core.pyx"],
language='c++',
libraries=['stdc++'],
)
setup(
cmdclass = {'build_ext': build_ext},
include_dirs ... | import os
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
core = Extension(
'geometry.core',
[os.path.join("geometry", "core.pyx")],
language='c++',
libraries=['stdc++'],
include_dirs = ['.'],
)
setu... | Make module path OS independent by using os.path.join | Make module path OS independent by using os.path.join
| Python | bsd-3-clause | FRidh/python-geometry | ---
+++
@@ -1,13 +1,15 @@
+import os
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
core = Extension(
- 'geopy.core',
- ["geopy/core.pyx"],
+ 'geometry.core',
+ [os.path.join("geometry", "core.pyx")], ... |
0571864eb2d99b746386ace721b8e218f127c6ac | email_obfuscator/templatetags/email_obfuscator.py | email_obfuscator/templatetags/email_obfuscator.py | from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
register = template.Library()
def obfuscate_string(value):
return ''.join(['&#%s;'.format(str(ord(char))) for char in value])
@register.filter
@stringfilter
def obfuscate(value):
... | from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
register = template.Library()
def obfuscate_string(value):
return ''.join(['&#{0:s};'.format(str(ord(char))) for char in value])
@register.filter
@stringfilter
def obfuscate(value):... | Fix mixup of old and new-style string formatting | Fix mixup of old and new-style string formatting | Python | mit | morninj/django-email-obfuscator | ---
+++
@@ -6,7 +6,7 @@
def obfuscate_string(value):
- return ''.join(['&#%s;'.format(str(ord(char))) for char in value])
+ return ''.join(['&#{0:s};'.format(str(ord(char))) for char in value])
@register.filter
@@ -25,5 +25,5 @@
else:
link_text = mail
- return mark_safe('<a href="%s... |
41ac7e2d85126c2fe5dd16230ed678d72a8d048f | jax/__init__.py | jax/__init__.py | # Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Use a regular import to add jax.__version__ rather than exec() trickery. | Use a regular import to add jax.__version__ rather than exec() trickery.
(The exec() trickery is needed for setup.py, but not for jax/__init__.py.)
| Python | apache-2.0 | tensorflow/probability,google/jax,google/jax,google/jax,google/jax,tensorflow/probability | ---
+++
@@ -14,10 +14,7 @@
import os
os.environ.setdefault('TF_CPP_MIN_LOG_LEVEL', '1')
-version_file = os.path.join(os.path.abspath(os.path.dirname(__file__)),
- "version.py")
-with open(version_file) as f:
- exec(f.read(), globals())
+from jax.version import __version__
from jax.a... |
e1c6b7c369395208b467fcf169b6e3d0eb8c8dd9 | src/rlib/string_stream.py | src/rlib/string_stream.py | from rpython.rlib.streamio import Stream, StreamError
class StringStream(Stream):
def __init__(self, string):
self._string = string
self.pos = 0
self.max = len(string) - 1
def write(self, data):
raise StreamError("StringStream is not writable")
def truncate(self, si... | from rpython.rlib.streamio import Stream, StreamError
class StringStream(Stream):
def __init__(self, string):
self._string = string
self.pos = 0
self.max = len(string) - 1
def write(self, data):
raise StreamError("StringStream is not writable")
def truncate(self, ... | Fix StringStream to conform to latest pypy | Fix StringStream to conform to latest pypy
Signed-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de>
| Python | mit | SOM-st/RPySOM,smarr/RTruffleSOM,smarr/RTruffleSOM,smarr/PySOM,SOM-st/RPySOM,SOM-st/RTruffleSOM,SOM-st/PySOM,SOM-st/RTruffleSOM,SOM-st/PySOM,smarr/PySOM | ---
+++
@@ -1,4 +1,5 @@
from rpython.rlib.streamio import Stream, StreamError
+
class StringStream(Stream):
def __init__(self, string):
@@ -8,14 +9,9 @@
def write(self, data):
raise StreamError("StringStream is not writable")
+
def truncate(self, size):
raise StreamError("String... |
98925a82dfb45a4c76496cd11af8d1483a678e6e | sigh/views/api.py | sigh/views/api.py | import json
from functools import wraps
from flask import Blueprint
from flask import Response
from ..models import Tag
api_views = Blueprint('api', __name__, url_prefix='/api/')
def jsonify(func):
@wraps(func)
def _(*args, **kwargs):
result = func(*args, **kwargs)
return Response(json.dum... | import json
from functools import wraps
from flask import Blueprint
from flask import Response
from ..models import Tag
from ..models import User
api_views = Blueprint('api', __name__, url_prefix='/api/')
def jsonify(func):
@wraps(func)
def _(*args, **kwargs):
result = func(*args, **kwargs)
... | Create a new API for User autocompletion | Create a new API for User autocompletion
| Python | mit | kxxoling/Programmer-Sign,kxxoling/Programmer-Sign,kxxoling/Programmer-Sign | ---
+++
@@ -5,6 +5,7 @@
from flask import Response
from ..models import Tag
+from ..models import User
api_views = Blueprint('api', __name__, url_prefix='/api/')
@@ -24,3 +25,11 @@
tags = Tag.query.filter(Tag.searchable_name.ilike(u'%{}%'.format(q.lower()))).all()
tags = [tag.to_dict('id_', 'displa... |
44b0634b387c3856aa26b711bf38862380ab1ffe | setup.py | setup.py | import os
from setuptools import setup, find_packages
ROOT = os.path.abspath(os.path.dirname(__file__))
setup(
name='Flask-Mobility',
version='0.1',
url='http://github.com/rehandalal/flask-mobility/',
license='BSD',
author='Rehan Dalal',
author_email='rehan@meet-rehan.com',
description='A ... | import os
from setuptools import setup, find_packages
ROOT = os.path.abspath(os.path.dirname(__file__))
setup(
name='Flask-Mobility',
version='0.1',
url='http://github.com/rehandalal/flask-mobility/',
license='BSD',
author='Rehan Dalal',
author_email='rehan@meet-rehan.com',
description='A ... | Add python versions to classifiers | Add python versions to classifiers
| Python | bsd-3-clause | rehandalal/flask-mobility | ---
+++
@@ -26,6 +26,8 @@
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
'Topic :: Internet :: WWW/HTTP :: Dynamic ... |
f22945907bafb189645800db1e9ca804104b06db | setup.py | setup.py | """
The setup package to install TensorPy dependencies
*> This does NOT include TensorFlow installation
*> To install TensorFlow, use "./install_tensorflow.sh"
"""
from setuptools import setup, find_packages # noqa
setup(
name='tensorpy',
version='1.0.1',
url='http://tensorpy.com',
author='Michael Mi... | """
The setup package to install TensorPy dependencies
*> This does NOT include TensorFlow installation
*> To install TensorFlow, use "./install_tensorflow.sh"
"""
from setuptools import setup, find_packages # noqa
setup(
name='tensorpy',
version='1.0.1',
url='http://tensorpy.com',
author='Michael Mi... | Update the "six" to force version 1.10.0 | Update the "six" to force version 1.10.0
| Python | mit | TensorPy/TensorPy,TensorPy/TensorPy | ---
+++
@@ -17,7 +17,7 @@
license='The MIT License',
install_requires=[
'requests==2.11.1',
- 'six>=1.10.0',
+ 'six==1.10.0',
'Pillow==3.4.1',
'BeautifulSoup==3.2.1',
], |
17e774c1c59411fd8b33d597b54f872466ec4fe7 | setup.py | setup.py | #!/usr/bin/env python
import os
import setuptools
setuptools.setup(
name='remoteconfig',
version='0.2.4',
author='Max Zheng',
author_email='maxzheng.os @t gmail.com',
description=open('README.rst').read(),
install_requires=[
'localconfig>=0.4',
'requests',
],
license='MIT',
package_dir... | #!/usr/bin/env python
import os
import setuptools
setuptools.setup(
name='remoteconfig',
version='0.2.4',
author='Max Zheng',
author_email='maxzheng.os @t gmail.com',
description='A simple wrapper for localconfig that allows for reading config from a remote server',
long_description=open('README.rst').... | Add long description / url | Add long description / url
| Python | mit | maxzheng/remoteconfig | ---
+++
@@ -11,7 +11,10 @@
author='Max Zheng',
author_email='maxzheng.os @t gmail.com',
- description=open('README.rst').read(),
+ description='A simple wrapper for localconfig that allows for reading config from a remote server',
+ long_description=open('README.rst').read(),
+
+ url='https://github.com/m... |
83cc9a5304e41e4ce517cfc739238a37f13f626a | matchzoo/data_pack/build_unit_from_data_pack.py | matchzoo/data_pack/build_unit_from_data_pack.py | from tqdm import tqdm
from .data_pack import DataPack
from matchzoo import processor_units
def build_unit_from_data_pack(
unit: processor_units.StatefulProcessorUnit,
data_pack: DataPack, flatten: bool = True,
verbose: int = 1
) -> processor_units.StatefulProcessorUnit:
"""
Build a :class:`Statef... | """Build unit from data pack."""
from tqdm import tqdm
from matchzoo import processor_units
from .data_pack import DataPack
def build_unit_from_data_pack(
unit: processor_units.StatefulProcessorUnit,
data_pack: DataPack, flatten: bool = True,
verbose: int = 1
) -> processor_units.StatefulProcessorUnit:
... | Update docs for build unit. | Update docs for build unit.
| Python | apache-2.0 | faneshion/MatchZoo,faneshion/MatchZoo | ---
+++
@@ -1,7 +1,9 @@
+"""Build unit from data pack."""
+
from tqdm import tqdm
+from matchzoo import processor_units
from .data_pack import DataPack
-from matchzoo import processor_units
def build_unit_from_data_pack( |
fac395f86a1fbe9a8c64a0f178b4dcaa3a218fb1 | setup.py | setup.py | #!/usr/bin/env python
"""
Logan
======
Logan is a toolkit for running standalone Django applications. It provides you
with tools to create a CLI runner, manage settings, and the ability to bootstrap
the process.
:copyright: (c) 2012 David Cramer.
:license: Apache License 2.0, see LICENSE for more details.
"""
from se... | #!/usr/bin/env python
"""
Logan
======
Logan is a toolkit for running standalone Django applications. It provides you
with tools to create a CLI runner, manage settings, and the ability to bootstrap
the process.
:copyright: (c) 2012 David Cramer.
:license: Apache License 2.0, see LICENSE for more details.
"""
from se... | Support Django 1.4 in the test suite | Support Django 1.4 in the test suite
| Python | apache-2.0 | dcramer/logan | ---
+++
@@ -24,7 +24,7 @@
zip_safe=False,
install_requires=[],
tests_require=[
- 'django>=1.2.5,<1.4',
+ 'django>=1.2.5,<1.5',
'nose>=1.1.2',
'unittest2',
], |
880b5257d549c2150d8888a2f062acd9cc948480 | array/is-crypt-solution.py | array/is-crypt-solution.py | # You have an array of strings crypt, the cryptarithm, and an an array containing the mapping of letters and digits, solution. The array crypt will contain three non-empty strings that follow the structure: [word1, word2, word3], which should be interpreted as the word1 + word2 = word3 cryptarithm
# Write a solution wh... | # You have an array of strings crypt, the cryptarithm, and an an array containing the mapping of letters and digits, solution. The array crypt will contain three non-empty strings that follow the structure: [word1, word2, word3], which should be interpreted as the word1 + word2 = word3 cryptarithm
# Write a solution wh... | Check if sum of decoded numbers of first and second strings equal to decoded number of third string | Check if sum of decoded numbers of first and second strings equal to decoded number of third string
| Python | mit | derekmpham/interview-prep,derekmpham/interview-prep | ---
+++
@@ -14,4 +14,10 @@
for letter in string:
arr[-1] = arr[-1]*10 + dic[letter]
-
+ # check if sum of decoded numbers of first and second strings equal to decoded number of third string
+ if arr[0] + arr[1] == arr[2]:
+ if len(`arr[0]`) == len(crypt[0]): # check if decoded number of first string has ... |
fef260c3731408592fd88e73817fe0f0cd7fe769 | telemetry/telemetry/core/chrome/inspector_memory_unittest.py | telemetry/telemetry/core/chrome/inspector_memory_unittest.py | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
from telemetry.test import tab_test_case
class InspectorMemoryTest(tab_test_case.TabTestCase):
def testGetDOMStats(self):
unittest_data_... | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
from telemetry.test import tab_test_case
class InspectorMemoryTest(tab_test_case.TabTestCase):
def testGetDOMStats(self):
unittest_data_... | Fix InspectorMemoryTest.testGetDOMStats to have consistent behaviour on CrOS and desktop versions of Chrome. Starting the browser in CrOS requires navigating through an initial setup that does not leave us with a tab at "chrome://newtab". This workaround runs the test in a new tab on all platforms for consistency. | Fix InspectorMemoryTest.testGetDOMStats to have consistent
behaviour on CrOS and desktop versions of Chrome. Starting the
browser in CrOS requires navigating through an initial setup
that does not leave us with a tab at "chrome://newtab". This workaround
runs the test in a new tab on all platforms for consistency.
BUG... | Python | bsd-3-clause | benschmaus/catapult,SummerLW/Perf-Insight-Report,catapult-project/catapult-csm,sahiljain/catapult,catapult-project/catapult-csm,benschmaus/catapult,catapult-project/catapult,catapult-project/catapult-csm,benschmaus/catapult,SummerLW/Perf-Insight-Report,catapult-project/catapult,catapult-project/catapult,sahiljain/catap... | ---
+++
@@ -11,11 +11,15 @@
'..', '..', '..', 'unittest_data')
self._browser.SetHTTPServerDirectories(unittest_data_dir)
- self._tab.Navigate(
+ # Due to an issue with CrOS, we create a new tab here rather than
+ # using self._tab to get a consistent starting page... |
ec91dc2fec8da044737c08db257f621d75016d3d | setup.py | setup.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
from setuptools import setup
from pathlib import Path
this_dir = Path(__file__).absolute().parent
if sys.argv[-1].startswith('publish'):
if os.system("pip list | grep wheel"):
print("wheel not installed.\nUse `pip install wheel`.\nExiting.... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
from setuptools import setup
from pathlib import Path
this_dir = Path(__file__).absolute().parent
if sys.argv[-1].startswith('publish'):
if os.system("pip list | grep wheel"):
print("wheel not installed.\nUse `pip install wheel`.\nExiting.... | Remove print. Tag should be made before publish. | Remove print. Tag should be made before publish.
| Python | mit | igordejanovic/parglare,igordejanovic/parglare | ---
+++
@@ -18,7 +18,6 @@
os.system("twine upload -r test dist/*")
else:
os.system("twine upload dist/*")
- print("You probably want to also tag the version now.")
sys.exit()
if __name__ == "__main__": |
3b59809abe755954787482fd3112862dd54019eb | setup.py | setup.py | from setuptools import setup, find_packages
install_requires = open('requirements.txt').read().split()
setup(
name='mocurly',
version='0.0.1',
description='A library that allows your python tests to easily mock out the recurly library',
author='Yoriyasu Yano',
author_email='yoriy@captricity.com',
... | from setuptools import setup, find_packages
install_requires = open('requirements.txt').read().split()
setup(
name='mocurly',
version='0.0.1',
description='A library that allows your python tests to easily mock out the recurly library',
author='Yoriyasu Yano',
author_email='yoriy@captricity.com',
... | Install should include xml files | Install should include xml files
| Python | mit | Captricity/mocurly | ---
+++
@@ -10,6 +10,7 @@
author_email='yoriy@captricity.com',
url='https://github.com/Captricity/mocurly',
packages=find_packages(exclude=("tests", "tests.*")),
+ package_data={'mocurly': ['templates/*.xml']},
install_requires=install_requires,
test_suite = 'tests'
) |
c6d81ce7eede6db801d4e9a92b27ec5d409d0eab | setup.py | setup.py | from setuptools import setup
setup(
name='autograd',
version='1.4',
description='Efficiently computes derivatives of numpy code.',
author='Dougal Maclaurin and David Duvenaud and Matthew Johnson',
author_email="maclaurin@physics.harvard.edu, duvenaud@cs.toronto.edu, mattjj@csail.mit.edu",
packa... | from setuptools import setup
setup(
name='autograd',
version='1.5',
description='Efficiently computes derivatives of numpy code.',
author='Dougal Maclaurin and David Duvenaud and Matthew Johnson',
author_email="maclaurin@physics.harvard.edu, duvenaud@cs.toronto.edu, mattjj@csail.mit.edu",
packa... | Increase version number for pypi | Increase version number for pypi
| Python | mit | HIPS/autograd,HIPS/autograd | ---
+++
@@ -2,7 +2,7 @@
setup(
name='autograd',
- version='1.4',
+ version='1.5',
description='Efficiently computes derivatives of numpy code.',
author='Dougal Maclaurin and David Duvenaud and Matthew Johnson',
author_email="maclaurin@physics.harvard.edu, duvenaud@cs.toronto.edu, mattjj@c... |
fa874329f57899eee34182f20b0621bf488cae5e | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='jupyterhub-kubespawner',
version='0.5.1',
install_requires=[
'jupyterhub',
'pyYAML',
'kubernetes==2.*',
'escapism',
'jupyter',
],
setup_requires=['pytest-runner'],
tests_require=['pytest'],
desc... | from setuptools import setup, find_packages
setup(
name='jupyterhub-kubespawner',
version='0.5.1',
install_requires=[
'jupyterhub',
'pyYAML',
'kubernetes==3.*',
'escapism',
'jupyter',
],
setup_requires=['pytest-runner'],
tests_require=['pytest'],
desc... | Switch to newer version of kubernetes client library | Switch to newer version of kubernetes client library
Has a bunch of fixes for us that are useful!
| Python | bsd-3-clause | yuvipanda/jupyterhub-kubernetes-spawner,ktong/kubespawner,jupyterhub/kubespawner | ---
+++
@@ -6,7 +6,7 @@
install_requires=[
'jupyterhub',
'pyYAML',
- 'kubernetes==2.*',
+ 'kubernetes==3.*',
'escapism',
'jupyter',
], |
9d53f0b11c53127d556bc1027b82491d71a1a381 | setup.py | setup.py | from setuptools import setup
setup(
name = 'PyFVCOM',
packages = ['PyFVCOM'],
version = '2.0.0',
description = ("PyFVCOM is a collection of various tools and utilities which can be used to extract, analyse and plot input and output files from FVCOM."),
author = 'Pierre Cazenave',
author_email =... | from setuptools import setup
setup(
name = 'PyFVCOM',
packages = ['PyFVCOM'],
version = '2.1.0',
description = ("PyFVCOM is a collection of various tools and utilities which can be used to extract, analyse and plot input and output files from FVCOM."),
author = 'Pierre Cazenave',
author_email =... | Prepare for the next release. | Prepare for the next release.
| Python | mit | pwcazenave/PyFVCOM | ---
+++
@@ -3,12 +3,12 @@
setup(
name = 'PyFVCOM',
packages = ['PyFVCOM'],
- version = '2.0.0',
+ version = '2.1.0',
description = ("PyFVCOM is a collection of various tools and utilities which can be used to extract, analyse and plot input and output files from FVCOM."),
author = 'Pierre C... |
6a84b18f584c7f9b8a3d7d53605bce5be919b056 | setup.py | setup.py | from setuptools import setup
from pybib import __version__
setup(name='pybib',
version=__version__,
description='Fetch citation information, given a Digital Object Identifier',
url='https://github.com/jgilchrist/pybib',
author='Jonny Gilchrist',
packages=['pybib'],
install_requires... | from setuptools import setup
from pybib import __version__
setup(name='pybib',
version=__version__,
description='Fetch citation information, given a Digital Object Identifier',
long_description=open('README.rst').read(),
url='https://github.com/jgilchrist/pybib',
author='Jonny Gilchrist'... | Fix the README for PyPi | Fix the README for PyPi
| Python | bsd-3-clause | jgilchrist/pybib | ---
+++
@@ -5,6 +5,7 @@
setup(name='pybib',
version=__version__,
description='Fetch citation information, given a Digital Object Identifier',
+ long_description=open('README.rst').read(),
url='https://github.com/jgilchrist/pybib',
author='Jonny Gilchrist',
packages=['pybib'], |
d78916f43b289ff56d5a5d87f8db6fbf5f9d7436 | setup.py | setup.py | from setuptools import setup
setup(
name="img2txt",
version="2.0",
author="hit9",
author_email="hit9@icloud.com",
description="Image to Ascii Text, can output to html or ansi terminal.",
license="BSD",
url="http://hit9.org/img2txt",
install_requires=['docopt', 'Pillow'],
scripts=['i... | from setuptools import setup
setup(
name="img2txt.py",
version="2.0",
author="hit9",
author_email="hit9@icloud.com",
description="Image to Ascii Text, can output to html or ansi terminal.",
license="BSD",
url="http://hit9.org/img2txt",
install_requires=['docopt', 'Pillow'],
scripts=... | Rename package name to img2txt.py | Rename package name to img2txt.py
| Python | bsd-3-clause | hit9/img2txt,hit9/img2txt | ---
+++
@@ -1,7 +1,7 @@
from setuptools import setup
setup(
- name="img2txt",
+ name="img2txt.py",
version="2.0",
author="hit9",
author_email="hit9@icloud.com", |
16a6783a5671b58836d7c81395ff09b68acf1cb1 | setup.py | setup.py | __author__ = 'yalnazov'
from setuptools import setup
setup(
name='paymill-wrapper',
version='2.0.0',
description='Python wrapper for PAYMILL API',
author='Aleksandar Yalnazov',
author_email='aleksandar.yalnazov@qaiware.com',
url='https://github.com/paymill/paymill-python',
license='MIT',
... | __author__ = 'yalnazov'
from setuptools import setup
setup(
name='paymill-wrapper',
version='2.1.0',
description='Python wrapper for PAYMILL API',
author='Aleksandar Yalnazov',
author_email='aleksandar.yalnazov@qaiware.com',
url='https://github.com/paymill/paymill-python',
license='MIT',
... | Fix distribution and bump version. | Fix distribution and bump version.
| Python | mit | lukasklein/paymill-python,paymill/paymill-python | ---
+++
@@ -2,13 +2,13 @@
from setuptools import setup
setup(
name='paymill-wrapper',
- version='2.0.0',
+ version='2.1.0',
description='Python wrapper for PAYMILL API',
author='Aleksandar Yalnazov',
author_email='aleksandar.yalnazov@qaiware.com',
url='https://github.com/paymill/paymi... |
3a0c7caadb46a69fb29fe34bd64de28c9b263fd6 | restconverter.py | restconverter.py | # -*- coding: utf-8 -*-
"""
flaskjk.restconverter
~~~~~~~~~~~~~~~~~~~~~
Helper functions for converting RestructuredText
This class heavily depends on the functionality provided by the docutils
package.
:copyright: (c) 2010 by Jochem Kossen.
:license: BSD, see LICENSE for more details.
"... | # -*- coding: utf-8 -*-
"""
flaskjk.restconverter
~~~~~~~~~~~~~~~~~~~~~
Helper functions for converting RestructuredText
This class heavily depends on the functionality provided by the docutils
package.
See http://wiki.python.org/moin/ReStructuredText for more information
:copyright: (... | Add rest_to_html_fragment to be able to convert just the body part | Add rest_to_html_fragment to be able to convert just the body part
| Python | bsd-2-clause | jkossen/flaskjk | ---
+++
@@ -8,6 +8,9 @@
This class heavily depends on the functionality provided by the docutils
package.
+
+
+ See http://wiki.python.org/moin/ReStructuredText for more information
:copyright: (c) 2010 by Jochem Kossen.
:license: BSD, see LICENSE for more details.
@@ -33,3 +36,9 @@
""... |
fe79e799f2d3862e4764c69e76ed5a7d0a132002 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
import os
__doc__ = """
Command line tool and library wrappers around iwlist and
/etc/network/interfaces.
"""
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
install_requires = [
'setuptools',
'pbkdf2',
]
try:
im... | #!/usr/bin/env python
from setuptools import setup
import os
__doc__ = """
Command line tool and library wrappers around iwlist and
/etc/network/interfaces.
"""
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
install_requires = [
'setuptools',
'pbkdf2',
]
try:
im... | Check for write access for bashcompletion via os.access | Check for write access for bashcompletion via os.access
Alternative version of pull request rockymeza/wifi#41 (which apparently
isn't worked on any more) which checks for write access before
attempting to install the bashcompletion addition during
installation -- if only installed in a library into a virtualenv
the in... | Python | bsd-2-clause | rockymeza/wifi,cangelis/wifi,nicupavel/wifi,foosel/wifi,rockymeza/wifi,cangelis/wifi,foosel/wifi,simudream/wifi,nicupavel/wifi,simudream/wifi | ---
+++
@@ -23,6 +23,16 @@
version = '1.0.0'
+data_files = [
+ ('/etc/bash_completion.d/', ['extras/wifi-completion.bash']),
+]
+for entry in data_files:
+ # make sure we actually have write access to the target folder and if not don't
+ # include it in data_files
+ if not os.access(entry[0], os.W_OK... |
b0d54c11ea76c6485982e274e8226dfc6da25ceb | setup.py | setup.py | #!/usr/bin/env python
# coding: utf-8
from distribute_setup import use_setuptools
use_setuptools()
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import sys
extra = {}
if sys.version_info >= (3,):
extra['use_2to3'] = True
setup(name='mockito',
version='0.3.0',
... | #!/usr/bin/env python
# coding: utf-8
from distribute_setup import use_setuptools
use_setuptools()
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import sys
extra = {}
if sys.version_info >= (3,):
extra['use_2to3'] = True
setup(name='mockito',
version='0.3.0',
... | Change download and documentation URLs. | Change download and documentation URLs.
| Python | mit | zhilts/pymockito,zhilts/pymockito | ---
+++
@@ -17,9 +17,9 @@
setup(name='mockito',
version='0.3.0',
packages=['mockito', 'mockito_test', 'mockito_util'],
- url='http://code.google.com/p/mockito/wiki/MockitoForPython',
- download_url='http://bitbucket.org/szczepiq/mockito-python/downloads/',
- maintainer='mockito maintaine... |
c64f9ebe17d9076958db502401567add4116b431 | setup.py | setup.py | # -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='flake8-coding',
version='0.1.0',
description='Adds coding magic comment checks to flake8',
long_description=open("README.rst").read(),
classifiers=[
'Development Status :: 3 - Alpha',
'Programming Language :: Python... | # -*- coding: utf-8 -*-
from setuptools import setup
from flake8_coding import __version__
setup(
name='flake8-coding',
version=__version__,
description='Adds coding magic comment checks to flake8',
long_description=open("README.rst").read(),
classifiers=[
'Development Status :: 3 - Alpha... | Load package version from flake8_coding.py | Load package version from flake8_coding.py
| Python | apache-2.0 | tk0miya/flake8-coding | ---
+++
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
from setuptools import setup
+from flake8_coding import __version__
setup(
name='flake8-coding',
- version='0.1.0',
+ version=__version__,
description='Adds coding magic comment checks to flake8',
long_description=open("README.rst").read(... |
17db9de51b816210728db7f58685b7d8e5545c65 | src/__init__.py | src/__init__.py | from pkg_resources import get_distribution
import codecs
import json
__version__ = get_distribution('rasa_nlu').version
class Interpreter(object):
def parse(self, text):
raise NotImplementedError()
@staticmethod
def load_synonyms(entity_synonyms):
if entity_synonyms:
with cod... | from pkg_resources import get_distribution
import codecs
import json
__version__ = get_distribution('rasa_nlu').version
class Interpreter(object):
def parse(self, text):
raise NotImplementedError()
@staticmethod
def load_synonyms(entity_synonyms):
if entity_synonyms:
with cod... | Fix entity dict access key | Fix entity dict access key
| Python | apache-2.0 | RasaHQ/rasa_nlu,beeva-fernandocerezal/rasa_nlu,beeva-fernandocerezal/rasa_nlu,verloop/rasa_nlu,PHLF/rasa_nlu,verloop/rasa_nlu,PHLF/rasa_nlu,RasaHQ/rasa_nlu,RasaHQ/rasa_nlu | ---
+++
@@ -19,6 +19,5 @@
def replace_synonyms(entities, entity_synonyms):
for i in range(len(entities)):
entity_value = entities[i]["value"]
- if (type(entity_value) == unicode and type(entity_synonyms) == unicode and
- entity_value.lower() in entity_synonyms)... |
32508c310075d779e368d09f8642db6ba9029a44 | setup.py | setup.py | from distutils.core import setup
setup(
name = 'mustache',
packages = ['mustache'],
version = '0.1.3',
description = 'Mustache templating in Python',
author = 'Peter Downs',
author_email = 'peterldowns@gmail.com',
url = 'https://github.com/peterldowns/python-mustache',
download_url = 'ht... | from distutils.core import setup
setup(
name = 'mustache',
packages = ['mustache'],
version = '0.1.3',
description = 'Mustache templating in Python',
author = 'Peter Downs',
author_email = 'peterldowns@gmail.com',
url = 'https://github.com/peterldowns/python-mustache',
download_url = 'ht... | Fix typo breaking PyPI push. | Fix typo breaking PyPI push.
| Python | mit | peterldowns/python-mustache,peterldowns/python-mustache | ---
+++
@@ -11,7 +11,7 @@
install_requirements = open('requirements.txt').read(),
extras_require = {
'test' : open('tests/requirements.txt').read(),
- }
+ },
keywords = [
'templating',
'template', |
de7f7dd544f41ccb38d4e132fe0c994728ec8efe | setup.py | setup.py | """setup.py"""
#pylint:disable=line-too-long
from codecs import open as codecs_open
try:
from setuptools import setup
except ImportError:
from distutils.core import setup #pylint:disable=import-error,no-name-in-module
with codecs_open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
with codecs_open(... | """setup.py"""
#pylint:disable=line-too-long
from codecs import open as codecs_open
try:
from setuptools import setup
except ImportError:
from distutils.core import setup #pylint:disable=import-error,no-name-in-module
with codecs_open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
with codecs_open(... | Remove requests and pyzmq from package dependencies | Remove requests and pyzmq from package dependencies
These will now have to be installed separately by the user depending on the
transport protocol required.
| Python | mit | bcb/jsonrpcclient | ---
+++
@@ -25,7 +25,7 @@
packages=['jsonrpcclient'],
package_data={'jsonrpcclient': ['response-schema.json']},
include_package_data=True,
- install_requires=['jsonschema', 'future', 'requests', 'pyzmq'],
+ install_requires=['jsonschema', 'future'],
tests_require=['tox'],
classifiers=[
... |
4cae30c31369ee840dd79fb30fa3023711415012 | setup.py | setup.py | import backdropsend
from setuptools import setup, find_packages
setup(
name='backdropsend',
version=backdropsend.__VERSION__,
packages=find_packages(exclude=['test*']),
scripts=['backdrop-send'],
# metadata for upload to PyPI
author=backdropsend.__AUTHOR__,
author_email=backdropsend.__AUTH... | import backdropsend
from setuptools import setup, find_packages
setup(
name='backdropsend',
version=backdropsend.__VERSION__,
packages=find_packages(exclude=['test*']),
scripts=['backdrop-send'],
# metadata for upload to PyPI
author=backdropsend.__AUTHOR__,
author_email=backdropsend.__AUTH... | Install man pages to /usr/local/share for permissions | Install man pages to /usr/local/share for permissions
@YolinaS
@gtrogers
| Python | mit | alphagov/backdropsend,alphagov/backdropsend | ---
+++
@@ -17,7 +17,7 @@
license='MIT',
keywords='api data performance_platform',
- data_files=[('/usr/share/man/man1', ['docs/backdrop-send.1.gz'])],
+ data_files=[('/usr/local/share/man/man1', ['docs/backdrop-send.1.gz'])],
install_requires=['requests', 'argparse'],
) |
2a950c91416d3b92a91f4f245a37a95b418b4bab | custom/uth/tasks.py | custom/uth/tasks.py | from custom.uth.utils import create_case, match_case, attach_images_to_case, submit_error_case
from custom.uth.models import SonositeUpload, VscanUpload
from celery.task import task
import io
def get_files_from_doc(doc):
files = {}
for f in doc._attachments.keys():
files[f] = io.BytesIO(doc.fetch_atta... | from custom.uth.utils import create_case, match_case, attach_images_to_case, submit_error_case
from custom.uth.models import SonositeUpload, VscanUpload
from celery.task import task
import io
def get_files_from_doc(doc):
files = {}
for f in doc._attachments.keys():
files[f] = io.BytesIO(doc.fetch_atta... | Delete docs on task completion | Delete docs on task completion
| Python | bsd-3-clause | puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,SEL... | ---
+++
@@ -18,18 +18,19 @@
files = get_files_from_doc(upload_doc)
create_case(upload_doc.related_case_id, files)
- # TODO delete doc if processing is successful
+ upload_doc.delete()
@task
def async_find_and_attach(upload_id):
+ case = None
+
try:
upload_doc = VscanUpload.get... |
5bb84d5eac353cd4bbe1843fccaca64161830591 | savu/__init__.py | savu/__init__.py | # Copyright 2014 Diamond Light Source Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | # Copyright 2014 Diamond Light Source Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | Update to make import of savu a little more useful | Update to make import of savu a little more useful | Python | apache-2.0 | mjn19172/Savu,swtp1v07/Savu,swtp1v07/Savu,swtp1v07/Savu,mjn19172/Savu,swtp1v07/Savu,mjn19172/Savu,mjn19172/Savu,mjn19172/Savu | ---
+++
@@ -21,3 +21,7 @@
.. moduleauthor:: Mark Basham <scientificsoftware@diamond.ac.uk>
"""
+
+from . import core
+from . import data
+from . import plugins |
95ba22a3f8e4a8084fd19071a713be550158a569 | setup.py | setup.py | from setuptools import setup, find_packages
import sys
import versioneer
project_name = 'menpo3d'
# Versioneer allows us to automatically generate versioning from
# our git tagging system which makes releases simpler.
versioneer.VCS = 'git'
versioneer.versionfile_source = '{}/_version.py'.format(project_name)
version... | from setuptools import setup, find_packages
import sys
import versioneer
project_name = 'menpo3d'
# Versioneer allows us to automatically generate versioning from
# our git tagging system which makes releases simpler.
versioneer.VCS = 'git'
versioneer.versionfile_source = '{}/_version.py'.format(project_name)
version... | Include data folder and specific test dependencies | Include data folder and specific test dependencies
| Python | bsd-3-clause | grigorisg9gr/menpo3d,nontas/menpo3d,nontas/menpo3d,grigorisg9gr/menpo3d | ---
+++
@@ -28,5 +28,7 @@
author='James Booth',
author_email='james.booth08@imperial.ac.uk',
packages=find_packages(),
- install_requires=install_requires
+ package_data={'menpo3d': ['data/*']},
+ install_requires=install_requires,
+ tests_require=['nose==1.3.4', 'mock==1.0.1'... |
4531017c7c9e96a7a1108f39a906ddcac25ebd59 | setup.py | setup.py | import os
from setuptools import setup
from setuptools import find_packages
here = os.path.abspath(os.path.dirname(__file__))
try:
with open(os.path.join(here, 'README.rst')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.rst')) as f:
CHANGES = f.read()
except:
README = ''
... | import io
from setuptools import setup, find_packages
long_description = '\n'.join((
io.open('README.rst', encoding='utf-8').read(),
io.open('CHANGES.txt', encoding='utf-8').read()
))
setup(
name='importscan',
version='0.2.dev0',
description='Recursively import modules and sub-packages',
long_... | Use io.open with encoding='utf-8' and flake8 compliance | Use io.open with encoding='utf-8' and flake8 compliance
| Python | bsd-3-clause | faassen/importscan | ---
+++
@@ -1,25 +1,16 @@
-import os
+import io
+from setuptools import setup, find_packages
-from setuptools import setup
-from setuptools import find_packages
-
-here = os.path.abspath(os.path.dirname(__file__))
-
-try:
- with open(os.path.join(here, 'README.rst')) as f:
- README = f.read()
- with op... |
ed400cd2ad3a98af3ea02e41e54758c5d42e72d4 | setup.py | setup.py | import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.md')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'pyramid',
'pyramid_debugtoolbar',
'waitress',
]
test_requires = require... | import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.md')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'pyramid',
'pyramid_debugtoolbar',
'waitress',
]
test_requires = require... | Add coverage to test dependancies | Add coverage to test dependancies
| Python | agpl-3.0 | makinacorpus/convertit,makinacorpus/convertit | ---
+++
@@ -15,6 +15,7 @@
test_requires = requires + [
'webtest',
'mock',
+ 'coverage',
]
setup(name='topdfserver', |
6e71b0de777bf516d376397961ec232ec39ea195 | setup.py | setup.py | from setuptools import setup
try:
from pypandoc import convert
read_md = lambda f: convert(f, 'rst')
except ImportError:
print("warning: pypandoc module not found, could not convert Markdown to RST")
read_md = lambda f: open(f, 'r').read()
setup(name='centerline',
version='0.1',
descriptio... | from setuptools import setup
try:
from pypandoc import convert
def read_md():
return lambda f: convert(f, 'rst')
except ImportError:
print(
"warning: pypandoc module not found, could not convert Markdown to RST"
)
def read_md():
return lambda f: open(f, 'r').read()
setup... | Define a MD->RST conversion function | Define a MD->RST conversion function
| Python | mit | fitodic/centerline,fitodic/polygon-centerline,fitodic/centerline | ---
+++
@@ -2,10 +2,17 @@
try:
from pypandoc import convert
- read_md = lambda f: convert(f, 'rst')
+
+ def read_md():
+ return lambda f: convert(f, 'rst')
+
except ImportError:
- print("warning: pypandoc module not found, could not convert Markdown to RST")
- read_md = lambda f: open(f, '... |
7cd2249d231e8afc1384bc3757856e8fdbb234bf | setup.py | setup.py | from setuptools import setup
from subprocess import check_output, CalledProcessError
try:
num_gpus = len(check_output(['nvidia-smi', '--query-gpu=gpu_name',
'--format=csv']).decode().strip().split('\n'))
tf = 'tensorflow-gpu' if num_gpus > 1 else 'tensorflow'
except CalledProce... | from setuptools import setup
from subprocess import check_output, CalledProcessError
try:
num_gpus = len(check_output(['nvidia-smi', '--query-gpu=gpu_name',
'--format=csv']).decode().strip().split('\n'))
tf = 'tensorflow-gpu' if num_gpus > 1 else 'tensorflow'
except CalledProce... | Make dependency check more stringent | Make dependency check more stringent
| Python | apache-2.0 | theislab/dca,theislab/dca,theislab/dca | ---
+++
@@ -6,9 +6,9 @@
'--format=csv']).decode().strip().split('\n'))
tf = 'tensorflow-gpu' if num_gpus > 1 else 'tensorflow'
except CalledProcessError:
- tf = 'tensorflow'
+ tf = 'tensorflow>=1.0.0'
except FileNotFoundError:
- tf = 'tensorflow'
+ tf = 'tensorflow... |
43ae9bdec900081d6ff91fc3847a4d8d9a42eaeb | contrib/plugins/w3cdate.py | contrib/plugins/w3cdate.py | """
Add a 'w3cdate' key to every entry -- this contains the date in ISO8601 format
WARNING: you must have PyXML installed as part of your python installation
in order for this plugin to work
Place this plugin early in your load_plugins list, so that the w3cdate will
be available to subsequent plugins
"""
__author__ ... | """
Add a 'w3cdate' key to every entry -- this contains the date in ISO8601 format
WARNING: you must have PyXML installed as part of your python installation
in order for this plugin to work
Place this plugin early in your load_plugins list, so that the w3cdate will
be available to subsequent plugins
"""
__author__ ... | Fix daylight savings time bug | Fix daylight savings time bug
| Python | mit | daitangio/pyblosxom,daitangio/pyblosxom,willkg/douglas,willkg/douglas | ---
+++
@@ -25,4 +25,7 @@
for i in range(len(entry_list)):
entry = entry_list[i]
- entry['w3cdate'] = xml.utils.iso8601.ctime(time.mktime(entry['timetuple']))
+ t = entry['timetuple']
+ # adjust for daylight savings time
+ t = t[0],t[1],t[2],t[3]+time.localtime()[-1... |
e0a6ea3d48691bedfb39a0a92d569ea4aaf61810 | pavement.py | pavement.py | import paver.doctools
import paver.setuputils
from schevo.release import setup_meta
options(
setup=setup_meta,
sphinx=Bunch(
docroot='doc',
builddir='build',
sourcedir='source',
),
)
@task
@needs('paver.doctools.html')
def openhtml():
index_file = path('doc/build/html/index.... | from schevo.release import setup_meta
options(
setup=setup_meta,
sphinx=Bunch(
docroot='doc',
builddir='build',
sourcedir='source',
),
)
try:
import paver.doctools
except ImportError:
pass
else:
@task
@needs('paver.doctools.html')
def openhtml():
index... | Make paver.doctools optional, to allow for downloading of ==dev eggs | Make paver.doctools optional, to allow for downloading of ==dev eggs
Signed-off-by: Matthew R. Scott <878b2bb7d7b44067d87275810e479f4abd7737ae@gmail.com>
| Python | mit | Schevo/schevo,Schevo/schevo | ---
+++
@@ -1,6 +1,3 @@
-import paver.doctools
-import paver.setuputils
-
from schevo.release import setup_meta
@@ -14,8 +11,13 @@
)
-@task
-@needs('paver.doctools.html')
-def openhtml():
- index_file = path('doc/build/html/index.html')
- sh('open ' + index_file)
+try:
+ import paver.doctools
+exce... |
910d848f9c7ceb9133fe52c0c3f2df6c8ed4e4aa | phi/flow.py | phi/flow.py | # pylint: disable-msg = unused-import
"""
*Main PhiFlow import:* `from phi.flow import *`
Imports important functions and classes from
`math`, `geom`, `field`, `physics` and `vis` (including sub-modules)
as well as the modules and sub-modules themselves.
See `phi.tf.flow`, `phi.torch.flow`, `phi.jax.flow`.
"""
# Mod... | # pylint: disable-msg = unused-import
"""
*Main PhiFlow import:* `from phi.flow import *`
Imports important functions and classes from
`math`, `geom`, `field`, `physics` and `vis` (including sub-modules)
as well as the modules and sub-modules themselves.
See `phi.tf.flow`, `phi.torch.flow`, `phi.jax.flow`.
"""
# Mod... | Add Tensor to standard imports | [Φ] Add Tensor to standard imports
| Python | mit | tum-pbs/PhiFlow,tum-pbs/PhiFlow | ---
+++
@@ -18,7 +18,7 @@
from .physics import fluid, flip, advect, diffuse
# Classes
-from .math import DType, Solve
+from .math import Tensor, DType, Solve
from .geom import Geometry, Sphere, Box, Cuboid
from .field import Grid, CenteredGrid, StaggeredGrid, GeometryMask, SoftGeometryMask, HardGeometryMask, No... |
f408d7e61753ecdeb280e59ecb35485385ec3f6a | Tools/compiler/compile.py | Tools/compiler/compile.py | import sys
import getopt
from compiler import compile, visitor
##import profile
def main():
VERBOSE = 0
DISPLAY = 0
CONTINUE = 0
opts, args = getopt.getopt(sys.argv[1:], 'vqdc')
for k, v in opts:
if k == '-v':
VERBOSE = 1
visitor.ASTVisitor.VERBOSE = visitor.ASTVis... | import sys
import getopt
from compiler import compile, visitor
import profile
def main():
VERBOSE = 0
DISPLAY = 0
PROFILE = 0
CONTINUE = 0
opts, args = getopt.getopt(sys.argv[1:], 'vqdcp')
for k, v in opts:
if k == '-v':
VERBOSE = 1
visitor.ASTVisitor.VERBOSE =... | Add -p option to invoke Python profiler | Add -p option to invoke Python profiler
| Python | mit | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | ---
+++
@@ -3,13 +3,14 @@
from compiler import compile, visitor
-##import profile
+import profile
def main():
VERBOSE = 0
DISPLAY = 0
+ PROFILE = 0
CONTINUE = 0
- opts, args = getopt.getopt(sys.argv[1:], 'vqdc')
+ opts, args = getopt.getopt(sys.argv[1:], 'vqdcp')
for k, v in opts:... |
a67176ba0ba06d1a7cfff5d8e21446bb78a30518 | subscription/api.py | subscription/api.py | from tastypie import fields
from tastypie.resources import ModelResource, ALL
from tastypie.authentication import ApiKeyAuthentication
from tastypie.authorization import Authorization
from subscription.models import Subscription, MessageSet
from djcelery.models import PeriodicTask
class PeriodicTaskResource(ModelResou... | from tastypie import fields
from tastypie.resources import ModelResource, ALL
from tastypie.authentication import ApiKeyAuthentication
from tastypie.authorization import Authorization
from subscription.models import Subscription, MessageSet
from djcelery.models import PeriodicTask
class PeriodicTaskResource(ModelResou... | Update tastypie methods allowed for subscriptions | Update tastypie methods allowed for subscriptions
| Python | bsd-3-clause | praekelt/ndoh-control,praekelt/ndoh-control,praekelt/ndoh-control,praekelt/ndoh-control | ---
+++
@@ -29,7 +29,7 @@
class Meta:
queryset = Subscription.objects.all()
resource_name = 'subscription'
- list_allowed_methods = ['post', 'get']
+ list_allowed_methods = ['post', 'get', 'put', 'patch']
include_resource_uri = True
always_return_data = True
... |
dfb6d41be3acf5fc4d4d0f3d8a7fb9d3507e9ae7 | labware/microplates.py | labware/microplates.py | from .grid import GridContainer, GridItem
from .liquids import LiquidWell
class Microplate(GridContainer):
rows = 12
cols = 8
volume = 100
min_vol = 50
max_vol = 90
height = 14.45
length = 127.76
width = 85.47
diameter = 7.15
depth = 3.25
a1... | from .grid import GridContainer, GridItem
from .liquids import LiquidWell
class Microplate(GridContainer):
rows = 12
cols = 8
volume = 100
min_vol = 50
max_vol = 90
height = 14.45
length = 127.76
width = 85.47
diameter = 7.15
depth = 3.25
a1... | Revert of af99d4483acb36eda65b; Microplate subsets are special and important. | Revert of af99d4483acb36eda65b; Microplate subsets are special and important.
| Python | apache-2.0 | OpenTrons/opentrons-api,OpenTrons/opentrons-api,Opentrons/labware,OpenTrons/opentrons-api,OpenTrons/opentrons-api,OpenTrons/opentrons_sdk,OpenTrons/opentrons-api | ---
+++
@@ -28,3 +28,15 @@
A1 with the pipette tip in place.
"""
super(Microplate, self).calibrate(**kwargs)
+
+
+class Microplate_96(Microplate):
+ pass
+
+
+class Microplate_96_Deepwell(Microplate_96):
+ volume = 400
+ min_vol = 50
+ max_vol = 380
+ height = 14.6
+ ... |
abd4859f8bac46fd6d114352ffad4ee9af28aa5f | common/lib/xmodule/xmodule/tests/test_mongo_utils.py | common/lib/xmodule/xmodule/tests/test_mongo_utils.py | """Tests for methods defined in mongo_utils.py"""
import os
from unittest import TestCase
from uuid import uuid4
from pymongo import ReadPreference
from django.conf import settings
from xmodule.mongo_utils import connect_to_mongodb
class MongoUtilsTests(TestCase):
"""
Tests for methods exposed in mongo_uti... | """
Tests for methods defined in mongo_utils.py
"""
import ddt
import os
from unittest import TestCase
from uuid import uuid4
from pymongo import ReadPreference
from django.conf import settings
from xmodule.mongo_utils import connect_to_mongodb
@ddt.ddt
class MongoUtilsTests(TestCase):
"""
Tests for method... | Convert test to DDT and test for primary, nearest modes. | Convert test to DDT and test for primary, nearest modes.
| Python | agpl-3.0 | teltek/edx-platform,arbrandes/edx-platform,kmoocdev2/edx-platform,CredoReference/edx-platform,Stanford-Online/edx-platform,eduNEXT/edx-platform,EDUlib/edx-platform,appsembler/edx-platform,ahmedaljazzar/edx-platform,appsembler/edx-platform,gsehub/edx-platform,gymnasium/edx-platform,jolyonb/edx-platform,a-parhom/edx-plat... | ---
+++
@@ -1,4 +1,7 @@
-"""Tests for methods defined in mongo_utils.py"""
+"""
+Tests for methods defined in mongo_utils.py
+"""
+import ddt
import os
from unittest import TestCase
from uuid import uuid4
@@ -10,19 +13,26 @@
from xmodule.mongo_utils import connect_to_mongodb
+@ddt.ddt
class MongoUtilsTests(T... |
956cb919554c8103149fa6442254bdfed0ce32d1 | lms/djangoapps/experiments/factories.py | lms/djangoapps/experiments/factories.py | import factory
from experiments.models import ExperimentData, ExperimentKeyValue
from student.tests.factories import UserFactory
class ExperimentDataFactory(factory.DjangoModelFactory):
class Meta(object):
model = ExperimentData
user = factory.SubFactory(UserFactory)
experiment_id = factory.fuzz... | import factory
import factory.fuzzy
from experiments.models import ExperimentData, ExperimentKeyValue
from student.tests.factories import UserFactory
class ExperimentDataFactory(factory.DjangoModelFactory):
class Meta(object):
model = ExperimentData
user = factory.SubFactory(UserFactory)
experim... | Add an import of a submodule to make pytest less complainy | Add an import of a submodule to make pytest less complainy
| Python | agpl-3.0 | angelapper/edx-platform,TeachAtTUM/edx-platform,a-parhom/edx-platform,CredoReference/edx-platform,gsehub/edx-platform,eduNEXT/edunext-platform,eduNEXT/edx-platform,stvstnfrd/edx-platform,eduNEXT/edx-platform,TeachAtTUM/edx-platform,Stanford-Online/edx-platform,a-parhom/edx-platform,eduNEXT/edx-platform,ahmedaljazzar/ed... | ---
+++
@@ -1,4 +1,5 @@
import factory
+import factory.fuzzy
from experiments.models import ExperimentData, ExperimentKeyValue
from student.tests.factories import UserFactory |
ea3e9270788b251440b5f6fab1605361e0dc2ade | inonemonth/challenges/tests/test_forms.py | inonemonth/challenges/tests/test_forms.py | import unittest
import django.test
from django.core.exceptions import ValidationError
from core.tests.setups import RobrechtSocialUserFactory
from ..validators import RepoExistanceValidator
###############################################################################
# Forms ... | import unittest
import django.test
from django.core.exceptions import ValidationError
from core.tests.setups import RobrechtSocialUserFactory
from ..validators import RepoExistanceValidator
###############################################################################
# Forms ... | Add Comment to RepoExistanceValidator test and correct test name | Add Comment to RepoExistanceValidator test and correct test name
| Python | mit | robrechtdr/inonemonth,robrechtdr/inonemonth,robrechtdr/inonemonth,robrechtdr/inonemonth | ---
+++
@@ -30,7 +30,9 @@
# Validators #
###############################################################################
+# Test takes longer than average test because of requests call
+#@unittest.skip("")
class RepoExistanceValidatorTestCase(djang... |
0bdcb1c36432cfa0506c6dd667e4e1910edcd371 | ixprofile_client/management/commands/createsuperuser.py | ixprofile_client/management/commands/createsuperuser.py | """
A management command to create a user with a given email.
"""
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
from ixprofile_client.webservice import UserWebService
from optparse import make_option
class Command(BaseCommand):
"""
The command... | """
A management command to create a user with a given email.
"""
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from ixprofile_client.webservice import UserWebService
from optparse import make_option
class Command(Bas... | Handle the case where the user may already exist in the database | Handle the case where the user may already exist in the database
| Python | mit | infoxchange/ixprofile-client,infoxchange/ixprofile-client | ---
+++
@@ -4,6 +4,7 @@
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
+from django.db import transaction
from ixprofile_client.webservice import UserWebService
@@ -36,15 +37,18 @@
if not email:
raise CommandError("No email ... |
1cd3096322b5d4b4c4df0f1fba6891e29c911c53 | spaces/utils.py | spaces/utils.py |
import re
import os
def normalize_path(path):
"""
Normalizes a path:
* Removes extra and trailing slashes
* Converts special characters to underscore
"""
path = re.sub(r'/+', '/', path) # repeated slash
path = re.sub(r'/*$', '', path) # trailing slash
path = [to_slug(p)... |
import re
import os
def normalize_path(path):
"""
Normalizes a path:
* Removes extra and trailing slashes
* Converts special characters to underscore
"""
if path is None:
return ""
path = re.sub(r'/+', '/', path) # repeated slash
path = re.sub(r'/*$', '', path) # tr... | Convert path to lowercase when normalizing | Convert path to lowercase when normalizing
| Python | mit | jgillick/Spaces,jgillick/Spaces,jgillick/Spaces,jgillick/Spaces,jgillick/Spaces,jgillick/Spaces | ---
+++
@@ -9,25 +9,29 @@
* Removes extra and trailing slashes
* Converts special characters to underscore
"""
+ if path is None:
+ return ""
+
path = re.sub(r'/+', '/', path) # repeated slash
path = re.sub(r'/*$', '', path) # trailing slash
-
+
path = [to_slug(p)... |
33c03c8d50524dca3b9c5990958a0b44e9fe399e | isserviceup/services/models/statuspage.py | isserviceup/services/models/statuspage.py | import requests
from bs4 import BeautifulSoup
from isserviceup.services.models.service import Service, Status
class StatusPagePlugin(Service):
def get_status(self):
r = requests.get(self.status_url)
if r.status_code != 200:
return Status.unavailable
b = BeautifulSoup(r.conte... | import requests
from bs4 import BeautifulSoup
from isserviceup.services.models.service import Service, Status
class StatusPagePlugin(Service):
def get_status(self):
r = requests.get(self.status_url)
if r.status_code != 200:
return Status.unavailable
b = BeautifulSoup(r.conte... | Use unresolved-incidents when page-status is empty | Use unresolved-incidents when page-status is empty
| Python | apache-2.0 | marcopaz/is-service-up,marcopaz/is-service-up,marcopaz/is-service-up | ---
+++
@@ -12,7 +12,14 @@
return Status.unavailable
b = BeautifulSoup(r.content, 'html.parser')
- status = next(x for x in b.find(class_='page-status').attrs['class'] if x.startswith('status-'))
+
+ page_status = b.find(class_='page-status')
+
+ if page_status is None:
+ ... |
e49ac8daeabf82708f2ba7bb623d7db73e1fcaff | readthedocs/core/subdomain_urls.py | readthedocs/core/subdomain_urls.py | from django.conf.urls.defaults import url, patterns
from urls import urlpatterns as main_patterns
urlpatterns = patterns('',
url(r'^projects/(?P<project_slug>[\w.-]+)/(?P<lang_slug>\w{2})/(?P<version_slug>[\w.-]+)/(?P<filename>.*)$',
'core.views.subproject_serve_docs',
name='subproject_docs_detail... | from django.conf.urls.defaults import url, patterns
from urls import urlpatterns as main_patterns
urlpatterns = patterns('',
url(r'^projects/(?P<project_slug>[\w.-]+)/(?P<lang_slug>\w{2})/(?P<version_slug>[\w.-]+)/(?P<filename>.*)$',
'core.views.subproject_serve_docs',
name='subproject_docs_detail... | Add verison_slug redirection back in for now. | Add verison_slug redirection back in for now.
| Python | mit | agjohnson/readthedocs.org,kdkeyser/readthedocs.org,istresearch/readthedocs.org,davidfischer/readthedocs.org,KamranMackey/readthedocs.org,espdev/readthedocs.org,ojii/readthedocs.org,singingwolfboy/readthedocs.org,michaelmcandrew/readthedocs.org,SteveViss/readthedocs.org,hach-que/readthedocs.org,raven47git/readthedocs.or... | ---
+++
@@ -20,6 +20,10 @@
{'filename': 'index.html'},
name='docs_detail'
),
+ url(r'^(?P<version_slug>.*)/$',
+ 'core.views.subdomain_handler',
+ name='version_subdomain_handler'
+ ),
url(r'^$', 'core.views.subdomain_handler'),
)
|
0484d3f14f29aa489bc848f1d83a9fb20183532e | plaidml/keras/tile_sandbox.py | plaidml/keras/tile_sandbox.py | from collections import OrderedDict
import numpy as np
import plaidml
import plaidml.keras
plaidml.keras.install_backend()
import keras.backend as K
def main(code, tensor_A, tensor_B, output_shape):
print(K.backend())
op = K._Op('sandbox_op', A.dtype, output_shape, code,
OrderedDict([('A', tens... | from collections import OrderedDict
import numpy as np
import plaidml
import plaidml.tile as tile
import plaidml.keras
plaidml.keras.install_backend()
import keras.backend as K
class SandboxOp(tile.Operation):
def __init__(self, code, a, b, output_shape):
super(SandboxOp, self).__init__(code, [('A', a), ... | Update Tile sandbox for op lib | Update Tile sandbox for op lib
| Python | apache-2.0 | plaidml/plaidml,plaidml/plaidml,plaidml/plaidml,plaidml/plaidml | ---
+++
@@ -1,28 +1,31 @@
from collections import OrderedDict
import numpy as np
import plaidml
+import plaidml.tile as tile
import plaidml.keras
plaidml.keras.install_backend()
import keras.backend as K
+class SandboxOp(tile.Operation):
+
+ def __init__(self, code, a, b, output_shape):
+ super(Sa... |
583c946061f8af815c32254655f4aed8f0c18dc9 | watcher/tests/api/test_config.py | watcher/tests/api/test_config.py | # All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | # All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | Use importlib to take place of im module | Use importlib to take place of im module
The imp module is deprecated[1] since version 3.4, use importlib to
instead
1: https://docs.python.org/3/library/imp.html#imp.reload
Change-Id: Ic126bc8e0936e5d7a2c7a910b54b7348026fedcb
| Python | apache-2.0 | openstack/watcher,openstack/watcher | ---
+++
@@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import imp
+import importlib
from oslo_config import cfg
from watcher.api import config as api_config
from watcher.tests.api import base
@@ -23,13 +23,13 @@
def test_config_enabl... |
ed5a151942ff6aeddeaab0fb2e23428821f89fc4 | rovercode/drivers/grovepi_ultrasonic_ranger_binary.py | rovercode/drivers/grovepi_ultrasonic_ranger_binary.py | """
Class for communicating with the GrovePi ultrasonic ranger.
Here we treat it as a binary sensor.
"""
import logging
logging.basicConfig()
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.getLevelName('INFO'))
try:
from GrovePi.Software.Python.grovepi import ultrasonicRead
except ImportError:
L... | """
Class for communicating with the GrovePi ultrasonic ranger.
Here we treat it as a binary sensor.
"""
import logging
logging.basicConfig()
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.getLevelName('INFO'))
try:
from grovepi import ultrasonicRead
except ImportError:
LOGGER.warning("GrovePi l... | Fix grovepi import in sensor driver | Fix grovepi import in sensor driver
| Python | apache-2.0 | aninternetof/rover-code,aninternetof/rover-code,aninternetof/rover-code | ---
+++
@@ -9,7 +9,7 @@
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.getLevelName('INFO'))
try:
- from GrovePi.Software.Python.grovepi import ultrasonicRead
+ from grovepi import ultrasonicRead
except ImportError:
LOGGER.warning("GrovePi lib unavailable. Using dummy.")
from drivers... |
95788f09949e83cf39588444b44eda55e13c6071 | wluopensource/accounts/models.py | wluopensource/accounts/models.py | from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
class UserProfile(models.Model):
user = models.ForeignKey(User, blank=True, unique=True)
url = models.URLField("Website", blank=True, verify_exists=False)
def __unicode__(self):
... | from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
class UserProfile(models.Model):
user = models.ForeignKey(User, blank=True, unique=True)
url = models.URLField("Website", blank=True)
def __unicode__(self):
return self.user.... | Remove verify false from user URL to match up with comment URL | Remove verify false from user URL to match up with comment URL
| Python | bsd-3-clause | jeffcharles/Open-Source-at-Laurier-Website,jeffcharles/Open-Source-at-Laurier-Website,jeffcharles/Open-Source-at-Laurier-Website,jeffcharles/Open-Source-at-Laurier-Website | ---
+++
@@ -4,7 +4,7 @@
class UserProfile(models.Model):
user = models.ForeignKey(User, blank=True, unique=True)
- url = models.URLField("Website", blank=True, verify_exists=False)
+ url = models.URLField("Website", blank=True)
def __unicode__(self):
return self.user.username |
d3bc714478c3f7a665b39dfb1b8d65e7bc59ccd0 | utuputki-webui/utuputki/handlers/logout.py | utuputki-webui/utuputki/handlers/logout.py | # -*- coding: utf-8 -*-
from handlers.handlerbase import HandlerBase
from db import db_session, Session
class LogoutHandler(HandlerBase):
def handle(self, packet_msg):
# Remove session
s = db_session()
s.query(Session).filter_by(key=self.sock.sid).delete()
s.commit()
s.clo... | # -*- coding: utf-8 -*-
from handlers.handlerbase import HandlerBase
from db import db_session, Session
class LogoutHandler(HandlerBase):
def handle(self, packet_msg):
# Remove session
s = db_session()
s.query(Session).filter_by(key=self.sock.sid).delete()
s.commit()
s.clo... | Clear all session data from websocket obj | Clear all session data from websocket obj
| Python | mit | katajakasa/utuputki2,katajakasa/utuputki2,katajakasa/utuputki2,katajakasa/utuputki2 | ---
+++
@@ -19,3 +19,5 @@
# Deauthenticate & clear session ID
self.sock.authenticated = False
self.sock.sid = None
+ self.sock.uid = None
+ self.sock.level = 0 |
5bcd0d538bad1393d2ecbc1f91556a7b873343c8 | subprocrunner/_logger/_logger.py | subprocrunner/_logger/_logger.py | """
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from typing import Callable, Optional
from ._null_logger import NullLogger
MODULE_NAME = "subprocrunner"
DEFAULT_ERROR_LOG_LEVEL = "WARNING"
try:
from loguru import logger
LOGURU_INSTALLED = True
logger.disable(MODULE_NAME)
exce... | """
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from typing import Callable, Optional
from ._null_logger import NullLogger
MODULE_NAME = "subprocrunner"
DEFAULT_ERROR_LOG_LEVEL = "WARNING"
try:
from loguru import logger
LOGURU_INSTALLED = True
logger.disable(MODULE_NAME)
exce... | Apply upper to the argument value | Apply upper to the argument value
| Python | mit | thombashi/subprocrunner,thombashi/subprocrunner | ---
+++
@@ -40,7 +40,7 @@
"CRITICAL": logger.critical,
}
- method = method_table.get(log_level)
+ method = method_table.get(log_level.upper())
if method is None:
raise ValueError("unknown log level: {}".format(log_level))
|
5d5b59bde655fbeb2d07bd5539c2ff9b29879d1d | pythontutorials/books/AutomateTheBoringStuff/Ch14/P2_writeCSV.py | pythontutorials/books/AutomateTheBoringStuff/Ch14/P2_writeCSV.py | # This program uses the csv module to manipulate .csv files
import csv
# Writer Objects
outputFile = open("output.csv", "w", newline='')
outputWriter = csv.writer(outputFile)
print(outputWriter.writerow(['spam', 'eggs', 'bacon', 'ham']))
print(outputWriter.writerow(['Hello, world!', 'eggs', 'bacon', 'ham']))
print(ou... | """Write CSV
This program uses :py:mod:`csv` to write .csv files.
Note:
Creates 'output.csv' and 'example.tsv' files.
"""
def main():
import csv
# Writer Objects
outputFile = open("output.csv", "w", newline='')
outputWriter = csv.writer(outputFile)
print(outputWriter.writerow(['spam', 'egg... | Update P1_writeCSV.py added docstring and wrapped in main function | Update P1_writeCSV.py
added docstring and wrapped in main function
| Python | mit | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | ---
+++
@@ -1,19 +1,32 @@
-# This program uses the csv module to manipulate .csv files
+"""Write CSV
-import csv
+This program uses :py:mod:`csv` to write .csv files.
-# Writer Objects
-outputFile = open("output.csv", "w", newline='')
-outputWriter = csv.writer(outputFile)
-print(outputWriter.writerow(['spam', 'e... |
20d94336b163c1e98458f14ab44651e2df8ed659 | web/social/management/commands/stream_twitter.py | web/social/management/commands/stream_twitter.py | import logging
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from social.models import *
from social.utils import *
from tweetstream import FilterStream
class Command(BaseCommand):
help = "Start Twitter streaming"
def handle(self, *args, **options):
... | import logging
import time
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from social.models import *
from social.utils import *
from tweetstream import FilterStream, ConnectionError
class Command(BaseCommand):
help = "Start Twitter streaming"
def handle(sel... | Add ConnectionError handling and reconnection to Twitter streamer | Add ConnectionError handling and reconnection to Twitter streamer
| Python | agpl-3.0 | kansanmuisti/datavaalit,kansanmuisti/datavaalit | ---
+++
@@ -1,9 +1,10 @@
import logging
+import time
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from social.models import *
from social.utils import *
-from tweetstream import FilterStream
+from tweetstream import FilterStream, ConnectionError
class Comm... |
72919640ac70da7f05ba36e345666909eb002187 | python/ramldoc/django_urls.py | python/ramldoc/django_urls.py | import re as regex
from django.conf.urls import patterns, url
def build_patterns(modules, version):
pattern_list = []
for module in modules:
url_string = r'^'
url_string += str(version) + r'/'
# NOTE, the assumption here is that get_path() is an instance of the AnnotationBaseClass:
... | import re as regex
from django.conf.urls import patterns, url
def build_patterns(modules, version):
pattern_list = []
for module in modules:
url_string = r'^'
url_string += str(version) + r'/'
# NOTE, the assumption here is that get_path() is an instance of the AnnotationBaseClass:
... | Fix for supporting special characters in the url. | Fix for supporting special characters in the url. | Python | apache-2.0 | SungardAS-CloudDevelopers/ramldoc | ---
+++
@@ -12,7 +12,7 @@
# NOTE, the assumption here is that get_path() is an instance of the AnnotationBaseClass:
url_string += module.get_path_abstract() + r'$'
url_string = regex.sub(r'{', r'(?P<', url_string)
- url_string = regex.sub(r'}', r'>[\w\s.@-]+)', url_string)
+ u... |
e2eab36586652b2c7fe37ca96fedea89760665fc | kpcc_backroom_handshakes/urls.py | kpcc_backroom_handshakes/urls.py | from django.conf import settings
from django.conf.urls import patterns, include, url
from django.core.urlresolvers import reverse
from django.views.generic import TemplateView
from django.views.generic import RedirectView
from django.contrib import admin
import os
import logging
logger = logging.getLogger("kpcc_backro... | from django.conf import settings
from django.conf.urls import patterns, include, url
from django.core.urlresolvers import reverse
from django.views.generic import TemplateView
from django.views.generic import RedirectView
from django.contrib import admin
import os
import logging
logger = logging.getLogger("kpcc_backro... | Disable redirect that prevented access to the admin panel. | Disable redirect that prevented access to the admin panel.
| Python | mit | SCPR/kpcc_backroom_handshakes,SCPR/kpcc_backroom_handshakes,SCPR/kpcc_backroom_handshakes | ---
+++
@@ -19,5 +19,5 @@
url(r"^elections/", include("ballot_box.urls", namespace="ballot-box")),
url(r"^elections/", include("measure_finance.urls", namespace="campaign-finance")),
url(r"^elections/", include("election_registrar.urls", namespace="elections")),
- url(r"^", RedirectView.as_view(url=... |
415e34fb913feaf623320827fb7680ee56c9d335 | gunicorn.conf.py | gunicorn.conf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
bind = '127.0.0.1:8001'
workers = 6
proc_name = 'lastuser'
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
bind = '127.0.0.1:8002'
workers = 6
proc_name = 'lastuser'
| Use a different port for lastuser | Use a different port for lastuser
| Python | bsd-2-clause | hasgeek/lastuser,hasgeek/lastuser,sindhus/lastuser,hasgeek/lastuser,sindhus/lastuser,hasgeek/funnel,hasgeek/funnel,hasgeek/funnel,hasgeek/funnel,hasgeek/lastuser,sindhus/lastuser,sindhus/lastuser,sindhus/lastuser,hasgeek/funnel,hasgeek/lastuser | ---
+++
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-bind = '127.0.0.1:8001'
+bind = '127.0.0.1:8002'
workers = 6
proc_name = 'lastuser' |
6bf762b7aeabcb47571fe4d23fe13ae8e4b3ebc3 | editorsnotes/main/views.py | editorsnotes/main/views.py | from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from models import Term, Reference
@login_required
def index(request):
o = {}
o['term_list'] = Term.objects.all()
return render_to_... | from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.decorators import login_required
from models import Term, Reference
@login_required
def index(request):
o = {}
o['term_list'] = Term.objects.all()
... | Throw 404 for non-existent terms. | Throw 404 for non-existent terms.
| Python | agpl-3.0 | editorsnotes/editorsnotes,editorsnotes/editorsnotes | ---
+++
@@ -1,6 +1,6 @@
from django.conf import settings
from django.http import HttpResponse
-from django.shortcuts import render_to_response
+from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.decorators import login_required
from models import Term, Reference
@@ -13,9... |
2bf3e59e5ec0ca5d1003cd52f06a8f12a5ee7caf | tools/metrics/apk_size.py | tools/metrics/apk_size.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Check APK file size for limit
from os import path, listdir, stat
from sys import exit
SIZE_LIMIT = 4194304
PATH = pa... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Check APK file size for limit
from os import path, listdir, stat
from sys import exit
SIZE_LIMIT = 4500000
PATH = pa... | Increase apk size limit to 4.5MB | Increase apk size limit to 4.5MB
| Python | mpl-2.0 | pocmo/focus-android,mozilla-mobile/focus-android,ekager/focus-android,pocmo/focus-android,mastizada/focus-android,liuche/focus-android,pocmo/focus-android,pocmo/focus-android,jonalmeida/focus-android,mozilla-mobile/focus-android,jonalmeida/focus-android,Benestar/focus-android,mozilla-mobile/focus-android,mastizada/focu... | ---
+++
@@ -7,7 +7,7 @@
from os import path, listdir, stat
from sys import exit
-SIZE_LIMIT = 4194304
+SIZE_LIMIT = 4500000
PATH = path.join(path.dirname(path.abspath(__file__)), '../../app/build/outputs/apk/')
files = [] |
1fa22ca68394d4ce55a4e10aa7c23f7bcfa02f79 | zc_common/remote_resource/mixins.py | zc_common/remote_resource/mixins.py | """
Class Mixins.
"""
from django.db import IntegrityError
from django.http import Http404
class MultipleIDMixin(object):
"""
Override get_queryset for multiple id support
"""
def get_queryset(self):
"""
Override :meth:``get_queryset``
"""
if hasattr(self.request, 'quer... | """
Class Mixins.
"""
from django.db import IntegrityError
from django.http import Http404
class MultipleIDMixin(object):
"""
Override get_queryset for multiple id support
"""
def get_queryset(self):
"""
Override :meth:``get_queryset``
"""
if hasattr(self.request, 'quer... | Update query param for mixin | Update query param for mixin
| Python | mit | ZeroCater/zc_common,ZeroCater/zc_common | ---
+++
@@ -13,8 +13,8 @@
"""
Override :meth:``get_queryset``
"""
- if hasattr(self.request, 'query_params') and 'ids' in self.request.query_params:
- query_param_ids = self.request.query_params.get('ids')
+ if hasattr(self.request, 'query_params') and 'filter[id]' ... |
c5f6a9632b6d996fc988bfc9317915208ff69a42 | domain/companies.py | domain/companies.py | # -*- coding: utf-8 -*-
"""
'companies' resource and schema settings.
:copyright: (c) 2014 by Nicola Iarocci and CIR2000.
:license: BSD, see LICENSE for more details.
"""
from common import required_string
_schema = {
# company id ('id')
'n': required_string, # name
'p': ... | # -*- coding: utf-8 -*-
"""
'companies' resource and schema settings.
:copyright: (c) 2014 by Nicola Iarocci and CIR2000.
:license: BSD, see LICENSE for more details.
"""
from common import required_string
_schema = {
# company id ('id')
'name': required_string,
'password': {'type': 'string', ... | Add a snake_cased field to the test document. | Add a snake_cased field to the test document.
| Python | bsd-3-clause | nicolaiarocci/Eve.NET-testbed | ---
+++
@@ -9,8 +9,9 @@
_schema = {
# company id ('id')
- 'n': required_string, # name
- 'p': {'type': 'string', 'nullable': True}, # password
+ 'name': required_string,
+ 'password': {'type': 'string', 'nullable': True},
+ 'state_or_province': {'type': 'string', 'nullabl... |
9502de0e6be30e4592f4f0cf141abc27db64ccf4 | dependencies.py | dependencies.py | import os
import pkgutil
import site
if pkgutil.find_loader("gi"):
try:
import gi
print('Found gi:', os.path.abspath(gi.__file__))
gi.require_version('Gst', '1.0')
# from gi.repository import GLib, Gst
except ValueError:
print('Couldn\'t find Gst')
print('Please ... | import os
import pkgutil
import site
from sys import exit
if pkgutil.find_loader('gi'):
try:
import gi
print("Found gi at:", os.path.abspath(gi.__file__))
gi.require_version('Gst', '1.0')
# from gi.repository import Gst
except ValueError:
print("Couldn\'t find Gst",
... | Clean up of text Proper exit when exception has been raised | Clean up of text
Proper exit when exception has been raised
| Python | mit | Kane610/axis | ---
+++
@@ -1,28 +1,32 @@
import os
import pkgutil
import site
+from sys import exit
-if pkgutil.find_loader("gi"):
+if pkgutil.find_loader('gi'):
try:
import gi
- print('Found gi:', os.path.abspath(gi.__file__))
+ print("Found gi at:", os.path.abspath(gi.__file__))
gi.requir... |
099892e56f02c683879d05625b1215212fda7c9e | links/views.py | links/views.py | from django.shortcuts import render, redirect
from django.http import Http404
from .models import Link, LinkForm
from urlparse import urlparse
def catchall(request, id):
try:
link = Link.objects.get(id=id)
return redirect(link.url)
except:
parsed = urlparse(id)
if parsed.netloc:
... | from django.shortcuts import render, redirect
from django.http import Http404
from .models import Link, LinkForm
from urlparse import urlparse
def catchall(request, id):
try:
link = Link.objects.get(id=id)
return redirect(link.url)
except:
parsed = urlparse(id)
if parsed.netloc:
... | Update post handling after migration | Update post handling after migration
| Python | mit | kudos/min.ie,kudos/min.ie | ---
+++
@@ -19,8 +19,8 @@
def home(request):
context = {'form': LinkForm}
- if 'link' in request.POST:
- link = Link(link=request.POST['url'])
+ if 'url' in request.POST:
+ link = Link(url=request.POST['url'])
link.save();
context['short_url'] = "http://" + str(request.get_host()) + "/" + str(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.