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 |
|---|---|---|---|---|---|---|---|---|---|---|
dd400066927e70e43001e3c3172241579a314b60 | s3_sample.py | s3_sample.py | # Copyright 2013. Amazon Web Services, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Import the SDK
import boto
import uuid
# Create an S3 client
s3 = boto.connect_s3()
# Create a new bucket.
bucket_name = "python-sdk-sample-" + str(uuid.uuid4())
print "Creating new bucket with name: " + bucket_name
bucket = s3.create_bucket(bucket_name)
# Upload some data
from boto.s3.key import Key
k = Key(bucket)
k.key = 'hello_world.txt'
print "Uploading some data to " + bucket_name + " with key: " + k.key
k.set_contents_from_string('This is a test of S3. Hello World!')
| # Copyright 2013. Amazon Web Services, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Import the SDK
import boto
import uuid
# Create an S3 client
s3 = boto.connect_s3()
# Create a new bucket.
bucket_name = "python-sdk-sample-" + str(uuid.uuid4())
print "Creating new bucket with name: " + bucket_name
bucket = s3.create_bucket(bucket_name)
# Upload some data
from boto.s3.key import Key
k = Key(bucket)
k.key = 'hello_world.txt'
print "Uploading some data to " + bucket_name + " with key: " + k.key
k.set_contents_from_string('This is a test of S3. Hello World!')
# Fetch the key to show that we stored something.
print "Downloading the object we just uploaded:\n"
print k.get_contents_as_string() + "\n"
print "Now delete the same object"
k.delete()
print "And finally, delete the bucket."
s3.delete_bucket(bucket_name)
| Update sample to also fetch the object, and delete the object and bucket. | Update sample to also fetch the object, and delete the object and bucket.
| Python | apache-2.0 | ceizner/codechallenge,awslabs/aws-python-sample,noahchense/aws-python-sample | ---
+++
@@ -31,3 +31,13 @@
print "Uploading some data to " + bucket_name + " with key: " + k.key
k.set_contents_from_string('This is a test of S3. Hello World!')
+
+# Fetch the key to show that we stored something.
+print "Downloading the object we just uploaded:\n"
+print k.get_contents_as_string() + "\n"
+
+print "Now delete the same object"
+k.delete()
+
+print "And finally, delete the bucket."
+s3.delete_bucket(bucket_name) |
c96b4de722e412f288b16dc8685c2556e3d801b1 | shopify_python/__init__.py | shopify_python/__init__.py | # Copyright (c) 2017 "Shopify inc." All rights reserved.
# Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
from __future__ import unicode_literals
from pylint import lint
from shopify_python import google_styleguide
from shopify_python import shopify_styleguide
__version__ = '0.4.2'
def register(linter): # type: (lint.PyLinter) -> None
google_styleguide.register_checkers(linter)
shopify_styleguide.register_checkers(linter)
| # Copyright (c) 2017 "Shopify inc." All rights reserved.
# Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
from __future__ import unicode_literals
from pylint import lint
from shopify_python import google_styleguide
from shopify_python import shopify_styleguide
__version__ = '0.4.3'
def register(linter): # type: (lint.PyLinter) -> None
google_styleguide.register_checkers(linter)
shopify_styleguide.register_checkers(linter)
| Increase version number to 0.4.3 | Increase version number to 0.4.3
| Python | mit | Shopify/shopify_python | ---
+++
@@ -7,7 +7,7 @@
from shopify_python import shopify_styleguide
-__version__ = '0.4.2'
+__version__ = '0.4.3'
def register(linter): # type: (lint.PyLinter) -> None |
938840b27fd218eeaf9c253e9162392e653dff0b | snippet_parser/it.py | snippet_parser/it.py | #-*- encoding: utf-8 -*-
from __future__ import unicode_literals
from core import *
def handle_bandiera(template):
return template.get(1)
def handle_citazione(template):
if template.params:
return '« ' + sp(template.params[0]) + ' »'
class SnippetParser(SnippetParserBase):
def strip_template(self, template, normalize, collapse):
if template.name.matches('bandiera'):
return handle_bandiera(template)
elif template.name.matches('citazione'):
return handle_citazione(template)
return super(SnippetParser, self).strip_template(
template, normalize, collapse)
| #-*- encoding: utf-8 -*-
from __future__ import unicode_literals
from core import *
class SnippetParser(SnippetParserBase):
def strip_template(self, template, normalize, collapse):
if template.name.matches('bandiera'):
return self.handle_bandiera(template)
elif template.name.matches('citazione'):
return self.handle_citazione(template)
return super(SnippetParser, self).strip_template(
template, normalize, collapse)
def handle_bandiera(template):
return template.get(1)
def handle_citazione(template):
if template.params:
return '« ' + self.sp(template.params[0]) + ' »'
| Fix snippet parser for Italian. | Fix snippet parser for Italian.
Former-commit-id: bb8d10f5f8301fbcd4f4232612bf722d380a3d10 | Python | mit | guilherme-pg/citationhunt,eggpi/citationhunt,eggpi/citationhunt,guilherme-pg/citationhunt,guilherme-pg/citationhunt,eggpi/citationhunt,eggpi/citationhunt,guilherme-pg/citationhunt | ---
+++
@@ -3,18 +3,18 @@
from core import *
-def handle_bandiera(template):
- return template.get(1)
-
-def handle_citazione(template):
- if template.params:
- return '« ' + sp(template.params[0]) + ' »'
-
class SnippetParser(SnippetParserBase):
def strip_template(self, template, normalize, collapse):
if template.name.matches('bandiera'):
- return handle_bandiera(template)
+ return self.handle_bandiera(template)
elif template.name.matches('citazione'):
- return handle_citazione(template)
+ return self.handle_citazione(template)
return super(SnippetParser, self).strip_template(
template, normalize, collapse)
+
+ def handle_bandiera(template):
+ return template.get(1)
+
+ def handle_citazione(template):
+ if template.params:
+ return '« ' + self.sp(template.params[0]) + ' »' |
a4a6c637615b561c7fef62aaa17deee7e0991436 | networking_cisco/services/trunk/trunkstubs.py | networking_cisco/services/trunk/trunkstubs.py | # Copyright (c) 2017 Cisco Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# Stub module containing the networking_cisco trunk APIs.
#
# Required for tox testing for neutron stable/mitaka.
# TODO(rcurran): Remove once networking_cisco is no longer supporting
# stable/mitaka.
TRUNK_SUBPORT_OWNER = ""
class NexusMDTrunkHandler(object):
def _stub_trunk(self, *args):
return False
is_trunk_parentport = _stub_trunk
is_trunk_subport = _stub_trunk
class NexusTrunkDriver(object):
def create(self):
pass
class DriverBase(object):
pass
| # Copyright (c) 2017 Cisco Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# Stub module containing the networking_cisco trunk APIs.
#
# Required for tox testing for neutron stable/mitaka.
# TODO(rcurran): Remove once networking_cisco is no longer supporting
# stable/mitaka.
TRUNK_SUBPORT_OWNER = ""
VLAN = ""
class DriverBase(object):
def __init__(self, name, interfaces, segmentation_types,
agent_type=None, can_trunk_bound_port=False):
pass
| Fix neutron server crash introduced by trunk code | Fix neutron server crash introduced by trunk code
When running pre-stable/ocata neutron code the networking_cisco trunk
code was crashing due to incorrect backwards_compatibility implementation.
Change-Id: I8188f8d16313166418d207c99124e2763eb669a1
| Python | apache-2.0 | noironetworks/networking-cisco,Tehsmash/networking-cisco,Tehsmash/networking-cisco,openstack/networking-cisco,openstack/networking-cisco,noironetworks/networking-cisco | ---
+++
@@ -20,22 +20,10 @@
# stable/mitaka.
TRUNK_SUBPORT_OWNER = ""
-
-
-class NexusMDTrunkHandler(object):
-
- def _stub_trunk(self, *args):
- return False
-
- is_trunk_parentport = _stub_trunk
- is_trunk_subport = _stub_trunk
-
-
-class NexusTrunkDriver(object):
-
- def create(self):
- pass
+VLAN = ""
class DriverBase(object):
- pass
+ def __init__(self, name, interfaces, segmentation_types,
+ agent_type=None, can_trunk_bound_port=False):
+ pass |
d2e3fcedb5a228a234d5b564cca391214f95e617 | us_ignite/apps/tests/fixtures.py | us_ignite/apps/tests/fixtures.py | from us_ignite.apps.models import Application, ApplicationMembership, Page
from us_ignite.profiles.tests.fixtures import get_user
def get_application(**kwargs):
defaults = {
'name': 'Gigabit app',
}
if not 'owner' in kwargs:
defaults['owner'] = get_user('us-ignite')
defaults.update(kwargs)
return Application.objects.create(**defaults)
def get_membership(application, user):
membership, is_new = (ApplicationMembership.objects
.get_or_create(application=application, user=user))
return membership
def get_page(**kwargs):
defaults = {
'name': 'Application list',
}
defaults.update(kwargs)
return Page.objects.create(**defaults)
| from us_ignite.apps.models import (Application, ApplicationMembership,
Domain, Page)
from us_ignite.profiles.tests.fixtures import get_user
def get_application(**kwargs):
data = {
'name': 'Gigabit app',
}
if not 'owner' in kwargs:
data['owner'] = get_user('us-ignite')
data.update(kwargs)
return Application.objects.create(**data)
def get_membership(application, user):
membership, is_new = (ApplicationMembership.objects
.get_or_create(application=application, user=user))
return membership
def get_page(**kwargs):
data = {
'name': 'Application list',
}
data.update(kwargs)
return Page.objects.create(**data)
def get_domain(**kwargs):
data = {
'name': 'Healthcare',
'slug': 'healthcare',
}
data.update(kwargs)
return Domain.objects.create(**data)
| Add ``get_domain`` test fixture factory. | Add ``get_domain`` test fixture factory.
Helpful to test the ``Domain``.
| Python | bsd-3-clause | us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite | ---
+++
@@ -1,15 +1,16 @@
-from us_ignite.apps.models import Application, ApplicationMembership, Page
+from us_ignite.apps.models import (Application, ApplicationMembership,
+ Domain, Page)
from us_ignite.profiles.tests.fixtures import get_user
def get_application(**kwargs):
- defaults = {
+ data = {
'name': 'Gigabit app',
}
if not 'owner' in kwargs:
- defaults['owner'] = get_user('us-ignite')
- defaults.update(kwargs)
- return Application.objects.create(**defaults)
+ data['owner'] = get_user('us-ignite')
+ data.update(kwargs)
+ return Application.objects.create(**data)
def get_membership(application, user):
@@ -19,8 +20,17 @@
def get_page(**kwargs):
- defaults = {
+ data = {
'name': 'Application list',
}
- defaults.update(kwargs)
- return Page.objects.create(**defaults)
+ data.update(kwargs)
+ return Page.objects.create(**data)
+
+
+def get_domain(**kwargs):
+ data = {
+ 'name': 'Healthcare',
+ 'slug': 'healthcare',
+ }
+ data.update(kwargs)
+ return Domain.objects.create(**data) |
f7ae0b3663f9fabd312f1f07c544ac9122241fc4 | broadcaster.py | broadcaster.py | from threading import Thread
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
import os
import requests
import time
FRAMES_PATH = os.getenv("FRAMES_PATH", 'frames')
PUBLISH_URL = os.getenv("PUBLISH_URL", 'http://localhost:9080/pub?id={channel}')
class EventHandler(FileSystemEventHandler):
def on_created(self, event):
Thread(target=post, args=(event.src_path,)).start()
def post(path):
channel = os.path.basename(os.path.dirname(path))
with open(path, 'rb') as content:
r = requests.post(PUBLISH_URL.format(channel=channel), data=content.read())
if r.status_code == 200:
print 'Pushed {}'.format(path)
else:
print r
os.remove(path)
if __name__ == "__main__":
event_handler = EventHandler()
observer = Observer()
observer.schedule(event_handler, path=FRAMES_PATH, recursive=True)
observer.start()
print 'started'
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
observer.join()
| from threading import Thread
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
import os
import requests
import time
FRAMES_PATH = os.getenv("FRAMES_PATH", 'frames')
PUBLISH_URL = os.getenv("PUBLISH_URL", 'http://localhost:9080/pub?id={channel}')
class EventHandler(FileSystemEventHandler):
def on_created(self, event):
if os.path.isdir(event.src_path):
return
Thread(target=post, args=(event.src_path,)).start()
def post(path):
channel = os.path.basename(os.path.dirname(path))
with open(path, 'rb') as content:
r = requests.post(PUBLISH_URL.format(channel=channel), data=content.read())
if r.status_code == 200:
print 'Pushed {}'.format(path)
else:
print r
os.remove(path)
if __name__ == "__main__":
event_handler = EventHandler()
observer = Observer()
observer.schedule(event_handler, path=FRAMES_PATH, recursive=True)
observer.start()
print 'started'
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
observer.join()
| Fix bug when directory is created on watched path | Fix bug when directory is created on watched path
| Python | mit | jbochi/live_thumb,jbochi/live_thumb,jbochi/live_thumb | ---
+++
@@ -11,6 +11,8 @@
class EventHandler(FileSystemEventHandler):
def on_created(self, event):
+ if os.path.isdir(event.src_path):
+ return
Thread(target=post, args=(event.src_path,)).start()
|
d6bc89c7f2372a623de42232b47c417be0620c45 | imgfilter/analyzers/blur_detection/focus_measure.py | imgfilter/analyzers/blur_detection/focus_measure.py | import cv2
import numpy
def LAPV(img):
"""Implements the LAPV focus measure algorithm.
:param img: the image the measure is applied to as a numpy matrix
"""
return numpy.std(cv2.Laplacian(img, cv2.CV_64F)) ** 2
def TENG(img):
"""Implements the TENG focus measure algorithm.
:param img: the image the measure is applied to as a numpy matrix
"""
gaussianX = cv2.Sobel(img, cv2.CV_64F, 1, 0, 1)
gaussianY = cv2.Sobel(img, cv2.CV_64F, 1, 0, 1)
return numpy.mean(gaussianX * gaussianX +
gaussianY * gaussianY)
def LAPM(img):
"""Implements the LAPM focus measure algorithm.
:param img: the image the measure is applied to as a numpy matrix
"""
kernel = numpy.array([-1, 2, -1])
laplacianX = numpy.abs(cv2.filter2D(img, -1, kernel))
laplacianY = numpy.abs(cv2.filter2D(img, -1, kernel.T))
return numpy.mean(laplacianX + laplacianY)
def MLOG(img):
"""Implements the MLOG focus measure algorithm.
:param img: the image the measure is applied to as a numpy matrix
"""
return numpy.max(cv2.convertScaleAbs(cv2.Laplacian(img, 3)))
| import cv2
import numpy
def LAPV(img):
"""Implements the LAPV focus measure algorithm.
:param img: the image the measure is applied to as a numpy matrix
"""
return numpy.std(cv2.Laplacian(img, cv2.CV_64F)) ** 2
def TENG(img):
"""Implements the TENG focus measure algorithm.
:param img: the image the measure is applied to as a numpy matrix
"""
gaussianX = cv2.Sobel(img, cv2.CV_64F, 1, 0)
gaussianY = cv2.Sobel(img, cv2.CV_64F, 1, 0)
return numpy.mean(gaussianX * gaussianX +
gaussianY * gaussianY)
def LAPM(img):
"""Implements the LAPM focus measure algorithm.
:param img: the image the measure is applied to as a numpy matrix
"""
kernel = numpy.array([-1, 2, -1])
laplacianX = numpy.abs(cv2.filter2D(img, -1, kernel))
laplacianY = numpy.abs(cv2.filter2D(img, -1, kernel.T))
return numpy.mean(laplacianX + laplacianY)
def MLOG(img):
"""Implements the MLOG focus measure algorithm.
:param img: the image the measure is applied to as a numpy matrix
"""
return numpy.max(cv2.convertScaleAbs(cv2.Laplacian(img, 3)))
| Fix bug in focus measure | Fix bug in focus measure
| Python | mit | vismantic-ohtuprojekti/image-filtering-suite,vismantic-ohtuprojekti/qualipy | ---
+++
@@ -15,8 +15,8 @@
:param img: the image the measure is applied to as a numpy matrix
"""
- gaussianX = cv2.Sobel(img, cv2.CV_64F, 1, 0, 1)
- gaussianY = cv2.Sobel(img, cv2.CV_64F, 1, 0, 1)
+ gaussianX = cv2.Sobel(img, cv2.CV_64F, 1, 0)
+ gaussianY = cv2.Sobel(img, cv2.CV_64F, 1, 0)
return numpy.mean(gaussianX * gaussianX +
gaussianY * gaussianY)
|
b78d0fa67ad19d4090a5b67668f621aa3b58e8ea | tests/test_rest.py | tests/test_rest.py | from vcontrol.rest.commands import info
from vcontrol.rest.commands.plugins import add
import requests
def test_info_command_r():
""" tests the InfoCommandR class """
r = requests.get('http://localhost:8080/v1/commands/info/foo')
assert r.text == 'unable to get info on foo'
c_inst = info.InfoCommandR()
c_inst.GET("foo")
def test_plugin_add_command():
""" tests rest/commands/plugin/add """
data = {'broken': 'broken'}
r = requests.post('http://localhost:8080/v1/commands/plugins/add', data=data)
assert 'no machine specified' in r.text
| from vcontrol.rest.commands import info
from vcontrol.rest.commands.plugins import add
import requests
def test_info_command_r():
""" tests the InfoCommandR class """
r = requests.get('http://localhost:8080/v1/commands/info/foo')
assert r.text == 'unable to get info on foo'
c_inst = info.InfoCommandR()
c_inst.GET("foo")
def test_plugin_add_command():
""" tests rest/commands/plugin/add """
data = {'broken': 'broken'}
r = requests.post('http://localhost:8080/v1/commands/plugin/add', data=data)
assert 'no machine specified' in r.text
| Test against the correct endpoint. | Test against the correct endpoint. | Python | apache-2.0 | CyberReboot/vcontrol,cglewis/vcontrol,CyberReboot/vcontrol,cglewis/vcontrol,cglewis/vcontrol,CyberReboot/vcontrol | ---
+++
@@ -13,5 +13,5 @@
def test_plugin_add_command():
""" tests rest/commands/plugin/add """
data = {'broken': 'broken'}
- r = requests.post('http://localhost:8080/v1/commands/plugins/add', data=data)
+ r = requests.post('http://localhost:8080/v1/commands/plugin/add', data=data)
assert 'no machine specified' in r.text |
c30ef8dba42dcc16eb7bf9e126d4551db30c06eb | exporters/filters/__init__.py | exporters/filters/__init__.py | from .key_value_filter import KeyValueFilter
from .key_value_regex_filter import KeyValueRegexFilter
from .no_filter import NoFilter
from .pythonexp_filter import PythonexpFilter
__all__ = ['KeyValueFilter', 'KeyValueRegexFilter', 'NoFilter', 'PythonexpFilter']
| from .key_value_filters import KeyValueFilter, KeyValueRegexFilter
from .no_filter import NoFilter
from .pythonexp_filter import PythonexpFilter
__all__ = ['KeyValueFilter', 'KeyValueRegexFilter', 'NoFilter', 'PythonexpFilter']
| Use proper filters avoiding deprecated warnings. | Use proper filters avoiding deprecated warnings.
| Python | bsd-3-clause | scrapinghub/exporters | ---
+++
@@ -1,5 +1,4 @@
-from .key_value_filter import KeyValueFilter
-from .key_value_regex_filter import KeyValueRegexFilter
+from .key_value_filters import KeyValueFilter, KeyValueRegexFilter
from .no_filter import NoFilter
from .pythonexp_filter import PythonexpFilter
|
c424744af801241fbdced0e3344c1f9b6f2c6416 | citenet/cli.py | citenet/cli.py | """Command-line interface for citenet."""
def main():
"""Run the CLI."""
print('CiteNet CLI')
| """Command-line interface for citenet."""
import sys
import json
import citenet
def main():
"""Run the CLI."""
if len(sys.argv) != 2:
print("Usage: {} <config_file>")
with open(sys.argv[1]) as config_file:
config = json.load(config_file)
graph = citenet.read_csv_graph(**config['graph'])
| Add rudimentary JSON configuration to CLI | Add rudimentary JSON configuration to CLI
| Python | mit | Pringley/citenet | ---
+++
@@ -1,5 +1,15 @@
"""Command-line interface for citenet."""
+
+import sys
+import json
+import citenet
def main():
"""Run the CLI."""
- print('CiteNet CLI')
+ if len(sys.argv) != 2:
+ print("Usage: {} <config_file>")
+
+ with open(sys.argv[1]) as config_file:
+ config = json.load(config_file)
+
+ graph = citenet.read_csv_graph(**config['graph']) |
7d714f0e19ceaa72e186674302549c176e98f442 | streak-podium/render.py | streak-podium/render.py | import matplotlib.pyplot as plt
import numpy as np
def horizontal_bar(sorted_streaks, sort):
"""
Render a horizontal bar chart of streaks.
Values have already been sorted by sort.
"""
# Only extract those users & streaks for streaks that are non-zero:
users, streaks = zip(*[(user, streak.get(sort)) for user, streak
in sorted_streaks if streak.get(sort) > 0][::-1])
title = 'Top Contributors by {} Streak'.format(sort.title())
figure = plt.figure()
y_pos = np.arange(len(users)) # y-location of bars
print('y_pos', y_pos)
plt.barh(y_pos, streaks, facecolor='#ff9999', edgecolor='grey', align='center')
plt.yticks(y_pos, users)
plt.xlim([0, max(streaks) + 0.5]) # x-limits a bit wider at right
plt.subplots_adjust(left=0.2) # Wider left margin
plt.title(title)
for format in ('png', 'svg'):
figure.savefig('temp/top_{}.{}'.format(sort, format), format=format)
| import matplotlib.pyplot as plt
import numpy as np
def horizontal_bar(sorted_streaks, sort):
"""
Render a horizontal bar chart of streaks.
Values have already been sorted by sort.
"""
# Only extract those users & streaks for streaks that are non-zero:
users, streaks = zip(*[(user, streak.get(sort)) for user, streak
in sorted_streaks if streak.get(sort) > 0][::-1])
title = 'Top Contributors by {} Streak'.format(sort.title())
figure = plt.figure(num=None, figsize=(6, 15))
y_pos = np.arange(len(users)) # y-location of bars
print('y_pos', y_pos)
plt.barh(y_pos, streaks, facecolor='#5555EE', edgecolor='grey', align='center')
plt.yticks(y_pos, users)
plt.xlim([0, max(streaks) + 10]) # x-limits a bit wider at right
plt.subplots_adjust(left=0.25) # Wider left margin
plt.title(title)
for format in ('png', 'svg'):
figure.savefig('temp/top_{}.{}'.format(sort, format), format=format)
| Add argument to adjust figure size | Add argument to adjust figure size
And minor styling tweaks.
| Python | mit | supermitch/streak-podium,jollyra/hubot-commit-streak,jollyra/hubot-commit-streak,jollyra/hubot-streak-podium,jollyra/hubot-streak-podium,supermitch/streak-podium | ---
+++
@@ -14,13 +14,13 @@
title = 'Top Contributors by {} Streak'.format(sort.title())
- figure = plt.figure()
+ figure = plt.figure(num=None, figsize=(6, 15))
y_pos = np.arange(len(users)) # y-location of bars
print('y_pos', y_pos)
- plt.barh(y_pos, streaks, facecolor='#ff9999', edgecolor='grey', align='center')
+ plt.barh(y_pos, streaks, facecolor='#5555EE', edgecolor='grey', align='center')
plt.yticks(y_pos, users)
- plt.xlim([0, max(streaks) + 0.5]) # x-limits a bit wider at right
- plt.subplots_adjust(left=0.2) # Wider left margin
+ plt.xlim([0, max(streaks) + 10]) # x-limits a bit wider at right
+ plt.subplots_adjust(left=0.25) # Wider left margin
plt.title(title)
for format in ('png', 'svg'): |
94f5edd9b2f693b48181ddefa7af725be854c49e | src/config/common/ssl_adapter.py | src/config/common/ssl_adapter.py | """ HTTPS Transport Adapter for python-requests, that allows configuration of
SSL version"""
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# @author: Sanju Abraham, Juniper Networks, OpenContrail
from requests.adapters import HTTPAdapter
try:
# This is required for RDO, which installs both python-requests
# and python-urllib3, but symlinks python-request's internally packaged
# urllib3 to the site installed one.
from requests.packages.urllib3.poolmanager import PoolManager
except ImportError:
# Fallback to standard installation methods
from urllib3.poolmanager import PoolManager
class SSLAdapter(HTTPAdapter):
'''An HTTPS Transport Adapter that can be configured with SSL/TLS
version.'''
def __init__(self, ssl_version=None, **kwargs):
self.ssl_version = ssl_version
self.poolmanager = None
super(SSLAdapter, self).__init__(**kwargs)
def init_poolmanager(self, connections, maxsize, block=False):
self.poolmanager = PoolManager(num_pools=connections,
maxsize=maxsize,
block=block,
ssl_version=self.ssl_version)
| """ HTTPS Transport Adapter for python-requests, that allows configuration of
SSL version"""
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# @author: Sanju Abraham, Juniper Networks, OpenContrail
from requests.adapters import HTTPAdapter
try:
# This is required for RDO, which installs both python-requests
# and python-urllib3, but symlinks python-request's internally packaged
# urllib3 to the site installed one.
from requests.packages.urllib3.poolmanager import PoolManager
except ImportError:
# Fallback to standard installation methods
from urllib3.poolmanager import PoolManager
class SSLAdapter(HTTPAdapter):
'''An HTTPS Transport Adapter that can be configured with SSL/TLS
version.'''
HTTPAdapter.__attrs__.extend(['ssl_version'])
def __init__(self, ssl_version=None, **kwargs):
self.ssl_version = ssl_version
self.poolmanager = None
super(SSLAdapter, self).__init__(**kwargs)
def init_poolmanager(self, connections, maxsize, block=False):
self.poolmanager = PoolManager(num_pools=connections,
maxsize=maxsize,
block=block,
ssl_version=self.ssl_version)
| Add ssl_version to the list of attributes, required when vnc_api gets called via multiprocessing module. This will ensure ssl_version gets included when pickle calls __getstate__ and __setstate__. | Add ssl_version to the list of attributes, required when vnc_api gets called via multiprocessing module.
This will ensure ssl_version gets included when pickle calls __getstate__ and __setstate__.
Courtesy: https://github.com/sigmavirus24/requests-toolbelt/commit/decadbd3512444889feb30cf1ff2f1448a3ecfca
Closes-Bug:#1604247
Change-Id: Iee9e0348c005e88c535f4da33cf98149a8c1b19d
| Python | apache-2.0 | tcpcloud/contrail-controller,tcpcloud/contrail-controller,tcpcloud/contrail-controller,tcpcloud/contrail-controller,tcpcloud/contrail-controller,tcpcloud/contrail-controller | ---
+++
@@ -16,6 +16,7 @@
class SSLAdapter(HTTPAdapter):
'''An HTTPS Transport Adapter that can be configured with SSL/TLS
version.'''
+ HTTPAdapter.__attrs__.extend(['ssl_version'])
def __init__(self, ssl_version=None, **kwargs):
self.ssl_version = ssl_version |
34513dd1716f7299b2244d488055e82da1aea080 | armstrong/core/arm_layout/utils.py | armstrong/core/arm_layout/utils.py | from django.utils.safestring import mark_safe
from django.template.loader import render_to_string
def get_layout_template_name(model, name):
ret = []
for a in model.__class__.mro():
if not hasattr(a, "_meta"):
continue
ret.append("layout/%s/%s/%s.html" % (a._meta.app_label,
a._meta.object_name.lower(), name))
return ret
def render_model(object, name, dictionary=None, context_instance=None):
dictionary = dictionary or {}
dictionary["object"] = object
return mark_safe(render_to_string(get_layout_template_name(object, name),
dictionary=dictionary, context_instance=context_instance))
| from django.utils.safestring import mark_safe
from django.template.loader import render_to_string
from armstrong.utils.backends import GenericBackend
template_finder = GenericBackend('ARMSTRONG_LAYOUT_TEMPLATE_FINDER',
defaults='armstrong.core.arm_layout.utils.get_layout_template_name')\
.get_backend
def get_layout_template_name(model, name):
ret = []
for a in model.__class__.mro():
if not hasattr(a, "_meta"):
continue
ret.append("layout/%s/%s/%s.html" % (a._meta.app_label,
a._meta.object_name.lower(), name))
return ret
def render_model(object, name, dictionary=None, context_instance=None):
dictionary = dictionary or {}
dictionary["object"] = object
return mark_safe(render_to_string(template_finder(object, name),
dictionary=dictionary, context_instance=context_instance))
| Use a GenericBackend for our template finding function. | Use a GenericBackend for our template finding function.
| Python | apache-2.0 | armstrong/armstrong.core.arm_layout,armstrong/armstrong.core.arm_layout | ---
+++
@@ -1,5 +1,12 @@
from django.utils.safestring import mark_safe
from django.template.loader import render_to_string
+
+from armstrong.utils.backends import GenericBackend
+
+
+template_finder = GenericBackend('ARMSTRONG_LAYOUT_TEMPLATE_FINDER',
+ defaults='armstrong.core.arm_layout.utils.get_layout_template_name')\
+ .get_backend
def get_layout_template_name(model, name):
@@ -15,5 +22,5 @@
def render_model(object, name, dictionary=None, context_instance=None):
dictionary = dictionary or {}
dictionary["object"] = object
- return mark_safe(render_to_string(get_layout_template_name(object, name),
+ return mark_safe(render_to_string(template_finder(object, name),
dictionary=dictionary, context_instance=context_instance)) |
f83d6e0848d2b2a9f1cff4938b315c41d01ce092 | python/ipywidgets/ipywidgets/widgets/utils.py | python/ipywidgets/ipywidgets/widgets/utils.py | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import sys
import warnings
# This function is from https://github.com/python/cpython/issues/67998
# (https://bugs.python.org/file39550/deprecated_module_stacklevel.diff) and
# calculates the appropriate stacklevel for deprecations to target the
# deprecation for the caller, no matter how many internal stack frames we have
# added in the process. For example, with the deprecation warning in the
# __init__ below, the appropriate stacklevel will change depending on how deep
# the inheritance hierarchy is.
def external_stacklevel(internal):
"""Find the first frame that doesn't any of the given internal strings
The depth will be 2 at minimum in order to start checking at the caller of
the function that called this utility method.
"""
level = 2
frame = sys._getframe(level)
while frame and any(s in frame.f_code.co_filename for s in internal):
level +=1
frame = frame.f_back
return level
def deprecation(message, internal=None):
"""Generate a deprecation warning targeting the first external frame
internal is a list of strings, which if they appear in filenames in the
frames, the frames will also be considered internal.
"""
if internal is None:
internal = []
warnings.warn(message, DeprecationWarning, stacklevel=external_stacklevel(internal+['ipywidgets/widgets/']))
| # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import sys
import warnings
# This function is from https://github.com/python/cpython/issues/67998
# (https://bugs.python.org/file39550/deprecated_module_stacklevel.diff) and
# calculates the appropriate stacklevel for deprecations to target the
# deprecation for the caller, no matter how many internal stack frames we have
# added in the process. For example, with the deprecation warning in the
# __init__ below, the appropriate stacklevel will change depending on how deep
# the inheritance hierarchy is.
def _external_stacklevel(internal):
"""Find the first frame that doesn't any of the given internal strings
The depth will be 1 at minimum in order to start checking at the caller of
the function that called this utility method.
"""
# Get the level of my caller's caller
level = 2
frame = sys._getframe(level)
while frame and any(s in frame.f_code.co_filename for s in internal):
level +=1
frame = frame.f_back
# the returned value will be used one level up from here, so subtract one
return level-1
def deprecation(message, internal=None):
"""Generate a deprecation warning targeting the first frame outside the ipywidgets library.
internal is a list of strings, which if they appear in filenames in the
frames, the frames will also be considered internal. This can be useful if we know that ipywidgets
is calling out to, for example, traitlets internally.
"""
if internal is None:
internal = []
warnings.warn(message, DeprecationWarning, stacklevel=_external_stacklevel(internal+['ipywidgets/widgets/']))
| Adjust stack level returned to account for it being calculated one level deeper than it is being used. | Adjust stack level returned to account for it being calculated one level deeper than it is being used.
Also, make the stack level calculator private until there is a need to make it public. | Python | bsd-3-clause | jupyter-widgets/ipywidgets,jupyter-widgets/ipywidgets,jupyter-widgets/ipywidgets,jupyter-widgets/ipywidgets | ---
+++
@@ -11,25 +11,28 @@
# added in the process. For example, with the deprecation warning in the
# __init__ below, the appropriate stacklevel will change depending on how deep
# the inheritance hierarchy is.
-def external_stacklevel(internal):
+def _external_stacklevel(internal):
"""Find the first frame that doesn't any of the given internal strings
- The depth will be 2 at minimum in order to start checking at the caller of
+ The depth will be 1 at minimum in order to start checking at the caller of
the function that called this utility method.
"""
+ # Get the level of my caller's caller
level = 2
frame = sys._getframe(level)
while frame and any(s in frame.f_code.co_filename for s in internal):
level +=1
frame = frame.f_back
- return level
+ # the returned value will be used one level up from here, so subtract one
+ return level-1
def deprecation(message, internal=None):
- """Generate a deprecation warning targeting the first external frame
+ """Generate a deprecation warning targeting the first frame outside the ipywidgets library.
internal is a list of strings, which if they appear in filenames in the
- frames, the frames will also be considered internal.
+ frames, the frames will also be considered internal. This can be useful if we know that ipywidgets
+ is calling out to, for example, traitlets internally.
"""
if internal is None:
internal = []
- warnings.warn(message, DeprecationWarning, stacklevel=external_stacklevel(internal+['ipywidgets/widgets/']))
+ warnings.warn(message, DeprecationWarning, stacklevel=_external_stacklevel(internal+['ipywidgets/widgets/'])) |
a6bab1368f5f6514ed6b3ac5abe38d6dea0c8cca | compile_w32.py | compile_w32.py | """
Compile script for py2exe.
In order to compile this you need to install py2exe.
From here: http://sourceforge.net/projects/py2exe/files/py2exe/
Compile environment must be win32 (Win XP, Win Server and so on...)
And you'll also need a working install of Python 2.6 (or newer) from python.org.
Python version must correspond to py2exe version.
You must follow instructions from here: http://www.py2exe.org/index.cgi/Tutorial
In short, you must run:
# python compile_w32.py py2exe
It will produce 2 folders /build/ and /dist/
/dist/ is your distributable version.
Rename it and use like a program distribution.
"""
from distutils.core import setup
import py2exe
setup(console=['dms_client.py'])
| """
Compile script for py2exe.
In order to compile this you need to install py2exe.
From here: http://sourceforge.net/projects/py2exe/files/py2exe/
Compile environment must be win32 (Win XP, Win Server and so on...)
And you'll also need a working install of Python 2.6 (or newer) from python.org.
Python version must correspond to py2exe version.
You must follow instructions from here: http://www.py2exe.org/index.cgi/Tutorial
In short, you must run:
# python compile_w32.py py2exe
It will produce 2 folders /build/ and /dist/
/dist/ is your distributable version.
Rename it and use like a program distribution.
"""
# TODO: Merge this with setup.py
from distutils.core import setup
import py2exe
setup(console=['dms_client.py'])
| Add comment to merge with setup.py | Add comment to merge with setup.py
| Python | bsd-3-clause | adlibre/dms-client | ---
+++
@@ -21,6 +21,8 @@
Rename it and use like a program distribution.
"""
+# TODO: Merge this with setup.py
+
from distutils.core import setup
import py2exe
|
aaa468b458b0ec73d4c175993674835c9bdd0df8 | cheddar/urls.py | cheddar/urls.py | # Copyright 2015 Thierry Carrez <thierry@openstack.org>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from django.conf.urls import patterns, url
from cheddar import views
urlpatterns = patterns(
'',
url(r'^$', views.index, name='index'),
url(r'^(\d+)$', views.trackindex),
url(r'^(\d+)/edit/(\S+)$', views.modifysession),
url(r'^(\d+)/(\S+)$', views.editsession),
url(r'^logout$', views.dologout),
url(r'^loggedout$', views.loggedout),
)
| # Copyright 2015 Thierry Carrez <thierry@openstack.org>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from django.conf.urls import patterns, url
from cheddar import views
urlpatterns = patterns(
'',
url(r'^$', views.index, name='index'),
url(r'^(\d+)$', views.trackindex),
url(r'^(\d+)/edit/(.+)$', views.modifysession),
url(r'^(\d+)/(.+)$', views.editsession),
url(r'^logout$', views.dologout),
url(r'^loggedout$', views.loggedout),
)
| Support spaces in track names | Support spaces in track names
Fix URLs so that spaces in track names do not create fail.
| Python | apache-2.0 | ttx/summitsched,ttx/summitsched | ---
+++
@@ -21,8 +21,8 @@
'',
url(r'^$', views.index, name='index'),
url(r'^(\d+)$', views.trackindex),
- url(r'^(\d+)/edit/(\S+)$', views.modifysession),
- url(r'^(\d+)/(\S+)$', views.editsession),
+ url(r'^(\d+)/edit/(.+)$', views.modifysession),
+ url(r'^(\d+)/(.+)$', views.editsession),
url(r'^logout$', views.dologout),
url(r'^loggedout$', views.loggedout),
) |
4dbeb34c0ca691ff4a9faf6d6a0fa9f67bacba5a | app/tests/conftest.py | app/tests/conftest.py | import os.path
import pytest
from alembic.command import upgrade
from alembic.config import Config
from app.database import sa, create_engine, create_db_session
from app.models import Base
HERE = os.path.dirname(os.path.abspath(__file__))
ALEMBIC_CONFIG = os.path.join(HERE, "..", "..", "alembic.ini")
def apply_migrations(engine):
"""Applies all alembic migrations."""
from alembic.config import Config
from alembic import command
alembic_cfg = Config(ALEMBIC_CONFIG)
with engine.begin() as connection:
alembic_cfg.attributes['connection'] = connection
command.upgrade(alembic_cfg, "head")
@pytest.fixture(scope='session')
def engine(request):
"""Session-wide test database."""
# create a SQLite DB in memory
_engine = create_engine("sqlite://")
# setup models in DB
Base.metadata.create_all(_engine)
return _engine
@pytest.fixture(scope='function')
def session(engine, request):
"""Creates a new database session for a test."""
_session = create_db_session(engine)
connection = engine.connect()
transaction = connection.begin()
def fin():
transaction.rollback()
connection.close()
request.addfinalizer(fin)
return _session
| import os.path
import pytest
from alembic.command import upgrade
from alembic.config import Config
from app.database import db as _db
from app.database import create_engine, create_db_session
from app.models import Base
HERE = os.path.dirname(os.path.abspath(__file__))
ALEMBIC_CONFIG = os.path.join(HERE, "..", "..", "alembic.ini")
def apply_migrations(engine):
"""Applies all alembic migrations."""
from alembic.config import Config
from alembic import command
alembic_cfg = Config(ALEMBIC_CONFIG)
with engine.begin() as connection:
alembic_cfg.attributes['connection'] = connection
command.upgrade(alembic_cfg, "head")
@pytest.fixture(scope='session')
def db(request):
"""Session-wide test database."""
# create a SQLite DB in memory
_db.engine = create_engine("sqlite://")
# setup models in DB
Base.metadata.create_all(_db.engine)
return _db
@pytest.fixture(scope='function')
def session(db, request):
"""Creates a new database session for a test."""
_session = create_db_session(db.engine)
connection = db.engine.connect()
transaction = connection.begin()
def fin():
transaction.rollback()
connection.close()
request.addfinalizer(fin)
return _session
| Change engine fixture to use db obj | Change engine fixture to use db obj
| Python | mit | PsyBorgs/redditanalyser,PsyBorgs/redditanalyser | ---
+++
@@ -4,7 +4,8 @@
from alembic.command import upgrade
from alembic.config import Config
-from app.database import sa, create_engine, create_db_session
+from app.database import db as _db
+from app.database import create_engine, create_db_session
from app.models import Base
@@ -24,22 +25,22 @@
@pytest.fixture(scope='session')
-def engine(request):
+def db(request):
"""Session-wide test database."""
# create a SQLite DB in memory
- _engine = create_engine("sqlite://")
+ _db.engine = create_engine("sqlite://")
# setup models in DB
- Base.metadata.create_all(_engine)
+ Base.metadata.create_all(_db.engine)
- return _engine
+ return _db
@pytest.fixture(scope='function')
-def session(engine, request):
+def session(db, request):
"""Creates a new database session for a test."""
- _session = create_db_session(engine)
- connection = engine.connect()
+ _session = create_db_session(db.engine)
+ connection = db.engine.connect()
transaction = connection.begin()
def fin(): |
96b283adbb3156e77aee012a9fb8aba9d67343a9 | src/bitmessageqt/widgets.py | src/bitmessageqt/widgets.py | from PyQt4 import uic
import os.path
import sys
def resource_path(path):
try:
return os.path.join(sys._MEIPASS, path)
except:
return os.path.join(os.path.dirname(__file__), path)
def load(path, widget):
uic.loadUi(resource_path(path), widget)
| from PyQt4 import uic
import os.path
import sys
from shared import codePath
def resource_path(resFile):
baseDir = codePath()
for subDir in ["ui", "bitmessageqt"]:
if os.path.isdir(os.path.join(baseDir, subDir)) and os.path.isfile(os.path.join(baseDir, subDir, resFile)):
return os.path.join(baseDir, subDir, resFile)
def load(resFile, widget):
uic.loadUi(resource_path(resFile), widget)
| Change UI loading for frozen | Change UI loading for frozen
| Python | mit | mailchuck/PyBitmessage,mailchuck/PyBitmessage,mailchuck/PyBitmessage,mailchuck/PyBitmessage | ---
+++
@@ -1,14 +1,13 @@
from PyQt4 import uic
import os.path
import sys
+from shared import codePath
+def resource_path(resFile):
+ baseDir = codePath()
+ for subDir in ["ui", "bitmessageqt"]:
+ if os.path.isdir(os.path.join(baseDir, subDir)) and os.path.isfile(os.path.join(baseDir, subDir, resFile)):
+ return os.path.join(baseDir, subDir, resFile)
-def resource_path(path):
- try:
- return os.path.join(sys._MEIPASS, path)
- except:
- return os.path.join(os.path.dirname(__file__), path)
-
-
-def load(path, widget):
- uic.loadUi(resource_path(path), widget)
+def load(resFile, widget):
+ uic.loadUi(resource_path(resFile), widget) |
31b8ecda3d6b34428180b45e49489ebefc8a57e3 | tests/test_util.py | tests/test_util.py | from unittest import TestCase
from pytest import deprecated_call
from w3lib.util import str_to_unicode, to_native_str, unicode_to_str
class StrToUnicodeTestCase(TestCase):
def test_deprecation(self):
with deprecated_call():
str_to_unicode('')
class ToNativeStrTestCase(TestCase):
def test_deprecation(self):
with deprecated_call():
to_native_str('')
class UnicodeToStrTestCase(TestCase):
def test_deprecation(self):
with deprecated_call():
unicode_to_str('')
| from unittest import TestCase
from pytest import deprecated_call, raises
from w3lib.util import (
str_to_unicode,
to_bytes,
to_native_str,
to_unicode,
unicode_to_str,
)
class StrToUnicodeTestCase(TestCase):
def test_deprecation(self):
with deprecated_call():
str_to_unicode('')
class ToBytesTestCase(TestCase):
def test_type_error(self):
with raises(TypeError):
to_bytes(True)
class ToNativeStrTestCase(TestCase):
def test_deprecation(self):
with deprecated_call():
to_native_str('')
class ToUnicodeTestCase(TestCase):
def test_type_error(self):
with raises(TypeError):
to_unicode(True)
class UnicodeToStrTestCase(TestCase):
def test_deprecation(self):
with deprecated_call():
unicode_to_str('')
| Test the TypeError of to_bytes() and to_unicode() | Test the TypeError of to_bytes() and to_unicode()
| Python | bsd-3-clause | scrapy/w3lib | ---
+++
@@ -1,8 +1,14 @@
from unittest import TestCase
-from pytest import deprecated_call
+from pytest import deprecated_call, raises
-from w3lib.util import str_to_unicode, to_native_str, unicode_to_str
+from w3lib.util import (
+ str_to_unicode,
+ to_bytes,
+ to_native_str,
+ to_unicode,
+ unicode_to_str,
+)
class StrToUnicodeTestCase(TestCase):
@@ -12,6 +18,13 @@
str_to_unicode('')
+class ToBytesTestCase(TestCase):
+
+ def test_type_error(self):
+ with raises(TypeError):
+ to_bytes(True)
+
+
class ToNativeStrTestCase(TestCase):
def test_deprecation(self):
@@ -19,6 +32,13 @@
to_native_str('')
+class ToUnicodeTestCase(TestCase):
+
+ def test_type_error(self):
+ with raises(TypeError):
+ to_unicode(True)
+
+
class UnicodeToStrTestCase(TestCase):
def test_deprecation(self): |
85300e02c65fc6a611b9bdd0722c965d53be8d52 | tests/test_util.py | tests/test_util.py | # -*- coding: utf-8 -*-
"""Test out the utility functions."""
from malt import json
def test_json():
resp = json({'greeting': 'Hello World!'})
assert resp.headers['Content-Type'] == 'application/json; charset=utf-8'
assert list(resp) == [b'{"greeting":"Hello World!"}']
| # -*- coding: utf-8 -*-
"""Test out the utility functions."""
from malt import json
def test_json():
resp = json({'greeting': 'Hello World!'})
assert resp.headers['Content-Type'] == 'application/json; charset=utf-8'
assert list(resp) == [b'{"greeting":"Hello World!"}\n']
| Update json test to include newline | Update json test to include newline
| Python | mit | nickfrostatx/malt | ---
+++
@@ -8,4 +8,4 @@
resp = json({'greeting': 'Hello World!'})
assert resp.headers['Content-Type'] == 'application/json; charset=utf-8'
- assert list(resp) == [b'{"greeting":"Hello World!"}']
+ assert list(resp) == [b'{"greeting":"Hello World!"}\n'] |
7a33e2e94e46dc3465a088cf4755134a09f6627c | src/models/user.py | src/models/user.py | from flock import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
def __init__(self):
pass
| from flock import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
suggestions = db.relationship('Suggestion', secondary=suggestions,
backref=db.backref('users', lazy='dynamic'))
def __init__(self):
pass
| Add suggestions to User model | Add suggestions to User model | Python | agpl-3.0 | DavidJFelix/hatchit,DavidJFelix/hatchit,DavidJFelix/hatchit | ---
+++
@@ -2,6 +2,8 @@
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
+ suggestions = db.relationship('Suggestion', secondary=suggestions,
+ backref=db.backref('users', lazy='dynamic'))
def __init__(self):
pass |
501dd023eb1b8c868808fe5151dc865e5e84859c | stats/topics.py | stats/topics.py | import neo4j
class SubTopics(neo4j.Traversal):
"""Traverser that yields all subcategories of a category."""
types = [neo4j.Incoming.is_a]
returnable = neo4j.RETURN_ALL_BUT_START_NODE
order = neo4j.BREADTH_FIRST
stop = neo4j.STOP_AT_END_OF_GRAPH
class Topics(neo4j.Traversal):
types = [
neo4j.Outgoing.mentions_concept,
neo4j.Outgoing.mentions,
neo4j.Outgoing.is_a,
]
order = neo4j.BREADTH_FIRST
stop = neo4j.STOP_AT_END_OF_GRAPH
def isReturnable(self, position):
return not position.is_start and\
position.last_relationship.type == 'is_a'
def run(graph, index, node):
topics = {}
for topic in Topics(node):
topics[topic["name"]] = [sub["name"] for sub in SubTopics(topic)]
return topics
| import neo4j
class SubTopics(neo4j.Traversal):
"""Traverser that yields all subcategories of a category."""
types = [neo4j.Incoming.is_a]
returnable = neo4j.RETURN_ALL_BUT_START_NODE
order = neo4j.BREADTH_FIRST
stop = neo4j.STOP_AT_END_OF_GRAPH
class Topics(neo4j.Traversal):
types = [
neo4j.Outgoing.mentions_concept,
neo4j.Outgoing.mentions,
neo4j.Outgoing.is_a,
]
order = neo4j.BREADTH_FIRST
stop = neo4j.STOP_AT_END_OF_GRAPH
def isReturnable(self, position):
return not position.is_start and\
position.last_relationship.type == 'is_a'
def run(graph, index, node):
topics = {}
for topic in Topics(node):
# TODO need to give this '1' some meaning
topics[topic["name"]] = [{sub["name"]: 1} for sub in SubTopics(topic)]
return topics
| Return format to please the browser's graph. | Return format to please the browser's graph.
| Python | mit | peplin/trinity | ---
+++
@@ -24,5 +24,6 @@
def run(graph, index, node):
topics = {}
for topic in Topics(node):
- topics[topic["name"]] = [sub["name"] for sub in SubTopics(topic)]
+ # TODO need to give this '1' some meaning
+ topics[topic["name"]] = [{sub["name"]: 1} for sub in SubTopics(topic)]
return topics |
1666a48ccaef30d5d1dbceb3212160991beecbd5 | wluopensource/osl_comments/models.py | wluopensource/osl_comments/models.py | from django.contrib.comments.models import Comment
from django.contrib.comments.signals import comment_was_posted
from django.contrib.contenttypes.models import ContentType
from django.db import models
import markdown
class OslComment(Comment):
parent_comment = models.ForeignKey(Comment, blank=True, null=True, related_name='parent_comment')
inline_to_object = models.BooleanField()
edit_timestamp = models.DateTimeField()
transformed_comment = models.TextField(editable=False)
def save(self, force_insert=False, force_update=False):
md = markdown.Markdown(safe_mode="escape")
self.transformed_comment = md.convert(self.comment)
if not self.id:
# if new comment, not edited comment
self.edit_timestamp = self.submit_date
super(OslComment, self).save(force_insert, force_update)
def comment_success_flash_handler(sender, **kwargs):
if 'request' in kwargs:
kwargs['request'].flash['comment_response'] = 'Your comment has been added!'
comment_was_posted.connect(comment_success_flash_handler)
def comment_user_url_injection_handler(sender, **kwargs):
if 'request' in kwargs and kwargs['request'].user.is_authenticated() and \
'comment' in kwargs:
comment = kwargs['comment']
comment.url = comment.user.get_profile().url
comment.save()
comment_was_posted.connect(comment_user_url_injection_handler)
class CommentsPerPageForContentType(models.Model):
content_type = models.OneToOneField(ContentType)
number_per_page = models.IntegerField()
| from django.contrib.comments.models import Comment
from django.contrib.comments.signals import comment_was_posted
from django.contrib.contenttypes.models import ContentType
from django.db import models
import markdown
class OslComment(Comment):
parent_comment = models.ForeignKey(Comment, blank=True, null=True, related_name='parent_comment')
inline_to_object = models.BooleanField()
edit_timestamp = models.DateTimeField()
transformed_comment = models.TextField(editable=False)
def save(self, force_insert=False, force_update=False):
md = markdown.Markdown(safe_mode="escape")
self.transformed_comment = md.convert(self.comment)
if not self.id:
# if new comment, not edited comment
self.edit_timestamp = self.submit_date
if self.user:
self.url = self.user.get_profile().url
super(OslComment, self).save(force_insert, force_update)
def comment_success_flash_handler(sender, **kwargs):
if 'request' in kwargs:
kwargs['request'].flash['comment_response'] = 'Your comment has been added!'
comment_was_posted.connect(comment_success_flash_handler)
class CommentsPerPageForContentType(models.Model):
content_type = models.OneToOneField(ContentType)
number_per_page = models.IntegerField()
| Move applying auth user URLs to comments from signal to save method | Move applying auth user URLs to comments from signal to save method
| Python | bsd-3-clause | jeffcharles/Open-Source-at-Laurier-Website,jeffcharles/Open-Source-at-Laurier-Website,jeffcharles/Open-Source-at-Laurier-Website,jeffcharles/Open-Source-at-Laurier-Website | ---
+++
@@ -18,6 +18,9 @@
if not self.id:
# if new comment, not edited comment
self.edit_timestamp = self.submit_date
+
+ if self.user:
+ self.url = self.user.get_profile().url
super(OslComment, self).save(force_insert, force_update)
@@ -26,15 +29,6 @@
kwargs['request'].flash['comment_response'] = 'Your comment has been added!'
comment_was_posted.connect(comment_success_flash_handler)
-def comment_user_url_injection_handler(sender, **kwargs):
- if 'request' in kwargs and kwargs['request'].user.is_authenticated() and \
- 'comment' in kwargs:
-
- comment = kwargs['comment']
- comment.url = comment.user.get_profile().url
- comment.save()
-comment_was_posted.connect(comment_user_url_injection_handler)
-
class CommentsPerPageForContentType(models.Model):
content_type = models.OneToOneField(ContentType)
number_per_page = models.IntegerField() |
3ef0c6adcfa74877245f586618c4592b308976cd | openapi_core/wrappers/flask.py | openapi_core/wrappers/flask.py | """OpenAPI core wrappers module"""
from openapi_core.wrappers.base import BaseOpenAPIRequest, BaseOpenAPIResponse
class FlaskOpenAPIRequest(BaseOpenAPIRequest):
def __init__(self, request):
self.request = request
@property
def host_url(self):
return self.request.host_url
@property
def path(self):
return self.request.path
@property
def method(self):
return self.request.method.lower()
@property
def path_pattern(self):
if self.request.url_rule is None:
return self.path
return self.request.url_rule.rule
@property
def parameters(self):
return {
'path': self.request.view_args,
'query': self.request.args,
'header': self.request.headers,
'cookie': self.request.cookies,
}
@property
def body(self):
return self.request.data
@property
def mimetype(self):
return self.request.mimetype
class FlaskOpenAPIResponse(BaseOpenAPIResponse):
def __init__(self, response):
self.response = response
@property
def data(self):
return self.response.data
@property
def status_code(self):
return self.response._status_code
@property
def mimetype(self):
return self.response.mimetype
| """OpenAPI core wrappers module"""
import re
from openapi_core.wrappers.base import BaseOpenAPIRequest, BaseOpenAPIResponse
# http://flask.pocoo.org/docs/1.0/quickstart/#variable-rules
PATH_PARAMETER_PATTERN = r'<(?:(?:string|int|float|path|uuid):)?(\w+)>'
class FlaskOpenAPIRequest(BaseOpenAPIRequest):
path_regex = re.compile(PATH_PARAMETER_PATTERN)
def __init__(self, request):
self.request = request
@property
def host_url(self):
return self.request.host_url
@property
def path(self):
return self.request.path
@property
def method(self):
return self.request.method.lower()
@property
def path_pattern(self):
if self.request.url_rule is None:
return self.path
return self.path_regex.sub(r'{\1}', self.request.url_rule.rule)
@property
def parameters(self):
return {
'path': self.request.view_args,
'query': self.request.args,
'header': self.request.headers,
'cookie': self.request.cookies,
}
@property
def body(self):
return self.request.data
@property
def mimetype(self):
return self.request.mimetype
class FlaskOpenAPIResponse(BaseOpenAPIResponse):
def __init__(self, response):
self.response = response
@property
def data(self):
return self.response.data
@property
def status_code(self):
return self.response._status_code
@property
def mimetype(self):
return self.response.mimetype
| Convert Flask path variables to OpenAPI path parameters | Convert Flask path variables to OpenAPI path parameters
| Python | bsd-3-clause | p1c2u/openapi-core | ---
+++
@@ -1,8 +1,15 @@
"""OpenAPI core wrappers module"""
+import re
+
from openapi_core.wrappers.base import BaseOpenAPIRequest, BaseOpenAPIResponse
+
+# http://flask.pocoo.org/docs/1.0/quickstart/#variable-rules
+PATH_PARAMETER_PATTERN = r'<(?:(?:string|int|float|path|uuid):)?(\w+)>'
class FlaskOpenAPIRequest(BaseOpenAPIRequest):
+
+ path_regex = re.compile(PATH_PARAMETER_PATTERN)
def __init__(self, request):
self.request = request
@@ -24,7 +31,7 @@
if self.request.url_rule is None:
return self.path
- return self.request.url_rule.rule
+ return self.path_regex.sub(r'{\1}', self.request.url_rule.rule)
@property
def parameters(self): |
481f580b30efe0cf6f46081c098e2a174444a10b | base/components/accounts/views.py | base/components/accounts/views.py | from django import http
from django.conf import settings
from django.views.generic import RedirectView, View
from requests_oauthlib import OAuth2Session
CLIENT_ID = settings.HELLO_BASE_CLIENT_ID
CLIENT_SECRET = settings.HELLO_BASE_CLIENT_SECRET
AUTHORIZATION_URL = 'https://localhost:8443/authorize'
TOKEN_URL = 'https://localhost:8443/token'
class PreAuthorizationView(RedirectView):
def get(self, request, *args, **kwargs):
# Redirect the user to Hello! Base ID using the appropriate
# URL with a few key OAuth paramters built in.
base = OAuth2Session(CLIENT_ID)
authorization_url, state = base.authorization_url(AUTHORIZATION_URL)
print(state)
# State is used to prevent CSRF, so let's keep this for later.
request.session['oauth_state'] = state
print(request.session['oauth_state'])
request.session.modified = True
return http.HttpResponseRedirect(authorization_url)
class PostAuthorizationView(View):
def get(self, request, *args, **kwargs):
# We SHOULD be grabbing state from the session, maybe this'll
# work in production, but in development it's not. So... we're
# doing this. :(
base = OAuth2Session(CLIENT_ID, state=request.GET['state'])
token = base.fetch_token(TOKEN_URL, client_secret=CLIENT_SECRET, authorization_response=self.request.build_absolute_uri())
print(token)
| from django import http
from django.conf import settings
from django.views.generic import RedirectView, View
from requests_oauthlib import OAuth2Session
CLIENT_ID = settings.HELLO_BASE_CLIENT_ID
CLIENT_SECRET = settings.HELLO_BASE_CLIENT_SECRET
AUTHORIZATION_URL = 'https://localhost:8443/authorize/'
TOKEN_URL = 'https://localhost:8443/token/'
class PreAuthorizationView(RedirectView):
def get(self, request, *args, **kwargs):
# Redirect the user to Hello! Base ID using the appropriate
# URL with a few key OAuth paramters built in.
base = OAuth2Session(CLIENT_ID)
authorization_url, state = base.authorization_url(AUTHORIZATION_URL)
# State is used to prevent CSRF, so let's keep this for later.
request.session['oauth_state'] = state
request.session.modified = True
return http.HttpResponseRedirect(authorization_url)
class PostAuthorizationView(View):
def get(self, request, *args, **kwargs):
# We SHOULD be grabbing state from the session, maybe this'll
# work in production, but in development it's not. So... we're
# doing this. :(
base = OAuth2Session(CLIENT_ID, state=request.GET['state'])
token = base.fetch_token(
TOKEN_URL,
auth=(CLIENT_ID, CLIENT_SECRET),
authorization_response=request.build_absolute_uri()
)
| Add some slashes and other things. | Add some slashes and other things.
| Python | apache-2.0 | hello-base/web,hello-base/web,hello-base/web,hello-base/web | ---
+++
@@ -7,8 +7,8 @@
CLIENT_ID = settings.HELLO_BASE_CLIENT_ID
CLIENT_SECRET = settings.HELLO_BASE_CLIENT_SECRET
-AUTHORIZATION_URL = 'https://localhost:8443/authorize'
-TOKEN_URL = 'https://localhost:8443/token'
+AUTHORIZATION_URL = 'https://localhost:8443/authorize/'
+TOKEN_URL = 'https://localhost:8443/token/'
class PreAuthorizationView(RedirectView):
def get(self, request, *args, **kwargs):
@@ -17,13 +17,8 @@
base = OAuth2Session(CLIENT_ID)
authorization_url, state = base.authorization_url(AUTHORIZATION_URL)
- print(state)
-
# State is used to prevent CSRF, so let's keep this for later.
request.session['oauth_state'] = state
-
- print(request.session['oauth_state'])
-
request.session.modified = True
return http.HttpResponseRedirect(authorization_url)
@@ -34,8 +29,10 @@
# work in production, but in development it's not. So... we're
# doing this. :(
base = OAuth2Session(CLIENT_ID, state=request.GET['state'])
- token = base.fetch_token(TOKEN_URL, client_secret=CLIENT_SECRET, authorization_response=self.request.build_absolute_uri())
-
- print(token)
+ token = base.fetch_token(
+ TOKEN_URL,
+ auth=(CLIENT_ID, CLIENT_SECRET),
+ authorization_response=request.build_absolute_uri()
+ )
|
2d99984303da47b23b1a790b1f0c51f9aa28e415 | neuralmonkey/nn/mlp.py | neuralmonkey/nn/mlp.py | import tensorflow as tf
from neuralmonkey.nn.projection import linear, multilayer_projection
class MultilayerPerceptron(object):
""" General implementation of the multilayer perceptron. """
# pylint: disable=too-many-arguments
def __init__(self, mlp_input, layer_configuration, dropout_plc,
output_size, name: str = 'multilayer_perceptron',
activation_fn=tf.nn.relu) -> None:
with tf.variable_scope(name):
last_layer_size = mlp_input.get_shape()[1].value
last_layer = multilayer_projection(mlp_input,
layer_configuration,
activation=activation_fn,
dropout_plc=dropout_plc,
scope="deep_output_mlp")
self.n_params = 0
for size in layer_configuration:
self.n_params += last_layer_size * size
last_layer_size = size
with tf.variable_scope("classification_layer"):
self.n_params += last_layer_size * output_size
self.logits = linear(last_layer, output_size)
@property
def softmax(self):
with tf.variable_scope("classification_layer"):
return tf.nn.softmax(self.logits, name="decision_softmax")
@property
def classification(self):
with tf.variable_scope("classification_layer"):
return tf.argmax(self.logits, 1)
| import tensorflow as tf
from neuralmonkey.nn.projection import linear, multilayer_projection
class MultilayerPerceptron(object):
""" General implementation of the multilayer perceptron. """
# pylint: disable=too-many-arguments
def __init__(self, mlp_input, layer_configuration, dropout_plc,
output_size, name: str = 'multilayer_perceptron',
activation_fn=tf.nn.relu) -> None:
with tf.variable_scope(name):
last_layer_size = mlp_input.get_shape()[-1].value
last_layer = multilayer_projection(mlp_input,
layer_configuration,
activation=activation_fn,
dropout_plc=dropout_plc,
scope="deep_output_mlp")
self.n_params = 0
for size in layer_configuration:
self.n_params += last_layer_size * size
last_layer_size = size
with tf.variable_scope("classification_layer"):
self.n_params += last_layer_size * output_size
self.logits = linear(last_layer, output_size)
@property
def softmax(self):
with tf.variable_scope("classification_layer"):
return tf.nn.softmax(self.logits, name="decision_softmax")
@property
def classification(self):
with tf.variable_scope("classification_layer"):
return tf.argmax(self.logits, 1)
| Allow 3D input to MLP | Allow 3D input to MLP | Python | bsd-3-clause | bastings/neuralmonkey,juliakreutzer/bandit-neuralmonkey,bastings/neuralmonkey,ufal/neuralmonkey,ufal/neuralmonkey,ufal/neuralmonkey,juliakreutzer/bandit-neuralmonkey,bastings/neuralmonkey,ufal/neuralmonkey,bastings/neuralmonkey,bastings/neuralmonkey,juliakreutzer/bandit-neuralmonkey,juliakreutzer/bandit-neuralmonkey,ufal/neuralmonkey,juliakreutzer/bandit-neuralmonkey | ---
+++
@@ -11,7 +11,7 @@
activation_fn=tf.nn.relu) -> None:
with tf.variable_scope(name):
- last_layer_size = mlp_input.get_shape()[1].value
+ last_layer_size = mlp_input.get_shape()[-1].value
last_layer = multilayer_projection(mlp_input,
layer_configuration, |
3853e133f420320c8fa475cafd62356179f6ef5c | zerver/migrations/0167_custom_profile_fields_sort_order.py | zerver/migrations/0167_custom_profile_fields_sort_order.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-04-08 15:49
from __future__ import unicode_literals
from django.db import migrations, models
from django.db.models import F
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def migrate_set_order_value(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
CustomProfileField = apps.get_model('zerver', 'CustomProfileField')
CustomProfileField.objects.all().update(order=F('id'))
class Migration(migrations.Migration):
dependencies = [
('zerver', '0166_add_url_to_profile_field'),
]
operations = [
migrations.AddField(
model_name='customprofilefield',
name='order',
field=models.IntegerField(default=0),
),
migrations.RunPython(migrate_set_order_value),
]
| # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-04-08 15:49
from __future__ import unicode_literals
from django.db import migrations, models
from django.db.models import F
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def migrate_set_order_value(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
CustomProfileField = apps.get_model('zerver', 'CustomProfileField')
CustomProfileField.objects.all().update(order=F('id'))
class Migration(migrations.Migration):
dependencies = [
('zerver', '0166_add_url_to_profile_field'),
]
operations = [
migrations.AddField(
model_name='customprofilefield',
name='order',
field=models.IntegerField(default=0),
),
migrations.RunPython(migrate_set_order_value,
reverse_code=migrations.RunPython.noop),
]
| Add missing reverse_code for migration 0167. | migrations: Add missing reverse_code for migration 0167.
| Python | apache-2.0 | jackrzhang/zulip,zulip/zulip,synicalsyntax/zulip,kou/zulip,jackrzhang/zulip,showell/zulip,kou/zulip,dhcrzf/zulip,timabbott/zulip,tommyip/zulip,brainwane/zulip,dhcrzf/zulip,timabbott/zulip,andersk/zulip,brainwane/zulip,synicalsyntax/zulip,rishig/zulip,tommyip/zulip,rishig/zulip,punchagan/zulip,showell/zulip,jackrzhang/zulip,eeshangarg/zulip,punchagan/zulip,eeshangarg/zulip,andersk/zulip,timabbott/zulip,synicalsyntax/zulip,eeshangarg/zulip,punchagan/zulip,shubhamdhama/zulip,zulip/zulip,rht/zulip,andersk/zulip,dhcrzf/zulip,dhcrzf/zulip,hackerkid/zulip,jackrzhang/zulip,rishig/zulip,rishig/zulip,showell/zulip,punchagan/zulip,brainwane/zulip,hackerkid/zulip,hackerkid/zulip,jackrzhang/zulip,kou/zulip,timabbott/zulip,jackrzhang/zulip,hackerkid/zulip,rht/zulip,dhcrzf/zulip,kou/zulip,kou/zulip,dhcrzf/zulip,brainwane/zulip,hackerkid/zulip,zulip/zulip,zulip/zulip,punchagan/zulip,synicalsyntax/zulip,eeshangarg/zulip,tommyip/zulip,rht/zulip,synicalsyntax/zulip,brainwane/zulip,brainwane/zulip,shubhamdhama/zulip,eeshangarg/zulip,hackerkid/zulip,rht/zulip,kou/zulip,synicalsyntax/zulip,showell/zulip,zulip/zulip,andersk/zulip,shubhamdhama/zulip,jackrzhang/zulip,andersk/zulip,zulip/zulip,rishig/zulip,timabbott/zulip,zulip/zulip,tommyip/zulip,tommyip/zulip,shubhamdhama/zulip,eeshangarg/zulip,shubhamdhama/zulip,rishig/zulip,rht/zulip,punchagan/zulip,dhcrzf/zulip,brainwane/zulip,eeshangarg/zulip,timabbott/zulip,showell/zulip,showell/zulip,rht/zulip,showell/zulip,rht/zulip,andersk/zulip,tommyip/zulip,andersk/zulip,shubhamdhama/zulip,kou/zulip,shubhamdhama/zulip,synicalsyntax/zulip,punchagan/zulip,tommyip/zulip,rishig/zulip,timabbott/zulip,hackerkid/zulip | ---
+++
@@ -23,5 +23,6 @@
name='order',
field=models.IntegerField(default=0),
),
- migrations.RunPython(migrate_set_order_value),
+ migrations.RunPython(migrate_set_order_value,
+ reverse_code=migrations.RunPython.noop),
] |
8df7c4b2c008ce6c7735106c28bad1f7326f7012 | tests/smoketests/test_twisted.py | tests/smoketests/test_twisted.py | from twisted.internet import reactor, task
def test_deferred():
return task.deferLater(reactor, 0.05, lambda: None)
| from twisted.internet import reactor, task
from twisted.internet.defer import Deferred, succeed
from twisted.python.failure import Failure
def test_deferred():
return task.deferLater(reactor, 0.05, lambda: None)
def test_failure():
"""
Test that we can check for a failure in an asynchronously-called function.
"""
# Create one Deferred for the result of the test function.
deferredThatFails = task.deferLater(reactor, 0.05, functionThatFails)
# Create another Deferred, which will give the opposite result of
# deferredThatFails (that is, which will succeed if deferredThatFails fails
# and vice versa).
deferredThatSucceeds = Deferred()
# It's tempting to just write something like:
#
# deferredThatFails.addCallback(deferredThatSucceeds.errback)
# deferredThatFails.addErrback (deferredThatSucceeds.callback)
#
# Unfortunately, that doesn't work. The problem is that each callbacks or
# errbacks in a Deferred's callback/errback chain is passed the result of
# the previous callback/errback, and execution switches between those
# chains depending on whether that result is a failure or not. So if a
# callback returns a failure, we switch to the errbacks, and if an errback
# doesn't return a failure, we switch to the callbacks. If we use the
# above, then when deferredThatFails fails, the following will happen:
#
# - deferredThatFails' first (and only) errback is called: the function
# deferredThatSucceeds.callback. It is passed some sort of failure
# object.
# - This causes deferredThatSucceeds to fire. We start its callback
# chain, passing in that same failure object that was passed to
# deferredThatFails' errback chain.
# - Since this is a failure object, we switch to the errback chain of
# deferredThatSucceeds. I believe this happens before the first
# callback is executed, because that callback is probably something
# setup by pytest that would cause the test to pass. So it looks like
# what's happening is we're bypassing that function entirely, and going
# straight to the errback, which causes the test to fail.
#
# The solution is to instead create two functions of our own, which call
# deferredThatSucceeds.callback and .errback but change whether the
# argument is a failure so that it won't cause us to switch between the
# callback and errback chains.
def passTest(arg):
# arg is a failure object of some sort. Don't pass it to callback
# because otherwise it'll trigger the errback, which will cause the
# test to fail.
deferredThatSucceeds.callback(None)
def failTest(arg):
# Manufacture a failure to pass to errback because otherwise twisted
# will switch to the callback chain, causing the test to pass.
theFailure = Failure(AssertionError("functionThatFails didn't fail"))
deferredThatSucceeds.errback(theFailure)
deferredThatFails.addCallbacks(failTest, passTest)
return deferredThatSucceeds
def functionThatFails():
assert False
| Add an example Twisted test that expects failure. | Add an example Twisted test that expects failure.
| Python | mit | CheeseLord/warts,CheeseLord/warts | ---
+++
@@ -1,6 +1,71 @@
from twisted.internet import reactor, task
+from twisted.internet.defer import Deferred, succeed
+from twisted.python.failure import Failure
def test_deferred():
return task.deferLater(reactor, 0.05, lambda: None)
+
+def test_failure():
+ """
+ Test that we can check for a failure in an asynchronously-called function.
+ """
+
+ # Create one Deferred for the result of the test function.
+ deferredThatFails = task.deferLater(reactor, 0.05, functionThatFails)
+
+ # Create another Deferred, which will give the opposite result of
+ # deferredThatFails (that is, which will succeed if deferredThatFails fails
+ # and vice versa).
+ deferredThatSucceeds = Deferred()
+
+ # It's tempting to just write something like:
+ #
+ # deferredThatFails.addCallback(deferredThatSucceeds.errback)
+ # deferredThatFails.addErrback (deferredThatSucceeds.callback)
+ #
+ # Unfortunately, that doesn't work. The problem is that each callbacks or
+ # errbacks in a Deferred's callback/errback chain is passed the result of
+ # the previous callback/errback, and execution switches between those
+ # chains depending on whether that result is a failure or not. So if a
+ # callback returns a failure, we switch to the errbacks, and if an errback
+ # doesn't return a failure, we switch to the callbacks. If we use the
+ # above, then when deferredThatFails fails, the following will happen:
+ #
+ # - deferredThatFails' first (and only) errback is called: the function
+ # deferredThatSucceeds.callback. It is passed some sort of failure
+ # object.
+ # - This causes deferredThatSucceeds to fire. We start its callback
+ # chain, passing in that same failure object that was passed to
+ # deferredThatFails' errback chain.
+ # - Since this is a failure object, we switch to the errback chain of
+ # deferredThatSucceeds. I believe this happens before the first
+ # callback is executed, because that callback is probably something
+ # setup by pytest that would cause the test to pass. So it looks like
+ # what's happening is we're bypassing that function entirely, and going
+ # straight to the errback, which causes the test to fail.
+ #
+ # The solution is to instead create two functions of our own, which call
+ # deferredThatSucceeds.callback and .errback but change whether the
+ # argument is a failure so that it won't cause us to switch between the
+ # callback and errback chains.
+
+ def passTest(arg):
+ # arg is a failure object of some sort. Don't pass it to callback
+ # because otherwise it'll trigger the errback, which will cause the
+ # test to fail.
+ deferredThatSucceeds.callback(None)
+ def failTest(arg):
+ # Manufacture a failure to pass to errback because otherwise twisted
+ # will switch to the callback chain, causing the test to pass.
+ theFailure = Failure(AssertionError("functionThatFails didn't fail"))
+ deferredThatSucceeds.errback(theFailure)
+
+ deferredThatFails.addCallbacks(failTest, passTest)
+
+ return deferredThatSucceeds
+
+def functionThatFails():
+ assert False
+ |
4fb6cd2b73deb500d664c1a0d2d6c57b11626a7e | tests/pyutils/test_path.py | tests/pyutils/test_path.py | from graphql.pyutils import Path
def describe_path():
def add_path():
path = Path(None, 0, None)
assert path.prev is None
assert path.key == 0
prev, path = path, Path(path, 1, None)
assert path.prev is prev
assert path.key == 1
prev, path = path, Path(path, "two", None)
assert path.prev is prev
assert path.key == "two"
def add_key():
prev = Path(None, 0, None)
path = prev.add_key("one")
assert path.prev is prev
assert path.key == "one"
def as_list():
path = Path(None, 1, None)
assert path.as_list() == [1]
path = path.add_key("two")
assert path.as_list() == [1, "two"]
path = path.add_key(3)
assert path.as_list() == [1, "two", 3]
| from graphql.pyutils import Path
def describe_path():
def can_create_a_path():
first = Path(None, 1, "First")
assert first.prev is None
assert first.key == 1
assert first.typename == "First"
def can_add_a_new_key_to_an_existing_path():
first = Path(None, 1, "First")
second = first.add_key("two", "Second")
assert second.prev is first
assert second.key == "two"
assert second.typename == "Second"
def can_convert_a_path_to_a_list_of_its_keys():
root = Path(None, 0, "Root")
assert root.as_list() == [0]
first = root.add_key("one", "First")
assert first.as_list() == [0, "one"]
second = first.add_key(2, "Second")
assert second.as_list() == [0, "one", 2]
| Improve tests for Path methods | Improve tests for Path methods
Replicates graphql/graphql-js@f42cee922d13576b1452bb5bf6c7b155bf0e2ecd
| Python | mit | graphql-python/graphql-core | ---
+++
@@ -2,27 +2,23 @@
def describe_path():
- def add_path():
- path = Path(None, 0, None)
- assert path.prev is None
- assert path.key == 0
- prev, path = path, Path(path, 1, None)
- assert path.prev is prev
- assert path.key == 1
- prev, path = path, Path(path, "two", None)
- assert path.prev is prev
- assert path.key == "two"
+ def can_create_a_path():
+ first = Path(None, 1, "First")
+ assert first.prev is None
+ assert first.key == 1
+ assert first.typename == "First"
- def add_key():
- prev = Path(None, 0, None)
- path = prev.add_key("one")
- assert path.prev is prev
- assert path.key == "one"
+ def can_add_a_new_key_to_an_existing_path():
+ first = Path(None, 1, "First")
+ second = first.add_key("two", "Second")
+ assert second.prev is first
+ assert second.key == "two"
+ assert second.typename == "Second"
- def as_list():
- path = Path(None, 1, None)
- assert path.as_list() == [1]
- path = path.add_key("two")
- assert path.as_list() == [1, "two"]
- path = path.add_key(3)
- assert path.as_list() == [1, "two", 3]
+ def can_convert_a_path_to_a_list_of_its_keys():
+ root = Path(None, 0, "Root")
+ assert root.as_list() == [0]
+ first = root.add_key("one", "First")
+ assert first.as_list() == [0, "one"]
+ second = first.add_key(2, "Second")
+ assert second.as_list() == [0, "one", 2] |
f232481f966580bfd54ddd0eeb781badda3a9394 | swh/web/add_forge_now/apps.py | swh/web/add_forge_now/apps.py | # Copyright (C) 2022 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
from django.apps import AppConfig
class AddForgeNowConfig(AppConfig):
name = "add_forge_now"
| # Copyright (C) 2022 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
from django.apps import AppConfig
class AddForgeNowConfig(AppConfig):
name = "swh.web.add_forge_now"
label = "swh_web_add_forge_now"
| Rename django app and add missing app_label | add_forge_now: Rename django app and add missing app_label
This fixes errors when using django 3.2 and thus the packaging
on debian unstable
| Python | agpl-3.0 | SoftwareHeritage/swh-web-ui,SoftwareHeritage/swh-web-ui,SoftwareHeritage/swh-web-ui | ---
+++
@@ -7,4 +7,5 @@
class AddForgeNowConfig(AppConfig):
- name = "add_forge_now"
+ name = "swh.web.add_forge_now"
+ label = "swh_web_add_forge_now" |
21dea82cd8fc2b7d8889013dfd827f59cc8ceb58 | acmd/tools/assets.py | acmd/tools/assets.py | # coding: utf-8
import sys
import os.path
import optparse
import json
import requests
from acmd import tool, log
from acmd import OK, SERVER_ERROR, USER_ERROR
from acmd.props import parse_properties
parser = optparse.OptionParser("acmd assets <import|touch> [options] <file>")
parser.add_option("-r", "--raw",
action="store_const", const=True, dest="raw",
help="output raw response data")
@tool('assets')
class AssetsTool(object):
""" Manage AEM DAM assets """
@staticmethod
def execute(server, argv):
options, args = parser.parse_args(argv)
return OK
def import_file(server, options, filename):
pass
| # coding: utf-8
import optparse
import os
import requests
from acmd import OK, SERVER_ERROR
from acmd import tool, error, log
from acmd.tools.tool_utils import get_argument, get_command
parser = optparse.OptionParser("acmd assets <import|touch> [options] <file>")
parser.add_option("-r", "--raw",
action="store_const", const=True, dest="raw",
help="output raw response data")
@tool('assets')
class AssetsTool(object):
""" Manage AEM DAM assets """
@staticmethod
def execute(server, argv):
options, args = parser.parse_args(argv)
action = get_command(args)
actionarg = get_argument(args)
if action == 'import':
return import_path(server, options, actionarg)
return OK
def import_path(server, options, path):
if os.path.isdir(path):
return import_directory(server, options, path)
else:
return import_file(server, options, path)
def import_directory(server, options, path):
log("Importing file {}".format(path))
for subdir, dirs, files in os.walk(path):
# _create_dir(server, subdir)
for filename in files:
import_file(server, options, os.path.join(subdir, filename))
def import_file(server, options, filename):
print filename
# curl -s -u admin:admin -X POST -F "jcr:primaryType=sling:OrderedFolder" $HOST$dampath > /dev/null
def _create_dir(server, path):
form_data = {'jcr:primaryType': 'sling:OrderedFolder'}
url = server.url(path)
resp = requests.post(url, auth=server.auth, data=form_data)
if resp.status_code != 201:
error("Failed to create directory {}".format(url))
return SERVER_ERROR
return OK
| Support iterate of files in dir | Support iterate of files in dir
| Python | mit | darashenka/aem-cmd,darashenka/aem-cmd,darashenka/aem-cmd | ---
+++
@@ -1,14 +1,12 @@
# coding: utf-8
-import sys
-import os.path
import optparse
-import json
+import os
import requests
-from acmd import tool, log
-from acmd import OK, SERVER_ERROR, USER_ERROR
-from acmd.props import parse_properties
+from acmd import OK, SERVER_ERROR
+from acmd import tool, error, log
+from acmd.tools.tool_utils import get_argument, get_command
parser = optparse.OptionParser("acmd assets <import|touch> [options] <file>")
parser.add_option("-r", "--raw",
@@ -23,9 +21,39 @@
@staticmethod
def execute(server, argv):
options, args = parser.parse_args(argv)
+ action = get_command(args)
+ actionarg = get_argument(args)
+ if action == 'import':
+ return import_path(server, options, actionarg)
return OK
+def import_path(server, options, path):
+ if os.path.isdir(path):
+ return import_directory(server, options, path)
+ else:
+ return import_file(server, options, path)
+
+
+def import_directory(server, options, path):
+ log("Importing file {}".format(path))
+ for subdir, dirs, files in os.walk(path):
+ # _create_dir(server, subdir)
+ for filename in files:
+ import_file(server, options, os.path.join(subdir, filename))
+
+
def import_file(server, options, filename):
- pass
+ print filename
+
+
+# curl -s -u admin:admin -X POST -F "jcr:primaryType=sling:OrderedFolder" $HOST$dampath > /dev/null
+def _create_dir(server, path):
+ form_data = {'jcr:primaryType': 'sling:OrderedFolder'}
+ url = server.url(path)
+ resp = requests.post(url, auth=server.auth, data=form_data)
+ if resp.status_code != 201:
+ error("Failed to create directory {}".format(url))
+ return SERVER_ERROR
+ return OK |
df8f5e0a6be5f3de31d61810b1624175b2d105ec | auth0/v2/device_credentials.py | auth0/v2/device_credentials.py | from .rest import RestClient
class DeviceCredentials(object):
def __init__(self, domain, jwt_token):
url = 'https://%s/api/v2/device-credentials' % domain
self.client = RestClient(endpoint=url, jwt=jwt_token)
def get(self, user_id=None, client_id=None, type=None,
fields=[], include_fields=True):
params = {
'fields': ','.join(fields) or None,
'include_fields': str(include_fields).lower(),
'user_id': user_id,
'client_id': client_id,
'type': type,
}
return self.client.get(params=params)
| from .rest import RestClient
class DeviceCredentials(object):
def __init__(self, domain, jwt_token):
url = 'https://%s/api/v2/device-credentials' % domain
self.client = RestClient(endpoint=url, jwt=jwt_token)
def get(self, user_id=None, client_id=None, type=None,
fields=[], include_fields=True):
params = {
'fields': ','.join(fields) or None,
'include_fields': str(include_fields).lower(),
'user_id': user_id,
'client_id': client_id,
'type': type,
}
return self.client.get(params=params)
def create(self, body):
return self.client.post(data=body)
def delete(self, id):
return self.client.delete(id=id)
| Implement create and delete methods for DeviceCredentials | Implement create and delete methods for DeviceCredentials
| Python | mit | auth0/auth0-python,auth0/auth0-python | ---
+++
@@ -18,3 +18,9 @@
'type': type,
}
return self.client.get(params=params)
+
+ def create(self, body):
+ return self.client.post(data=body)
+
+ def delete(self, id):
+ return self.client.delete(id=id) |
967795c9005b7ccdacdb17c461a86cda68409785 | fileutil.py | fileutil.py | import os, shutil
def atomic_write_file(path, data):
temp = os.path.join(os.path.dirname(path), ".tmpsave." + os.path.basename(path))
try:
with open(temp, "wb") as out:
try:
shutil.copystat(path, temp)
except OSError:
pass
out.write(data)
except IOError:
try:
os.remove(temp)
except OSError:
pass
raise
else:
os.rename(temp, path)
| import sys, os, shutil
if sys.platform == "win32":
# os.rename is broken on windows
import win32file
def rename(old, new):
win32file.MoveFileEx(old, new, win32file.MOVEFILE_REPLACE_EXISTING)
else:
rename = os.rename
def atomic_write_file(path, data):
temp = os.path.join(os.path.dirname(path), ".tmpsave." + os.path.basename(path))
try:
with open(temp, "wb") as out:
try:
shutil.copystat(path, temp)
except OSError:
pass
out.write(data)
except IOError:
try:
os.remove(temp)
except OSError:
pass
raise
else:
rename(temp, path)
| Use MoveFileEx on Windows because os.rename does not replace existing files. | Use MoveFileEx on Windows because os.rename does not replace existing files.
| Python | mit | shaurz/devo | ---
+++
@@ -1,4 +1,12 @@
-import os, shutil
+import sys, os, shutil
+
+if sys.platform == "win32":
+ # os.rename is broken on windows
+ import win32file
+ def rename(old, new):
+ win32file.MoveFileEx(old, new, win32file.MOVEFILE_REPLACE_EXISTING)
+else:
+ rename = os.rename
def atomic_write_file(path, data):
temp = os.path.join(os.path.dirname(path), ".tmpsave." + os.path.basename(path))
@@ -16,4 +24,4 @@
pass
raise
else:
- os.rename(temp, path)
+ rename(temp, path) |
a9f5603b9134a6daa757fd85c1600ac3aa67f5df | time_test.py | time_test.py | import timeit
setup="""
from _ppeg import Pattern
text = open('kjv10.txt').read()
pat = Pattern()
pat.setdummy()
pat.dump()
"""
t = timeit.Timer(stmt='print pat.match(text)', setup=setup)
N=5
print "Time taken: %.2f sec" % (t.timeit(N)/float(N))
| import timeit
setup="""
from _ppeg import Pattern
text = open('kjv10.txt').read()
pat = Pattern.Dummy()
pat.dump()
"""
t = timeit.Timer(stmt='print pat(text)', setup=setup)
N=5
print "Time taken: %.2f sec" % (t.timeit(N)/float(N))
| Update timing test to new pattern API | Update timing test to new pattern API
| Python | mit | moreati/ppeg,moreati/ppeg | ---
+++
@@ -4,12 +4,11 @@
text = open('kjv10.txt').read()
-pat = Pattern()
-pat.setdummy()
+pat = Pattern.Dummy()
pat.dump()
"""
-t = timeit.Timer(stmt='print pat.match(text)', setup=setup)
+t = timeit.Timer(stmt='print pat(text)', setup=setup)
N=5
print "Time taken: %.2f sec" % (t.timeit(N)/float(N))
|
16c8880c2b3d5f68ee25093057f949ed0f2e7a5c | toast/app.py | toast/app.py | from flask import Flask, jsonify
from flask import render_template
import urllib2
import json
app = Flask(__name__)
#@app.route("/")
#def hello():
# return render_template('index.html')
#
#@app.route("/dream/<dream>")
#def dream(dream):
# return render_template('dream.html', my_dream=dream)
#
#
@app.route("/dream/define/<term>")
def get_urbandictionary(term):
response = urllib2.urlopen('http://api.urbandictionary.com/v0/define?term=' + term)
html = response.read()
j = json.loads(html)
return j['list'][0]['definition']
@app.route("/dreams/top")
def get_json():
return jsonify(top_dreams=
[{dream:d1,count:100},
{dream:d2,count:80},
{dream:d3,count:60},
{dream:d4,count:40},
{dream:d5,count:20}
]
)
@app.route("/dreams/recent")
def get_json():
return jsonify(recent_dreams=
[{dream:d1,count:100},
{dream:d2,count:80},
{dream:d3,count:60},
{dream:d4,count:40},
{dream:d5,count:20}
]
)
if __name__ == "__main__":
# Development only! Reloads server on file change.
app.debug = True
app.run()
| from flask import Flask, jsonify
from flask import render_template
import urllib2
import json
app = Flask(__name__)
FAKE_DATA = [{'name':'toast',
'count':100},
{'name':'pizza',
'count':80},
{'name':'bread',
'count':60},
{'name':'butter',
'count':40},
{'name':'beer',
'count':20}]
@app.route("/dream/define/<term>")
def get_urbandictionary(term):
response = urllib2.urlopen('http://api.urbandictionary.com/v0/define?term=' + term)
html = response.read()
j = json.loads(html)
return j['list'][0]['definition']
@app.route("/dreams/top")
def top_dreams():
return jsonify(data=FAKE_DATA)
@app.route("/dreams/recent")
def recent_dreams():
return jsonify(data=FAKE_DATA)
if __name__ == "__main__":
# Development only! Reloads server on file change.
app.debug = True
app.run()
| Clean up endpoint controllers and add test data. | Clean up endpoint controllers and add test data.
| Python | apache-2.0 | whiskeylover/idreamoftoast,whiskeylover/idreamoftoast,whiskeylover/idreamoftoast | ---
+++
@@ -5,46 +5,32 @@
app = Flask(__name__)
-#@app.route("/")
-#def hello():
-# return render_template('index.html')
-#
-#@app.route("/dream/<dream>")
-#def dream(dream):
-# return render_template('dream.html', my_dream=dream)
-#
-#
+FAKE_DATA = [{'name':'toast',
+ 'count':100},
+ {'name':'pizza',
+ 'count':80},
+ {'name':'bread',
+ 'count':60},
+ {'name':'butter',
+ 'count':40},
+ {'name':'beer',
+ 'count':20}]
@app.route("/dream/define/<term>")
def get_urbandictionary(term):
response = urllib2.urlopen('http://api.urbandictionary.com/v0/define?term=' + term)
html = response.read()
-
+
j = json.loads(html)
return j['list'][0]['definition']
@app.route("/dreams/top")
-def get_json():
- return jsonify(top_dreams=
- [{dream:d1,count:100},
- {dream:d2,count:80},
- {dream:d3,count:60},
- {dream:d4,count:40},
- {dream:d5,count:20}
- ]
- )
+def top_dreams():
+ return jsonify(data=FAKE_DATA)
@app.route("/dreams/recent")
-def get_json():
- return jsonify(recent_dreams=
- [{dream:d1,count:100},
- {dream:d2,count:80},
- {dream:d3,count:60},
- {dream:d4,count:40},
- {dream:d5,count:20}
- ]
- )
-
+def recent_dreams():
+ return jsonify(data=FAKE_DATA)
if __name__ == "__main__":
# Development only! Reloads server on file change. |
ada71c4aa8e96e71b90c205fbfec9079ffa29142 | test/features/steps/system.py | test/features/steps/system.py | from __future__ import print_function
import sys
import subprocess
import os
@given('a system executable {exe}')
def step_impl(context, exe):
binary = None
if sys.platform.startswith('win'):
try:
binary = subprocess.check_output(["where", exe]).decode('utf8').strip()
except:
pass
else:
try:
binary = subprocess.check_output(["which", exe]).decode('utf8').strip()
except:
pass
if binary is None:
print(
"Skipping scenario", context.scenario,
"(executable %s not found)" % exe,
file = sys.stderr
)
context.scenario.skip("The executable '%s' is not present" % exe)
else:
print(
"Found executable '%s' at '%s'" % (exe, binary),
file = sys.stderr
)
@then('{exe} is a static executable')
def step_impl(ctx, exe):
if sys.platform.lower().startswith('darwin'):
context.scenario.skip("Static runtime linking is not supported on OS X")
if sys.platform.startswith('win'):
lines = subprocess.check_output(["dumpbin.exe", exe]).decode('utf8').split('\r\n')
for line in lines:
if 'msvcrt' in line.lower():
assert False, 'Found MSVCRT: %s' % line
else:
out = subprocess.check_output(["file", exe]).decode('utf8')
assert 'statically linked' in out, "Not a static executable: %s" % out
| from __future__ import print_function
import sys
import subprocess
import os
@given('a system executable {exe}')
def step_impl(context, exe):
binary = None
if sys.platform.startswith('win'):
try:
binary = subprocess.check_output(["where", exe]).decode('utf8').strip()
except:
pass
else:
try:
binary = subprocess.check_output(["which", exe]).decode('utf8').strip()
except:
pass
if binary is None:
print(
"Skipping scenario", context.scenario,
"(executable %s not found)" % exe,
file = sys.stderr
)
context.scenario.skip("The executable '%s' is not present" % exe)
else:
print(
"Found executable '%s' at '%s'" % (exe, binary),
file = sys.stderr
)
@then('{exe} is a static executable')
def step_impl(ctx, exe):
if sys.platform.lower().startswith('darwin'):
context.scenario.skip("Static runtime linking is not supported on OS X")
if sys.platform.startswith('win'):
lines = subprocess.check_output(["dumpbin.exe", "/DEPENDENTS", exe]).decode('utf8').split('\r\n')
for line in lines:
if 'msvcrt' in line.lower():
assert False, 'Found MSVCRT: %s' % line
else:
out = subprocess.check_output(["file", exe]).decode('utf8')
assert 'statically linked' in out, "Not a static executable: %s" % out
| Use the correct option when dumping dependent libraries. | test: Use the correct option when dumping dependent libraries.
| Python | bsd-3-clause | hotgloupi/configure,hotgloupi/configure,hotgloupi/configure,hotgloupi/configure,hotgloupi/configure | ---
+++
@@ -36,7 +36,7 @@
context.scenario.skip("Static runtime linking is not supported on OS X")
if sys.platform.startswith('win'):
- lines = subprocess.check_output(["dumpbin.exe", exe]).decode('utf8').split('\r\n')
+ lines = subprocess.check_output(["dumpbin.exe", "/DEPENDENTS", exe]).decode('utf8').split('\r\n')
for line in lines:
if 'msvcrt' in line.lower():
assert False, 'Found MSVCRT: %s' % line |
acfa9a206e803ad41565f6f3a678d9e1130948d8 | test/runmain.py | test/runmain.py | #!usr/bin/env python
import ui_logic_mainwindow as uv
from PyQt4 import QtGui
import sys
def main():
app = QtGui.QApplication(sys.argv)
ex = uv.UiMainWindow()
ex.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main()
| #!/usr/bin/env python
from test import ui_logic_mainwindow as uv
from PyQt4 import QtGui
import sys
def main():
app = QtGui.QApplication(sys.argv)
ex = uv.UiMainWindow()
ex.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main()
| Update run mainfile to reflect import paths | Update run mainfile to reflect import paths
| Python | mit | bibsian/database-development | ---
+++
@@ -1,5 +1,5 @@
-#!usr/bin/env python
-import ui_logic_mainwindow as uv
+#!/usr/bin/env python
+from test import ui_logic_mainwindow as uv
from PyQt4 import QtGui
import sys
|
64f3e09eb74158233af37513d0cedf75b8d62aae | packagename/conftest.py | packagename/conftest.py | # this contains imports plugins that configure py.test for astropy tests.
# by importing them here in conftest.py they are discoverable by py.test
# no matter how it is invoked within the source tree.
from astropy.tests.pytest_plugins import *
## Uncomment the following line to treat all DeprecationWarnings as
## exceptions
# enable_deprecations_as_exceptions()
| # this contains imports plugins that configure py.test for astropy tests.
# by importing them here in conftest.py they are discoverable by py.test
# no matter how it is invoked within the source tree.
from astropy.tests.pytest_plugins import *
## Uncomment the following line to treat all DeprecationWarnings as
## exceptions
# enable_deprecations_as_exceptions()
## Uncomment and customize the following lines to add/remove entries
## from the list of packages for which version numbers are displayed
## when running the tests
# PYTEST_HEADER_MODULES['scikit-image'] = 'skimage'
# del PYTEST_HEADER_MODULES['h5py']
| Add note about adding/removing packages to/from pytest header | Add note about adding/removing packages to/from pytest header | Python | bsd-3-clause | alexrudy/Zeeko,alexrudy/Zeeko | ---
+++
@@ -7,3 +7,9 @@
## Uncomment the following line to treat all DeprecationWarnings as
## exceptions
# enable_deprecations_as_exceptions()
+
+## Uncomment and customize the following lines to add/remove entries
+## from the list of packages for which version numbers are displayed
+## when running the tests
+# PYTEST_HEADER_MODULES['scikit-image'] = 'skimage'
+# del PYTEST_HEADER_MODULES['h5py'] |
19e0b3f089c684fe4aaaed8a06b4baad31de2f41 | currencies/models.py | currencies/models.py | from django.db import models
from django.utils.translation import gettext_lazy as _
class Currency(models.Model):
code = models.CharField(_('code'), max_length=3)
name = models.CharField(_('name'), max_length=35)
symbol = models.CharField(_('symbol'), max_length=4, blank=True)
factor = models.DecimalField(_('factor'), max_digits=10, decimal_places=4,
help_text=_('Specifies the difference of the currency to default one.'))
is_active = models.BooleanField(_('active'), default=True,
help_text=_('The currency will be available.'))
is_base = models.BooleanField(_('base'), default=False,
help_text=_('Make this the base currency against which rates are calculated.'))
is_default = models.BooleanField(_('default'), default=False,
help_text=_('Make this the default user currency.'))
class Meta:
verbose_name = _('currency')
verbose_name_plural = _('currencies')
def __unicode__(self):
return self.code
def save(self, **kwargs):
# Make sure the base and default currencies are unique
if self.is_base:
Currency.objects.filter(is_base=True).update(is_base=False)
if self.is_default:
Currency.objects.filter(is_default=True).update(is_default=False)
super(Currency, self).save(**kwargs)
| from django.db import models
from django.utils.translation import gettext_lazy as _
class Currency(models.Model):
code = models.CharField(_('code'), max_length=3)
name = models.CharField(_('name'), max_length=35)
symbol = models.CharField(_('symbol'), max_length=4, blank=True)
factor = models.DecimalField(_('factor'), max_digits=10, decimal_places=4,
help_text=_('Specifies the difference of the currency to default one.'))
is_active = models.BooleanField(_('active'), default=True,
help_text=_('The currency will be available.'))
is_base = models.BooleanField(_('base'), default=False,
help_text=_('Make this the base currency against which rates are calculated.'))
is_default = models.BooleanField(_('default'), default=False,
help_text=_('Make this the default user currency.'))
class Meta:
ordering = ('name', )
verbose_name = _('currency')
verbose_name_plural = _('currencies')
def __unicode__(self):
return self.code
def save(self, **kwargs):
# Make sure the base and default currencies are unique
if self.is_base:
Currency.objects.filter(is_base=True).update(is_base=False)
if self.is_default:
Currency.objects.filter(is_default=True).update(is_default=False)
super(Currency, self).save(**kwargs)
| Order currencies by name by default | Order currencies by name by default
| Python | bsd-3-clause | marcosalcazar/django-currencies,jmp0xf/django-currencies,ydaniv/django-currencies,ydaniv/django-currencies,barseghyanartur/django-currencies,panosl/django-currencies,pathakamit88/django-currencies,bashu/django-simple-currencies,mysociety/django-currencies,pathakamit88/django-currencies,racitup/django-currencies,panosl/django-currencies,racitup/django-currencies,marcosalcazar/django-currencies,mysociety/django-currencies,bashu/django-simple-currencies | ---
+++
@@ -16,6 +16,7 @@
help_text=_('Make this the default user currency.'))
class Meta:
+ ordering = ('name', )
verbose_name = _('currency')
verbose_name_plural = _('currencies')
|
aa0065ef79fd3763c201cdd9b92b64f8f48ff732 | test/test_basic.py | test/test_basic.py | #!/usr/bin/env python
from gaidaros.gaidaros import *
server = Gaidaros()
#TODO: run a client to do a request against a one-time handle action
#server.handle()
| #!/usr/bin/env python
from gaidaros import *
server = Gaidaros()
#TODO: run a client to do a request against a one-time handle action
#server.handle()
| Make the actual change to testfile mentioned in last commit(..) | Make the actual change to testfile mentioned in last commit(..)
| Python | mit | rowanthorpe/gaidaros | ---
+++
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-from gaidaros.gaidaros import *
+from gaidaros import *
server = Gaidaros()
#TODO: run a client to do a request against a one-time handle action
#server.handle() |
5fe3187ba546bea4d948914b2eb5cf9953a5bee6 | tests/clip_test.py | tests/clip_test.py | import PyDSTool as dst
from PyDSTool.Toolbox.phaseplane import Point2D
from matplotlib import pyplot as plt
from fovea.graphics import *
# ISSUE: fix to use new argument format for function (no global)
plotter.domain={'x': [-1,1], 'y': [-2,2]}
plotter.coords=('x','y')
a, b = force_line_to_extent(Point2D((0.25,0)), Point2D((0.5,0.1)))
plt.plot(np.array((a, b)).T[0], np.array((a, b)).T[1], 'g')
cc, dd = Point2D((3,-2.5)), Point2D((-5.1,1.8))
plt.plot(np.array((cc, dd)).T[0], np.array((cc, dd)).T[1], 'b:')
c, d = force_line_to_extent(Point2D((3,-2.5)), Point2D((-5.1,1.8)))
plt.plot(np.array((c, d)).T[0], np.array((c, d)).T[1], 'r')
plt.show()
| import PyDSTool as dst
from PyDSTool.Toolbox.phaseplane import Point2D
from matplotlib import pyplot as plt
import numpy as np
from fovea.graphics import *
plotter.domain={'x': [-1,1], 'y': [-2,2]}
plotter.coords=('x','y')
a, b = force_line_to_extent(Point2D((0.25,0)), Point2D((0.5,0.1)),
plotter.domain, plotter.coords)
plt.plot(np.array((a, b)).T[0], np.array((a, b)).T[1], 'g')
cc, dd = Point2D((3,-2.5)), Point2D((-5.1,1.8))
plt.plot(np.array((cc, dd)).T[0], np.array((cc, dd)).T[1], 'b:')
c, d = force_line_to_extent(Point2D((3,-2.5)), Point2D((-5.1,1.8)),
plotter.domain, plotter.coords)
plt.plot(np.array((c, d)).T[0], np.array((c, d)).T[1], 'r')
e, f = force_line_to_extent(np.array((0.25,0)), np.array((1.5,0.1)),
plotter.domain, plotter.coords)
plt.plot(np.array((e, f)).T[0], np.array((e, f)).T[1], 'g')
plt.show()
| Fix new syntax and add example using numpy arrays | Fix new syntax and add example using numpy arrays
| Python | bsd-3-clause | robclewley/fovea,akuefler/fovea | ---
+++
@@ -1,19 +1,26 @@
import PyDSTool as dst
from PyDSTool.Toolbox.phaseplane import Point2D
from matplotlib import pyplot as plt
+import numpy as np
from fovea.graphics import *
-# ISSUE: fix to use new argument format for function (no global)
plotter.domain={'x': [-1,1], 'y': [-2,2]}
plotter.coords=('x','y')
-a, b = force_line_to_extent(Point2D((0.25,0)), Point2D((0.5,0.1)))
+a, b = force_line_to_extent(Point2D((0.25,0)), Point2D((0.5,0.1)),
+ plotter.domain, plotter.coords)
plt.plot(np.array((a, b)).T[0], np.array((a, b)).T[1], 'g')
cc, dd = Point2D((3,-2.5)), Point2D((-5.1,1.8))
plt.plot(np.array((cc, dd)).T[0], np.array((cc, dd)).T[1], 'b:')
-c, d = force_line_to_extent(Point2D((3,-2.5)), Point2D((-5.1,1.8)))
+c, d = force_line_to_extent(Point2D((3,-2.5)), Point2D((-5.1,1.8)),
+ plotter.domain, plotter.coords)
plt.plot(np.array((c, d)).T[0], np.array((c, d)).T[1], 'r')
+e, f = force_line_to_extent(np.array((0.25,0)), np.array((1.5,0.1)),
+ plotter.domain, plotter.coords)
+plt.plot(np.array((e, f)).T[0], np.array((e, f)).T[1], 'g')
+
+
plt.show() |
d68a7f9c42220d6497fe87cc8426ce8ff8098c30 | wcontrol/src/results.py | wcontrol/src/results.py | from wcontrol.conf.config import BMI, BFP, MUSCLE
class results(object):
def __init__(self, control, gender):
self.bmi = self.get_bmi(control.bmi)
self.fat = self.get_fat(control.fat, gender)
self.muscle = self.get_muscle(control.muscle, gender)
def get_bmi(self, bmi):
for limit, msg in BMI:
if bmi <= limit:
return msg
def get_fat(self, fat, gender):
for limit_w, limit_m, msg in BFP:
if gender == 'Female' and fat <= limit_w:
return msg
if gender == 'Male' and fat <= limit_m:
return msg
def get_muscle(self, muscle, gender):
for limit_w, limit_m, msg in MUSCLE:
if gender == 'Female' and muscle <= limit_w:
return msg
if gender == 'Male' and muscle <= limit_m:
return msg
| from wcontrol.conf.config import BMI, BFP, MUSCLE, VISCERAL
class results(object):
def __init__(self, control, gender):
self.bmi = self.get_bmi(control.bmi)
self.fat = self.get_fat(control.fat, gender)
self.muscle = self.get_muscle(control.muscle, gender)
self.visceral = self.get_visceral(control.visceral)
def get_bmi(self, bmi):
for limit, msg in BMI:
if bmi <= limit:
return msg
def get_fat(self, fat, gender):
for limit_w, limit_m, msg in BFP:
if gender == 'Female' and fat <= limit_w:
return msg
if gender == 'Male' and fat <= limit_m:
return msg
def get_muscle(self, muscle, gender):
for limit_w, limit_m, msg in MUSCLE:
if gender == 'Female' and muscle <= limit_w:
return msg
if gender == 'Male' and muscle <= limit_m:
return msg
def get_visceral(self, visceral):
for limit, msg in VISCERAL:
if visceral <= limit:
return msg
| Add function to get the visceral fat result | Add function to get the visceral fat result
| Python | mit | pahumadad/weight-control,pahumadad/weight-control,pahumadad/weight-control,pahumadad/weight-control | ---
+++
@@ -1,4 +1,4 @@
-from wcontrol.conf.config import BMI, BFP, MUSCLE
+from wcontrol.conf.config import BMI, BFP, MUSCLE, VISCERAL
class results(object):
@@ -6,6 +6,7 @@
self.bmi = self.get_bmi(control.bmi)
self.fat = self.get_fat(control.fat, gender)
self.muscle = self.get_muscle(control.muscle, gender)
+ self.visceral = self.get_visceral(control.visceral)
def get_bmi(self, bmi):
for limit, msg in BMI:
@@ -25,3 +26,8 @@
return msg
if gender == 'Male' and muscle <= limit_m:
return msg
+
+ def get_visceral(self, visceral):
+ for limit, msg in VISCERAL:
+ if visceral <= limit:
+ return msg |
2e6ff15fed8eda23b141a81264929bfb83d4fcb8 | avena/tests/test-flip.py | avena/tests/test-flip.py | #!/usr/bin/env python
from numpy import all, array
from avena import flip
def test_flip_vertical():
x = array([[1], [2], [3]])
assert all(flip._flip_vertical(flip._flip_vertical(x)) == x)
y = array([[3], [2], [1]])
assert all(flip._flip_vertical(x) == y)
def test_flip_horizontal():
x = array([[1, 2, 3]])
assert all(flip._flip_horizontal(flip._flip_horizontal(x)) == x)
y = array([[3, 2, 1]])
assert all(flip._flip_horizontal(x) == y)
if __name__ == '__main__':
pass
| #!/usr/bin/env python
from numpy import all, array
from .. import flip
def test_flip_vertical():
x = array([[1], [2], [3]])
assert all(flip._flip_vertical(flip._flip_vertical(x)) == x)
y = array([[3], [2], [1]])
assert all(flip._flip_vertical(x) == y)
def test_flip_horizontal():
x = array([[1, 2, 3]])
assert all(flip._flip_horizontal(flip._flip_horizontal(x)) == x)
y = array([[3, 2, 1]])
assert all(flip._flip_horizontal(x) == y)
if __name__ == '__main__':
pass
| Use relative imports in unit tests. | Use relative imports in unit tests.
| Python | isc | eliteraspberries/avena | ---
+++
@@ -2,7 +2,7 @@
from numpy import all, array
-from avena import flip
+from .. import flip
def test_flip_vertical(): |
bc576b0284ebf49e105af678b483173084068bfb | ufyr/utils/http.py | ufyr/utils/http.py | #! /usr/bin/python
import json
import requests
class Callback(object):
def __init__(self, url, method='GET', req_kwargs={}, **kwargs):
assert isinstance(url, (str, unicode))
assert isinstance(method, (str, unicode))
assert isinstance(req_kwargs, dict)
self.url = url
self.method = method
self.req_kwargs = req_kwargs
def __eq__(self, other):
return all((self.url.lower() == other.url.lower(),
self.method.lower() == other.method.lower(),
self.req_kwargs == other.req_kwargs))
@classmethod
def from_json(cls, json_string):
'''
Input: string json_string containing a url key
Returns: a Callback obj instance initalized by the parameters in the json_string.
'''
json_obj = json.loads(json_string)
if 'url' not in json_obj:
raise Exception('"url" not in json')
return Callback(**json_obj)
def to_json(self):
'''
Return a JSON serialization of the Callback obj.
'''
json_obj = {'url':self.url,
'method':self.method,
'req_kwargs':self.req_kwargs}
return json.dumps(json_obj)
def execute(self):
'''
Execute the callback call that this object represents.
'''
f = getattr(requests, self.method.lower())
return f(self.url, **self.req_kwargs)
| #! /usr/bin/python
import json
import requests
from ufyr.decorators import retry
class Callback(object):
def __init__(self, url, method='GET', req_kwargs={}, **kwargs):
assert isinstance(url, (str, unicode))
assert isinstance(method, (str, unicode))
assert isinstance(req_kwargs, dict)
self.url = url
self.method = method
self.req_kwargs = req_kwargs
def __eq__(self, other):
return all((self.url.lower() == other.url.lower(),
self.method.lower() == other.method.lower(),
self.req_kwargs == other.req_kwargs))
@classmethod
def from_json(cls, json_string):
'''
Input: string json_string containing a url key
Returns: a Callback obj instance initalized by the parameters in the json_string.
'''
json_obj = json.loads(json_string)
if 'url' not in json_obj:
raise Exception('"url" not in json')
return Callback(**json_obj)
def to_json(self):
'''
Return a JSON serialization of the Callback obj.
'''
json_obj = {'url':self.url,
'method':self.method,
'req_kwargs':self.req_kwargs}
return json.dumps(json_obj)
@retry
def execute(self):
'''
Execute the callback call that this object represents.
'''
f = getattr(requests, self.method.lower())
return f(self.url, **self.req_kwargs).status_code < 400
| Add retry and failure detection to callback.execute | Add retry and failure detection to callback.execute
| Python | unlicense | timeartist/ufyr | ---
+++
@@ -3,6 +3,8 @@
import json
import requests
+
+from ufyr.decorators import retry
class Callback(object):
def __init__(self, url, method='GET', req_kwargs={}, **kwargs):
@@ -47,12 +49,13 @@
return json.dumps(json_obj)
+ @retry
def execute(self):
'''
Execute the callback call that this object represents.
'''
f = getattr(requests, self.method.lower())
- return f(self.url, **self.req_kwargs)
+ return f(self.url, **self.req_kwargs).status_code < 400
|
74adefcad1fe411b596981da7d124cda2f8e936d | mopidy/backends/local/__init__.py | mopidy/backends/local/__init__.py | from __future__ import unicode_literals
import mopidy
from mopidy import ext
__doc__ = """A backend for playing music from a local music archive.
This backend handles URIs starting with ``file:``.
See :ref:`music-from-local-storage` for further instructions on using this
backend.
**Issues:**
https://github.com/mopidy/mopidy/issues?labels=Local+backend
**Dependencies:**
- None
**Settings:**
- :attr:`mopidy.settings.LOCAL_MUSIC_PATH`
- :attr:`mopidy.settings.LOCAL_PLAYLIST_PATH`
- :attr:`mopidy.settings.LOCAL_TAG_CACHE_FILE`
"""
class Extension(ext.Extension):
name = 'Mopidy-Local'
version = mopidy.__version__
def get_default_config(self):
return '[ext.local]'
def validate_config(self, config):
pass
def validate_environment(self):
pass
def get_backend_classes(self):
from .actor import LocalBackend
return [LocalBackend]
| from __future__ import unicode_literals
import mopidy
from mopidy import ext
from mopidy.utils import config, formatting
default_config = """
[ext.local]
# If the local extension should be enabled or not
enabled = true
# Path to folder with local music
music_path = $XDG_MUSIC_DIR
# Path to playlist folder with m3u files for local music
playlist_path = $XDG_DATA_DIR/mopidy/playlists
# Path to tag cache for local music
tag_cache_file = $XDG_DATA_DIR/mopidy/tag_cache
"""
__doc__ = """A backend for playing music from a local music archive.
This backend handles URIs starting with ``file:``.
See :ref:`music-from-local-storage` for further instructions on using this
backend.
**Issues:**
https://github.com/mopidy/mopidy/issues?labels=Local+backend
**Dependencies:**
- None
**Default config:**
.. code-block:: ini
%(config)s
""" % {'config': formatting.indent(default_config)}
class Extension(ext.Extension):
name = 'Mopidy-Local'
version = mopidy.__version__
def get_default_config(self):
return default_config
def get_config_schema(self):
schema = config.ExtensionConfigSchema()
schema['music_path'] = config.String()
schema['playlist_path'] = config.String()
schema['tag_cache_file'] = config.String()
def validate_environment(self):
pass
def get_backend_classes(self):
from .actor import LocalBackend
return [LocalBackend]
| Add default config and config schema | local: Add default config and config schema
| Python | apache-2.0 | jmarsik/mopidy,jmarsik/mopidy,jodal/mopidy,rawdlite/mopidy,ali/mopidy,SuperStarPL/mopidy,jcass77/mopidy,adamcik/mopidy,pacificIT/mopidy,diandiankan/mopidy,tkem/mopidy,swak/mopidy,diandiankan/mopidy,bacontext/mopidy,mokieyue/mopidy,pacificIT/mopidy,swak/mopidy,ZenithDK/mopidy,vrs01/mopidy,bencevans/mopidy,bacontext/mopidy,quartz55/mopidy,abarisain/mopidy,hkariti/mopidy,tkem/mopidy,mopidy/mopidy,hkariti/mopidy,dbrgn/mopidy,SuperStarPL/mopidy,SuperStarPL/mopidy,ZenithDK/mopidy,mokieyue/mopidy,abarisain/mopidy,quartz55/mopidy,ali/mopidy,priestd09/mopidy,dbrgn/mopidy,kingosticks/mopidy,swak/mopidy,dbrgn/mopidy,glogiotatidis/mopidy,hkariti/mopidy,bencevans/mopidy,bacontext/mopidy,quartz55/mopidy,SuperStarPL/mopidy,diandiankan/mopidy,glogiotatidis/mopidy,hkariti/mopidy,priestd09/mopidy,jmarsik/mopidy,woutervanwijk/mopidy,dbrgn/mopidy,jmarsik/mopidy,woutervanwijk/mopidy,bencevans/mopidy,diandiankan/mopidy,jcass77/mopidy,priestd09/mopidy,bacontext/mopidy,ZenithDK/mopidy,ZenithDK/mopidy,vrs01/mopidy,mopidy/mopidy,bencevans/mopidy,mokieyue/mopidy,adamcik/mopidy,liamw9534/mopidy,tkem/mopidy,quartz55/mopidy,rawdlite/mopidy,adamcik/mopidy,ali/mopidy,glogiotatidis/mopidy,rawdlite/mopidy,rawdlite/mopidy,liamw9534/mopidy,jcass77/mopidy,swak/mopidy,tkem/mopidy,mokieyue/mopidy,kingosticks/mopidy,jodal/mopidy,mopidy/mopidy,ali/mopidy,kingosticks/mopidy,pacificIT/mopidy,pacificIT/mopidy,vrs01/mopidy,vrs01/mopidy,jodal/mopidy,glogiotatidis/mopidy | ---
+++
@@ -2,7 +2,24 @@
import mopidy
from mopidy import ext
+from mopidy.utils import config, formatting
+
+default_config = """
+[ext.local]
+
+# If the local extension should be enabled or not
+enabled = true
+
+# Path to folder with local music
+music_path = $XDG_MUSIC_DIR
+
+# Path to playlist folder with m3u files for local music
+playlist_path = $XDG_DATA_DIR/mopidy/playlists
+
+# Path to tag cache for local music
+tag_cache_file = $XDG_DATA_DIR/mopidy/tag_cache
+"""
__doc__ = """A backend for playing music from a local music archive.
@@ -19,12 +36,12 @@
- None
-**Settings:**
+**Default config:**
-- :attr:`mopidy.settings.LOCAL_MUSIC_PATH`
-- :attr:`mopidy.settings.LOCAL_PLAYLIST_PATH`
-- :attr:`mopidy.settings.LOCAL_TAG_CACHE_FILE`
-"""
+.. code-block:: ini
+
+%(config)s
+""" % {'config': formatting.indent(default_config)}
class Extension(ext.Extension):
@@ -33,10 +50,13 @@
version = mopidy.__version__
def get_default_config(self):
- return '[ext.local]'
+ return default_config
- def validate_config(self, config):
- pass
+ def get_config_schema(self):
+ schema = config.ExtensionConfigSchema()
+ schema['music_path'] = config.String()
+ schema['playlist_path'] = config.String()
+ schema['tag_cache_file'] = config.String()
def validate_environment(self):
pass |
d6444cd75c8ce6babd373989abd3507dd14923bb | api.py | api.py | import json
from tornado.httpserver import HTTPServer
from tornado.web import URLSpec
import tornado.ioloop
import tornado.web
from tornado.options import define, options
from orders import Book, Buy, Sell
define("port", default=3000, help="run on the given port", type=int)
Book()
class BookHandler(tornado.web.RequestHandler):
def get(self):
ret = json.dumps(Book().orders())
self.write(ret)
class OrderHandler(tornado.web.RequestHandler):
def post(self, **kwargs):
order = None
body = json.loads(self.request.body)
if self.request.uri == "/buy":
order = Buy(**body)
if self.request.uri == "/sell":
order = Sell(**body)
fills = Book().match(order)
self.write(json.dumps(fills))
def main():
tornado.options.parse_command_line()
application = tornado.web.Application([
URLSpec(r"/book", BookHandler, name="book"),
URLSpec(r"/buy", OrderHandler, name="buy"),
URLSpec(r"/sell", OrderHandler, name="sell"),
])
http_server = HTTPServer(application)
http_server.listen(options.port)
tornado.ioloop.IOLoop.current().start()
if __name__ == "__main__":
main()
| import json
from tornado.httpserver import HTTPServer
from tornado.httputil import HTTPHeaders
from tornado.web import URLSpec
import tornado.ioloop
import tornado.web
from tornado.options import define, options
from orders import Book, Buy, Sell
define("port", default=3000, help="run on the given port", type=int)
Book()
class BookHandler(tornado.web.RequestHandler):
def get(self):
ret = json.dumps(Book().orders())
self.write(ret)
class OrderHandler(tornado.web.RequestHandler):
def post(self, **kwargs):
order = None
body = json.loads(self.request.body)
if self.request.uri == "/buy":
order = Buy(**body)
if self.request.uri == "/sell":
order = Sell(**body)
fills = Book().match(order)
self.set_header("content-type", "application/json")
self.set_header("location", "{}://{}{}".format(self.request.protocol,
self.request.host, self.reverse_url("book")))
self.write(json.dumps(fills))
def main():
tornado.options.parse_command_line()
application = tornado.web.Application([
URLSpec(r"/book", BookHandler, name="book"),
URLSpec(r"/buy", OrderHandler, name="buy"),
URLSpec(r"/sell", OrderHandler, name="sell"),
])
http_server = HTTPServer(application)
http_server.listen(options.port)
tornado.ioloop.IOLoop.current().start()
if __name__ == "__main__":
main()
| Add location and content-type headers to response. | Add location and content-type headers to response.
| Python | mit | eigenholser/ddme,eigenholser/ddme | ---
+++
@@ -1,5 +1,6 @@
import json
from tornado.httpserver import HTTPServer
+from tornado.httputil import HTTPHeaders
from tornado.web import URLSpec
import tornado.ioloop
import tornado.web
@@ -28,6 +29,9 @@
if self.request.uri == "/sell":
order = Sell(**body)
fills = Book().match(order)
+ self.set_header("content-type", "application/json")
+ self.set_header("location", "{}://{}{}".format(self.request.protocol,
+ self.request.host, self.reverse_url("book")))
self.write(json.dumps(fills))
|
0cb295e80fbf8d08276166d8005722918012ca83 | wafer/kv/models.py | wafer/kv/models.py | from django.contrib.auth.models import Group
from django.db import models
from jsonfield import JSONField
class KeyValue(models.Model):
group = models.ForeignKey(Group, on_delete=models.CASCADE)
key = models.CharField(max_length=64, db_index=True)
value = JSONField()
def __unicode__(self):
return u'KV(%s, %s, %r)' % (self.group.name, self.key, self.value)
| from django.contrib.auth.models import Group
from django.db import models
from jsonfield import JSONField
class KeyValue(models.Model):
group = models.ForeignKey(Group, on_delete=models.CASCADE)
key = models.CharField(max_length=64, db_index=True)
value = JSONField()
def __unicode__(self):
return u'KV(%s, %s, %r)' % (self.group.name, self.key, self.value)
def __str__(self):
return 'KV(%s, %s, %r)' % (self.group.name, self.key, self.value)
| Add KeyValue.__str__ for python 3 | Add KeyValue.__str__ for python 3
| Python | isc | CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer | ---
+++
@@ -11,3 +11,6 @@
def __unicode__(self):
return u'KV(%s, %s, %r)' % (self.group.name, self.key, self.value)
+
+ def __str__(self):
+ return 'KV(%s, %s, %r)' % (self.group.name, self.key, self.value) |
7f412fef594a514d13519a0f048c55b293fd84b3 | abandoned/models.py | abandoned/models.py | from django.db import models
class Author(models.Model):
author_name = models.CharField(max_length=200, unique=True)
author_link = models.URLField()
def __str__(self):
return str(self.name)
class Reason(models.Model):
reason = models.CharField(max_length=200)
def __str__(self):
return str(self.reason)
class Tag(models.Model):
text = models.CharField(max_length=100, unique=True)
def __str__(self):
return str(self.text)
class Language(models.Model):
language_name = models.CharField(max_length=100, unique=True)
def __str__(self):
return str(self.name)
class Project(models.Model):
name = models.CharField(max_length=400)
link = models.URLField(unique=True)
author = models.ForeignKey(Author, related_name='projects')
description = models.TextField()
reason = models.ForeignKey(Reason, related_name='projects')
language = models.ForeignKey(Language, related_name='projects', null=True)
tags = models.ManyToManyField(Tag, related_name='projects')
upvotes = models.IntegerField(default=0)
date_added = models.DateTimeField(auto_now_add=True)
def __str__(self):
return str(self.name) | from django.db import models
class Author(models.Model):
author_name = models.CharField(max_length=200, unique=True)
author_link = models.URLField()
def __str__(self):
return str(self.name)
class Reason(models.Model):
reason = models.CharField(max_length=200)
def __str__(self):
return str(self.reason)
class Tag(models.Model):
text = models.CharField(max_length=100, unique=True)
def __str__(self):
return str(self.text)
def save(self, *args, **kwargs):
self.text = self.text.lower()
super(Tag, self).save(*args, **kwargs)
class Language(models.Model):
language_name = models.CharField(max_length=100, unique=True)
def __str__(self):
return str(self.name)
class Project(models.Model):
name = models.CharField(max_length=400)
link = models.URLField(unique=True)
author = models.ForeignKey(Author, related_name='projects')
description = models.TextField()
reason = models.ForeignKey(Reason, related_name='projects')
language = models.ForeignKey(Language, related_name='projects', null=True)
tags = models.ManyToManyField(Tag, related_name='projects')
upvotes = models.IntegerField(default=0)
date_added = models.DateTimeField(auto_now_add=True)
def __str__(self):
return str(self.name) | Tag text is now converted to lowercase before being saved | Tag text is now converted to lowercase before being saved
| Python | mit | Kunstmord/abandoned,Kunstmord/abandoned,Kunstmord/abandoned | ---
+++
@@ -22,6 +22,10 @@
def __str__(self):
return str(self.text)
+ def save(self, *args, **kwargs):
+ self.text = self.text.lower()
+ super(Tag, self).save(*args, **kwargs)
+
class Language(models.Model):
language_name = models.CharField(max_length=100, unique=True) |
61e792e1c4d41d2a0e3f3433b39f364a5c1df144 | daybed/tests/test_id_generators.py | daybed/tests/test_id_generators.py | try:
from unittest2 import TestCase
except ImportError:
from unittest import TestCase # flake8: noqa
import six
from mock import patch
from daybed.backends.id_generators import KoremutakeGenerator
class KoremutakeGeneratorTest(TestCase):
def test_it_defaults_the_max_bytes_to_4(self):
generator = KoremutakeGenerator()
self.assertEquals(generator.max_bytes, 4)
@patch('koremutake.encode')
def test_it_doesnt_reuse_a_name_twice(self, encode):
encode.side_effect = ['existing-value', 'new-value']
created = ['existing-value']
def _exists(key):
return key in created
generator = KoremutakeGenerator()
self.assertEquals(generator(key_exist=_exists), 'new-value')
def test_it_returns_a_string_with_a_max_size(self):
generator = KoremutakeGenerator()
uid = generator()
self.assertTrue(len(uid) <= 24)
self.assertIsInstance(uid, six.text_type)
| try:
from unittest2 import TestCase
except ImportError:
from unittest import TestCase # flake8: noqa
import six
from mock import patch
from daybed.backends.id_generators import KoremutakeGenerator
class KoremutakeGeneratorTest(TestCase):
def setUp(self):
self.generator = KoremutakeGenerator()
def test_it_defaults_the_max_bytes_to_4(self):
self.assertEquals(generator.max_bytes, 4)
@patch('koremutake.encode')
def test_it_doesnt_reuse_a_name_twice(self, encode):
encode.side_effect = ['existing-value', 'new-value']
created = ['existing-value']
def _exists(key):
return key in created
self.assertEquals(self.generator(key_exist=_exists), 'new-value')
def test_it_returns_a_string_with_a_max_size(self):
uid = self.generator()
self.assertTrue(len(uid) <= 24)
self.assertIsInstance(uid, six.text_type)
| Put the generator instanciation in the setUp | Put the generator instanciation in the setUp
| Python | bsd-3-clause | spiral-project/daybed,spiral-project/daybed | ---
+++
@@ -11,10 +11,11 @@
class KoremutakeGeneratorTest(TestCase):
+ def setUp(self):
+ self.generator = KoremutakeGenerator()
+
def test_it_defaults_the_max_bytes_to_4(self):
- generator = KoremutakeGenerator()
self.assertEquals(generator.max_bytes, 4)
-
@patch('koremutake.encode')
def test_it_doesnt_reuse_a_name_twice(self, encode):
@@ -23,11 +24,9 @@
def _exists(key):
return key in created
- generator = KoremutakeGenerator()
- self.assertEquals(generator(key_exist=_exists), 'new-value')
+ self.assertEquals(self.generator(key_exist=_exists), 'new-value')
def test_it_returns_a_string_with_a_max_size(self):
- generator = KoremutakeGenerator()
- uid = generator()
+ uid = self.generator()
self.assertTrue(len(uid) <= 24)
self.assertIsInstance(uid, six.text_type) |
aeb43ef66c0dc16d020b941e71fa19d357016e02 | jsk_apc2016_common/scripts/install_trained_data.py | jsk_apc2016_common/scripts/install_trained_data.py | #!/usr/bin/env python
from jsk_data import download_data
def main():
PKG = 'jsk_apc2016_common'
download_data(
pkg_name=PKG,
path='trained_data/vgg16_96000.chainermodel',
url='https://drive.google.com/uc?id=0B9P1L--7Wd2vOTdzOGlJcGM1N00',
md5='3c993d333cf554684b5162c9f69b20cf',
)
download_data(
pkg_name=PKG,
path='trained_data/vgg16_rotation_translation_brightness_372000.chainermodel',
url='https://drive.google.com/uc?id=0B9P1L--7Wd2veHZKRkFwZjRiZDQ',
md5='58a0e819ba141a34b1d68cc5e972615b',
)
download_data(
pkg_name=PKG,
path='trained_data/fcn32s_6000.chainermodel',
url='https://drive.google.com/uc?id=0B9P1L--7Wd2vd0JUMFZKeVQxaG8',
md5='d063161d18129946f6c2878afb5f9067',
)
if __name__ == '__main__':
main()
| #!/usr/bin/env python
from jsk_data import download_data
def main():
PKG = 'jsk_apc2016_common'
download_data(
pkg_name=PKG,
path='trained_data/vgg16_96000.chainermodel',
url='https://drive.google.com/uc?id=0B9P1L--7Wd2vOTdzOGlJcGM1N00',
md5='3c993d333cf554684b5162c9f69b20cf',
)
download_data(
pkg_name=PKG,
path='trained_data/vgg16_rotation_translation_brightness_372000.chainermodel',
url='https://drive.google.com/uc?id=0B9P1L--7Wd2vamZrczFqb3JoVnM',
md5='58a0e819ba141a34b1d68cc5e972615b',
)
download_data(
pkg_name=PKG,
path='trained_data/fcn32s_6000.chainermodel',
url='https://drive.google.com/uc?id=0B9P1L--7Wd2vd0JUMFZKeVQxaG8',
md5='d063161d18129946f6c2878afb5f9067',
)
if __name__ == '__main__':
main()
| Fix 404 of trained data vgg16_rotation_translation_brightness_372000... | Fix 404 of trained data vgg16_rotation_translation_brightness_372000...
| Python | bsd-3-clause | pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc | ---
+++
@@ -16,7 +16,7 @@
download_data(
pkg_name=PKG,
path='trained_data/vgg16_rotation_translation_brightness_372000.chainermodel',
- url='https://drive.google.com/uc?id=0B9P1L--7Wd2veHZKRkFwZjRiZDQ',
+ url='https://drive.google.com/uc?id=0B9P1L--7Wd2vamZrczFqb3JoVnM',
md5='58a0e819ba141a34b1d68cc5e972615b',
)
|
27a24e265737c0d67ed5d93e705d250a9e6b855a | mistralclient/api/v2/tasks.py | mistralclient/api/v2/tasks.py | # Copyright 2014 - Mirantis, 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 agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from mistralclient.api import base
class Task(base.Resource):
resource_name = 'Task'
class TaskManager(base.ResourceManager):
resource_class = Task
def update(self, id, state):
self._ensure_not_empty(id=id, state=state)
data = {
'state': state
}
return self._update('/tasks/%s' % id, data)
def list(self):
return self._list('/tasks', response_key='tasks')
def get(self, id):
self._ensure_not_empty(id=id)
return self._get('/tasks/%s' % id)
| # Copyright 2014 - Mirantis, 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 agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from mistralclient.api import base
class Task(base.Resource):
resource_name = 'Task'
class TaskManager(base.ResourceManager):
resource_class = Task
def update(self, id, state):
self._ensure_not_empty(id=id, state=state)
data = {
'state': state
}
return self._update('/tasks/%s' % id, data)
def list(self, execution_id=None):
url = '/tasks'
if execution_id:
url = '/executions/%s/tasks' % execution_id
return self._list(url, response_key='tasks')
def get(self, id):
self._ensure_not_empty(id=id)
return self._get('/tasks/%s' % id)
| Support naive filtering in python API | Support naive filtering in python API
Change-Id: I10caecf68c73e7c722a9ab93a718b80c588d4d0e
| Python | apache-2.0 | openstack/python-mistralclient,openstack/python-mistralclient,StackStorm/python-mistralclient,StackStorm/python-mistralclient | ---
+++
@@ -31,8 +31,13 @@
return self._update('/tasks/%s' % id, data)
- def list(self):
- return self._list('/tasks', response_key='tasks')
+ def list(self, execution_id=None):
+ url = '/tasks'
+
+ if execution_id:
+ url = '/executions/%s/tasks' % execution_id
+
+ return self._list(url, response_key='tasks')
def get(self, id):
self._ensure_not_empty(id=id) |
ed350a7387c376538f51a8a7a8cfde5469baba8a | tests/testutils.py | tests/testutils.py | import psycopg2
import os
import getpass
def get_pg_connection():
return psycopg2.connect(
"dbname=bedquilt_test user={}".format(getpass.getuser())
)
| import psycopg2
import os
import getpass
# CREATE DATABASE bedquilt_test
# WITH OWNER = {{owner}}
# ENCODING = 'UTF8'
# TABLESPACE = pg_default
# LC_COLLATE = 'en_GB.UTF-8'
# LC_CTYPE = 'en_GB.UTF-8'
# CONNECTION LIMIT = -1;
def get_pg_connection():
return psycopg2.connect(
"dbname=bedquilt_test user={}".format(getpass.getuser())
)
| Add the sql to create the test database | Add the sql to create the test database
| Python | mit | BedquiltDB/bedquilt-core | ---
+++
@@ -1,6 +1,15 @@
import psycopg2
import os
import getpass
+
+
+# CREATE DATABASE bedquilt_test
+# WITH OWNER = {{owner}}
+# ENCODING = 'UTF8'
+# TABLESPACE = pg_default
+# LC_COLLATE = 'en_GB.UTF-8'
+# LC_CTYPE = 'en_GB.UTF-8'
+# CONNECTION LIMIT = -1;
def get_pg_connection(): |
28ce9a3316bbbb58a244dc6ed5cd43bc13dca01b | project_dir/urls.py | project_dir/urls.py | """<project_name> URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^/', include('pages.urls')),
]
| """<project_name> URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('pages.urls')),
]
| Remove unneccesary / in url conf | Remove unneccesary / in url conf
| Python | mit | nkhumphreys/django_docker_template,nkhumphreys/django_docker_template,nkhumphreys/django_docker_template | ---
+++
@@ -18,5 +18,5 @@
urlpatterns = [
url(r'^admin/', admin.site.urls),
- url(r'^/', include('pages.urls')),
+ url(r'^', include('pages.urls')),
] |
8c18b43880368bba654e715c2da197f7a6d9e41a | tests/test_carddb.py | tests/test_carddb.py | from hearthstone.enums import CardType, GameTag, Rarity
import utils
CARDS = utils.fireplace.cards.db
def test_all_tags_known():
"""
Iterate through the card database and check that all specified GameTags
are known in hearthstone.enums.GameTag
"""
unknown_tags = set()
known_tags = list(GameTag)
known_rarities = list(Rarity)
# Check the db loaded correctly
assert utils.fireplace.cards.db
for card in CARDS.values():
card_tags = [int(e.attrib["enumID"]) for e in card.xml.findall("./Tag")]
for tag in card_tags:
# We have fake tags in fireplace.enums which are always negative
if tag not in known_tags and tag > 0:
unknown_tags.add(tag)
# Test rarities as well (cf. TB_BlingBrawl_Blade1e in 10956...)
assert card.rarity in known_rarities
assert not unknown_tags
def test_play_scripts():
for card in CARDS.values():
if card.scripts.activate:
assert card.type == CardType.HERO_POWER
elif card.scripts.play:
assert card.type not in (CardType.HERO, CardType.HERO_POWER, CardType.ENCHANTMENT)
| from hearthstone.enums import CardType, GameTag, Rarity
import utils
CARDS = utils.fireplace.cards.db
def test_all_tags_known():
"""
Iterate through the card database and check that all specified GameTags
are known in hearthstone.enums.GameTag
"""
unknown_tags = set()
known_tags = list(GameTag)
known_rarities = list(Rarity)
# Check the db loaded correctly
assert utils.fireplace.cards.db
for card in CARDS.values():
for tag in card.tags:
# We have fake tags in fireplace.enums which are always negative
if tag not in known_tags and tag > 0:
unknown_tags.add(tag)
# Test rarities as well (cf. TB_BlingBrawl_Blade1e in 10956...)
assert card.rarity in known_rarities
assert not unknown_tags
def test_play_scripts():
for card in CARDS.values():
if card.scripts.activate:
assert card.type == CardType.HERO_POWER
elif card.scripts.play:
assert card.type not in (CardType.HERO, CardType.HERO_POWER, CardType.ENCHANTMENT)
| Simplify the CardDB test check for tags | Simplify the CardDB test check for tags
| Python | agpl-3.0 | smallnamespace/fireplace,NightKev/fireplace,smallnamespace/fireplace,beheh/fireplace,Ragowit/fireplace,Ragowit/fireplace,jleclanche/fireplace | ---
+++
@@ -19,8 +19,7 @@
assert utils.fireplace.cards.db
for card in CARDS.values():
- card_tags = [int(e.attrib["enumID"]) for e in card.xml.findall("./Tag")]
- for tag in card_tags:
+ for tag in card.tags:
# We have fake tags in fireplace.enums which are always negative
if tag not in known_tags and tag > 0:
unknown_tags.add(tag) |
d31bb7014a58eb90ffb3dd25d136595c24c47e68 | app.py | app.py | import eventlet
eventlet.monkey_patch() # NOLINT
import importlib
import sys
from weaveserver.main import create_app
from weaveserver.core.logger import configure_logging
def handle_launch():
import signal
from weaveserver.core.config_loader import get_config
configure_logging()
name = sys.argv[1]
module = importlib.import_module(name)
meta = module.__meta__
config = get_config(meta.get("config"))
app = meta["class"](config)
signal.signal(signal.SIGTERM, lambda x, y: app.on_service_stop())
signal.signal(signal.SIGINT, lambda x, y: app.on_service_stop())
app.before_service_start()
app.on_service_start()
def handle_main():
configure_logging()
main_app = create_app()
main_app.start()
| import eventlet
eventlet.monkey_patch() # NOLINT
import importlib
import sys
from weaveserver.main import create_app
from weaveserver.core.logger import configure_logging
def handle_launch():
import signal
from weaveserver.core.config_loader import get_config
configure_logging()
token = sys.stdin.readline().strip()
name = sys.argv[1]
module = importlib.import_module(name)
meta = module.__meta__
config = get_config(meta.get("config"))
app = meta["class"](token, config)
signal.signal(signal.SIGTERM, lambda x, y: app.on_service_stop())
signal.signal(signal.SIGINT, lambda x, y: app.on_service_stop())
app.before_service_start()
app.on_service_start()
def handle_main():
configure_logging()
main_app = create_app()
main_app.start()
| Read for service token from stdin. | Read for service token from stdin.
| Python | mit | supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer | ---
+++
@@ -13,15 +13,18 @@
from weaveserver.core.config_loader import get_config
configure_logging()
+ token = sys.stdin.readline().strip()
+
name = sys.argv[1]
module = importlib.import_module(name)
meta = module.__meta__
config = get_config(meta.get("config"))
- app = meta["class"](config)
+ app = meta["class"](token, config)
signal.signal(signal.SIGTERM, lambda x, y: app.on_service_stop())
signal.signal(signal.SIGINT, lambda x, y: app.on_service_stop())
+
app.before_service_start()
app.on_service_start()
|
6ecabe1e20ef7d82651bf91ccfc30bcb77bcb968 | nbx/extensions/partial_run.py | nbx/extensions/partial_run.py | import six
# only run for python 3, or else syntax errors
if six.PY3:
from ._partial_run import *
| import six
def load_ipython_extension(shell):
# only run for python 3, or else syntax errors
if not six.PY3:
return
from ._partial_run import safe_run_module
shell.safe_run_module = safe_run_module.__get__(shell)
| Update to use ipython kernel extension | Update to use ipython kernel extension
| Python | mit | dalejung/nbx,dalejung/nbx,dalejung/nbx,dalejung/nbx | ---
+++
@@ -1,4 +1,9 @@
import six
-# only run for python 3, or else syntax errors
-if six.PY3:
- from ._partial_run import *
+
+
+def load_ipython_extension(shell):
+ # only run for python 3, or else syntax errors
+ if not six.PY3:
+ return
+ from ._partial_run import safe_run_module
+ shell.safe_run_module = safe_run_module.__get__(shell) |
db8b85e2c5789b91a1d50a902f626fba95a4f4cc | txircd/modules/cmd_ping.py | txircd/modules/cmd_ping.py | from twisted.words.protocols import irc
from txircd.modbase import Command
class PingCommand(Command):
def onUse(self, user, data):
if data["params"]:
user.sendMessage("PONG", ":{}".format(data["params"][0]), to=self.ircd.servconfig["server_name"], prefix=None)
else:
user.sendMessage(irc.ERR_NOORIGIN, ":No origin specified")
def updateActivity(self, user):
pass
class Spawner(object):
def __init__(self, ircd):
self.ircd = ircd
def spawn(self):
return {
"commands": {
"PING": PingCommand()
}
}
def cleanup(self):
del self.ircd.commands["PING"] | from twisted.words.protocols import irc
from txircd.modbase import Command
class PingCommand(Command):
def onUse(self, user, data):
if data["params"]:
user.sendMessage("PONG", ":{}".format(data["params"][0]), to=self.ircd.servconfig["server_name"])
else:
user.sendMessage(irc.ERR_NOORIGIN, ":No origin specified")
def updateActivity(self, user):
pass
class Spawner(object):
def __init__(self, ircd):
self.ircd = ircd
def spawn(self):
return {
"commands": {
"PING": PingCommand()
}
}
def cleanup(self):
del self.ircd.commands["PING"] | Send the server prefix on the line when the client sends PING | Send the server prefix on the line when the client sends PING
| Python | bsd-3-clause | Heufneutje/txircd,ElementalAlchemist/txircd,DesertBus/txircd | ---
+++
@@ -4,7 +4,7 @@
class PingCommand(Command):
def onUse(self, user, data):
if data["params"]:
- user.sendMessage("PONG", ":{}".format(data["params"][0]), to=self.ircd.servconfig["server_name"], prefix=None)
+ user.sendMessage("PONG", ":{}".format(data["params"][0]), to=self.ircd.servconfig["server_name"])
else:
user.sendMessage(irc.ERR_NOORIGIN, ":No origin specified")
|
a7481dea799117199af4e48526a007194c8d3220 | fabfile/docs.py | fabfile/docs.py | # Module: docs
# Date: 03rd April 2013
# Author: James Mills, j dot mills at griffith dot edu dot au
"""Documentation Tasks"""
from fabric.api import lcd, local, task
from .utils import pip, requires
PACKAGE = "src/ccav"
@task()
@requires("sphinx-apidoc")
def api():
"""Generate the API Documentation"""
if PACKAGE is not None:
local("sphinx-apidoc -f -T -o docs/source/api {0:s}".format(PACKAGE))
@task()
@requires("make")
def clean():
"""Delete Generated Documentation"""
with lcd("docs"):
local("make clean")
@task(default=True)
@requires("make")
def build(**options):
"""Build the Documentation"""
pip(requirements="docs/requirements.txt")
with lcd("docs"):
local("make html")
@task()
@requires("open")
def view(**options):
"""View the Documentation"""
with lcd("docs"):
local("open build/html/index.html")
| # Module: docs
# Date: 03rd April 2013
# Author: James Mills, j dot mills at griffith dot edu dot au
"""Documentation Tasks"""
from fabric.api import lcd, local, task
from .utils import pip, requires
PACKAGE = "src/ccav"
@task()
@requires("sphinx-apidoc")
def api():
"""Generate the API Documentation"""
if PACKAGE is not None:
local("sphinx-apidoc -f -T -o docs/source/api {0:s}".format(PACKAGE))
@task()
@requires("make")
def clean():
"""Delete Generated Documentation"""
with lcd("docs"):
local("make clean")
@task(default=True)
@requires("make")
def build(**options):
"""Build the Documentation"""
pip(requirements="docs/requirements.txt")
with lcd("docs"):
local("make html")
@task()
def view(**options):
"""View the Documentation"""
with lcd("docs"):
import webbrowser
webbrowser.open_new_tab("build/html/index.html")
| Use webbrowser.open_new_tab() instead of platform dependent open | Use webbrowser.open_new_tab() instead of platform dependent open
| Python | mit | eriol/circuits,treemo/circuits,treemo/circuits,treemo/circuits,nizox/circuits,eriol/circuits,eriol/circuits | ---
+++
@@ -42,9 +42,9 @@
@task()
-@requires("open")
def view(**options):
"""View the Documentation"""
with lcd("docs"):
- local("open build/html/index.html")
+ import webbrowser
+ webbrowser.open_new_tab("build/html/index.html") |
ae433a0ed222d3540581b2b49c9a49a8ad16819c | wagtailaltgenerator/translation_providers/google_translate.py | wagtailaltgenerator/translation_providers/google_translate.py | import logging
from . import AbstractTranslationProvider
from google.cloud import translate
logger = logging.getLogger(__name__)
class GoogleTranslate(AbstractTranslationProvider):
def translate(self, strings, target_language, source_language="en"):
client = translate.Client()
response = client.translate(
strings, source_language=source_language, target_language=target_language
)
return list(map(lambda x: x["translatedText"], response))
| import logging
from . import AbstractTranslationProvider
logger = logging.getLogger(__name__)
class GoogleTranslate(AbstractTranslationProvider):
def translate(self, strings, target_language, source_language="en"):
from google.cloud import translate
client = translate.Client()
response = client.translate(
strings, source_language=source_language, target_language=target_language
)
return list(map(lambda x: x["translatedText"], response))
| Enable test mocking for translate | Enable test mocking for translate
| Python | mit | marteinn/wagtail-alt-generator,marteinn/wagtail-alt-generator,marteinn/wagtail-alt-generator | ---
+++
@@ -1,7 +1,6 @@
import logging
from . import AbstractTranslationProvider
-from google.cloud import translate
logger = logging.getLogger(__name__)
@@ -9,6 +8,8 @@
class GoogleTranslate(AbstractTranslationProvider):
def translate(self, strings, target_language, source_language="en"):
+ from google.cloud import translate
+
client = translate.Client()
response = client.translate(
strings, source_language=source_language, target_language=target_language |
4237d5cb9d430c71089e3fe5965e5d83af9f97df | run.py | run.py | from __future__ import print_function
import tornado
from tornado import autoreload
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.log import enable_pretty_logging
from app import app
enable_pretty_logging()
PORT = 8000
if __name__ == '__main__':
http_server = HTTPServer(WSGIContainer(app))
http_server.listen(PORT)
ioloop = tornado.ioloop.IOLoop().instance()
print("Server listening at 127.0.0.1:{}".format(PORT))
ioloop.start()
| from __future__ import print_function
import tornado
from tornado import autoreload
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.log import enable_pretty_logging
from app import app, db
from app.models import User
enable_pretty_logging()
PORT = 8000
if __name__ == '__main__':
http_server = HTTPServer(WSGIContainer(app))
http_server.listen(PORT)
ioloop = tornado.ioloop.IOLoop().instance()
if User.query.all():
db.drop_all()
db.create_all()
print("Server listening at 127.0.0.1:{}".format(PORT))
ioloop.start()
| Add db creation and drop | Add db creation and drop
| Python | mit | jochasinga/rpg-x,jochasinga/rpg-x,jochasinga/rpg-x,jochasinga/rpg-x | ---
+++
@@ -6,7 +6,8 @@
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.log import enable_pretty_logging
-from app import app
+from app import app, db
+from app.models import User
enable_pretty_logging()
@@ -17,5 +18,10 @@
http_server.listen(PORT)
ioloop = tornado.ioloop.IOLoop().instance()
+ if User.query.all():
+ db.drop_all()
+
+ db.create_all()
+
print("Server listening at 127.0.0.1:{}".format(PORT))
ioloop.start() |
fdbc857d3496182d417f881242257eb6a858a42c | setup.py | setup.py | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
install_requires = (
'parsimonious',
)
description = "Connexions project search query parsing library."
with open('README.rst', 'r') as fb:
readme = fb.read()
long_description = readme
setup(
name='cnx-query-grammar',
version='0.2.1',
author='Connexions team',
author_email='info@cnx.org',
url='https://github.com/connexions/cnx-query-grammar',
license='AGPL, See also LICENSE.txt',
description=description,
long_description=long_description,
packages=find_packages(),
install_requires=install_requires,
package_data={
'': ['query.peg'],
},
entry_points="""\
[console_scripts]
query_parser = cnxquerygrammar.query_parser:main
""",
test_suite='cnxquerygrammar.tests'
)
| # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
install_requires = (
'parsimonious',
)
description = "Connexions project search query parsing library."
with open('README.rst', 'r') as fb:
readme = fb.read()
long_description = readme
setup(
name='cnx-query-grammar',
version='0.2.2',
author='Connexions team',
author_email='info@cnx.org',
url='https://github.com/connexions/cnx-query-grammar',
license='AGPL, See also LICENSE.txt',
description=description,
long_description=long_description,
packages=find_packages(),
install_requires=install_requires,
package_data={
'': ['query.peg'],
},
entry_points="""\
[console_scripts]
query_parser = cnxquerygrammar.query_parser:main
""",
test_suite='cnxquerygrammar.tests'
)
| Bump version for tag and release | Bump version for tag and release
| Python | agpl-3.0 | Connexions/cnx-query-grammar | ---
+++
@@ -13,7 +13,7 @@
setup(
name='cnx-query-grammar',
- version='0.2.1',
+ version='0.2.2',
author='Connexions team',
author_email='info@cnx.org',
url='https://github.com/connexions/cnx-query-grammar', |
7734721ebf956c994de289b43523681e42897ad4 | setup.py | setup.py | import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-extra-fields',
version='0.9',
packages=['drf_extra_fields',
'drf_extra_fields.runtests'],
include_package_data=True,
license='License', # example license
description='Additional fields for Django Rest Framework.',
long_description=README,
author='hipo',
author_email='pypi@hipolabs.com',
classifiers=[
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
)
| import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-extra-fields',
version='0.9',
packages=['drf_extra_fields',
'drf_extra_fields.runtests'],
include_package_data=True,
license='License', # example license
description='Additional fields for Django Rest Framework.',
long_description=README,
author='hipo',
author_email='pypi@hipolabs.com',
classifiers=[
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
)
| Add python 3 trove classifier | Add python 3 trove classifier
| Python | apache-2.0 | Hipo/drf-extra-fields,Hipo/drf-extra-fields | ---
+++
@@ -24,6 +24,7 @@
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
+ 'Programming Language :: Python :: 3',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
], |
c9d3acd0e404a60a3bb31dd49aadcca7c67ffa55 | setup.py | setup.py | from setuptools import setup, find_packages
install_requires = [
'dill==0.2.5',
'easydict==1.6',
'h5py==2.6.0',
'jsonpickle==0.9.3',
'Keras==1.2.0',
'nflgame==1.2.20',
'numpy==1.11.2',
'pandas==0.19.1',
'scikit-learn==0.18.1',
'scipy==0.18.1',
'tensorflow==0.12.0rc1',
'Theano==0.8.2',
]
with open('README.md', 'r') as f:
readme = f.read()
setup(
name="wincast",
version='0.0.1',
url='https://github.com/kahnjw/wincast',
author_email='thomas.welfley+djproxy@gmail.com',
long_description=readme,
license='MIT',
packages=find_packages(exclude=['tests', 'tests.*']),
install_requires=install_requires,
data_files=[
('models', ['models/wincast.model.h5', 'models/wincast.scaler.pkl']),
('data', ['data/Xy.csv'])
]
)
| from setuptools import setup, find_packages
install_requires = [
'dill==0.2.5',
'easydict==1.6',
'h5py==2.6.0',
'jsonpickle==0.9.3',
'Keras==1.2.0',
'nflgame==1.2.20',
'numpy==1.11.2',
'pandas==0.19.1',
'scikit-learn==0.18.1',
'scipy==0.18.1',
'tensorflow==0.12.0rc1',
'Theano==0.8.2',
]
with open('README.md', 'r') as f:
readme = f.read()
setup(
name="wincast",
version='0.0.1',
url='https://github.com/kahnjw/wincast',
author_email='thomas.welfley+djproxy@gmail.com',
long_description=readme,
license='MIT',
packages=find_packages(exclude=['tests', 'tests.*']),
install_requires=install_requires,
data_files=[
('', ['models/wincast.model.h5', 'models/wincast.scaler.pkl']),
('', ['data/Xy.csv'])
]
)
| Use empty string for install dir | Use empty string for install dir
| Python | mit | kahnjw/wincast | ---
+++
@@ -29,7 +29,7 @@
packages=find_packages(exclude=['tests', 'tests.*']),
install_requires=install_requires,
data_files=[
- ('models', ['models/wincast.model.h5', 'models/wincast.scaler.pkl']),
- ('data', ['data/Xy.csv'])
+ ('', ['models/wincast.model.h5', 'models/wincast.scaler.pkl']),
+ ('', ['data/Xy.csv'])
]
) |
3881bc75b43fc109e27348a41724311300039a15 | setup.py | setup.py | from pip.req import parse_requirements
from setuptools import setup
setup(name='psc_konvertor',
version='0.1.0',
description='PSČ Konvertor',
long_description='',
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'Operating System :: Unix',
'Programming Language :: Python :: Implementation :: CPython',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6'
],
keywords='psc konvertor',
url='https://github.com/petrbel/PscKonvertor',
author='Petr Bělohlávek',
author_email='me@petrbel.cz',
license='MIT',
packages=['psc_konvertor',
'psc_konvertor.data'],
package_data={
# If any package contains *.txt or *.rst files, include them:
'': ['*.csv'],
},
include_package_data=True,
zip_safe=False,
test_suite='psc_konvertor.tests',
install_requires=[str(ir.req) for ir in parse_requirements('requirements.txt', session='hack')],
)
| try: # for pip >= 10
from pip._internal.req import parse_requirements
except ImportError: # for pip <= 9.0.3
from pip.req import parse_requirements
from setuptools import setup
install_reqs = list(parse_requirements('requirements.txt', session='hack'))
try:
requirements = [str(ir.req) for ir in install_reqs]
except:
requirements = [str(ir.requirement) for ir in install_reqs]
setup(name='psc_konvertor',
version='0.1.0',
description='PSČ Konvertor',
long_description='',
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'Operating System :: Unix',
'Programming Language :: Python :: Implementation :: CPython',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6'
],
keywords='psc konvertor',
url='https://github.com/petrbel/PscKonvertor',
author='Petr Bělohlávek',
author_email='me@petrbel.cz',
license='MIT',
packages=['psc_konvertor',
'psc_konvertor.data'],
package_data={
# If any package contains *.txt or *.rst files, include them:
'': ['*.csv'],
},
include_package_data=True,
zip_safe=False,
test_suite='psc_konvertor.tests',
install_requires=requirements,
)
| Add support for current pip | Add support for current pip
Introducing support for current pip while maintaining backward
compatibility.
| Python | mit | petrbel/psc_konvertor | ---
+++
@@ -1,5 +1,15 @@
-from pip.req import parse_requirements
+try: # for pip >= 10
+ from pip._internal.req import parse_requirements
+except ImportError: # for pip <= 9.0.3
+ from pip.req import parse_requirements
+
from setuptools import setup
+
+install_reqs = list(parse_requirements('requirements.txt', session='hack'))
+try:
+ requirements = [str(ir.req) for ir in install_reqs]
+except:
+ requirements = [str(ir.requirement) for ir in install_reqs]
setup(name='psc_konvertor',
version='0.1.0',
@@ -31,5 +41,5 @@
include_package_data=True,
zip_safe=False,
test_suite='psc_konvertor.tests',
- install_requires=[str(ir.req) for ir in parse_requirements('requirements.txt', session='hack')],
+ install_requires=requirements,
) |
7ca0d0d23587814f7bdc8e4d5de4c1182b516b3b | setup.py | setup.py | #!/usr/bin/env python
import subprocess
from setuptools import setup, find_packages
import os
def git_version():
def _minimal_ext_cmd(cmd):
# construct minimal environment
env = {}
for k in ['SYSTEMROOT', 'PATH']:
v = os.environ.get(k)
if v is not None:
env[k] = v
# LANGUAGE is used on win32
env['LANGUAGE'] = 'C'
env['LANG'] = 'C'
env['LC_ALL'] = 'C'
out = subprocess.Popen(
cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
return out
try:
out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
GIT_REVISION = out.strip().decode('ascii')
except OSError:
GIT_REVISION = ""
return GIT_REVISION
def getVersion(version, release=True):
if os.path.exists('.git'):
_git_version = git_version()[:7]
else:
_git_version = ''
if release:
return version
else:
return version + '-dev.' + _git_version
setup(name='pymks',
version=getVersion('0.3.2', release=False),
description='Materials Knowledge Systems in Python (PyMKS)',
author='David Brough, Daniel Wheeler',
author_email='david.brough.0416@gmail.com',
url='http://pymks.org',
packages=find_packages(),
package_data={'': ['tests/*.py']},
)
| #!/usr/bin/env python
import subprocess
from setuptools import setup, find_packages
import os
def git_version():
def _minimal_ext_cmd(cmd):
# construct minimal environment
env = {}
for k in ['SYSTEMROOT', 'PATH']:
v = os.environ.get(k)
if v is not None:
env[k] = v
# LANGUAGE is used on win32
env['LANGUAGE'] = 'C'
env['LANG'] = 'C'
env['LC_ALL'] = 'C'
out = subprocess.Popen(
cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
return out
try:
out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
GIT_REVISION = out.strip().decode('ascii')
except OSError:
GIT_REVISION = ""
return GIT_REVISION
def getVersion(version, release=True):
if os.path.exists('.git'):
_git_version = git_version()[:7]
else:
_git_version = ''
if release:
return version
else:
return version + '-dev.' + _git_version
setup(name='pymks',
version=getVersion('0.3.1', release=True),
description='Materials Knowledge Systems in Python (PyMKS)',
author='David Brough, Daniel Wheeler',
author_email='david.brough.0416@gmail.com',
url='http://pymks.org',
packages=find_packages(),
package_data={'': ['tests/*.py']},
)
| Revert back to version number | Revert back to version number
| Python | mit | davidbrough1/pymks,davidbrough1/pymks | ---
+++
@@ -41,7 +41,7 @@
return version + '-dev.' + _git_version
setup(name='pymks',
- version=getVersion('0.3.2', release=False),
+ version=getVersion('0.3.1', release=True),
description='Materials Knowledge Systems in Python (PyMKS)',
author='David Brough, Daniel Wheeler',
author_email='david.brough.0416@gmail.com', |
ffe963385ed5f8f1011b40df4fdc0cfa0794abaf | setup.py | setup.py | from setuptools import setup
setup(
name='skyarea',
packages=['sky_area'],
scripts=['bin/make_search_map', 'bin/process_areas', 'bin/run_sky_area'],
version='0.1',
description='Compute credible regions on the sky from RA-DEC MCMC samples',
author='Will M. Farr',
author_email='will.farr@ligo.org',
url='http://farr.github.io/skyarea/',
license='MIT',
keywords='MCMC credible regions skymap LIGO',
install_requires=['numpy', 'matplotlib', 'scipy', 'healpy', 'glue'],
classifiers=['Development Status :: 5 - Production/Stable',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Topic :: Scientific/Engineering :: Astronomy',
'Topic :: Scientific/Engineering :: Visualization']
)
| from setuptools import setup
setup(
name='skyarea',
packages=['sky_area'],
scripts=['bin/make_search_map', 'bin/process_areas', 'bin/run_sky_area'],
version='0.1',
description='Compute credible regions on the sky from RA-DEC MCMC samples',
author='Will M. Farr',
author_email='will.farr@ligo.org',
url='http://farr.github.io/skyarea/',
license='MIT',
keywords='MCMC credible regions skymap LIGO',
install_requires=['numpy', 'matplotlib', 'scipy', 'healpy', 'glue'],
classifiers=['Development Status :: 5 - Production/Stable',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2.7',
'Topic :: Scientific/Engineering :: Astronomy',
'Topic :: Scientific/Engineering :: Visualization']
)
| Add Python version list trove classifiers | Add Python version list trove classifiers
| Python | mit | farr/skyarea,lpsinger/skyarea | ---
+++
@@ -15,6 +15,7 @@
classifiers=['Development Status :: 5 - Production/Stable',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
+ 'Programming Language :: Python :: 2.7',
'Topic :: Scientific/Engineering :: Astronomy',
'Topic :: Scientific/Engineering :: Visualization']
) |
e8e65f082ba73277cd99a02ede4d3f019a585088 | setup.py | setup.py | #!/usr/bin/env python
requires = ['requests', 'requests-oauthlib']
try:
from setuptools import setup
kw = {'entry_points':
"""[console_scripts]\nopenphoto = openphoto.main:main\n""",
'zip_safe': False,
'install_requires': requires
}
except ImportError:
from distutils.core import setup
kw = {'scripts': ['bin/openphoto'],
'requires': requires}
setup(name='openphoto',
version='0.3',
description='Python client library for Trovebox/Openphoto',
author='Pete Burgers, James Walker',
url='https://github.com/openphoto/openphoto-python',
packages=['openphoto'],
**kw
)
| #!/usr/bin/env python
requires = ['requests', 'requests_oauthlib']
try:
from setuptools import setup
kw = {'entry_points':
"""[console_scripts]\nopenphoto = openphoto.main:main\n""",
'zip_safe': False,
'install_requires': requires
}
except ImportError:
from distutils.core import setup
kw = {'scripts': ['bin/openphoto'],
'requires': requires}
setup(name='openphoto',
version='0.3',
description='Python client library for Trovebox/Openphoto',
author='Pete Burgers, James Walker',
url='https://github.com/openphoto/openphoto-python',
packages=['openphoto'],
**kw
)
| Correct requests_oauth package name, to fix distutils installation | Correct requests_oauth package name, to fix distutils installation
| Python | apache-2.0 | photo/openphoto-python,photo/openphoto-python | ---
+++
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-requires = ['requests', 'requests-oauthlib']
+requires = ['requests', 'requests_oauthlib']
try:
from setuptools import setup |
e7677e76e22e5cba305ba218676a5c870b940e7a | setup.py | setup.py | from setuptools import setup
from sys import version
if version < '2.6.0':
raise Exception("This module doesn't support any version less than 2.6")
import sys
sys.path.append("./test")
with open('README.rst', 'r') as f:
long_description = f.read()
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
"Programming Language :: Python",
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.0',
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2',
'Topic :: Software Development :: Libraries :: Python Modules'
]
setup(
author='Keita Oouchi',
author_email='keita.oouchi@gmail.com',
url = 'https://github.com/keitaoouchi/seleniumwrapper',
name = 'seleniumwrapper',
version = '0.1.4',
package_dir={"":"src"},
packages = ['seleniumwrapper'],
test_suite = "test_seleniumwrapper.suite",
license='BSD License',
classifiers=classifiers,
description = 'selenium webdriver wrapper to make manipulation easier.',
long_description=long_description,
)
| from setuptools import setup
from sys import version
if version < '2.6.0':
raise Exception("This module doesn't support any version less than 2.6")
import sys
sys.path.append("./test")
with open('README.rst', 'r') as f:
long_description = f.read()
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
"Programming Language :: Python",
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.0',
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2',
'Topic :: Software Development :: Libraries :: Python Modules'
]
setup(
author='Keita Oouchi',
author_email='keita.oouchi@gmail.com',
url = 'https://github.com/keitaoouchi/seleniumwrapper',
name = 'seleniumwrapper',
version = '0.1.5',
package_dir={"":"src"},
packages = ['seleniumwrapper'],
test_suite = "test_seleniumwrapper.suite",
license='BSD License',
classifiers=classifiers,
description = 'selenium webdriver wrapper to make manipulation easier.',
long_description=long_description,
)
| Change version 0.1.4 to 0.1.5 | Change version 0.1.4 to 0.1.5
| Python | bsd-3-clause | keitaoouchi/seleniumwrapper | ---
+++
@@ -32,7 +32,7 @@
author_email='keita.oouchi@gmail.com',
url = 'https://github.com/keitaoouchi/seleniumwrapper',
name = 'seleniumwrapper',
- version = '0.1.4',
+ version = '0.1.5',
package_dir={"":"src"},
packages = ['seleniumwrapper'],
test_suite = "test_seleniumwrapper.suite", |
aabc64d9e7dc2a4f2189650dac643781cc0f3e14 | setup.py | setup.py | from setuptools import setup
setup(name='pil-compat',
version='1.0.0',
packages=['Image',
'ImageDraw'],
description='Compatibility modules, bridging PIL -> Pillow',
author='Alistair Lynn',
author_email='alistair@alynn.co.uk',
url='http://github.com/prophile/pil-compat',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'License :: Other/Proprietary License',
'Programming Language :: Python',
'Topic :: Multimedia :: Graphics'
],
setup_requires=['wheel'],
install_requires=['pillow'])
| from setuptools import setup
setup(name='pil-compat',
version='1.0.0',
packages=['Image',
'ImageChops',
'ImageColor',
'ImageDraw',
'ImageEnhance',
'ImageFile',
'ImageFilter',
'ImageFont',
'ImageMath',
'ImageMorph',
'ImageOps',
'ImagePalette',
'ImagePath',
'ImageSequence',
'ImageStat'],
description='Compatibility modules, bridging PIL -> Pillow',
author='Alistair Lynn',
author_email='alistair@alynn.co.uk',
url='http://github.com/prophile/pil-compat',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'License :: Other/Proprietary License',
'Programming Language :: Python',
'Topic :: Multimedia :: Graphics'
],
setup_requires=['wheel'],
install_requires=['pillow'])
| Add the remaining PIL modules | Add the remaining PIL modules
| Python | mit | prophile/pil-compat,coxmediagroup/pil-compat | ---
+++
@@ -3,7 +3,20 @@
setup(name='pil-compat',
version='1.0.0',
packages=['Image',
- 'ImageDraw'],
+ 'ImageChops',
+ 'ImageColor',
+ 'ImageDraw',
+ 'ImageEnhance',
+ 'ImageFile',
+ 'ImageFilter',
+ 'ImageFont',
+ 'ImageMath',
+ 'ImageMorph',
+ 'ImageOps',
+ 'ImagePalette',
+ 'ImagePath',
+ 'ImageSequence',
+ 'ImageStat'],
description='Compatibility modules, bridging PIL -> Pillow',
author='Alistair Lynn',
author_email='alistair@alynn.co.uk', |
4eb9d9ce241c32ee3fbef58be3ef4a52b7ab10e0 | setup.py | setup.py | #!/usr/bin/env python
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
# Utility function to read the README file.
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='artifactory',
version='0.1.9',
py_modules=['artifactory'],
license='MIT License',
description='A Python to Artifactory interface',
long_description=read('README.md'),
author='Konstantin Nazarov',
author_email='knazarov@parallels.com',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Topic :: Software Development :: Libraries',
'Topic :: System :: Filesystems',
],
url='http://github.com/parallels/artifactory',
download_url='http://github.com/parallels/artifactory',
install_requires=['pathlib', 'requests', 'python-dateutil'],
zip_safe=False,
package_data = {'': ['README.md']}
)
| #!/usr/bin/env python
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
# Utility function to read the README file.
# To upload to PyPi, you need to have 'pypandoc'.
# Otherwise the readme will be clumsy.
try:
from pypandoc import convert
read_md = lambda fname: convert(os.path.join(os.path.dirname(__file__),
fname), 'rst')
except ImportError:
print("warning: pypandoc module not found," +
" could not convert Markdown to RST")
read_md = lambda fname: open(os.path.join(os.path.dirname(__file__),
fname), 'r').read()
setup(
name='artifactory',
version='0.1.9',
py_modules=['artifactory'],
license='MIT License',
description='A Python to Artifactory interface',
long_description=read_md('README.md'),
author='Konstantin Nazarov',
author_email='knazarov@parallels.com',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Topic :: Software Development :: Libraries',
'Topic :: System :: Filesystems',
],
url='http://github.com/parallels/artifactory',
download_url='http://github.com/parallels/artifactory',
install_requires=['pathlib', 'requests', 'python-dateutil'],
zip_safe=False,
package_data={'': ['README.md']}
)
| Convert README.md to RST when uploading to PyPi | Convert README.md to RST when uploading to PyPi
We want to keep the README in Markdown, to display on GitHub,
while still looking fine on PyPi.
| Python | mit | rabbitt/artifactory,Parallels/artifactory,rabbitt/artifactory | ---
+++
@@ -8,8 +8,17 @@
from distutils.core import setup
# Utility function to read the README file.
-def read(fname):
- return open(os.path.join(os.path.dirname(__file__), fname)).read()
+# To upload to PyPi, you need to have 'pypandoc'.
+# Otherwise the readme will be clumsy.
+try:
+ from pypandoc import convert
+ read_md = lambda fname: convert(os.path.join(os.path.dirname(__file__),
+ fname), 'rst')
+except ImportError:
+ print("warning: pypandoc module not found," +
+ " could not convert Markdown to RST")
+ read_md = lambda fname: open(os.path.join(os.path.dirname(__file__),
+ fname), 'r').read()
setup(
name='artifactory',
@@ -17,7 +26,7 @@
py_modules=['artifactory'],
license='MIT License',
description='A Python to Artifactory interface',
- long_description=read('README.md'),
+ long_description=read_md('README.md'),
author='Konstantin Nazarov',
author_email='knazarov@parallels.com',
classifiers=[
@@ -36,5 +45,5 @@
download_url='http://github.com/parallels/artifactory',
install_requires=['pathlib', 'requests', 'python-dateutil'],
zip_safe=False,
- package_data = {'': ['README.md']}
+ package_data={'': ['README.md']}
) |
b51e0ff9407f8a609be580d8fcb9cad6cfd267d8 | setup.py | setup.py | # Use setuptools if we can
try:
from setuptools.core import setup
except ImportError:
from distutils.core import setup
PACKAGE = 'django-render-as'
VERSION = '1.1'
package_data = {
'render_as': [
'templates/avoid_clash_with_real_app/*.html',
'templates/render_as/*.html',
],
}
setup(
name=PACKAGE, version=VERSION,
description="Template rendering indirector based on object class",
packages=[
'render_as',
'render_as/templatetags',
],
package_data=package_data,
license='MIT',
author='James Aylett',
author_email='james@tartarus.org',
install_requires=[
'Django~=1.10',
],
classifiers=[
'Intended Audience :: Developers',
'Framework :: Django',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
],
)
| # Use setuptools if we can
try:
from setuptools.core import setup
except ImportError:
from distutils.core import setup
PACKAGE = 'django-render-as'
VERSION = '1.2'
package_data = {
'render_as': [
'test_templates/avoid_clash_with_real_app/*.html',
'test_templates/render_as/*.html',
],
}
setup(
name=PACKAGE, version=VERSION,
description="Template rendering indirector based on object class",
packages=[
'render_as',
'render_as/templatetags',
],
package_data=package_data,
license='MIT',
author='James Aylett',
author_email='james@tartarus.org',
install_requires=[
'Django~=1.10',
],
classifiers=[
'Intended Audience :: Developers',
'Framework :: Django',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
],
)
| Include test templates in distributions. | Include test templates in distributions.
This probably wasn't working before, although apparently I didn't
notice. But then no one really runs tests for their 3PA, do they?
This is v1.2.
| Python | mit | jaylett/django-render-as,jaylett/django-render-as | ---
+++
@@ -5,12 +5,12 @@
from distutils.core import setup
PACKAGE = 'django-render-as'
-VERSION = '1.1'
+VERSION = '1.2'
package_data = {
'render_as': [
- 'templates/avoid_clash_with_real_app/*.html',
- 'templates/render_as/*.html',
+ 'test_templates/avoid_clash_with_real_app/*.html',
+ 'test_templates/render_as/*.html',
],
}
|
60a7b2c7a438cd3fb08e418e9e7d1ffb62fe1c89 | setup.py | setup.py | import re
from setuptools import setup
from io import open
__version__, = re.findall('__version__ = "(.*)"',
open('mappyfile/__init__.py').read())
def readme():
with open('README.rst', "r", encoding="utf-8") as f:
return f.read()
setup(name='mappyfile',
version=__version__,
description='A pure Python MapFile parser for working with MapServer',
long_description=readme(),
classifiers=[
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Intended Audience :: Developers',
'Topic :: Text Processing :: Linguistic',
'Topic :: Software Development :: Build Tools'
],
package_data={
'': ['*.g'],
'': ['schemas/*.json']
},
url='http://github.com/geographika/mappyfile',
author='Seth Girvin',
author_email='sethg@geographika.co.uk',
license='MIT',
packages=['mappyfile'],
install_requires=['lark-parser', 'jsonschema'],
zip_safe=False)
| import re
from setuptools import setup
from io import open
__version__, = re.findall('__version__ = "(.*)"',
open('mappyfile/__init__.py').read())
def readme():
with open('README.rst', "r", encoding="utf-8") as f:
return f.read()
setup(name='mappyfile',
version=__version__,
description='A pure Python MapFile parser for working with MapServer',
long_description=readme(),
classifiers=[
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Intended Audience :: Developers',
'Topic :: Text Processing :: Linguistic',
'Topic :: Software Development :: Build Tools'
],
package_data={
'': ['*.g'],
'schemas': ['schemas/*.json']
},
url='http://github.com/geographika/mappyfile',
author='Seth Girvin',
author_email='sethg@geographika.co.uk',
license='MIT',
packages=['mappyfile'],
install_requires=['lark-parser', 'jsonschema'],
zip_safe=False)
| Add json files to subfolder | Add json files to subfolder
| Python | mit | geographika/mappyfile,geographika/mappyfile | ---
+++
@@ -29,7 +29,7 @@
],
package_data={
'': ['*.g'],
- '': ['schemas/*.json']
+ 'schemas': ['schemas/*.json']
},
url='http://github.com/geographika/mappyfile',
author='Seth Girvin', |
fa773ead3f83e1674a428cb35c499a572ed50250 | 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',
'catsnap.config',
'catsnap.batch'],
install_requires=[
"Flask==0.9",
"gunicorn==0.14.6",
"boto==2.5.2",
"requests==0.13.2",
"argparse==1.2.1",
"psycopg2==2.4.6",
"sqlalchemy==0.8.0b2",
"yoyo-migrations==4.1.6",
"wand==0.3.3",
"celery==3.1.16",
"redis==2.10.3",
"gevent==1.1b5",
"Flask-Sockets==0.1",
"PyYAML==3.11",
"mock==1.0.1",
"nose==1.1.2",
"selenium==2.48",
"splinter==0.5.3",
"bcrypt==1.1.1",
],
)
| #!/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',
'catsnap.config',
'catsnap.batch'],
install_requires=[
"Flask==0.9",
"gunicorn==0.14.6",
"boto==2.40.0",
"requests==0.13.2",
"argparse==1.2.1",
"psycopg2==2.4.6",
"sqlalchemy==0.8.0b2",
"yoyo-migrations==4.1.6",
"wand==0.3.3",
"celery==3.1.16",
"redis==2.10.3",
"gevent==1.1b5",
"Flask-Sockets==0.1",
"PyYAML==3.11",
"mock==1.0.1",
"nose==1.1.2",
"selenium==2.48",
"splinter==0.5.3",
"bcrypt==1.1.1",
],
)
| Upgrade to a way newer boto | Upgrade to a way newer boto
Fixes an issue where content-type got %-escaped.
| Python | mit | ErinCall/catsnap,ErinCall/catsnap,ErinCall/catsnap | ---
+++
@@ -15,7 +15,7 @@
install_requires=[
"Flask==0.9",
"gunicorn==0.14.6",
- "boto==2.5.2",
+ "boto==2.40.0",
"requests==0.13.2",
"argparse==1.2.1",
"psycopg2==2.4.6", |
e0a468f8e7d56bd46a4e12af8959587dde8a7654 | setup.py | setup.py | # -*- coding: utf8 -*-
from setuptools import setup, find_packages
setup(
name='django-revisionfield',
version='0.2.2',
description = 'An model field that auto increments every time the model is'
' saved',
author='Bradley Ayers',
author_email='bradley.ayers@gmail.com',
license='Simplified BSD',
url='https://github.com/bradleyayers/django-revisionfield/',
packages=find_packages(),
install_requires=['Django >=1.2'],
tests_require=['Django >=1.2', 'Attest >=0.4', 'django-attest >=0.2.2',
'unittest-xml-reporting'],
test_loader='tests:loader',
test_suite='tests.everything',
classifiers = [
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)
| # -*- coding: utf8 -*-
from setuptools import setup, find_packages
setup(
name='django-revisionfield',
version='0.2.3.dev',
description = 'An model field that auto increments every time the model is'
' saved',
author='Bradley Ayers',
author_email='bradley.ayers@gmail.com',
license='Simplified BSD',
url='https://github.com/bradleyayers/django-revisionfield/',
packages=find_packages(),
install_requires=['Django >=1.2'],
tests_require=['Django >=1.2', 'Attest >=0.5.3', 'django-attest >=0.2.2',
'unittest-xml-reporting', 'pylint'],
test_loader='tests:loader',
test_suite='tests.everything',
classifiers = [
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)
| Update test requirements to Attest >=0.5.3, pylint. | Update test requirements to Attest >=0.5.3, pylint.
| Python | bsd-2-clause | bradleyayers/django-revisionfield | ---
+++
@@ -4,7 +4,7 @@
setup(
name='django-revisionfield',
- version='0.2.2',
+ version='0.2.3.dev',
description = 'An model field that auto increments every time the model is'
' saved',
@@ -16,8 +16,8 @@
packages=find_packages(),
install_requires=['Django >=1.2'],
- tests_require=['Django >=1.2', 'Attest >=0.4', 'django-attest >=0.2.2',
- 'unittest-xml-reporting'],
+ tests_require=['Django >=1.2', 'Attest >=0.5.3', 'django-attest >=0.2.2',
+ 'unittest-xml-reporting', 'pylint'],
test_loader='tests:loader',
test_suite='tests.everything', |
3feb567a74042e1174d8206b5f8cb945499b8ced | setup.py | setup.py | from setuptools import setup, find_packages
import os
import os.path as op
import uuid
import configparser
ver_file = os.path.join('popylar', 'version.py')
with open(ver_file) as f:
exec(f.read())
popylar_path = op.join(op.expanduser('~'), '.popylar')
# If UID file does not exist, then generate a UID and save to file.
# We don't overwrite an existing one in order to keep UIDs constant
# when the package is upgraded or installed in a venv.
if not os.path.exists(popylar_path):
parser = configparser.ConfigParser()
parser.read_dict(dict(user=dict(uid=uuid.uuid1().hex,
track=True)))
with open(popylar_path, 'w') as fhandle:
parser.write(fhandle)
PACKAGES = find_packages()
opts = dict(name=NAME,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
url=URL,
packages=PACKAGES,
download_url=DOWNLOAD_URL,
license=LICENSE,
classifiers=CLASSIFIERS,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
platforms=PLATFORMS,
version=VERSION,
requires=REQUIRES)
if __name__ == '__main__':
setup(**opts)
| from setuptools import setup, find_packages
import os
import os.path as op
import uuid
import configparser
ver_file = os.path.join('popylar', 'version.py')
with open(ver_file) as f:
exec(f.read())
popylar_path = op.join(op.expanduser('~'), '.popylar')
# If UID file does not exist, then generate a UID and save to file.
# We don't overwrite an existing one in order to keep UIDs constant
# when the package is upgraded or installed in a venv.
if not os.path.exists(popylar_path):
parser = configparser.ConfigParser()
parser.read_dict(dict(user=dict(uid=uuid.uuid1().hex,
track=True)))
with open(popylar_path, 'w') as fhandle:
parser.write(fhandle)
PACKAGES = find_packages()
opts = dict(name=NAME,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
url=URL,
packages=PACKAGES,
download_url=DOWNLOAD_URL,
license=LICENSE,
classifiers=CLASSIFIERS,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
platforms=PLATFORMS,
version=VERSION,
install_requires=REQUIRES,
requires=REQUIRES)
if __name__ == '__main__':
setup(**opts)
| Make sure that requirements are installed by pip. | Make sure that requirements are installed by pip.
| Python | bsd-2-clause | popylar/popylar | ---
+++
@@ -37,6 +37,7 @@
author_email=AUTHOR_EMAIL,
platforms=PLATFORMS,
version=VERSION,
+ install_requires=REQUIRES,
requires=REQUIRES)
|
2ce76787e2a827525615508a087e5e17d22534a9 | setup.py | setup.py | #########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
from setuptools import setup
setup(
zip_safe=True,
name='cloudify-vcloud-plugin',
version='1.2m6',
packages=[
'vcloud_plugin_common',
'server_plugin',
'network_plugin'
],
license='LICENSE',
description='Cloudify plugin for vmWare vCloud infrastructure.',
install_requires=[
'cloudify-plugins-common==3.2a7',
'pyvcloud==12c2',
'requests==2.4.3',
'IPy==0.81'
]
)
| #########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
from setuptools import setup
setup(
zip_safe=True,
name='cloudify-vcloud-plugin',
version='1.2m6',
packages=[
'vcloud_plugin_common',
'server_plugin',
'network_plugin'
],
license='LICENSE',
description='Cloudify plugin for vmWare vCloud infrastructure.',
install_requires=[
'cloudify-plugins-common==3.2a6',
'pyvcloud==12c2',
'requests==2.4.3',
'IPy==0.81'
]
)
| Change cloudify-plugin-common version back to 3.2a6 | Change cloudify-plugin-common version back to 3.2a6
| Python | apache-2.0 | kemiz/tosca-vcloud-plugin,nmishkin/tosca-vcloud-plugin,denismakogon/tosca-vcloud-plugin,vmware/tosca-vcloud-plugin,cloudify-cosmo/tosca-vcloud-plugin | ---
+++
@@ -27,7 +27,7 @@
license='LICENSE',
description='Cloudify plugin for vmWare vCloud infrastructure.',
install_requires=[
- 'cloudify-plugins-common==3.2a7',
+ 'cloudify-plugins-common==3.2a6',
'pyvcloud==12c2',
'requests==2.4.3',
'IPy==0.81' |
23b5b79fc0a107881d563221e7c7d284e6761868 | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
def get_description():
try:
with open("README.md") as f:
return f.read()
except IOError:
return ""
setup(name='ulp',
version='1.0.2',
author='Guilherme Victal',
author_email='guilherme at victal.eti.br',
url='https://github.com/victal/ulp',
description='ULP is a Locator Picker - a PathPicker clone for URLs',
long_description=get_description(),
license='MIT',
packages=['ulp', 'ulp.widgets'],
requires=['pyperclip', 'urwid'],
scripts=['scripts/ulp'],
entry_points={
'console_scripts': [
'ulp_extract=ulp.urlextract:main',
'ulp_tui=ulp.tui:main'
]
},
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 3 - Alpha',
# Indicate who your project is intended for
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: MIT License',
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
]
)
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
def get_description():
try:
with open("README.md") as f:
return f.read()
except IOError:
return ""
setup(name='ulp',
version='1.0.3',
author='Guilherme Victal',
author_email='guilherme at victal.eti.br',
url='https://github.com/victal/ulp',
description='ULP is a Locator Picker - a PathPicker clone for URLs',
long_description=get_description(),
license='MIT',
packages=['ulp', 'ulp.widgets'],
install_requires=['pyperclip', 'urwid'],
scripts=['scripts/ulp'],
entry_points={
'console_scripts': [
'ulp_extract=ulp.urlextract:main',
'ulp_tui=ulp.tui:main'
]
},
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 3 - Alpha',
# Indicate who your project is intended for
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: MIT License',
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
]
)
| Fix install dependencies and bump to 1.0.3 | Fix install dependencies and bump to 1.0.3
| Python | mit | victal/ulp,victal/ulp | ---
+++
@@ -13,7 +13,7 @@
setup(name='ulp',
- version='1.0.2',
+ version='1.0.3',
author='Guilherme Victal',
author_email='guilherme at victal.eti.br',
url='https://github.com/victal/ulp',
@@ -21,7 +21,7 @@
long_description=get_description(),
license='MIT',
packages=['ulp', 'ulp.widgets'],
- requires=['pyperclip', 'urwid'],
+ install_requires=['pyperclip', 'urwid'],
scripts=['scripts/ulp'],
entry_points={
'console_scripts': [ |
3e89599b12cb3a39528d1d3835241066412e3a29 | setup.py | setup.py | from setuptools import setup, find_packages
try:
import pypandoc
long_description=pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
long_description = "Whitespace interpreter written in Python 3"
setup(
name='whitepy',
version='0.0.1',
author='Yasser Nabi',
author_email='yassersaleemi@gmail.com',
packages=['whitepy'],
scripts=['whitepycli'],
package_data={'README.md': ['README.md']},
url='http://pypi.python.org/pypi/whitepy/',
license='LICENSE.txt',
description='Whitespace interpreter written in Python 3',
long_description=long_description,
install_requires=[
"click == 6.7",
"readchar == 0.7",
],
)
| from setuptools import setup, find_packages
version = '0.2'
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
long_description = "Whitespace interpreter written in Python 3"
setup(
name='whitepy',
version=version,
author='Yasser Nabi',
author_email='yassersaleemi@gmail.com',
packages=['whitepy'],
scripts=['whitepycli'],
package_data={'README.md': ['README.md']},
url='https://github.com/yasn77/whitepy',
download_url='https://github.com/yasn77/whitepy/archive/{}.tar.gz'.format(version),
license='LICENSE.txt',
description='Whitespace interpreter written in Python 3',
long_description=long_description,
install_requires=[
"click == 6.7",
"readchar == 0.7",
],
)
| Prepare for adding to pypi | Prepare for adding to pypi
| Python | apache-2.0 | yasn77/whitepy | ---
+++
@@ -1,20 +1,23 @@
from setuptools import setup, find_packages
+
+version = '0.2'
try:
import pypandoc
- long_description=pypandoc.convert('README.md', 'rst')
+ long_description = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
long_description = "Whitespace interpreter written in Python 3"
setup(
name='whitepy',
- version='0.0.1',
+ version=version,
author='Yasser Nabi',
author_email='yassersaleemi@gmail.com',
packages=['whitepy'],
scripts=['whitepycli'],
package_data={'README.md': ['README.md']},
- url='http://pypi.python.org/pypi/whitepy/',
+ url='https://github.com/yasn77/whitepy',
+ download_url='https://github.com/yasn77/whitepy/archive/{}.tar.gz'.format(version),
license='LICENSE.txt',
description='Whitespace interpreter written in Python 3',
long_description=long_description, |
dde846475bc3584e4269300b754573a0c4a34170 | setup.py | setup.py | #!/usr/bin/env python
# coding: utf8
# Copyright 2013-2015 Vincent Jacques <vincent@vincent-jacques.net>
import setuptools
version = "0.5.0"
setuptools.setup(
name="MockMockMock",
version=version,
description="Mocking library focusing on very explicit definition of the mocks' behaviour",
author="Vincent Jacques",
author_email="vincent@vincent-jacques.net",
url="http://pythonhosted.org/MockMockMock",
packages=setuptools.find_packages(),
license="MIT",
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python",
"Topic :: Software Development",
],
test_suite="MockMockMock.tests.AllTests",
use_2to3=True,
command_options={
"build_sphinx": {
"version": ("setup.py", version),
"release": ("setup.py", version),
"source_dir": ("setup.py", "doc"),
},
},
)
| #!/usr/bin/env python
# coding: utf8
# Copyright 2013-2015 Vincent Jacques <vincent@vincent-jacques.net>
import setuptools
version = "0.5.1"
setuptools.setup(
name="MockMockMock",
version=version,
description="Mocking library focusing on very explicit definition of the mocks' behaviour",
author="Vincent Jacques",
author_email="vincent@vincent-jacques.net",
url="http://pythonhosted.org/MockMockMock",
packages=setuptools.find_packages(),
license="MIT",
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python",
"Topic :: Software Development",
],
test_suite="MockMockMock.tests.AllTests",
use_2to3=True,
command_options={
"build_sphinx": {
"version": ("setup.py", version),
"release": ("setup.py", version),
"source_dir": ("setup.py", "doc"),
},
},
)
| Test deployment to PyPI from Travis | Test deployment to PyPI from Travis
| Python | mit | jacquev6/MockMockMock | ---
+++
@@ -5,7 +5,7 @@
import setuptools
-version = "0.5.0"
+version = "0.5.1"
setuptools.setup( |
336bfa47f24c01c8033c88d4dc60cfb3f117b7dd | setup.py | setup.py | import setuptools
from savanna.openstack.common import setup as common_setup
requires = common_setup.parse_requirements()
depend_links = common_setup.parse_dependency_links()
project = 'savanna'
setuptools.setup(
name=project,
version=common_setup.get_version(project, '0.1'),
description='Savanna project',
author='Mirantis Inc.',
author_email='savanna-team@mirantis.com',
url='http://savanna.mirantis.com',
classifiers=[
'Environment :: OpenStack',
'Intended Audience :: Information Technology',
'Intended Audience :: System Administrators',
'Intended Audience :: BigDate',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
],
license='Apache Software License',
cmdclass=common_setup.get_cmdclass(),
packages=setuptools.find_packages(exclude=['bin']),
package_data={'savanna': ['resources/*.template']},
install_requires=requires,
dependency_links=depend_links,
include_package_data=True,
test_suite='nose.collector',
scripts=[
'bin/savanna-api',
'bin/savanna-manage',
],
py_modules=[],
data_files=[
('share/savanna',
[
'etc/savanna/savanna.conf.sample',
'etc/savanna/savanna.conf.sample-full',
]),
],
)
| import setuptools
from savanna.openstack.common import setup as common_setup
requires = common_setup.parse_requirements()
depend_links = common_setup.parse_dependency_links()
project = 'savanna'
setuptools.setup(
name=project,
version=common_setup.get_version(project, '0.1'),
description='Savanna project',
author='Mirantis Inc.',
author_email='savanna-team@mirantis.com',
url='http://savanna.mirantis.com',
classifiers=[
'Environment :: OpenStack',
'Intended Audience :: Information Technology',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
],
license='Apache Software License',
cmdclass=common_setup.get_cmdclass(),
packages=setuptools.find_packages(exclude=['bin']),
package_data={'savanna': ['resources/*.template']},
install_requires=requires,
dependency_links=depend_links,
include_package_data=True,
test_suite='nose.collector',
scripts=[
'bin/savanna-api',
'bin/savanna-manage',
],
py_modules=[],
data_files=[
('share/savanna',
[
'etc/savanna/savanna.conf.sample',
'etc/savanna/savanna.conf.sample-full',
]),
],
)
| Remove an invalid trove classifier. | Remove an invalid trove classifier.
* setup.py(setuptools.setup): Remove "Intended Audience :: BigDate"
since it's not in pypi's list of valid trove classifiers and
prevents successful upload of the package when present.
Change-Id: Iee487d1737a12158bb181d21ae841d07e0820e10
| Python | apache-2.0 | zhujzhuo/Sahara,matips/iosr-2015,bigfootproject/sahara,bigfootproject/sahara,zhangjunli177/sahara,keedio/sahara,esikachev/scenario,henaras/sahara,xme1226/sahara,egafford/sahara,esikachev/sahara-backup,bigfootproject/sahara,tellesnobrega/storm_plugin,xme1226/sahara,esikachev/sahara-backup,mapr/sahara,tellesnobrega/sahara,ekasitk/sahara,esikachev/scenario,esikachev/sahara-backup,crobby/sahara,ekasitk/sahara,xme1226/sahara,citrix-openstack-build/sahara,tellesnobrega/storm_plugin,tellesnobrega/storm_plugin,crobby/sahara,rnirmal/savanna,zhangjunli177/sahara,mapr/sahara,redhat-openstack/sahara,citrix-openstack-build/sahara,redhat-openstack/sahara,tellesnobrega/sahara,openstack/sahara,matips/iosr-2015,rnirmal/savanna,keedio/sahara,keedio/sahara,ekasitk/sahara,citrix-openstack-build/sahara,henaras/sahara,matips/iosr-2015,zhangjunli177/sahara,henaras/sahara,zhujzhuo/Sahara,egafford/sahara,zhujzhuo/Sahara,redhat-openstack/sahara,openstack/sahara,crobby/sahara,esikachev/scenario,mapr/sahara | ---
+++
@@ -17,7 +17,6 @@
'Environment :: OpenStack',
'Intended Audience :: Information Technology',
'Intended Audience :: System Administrators',
- 'Intended Audience :: BigDate',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python', |
d1125a4b1a73277f783225bdf2c04a722332bc91 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name = "images_of",
version = "0.1.0",
author = "acimi-ursi",
description = "Tools for managing the ImagesOfNetwork on reddit",
url = "https://github.com/amici-ursi/ImagesOfNetwork",
packages = find_packages(),
install_requires = [
"click",
"praw==3.4",
"pytoml",
],
entry_points = {
"console_scripts": [
"ion_expand = images_of.entrypoints.expand:main",
"ion_setup_oauth = images_of.entrypoints.oauth:main",
"ion_bot = images_of.entrypoints.bot:main",
"ion_propagate = images_of.entrypoints.propagate:main",
"ion_invite_mods = images_of.entrypoints.invite_mods:main",
"ion_bulkmail = images_of.entrypoints.bulkmail:main",
"ion_audit_mods = images_of.entrypoints.audit_mods:main",
"ion_blacklist_requests = images_of.entrypoints.blacklist_requests.py:main",
],
},
data_files = [
('images_of', 'data/*.toml'),
],
)
| #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name = "images_of",
version = "0.1.0",
author = "acimi-ursi",
description = "Tools for managing the ImagesOfNetwork on reddit",
url = "https://github.com/amici-ursi/ImagesOfNetwork",
packages = find_packages(),
install_requires = [
"click",
"praw==3.4",
"pytoml",
],
entry_points = {
"console_scripts": [
"ion_expand = images_of.entrypoints.expand:main",
"ion_setup_oauth = images_of.entrypoints.oauth:main",
"ion_bot = images_of.entrypoints.bot:main",
"ion_propagate = images_of.entrypoints.propagate:main",
"ion_invite_mods = images_of.entrypoints.invite_mods:main",
"ion_bulkmail = images_of.entrypoints.bulkmail:main",
"ion_audit_mods = images_of.entrypoints.audit_mods:main",
"ion_blacklist_requests = images_of.entrypoints.blacklist_requests:main",
],
},
data_files = [
('images_of', 'data/*.toml'),
],
)
| Fix entry point for blacklist_requests | Fix entry point for blacklist_requests | Python | mit | scowcron/ImagesOfNetwork,amici-ursi/ImagesOfNetwork | ---
+++
@@ -26,7 +26,7 @@
"ion_invite_mods = images_of.entrypoints.invite_mods:main",
"ion_bulkmail = images_of.entrypoints.bulkmail:main",
"ion_audit_mods = images_of.entrypoints.audit_mods:main",
- "ion_blacklist_requests = images_of.entrypoints.blacklist_requests.py:main",
+ "ion_blacklist_requests = images_of.entrypoints.blacklist_requests:main",
],
},
|
1f3c60342d1599faf245377d753aa53f15f6805c | setup.py | setup.py | from setuptools import setup
setup(
name='django-waffle',
version='0.1.1',
description='A feature flipper for Django.',
long_description=open('README.rst').read(),
author='James Socol',
author_email='james.socol@gmail.com',
url='http://github.com/jsocol/bleach',
license='BSD',
packages=['waffle'],
include_package_data=True,
package_data = { '': ['README.rst'] },
zip_safe=False,
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
]
)
| from setuptools import setup
setup(
name='django-waffle',
version='0.1.1',
description='A feature flipper for Django.',
long_description=open('README.rst').read(),
author='James Socol',
author_email='james.socol@gmail.com',
url='http://github.com/jsocol/django-waffle',
license='BSD',
packages=['waffle'],
include_package_data=True,
package_data = { '': ['README.rst'] },
zip_safe=False,
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
]
)
| Update the PyPI home page URL. | Update the PyPI home page URL.
| Python | bsd-3-clause | VladimirFilonov/django-waffle,isotoma/django-waffle,willkg/django-waffle,hwkns/django-waffle,VladimirFilonov/django-waffle,engagespark/django-waffle,ekohl/django-waffle,webus/django-waffle,rlr/django-waffle,engagespark/django-waffle,styleseat/django-waffle,ilanbm/django-waffle,safarijv/django-waffle,isotoma/django-waffle,TwigWorld/django-waffle,rsalmaso/django-waffle,11craft/django-waffle,rsalmaso/django-waffle,safarijv/django-waffle,JeLoueMonCampingCar/django-waffle,mark-adams/django-waffle,engagespark/django-waffle,groovecoder/django-waffle,mark-adams/django-waffle,groovecoder/django-waffle,rlr/django-waffle,rlr/django-waffle,styleseat/django-waffle,rsalmaso/django-waffle,isotoma/django-waffle,rlr/django-waffle,ilanbm/django-waffle,webus/django-waffle,mwaaas/django-waffle-session,groovecoder/django-waffle,crccheck/django-waffle,styleseat/django-waffle,TwigWorld/django-waffle,JeLoueMonCampingCar/django-waffle,rodgomes/django-waffle,paulcwatts/django-waffle,paulcwatts/django-waffle,festicket/django-waffle,festicket/django-waffle,isotoma/django-waffle,rodgomes/django-waffle,hwkns/django-waffle,paulcwatts/django-waffle,festicket/django-waffle,mark-adams/django-waffle,mwaaas/django-waffle-session,crccheck/django-waffle,safarijv/django-waffle,rsalmaso/django-waffle,TwigWorld/django-waffle,webus/django-waffle,JeLoueMonCampingCar/django-waffle,hwkns/django-waffle,JeLoueMonCampingCar/django-waffle,hwkns/django-waffle,mark-adams/django-waffle,festicket/django-waffle,styleseat/django-waffle,willkg/django-waffle,safarijv/django-waffle,groovecoder/django-waffle,crccheck/django-waffle,VladimirFilonov/django-waffle,mwaaas/django-waffle-session,rodgomes/django-waffle,ekohl/django-waffle,11craft/django-waffle,VladimirFilonov/django-waffle,crccheck/django-waffle,engagespark/django-waffle,webus/django-waffle,ilanbm/django-waffle,ilanbm/django-waffle,rodgomes/django-waffle,mwaaas/django-waffle-session,paulcwatts/django-waffle | ---
+++
@@ -7,7 +7,7 @@
long_description=open('README.rst').read(),
author='James Socol',
author_email='james.socol@gmail.com',
- url='http://github.com/jsocol/bleach',
+ url='http://github.com/jsocol/django-waffle',
license='BSD',
packages=['waffle'],
include_package_data=True, |
003034caa0072d3e13b997df219b6612ae4b128e | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
version = "0.1.1"
setup(name="riemann-sumd",
version=version,
description="Python agent for scheduling event generating processes and sending the results to Riemann",
author="Brian Hatfield",
author_email="bmhatfield@gmail.com",
url="https://github.com/bmhatfield/riemann-sumd",
package_dir={'': 'lib'},
py_modules=['event', 'loader', 'scheduler', 'sender', 'task'],
data_files=[('/etc/init/', ["init/ubuntu/sumd.conf"]),
('/etc/sumd', ['examples/etc/sumd/sumd.conf']),
('/etc/sumd/tasks.d', ['examples/etc/sumd/tasks.d/simple.task.example']),
('/etc/sumd/tags.d', ['examples/etc/sumd/tags.d/simple.tag.example'])],
scripts=["bin/sumd"]
) | #!/usr/bin/env python
from distutils.core import setup
version = "0.2.0"
setup(name="riemann-sumd",
version=version,
description="Python agent for scheduling event generating processes and sending the results to Riemann",
author="Brian Hatfield",
author_email="bmhatfield@gmail.com",
url="https://github.com/bmhatfield/riemann-sumd",
package_dir={'': 'lib'},
py_modules=['event', 'loader', 'scheduler', 'sender', 'task'],
data_files=[('/etc/init/', ["init/ubuntu/sumd.conf"]),
('/etc/sumd', ['examples/etc/sumd/sumd.conf']),
('/etc/sumd/tasks.d', ['examples/etc/sumd/tasks.d/simple.task.example']),
('/etc/sumd/tags.d', ['examples/etc/sumd/tags.d/simple.tag.example'])],
scripts=["bin/sumd"],
install_requires=[
"pyyaml",
"python-daemon",
"bernhard>=0.0.5",
"requests"
]
)
| Update Riemann-sumd version, add install_requires | Update Riemann-sumd version, add install_requires
| Python | mit | crashlytics/riemann-sumd | ---
+++
@@ -1,7 +1,7 @@
#!/usr/bin/env python
from distutils.core import setup
-version = "0.1.1"
+version = "0.2.0"
setup(name="riemann-sumd",
version=version,
@@ -15,5 +15,11 @@
('/etc/sumd', ['examples/etc/sumd/sumd.conf']),
('/etc/sumd/tasks.d', ['examples/etc/sumd/tasks.d/simple.task.example']),
('/etc/sumd/tags.d', ['examples/etc/sumd/tags.d/simple.tag.example'])],
- scripts=["bin/sumd"]
- )
+ scripts=["bin/sumd"],
+ install_requires=[
+ "pyyaml",
+ "python-daemon",
+ "bernhard>=0.0.5",
+ "requests"
+ ]
+) |
14a4bb5db566c5027d1b6fa9f715e1c984442137 | setup.py | setup.py | import os
from setuptools import setup
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='timeflow',
packages=['timeflow'],
version='0.1',
description='Small CLI time logger',
author='Justas Trimailovas',
author_email='j.trimailvoas@gmail.com',
url='https://github.com/trimailov/timeflow',
keywords=['timelogger', 'logging', 'timetracker', 'tracker'],
long_description=read('README.rst'),
entry_points='''
[console_scripts]
timeflow=timeflow.main:main
tf=timeflow.main:main
''',
)
| import os
from setuptools import setup
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='timeflow',
packages=['timeflow'],
version='0.1.1',
description='Small CLI time logger',
author='Justas Trimailovas',
author_email='j.trimailvoas@gmail.com',
url='https://github.com/trimailov/timeflow',
keywords=['timelogger', 'logging', 'timetracker', 'tracker'],
long_description=read('README.rst'),
entry_points='''
[console_scripts]
timeflow=timeflow.main:main
tf=timeflow.main:main
''',
)
| Bump up the version after fix | Bump up the version after fix
| Python | mit | trimailov/timeflow | ---
+++
@@ -12,7 +12,7 @@
setup(
name='timeflow',
packages=['timeflow'],
- version='0.1',
+ version='0.1.1',
description='Small CLI time logger',
author='Justas Trimailovas', |
e16a6c3012dfc8138b889e539c62eb391ce847e2 | setup.py | setup.py | import os
from setuptools import setup
from withtool import __version__
def read(fname):
path = os.path.join(os.path.dirname(__file__), fname)
with open(path, encoding='utf-8') as f:
return f.read()
setup(
name='with',
version=__version__,
description='A shell context manager',
long_description=read('README.rst'),
author='Renan Ivo',
author_email='renanivom@gmail.com',
url='https://github.com/renanivo/with',
keywords='context manager shell command line repl',
scripts=['bin/with'],
install_requires=[
'appdirs==1.4.3',
'docopt==0.6.2',
'prompt-toolkit==1.0',
'python-slugify==1.2.2',
],
packages=['withtool'],
classifiers=[
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
]
)
| import os
from setuptools import setup
from withtool import __version__
def read(fname):
path = os.path.join(os.path.dirname(__file__), fname)
with open(path, encoding='utf-8') as f:
return f.read()
setup(
name='with',
version=__version__,
description='A shell context manager',
long_description=read('README.rst'),
author='Renan Ivo',
author_email='renanivom@gmail.com',
url='https://github.com/renanivo/with',
keywords='context manager shell command line repl',
scripts=['bin/with'],
install_requires=[
'appdirs==1.4.3',
'docopt==0.6.2',
'prompt-toolkit==1.0',
'python-slugify==1.2.3',
],
packages=['withtool'],
classifiers=[
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
]
)
| Upgrade dependency python-slugify to ==1.2.3 | Upgrade dependency python-slugify to ==1.2.3
| Python | mit | renanivo/with | ---
+++
@@ -25,7 +25,7 @@
'appdirs==1.4.3',
'docopt==0.6.2',
'prompt-toolkit==1.0',
- 'python-slugify==1.2.2',
+ 'python-slugify==1.2.3',
],
packages=['withtool'],
classifiers=[ |
412e195da29b4f4fc7b72967c192714a6f5eaeb5 | setup.py | setup.py | #!/usr/bin/env python
import os
from setuptools import setup, find_packages
from version import get_git_version
VERSION, SOURCE_LABEL = get_git_version()
PROJECT = 'yakonfig'
AUTHOR = 'Diffeo, Inc.'
AUTHOR_EMAIL = 'support@diffeo.com'
URL = 'http://github.com/diffeo/yakonfig'
DESC = 'load a configuration dictionary for a large application'
def read_file(file_name):
with open(os.path.join(os.path.dirname(__file__), file_name), 'r') as f:
return f.read()
setup(
name=PROJECT,
version=VERSION,
description=DESC,
license=read_file('LICENSE.txt'),
long_description=read_file('README.md'),
# source_label=SOURCE_LABEL,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
url=URL,
packages=find_packages(),
classifiers=[
'Programming Language :: Python :: 2.7',
'Development Status :: 3 - Alpha',
'Topic :: Utilities',
# MIT/X11 license http://opensource.org/licenses/MIT
'License :: OSI Approved :: MIT License',
],
tests_require=[
'pexpect',
],
install_requires=[
'importlib',
'pyyaml',
'six',
],
)
| #!/usr/bin/env python
import os
from setuptools import setup, find_packages
from version import get_git_version
VERSION, SOURCE_LABEL = get_git_version()
PROJECT = 'yakonfig'
AUTHOR = 'Diffeo, Inc.'
AUTHOR_EMAIL = 'support@diffeo.com'
URL = 'http://github.com/diffeo/yakonfig'
DESC = 'load a configuration dictionary for a large application'
def read_file(file_name):
with open(os.path.join(os.path.dirname(__file__), file_name), 'r') as f:
return f.read()
setup(
name=PROJECT,
version=VERSION,
description=DESC,
license=read_file('LICENSE.txt'),
long_description=read_file('README.md'),
# source_label=SOURCE_LABEL,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
url=URL,
packages=find_packages(),
classifiers=[
'Programming Language :: Python :: 2.7',
'Development Status :: 3 - Alpha',
'Topic :: Utilities',
# MIT/X11 license http://opensource.org/licenses/MIT
'License :: OSI Approved :: MIT License',
],
install_requires=[
'pyyaml',
'six',
],
)
| Clean up dependencies (no importlib) | Clean up dependencies (no importlib)
| Python | mit | diffeo/yakonfig | ---
+++
@@ -33,11 +33,7 @@
# MIT/X11 license http://opensource.org/licenses/MIT
'License :: OSI Approved :: MIT License',
],
- tests_require=[
- 'pexpect',
- ],
install_requires=[
- 'importlib',
'pyyaml',
'six',
], |
9ae2abd28cfc1d913791b1548677d98081777489 | setup.py | setup.py | # Copyright 2015 Bloomberg Finance L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from setuptools import setup, find_packages
setup(name='bqplot',
version='0.2.0',
include_package_data=True,
install_requires=['ipython', 'numpy'],
packages=find_packages(),
zip_safe=False)
| # Copyright 2015 Bloomberg Finance L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from setuptools import setup, find_packages
setup(name='bqplot',
version='0.2.0',
include_package_data=True,
install_requires=['ipython', 'numpy', 'pandas'],
packages=find_packages(),
zip_safe=False)
| Add pandas to the dependencies | Add pandas to the dependencies
| Python | apache-2.0 | SylvainCorlay/bqplot,SylvainCorlay/bqplot,ChakriCherukuri/bqplot,rmenegaux/bqplot,rmenegaux/bqplot,bloomberg/bqplot,dmadeka/bqplot,ChakriCherukuri/bqplot,SylvainCorlay/bqplot,ChakriCherukuri/bqplot,ssunkara1/bqplot,ssunkara1/bqplot,bloomberg/bqplot,bloomberg/bqplot,dmadeka/bqplot | ---
+++
@@ -17,6 +17,6 @@
setup(name='bqplot',
version='0.2.0',
include_package_data=True,
- install_requires=['ipython', 'numpy'],
+ install_requires=['ipython', 'numpy', 'pandas'],
packages=find_packages(),
zip_safe=False) |
5d7057bc34e10070a5b3f825618e87ad91fcbfea | stack.py | stack.py | #!/usr/bin/env python
'''Implementation of a simple stack data structure.
The stack has push, pop, and peek methods.
'''
class Item(object):
def __init__(self):
pass
class Stack(object):
def __init__(self):
pass
| #!/usr/bin/env python
'''Implementation of a simple stack data structure.
The stack has push, pop, and peek methods. Items in the stack have a value,
and next_item attribute. The stack has a top attribute.
'''
class Item(object):
def __init__(self, value, next_item=None):
self.value = value
self.next_item = next_item
class Stack(object):
def __init__(self, top=None):
self.top = top
| Add attributes to Stack and Item classes | Add attributes to Stack and Item classes
| Python | mit | jwarren116/data-structures-deux | ---
+++
@@ -1,15 +1,17 @@
#!/usr/bin/env python
'''Implementation of a simple stack data structure.
-The stack has push, pop, and peek methods.
+The stack has push, pop, and peek methods. Items in the stack have a value,
+and next_item attribute. The stack has a top attribute.
'''
class Item(object):
- def __init__(self):
- pass
+ def __init__(self, value, next_item=None):
+ self.value = value
+ self.next_item = next_item
class Stack(object):
- def __init__(self):
- pass
+ def __init__(self, top=None):
+ self.top = top |
c6fc60ec33c98b0a4b6272f5304b76477f5955f8 | src/dynmen/dmenu.py | src/dynmen/dmenu.py | # -*- coding: utf-8 -*-
from os import path as _path
from dynmen.common import TraitMenu as _TraitMenu
from dynmen.generator import (AddOptions as _AddOptions,
load_options as _load_options,)
_dirname = _path.dirname(_path.abspath(__file__))
_path = _path.join(_dirname, 'data/dmenu_opts.json')
@_AddOptions(*_load_options(_path))
class DMenu(_TraitMenu):
_base_command = ['dmenu']
| # -*- coding: utf-8 -*-
from os import path as _path
from dynmen.common import TraitMenu as _TraitMenu
from dynmen.generator import (AddOptions as _AddOptions,
load_options as _load_options,)
_dirname = _path.dirname(_path.abspath(__file__))
_path = _path.join(_dirname, 'data/dmenu_opts.json')
@_AddOptions(*_load_options(_path))
class DMenu(_TraitMenu):
_base_command = ['dmenu']
_aliases = (
('i', 'case_insensitive'),
('p', 'prompt'),
('fn', 'font'),
)
| Add a few aliases to DMenu | Add a few aliases to DMenu
| Python | mit | frostidaho/dynmen | ---
+++
@@ -11,4 +11,9 @@
@_AddOptions(*_load_options(_path))
class DMenu(_TraitMenu):
_base_command = ['dmenu']
+ _aliases = (
+ ('i', 'case_insensitive'),
+ ('p', 'prompt'),
+ ('fn', 'font'),
+ )
|
55b4e25bcb61e4d6e26ce9ea148dc3577e065873 | setup.py | setup.py | # -*- coding: utf-8 -*-
import sys
from setuptools import setup, find_packages
IS_PY3 = sys.version_info > (3,)
install_requires = (
'cnx-archive',
'cnx-epub',
'jinja2',
'openstax-accounts>=0.8',
'psycopg2',
'pyramid>=1.5',
'pyramid_multiauth',
)
tests_require = [
'webtest',
]
extras_require = {
'test': tests_require,
}
description = """\
Application for accepting publication requests to the Connexions Archive."""
if not IS_PY3:
tests_require.append('mock')
setup(
name='cnx-publishing',
version='0.1',
author='Connexions team',
author_email='info@cnx.org',
url="https://github.com/connexions/cnx-publishing",
license='LGPL, See also LICENSE.txt',
description=description,
install_requires=install_requires,
tests_require=tests_require,
extras_require=extras_require,
test_suite='cnxpublishing.tests',
packages=find_packages(),
include_package_data=True,
package_data={
'cnxpublishing': ['sql/*.sql', 'sql/*/*.sql'],
},
entry_points="""\
[paste.app_factory]
main = cnxpublishing.main:main
[console_scripts]
cnx-publishing-initdb = cnxpublishing.scripts.initdb:main
""",
)
| # -*- coding: utf-8 -*-
import sys
from setuptools import setup, find_packages
IS_PY3 = sys.version_info > (3,)
install_requires = (
'cnx-archive',
'cnx-epub',
'jinja2',
'openstax-accounts>=0.10.0',
'psycopg2',
'pyramid>=1.5',
'pyramid_multiauth',
)
tests_require = [
'webtest',
]
extras_require = {
'test': tests_require,
}
description = """\
Application for accepting publication requests to the Connexions Archive."""
if not IS_PY3:
tests_require.append('mock')
setup(
name='cnx-publishing',
version='0.1',
author='Connexions team',
author_email='info@cnx.org',
url="https://github.com/connexions/cnx-publishing",
license='LGPL, See also LICENSE.txt',
description=description,
install_requires=install_requires,
tests_require=tests_require,
extras_require=extras_require,
test_suite='cnxpublishing.tests',
packages=find_packages(),
include_package_data=True,
package_data={
'cnxpublishing': ['sql/*.sql', 'sql/*/*.sql'],
},
entry_points="""\
[paste.app_factory]
main = cnxpublishing.main:main
[console_scripts]
cnx-publishing-initdb = cnxpublishing.scripts.initdb:main
""",
)
| Use the latest openstax-accounts (0.10.0) | Use the latest openstax-accounts (0.10.0)
| Python | agpl-3.0 | Connexions/cnx-publishing,Connexions/cnx-publishing,Connexions/cnx-publishing | ---
+++
@@ -9,7 +9,7 @@
'cnx-archive',
'cnx-epub',
'jinja2',
- 'openstax-accounts>=0.8',
+ 'openstax-accounts>=0.10.0',
'psycopg2',
'pyramid>=1.5',
'pyramid_multiauth', |
81d526bb3da4f103462f17d66af25cac83de4d63 | setup.py | setup.py | """ Setup script for PyPI """
import os
from setuptools import setup
try:
from ConfigParser import SafeConfigParser
except ImportError:
from configparser import SafeConfigParser
settings = SafeConfigParser()
settings.read(os.path.realpath('aws_ec2_assign_elastic_ip/settings.conf'))
setup(
name='aws-ec2-assign-elastic-ip',
version=settings.get('general', 'version'),
license='Apache License, Version 2.0',
description='Automatically assign Elastic IPs to AWS EC2 instances',
author='Sebastian Dahlgren, Skymill Solutions',
author_email='sebastian.dahlgren@skymill.se',
url='https://github.com/skymill/aws-ec2-assign-elastic-ip',
keywords="aws amazon web services ec2 as elasticip eip",
platforms=['Any'],
packages=['aws_ec2_assign_elastic_ip'],
scripts=['aws-ec2-assign-elastic-ip'],
include_package_data=True,
zip_safe=False,
install_requires=['boto >= 2.36.0', 'netaddr >= 0.7.12'],
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python'
]
)
| """ Setup script for PyPI """
import os
from setuptools import setup
try:
from ConfigParser import SafeConfigParser
except ImportError:
from configparser import SafeConfigParser
settings = SafeConfigParser()
settings.read(os.path.realpath('aws_ec2_assign_elastic_ip/settings.conf'))
with open('README.md', 'r') as fh:
long_description = fh.read()
setup(
name='aws-ec2-assign-elastic-ip',
version=settings.get('general', 'version'),
license='Apache License, Version 2.0',
description='Automatically assign Elastic IPs to AWS EC2 instances',
long_description=long_description,
long_description_content_type='text/markdown',
author='Sebastian Dahlgren, Skymill Solutions',
author_email='sebastian.dahlgren@skymill.se',
url='https://github.com/skymill/aws-ec2-assign-elastic-ip',
keywords="aws amazon web services ec2 as elasticip eip",
platforms=['Any'],
packages=['aws_ec2_assign_elastic_ip'],
scripts=['aws-ec2-assign-elastic-ip'],
include_package_data=True,
zip_safe=False,
install_requires=['boto >= 2.36.0', 'netaddr >= 0.7.12'],
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python'
]
)
| Add PyPI long project description | Add PyPI long project description
| Python | apache-2.0 | skymill/aws-ec2-assign-elastic-ip | ---
+++
@@ -9,12 +9,16 @@
settings = SafeConfigParser()
settings.read(os.path.realpath('aws_ec2_assign_elastic_ip/settings.conf'))
+with open('README.md', 'r') as fh:
+ long_description = fh.read()
setup(
name='aws-ec2-assign-elastic-ip',
version=settings.get('general', 'version'),
license='Apache License, Version 2.0',
description='Automatically assign Elastic IPs to AWS EC2 instances',
+ long_description=long_description,
+ long_description_content_type='text/markdown',
author='Sebastian Dahlgren, Skymill Solutions',
author_email='sebastian.dahlgren@skymill.se',
url='https://github.com/skymill/aws-ec2-assign-elastic-ip', |
de276ee4b006b1f207a0692c1cfda3ecbd9b38fd | setup.py | setup.py | from setuptools import setup, find_packages
__version__ = "unknown"
# "import" __version__
for line in open("sfs/__init__.py"):
if line.startswith("__version__"):
exec(line)
break
setup(
name="sfs",
version=__version__,
packages=find_packages(),
install_requires=[
'numpy!=1.11.0', # https://github.com/sfstoolbox/sfs-python/issues/11
'scipy',
],
author="SFS Toolbox Developers",
author_email="sfstoolbox@gmail.com",
description="Sound Field Synthesis Toolbox",
long_description=open('README.rst').read(),
license="MIT",
keywords="audio SFS WFS Ambisonics".split(),
url="http://github.com/sfstoolbox/",
platforms='any',
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Scientific/Engineering",
],
zip_safe=True,
)
| from setuptools import setup, find_packages
__version__ = "unknown"
# "import" __version__
for line in open("sfs/__init__.py"):
if line.startswith("__version__"):
exec(line)
break
setup(
name="sfs",
version=__version__,
packages=find_packages(),
install_requires=[
'numpy!=1.11.0', # https://github.com/sfstoolbox/sfs-python/issues/11
'scipy',
],
author="SFS Toolbox Developers",
author_email="sfstoolbox@gmail.com",
description="Sound Field Synthesis Toolbox",
long_description=open('README.rst').read(),
license="MIT",
keywords="audio SFS WFS Ambisonics".split(),
url="http://github.com/sfstoolbox/",
platforms='any',
python_requires='>=3.6',
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Scientific/Engineering",
],
zip_safe=True,
)
| Add python_requires to help pip | Add python_requires to help pip
| Python | mit | sfstoolbox/sfs-python,sfstoolbox/sfs-python | ---
+++
@@ -24,6 +24,7 @@
keywords="audio SFS WFS Ambisonics".split(),
url="http://github.com/sfstoolbox/",
platforms='any',
+ python_requires='>=3.6',
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License", |
250d04c162c018227e13aa6cf6285c3121f0a687 | setup.py | setup.py | from setuptools import setup, find_packages
CONSOLE_SCRIPTS = ['pordego = pordego.cli:main']
setup(name="pordego",
version="1.0.0",
description="Command line tool for running configurable static analysis plugins on Python code",
packages=find_packages(),
entry_points={'console_scripts': CONSOLE_SCRIPTS},
install_requires=["pyyaml"]
)
| from setuptools import setup, find_packages
CONSOLE_SCRIPTS = ['pordego = pordego.cli:main']
CLASSIFIERS = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License"
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7"
]
setup(name="pordego",
version="1.0.0",
author="Tim Treptow",
author_email="tim.treptow@gmail.com",
description="Command line tool for running configurable static analysis plugins on Python code",
packages=find_packages(),
url="https://github.com/ttreptow/pordego",
entry_points={'console_scripts': CONSOLE_SCRIPTS},
install_requires=["pyyaml"],
classifiers=CLASSIFIERS
)
| Add fields for pypi submission | Add fields for pypi submission
| Python | mit | ttreptow/pordego | ---
+++
@@ -2,11 +2,23 @@
CONSOLE_SCRIPTS = ['pordego = pordego.cli:main']
+CLASSIFIERS = [
+ "Development Status :: 5 - Production/Stable",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: MIT License"
+ "Operating System :: OS Independent",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 2.7"
+]
setup(name="pordego",
version="1.0.0",
+ author="Tim Treptow",
+ author_email="tim.treptow@gmail.com",
description="Command line tool for running configurable static analysis plugins on Python code",
packages=find_packages(),
+ url="https://github.com/ttreptow/pordego",
entry_points={'console_scripts': CONSOLE_SCRIPTS},
- install_requires=["pyyaml"]
+ install_requires=["pyyaml"],
+ classifiers=CLASSIFIERS
) |
6c6a774ef2614ca82fbe61ec04e9b6a75415b015 | setup.py | setup.py | from distutils.core import setup
setup(
name = 'openhomedevice',
packages = ['openhomedevice'],
version = '0.2.1',
description = 'Provides an API for requesting information from an Openhome device',
author = 'Barry John Williams',
author_email = 'barry@bjw.me.uk',
url = 'https://github.com/bazwilliams/openhomedevice',
download_url = 'https://github.com/bazwilliams/openhomedevice/tarball/0.2',
keywords = ['upnp', 'dlna', 'openhome', 'linn', 'ds', 'music', 'render'],
install_requires = ['requests', 'lxml'],
classifiers = [],
)
| from distutils.core import setup
setup(
name = 'openhomedevice',
packages = ['openhomedevice'],
version = '0.2.2',
description = 'Provides an API for requesting information from an Openhome device',
author = 'Barry John Williams',
author_email = 'barry@bjw.me.uk',
url = 'https://github.com/cak85/openhomedevice',
download_url = 'https://github.com/cak85/openhomedevice/tarball/0.2.2',
keywords = ['upnp', 'dlna', 'openhome', 'linn', 'ds', 'music', 'render'],
install_requires = ['requests', 'lxml'],
classifiers = [],
)
| Change url to this fork | Change url to this fork
| Python | mit | bazwilliams/openhomedevice | ---
+++
@@ -2,12 +2,12 @@
setup(
name = 'openhomedevice',
packages = ['openhomedevice'],
- version = '0.2.1',
+ version = '0.2.2',
description = 'Provides an API for requesting information from an Openhome device',
author = 'Barry John Williams',
author_email = 'barry@bjw.me.uk',
- url = 'https://github.com/bazwilliams/openhomedevice',
- download_url = 'https://github.com/bazwilliams/openhomedevice/tarball/0.2',
+ url = 'https://github.com/cak85/openhomedevice',
+ download_url = 'https://github.com/cak85/openhomedevice/tarball/0.2.2',
keywords = ['upnp', 'dlna', 'openhome', 'linn', 'ds', 'music', 'render'],
install_requires = ['requests', 'lxml'],
classifiers = [], |
f293f162e0dcec88cbfbb9ae691bc2deb4c3ba26 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
install_requires = [
'MySQL-python>=1.0.0',
'SQLAlchemy>=1.1.0',
]
f = open('README.rst')
readme = f.read()
f.close()
setup(
name='sqldd',
version='0.9.1',
author='Rick Keilty',
author_email='rkeilty@gmail.com',
url='http://github.com/rkeilty/sql-data-dependency',
description='A toolkit for analyzing dependencies in SQL databases.',
long_description=readme,
license='BSD',
packages=find_packages(),
install_requires=install_requires,
include_package_data=True,
scripts=[
'bin/sqldd'
],
zip_safe=False,
classifiers=[
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Operating System :: OS Independent',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Topic :: Software Development'
],
)
| #!/usr/bin/env python
from setuptools import setup, find_packages
install_requires = [
'MySQL-python>=1.0.0',
'SQLAlchemy>=1.0.0',
]
f = open('README.rst')
readme = f.read()
f.close()
setup(
name='sqldd',
version='0.9.2',
author='Rick Keilty',
author_email='rkeilty@gmail.com',
url='http://github.com/rkeilty/sql-data-dependency',
description='A toolkit for analyzing dependencies in SQL databases.',
long_description=readme,
license='BSD',
packages=find_packages(),
install_requires=install_requires,
include_package_data=True,
scripts=[
'bin/sqldd'
],
zip_safe=False,
classifiers=[
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Operating System :: OS Independent',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Topic :: Software Development'
],
)
| Allow SQLAlchemy as old as 1.0 | Allow SQLAlchemy as old as 1.0
| Python | bsd-3-clause | rkeilty/sql-data-dependency,rkeilty/sql-data-dependency | ---
+++
@@ -3,7 +3,7 @@
install_requires = [
'MySQL-python>=1.0.0',
- 'SQLAlchemy>=1.1.0',
+ 'SQLAlchemy>=1.0.0',
]
f = open('README.rst')
@@ -12,7 +12,7 @@
setup(
name='sqldd',
- version='0.9.1',
+ version='0.9.2',
author='Rick Keilty',
author_email='rkeilty@gmail.com',
url='http://github.com/rkeilty/sql-data-dependency', |
fdc40813faee6a5867530ad8b8ad6daff48f2f42 | setup.py | setup.py | from setuptools import setup
setup(
name='pytest-flakes',
description='pytest plugin to check source code with pyflakes',
long_description=open("README.rst").read(),
license="MIT license",
version='4.0.1',
author='Florian Schulze, Holger Krekel and Ronny Pfannschmidt',
url='https://github.com/asmeurer/pytest-flakes',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Framework :: Pytest',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Software Development :: Testing',
],
py_modules=['pytest_flakes'],
entry_points={'pytest11': ['flakes = pytest_flakes']},
install_requires=['pytest>=2.8.0', 'pyflakes'])
| from setuptools import setup
setup(
name='pytest-flakes',
description='pytest plugin to check source code with pyflakes',
long_description=open("README.rst").read(),
license="MIT license",
version='4.0.1',
author='Florian Schulze, Holger Krekel and Ronny Pfannschmidt',
url='https://github.com/asmeurer/pytest-flakes',
python_requires='>=3.5',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Framework :: Pytest',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Software Development :: Testing',
],
py_modules=['pytest_flakes'],
entry_points={'pytest11': ['flakes = pytest_flakes']},
install_requires=['pytest>=2.8.0', 'pyflakes'])
| Add python_requires to help pip | Add python_requires to help pip
| Python | mit | fschulze/pytest-flakes | ---
+++
@@ -8,6 +8,7 @@
version='4.0.1',
author='Florian Schulze, Holger Krekel and Ronny Pfannschmidt',
url='https://github.com/asmeurer/pytest-flakes',
+ python_requires='>=3.5',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Framework :: Pytest', |
97e244878215a802a4f70967cc984f3763be5a30 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
from pupa import __version__
long_description = ''
setup(name='pupa',
version=__version__,
packages=find_packages(),
author='James Turk',
author_email='jturk@sunlightfoundation.com',
license='BSD',
url='http://github.com/opencivicdata/pupa/',
description='scraping framework for muncipal data',
long_description=long_description,
platforms=['any'],
entry_points='''[console_scripts]
pupa = pupa.cli.__main__:main''',
install_requires=[
#'Django==1.7.0',
'dj_database_url==0.3.0',
'django-uuidfield==0.5.0',
'djorm-pgarray==1.0',
'jsonfield>=0.9.20,<1',
'opencivicdata-django>=0.6.0',
'opencivicdata-divisions',
'scrapelib>=0.10',
'validictory>=1.0.0a2',
'psycopg2',
'pytz',
'boto',
#'kafka-python', # Optional Kafka dep
],
classifiers=["Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Topic :: Software Development :: Libraries :: Python Modules",
],
)
| #!/usr/bin/env python
from setuptools import setup, find_packages
from pupa import __version__
long_description = ''
setup(name='pupa',
version=__version__,
packages=find_packages(),
author='James Turk',
author_email='jturk@sunlightfoundation.com',
license='BSD',
url='http://github.com/opencivicdata/pupa/',
description='scraping framework for muncipal data',
long_description=long_description,
platforms=['any'],
entry_points='''[console_scripts]
pupa = pupa.cli.__main__:main''',
install_requires=[
#'Django==1.7.0',
'dj_database_url==0.3.0',
'opencivicdata-django>=0.7.0',
'opencivicdata-divisions',
'scrapelib>=0.10',
'validictory>=1.0.0a2',
'psycopg2',
'pytz',
'boto',
#'kafka-python', # Optional Kafka dep
],
classifiers=["Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.4",
"Topic :: Software Development :: Libraries :: Python Modules",
],
)
| Revert "Revert "drop old requirements"" | Revert "Revert "drop old requirements""
This reverts commit f444e853936eb95bbe61c2bbf26098e417cc5fef.
| Python | bsd-3-clause | mileswwatkins/pupa,datamade/pupa,datamade/pupa,opencivicdata/pupa,opencivicdata/pupa,mileswwatkins/pupa | ---
+++
@@ -19,10 +19,7 @@
install_requires=[
#'Django==1.7.0',
'dj_database_url==0.3.0',
- 'django-uuidfield==0.5.0',
- 'djorm-pgarray==1.0',
- 'jsonfield>=0.9.20,<1',
- 'opencivicdata-django>=0.6.0',
+ 'opencivicdata-django>=0.7.0',
'opencivicdata-divisions',
'scrapelib>=0.10',
'validictory>=1.0.0a2',
@@ -36,7 +33,6 @@
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
- "Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Topic :: Software Development :: Libraries :: Python Modules",
], |
eefe1ac289db85464d3d7f2f8ce3dbf8ab94487f | setup.py | setup.py | import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name = "UCLDC Deep Harvester",
version = "0.0.1",
description = ("deep harvester code for the UCLDC project"),
long_description=read('README.md'),
author='Barbara Hui',
author_email='barbara.hui@ucop.edu',
dependency_links=[
'https://github.com/ucldc/pynux/archive/master.zip#egg=pynux'
],
install_requires=[
'boto',
'pynux',
'python-magic'
],
packages=['deepharvest'],
test_suite='tests'
)
| import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name = "UCLDC Deep Harvester",
version = "0.0.1",
description = ("deep harvester code for the UCLDC project"),
long_description=read('README.md'),
author='Barbara Hui',
author_email='barbara.hui@ucop.edu',
dependency_links=[
'https://github.com/ucldc/pynux/archive/master.zip#egg=pynux',
'https://github.com/barbarahui/nuxeo-calisphere/archive/master.zip#egg=UCLDC-Deep-Harvester'
],
install_requires=[
'boto',
'pynux',
'python-magic',
'UCLDC-Deep-Harvester'
],
packages=['deepharvest'],
test_suite='tests'
)
| Add UCLDC-Deep-Harvester as a dependency. | Add UCLDC-Deep-Harvester as a dependency.
| Python | bsd-3-clause | barbarahui/nuxeo-calisphere,barbarahui/nuxeo-calisphere | ---
+++
@@ -15,12 +15,14 @@
author='Barbara Hui',
author_email='barbara.hui@ucop.edu',
dependency_links=[
- 'https://github.com/ucldc/pynux/archive/master.zip#egg=pynux'
+ 'https://github.com/ucldc/pynux/archive/master.zip#egg=pynux',
+ 'https://github.com/barbarahui/nuxeo-calisphere/archive/master.zip#egg=UCLDC-Deep-Harvester'
],
install_requires=[
'boto',
'pynux',
- 'python-magic'
+ 'python-magic',
+ 'UCLDC-Deep-Harvester'
],
packages=['deepharvest'],
test_suite='tests' |
264d9e1748bb7129e0f8c287b657a7ca8b86c402 | setup.py | setup.py | from setuptools import setup, find_packages
version = '1.9'
setup(name='jarn.viewdoc',
version=version,
description='Python documentation viewer',
long_description=open('README.rst').read() + '\n' +
open('CHANGES.rst').read(),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
keywords='view rest rst package docs rst2html',
author='Stefan H. Holek',
author_email='stefan@epy.co.at',
url='https://pypi.python.org/pypi/jarn.viewdoc',
license='BSD 2-clause',
packages=find_packages(),
namespace_packages=['jarn'],
include_package_data=True,
zip_safe=False,
test_suite='jarn.viewdoc.tests',
install_requires=[
'setuptools',
'docutils',
],
entry_points={
'console_scripts': 'viewdoc=jarn.viewdoc.viewdoc:main',
},
)
| from setuptools import setup, find_packages
version = '1.9'
setup(name='jarn.viewdoc',
version=version,
description='Python documentation viewer',
long_description=open('README.rst').read() + '\n' +
open('CHANGES.rst').read(),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
keywords='view rest rst package docs rst2html',
author='Stefan H. Holek',
author_email='stefan@epy.co.at',
url='https://github.com/Jarn/jarn.viewdoc',
license='BSD-2-Clause',
packages=find_packages(),
namespace_packages=['jarn'],
include_package_data=True,
zip_safe=False,
test_suite='jarn.viewdoc.tests',
install_requires=[
'setuptools',
'docutils',
],
entry_points={
'console_scripts': 'viewdoc=jarn.viewdoc.viewdoc:main',
},
)
| Use github URL and official license name. | Use github URL and official license name.
| Python | bsd-2-clause | Jarn/jarn.viewdoc | ---
+++
@@ -25,8 +25,8 @@
keywords='view rest rst package docs rst2html',
author='Stefan H. Holek',
author_email='stefan@epy.co.at',
- url='https://pypi.python.org/pypi/jarn.viewdoc',
- license='BSD 2-clause',
+ url='https://github.com/Jarn/jarn.viewdoc',
+ license='BSD-2-Clause',
packages=find_packages(),
namespace_packages=['jarn'],
include_package_data=True, |
4bd197766cff3f4a2bd7231e0822a14efbd75c28 | setup.py | setup.py | import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "ideone",
version = "0.0.1",
author = "Joe Schafer",
author_email = "joe@jschaf.com",
home-page = "http://github.com/jschaf/ideone-api/",
summary = "A Python binding to the Ideone (Online Compiler) API.",
description = "A Python binding to the Ideone (Online Compiler) API.",
license = "BSD",
platforms = ["any"],
keywords = "API ideone codepad",
packages = ['ideone'],
long_description=read('README.rst'),
classifiers=[
"Development Status :: 3 - Alpha",
"Topic :: Utilities",
"License :: OSI Approved :: BSD License",
],
install_requires=['suds',]
)
| import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "ideone",
version = "0.0.1",
author = "Joe Schafer",
author_email = "joe@jschaf.com",
url = "http://github.com/jschaf/ideone-api/",
description = "A Python binding to the Ideone (Online Compiler) API.",
license = "BSD",
platforms = ["any"],
keywords = "API, ideone, codepad",
packages = ['ideone'],
long_description=read('README.rst'),
classifiers=[
"Development Status :: 3 - Alpha",
"Topic :: Utilities",
"License :: OSI Approved :: BSD License",
],
install_requires=['suds',]
)
| Use url instead of home-page. Separate keywords by commas. | Use url instead of home-page. Separate keywords by commas.
| Python | bsd-3-clause | jschaf/ideone-api | ---
+++
@@ -9,12 +9,11 @@
version = "0.0.1",
author = "Joe Schafer",
author_email = "joe@jschaf.com",
- home-page = "http://github.com/jschaf/ideone-api/",
- summary = "A Python binding to the Ideone (Online Compiler) API.",
+ url = "http://github.com/jschaf/ideone-api/",
description = "A Python binding to the Ideone (Online Compiler) API.",
license = "BSD",
platforms = ["any"],
- keywords = "API ideone codepad",
+ keywords = "API, ideone, codepad",
packages = ['ideone'],
long_description=read('README.rst'),
classifiers=[ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.