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 |
|---|---|---|---|---|---|---|---|---|---|---|
f557c20678de706d9e714e1d903b482b7e886e3b | keras_contrib/backend/cntk_backend.py | keras_contrib/backend/cntk_backend.py | from keras.backend import cntk_backend as KCN
from keras.backend.cntk_backend import logsumexp
import cntk as C
import numpy as np
def clip(x, min_value, max_value):
"""Element-wise value clipping.
If min_value > max_value, clipping range is [min_value,min_value].
# Arguments
x: Tensor or variab... | from keras.backend import cntk_backend as KCN
from keras.backend.cntk_backend import logsumexp
import cntk as C
import numpy as np
def clip(x, min_value, max_value):
"""Element-wise value clipping.
If min_value > max_value, clipping range is [min_value,min_value].
# Arguments
x: Tensor or variab... | Add moments op to CNTK backend, and associated tests | Add moments op to CNTK backend, and associated tests
| Python | mit | keras-team/keras-contrib,keras-team/keras-contrib,farizrahman4u/keras-contrib,keras-team/keras-contrib | ---
+++
@@ -25,3 +25,11 @@
min_value = -np.inf
max_value = C.maximum(min_value, max_value)
return C.clip(x, min_value, max_value)
+
+
+def moments(x, axes, shift=None, keep_dims=False):
+ ''' Calculates and returns the mean and variance of the input '''
+ mean_batch = KCN.mean(x, axis=axes, k... |
52da8be7ffe6ea2ba09acf3ce44b9a79758b115b | glance/version.py | glance/version.py | # Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | # Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | Remove runtime dep on python pbr | Remove runtime dep on python pbr
| Python | apache-2.0 | redhat-openstack/glance,redhat-openstack/glance | ---
+++
@@ -13,6 +13,31 @@
# under the License.
-import pbr.version
+GLANCE_VENDOR = "OpenStack Foundation"
+GLANCE_PRODUCT = "OpenStack Glance"
+GLANCE_PACKAGE = None # OS distro package version suffix
-version_info = pbr.version.VersionInfo('glance')
+loaded = False
+
+
+class VersionInfo(object):
+ r... |
94b73811a4986dee5ac32fe1d91f377828a5bca5 | mnemosyne/app/__init__.py | mnemosyne/app/__init__.py | import aiohttp
import aiohttp.web
from mnemosyne.app import by_time, by_uuid
application = aiohttp.web.Application()
# by_uuid API
# app.router.add_route('GET', '/applications', mnemosyne.applications.index)
application.router.add_route('GET', '/trace/{traceUuid}', by_uuid.getTrace)
application.router.add_route('GET... |
import os
import aiohttp
import aiohttp.web
from mnemosyne.app import by_time, by_uuid
application = aiohttp.web.Application()
class DirectoryIndex(aiohttp.web.StaticRoute):
def handle(self, request):
filename = request.match_info['filename']
if not filename:
filename = 'index.html'... | Add static route serving files | Add static route serving files
Custom static file handler resolves `/` to `/index.html`.
| Python | agpl-3.0 | jgraichen/mnemosyne,jgraichen/mnemosyne,jgraichen/mnemosyne | ---
+++
@@ -1,3 +1,5 @@
+
+import os
import aiohttp
import aiohttp.web
@@ -5,11 +7,31 @@
application = aiohttp.web.Application()
+class DirectoryIndex(aiohttp.web.StaticRoute):
+ def handle(self, request):
+ filename = request.match_info['filename']
+
+ if not filename:
+ filename... |
66c1bcdb242b30658d323832af04ee814432bdc9 | hackernews_scrapy/items.py | hackernews_scrapy/items.py | # -*- coding: utf-8 -*-
import scrapy
class HackernewsScrapyItem(scrapy.Item):
title = scrapy.Field()
crawled_at = scrapy.Field()
| # -*- coding: utf-8 -*-
import scrapy
class HackernewsScrapyItem(scrapy.Item):
title = scrapy.Field()
url = scrapy.Field()
| Add url field to HackernewsScrapyItem and remove "crawled_at" | Add url field to HackernewsScrapyItem and remove "crawled_at"
| Python | mit | mdsrosa/hackernews_scrapy | ---
+++
@@ -4,4 +4,4 @@
class HackernewsScrapyItem(scrapy.Item):
title = scrapy.Field()
- crawled_at = scrapy.Field()
+ url = scrapy.Field() |
11d4059cf5c66e6de648c675bb049825901479cf | code/array_map.py | code/array_map.py | arr = [1, 5, 10, 20]
print(*map(lambda num: num * 2, arr))
| arr = [1, 5, 10, 20]
print([num * 2 for num in arr])
| Use more consistent example for map | Use more consistent example for map
There is a `map` function in pythin, but for simple single expression
calculations, list comprehensions are much better suited.
While map works well if there is a function, you can pass.
| Python | mit | Evmorov/ruby-coffeescript,evmorov/lang-compare,evmorov/lang-compare,evmorov/lang-compare,evmorov/lang-compare,Evmorov/ruby-coffeescript,evmorov/lang-compare,Evmorov/ruby-coffeescript,evmorov/lang-compare | ---
+++
@@ -1,2 +1,2 @@
arr = [1, 5, 10, 20]
-print(*map(lambda num: num * 2, arr))
+print([num * 2 for num in arr]) |
546ff329d4a792ddfb0576c78cf6d3e4f2321727 | scripts/build_profile_docs.py | scripts/build_profile_docs.py | #! /bin/env python
import os
from typing import Any, Dict, Generator, Iterable, Type
from isort.profiles import profiles
OUTPUT_FILE = os.path.abspath(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "../docs/configuration/profiles.md")
)
HEADER = """Built-in Profile for isort
========
The following pr... | #! /bin/env python
import os
from typing import Any, Dict, Generator, Iterable, Type
from isort.profiles import profiles
OUTPUT_FILE = os.path.abspath(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "../docs/configuration/profiles.md")
)
HEADER = """Built-in Profile for isort
========
The following pr... | Fix typo in profile doc description build | Fix typo in profile doc description build
| Python | mit | PyCQA/isort,PyCQA/isort | ---
+++
@@ -24,7 +24,7 @@
return f"""
#{profile_name}
-{profile.get('descripiton', '')}
+{profile.get('description', '')}
{options}
"""
|
75f0db346adfcf53f71ff69aa61c163a84116e0e | seaworthy/tests/test_utils.py | seaworthy/tests/test_utils.py | from testtools.assertions import assert_that
from testtools.matchers import Equals
from seaworthy.utils import resource_name
def test_resource_name():
# Dummy test so that pytest passes
assert_that(resource_name('foo'), Equals('test_foo'))
| from testtools.assertions import assert_that
from testtools.matchers import Equals
from ..utils import resource_name
def test_resource_name():
# Dummy test so that pytest passes
assert_that(resource_name('foo'), Equals('test_foo'))
| Fix the import order lint error | Fix the import order lint error
| Python | bsd-3-clause | praekeltfoundation/seaworthy | ---
+++
@@ -1,7 +1,7 @@
from testtools.assertions import assert_that
from testtools.matchers import Equals
-from seaworthy.utils import resource_name
+from ..utils import resource_name
def test_resource_name(): |
21ab1204c1cb35a5d9b95124040e160f4f5edabd | solitude/settings/__init__.py | solitude/settings/__init__.py | from local import *
| from .base import *
try:
from .local import *
except ImportError, exc:
exc.args = tuple(['%s (did you rename settings/local.py-dist?)' % exc.args[0]])
raise exc
| Revert "some random settings changes" | Revert "some random settings changes"
This reverts commit 640eb2be2e32413718e93c1b8c77279ab5152170.
| Python | bsd-3-clause | muffinresearch/solitude,muffinresearch/solitude | ---
+++
@@ -1 +1,6 @@
-from local import *
+from .base import *
+try:
+ from .local import *
+except ImportError, exc:
+ exc.args = tuple(['%s (did you rename settings/local.py-dist?)' % exc.args[0]])
+ raise exc |
481028f075bf46696b8adc5904663e97bc883c52 | notfound.py | notfound.py | from google.appengine.ext.webapp import template
import webapp2
import os
class NotFound(webapp2.RequestHandler):
def get(self):
path = os.path.join(os.path.dirname(__file__), 'templates/notfound.html')
self.response.out.write(template.render(path, {}))
app = webapp2.WSGIApplication([('/.*', NotFo... | from google.appengine.ext.webapp import template
import webapp2
import os
class NotFound(webapp2.RequestHandler):
def get(self):
self.error(404)
path = os.path.join(os.path.dirname(__file__), 'templates/notfound.html')
self.response.out.write(template.render(path, {}))
app = webapp2.WSGIA... | Return HTTP Status Code 404 for not found errors | Return HTTP Status Code 404 for not found errors
| Python | mit | mback2k/appengine-oauth-profile,mback2k/appengine-oauth-profile | ---
+++
@@ -4,6 +4,8 @@
class NotFound(webapp2.RequestHandler):
def get(self):
+ self.error(404)
+
path = os.path.join(os.path.dirname(__file__), 'templates/notfound.html')
self.response.out.write(template.render(path, {}))
|
b77e2fa27e8e2cae133cc2bc0e2f130b999b83c5 | pythonFlaskStarter/app/welcome.py | pythonFlaskStarter/app/welcome.py | # Copyright 2015 IBM Corp. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | # Copyright 2015 IBM Corp. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | Fix bad encoding in boilerplate | Fix bad encoding in boilerplate
| Python | apache-2.0 | javed120183/testingrepo,rvennam/starter-apps,javed120183/testingrepo,rvennam/starter-apps,rvennam/starter-apps,rvennam/starter-apps | ---
+++
@@ -1,13 +1,13 @@
# Copyright 2015 IBM Corp. All Rights Reserved.
#
-# Licensed under the Apache License, Version 2.0 (the “License”);
+# 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 Licens... |
91d63e50df5bc8b9fe7d98b28efd541bafd0bc08 | blankspot/node_registration/urls.py | blankspot/node_registration/urls.py | from django.conf.urls import patterns, url
from node_registration import views
urlpatterns = patterns('',
url(r'^add/$', views.PositionCreate.as_view(), name='position-add'),
url(r'^list', views.ListPosition.as_view(), name='position-list')
)
| from django.conf.urls import patterns, url
from node_registration import views
urlpatterns = patterns('',
url(r'^add/$', views.PositionCreate.as_view(), name='position-add'),
url(r'^list', views.ListPosition.as_view(), name='position-list')
)
| Replace \t by spaces for indention | Replace \t by spaces for indention
| Python | agpl-3.0 | frlan/blankspot | ---
+++
@@ -2,6 +2,6 @@
from node_registration import views
urlpatterns = patterns('',
- url(r'^add/$', views.PositionCreate.as_view(), name='position-add'),
- url(r'^list', views.ListPosition.as_view(), name='position-list')
+ url(r'^add/$', views.PositionCreate.as_view(), name='position-add'),
+ url(r'^li... |
a136f7046b8df661713d3bcf6a7681894210def2 | ricker/__init__.py | ricker/__init__.py | """
Ricker wavelet generator for seismic simulation
===============================================
"""
from __future__ import division, print_function, absolute_import | """
Ricker wavelet generator for seismic simulation
===============================================
"""
from __future__ import division, print_function, absolute_import
from .ricker import ricker
| Make ricker funciton available in the top level. | Make ricker funciton available in the top level.
| Python | mit | gatechzhu/ricker | ---
+++
@@ -5,3 +5,5 @@
"""
from __future__ import division, print_function, absolute_import
+
+from .ricker import ricker |
5307e9d879a5432db5f54fd61ea0060b6526a1a6 | sundaytasks/example/test_plugin.py | sundaytasks/example/test_plugin.py | from tornado import gen, ioloop
from tornado.ioloop import IOLoop
import sys
from pkg_resources import iter_entry_points
import json
@gen.coroutine
def main(plugin):
#print("plugin:",plugin['receiver'])
response = yield plugin['receiver']("Prufa")
print("Results: \n%s" % json.dumps(response, sort_keys=True... | from tornado import gen, ioloop
from tornado.ioloop import IOLoop
import sys
from pkg_resources import iter_entry_points
import json
@gen.coroutine
def main(plugin):
response = yield plugin['receiver']("Prufa")
print("Results: \n%s" % json.dumps(response, sort_keys=True,
indent=4, separators=(',', ': ')))
... | Clear old method of calling plugins | Clear old method of calling plugins
| Python | apache-2.0 | olafura/sundaytasks-py | ---
+++
@@ -6,7 +6,6 @@
@gen.coroutine
def main(plugin):
- #print("plugin:",plugin['receiver'])
response = yield plugin['receiver']("Prufa")
print("Results: \n%s" % json.dumps(response, sort_keys=True,
indent=4, separators=(',', ': '))) |
f50ef6d331afa5a55467a104bc307edbdb2cd650 | tests/test_auth.py | tests/test_auth.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import json
from unittest import TestCase
import httpretty
from faker import Faker
from polyaxon_schemas.user import UserConfig
from polyaxon_client.auth import AuthClient
faker = Faker()
class TestAuthClient(TestCase):
... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import json
import uuid
from unittest import TestCase
import httpretty
from faker import Faker
from polyaxon_schemas.authentication import CredentialsConfig
from polyaxon_schemas.user import UserConfig
from polyaxon_client.auth ... | Fix auth tests and add login test | Fix auth tests and add login test
| Python | apache-2.0 | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | ---
+++
@@ -2,9 +2,11 @@
from __future__ import absolute_import, division, print_function
import json
+import uuid
from unittest import TestCase
import httpretty
from faker import Faker
+from polyaxon_schemas.authentication import CredentialsConfig
from polyaxon_schemas.user import UserConfig
@@ -17,6 +19... |
89bec483ce88fb1a310d4dd06220ace412148257 | tests/test_auth.py | tests/test_auth.py | from __future__ import absolute_import
import random
import unittest
from .config import *
from tweepy import API, OAuthHandler
class TweepyAuthTests(unittest.TestCase):
def testoauth(self):
auth = OAuthHandler(oauth_consumer_key, oauth_consumer_secret)
# test getting access token
auth... | from __future__ import absolute_import
import random
import unittest
from six.moves import input
from .config import *
from tweepy import API, OAuthHandler
class TweepyAuthTests(unittest.TestCase):
def testoauth(self):
auth = OAuthHandler(oauth_consumer_key, oauth_consumer_secret)
# test gett... | Update auth tests to be compatible with Python 3 | Update auth tests to be compatible with Python 3
| Python | mit | svven/tweepy,tweepy/tweepy | ---
+++
@@ -2,6 +2,8 @@
import random
import unittest
+
+from six.moves import input
from .config import *
from tweepy import API, OAuthHandler
@@ -15,7 +17,7 @@
# test getting access token
auth_url = auth.get_authorization_url()
print('Please authorize: ' + auth_url)
- verif... |
d604128015826444be4585c7204030840e9efc88 | tests/test_java.py | tests/test_java.py | def test_java_exists(Command):
version_result = Command("java -version")
assert version_result.rc == 0
| def test_java_exists(Command):
version_result = Command("java -version")
assert version_result.rc == 0
def test_java_certs_exist(File):
assert File("/etc/ssl/certs/java/cacerts").exists
| Add test to make sure SSL certs are installed. | Add test to make sure SSL certs are installed.
| Python | apache-2.0 | azavea/ansible-java,flibbertigibbet/ansible-java | ---
+++
@@ -2,3 +2,7 @@
version_result = Command("java -version")
assert version_result.rc == 0
+
+
+def test_java_certs_exist(File):
+ assert File("/etc/ssl/certs/java/cacerts").exists |
1db05fb528295456e2127be5ba5225d697655676 | metashare/accounts/urls.py | metashare/accounts/urls.py | from django.conf.urls.defaults import patterns
from metashare.settings import DJANGO_BASE
urlpatterns = patterns('metashare.accounts.views',
(r'create/$',
'create'),
(r'confirm/(?P<uuid>[0-9a-f]{32})/$',
'confirm'),
(r'contact/$',
'contact'),
(r'reset/(?:(?P<uuid>[0-9a-f]{32})/)?$',
'reset'),
... | from django.conf.urls.defaults import patterns
from metashare.settings import DJANGO_BASE
urlpatterns = patterns('metashare.accounts.views',
(r'create/$',
'create'),
(r'confirm/(?P<uuid>[0-9a-f]{32})/$',
'confirm'),
(r'contact/$',
'contact'),
(r'reset/(?:(?P<uuid>[0-9a-f]{32})/)?$',
'reset'),
... | Manage default editor group on a single page | Manage default editor group on a single page
| Python | bsd-3-clause | zeehio/META-SHARE,MiltosD/CEF-ELRC,zeehio/META-SHARE,MiltosD/CEFELRC,MiltosD/CEF-ELRC,zeehio/META-SHARE,MiltosD/CEFELRC,MiltosD/CEF-ELRC,MiltosD/CEF-ELRC,JuliBakagianni/CEF-ELRC,MiltosD/CEFELRC,MiltosD/CEFELRC,zeehio/META-SHARE,JuliBakagianni/META-SHARE,JuliBakagianni/CEF-ELRC,JuliBakagianni/META-SHARE,JuliBakagianni/C... | ---
+++
@@ -16,10 +16,8 @@
'editor_group_application'),
(r'organization_application/$',
'organization_application'),
- (r'add_default_editor_groups/$',
- 'add_default_editor_groups'),
- (r'remove_default_editor_groups/$',
- 'remove_default_editor_groups'),
+ (r'update_default_editor_groups/$',
+... |
29978337158d06c6c761294fd1e3c5c54de847ae | src/webassets/filter/uglifyjs.py | src/webassets/filter/uglifyjs.py | """Minify Javascript using `UglifyJS <https://github.com/mishoo/UglifyJS/>`_.
UglifyJS is an external tool written for NodeJS; this filter assumes that
the ``uglifyjs`` executable is in the path. Otherwise, you may define
a ``UGLIFYJS_BIN`` setting. Additional options may be passed to ``uglifyjs``
by setting ``UGLIFYJ... | """Minify Javascript using `UglifyJS <https://github.com/mishoo/UglifyJS/>`_.
UglifyJS is an external tool written for NodeJS; this filter assumes that
the ``uglifyjs`` executable is in the path. Otherwise, you may define
a ``UGLIFYJS_BIN`` setting. Additional options may be passed to ``uglifyjs``
by setting ``UGLIFYJ... | Fix misspelled UglifyJS filter class name | Fix misspelled UglifyJS filter class name
| Python | bsd-2-clause | scorphus/webassets,heynemann/webassets,glorpen/webassets,john2x/webassets,JDeuce/webassets,wijerasa/webassets,glorpen/webassets,0x1997/webassets,aconrad/webassets,JDeuce/webassets,aconrad/webassets,john2x/webassets,heynemann/webassets,florianjacob/webassets,wijerasa/webassets,glorpen/webassets,aconrad/webassets,heynema... | ---
+++
@@ -11,10 +11,10 @@
from webassets.filter import Filter
-__all__ = ('UglifySFilter',)
+__all__ = ('UglifyJSFilter',)
-class UglifySFilter(Filter):
+class UglifyJSFilter(Filter):
name = 'uglifyjs'
|
722228a023aca35660bc493b812727f6c665b3cb | posts.py | posts.py | import json
import pprint
import requests
def sample_valid_reddit_response():
r = requests.get('http://www.reddit.com/r/cscareerquestions/top.json')
response_json = r.json()
if 'data' not in response_json:
print("Trying again")
response_json = sample_valid_reddit_response()
return response_json
def save_samp... | import json
import pprint
import requests
SAMPLE_REDDIT_URL = 'http://www.reddit.com/r/cscareerquestions/top.json'
def sample_valid_reddit_response():
r = requests.get(SAMPLE_REDDIT_URL)
response_json = r.json()
if 'data' not in response_json:
print("Trying again")
response_json = sample_valid_reddit_response... | Make reddit url a constant | Make reddit url a constant
| Python | mit | RossCarriga/repost-data | ---
+++
@@ -2,8 +2,10 @@
import pprint
import requests
+SAMPLE_REDDIT_URL = 'http://www.reddit.com/r/cscareerquestions/top.json'
+
def sample_valid_reddit_response():
- r = requests.get('http://www.reddit.com/r/cscareerquestions/top.json')
+ r = requests.get(SAMPLE_REDDIT_URL)
response_json = r.json()
if '... |
d3d5c0c6d13b6cf84b8a7e12e40e9740ca960529 | spillway/mixins.py | spillway/mixins.py | from rest_framework.exceptions import ValidationError
class ModelSerializerMixin(object):
"""Provides generic model serializer classes to views."""
model_serializer_class = None
def get_serializer_class(self):
if self.serializer_class:
return self.serializer_class
class Defaul... | from rest_framework.exceptions import ValidationError
class ModelSerializerMixin(object):
"""Provides generic model serializer classes to views."""
model_serializer_class = None
def get_serializer_class(self):
if self.serializer_class:
return self.serializer_class
class Defaul... | Use request.data to access file uploads | Use request.data to access file uploads
| Python | bsd-3-clause | kuzmich/django-spillway,barseghyanartur/django-spillway,bkg/django-spillway | ---
+++
@@ -21,8 +21,7 @@
def clean_params(self):
"""Returns a validated form dict from Request parameters."""
form = self.query_form_class(
- self.request.query_params or self.request.data,
- self.request.FILES or None)
+ self.request.query_params or self.reque... |
7a5cb8ba82b79372226f9ac4ba3a71e4209cdd72 | sheldon/storage.py | sheldon/storage.py | # -*- coding: utf-8 -*-
"""
Interface to Redis-storage.
@author: Seva Zhidkov
@contact: zhidkovseva@gmail.com
@license: The MIT license
Copyright (C) 2015
"""
class Storage:
pass | # -*- coding: utf-8 -*-
"""
Interface to Redis-storage.
@author: Seva Zhidkov
@contact: zhidkovseva@gmail.com
@license: The MIT license
Copyright (C) 2015
"""
from .utils import logger
# We will catch all import exceptions in bot.py
from redis import StrictRedis
class Storage:
def __init__(self, bot):
... | Create init of Storage class | Create init of Storage class
| Python | mit | lises/sheldon | ---
+++
@@ -9,7 +9,41 @@
Copyright (C) 2015
"""
+from .utils import logger
+
+# We will catch all import exceptions in bot.py
+from redis import StrictRedis
class Storage:
- pass
+ def __init__(self, bot):
+ """
+ Create new storage for bot
+
+ :param bot: Bot object
+ :retu... |
7cc8699f7100cfc969b1b76efbcc47e1fafb2363 | paiji2_shoutbox/models.py | paiji2_shoutbox/models.py | from django.db import models
from django.utils.translation import ugettext as _
from django.utils.timezone import now
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except:
from django.contrib.auth.models import User
class Note(models.Model):
author = models.ForeignKey(
... | from django.db import models
from django.utils.translation import ugettext as _
from django.utils.timezone import now
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except:
from django.contrib.auth.models import User
class Note(models.Model):
author = models.ForeignKey(
... | Remove save method for auto_now_add=True | Remove save method for auto_now_add=True
| Python | agpl-3.0 | rezometz/django-paiji2-shoutbox,rezometz/django-paiji2-shoutbox | ---
+++
@@ -22,12 +22,8 @@
)
posted_at = models.DateTimeField(
_('publication date'),
+ auto_now_add=True,
)
-
- def save(self, *args, **kwargs):
- if self.pk is None:
- self.posted_at = now()
- super(Note, self).save(*args, **kwargs)
class Meta:
... |
f4a73fcc591d877003e9963f087d2473568bfa9d | python/ql/test/experimental/query-tests/Security/CWE-079/sendgrid_via_mail_send_post_request_body_bad.py | python/ql/test/experimental/query-tests/Security/CWE-079/sendgrid_via_mail_send_post_request_body_bad.py | # This tests that the developer doesn't pass tainted user data into the mail.send.post() method in the SendGrid library.
import sendgrid
import os
sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
data = {
"content": [
{
"type": "text/html",
"value": "<html><p>He... | import sendgrid
import os
from flask import request, Flask
app = Flask(__name__)
@app.route("/sendgrid")
def send():
sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
data = {
"content": [
{
"type": "text/html",
"value": "<html>{}</html>"... | Add RFS to `sendgrid` test | Add RFS to `sendgrid` test
| Python | mit | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | ---
+++
@@ -1,44 +1,48 @@
-# This tests that the developer doesn't pass tainted user data into the mail.send.post() method in the SendGrid library.
import sendgrid
import os
+from flask import request, Flask
+
+app = Flask(__name__)
-sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
+@app.rout... |
00a05d86e83f95ecab589313459212a6d6ec4355 | setup.py | setup.py | from setuptools import setup
setup(
name='discord-curious',
version='0.2.0.post1',
packages=['curious', 'curious.core', 'curious.http', 'curious.commands', 'curious.dataclasses', 'curious.voice',
'curious.ext.loapi', 'curious.ext.paginator'],
url='https://github.com/SunDwarf/curious',
... | from setuptools import setup
setup(
name='discord-curious',
version='0.2.0.post1',
packages=['curious', 'curious.core', 'curious.http', 'curious.commands', 'curious.dataclasses', 'curious.voice',
'curious.ext.loapi', 'curious.ext.paginator'],
url='https://github.com/SunDwarf/curious',
... | Update `curio` pin to 0.6.0. | Update `curio` pin to 0.6.0.
Signed-off-by: Laura <07c342be6e560e7f43842e2e21b774e61d85f047@veriny.tf>
| Python | mit | SunDwarf/curious | ---
+++
@@ -12,7 +12,7 @@
description='A curio library for the Discord API',
install_requires=[
"cuiows>=0.1.10",
- "curio==0.5.0",
+ "curio==0.6.0",
"h11==0.7.0",
"multidict==2.1.4",
"pylru==1.0.9", |
bace6c5562b8c085858824168ba3ed4bf73fe3ae | setup.py | setup.py | #! /usr/bin/env python
'''
This file is part of ConfigShell.
Copyright (c) 2011-2013 by Datera, Inc
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
U... | #! /usr/bin/env python
'''
This file is part of ConfigShell.
Copyright (c) 2011-2013 by Datera, Inc
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
U... | Add missing dependency on pyparsing and six | Add missing dependency on pyparsing and six
Signed-off-by: Christophe Vu-Brugier <1930e27f67e1e10d51770b88cb06d386f1aa46ae@fastmail.fm>
| Python | apache-2.0 | agrover/configshell-fb,cvubrugier/configshell-fb | ---
+++
@@ -27,6 +27,10 @@
maintainer_email = 'agrover@redhat.com',
url = 'http://github.com/open-iscsi/configshell-fb',
packages = ['configshell', 'configshell_fb'],
+ install_requires = [
+ 'pyparsing',
+ 'six',
+ ],
classifiers = [
"Programming Language :: Python",
... |
6fed8b08e280b88a491ca6c04e0a2c429e7f493f | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
from distutils.core import setup
setup(
name='django-banking',
version='0.1-dev',
description='Banking (SWIFT) classes for Python/Django',
long_description=open('README').read(),
author='Benjamin P. Jung',
author_em... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
from distutils.core import setup
setup(
name='django-banking',
version='0.1-dev',
description='Banking (SWIFT) classes for Python/Django',
long_description=open('README').read(),
author='Benjamin P. Jung',
author_em... | Include 'models' subdirectory in package | Include 'models' subdirectory in package
| Python | bsd-3-clause | headcr4sh/django-banking | ---
+++
@@ -13,7 +13,7 @@
author_email='headcr4sh@gmail.com',
url='https://github.com/headcr4sh/dango-banking',
download_url='https://github.com/headcr4sh/django-banking/downloads/',
- packages = ['django_banking',],
+ packages = ['django_banking', 'django_banking.models'],
license='BSD',
... |
7375a9c8adbc14932af2638cf1067c379457da48 | setup.py | setup.py | """
nubo
----
An easy way to deploy Linux VMs on different cloud providers.
Links
`````
* `GitHub Repository <https://github.com/ema/nubo>`_
* `Development Version
<http://github.com/ema/nubo/zipball/master#egg=nubo-dev>`_
"""
from setuptools import setup
setup(
name='nubo',
version='0.4',
url='http://... | """
nubo
----
An easy way to deploy Linux VMs on different cloud providers.
Links
`````
* `GitHub Repository <https://github.com/ema/nubo>`_
* `Development Version
<http://github.com/ema/nubo/zipball/master#egg=nubo-dev>`_
"""
from setuptools import setup
install_requires = [
'setuptools',
'apach... | Add importlib to install_requires if necessary | Add importlib to install_requires if necessary
| Python | bsd-3-clause | ema/nubo | ---
+++
@@ -12,6 +12,18 @@
from setuptools import setup
+install_requires = [
+ 'setuptools',
+ 'apache-libcloud',
+ 'paramiko',
+ 'texttable'
+]
+
+try:
+ import importlib
+except ImportError:
+ install_requires.append('importlib')
+
setup(
name='nubo',
version=... |
d237dd2c68ed083d65d69b31d0a1905262a9edca | setup.py | setup.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from setuptools import setup, Extension
import os
from Cython.Build import cythonize
if (os.name == "nt"):
compile_args = ['/EHs', '/D_CRT_SECURE_NO_DEPRECATE']
else:
compile_args = ['-Wno-switch-enum', '-Wno-switch', '-Wno-switch-default',
... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from setuptools import setup, Extension
import platform
from Cython.Build import cythonize
os_name = platform.system()
if (os_name == "Windows"):
compile_args = ['/EHs', '/D_CRT_SECURE_NO_DEPRECATE']
else:
compile_args = ['-Wno-switch-enum', '-Wn... | Add compile arg for building on MacOS Catalina / Xcode 11.2 | Add compile arg for building on MacOS Catalina / Xcode 11.2
| Python | bsd-3-clause | sot/Chandra.Time,sot/Chandra.Time,sot/Chandra.Time | ---
+++
@@ -1,14 +1,17 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from setuptools import setup, Extension
-import os
+import platform
from Cython.Build import cythonize
-if (os.name == "nt"):
+os_name = platform.system()
+if (os_name == "Windows"):
compile_args = ['/EHs', '/D_CRT_S... |
0ae34253829e0d51049edf5f7d270b404bc22354 | setup.py | setup.py | import os
from setuptools import setup, find_packages
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
setup(
name="django-nopassword",
version='1.1.0',
url='http://github.com/relekang/django-nopassword',
author='Rolf Erik Lekang',
author_email='me@rolflekang.com',
description='Authenti... | import os
from setuptools import setup, find_packages
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
setup(
name="django-nopassword",
version='1.1.0',
url='http://github.com/relekang/django-nopassword',
author='Rolf Erik Lekang',
author_email='me@rolflekang.com',
description='Authenti... | Remove reference to email from short description | Remove reference to email from short description
| Python | mit | relekang/django-nopassword,smajda/django-nopassword,relekang/django-nopassword,mjumbewu/django-nopassword,smajda/django-nopassword,mjumbewu/django-nopassword | ---
+++
@@ -9,8 +9,7 @@
url='http://github.com/relekang/django-nopassword',
author='Rolf Erik Lekang',
author_email='me@rolflekang.com',
- description='Authentication backend for django that uses '
- 'email verification instead of passwords',
+ description='Authentication backend f... |
78a596ba34a3a8a7435dd6ca997e6b6cb79fbdd6 | setup.py | setup.py | #!/usr/bin/env python2.7
from __future__ import print_function
from distutils.core import setup
import os
version = '1.0.0b'
# Append TeamCity build number if it gives us one.
if 'TC_BUILD_NUMBER' in os.environ and version.endswith('b'):
version += '' + os.environ['TC_BUILD_NUMBER']
setup(name='fetch',
mai... | #!/usr/bin/env python2.7
from __future__ import print_function
from distutils.core import setup
import os
version = '1.0.0b'
# Append TeamCity build number if it gives us one.
if 'TC_BUILD_NUMBER' in os.environ and version.endswith('b'):
version += '' + os.environ['TC_BUILD_NUMBER']
setup(name='fetch',
mai... | Add croniter dependency. Sort deps. | Add croniter dependency. Sort deps.
| Python | apache-2.0 | GeoscienceAustralia/fetch,GeoscienceAustralia/fetch | ---
+++
@@ -21,12 +21,13 @@
'bin/fetch-service'
],
requires=[
- 'neocommon',
- 'requests',
+ 'arrow',
+ 'croniter',
'feedparser',
'lxml',
+ 'neocommon',
+ 'pyyaml',
+ 'requests',
'setproctitle',
- ... |
ee4bda5802a601485027a3ea91607dc5077ca73d | setup.py | setup.py | import os
import sys
from setuptools import setup, find_packages
from tethys_apps.app_installation import custom_develop_command, custom_install_command
### Apps Definition ###
app_package = 'canned_gssha'
release_package = 'tethysapp-' + app_package
app_class = 'canned_gssha.app:CannedGSSHA'
app_package_dir = os.path... | import os
import sys
from setuptools import setup, find_packages
from tethys_apps.app_installation import custom_develop_command, custom_install_command
### Apps Definition ###
app_package = 'canned_gssha'
release_package = 'tethysapp-' + app_package
app_class = 'canned_gssha.app:CannedGSSHA'
app_package_dir = os.path... | Set maximum bounds for both plots to provide a common scale for comparison between the different scenarios. | Set maximum bounds for both plots to provide a common scale for comparison between the different scenarios.
| Python | bsd-2-clause | CI-WATER/tethysapp-canned_gssha,CI-WATER/tethysapp-canned_gssha,CI-WATER/tethysapp-canned_gssha | ---
+++
@@ -14,7 +14,7 @@
setup(
name=release_package,
- version='0.0.1',
+ version='0.1.0',
description='Access GSSHA model results that have been put away for a rainy day.',
long_description='',
keywords='', |
8f86b354b3ceff46363e3121bb1f553a8ff8b301 | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
import os.path
import versioneer
versioneer.versionfile_source = "circuit/_version.py"
versioneer.versionfile_build = "circuit/_version.py"
versioneer.tag_prefix = ""
versioneer.parentdir_prefix = ""
commands = versioneer.get_cmdclass().copy()
## Get long_descri... | #!/usr/bin/env python
from setuptools import setup
import versioneer
versioneer.versionfile_source = "circuit/_version.py"
versioneer.versionfile_build = "circuit/_version.py"
versioneer.tag_prefix = ""
versioneer.parentdir_prefix = ""
commands = versioneer.get_cmdclass().copy()
with open('README.md') as f:
long... | Add test suit and requirements. | Add test suit and requirements.
| Python | apache-2.0 | edgeware/python-circuit | ---
+++
@@ -1,7 +1,6 @@
#!/usr/bin/env python
+from setuptools import setup
-from distutils.core import setup
-import os.path
import versioneer
versioneer.versionfile_source = "circuit/_version.py"
@@ -10,18 +9,20 @@
versioneer.parentdir_prefix = ""
commands = versioneer.get_cmdclass().copy()
-## Get long_... |
1d0e6420e0e37921381c30b0247c0f5f27c72a1f | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name="marshmallow-pynamodb",
version="0.7.1",
packages=find_packages(exclude=('*test*',)),
package_dir={'marshmallow-pynamodb': 'marshmallow_pynamodb'},
description='PynamoDB integration with the marshmallow (de)serialization library',
author='... | from setuptools import setup, find_packages
setup(
name="marshmallow-pynamodb",
version="0.8.0",
packages=find_packages(exclude=('*test*',)),
package_dir={'marshmallow-pynamodb': 'marshmallow_pynamodb'},
description='PynamoDB integration with the marshmallow (de)serialization library',
author='... | Increment version number 0.8.0 Set field support | Increment version number 0.8.0 Set field support
| Python | mit | mathewmarcus/marshmallow-pynamodb | ---
+++
@@ -2,7 +2,7 @@
setup(
name="marshmallow-pynamodb",
- version="0.7.1",
+ version="0.8.0",
packages=find_packages(exclude=('*test*',)),
package_dir={'marshmallow-pynamodb': 'marshmallow_pynamodb'},
description='PynamoDB integration with the marshmallow (de)serialization library', |
c529b8d4979f5fae6984d2bcd6d2aa40d181e097 | setup.py | setup.py | import re
from setuptools import setup
__version__,= re.findall('__version__ = "(.*)"', open('mappyfile/__init__.py').read())
def readme():
with open('README.rst') as f:
return f.read()
setup(name='mappyfile',
version=__version__,
description='A pure Python MapFile parser for working with Map... | import re
from setuptools import setup
__version__,= re.findall('__version__ = "(.*)"', open('mappyfile/__init__.py').read())
def readme():
with open('README.rst') as f:
return f.read()
setup(name='mappyfile',
version=__version__,
description='A pure Python MapFile parser for working with Map... | Add schemas folder to package | Add schemas folder to package
| Python | mit | geographika/mappyfile,geographika/mappyfile | ---
+++
@@ -25,7 +25,7 @@
'Topic :: Software Development :: Build Tools'
],
package_data = {
- '': ['*.g']
+ '': ['*.g', 'schemas/*.json']
},
url='http://github.com/geographika/mappyfile',
author='Seth Girvin', |
766e33416df08b6cdcdb236a335afbc6bd7acc06 | setup.py | setup.py | from setuptools import setup
from os import path
with open(path.join(path.abspath(path.dirname(__file__)), 'README.rst')) as f:
readme = f.read()
setup(
name='ghstats',
version='1.1.1',
packages=['ghstats'],
description='GitHub Release download count and other statistics.',
long_description=re... | from setuptools import setup
from os import path
with open(path.join(path.abspath(path.dirname(__file__)), 'README.rst')) as f:
readme = f.read()
setup(
name='ghstats',
version='1.1.1',
packages=['ghstats'],
description='GitHub Release download count and other statistics.',
long_description=re... | Add explicit Python 3.6 support | Add explicit Python 3.6 support
| Python | mit | kefir500/ghstats | ---
+++
@@ -32,6 +32,7 @@
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
'Topic :: Utilities'
]
) |
e05b6484938f65338882a86c9ce2d71df6e5272b | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from distutils.core import setup
setup(
name='regulations-parser',
url='https://github.com/cfpb/regulations-parser',
author='CFPB',
author_email='tech@cfpb.gov',
license='CC0',
version='0.1.0',
description='eCFR Parser for eRegulation... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
setup(
name='regulations-parser',
url='https://github.com/cfpb/regulations-parser',
author='CFPB',
author_email='tech@cfpb.gov',
license='CC0',
version='0.1.0',
description='eCFR Parser for ... | Use find_packages() to ensure the whole regparser gets installed | Use find_packages() to ensure the whole regparser gets installed
| Python | cc0-1.0 | grapesmoker/regulations-parser | ---
+++
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
import os
-from distutils.core import setup
+from setuptools import setup, find_packages
setup(
name='regulations-parser',
@@ -15,7 +15,7 @@
long_description=open('README.md').read()
if os.path.exists('README.md') else '',
- packages=... |
3766a8638094fc7bbf8bfb529312a0741049376b | spyder_memory_profiler/__init__.py | spyder_memory_profiler/__init__.py | # -*- coding: utf-8 -*-
#
# Copyright © 2013 Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
__version__ = '0.2.dev0'
# =============================================================================
# The following statements are required to register this 3rd p... | # -*- coding: utf-8 -*-
#
# Copyright © 2013 Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
__version__ = '0.2.0'
# =============================================================================
# The following statements are required to register this 3rd part... | Change version number to 0.2.0 | Change version number to 0.2.0
| Python | mit | jitseniesen/spyder-memory-profiler,spyder-ide/spyder.memory_profiler,jitseniesen/spyder-memory-profiler | ---
+++
@@ -4,7 +4,7 @@
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
-__version__ = '0.2.dev0'
+__version__ = '0.2.0'
# =============================================================================
# The following statements are required to register this 3rd party plugin: |
137d3c0394309dfb22a407eda5b80bc312482c1d | setup.py | setup.py | from distutils.core import setup
setup(name="zutil",
version='0.1.5',
description="Utilities used for generating zCFD control dictionaries",
author="Zenotech",
author_email="support@zenotech.com",
url="https://zcfd.zenotech.com/",
packages=["zutil", "zutil.post", "zutil.analysis", "... | from distutils.core import setup
setup(name="zutil",
version='0.1.5',
description="Utilities used for generating zCFD control dictionaries",
author="Zenotech",
author_email="support@zenotech.com",
license="MIT",
url="https://zcfd.zenotech.com/",
project_urls={
"Sourc... | Add license and Source Code url | Add license and Source Code url
| Python | mit | zCFD/zutil | ---
+++
@@ -5,7 +5,11 @@
description="Utilities used for generating zCFD control dictionaries",
author="Zenotech",
author_email="support@zenotech.com",
+ license="MIT",
url="https://zcfd.zenotech.com/",
+ project_urls={
+ "Source Code": "https://github.com/zCFD/zutil/",
... |
0e801cf96a7dee047f935b32c931eabe135035ea | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
with open('README.rst') as readme_f:
README = readme_f.read()
with open('tests/requirements.txt') as test_requirements_f:
TEST_REQUIREMENTS = test_requirements_f.readlines()
setup(
name="yturl",
version="1.18.0",
description="Gets direct media... | #!/usr/bin/env python
from setuptools import setup
with open('README.rst') as readme_f:
README = readme_f.read()
with open('tests/requirements.txt') as test_requirements_f:
TEST_REQUIREMENTS = test_requirements_f.readlines()
setup(
name="yturl",
version="1.18.0",
description="Gets direct media... | Update classifiers to show ISC license | Update classifiers to show ISC license
| Python | isc | garg10may/yturl | ---
+++
@@ -31,7 +31,7 @@
classifiers=[
"Development Status :: 5 - Production/Stable",
- "License :: OSI Approved :: MIT License",
+ "License :: OSI Approved :: ISC License (ISCL)",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.2",
... |
9af9144f9026e84ce04f9cdd5ce738b015247c12 | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
from catplot import __version__ as version
maintainer = 'Shao-Zheng-Jiang'
maintainer_email = 'shaozhengjiang@gmail.com'
author = maintainer
author_email = maintainer_email
description = __doc__
requires = [
'numpy',
'scipy',
'matplotlib',
]
license... | #!/usr/bin/env python
from distutils.core import setup
from catplot import __version__ as version
maintainer = 'Shao-Zheng-Jiang'
maintainer_email = 'shaozhengjiang@gmail.com'
author = maintainer
author_email = maintainer_email
description = __doc__
requires = [
'numpy',
'scipy',
'matplotlib',
]
license... | Fix compatible bug: file() -> open(). | Fix compatible bug: file() -> open().
| Python | mit | PytLab/catplot | ---
+++
@@ -16,7 +16,7 @@
]
license = 'LICENSE'
-long_description = file('README.md').read()
+long_description = open('README.md').read()
name = 'python-catplot'
packages = [
'catplot', |
d978f9c54d3509a5fd8ef3b287d2c3dfa7683d77 | setup.py | setup.py | #!/usr/bin/python
from setuptools import setup
setup(name="catsnap",
version="6.0.0",
description="catalog and store images",
author="Erin Call",
author_email="hello@erincall.com",
url="https://github.com/ErinCall/",
packages=['catsnap',
'catsnap.document',
... | #!/usr/bin/python
from setuptools import setup
setup(name="catsnap",
version="6.0.0",
description="catalog and store images",
author="Erin Call",
author_email="hello@erincall.com",
url="https://github.com/ErinCall/",
packages=['catsnap',
'catsnap.document',
... | Upgrade to a newer gevent for OSX Yosemity compat | Upgrade to a newer gevent for OSX Yosemity compat
See https://github.com/gevent/gevent/issues/656
| Python | mit | ErinCall/catsnap,ErinCall/catsnap,ErinCall/catsnap | ---
+++
@@ -24,7 +24,7 @@
"wand==0.3.3",
"celery==3.1.16",
"redis==2.10.3",
- "gevent==1.0.2",
+ "gevent==1.1b5",
"Flask-Sockets==0.1",
"PyYAML==3.11",
|
976167045131263dc52ff57315f08783a318a9df | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
setup(use_scm_version=True)
| #!/usr/bin/env python
from setuptools import setup
setup(name='django-s3file', use_scm_version=True)
| Add package name for github usage report | Add package name for github usage report | Python | mit | codingjoe/django-s3file,codingjoe/django-s3file,codingjoe/django-s3file | ---
+++
@@ -1,4 +1,4 @@
#!/usr/bin/env python
from setuptools import setup
-setup(use_scm_version=True)
+setup(name='django-s3file', use_scm_version=True) |
83f62bd5993ba253183f120567a2a42108c4b7b4 | setup.py | setup.py | from distutils.core import setup
description = """
A python module for calculating riichi mahjong hands: yaku, han and fu.
You can find usage examples here https://github.com/MahjongRepository/mahjong
"""
setup(
name='mahjong',
packages=['mahjong'],
version='1.0.1',
description='Mahjong hands calcula... | from distutils.core import setup
description = """
A python module for calculating riichi mahjong hands: yaku, han and fu.
Right now it supports only japanese version (riichi mahjong). MCR (chinese version) in plans
You can find usage examples here https://github.com/MahjongRepository/mahjong
"""
setup(
name='m... | Add missed packages tot he build script | Add missed packages tot he build script
| Python | mit | MahjongRepository/mahjong | ---
+++
@@ -2,14 +2,21 @@
description = """
A python module for calculating riichi mahjong hands: yaku, han and fu.
+
+Right now it supports only japanese version (riichi mahjong). MCR (chinese version) in plans
You can find usage examples here https://github.com/MahjongRepository/mahjong
"""
setup(
n... |
70189c54cfbe07b819fcd23fbe213be9de5b4db2 | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='sheetsu',
version='0.0.4',
description='Sheetsu Python client',
url='http://github.com/andreffs18/sheetsu-python',
author='Andre Silva',
author_email='andreffs18@gmail.com',
license='MIT',
keywords='sheetsu api client sdk spreadsh... | from setuptools import setup, find_packages
setup(
name='sheetsu',
version='0.0.5',
description='Sheetsu Python client',
url='http://github.com/andreffs18/sheetsu-python',
author='Andre Silva',
author_email='andreffs18@gmail.com',
license='MIT',
keywords='sheetsu api client sdk spreadsh... | Add required packages for lib to work and update version | Add required packages for lib to work and update version
| Python | mit | andreffs18/sheetsu-python | ---
+++
@@ -2,7 +2,7 @@
setup(
name='sheetsu',
- version='0.0.4',
+ version='0.0.5',
description='Sheetsu Python client',
url='http://github.com/andreffs18/sheetsu-python',
author='Andre Silva',
@@ -10,5 +10,6 @@
license='MIT',
keywords='sheetsu api client sdk spreadsheet',
... |
4bf26b6d976171b5a388134ad9716af639f15a3b | 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')).read()
CHANGES = open(os.path.join(here, 'CHANGES')).read()
requires = [
'oauth2client',
]
tests_require = []
testing_requires = tests_require + [
'no... | import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README')).read()
CHANGES = open(os.path.join(here, 'CHANGES')).read()
requires = [
'oauth2client',
'google-api-python-client',
]
tests_require = []
testing_r... | Add the Google API client as a requirement | Add the Google API client as a requirement
| Python | isc | GuardedRisk/Google-Apps-Auditing | ---
+++
@@ -8,6 +8,7 @@
requires = [
'oauth2client',
+ 'google-api-python-client',
]
tests_require = [] |
05bfc141b279dc8f30089e8b72502f9042a2ff3b | setup.py | setup.py | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011-2015 Genestack Limited
# All Rights Reserved
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF GENESTACK LIMITED
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#
from distutils.core import ... | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011-2015 Genestack Limited
# All Rights Reserved
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF GENESTACK LIMITED
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#
from distutils.core import ... | Use move version for sutup.py | Use move version for sutup.py
| Python | mit | genestack/python-client | ---
+++
@@ -10,10 +10,11 @@
#
from distutils.core import setup
+exec(open('genestack/version.py').read())
setup(
name='genestack',
- version='0.1',
+ version=__version__,
packages=['genestack', 'genestack.settings'],
url='',
license='', |
cc92b1770acdc5a34eb32c596c0b2ece6bf32b0f | qiprofile_rest/server/settings.py | qiprofile_rest/server/settings.py | # This file specifies the Eve configuration.
import os
# The run environment default is production.
# Modify this by setting the NODE_ENV environment variable.
env = os.getenv('NODE_ENV') or 'production'
# The MongoDB database.
if env == 'production':
MONGO_DBNAME = 'qiprofile'
else:
MONGO_DBNAME = 'qiprofile_test... | """This ``settings`` file specifies the Eve configuration."""
import os
# The run environment default is production.
# Modify this by setting the NODE_ENV environment variable.
env = os.getenv('NODE_ENV') or 'production'
# The MongoDB database.
if env == 'production':
MONGO_DBNAME = 'qiprofile'
else:
MONGO_DB... | Allow MONGO_HOST env var override. | Allow MONGO_HOST env var override.
| Python | bsd-2-clause | ohsu-qin/qirest,ohsu-qin/qiprofile-rest | ---
+++
@@ -1,4 +1,5 @@
-# This file specifies the Eve configuration.
+"""This ``settings`` file specifies the Eve configuration."""
+
import os
# The run environment default is production.
@@ -6,9 +7,15 @@
env = os.getenv('NODE_ENV') or 'production'
# The MongoDB database.
if env == 'production':
- MONGO_DBN... |
8cab1d360218f6d8075bad08fd38ef90c75e5549 | turbustat/tests/setup_package.py | turbustat/tests/setup_package.py |
def get_package_data():
return {
_ASTROPY_PACKAGE_NAME_ + '.tests': ['data/*.fits', 'data/*.npz']
}
|
def get_package_data():
return {
_ASTROPY_PACKAGE_NAME_ + '.tests': ['data/*.fits', 'data/*.npz',
'coveragerc']
}
| Add coveragerc to package data | Add coveragerc to package data
| Python | mit | e-koch/TurbuStat,Astroua/TurbuStat | ---
+++
@@ -1,5 +1,6 @@
def get_package_data():
return {
- _ASTROPY_PACKAGE_NAME_ + '.tests': ['data/*.fits', 'data/*.npz']
+ _ASTROPY_PACKAGE_NAME_ + '.tests': ['data/*.fits', 'data/*.npz',
+ 'coveragerc']
} |
9371b962e43d6876ff8f902283d3fb1963c076d3 | pytest-{{cookiecutter.plugin_name}}/pytest_{{cookiecutter.plugin_name}}.py | pytest-{{cookiecutter.plugin_name}}/pytest_{{cookiecutter.plugin_name}}.py | # -*- coding: utf-8 -*-
import pytest
def pytest_addoption(parser):
group = parser.getgroup('{{cookiecutter.plugin_name}}')
group.addoption(
'--foo',
action='store_const',
dest='foo',
help='alias for --foo'
)
| Implement a very basic plugin to add an option | Implement a very basic plugin to add an option
| Python | mit | luzfcb/cookiecutter-pytest-plugin,s0undt3ch/cookiecutter-pytest-plugin,pytest-dev/cookiecutter-pytest-plugin | ---
+++
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+
+import pytest
+
+
+def pytest_addoption(parser):
+ group = parser.getgroup('{{cookiecutter.plugin_name}}')
+ group.addoption(
+ '--foo',
+ action='store_const',
+ dest='foo',
+ help='alias for --foo'
+ ) | |
6d1626327f3577a86cdd3c54e5732b65e59a3402 | test2.py | test2.py | import json
import itertools
with open('products.json') as data_file:
data = json.load(data_file)
products = data['products']
products_temp = []
for index, item in enumerate(products):
products_temp.append(item)
products = products_temp
products_temp = [] # delete the variable
for index, item in enumer... | #notes: will do it using oop.
import json
import itertools
with open('products.json') as data_file:
data = json.load(data_file)
products = data['products']
products_temp = []
for index, item in enumerate(products):
products_temp.append(item)
products = products_temp
products_temp = [] # delete the varia... | Add an additional layer for the for loop | Add an additional layer for the for loop
| Python | mit | zhang96/JSONWithPython | ---
+++
@@ -1,3 +1,4 @@
+#notes: will do it using oop.
import json
import itertools
@@ -23,14 +24,15 @@
for index, item in enumerate(products):
if item ['product_type'] == 'Computer':
computers.append((item['title'],item['options']))
- print item
- print "====="
-
- else: pass
- ... |
8c5007bd5a1f898ca0987e7b79b8dd8f0a2642c5 | pfamserver/api.py | pfamserver/api.py | from application import app
from flask.ext.restful import Api, Resource
import os
from subprocess import Popen as run, PIPE
api = Api(app)
class QueryAPI(Resource):
def get(self, query):
cmd = ['./hmmer/binaries/esl-afetch', 'Pfam-A.full', query]
output = run(cmd, stdout=PIPE).communicate()[0]
... | from application import app
from flask.ext.restful import Api, Resource
import os
from subprocess import Popen as run, PIPE
api = Api(app)
def db(query):
cmd = ['./hmmer/binaries/esl-afetch', 'Pfam-A.full', query]
return run(cmd, stdout=PIPE).communicate()[0]
class QueryAPI(Resource):
def get(self, q... | Check variations little variations if the query fails. | Check variations little variations if the query fails.
| Python | agpl-3.0 | ecolell/pfamserver,ecolell/pfamserver,ecolell/pfamserver | ---
+++
@@ -7,14 +7,21 @@
api = Api(app)
+def db(query):
+ cmd = ['./hmmer/binaries/esl-afetch', 'Pfam-A.full', query]
+ return run(cmd, stdout=PIPE).communicate()[0]
+
+
class QueryAPI(Resource):
def get(self, query):
- cmd = ['./hmmer/binaries/esl-afetch', 'Pfam-A.full', query]
- ou... |
f019cb2f0e3604b264aeb55a3a01641f998d27d7 | test/fuzz/gen-dict.py | test/fuzz/gen-dict.py | import json
import sys
def find_literals(literals, node):
'''Recursively find STRING literals in the grammar definition'''
if type(node) is dict:
if 'type' in node and node['type'] == 'STRING' and 'value' in node:
literals.add(node['value'])
for key, value in node.iteritems():
find_literals(l... | import json
import sys
def find_literals(literals, node):
'''Recursively find STRING literals in the grammar definition'''
if type(node) is dict:
if 'type' in node and node['type'] == 'STRING' and 'value' in node:
literals.add(node['value'])
for key, value in node.iteritems():
find_literals(l... | Handle non-ascii characters when generating fuzzing dictionary | Handle non-ascii characters when generating fuzzing dictionary
This caused a failure when generating the dictionary for `tree-sitter-agda`.
| Python | mit | tree-sitter/tree-sitter,tree-sitter/tree-sitter,tree-sitter/tree-sitter,tree-sitter/tree-sitter,tree-sitter/tree-sitter,tree-sitter/tree-sitter,tree-sitter/tree-sitter | ---
+++
@@ -25,7 +25,7 @@
for lit in sorted(literals):
if lit:
- print '"%s"' % ''.join([(c if c.isalnum() else '\\x%02x' % ord(c)) for c in lit])
+ print '"%s"' % ''.join(['\\x%02x' % ord(b) for b in lit.encode('utf-8')])
if __name__ == '__main__':
main() |
6dd5a006892b1ba51c7f4f338693bf780293b897 | dedupe/_typing.py | dedupe/_typing.py | import numpy
import sys
from typing import (Iterator,
Tuple,
Mapping,
Union,
Iterable,
List,
Any)
if sys.version_info >= (3, 8):
from typing import TypedDict, Protocol, Literal
else:
from ty... | import numpy
import sys
from typing import (Iterator,
Tuple,
Mapping,
Union,
Iterable,
List,
Any)
if sys.version_info >= (3, 8):
from typing import TypedDict, Protocol, Literal
else:
from ty... | Remove use of "unsure" from TrainingData type | Remove use of "unsure" from TrainingData type
The "unsure" key isn't used anywhere else
| Python | mit | dedupeio/dedupe,dedupeio/dedupe | ---
+++
@@ -31,13 +31,9 @@
JoinConstraint = Literal['one-to-one', 'many-to-one', 'many-to-many']
-class _TrainingData(TypedDict):
+class TrainingData(TypedDict):
match: List[TrainingExample]
distinct: List[TrainingExample]
-
-
-class TrainingData(_TrainingData, total=False):
- uncertain: List[Traini... |
476338ba2edce4ff78f9451ae9cca6a2c91f787b | opps/core/admin/article.py | opps/core/admin/article.py | # -*- coding: utf-8 -*-
from django.contrib import admin
from django import forms
from opps.core.models import Post, PostImage
from opps.core.models import Image
from redactor.widgets import RedactorEditor
class PostImageInline(admin.TabularInline):
model = PostImage
fk_name = 'post'
raw_id_fields = ['... | # -*- coding: utf-8 -*-
from django.contrib.sites.models import Site
from django.contrib import admin
from django import forms
from opps.core.models import Post, PostImage
from opps.core.models import Image
from redactor.widgets import RedactorEditor
class PostImageInline(admin.TabularInline):
model = PostImag... | Fix field set on post admin, opps core | Fix field set on post admin, opps core
| Python | mit | YACOWS/opps,jeanmask/opps,opps/opps,jeanmask/opps,opps/opps,opps/opps,williamroot/opps,jeanmask/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,opps/opps,williamroot/opps | ---
+++
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
+from django.contrib.sites.models import Site
from django.contrib import admin
from django import forms
@@ -29,6 +30,14 @@
prepopulated_fields = {"slug": ("title",)}
inlines = [PostImageInline]
+ fieldsets = (
+ (None, {'fields': ('title',... |
c9ed6fe84b7f55ba2e9dc75d9ddf8cb0e7f9eb8c | pixelmap/pixel.py | pixelmap/pixel.py | """Pixel
A pixel data structure with it's own uid that makes a Pixelmap.
Last updated: March 7, 2017
"""
from itertools import count
class Pixel:
new_id = count(1)
def __init__(self):
"""Pixel constructor"""
self.id = next(self.new_id)
def __str__(self):
return str(self.id)
... | """Pixel
A pixel data structure with it's own uid that makes a Pixelmap.
Last updated: March 11, 2017
"""
from itertools import count
class Pixel:
new_id = count(1)
def __init__(self, data=None):
"""Pixel constructor"""
self.id = next(self.new_id)
self.data = data
def __str__(s... | Add data dict as Pixel member. | Add data dict as Pixel member.
| Python | mit | yebra06/pixelmap | ---
+++
@@ -1,7 +1,7 @@
"""Pixel
A pixel data structure with it's own uid that makes a Pixelmap.
-Last updated: March 7, 2017
+Last updated: March 11, 2017
"""
from itertools import count
@@ -10,12 +10,10 @@
class Pixel:
new_id = count(1)
- def __init__(self):
+ def __init__(self, data=None):
... |
8a7b6be29b3a839ba8e5c2cb33322d90d51d5fc4 | karbor/tests/unit/conf_fixture.py | karbor/tests/unit/conf_fixture.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | Fix loading 'provider_config_dir' opt error | Fix loading 'provider_config_dir' opt error
When run unit test using 'ostestr --pdb' command. it may get
an error that can not find the config opt 'provider_config_dir'.
Change-Id: Ibc1c693a1531c791ad434ff56ee349ba3afb3d63
Closes-Bug: #1649443
| Python | apache-2.0 | openstack/smaug,openstack/smaug | ---
+++
@@ -17,6 +17,7 @@
CONF = cfg.CONF
CONF.import_opt('policy_file', 'karbor.policy', group='oslo_policy')
+CONF.import_opt('provider_config_dir', 'karbor.services.protection.provider')
def set_defaults(conf): |
117c3e6c1f301c4e5c07e22b3c76f330b18ea36e | bin/create_contour_data.py | bin/create_contour_data.py | #!/usr/bin/env python3
import sys
import os
sys.path.append('../nsmaps')
import nsmaps
DATA_DIR = './website/nsmaps-data'
def test():
stations = nsmaps.station.Stations(DATA_DIR)
departure_station_name = 'Utrecht Centraal'
departure_station = stations.find_station(departure_station_name)
filepat... | #!/usr/bin/env python3
import sys
import os
sys.path.append('../nsmaps')
import nsmaps
DATA_DIR = './website/nsmaps-data'
def test():
stations = nsmaps.station.Stations(DATA_DIR)
departure_station_name = 'Utrecht Centraal'
departure_station = stations.find_station(departure_station_name)
assert ... | Create tiles in create contour command | Create tiles in create contour command
| Python | mit | bartromgens/nsmaps,bartromgens/nsmaps,bartromgens/nsmaps | ---
+++
@@ -16,12 +16,14 @@
departure_station_name = 'Utrecht Centraal'
departure_station = stations.find_station(departure_station_name)
- filepath_out = os.path.join(DATA_DIR, 'contours_' + departure_station.get_code() + '.geojson')
+ assert os.path.exists(os.path.join(DATA_DIR, 'contours/'))
+ ... |
5dc6488f5d7d0eb1d78b9c2edbb61b177cec6109 | run.py | run.py | #!/usr/bin/env python
import os
os.environ['APP_SETTINGS'] = 'config.DevelopmentConfig'
from pskb_website import app
# Uncomment to see the config you're running with
#for key, value in app.config.iteritems():
#print key, value
app.run()
| #!/usr/bin/env python
import os
os.environ['APP_SETTINGS'] = 'config.DevelopmentConfig'
#os.environ['APP_SETTINGS'] = 'config.DebugProductionConfig'
from pskb_website import app
# Uncomment to see the config you're running with
#for key, value in app.config.iteritems():
#print key, value
app.run()
| Add line to easily uncomment and switch back and forth to production settings locally | Add line to easily uncomment and switch back and forth to production settings locally
| Python | agpl-3.0 | paulocheque/guides-cms,pluralsight/guides-cms,paulocheque/guides-cms,paulocheque/guides-cms,pluralsight/guides-cms,pluralsight/guides-cms | ---
+++
@@ -3,6 +3,7 @@
import os
os.environ['APP_SETTINGS'] = 'config.DevelopmentConfig'
+#os.environ['APP_SETTINGS'] = 'config.DebugProductionConfig'
from pskb_website import app
|
e2541a9de3b4239f8f3cb7cc06dd9e7f48dd18a9 | objectTopGroup.py | objectTopGroup.py | #**********************************************************************************************#
#********* Return the top most group name of an object ****************************************#
#********* by Djordje Spasic ******************************************************************#
#********* issworld2000@yahoo... | #**********************************************************************************************#
#********* Return the top most group name of an object ****************************************#
#********* by Djordje Spasic ******************************************************************#
#********* issworld2000@yahoo... | Return the top most group name of an object | Return the top most group name of an object | Python | unlicense | stgeorges/pythonscripts | ---
+++
@@ -19,7 +19,7 @@
for i in range(rs.GroupCount()):
groupRO = sc.doc.Groups.GroupMembers(i)
for ele in groupRO:
- if rs.coercerhinoobject(ele).Id == _id:
+ if ele.Id == _id:
groupName = groupNames[i]
if groupName:
print groupName |
a28c3e9614cc8ab82ed0d1796d68a5b03906f801 | seleniumbase/config/proxy_list.py | seleniumbase/config/proxy_list.py | """
Proxy Server "Phone Book".
Simplify running browser tests through a proxy server
by adding your frequently-used proxies here.
Now you can do something like this on the command line:
"pytest SOME_TEST.py --proxy=proxy1"
Format of PROXY_LIST server entries:
* "ip_address:port" OR "username:password@ip_address:po... | """
Proxy Server "Phone Book".
Simplify running browser tests through a proxy server
by adding your frequently-used proxies here.
Now you can do something like this on the command line:
"pytest SOME_TEST.py --proxy=proxy1"
Format of PROXY_LIST server entries:
* "ip_address:port" OR "username:password@ip_address:po... | Update the sample proxy list | Update the sample proxy list
| Python | mit | mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase | ---
+++
@@ -20,10 +20,9 @@
"""
PROXY_LIST = {
- "example1": "45.133.182.18:18080", # (Example) - set your own proxy here
- "example2": "95.174.67.50:18080", # (Example) - set your own proxy here
- "example3": "83.97.23.90:18080", # (Example) - set your own proxy here
- "example4": "82.200.233.4:312... |
9d59bca61b2836e7db3c50d5558a46aa2dbaea08 | tests/run_tests.py | tests/run_tests.py | #! /usr/bin/env python
# ======================================================================
# matscipy - Python materials science tools
# https://github.com/libAtoms/matscipy
#
# Copyright (2014) James Kermode, King's College London
# Lars Pastewka, Karlsruhe Institute of Technology
#
# This progr... | #! /usr/bin/env python
# ======================================================================
# matscipy - Python materials science tools
# https://github.com/libAtoms/matscipy
#
# Copyright (2014) James Kermode, King's College London
# Lars Pastewka, Karlsruhe Institute of Technology
#
# This progr... | Add crack test to test runner. | Add crack test to test runner.
| Python | lgpl-2.1 | libAtoms/matscipy,libAtoms/matscipy,libAtoms/matscipy,libAtoms/matscipy | ---
+++
@@ -23,6 +23,7 @@
import unittest
+from cubic_crystal_crack import *
from cubic_elastic_moduli import *
### |
6d942a84da5f9a07ea1fac96ec0667ded623be60 | tests/test_util.py | tests/test_util.py | import unittest
import tabula
try:
FileNotFoundError
from unittest.mock import patch, MagicMock
from urllib.request import Request
except NameError:
FileNotFoundError = IOError
from mock import patch, MagicMock
from urllib2 import Request
class TestUtil(unittest.TestCase):
def test_enviro... | import unittest
import tabula
try:
FileNotFoundError
from unittest.mock import patch, MagicMock
from urllib.request import Request
except NameError:
FileNotFoundError = IOError
from mock import patch, MagicMock
from urllib2 import Request
class TestUtil(unittest.TestCase):
def test_enviro... | Remove assert_called for Python 3.5 compatibility | fix: Remove assert_called for Python 3.5 compatibility
| Python | mit | chezou/tabula-py | ---
+++
@@ -30,8 +30,6 @@
tabula.file_util.localize_file(uri, user_agent=user_agent)
mock_fun.assert_called_with(uri, user_agent)
- mock_urlopen.assert_called()
- mock_copyfileobj.assert_called()
if __name__ == '__main__': |
5d4210ceb34773dffce7d0bb27f38115bb8e1a9f | tests/testcases.py | tests/testcases.py | from __future__ import unicode_literals
from __future__ import absolute_import
from fig.packages.docker import Client
from fig.service import Service
from fig.cli.utils import docker_url
from . import unittest
class DockerClientTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.client ... | from __future__ import unicode_literals
from __future__ import absolute_import
from fig.packages.docker import Client
from fig.service import Service
from fig.cli.utils import docker_url
from . import unittest
class DockerClientTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.client ... | Fix tests when there is an image with int tag | Fix tests when there is an image with int tag
| Python | apache-2.0 | mosquito/docker-compose,thaJeztah/docker.github.io,thaJeztah/docker.github.io,bsmr-docker/compose,gdevillele/docker.github.io,BSWANG/denverdino.github.io,jiekechoo/compose,jgrowl/compose,docker/docker.github.io,brunocascio/compose,ZJaffee/compose,gdevillele/docker.github.io,LuisBosquez/docker.github.io,kojiromike/compo... | ---
+++
@@ -18,7 +18,7 @@
self.client.kill(c['Id'])
self.client.remove_container(c['Id'])
for i in self.client.images():
- if 'figtest' in i['Tag']:
+ if isinstance(i['Tag'], basestring) and 'figtest' in i['Tag']:
self.client.remove_ima... |
8c97ffed1531315dd50639c40b0bccad0fc1ef2d | textual_runtime.py | textual_runtime.py | # Runtime for managing the interactive component of the game. Allows user to play the game
# through a text based interface.
from game import DiscState
class TextualRuntime:
def __init__(self, game):
self.game = game
self.state = {
"continue": True
}
def start(self):
while self.state["cont... | # Runtime for managing the interactive component of the game. Allows user to play the game
# through a text based interface.
from game import DiscState
class TextualRuntime:
def __init__(self, game):
self.game = game
self.state = {
"continue": True
}
def start(self):
while self.state["cont... | Add ability to drop discs on slots | Add ability to drop discs on slots
| Python | mit | misterwilliam/connect-four | ---
+++
@@ -18,7 +18,7 @@
def render(self):
str_repr = ["Current board state:\n"]
- str_repr += [" %i " % col_index for col_index in range(self.game.grid.width)]
+ str_repr += [" %i " % col_index for col_index in range(self.game.grid.width)] + ["\n"]
for row in self.game.grid:
row_repr = [... |
46c7798003ce2eef60440860cc305372bd73a57d | salt/returners/cassandra_return.py | salt/returners/cassandra_return.py | '''
Return data to a Cassandra ColumFamily
Here's an example Keyspace/ColumnFamily setup that works with this
returner::
create keyspace salt;
use salt;
create column family returns
with key_validation_class='UTF8Type'
and comparator='UTF8Type'
and default_validation_class='UTF8Type';
''... | '''
Return data to a Cassandra ColumFamily
Here's an example Keyspace/ColumnFamily setup that works with this
returner::
create keyspace salt;
use salt;
create column family returns
with key_validation_class='UTF8Type'
and comparator='UTF8Type'
and default_validation_class='UTF8Type';
''... | Debug statement used the wrong variable. | Debug statement used the wrong variable.
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -43,5 +43,5 @@
else:
columns['return'] = str(ret['return'])
- log.debug(back)
+ log.debug(columns)
cf.insert(ret['jid'], columns) |
566739e88098eb40da26bd0930ac2d65ffdb999c | src/nyc_trees/apps/core/helpers.py | src/nyc_trees/apps/core/helpers.py |
def user_is_census_admin(user):
return user.is_authenticated() and user.is_census_admin
def user_is_group_admin(user, group):
return user.is_authenticated() and (user.is_census_admin or
group.admin == user)
def user_has_online_training(user):
return user.is_authe... | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from apps.users.models import TrustedMapper
def user_is_census_admin(user):
return user.is_authenticated() and user.is_census_admin
def user_is_group_admin(user, group):
ret... | Hide "Request Individual Mapper Status" button if approved | Hide "Request Individual Mapper Status" button if approved
There's no point to showing this button once you have been approved as
an individual mapper for this group.
| Python | agpl-3.0 | RickMohr/nyc-trees,kdeloach/nyc-trees,azavea/nyc-trees,maurizi/nyc-trees,kdeloach/nyc-trees,RickMohr/nyc-trees,kdeloach/nyc-trees,azavea/nyc-trees,azavea/nyc-trees,kdeloach/nyc-trees,maurizi/nyc-trees,RickMohr/nyc-trees,maurizi/nyc-trees,RickMohr/nyc-trees,kdeloach/nyc-trees,azavea/nyc-trees,azavea/nyc-trees,maurizi/ny... | ---
+++
@@ -1,3 +1,10 @@
+# -*- coding: utf-8 -*-
+from __future__ import print_function
+from __future__ import unicode_literals
+from __future__ import division
+
+from apps.users.models import TrustedMapper
+
def user_is_census_admin(user):
return user.is_authenticated() and user.is_census_admin
@@ -18,3 +... |
0e2635c01205c3359c3eabf7369453c3886c304a | photo/qt/overviewWindow.py | photo/qt/overviewWindow.py | """An overview window showing thumbnails of the image set.
"""
from __future__ import division
import math
from PySide import QtCore, QtGui
class ThumbnailWidget(QtGui.QLabel):
def __init__(self, image, scale):
super(ThumbnailWidget, self).__init__()
pixmap = image.getPixmap()
size = sca... | """An overview window showing thumbnails of the image set.
"""
from __future__ import division
import math
from PySide import QtCore, QtGui
class ThumbnailWidget(QtGui.QLabel):
ThumbnailSize = QtCore.QSize(128, 128)
def __init__(self, image):
super(ThumbnailWidget, self).__init__()
pixmap =... | Use a fixed thumbnail size rather then a relative scale. | Use a fixed thumbnail size rather then a relative scale.
| Python | apache-2.0 | RKrahl/photo-tools | ---
+++
@@ -8,11 +8,12 @@
class ThumbnailWidget(QtGui.QLabel):
- def __init__(self, image, scale):
+ ThumbnailSize = QtCore.QSize(128, 128)
+
+ def __init__(self, image):
super(ThumbnailWidget, self).__init__()
pixmap = image.getPixmap()
- size = scale * pixmap.size()
- p... |
44faefd4bd0bfa3dede8686903759a033c1072d6 | flask_simple_serializer/response.py | flask_simple_serializer/response.py | import json
from flask import Response as SimpleResponse
from .status_codes import HTTP_200_OK
from .serializers import BaseSerializer
class Response(SimpleResponse):
def __init__(self, data, headers=None, status_code=HTTP_200_OK):
"""
For now the content/type always will be application/json.
... | from flask import Response as SimpleResponse
from flask import json
from .status_codes import HTTP_200_OK
from .serializers import BaseSerializer
class Response(SimpleResponse):
def __init__(self, data, headers=None, status_code=HTTP_200_OK):
"""
For now the content/type always will be applicati... | Replace json for flask.json to manage the Response | Replace json for flask.json to manage the Response
| Python | mit | marcosschroh/Flask-Simple-Serializer | ---
+++
@@ -1,6 +1,5 @@
-import json
-
from flask import Response as SimpleResponse
+from flask import json
from .status_codes import HTTP_200_OK
from .serializers import BaseSerializer |
c51ec70a8e71f2e8e7a0d0bb4f0712b379af0505 | src/victims_web/plugin/__init__.py | src/victims_web/plugin/__init__.py | # This file is part of victims-web.
#
# Copyright (C) 2013 The Victims Project
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any... | Add helper method to plugin pkg to handle configs | Add helper method to plugin pkg to handle configs
| Python | agpl-3.0 | victims/victims-web,jasinner/victims-web,victims/victims-web,jasinner/victims-web | ---
+++
@@ -0,0 +1,30 @@
+# This file is part of victims-web.
+#
+# Copyright (C) 2013 The Victims Project
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the ... | |
3f17f454172d15e9279e00ccc2acfb931bf685f1 | transmutagen/tests/test_origen.py | transmutagen/tests/test_origen.py | import os
from itertools import combinations
import numpy as np
from ..tape9utils import origen_to_name
DATA_DIR = os.path.abspath(os.path.join(__file__, os.path.pardir,
os.path.pardir, os.path.pardir, 'docker', 'data'))
def load_data(datafile):
with open(datafile) as f:
return eval(f.read(), {'arra... | import os
from itertools import combinations
import numpy as np
from ..tape9utils import origen_to_name
DATA_DIR = os.path.abspath(os.path.join(__file__, os.path.pardir,
os.path.pardir, os.path.pardir, 'docker', 'data'))
def load_data(datafile):
with open(datafile) as f:
return eval(f.read(), {'arra... | Add a sanity test for the data | Add a sanity test for the data
| Python | bsd-3-clause | ergs/transmutagen,ergs/transmutagen | ---
+++
@@ -16,14 +16,19 @@
for datafile in os.listdir(DATA_DIR):
data = load_data(os.path.join(DATA_DIR, datafile))
- tape9, time, nuc, phi = datafile.split()[0]
+ tape9, time, nuc, phi = datafile.split()
assert 'table_4' in data
assert 'nuclide' in data['table_4']
... |
905690beacad9731bb113bdbeedf0ed2c7df3160 | profile_audfprint_match.py | profile_audfprint_match.py | import audfprint
import cProfile
import pstats
argv = ["audfprint", "match", "-d", "tmp.fpdb", "--density", "200", "query.mp3", "query2.mp3"]
cProfile.run('audfprint.main(argv)', 'fpmstats')
p = pstats.Stats('fpmstats')
p.sort_stats('time')
p.print_stats(10)
| import audfprint
import cProfile
import pstats
argv = ["audfprint", "match", "-d", "fpdbase.pklz", "--density", "200", "query.mp3"]
cProfile.run('audfprint.main(argv)', 'fpmstats')
p = pstats.Stats('fpmstats')
p.sort_stats('time')
p.print_stats(10)
| Update profile for local data. | Update profile for local data.
| Python | mit | dpwe/audfprint | ---
+++
@@ -2,7 +2,7 @@
import cProfile
import pstats
-argv = ["audfprint", "match", "-d", "tmp.fpdb", "--density", "200", "query.mp3", "query2.mp3"]
+argv = ["audfprint", "match", "-d", "fpdbase.pklz", "--density", "200", "query.mp3"]
cProfile.run('audfprint.main(argv)', 'fpmstats')
|
c3a06fc8a1c8b1bb2b24b929fd158ae1602836f6 | cobra/topology/__init__.py | cobra/topology/__init__.py | from os import name as __name
from sys import modules as __modules
from warnings import warn
if __name == 'java':
warn("%s is not yet supported on jython"%__modules[__name__])
else:
from reporter_metabolites import *
del __name, __modules
| from os import name as __name
from sys import modules as __modules
from warnings import warn
if __name == 'java':
warn("%s is not yet supported on jython"%__modules[__name__])
else:
from .reporter_metabolites import *
del __name, __modules
| Fix import issue in cobra.topology | Fix import issue in cobra.topology
Signed-off-by: Vivek Rai <6965dcfed9719c822a5fc29f0dbf450e6c3f778e@gmail.com>
| Python | lgpl-2.1 | JuBra/cobrapy,aebrahim/cobrapy,zakandrewking/cobrapy,JuBra/cobrapy,jeicher/cobrapy,zakandrewking/cobrapy,aebrahim/cobrapy,jeicher/cobrapy | ---
+++
@@ -5,5 +5,5 @@
warn("%s is not yet supported on jython"%__modules[__name__])
else:
- from reporter_metabolites import *
+ from .reporter_metabolites import *
del __name, __modules |
e7998648c42d5bcccec7239d13521a5b77a738af | src/utils/indices.py | src/utils/indices.py | import json
import os
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Index
from model import APIDoc
def exists():
return Index(APIDoc.Index.name).exists()
def setup():
"""
Setup Elasticsearch Index.
Primary index with dynamic template.
Secondary index with static mappings... | import json
import os
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Index
from model import APIDoc
def exists():
return Index(APIDoc.Index.name).exists()
def setup():
"""
Setup Elasticsearch Index with dynamic template.
Run it on an open index to update dynamic mapping.
... | Allow setup function to update dynamic mapping | Allow setup function to update dynamic mapping
| Python | mit | Network-of-BioThings/smartAPI,Network-of-BioThings/smartAPI,Network-of-BioThings/smartAPI,Network-of-BioThings/smartAPI,Network-of-BioThings/smartAPI | ---
+++
@@ -12,9 +12,8 @@
def setup():
"""
- Setup Elasticsearch Index.
- Primary index with dynamic template.
- Secondary index with static mappings.
+ Setup Elasticsearch Index with dynamic template.
+ Run it on an open index to update dynamic mapping.
"""
_dirname = os.path.dirname... |
3a8ff4ce62c2a0f3e7ebc61284894fc69ec36b79 | django_sqs/message.py | django_sqs/message.py | import base64
try:
import json
except ImportError:
try:
import simplejson as json
except ImportError:
import django.utils.simplejson as json
import boto.sqs.message
from django.contrib.contenttypes.models import ContentType
class ModelInstanceMessage(boto.sqs.message.RawMessage):
""... | import base64
try:
import json
except ImportError:
try:
import simplejson as json
except ImportError:
import django.utils.simplejson as json
import boto.sqs.message
from django.contrib.contenttypes.models import ContentType
class ModelInstanceMessage(boto.sqs.message.RawMessage):
""... | Raise ValueError on get_body instead of random exception when initializing ModelInstanceMessage. | Raise ValueError on get_body instead of random exception when initializing ModelInstanceMessage.
| Python | bsd-3-clause | mpasternacki/django-sqs | ---
+++
@@ -27,9 +27,31 @@
(ct.app_label, ct.model, value.pk)))
def decode(self, value):
- app_label, model, pk = json.loads(base64.b64decode(value))
- ct = ContentType.objects.get(app_label=app_label, model=model)
- return ct.get_object_for_this_type(pk=pk)
+ try:
... |
9b0618d3b52c74bf2abd65a581807087cbaa2ca4 | grammpy_transforms/NongeneratingSymbolsRemove/nongeneratingSymbolsRemove.py | grammpy_transforms/NongeneratingSymbolsRemove/nongeneratingSymbolsRemove.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy-transforms
"""
from grammpy import Grammar
def _copy_grammar(grammar):
return Grammar(terminals=(item.s for item in grammar.terms()),
nonterminals=grammar.nonterms(),
... | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy-transforms
"""
from copy import copy
from grammpy import Grammar
def _copy_grammar(grammar):
return copy(grammar)
def remove_nongenerating_symbol(grammar: Grammar, transform_grammar=False) -> Grammar:
... | Switch to new version of grammpy (1.1.2) and use copy method | Switch to new version of grammpy (1.1.2) and use copy method
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -7,15 +7,12 @@
"""
+from copy import copy
from grammpy import Grammar
def _copy_grammar(grammar):
- return Grammar(terminals=(item.s for item in grammar.terms()),
- nonterminals=grammar.nonterms(),
- rules=grammar.rules(),
- start_symbol=g... |
50dce60963c6817eb0dded8c4fc23047e7b54d6e | runtests.py | runtests.py | #!/usr/bin/env python
import glob
import logging
import os
import sys
import unittest
from trace import fullmodname
try:
from tests.utils import cleanup
except:
def cleanup():
pass
sys.path.insert(0, os.getcwd())
verbosity = 1
if "-q" in sys.argv or '--quiet' in sys.argv:
verbosity = 0
if "-v" in... | #!/usr/bin/env python
import glob
import logging
import os
import sys
import unittest
from trace import fullmodname
try:
from tests.utils import cleanup
except:
def cleanup():
pass
sys.path.insert(0, os.getcwd())
verbosity = 1
if "-q" in sys.argv or '--quiet' in sys.argv:
verbosity = 0
if "-v" in... | Split out running unit and functional tests | Split out running unit and functional tests
| Python | apache-2.0 | google/oauth2client,clancychilds/oauth2client,google/oauth2client,clancychilds/oauth2client,googleapis/google-api-python-client,googleapis/oauth2client,googleapis/oauth2client,jonparrott/oauth2client,jonparrott/oauth2client,googleapis/google-api-python-client | ---
+++
@@ -43,10 +43,12 @@
__import__(module)
raise
+# build and run unit test suite
unit_tests = build_suite('tests')
+unittest.TextTestRunner(verbosity=verbosity).run(unit_tests)
+cleanup()
+
+# build and run functional test suite
functional_tests = build_suite('functional_tests')
-
-# run te... |
0f21ef4fe5a1e95668f5fdbeda4d8a37da65484f | trombi/__init__.py | trombi/__init__.py | # Copyright (c) 2010 Inoi Oy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute,... | # Copyright (c) 2010 Inoi Oy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute,... | Add version information under trombi module | Add version information under trombi module
| Python | mit | inoi/trombi | ---
+++
@@ -18,4 +18,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
+version = (0, 9, 0)
+
from .client import * |
4c11a3c8f0cd82ebee3269e76450562aa8d2b8c3 | troposphere/sns.py | troposphere/sns.py | # Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
try:
from awacs.aws import Policy
policytypes = (dict, Policy)
except ImportError:
policytypes = dict,
class Subscription(AWSProperty):
props = {
... | # Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
try:
from awacs.aws import Policy
policytypes = (dict, Policy)
except ImportError:
policytypes = dict,
class Subscription(AWSProperty):
props = {
... | Add missing properties to SNS::Subscription | Add missing properties to SNS::Subscription
| Python | bsd-2-clause | johnctitus/troposphere,ikben/troposphere,cloudtools/troposphere,johnctitus/troposphere,ikben/troposphere,cloudtools/troposphere,pas256/troposphere,pas256/troposphere | ---
+++
@@ -22,10 +22,13 @@
resource_type = "AWS::SNS::Subscription"
props = {
- 'Endpoint': (basestring, True),
+ 'DeliveryPolicy': (dict, False),
+ 'Endpoint': (basestring, False),
+ 'FilterPolicy': (dict, False),
'Protocol': (basestring, True),
+ 'RawMessageD... |
6038bcd507c43eb86e04c6a32abf9b8249c8872e | tests/server/handlers/test_zip.py | tests/server/handlers/test_zip.py | import asyncio
import io
import zipfile
from unittest import mock
from tornado import testing
from waterbutler.core import streams
from tests import utils
class TestZipHandler(utils.HandlerTestCase):
def setUp(self):
super().setUp()
identity_future = asyncio.Future()
identity_future.se... | import asyncio
import io
import zipfile
from unittest import mock
from tornado import testing
from waterbutler.core import streams
from tests import utils
class TestZipHandler(utils.HandlerTestCase):
@testing.gen_test
def test_download_stream(self):
data = b'freddie brian john roger'
strea... | Remove deprecated test setup and teardown code | Remove deprecated test setup and teardown code
| Python | apache-2.0 | rdhyee/waterbutler,kwierman/waterbutler,hmoco/waterbutler,CenterForOpenScience/waterbutler,cosenal/waterbutler,Ghalko/waterbutler,rafaeldelucena/waterbutler,felliott/waterbutler,icereval/waterbutler,RCOSDP/waterbutler,TomBaxter/waterbutler,chrisseto/waterbutler,Johnetordoff/waterbutler | ---
+++
@@ -12,40 +12,18 @@
class TestZipHandler(utils.HandlerTestCase):
- def setUp(self):
- super().setUp()
- identity_future = asyncio.Future()
- identity_future.set_result({
- 'auth': {},
- 'credentials': {},
- 'settings': {},
- })
- self... |
e9c23c7a0c622e8db29d066f1cd1a679dc6eb1bf | salt/grains/external_ip.py | salt/grains/external_ip.py | # -*- coding: utf-8 -*-
# This file is here to ensure that upgrades of salt remove the external_ip
# grain
| # -*- coding: utf-8 -*-
# This file is here to ensure that upgrades of salt remove the external_ip
# grain, this file should be removed in the Boron release
| Add note to remove file | Add note to remove file
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# This file is here to ensure that upgrades of salt remove the external_ip
-# grain
+# grain, this file should be removed in the Boron release
|
8ecaaa14cba2a84606dc6d31f0c16c09dbfae017 | server/LikeLines/debug.py | server/LikeLines/debug.py | """
Debug Blueprints.
"""
from flask import Blueprint, current_app, redirect, jsonify, url_for, request
debug_pages = Blueprint('debug', __name__)
@debug_pages.route("/clear_all", methods=['GET', 'POST'])
def clear_all():
if request.method == 'GET':
return '<form method="POST"><input type="submit" value=... | """
Debug Blueprints.
"""
from flask import Blueprint, current_app, redirect, jsonify, url_for, request
debug_pages = Blueprint('debug', __name__)
@debug_pages.route("/clear_all", methods=['GET', 'POST'])
def clear_all():
if request.method == 'GET':
return '<form method="POST"><input type="submit" value=... | Fix incorrect redirect in clear_all | Fix incorrect redirect in clear_all
| Python | mit | ShinNoNoir/likelines-player,ShinNoNoir/likelines-player,ShinNoNoir/likelines-player | ---
+++
@@ -14,7 +14,7 @@
mongo = current_app.mongo
mongo.db.userSessions.remove()
mongo.db.interactionSessions.remove()
- return redirect(url_for('destroy_session'))
+ return redirect(url_for('end_session'))
@debug_pages.route("/dump") |
35a9de1ba8f6c1bcb6ae35c9f965657de973412f | tokenizers/sentiment_tokenizer.py | tokenizers/sentiment_tokenizer.py | from nltk.sentiment.util import mark_negation
from nltk.util import trigrams
import re
import validators
from .happy_tokenizer import Tokenizer
class SentimentTokenizer(object):
def __init__(self):
self.tknzr = Tokenizer()
@staticmethod
def reduce_lengthening(text):
"""
Replace re... | from nltk.sentiment.util import mark_negation
from nltk.util import trigrams
import re
import validators
from .happy_tokenizer import Tokenizer
class SentimentTokenizer(object):
def __init__(self):
self.tknzr = Tokenizer()
@staticmethod
def reduce_lengthening(text):
"""
Replace re... | Use map to loop instead of mapping a list | Use map to loop instead of mapping a list
| Python | apache-2.0 | chuajiesheng/twitter-sentiment-analysis | ---
+++
@@ -39,6 +39,6 @@
rebuild_str = ' '.join(cleaned_tokens)
negated_tokens = mark_negation(list(self.tknzr.tokenize(rebuild_str)))
- list_of_trigrams = list(trigrams(negated_tokens))
- return list([' '.join(s) for s in list_of_trigrams])
+ list_of_trigrams = list([' '.joi... |
3c7e6e1f02b9d73497cb49359d542d3fa4c9a85f | utils/rc_sensor.py | utils/rc_sensor.py | #!/usr/bin/env python
import rcsensor
print(rcsensor.get_count(200, 10, 22))
| #!/usr/bin/env python
from common.rcsensor import rcsensor as rcsensor
class RcSensor(object):
def __init__(self, gpio, cycles=200, discharge_delay=10):
if gpio is None:
raise ValueError("Must supply gpio value")
self.gpio = gpio
self.cycles = cycles
self.discharge_de... | Create a RC sensor class object | Create a RC sensor class object
| Python | mit | mecworks/garden_pi,mecworks/garden_pi,mecworks/garden_pi,mecworks/garden_pi | ---
+++
@@ -1,5 +1,21 @@
#!/usr/bin/env python
-import rcsensor
+from common.rcsensor import rcsensor as rcsensor
-print(rcsensor.get_count(200, 10, 22))
+
+class RcSensor(object):
+
+ def __init__(self, gpio, cycles=200, discharge_delay=10):
+ if gpio is None:
+ raise ValueError("Must suppl... |
d697266e41f2e073c801221b7da46455a0ef1116 | dimod/package_info.py | dimod/package_info.py | # Copyright 2018 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | # Copyright 2018 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | Update version 0.9.4 -> 0.9.5 | Update version 0.9.4 -> 0.9.5
New Features
------------
* `BQM.normalize` now returns the value the BQM was scaled by
* `SampleSet.relabel_variables` no longer blocks for unresolved sample sets
* `FileView` has a new parameter, `ignore_variables` that treats the BQM as integer-labelled
* `ScaleComposite` no longe... | Python | apache-2.0 | dwavesystems/dimod,dwavesystems/dimod | ---
+++
@@ -14,7 +14,7 @@
#
# ================================================================================================
-__version__ = '0.9.4'
+__version__ = '0.9.5'
__author__ = 'D-Wave Systems Inc.'
__authoremail__ = 'acondello@dwavesys.com'
__description__ = 'A shared API for binary quadratic model s... |
a5e8f6af93debd98b626ee382a843d5dedbf70f8 | test/benchmarks/general/blocks/read_sigproc.py | test/benchmarks/general/blocks/read_sigproc.py | from timeit import default_timer as timer
import bifrost as bf
from bifrost import pipeline as bfp
from bifrost import blocks as blocks
from bifrost_benchmarks import PipelineBenchmarker
class SigprocBenchmarker(PipelineBenchmarker):
def run_benchmark(self):
with bf.Pipeline() as pipeline:
fil_... | """ Test the sigproc read function """
from timeit import default_timer as timer
import bifrost as bf
from bifrost import pipeline as bfp
from bifrost import blocks as blocks
from bifrost_benchmarks import PipelineBenchmarker
class SigprocBenchmarker(PipelineBenchmarker):
""" Test the sigproc read function """
... | Add docstrings for sigproc benchmarks | Add docstrings for sigproc benchmarks
| Python | bsd-3-clause | ledatelescope/bifrost,ledatelescope/bifrost,ledatelescope/bifrost,ledatelescope/bifrost | ---
+++
@@ -1,3 +1,4 @@
+""" Test the sigproc read function """
from timeit import default_timer as timer
import bifrost as bf
from bifrost import pipeline as bfp
@@ -5,6 +6,7 @@
from bifrost_benchmarks import PipelineBenchmarker
class SigprocBenchmarker(PipelineBenchmarker):
+ """ Test the sigproc read fun... |
9a2cc99b068b2aaa572f52b4516852b239577c34 | dummyserver/server.py | dummyserver/server.py | #!/usr/bin/python
import threading, socket
"""
Dummy server using for unit testing
"""
class Server(threading.Thread):
def __init__(self, handler, host='localhost', port=8021):
threading.Thread.__init__(self)
self.handler = handler
self.host = host
self.port = port
self.... | #!/usr/bin/python
import threading, socket
class Server(threading.Thread):
""" Dummy server using for unit testing """
def __init__(self, handler, host='localhost', port=8021):
threading.Thread.__init__(self)
self.handler = handler
self.host = host
self.port = port
... | Put docstring inside Server class | Put docstring inside Server class
| Python | apache-2.0 | psf/requests | ---
+++
@@ -4,11 +4,10 @@
-"""
-Dummy server using for unit testing
-"""
class Server(threading.Thread):
+ """ Dummy server using for unit testing """
+
def __init__(self, handler, host='localhost', port=8021):
threading.Thread.__init__(self)
self.handler = handler |
47352af38ace09af3572bc63d8c1da4d27cafb86 | app/notify_client/job_api_client.py | app/notify_client/job_api_client.py |
from notifications_python_client.base import BaseAPIClient
from app.notify_client import _attach_current_user
class JobApiClient(BaseAPIClient):
def __init__(self, base_url=None, client_id=None, secret=None):
super(self.__class__, self).__init__(base_url=base_url or 'base_url',
... |
from notifications_python_client.base import BaseAPIClient
from app.notify_client import _attach_current_user
class JobApiClient(BaseAPIClient):
def __init__(self, base_url=None, client_id=None, secret=None):
super(self.__class__, self).__init__(base_url=base_url or 'base_url',
... | Add limit_days query param to the get_job endpoint. | Add limit_days query param to the get_job endpoint.
| Python | mit | alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin | ---
+++
@@ -14,11 +14,14 @@
self.client_id = app.config['ADMIN_CLIENT_USER_NAME']
self.secret = app.config['ADMIN_CLIENT_SECRET']
- def get_job(self, service_id, job_id=None):
+ def get_job(self, service_id, job_id=None, limit_days=None):
if job_id:
return self.get(url=... |
aa6cf034e41f9426e6b4688ffe832f802efb7864 | fbalerts.py | fbalerts.py | '''
Check your Facebook notifications on command line.
Author: Amit Chaudhary ( studenton.com@gmail.com )
'''
import json
# Configuration
notifications = 5 # Number of Notifications
profile_id = '1XXXXXXXXXXXXXX'
token = 'write token here'
url = 'https://www.facebook.com/feeds/notifications.php?id=' + \
p... | '''
Check your Facebook notifications on command line.
Author: Amit Chaudhary ( studenton.com@gmail.com )
'''
import json
# Configuration
notifications = 5 # Number of Notifications
profile_id = '1XXXXXXXXXXXXXX'
token = 'write token here'
base_url = 'https://www.facebook.com/feeds/notifications.php?id={0}&vi... | Use new string formatting method | Use new string formatting method | Python | mit | studenton/facebook-alerts | ---
+++
@@ -8,9 +8,8 @@
notifications = 5 # Number of Notifications
profile_id = '1XXXXXXXXXXXXXX'
token = 'write token here'
-url = 'https://www.facebook.com/feeds/notifications.php?id=' + \
- profile_id + '&viewer=' + profile_id + '&key=' + token + '&format=json'
-
+base_url = 'https://www.facebook.com/feeds... |
afa76e2643ed75c6864d2281afd3e220b848e487 | iscc_bench/textid/unicode_blocks.py | iscc_bench/textid/unicode_blocks.py | # -*- coding: utf-8 -*-
"""Blocks of unicode ranges"""
from pprint import pprint
import requests
URL = "https://www.unicode.org/Public/UCD/latest/ucd/Blocks.txt"
def load_blocks():
blocks = {}
data = requests.get(URL).text
for line in data.splitlines():
if line and not line.startswith('#'):
... | # -*- coding: utf-8 -*-
"""Blocks of unicode ranges"""
import unicodedata
from pprint import pprint
import requests
URL = "https://www.unicode.org/Public/UCD/latest/ucd/Blocks.txt"
def load_blocks():
"""Load and parse unicode blocks from unicode standard"""
blocks = {}
data = requests.get(URL).text
f... | Add various unicode spec helper functions | Add various unicode spec helper functions
| Python | bsd-2-clause | coblo/isccbench | ---
+++
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""Blocks of unicode ranges"""
+import unicodedata
from pprint import pprint
import requests
@@ -7,6 +8,7 @@
def load_blocks():
+ """Load and parse unicode blocks from unicode standard"""
blocks = {}
data = requests.get(URL).text
for line in... |
0f5a632d625d65f4edf9e31efa75708a79eee16c | CaseStudies/glass/Implementations/Python_Simplified/Implementation/readTable.py | CaseStudies/glass/Implementations/Python_Simplified/Implementation/readTable.py | """
This module implements a portion of the Input Format Module. In this
case the input is the tabular data necessary for the different interpolations.
"""
import numpy as np
def read_num_col(filename):
with open(filename, 'rb') as f:
num_col = [f.readline()]
num_col = np.genfromtxt(num_col, delimi... | """
This module implements a portion of the Input Format Module. In this
case the input is the tabular data necessary for the different interpolations.
"""
def read_num_col(filename):
with open(filename, "r") as f:
line = f.readline()
z_array = line.split(",")[1::2]
z_array = [float(i) for i in z... | Remove numpy dependency from glassbr python code | Remove numpy dependency from glassbr python code
| Python | bsd-2-clause | JacquesCarette/literate-scientific-software,JacquesCarette/literate-scientific-software,JacquesCarette/literate-scientific-software,JacquesCarette/literate-scientific-software,JacquesCarette/literate-scientific-software,JacquesCarette/literate-scientific-software,JacquesCarette/literate-scientific-software | ---
+++
@@ -3,22 +3,28 @@
case the input is the tabular data necessary for the different interpolations.
"""
-import numpy as np
-
def read_num_col(filename):
- with open(filename, 'rb') as f:
- num_col = [f.readline()]
-
- num_col = np.genfromtxt(num_col, delimiter=',', dtype=str)
- num_col = ... |
ea6c57de01f420bdd344194e5529a0e91036c634 | greenfan/management/commands/create-job-from-testspec.py | greenfan/management/commands/create-job-from-testspec.py | #
# Copyright 2012 Cisco Systems, Inc.
#
# Author: Soren Hansen <sorhanse@cisco.com>
#
# 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... | #
# Copyright 2012 Cisco Systems, Inc.
#
# Author: Soren Hansen <sorhanse@cisco.com>
#
# 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... | Allow us to create both virtual and physical jobs | Allow us to create both virtual and physical jobs
| Python | apache-2.0 | sorenh/python-django-greenfan,sorenh/python-django-greenfan | ---
+++
@@ -23,6 +23,6 @@
class Command(BaseCommand):
def handle(self, ts_id, **options):
ts = TestSpecification.objects.get(id=ts_id)
- job = ts.create_job()
-
+ physical = 'physical' in options
+ job = ts.create_job(physical=physical)
return 'Created job %d' % job.pk |
bfc94287cc5886495851733a45872a8979900435 | lily/notes/migrations/0010_remove_polymorphic_cleanup.py | lily/notes/migrations/0010_remove_polymorphic_cleanup.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('notes', '0009_remove_polymorphic_data_migrate'),
]
operations = [
migrations.AlterField(
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
import django_extensions.db.fields
# Comment for testing migrations in Travis continuous deployment.
class Migration(migrations.Migration):
dependencies = [
('notes', '0009_remove_polymorphic_data_migrate')... | Test migrations with continuous deployment. | Test migrations with continuous deployment.
| Python | agpl-3.0 | HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily | ---
+++
@@ -3,6 +3,8 @@
from django.db import migrations
import django_extensions.db.fields
+
+# Comment for testing migrations in Travis continuous deployment.
class Migration(migrations.Migration): |
bc3e31838fd1b5eec3c4ca17f5fab4588ac87904 | tests/client/test_TelnetClient.py | tests/client/test_TelnetClient.py | import unittest
import unittest.mock as mock
from ogn.client.client import TelnetClient
class TelnetClientTest(unittest.TestCase):
@mock.patch('ogn.client.client.socket')
def test_connect(self, socket_mock):
def callback(raw_message):
pass
client = TelnetClient()
client.r... | import unittest
import unittest.mock as mock
from ogn.client.client import TelnetClient
class TelnetClientTest(unittest.TestCase):
@mock.patch('ogn.client.client.socket')
def test_connect_disconnect(self, socket_mock):
client = TelnetClient()
client.connect()
client.sock.connect.asser... | Update to receiver version 0.2.6 | Update to receiver version 0.2.6
Update to receiver version 0.2.6
Better testing
| Python | agpl-3.0 | glidernet/python-ogn-client | ---
+++
@@ -6,9 +6,21 @@
class TelnetClientTest(unittest.TestCase):
@mock.patch('ogn.client.client.socket')
- def test_connect(self, socket_mock):
+ def test_connect_disconnect(self, socket_mock):
+ client = TelnetClient()
+ client.connect()
+ client.sock.connect.assert_called_once(... |
05f0969ee8b9374c2fe5bce2c753fb4619432f0d | tests/integration/runners/jobs.py | tests/integration/runners/jobs.py | # -*- coding: utf-8 -*-
'''
Tests for the salt-run command
'''
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
class ManageTest(integration.ShellCase):
'''
Test the manage runner
'''
def test_active(self)... | # -*- coding: utf-8 -*-
'''
Tests for the salt-run command
'''
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
class ManageTest(integration.ShellCase):
'''
Test the manage runner
'''
def test_active(self)... | Fix the output now that we are using the default output (nested) instead of hard coding it to yaml | Fix the output now that we are using the default output (nested) instead of hard coding it to yaml
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -22,7 +22,7 @@
'''
ret = self.run_run_plus('jobs.active')
self.assertEqual(ret['fun'], {})
- self.assertEqual(ret['out'], ['{}'])
+ self.assertEqual(ret['out'], [])
def test_lookup_jid(self):
''' |
ba6f29106ba6b8957d82cf042753e4b48a671da6 | waterbutler/providers/osfstorage/metadata.py | waterbutler/providers/osfstorage/metadata.py | from waterbutler.core import metadata
class BaseOsfStorageMetadata:
@property
def provider(self):
return 'osfstorage'
class OsfStorageFileMetadata(BaseOsfStorageMetadata, metadata.BaseFileMetadata):
@property
def name(self):
return self.raw['name']
@property
def path(self):
... | from waterbutler.core import metadata
class BaseOsfStorageMetadata:
@property
def provider(self):
return 'osfstorage'
class OsfStorageFileMetadata(BaseOsfStorageMetadata, metadata.BaseFileMetadata):
@property
def name(self):
return self.raw['name']
@property
def path(self):
... | Return User and download count | Return User and download count
| Python | apache-2.0 | rdhyee/waterbutler,hmoco/waterbutler,CenterForOpenScience/waterbutler,Johnetordoff/waterbutler,TomBaxter/waterbutler,kwierman/waterbutler,RCOSDP/waterbutler,Ghalko/waterbutler,icereval/waterbutler,cosenal/waterbutler,felliott/waterbutler,chrisseto/waterbutler,rafaeldelucena/waterbutler | ---
+++
@@ -62,3 +62,10 @@
@property
def version(self):
return str(self.raw['index'])
+
+ @property
+ def extra(self):
+ return {
+ 'user': self.raw['user'],
+ 'downloads': self.raw['downloads'],
+ } |
be86fc3f3c7ec9dc213f8f527da59d5578be8b2a | irma/fileobject/handler.py | irma/fileobject/handler.py | from irma.database.nosqlhandler import NoSQLDatabase
from bson import ObjectId
class FileObject(object):
_uri = None
_dbname = None
_collection = None
def __init__(self, dbname=None, id=None):
if dbname:
self._dbname = dbname
self._dbfile = None
if id:
... | from irma.database.nosqlhandler import NoSQLDatabase
from bson import ObjectId
class FileObject(object):
_uri = None
_dbname = None
_collection = None
def __init__(self, dbname=None, id=None):
if dbname:
self._dbname = dbname
self._dbfile = None
if id:
... | Delete method added in FileObject | Delete method added in FileObject
| Python | apache-2.0 | hirokihamasaki/irma,hirokihamasaki/irma,quarkslab/irma,hirokihamasaki/irma,hirokihamasaki/irma,quarkslab/irma,hirokihamasaki/irma,quarkslab/irma,quarkslab/irma | ---
+++
@@ -27,6 +27,10 @@
db = NoSQLDatabase(self._dbname, self._uri)
self._id = db.put_file(self._dbname, self._collection, data, name, '', [])
+ def delete(self):
+ db = NoSQLDatabase(self._dbname, self._uri)
+ db.remove(self._dbname, self._collection, self._id)
+
@propert... |
010c87de588009371adbab8a234de78d9da4ebbd | fullcalendar/admin.py | fullcalendar/admin.py | from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
from mezzanine.core.admin import StackedDynamicInlineAdmin, DisplayableAdmin
from fullcalendar.models import *
class EventCategoryAdmin(admin.ModelAdmin):
list_display = ('name',)
class OccurrenceInline(StackedDynamicInlineA... | from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
from mezzanine.core.admin import StackedDynamicInlineAdmin, DisplayableAdmin
from fullcalendar.models import *
class EventCategoryAdmin(admin.ModelAdmin):
list_display = ('name',)
class OccurrenceInline(StackedDynamicInlineA... | Fix Django system check error for a editable field that is not displayed | Fix Django system check error for a editable field that is not displayed
This error,
"CommandError: System check identified some issues:
ERRORS:
<class 'fullcalendar.admin.EventAdmin'>: (admin.E122) The value of 'list_editable[0]' refers to 'status', which is not an attribute of 'events.Event'."
was given for Django >... | Python | mit | jonge-democraten/mezzanine-fullcalendar | ---
+++
@@ -13,7 +13,7 @@
fields = ('start_time', 'end_time', 'description', 'location')
class EventAdmin(DisplayableAdmin):
- list_display = ('title', 'event_category')
+ list_display = ('title', 'event_category', 'status')
list_filter = ('event_category',)
search_fields = ('title', 'descript... |
4a85ecaaae1452e74acc485d032f00e8bedace47 | cmsplugin_filer_link/cms_plugins.py | cmsplugin_filer_link/cms_plugins.py | from __future__ import unicode_literals
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext as _
from django.conf import settings
from .models import FilerLinkPlugin
class FilerLinkPlugin(CMSPluginBase):
module = 'Filer'
model = File... | from __future__ import unicode_literals
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext as _
from django.conf import settings
from .models import FilerLinkPlugin
class FilerLinkPlugin(CMSPluginBase):
module = 'Filer'
model = File... | Add "page_link" to "raw_id_fields" to prevent the run of "decompress" | Add "page_link" to "raw_id_fields" to prevent the run of "decompress"
Same issue as the already merged pull request for issue #106 however this applies to cmsfiler_link | Python | bsd-3-clause | stefanfoulis/cmsplugin-filer,creimers/cmsplugin-filer,wlanslovenija/cmsplugin-filer,jschneier/cmsplugin-filer,creimers/cmsplugin-filer,divio/cmsplugin-filer,yvess/cmsplugin-filer,brightinteractive/cmsplugin-filer,yvess/cmsplugin-filer,nephila/cmsplugin-filer,jschneier/cmsplugin-filer,stefanfoulis/cmsplugin-filer,sephii... | ---
+++
@@ -12,6 +12,7 @@
model = FilerLinkPlugin
name = _("Link")
text_enabled = True
+ raw_id_fields = ('page_link', )
render_template = "cmsplugin_filer_link/link.html"
def render(self, context, instance, placeholder): |
c25b7820ccd52b943586af42d09ce53c3633ed96 | cmsplugin_simple_markdown/models.py | cmsplugin_simple_markdown/models.py | import threading
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models.pluginmodel import CMSPlugin
from cmsplugin_simple_markdown import utils
localdata = threading.local()
localdata.TEMPLATE_CHOICES = utils.autodiscover_templates()
TEMPLATE_CHOICES = localdata.TEMPLATE... | import threading
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models.pluginmodel import CMSPlugin
from cmsplugin_simple_markdown import utils
localdata = threading.local()
localdata.TEMPLATE_CHOICES = utils.autodiscover_templates()
TEMPLATE_CHOICES = localdata.TEMPLATE... | Add some tiny docstring to the unicode method | Add some tiny docstring to the unicode method
| Python | bsd-3-clause | Alir3z4/cmsplugin-simple-markdown,Alir3z4/cmsplugin-simple-markdown | ---
+++
@@ -21,4 +21,7 @@
)
def __unicode__(self):
+ """
+ :rtype: str or unicode
+ """
return self.markdown_text |
79ac1550b5acd407b2a107e694c66cccfbc0be89 | alerts/lib/deadman_alerttask.py | alerts/lib/deadman_alerttask.py | from alerttask import AlertTask
class DeadmanAlertTask(AlertTask):
def __init__(self):
self.deadman = True
def executeSearchEventsSimple(self):
# We override this method to specify the size as 1
# since we only care about if ANY events are found or not
return self.main_query.e... | from alerttask import AlertTask
class DeadmanAlertTask(AlertTask):
def executeSearchEventsSimple(self):
# We override this method to specify the size as 1
# since we only care about if ANY events are found or not
return self.main_query.execute(self.es, indices=self.event_indices, size=1)
| Remove deadman alerttask init method | Remove deadman alerttask init method
| Python | mpl-2.0 | jeffbryner/MozDef,gdestuynder/MozDef,mozilla/MozDef,mpurzynski/MozDef,mozilla/MozDef,Phrozyn/MozDef,jeffbryner/MozDef,jeffbryner/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,gdestuynder/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,mpurzynski/MozDef,gdestuynder/MozDef,Phrozyn/MozDef,mozilla/MozDef,jeffbryner/MozDef,mozilla/MozDef... | ---
+++
@@ -2,8 +2,6 @@
class DeadmanAlertTask(AlertTask):
- def __init__(self):
- self.deadman = True
def executeSearchEventsSimple(self):
# We override this method to specify the size as 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.