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 |
|---|---|---|---|---|---|---|---|---|---|---|
88fcd9e1ae2a8fe21023816304023526eb7b7e35 | fb_import.py | fb_import.py | import MySQLdb
# Download Guest List.csv from Facebook event page and copy it to a file named
# 'list.csv'. Remove the first line (column title) and the '"'s around each
# name (they cause trouble with MySQL)
filename = "list.csv"
data = open(filename, 'r');
guests = [];
db_host = "" # Add your host
db_user = "" # Add your user
db_password = "" # Add your password
db_name = "" # Add your database name
db_table = "" # Add your table name
for line in data:
person = line.split(',')
guests.append([person[0].strip(), person[1].strip()])
print("Number of guests {}\n".format(str(len(guests))))
db = MySQLdb.connect(db_host, db_user, db_password, db_name)
cursor = db.cursor()
for person, status in guests:
print("Adding " + person + " status: " + status)
cursor.execute("INSERT INTO {} (name, status)\
VALUES (\"{}\", \"{}\")".format(db_table, person, status))
# Clean up
cursor.close()
db.commit()
db.close()
| import MySQLdb
import json
# Download Guest List.csv from Facebook event page and copy it to a file named
# 'list.csv'. Remove the first line (column title) and the '"'s around each
# name (they cause trouble with MySQL)
filename = "list.csv"
data = open(filename, 'r')
guests = []
# Config Setup
config_file = open('config.json', 'r')
config = json.load(config_file)
for line in data:
person = line.split(',')
guests.append([person[0].strip(), person[1].strip()])
print("Number of guests {}\n".format(str(len(guests))))
db = MySQLdb.connect(config['db_host'], config['db_user'], config['db_password'],
config['db_name'])
cursor = db.cursor()
for person, status in guests:
print("Adding " + person + " status: " + status)
cursor.execute("INSERT INTO {} (name, status)\
VALUES (\"{}\", \"{}\")".format(db_table, person, status))
# Clean up
cursor.close()
db.commit()
db.close()
| Use config file in import script | Use config file in import script
| Python | mit | copperwall/Attendance-Checker,copperwall/Attendance-Checker,copperwall/Attendance-Checker | ---
+++
@@ -1,17 +1,16 @@
import MySQLdb
+import json
# Download Guest List.csv from Facebook event page and copy it to a file named
# 'list.csv'. Remove the first line (column title) and the '"'s around each
# name (they cause trouble with MySQL)
filename = "list.csv"
-data = open(filename, 'r');
-guests = [];
+data = open(filename, 'r')
+guests = []
-db_host = "" # Add your host
-db_user = "" # Add your user
-db_password = "" # Add your password
-db_name = "" # Add your database name
-db_table = "" # Add your table name
+# Config Setup
+config_file = open('config.json', 'r')
+config = json.load(config_file)
for line in data:
person = line.split(',')
@@ -19,7 +18,8 @@
print("Number of guests {}\n".format(str(len(guests))))
-db = MySQLdb.connect(db_host, db_user, db_password, db_name)
+db = MySQLdb.connect(config['db_host'], config['db_user'], config['db_password'],
+ config['db_name'])
cursor = db.cursor()
for person, status in guests: |
1f91a0eed0f336ac559cfbca5c4a86f313b48bb5 | tests/test_postgres_processor.py | tests/test_postgres_processor.py | import pytest
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.api.settings")
import django
from django.test import TestCase
from scrapi.processing.postgres import PostgresProcessor, Document
from . import utils
from scrapi.linter.document import RawDocument
django.setup()
test_db = PostgresProcessor()
# NORMALIZED = NormalizedDocument(utils.RECORD)
RAW = RawDocument(utils.POSTGRES_RAW_DOC)
class DocumentTestCase(TestCase):
@pytest.mark.django_db
def test_raw_processing(self):
test_db.process_raw(RAW)
queryset = Document(docID='someID', source=RAW['source'])
assert queryset.docID == RAW.attributes['docID']
| # import pytest
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.api.settings")
import django
from django.test import TestCase
from scrapi.processing.postgres import PostgresProcessor, Document
from . import utils
from scrapi.linter.document import RawDocument, NormalizedDocument
django.setup()
test_db = PostgresProcessor()
RAW = RawDocument(utils.POSTGRES_RAW_DOC)
NORMALIZED = NormalizedDocument(utils.RECORD)
class DocumentTestCase(TestCase):
def test_raw_processing(self):
test_db.process_raw(RAW)
queryset = Document(docID='someID', source=RAW['source'])
assert queryset.docID == RAW.attributes['docID']
def test_normalized_processing(self):
test_db.process_normalized(RAW, NORMALIZED)
queryset = Document(docID=RAW['docID'], source=RAW['source'])
assert(queryset.source == NORMALIZED['shareProperties']['source'])
| Add test for process normalized | Add test for process normalized
| Python | apache-2.0 | erinspace/scrapi,erinspace/scrapi,fabianvf/scrapi,mehanig/scrapi,CenterForOpenScience/scrapi,CenterForOpenScience/scrapi,felliott/scrapi,felliott/scrapi,fabianvf/scrapi,mehanig/scrapi | ---
+++
@@ -1,4 +1,4 @@
-import pytest
+# import pytest
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.api.settings")
@@ -8,20 +8,24 @@
from scrapi.processing.postgres import PostgresProcessor, Document
from . import utils
-from scrapi.linter.document import RawDocument
+from scrapi.linter.document import RawDocument, NormalizedDocument
django.setup()
test_db = PostgresProcessor()
-# NORMALIZED = NormalizedDocument(utils.RECORD)
RAW = RawDocument(utils.POSTGRES_RAW_DOC)
+NORMALIZED = NormalizedDocument(utils.RECORD)
class DocumentTestCase(TestCase):
- @pytest.mark.django_db
def test_raw_processing(self):
test_db.process_raw(RAW)
queryset = Document(docID='someID', source=RAW['source'])
assert queryset.docID == RAW.attributes['docID']
+
+ def test_normalized_processing(self):
+ test_db.process_normalized(RAW, NORMALIZED)
+ queryset = Document(docID=RAW['docID'], source=RAW['source'])
+ assert(queryset.source == NORMALIZED['shareProperties']['source']) |
5d39c34994d2c20b02d60d6e9f19cfd62310828b | sumy/models/dom/_paragraph.py | sumy/models/dom/_paragraph.py | # -*- coding: utf8 -*-
from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals
from itertools import chain
from ..._compat import unicode_compatible
from ...utils import cached_property
from ._sentence import Sentence
@unicode_compatible
class Paragraph(object):
def __init__(self, sentences):
sentences = tuple(sentences)
for sentence in sentences:
if not isinstance(sentence, Sentence):
raise TypeError("Only instances of class 'Sentence' are allowed.")
self._sentences = sentences
@cached_property
def sentences(self):
return tuple(s for s in self._sentences if not s.is_heading)
@cached_property
def headings(self):
return tuple(s for s in self._sentences if s.is_heading)
@cached_property
def words(self):
return tuple(chain(*(s.words for s in self._sentences)))
def __unicode__(self):
return "<Paragraph with %d headings & %d sentences>" % (
len(self.headings),
len(self.sentences),
)
def __repr__(self):
return self.__str__()
| # -*- coding: utf8 -*-
from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals
from itertools import chain
from ..._compat import unicode_compatible
from ...utils import cached_property
from ._sentence import Sentence
@unicode_compatible
class Paragraph(object):
__slots__ = (
"_sentences",
"_cached_property_sentences",
"_cached_property_headings",
"_cached_property_words",
)
def __init__(self, sentences):
sentences = tuple(sentences)
for sentence in sentences:
if not isinstance(sentence, Sentence):
raise TypeError("Only instances of class 'Sentence' are allowed.")
self._sentences = sentences
@cached_property
def sentences(self):
return tuple(s for s in self._sentences if not s.is_heading)
@cached_property
def headings(self):
return tuple(s for s in self._sentences if s.is_heading)
@cached_property
def words(self):
return tuple(chain(*(s.words for s in self._sentences)))
def __unicode__(self):
return "<Paragraph with %d headings & %d sentences>" % (
len(self.headings),
len(self.sentences),
)
def __repr__(self):
return self.__str__()
| Create immutable objects for paragraph instances | Create immutable objects for paragraph instances
There a lot of paragraph objects in parsed document.
It saves some memory during summarization.
| Python | apache-2.0 | miso-belica/sumy,miso-belica/sumy | ---
+++
@@ -11,6 +11,13 @@
@unicode_compatible
class Paragraph(object):
+ __slots__ = (
+ "_sentences",
+ "_cached_property_sentences",
+ "_cached_property_headings",
+ "_cached_property_words",
+ )
+
def __init__(self, sentences):
sentences = tuple(sentences)
for sentence in sentences: |
ca4dc40c14426a97c532263135b885c45dcc8e77 | account_payment_mode/models/res_partner_bank.py | account_payment_mode/models/res_partner_bank.py | # -*- coding: utf-8 -*-
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields
class ResPartnerBank(models.Model):
_inherit = 'res.partner.bank'
# TODO: It doesn't work, I don't understand why
# So I change the label of the field in the view
acc_type = fields.Char(string='Bank Account Type')
| # -*- coding: utf-8 -*-
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields
class ResPartnerBank(models.Model):
_inherit = 'res.partner.bank'
# I also have to change the label of the field in the view
# I store the field, so that we can do groupby and search on it
acc_type = fields.Char(string='Bank Account Type', store=True)
| Store field acc_type on res.partner.bank, so that we can search and groupby on it | Store field acc_type on res.partner.bank, so that we can search and groupby on it
| Python | agpl-3.0 | CompassionCH/bank-payment,CompassionCH/bank-payment | ---
+++
@@ -8,6 +8,6 @@
class ResPartnerBank(models.Model):
_inherit = 'res.partner.bank'
- # TODO: It doesn't work, I don't understand why
- # So I change the label of the field in the view
- acc_type = fields.Char(string='Bank Account Type')
+ # I also have to change the label of the field in the view
+ # I store the field, so that we can do groupby and search on it
+ acc_type = fields.Char(string='Bank Account Type', store=True) |
e2e730c7f8fb8b0c536971082374171d1eacdf73 | main.py | main.py | import datetime
import os
import json
import aiohttp
from discord.ext import commands
config = json.load(open('config.json'))
class Bot(commands.Bot):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.session = aiohttp.ClientSession(loop=self.loop)
self.config = config
self.startup_time = datetime.datetime.utcnow()
async def on_ready(self):
print(f'You are currently logged in as {bot.user}.')
def load_extensions(self):
for file in os.listdir('cogs'):
if file.endswith('.py'):
ext = file[:-3]
try:
self.load_extension(f'cogs.{ext}')
except Exception as e:
print(f'Failed to load extension {ext}: {e}')
if __name__ == '__main__':
bot = Bot(command_prefix='-', config=config)
bot.load_extensions()
bot.run(bot.config['discord'])
| import datetime
import os
import json
import aiohttp
import discord
from discord.ext import commands
config = json.load(open('config.json'))
class Bot(commands.Bot):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.session = aiohttp.ClientSession(loop=self.loop)
self.config = config
self.startup_time = datetime.datetime.utcnow()
async def on_ready(self):
print(f'You are currently logged in as {bot.user}.')
game = discord.Game('-help')
await self.change_presence(activity=game)
def load_extensions(self):
for file in os.listdir('cogs'):
if file.endswith('.py'):
ext = file[:-3]
try:
self.load_extension(f'cogs.{ext}')
except Exception as e:
print(f'Failed to load extension {ext}: {e}')
if __name__ == '__main__':
bot = Bot(command_prefix='-', config=config)
bot.load_extensions()
bot.run(bot.config['discord'])
| Change game status to -help | Change game status to -help
| Python | mit | r-robles/rd-bot | ---
+++
@@ -2,6 +2,7 @@
import os
import json
import aiohttp
+import discord
from discord.ext import commands
config = json.load(open('config.json'))
@@ -17,6 +18,9 @@
async def on_ready(self):
print(f'You are currently logged in as {bot.user}.')
+ game = discord.Game('-help')
+ await self.change_presence(activity=game)
+
def load_extensions(self):
for file in os.listdir('cogs'):
if file.endswith('.py'): |
2bdd1d4c7ec3dc4013b193810f908dd83c1aab6b | tests/test_abi/test_reversibility_properties.py | tests/test_abi/test_reversibility_properties.py | from hypothesis import (
given,
settings,
)
from eth_abi import (
encode_abi,
decode_abi,
encode_single,
decode_single,
)
from tests.common.strategies import (
multi_strs_values,
single_strs_values,
)
@settings(max_examples=1000)
@given(multi_strs_values)
def test_multi_abi_reversability(types_and_values):
"""
Tests round trip encoding and decoding for basic types and lists of basic
types.
"""
types, values = types_and_values
encoded_values = encode_abi(types, values)
decoded_values = decode_abi(types, encoded_values)
assert values == decoded_values
@settings(max_examples=1000)
@given(single_strs_values)
def test_single_abi_reversability(type_and_value):
"""
Tests round trip encoding and decoding for basic types and lists of basic
types.
"""
_type, value = type_and_value
encoded_value = encode_single(_type, value)
decoded_value = decode_single(_type, encoded_value)
assert value == decoded_value
| from hypothesis import (
given,
settings,
)
from eth_abi import (
encode_abi,
decode_abi,
encode_single,
decode_single,
)
from tests.common.strategies import (
multi_strs_values,
single_strs_values,
)
@settings(max_examples=1000)
@given(multi_strs_values)
def test_multi_abi_reversibility(types_and_values):
"""
Tests round trip encoding and decoding for basic types and lists of basic
types.
"""
types, values = types_and_values
encoded_values = encode_abi(types, values)
decoded_values = decode_abi(types, encoded_values)
assert values == decoded_values
@settings(max_examples=1000)
@given(single_strs_values)
def test_single_abi_reversibility(type_and_value):
"""
Tests round trip encoding and decoding for basic types and lists of basic
types.
"""
_type, value = type_and_value
encoded_value = encode_single(_type, value)
decoded_value = decode_single(_type, encoded_value)
assert value == decoded_value
| Fix spelling errors in test names | Fix spelling errors in test names
| Python | mit | pipermerriam/ethereum-abi-utils | ---
+++
@@ -18,7 +18,7 @@
@settings(max_examples=1000)
@given(multi_strs_values)
-def test_multi_abi_reversability(types_and_values):
+def test_multi_abi_reversibility(types_and_values):
"""
Tests round trip encoding and decoding for basic types and lists of basic
types.
@@ -31,7 +31,7 @@
@settings(max_examples=1000)
@given(single_strs_values)
-def test_single_abi_reversability(type_and_value):
+def test_single_abi_reversibility(type_and_value):
"""
Tests round trip encoding and decoding for basic types and lists of basic
types. |
2d1798eb26614d87fca94efff25ea0384ae811b5 | Sketches/MPS/Experiments/Likefile2/likefile/TestLikeFile.py | Sketches/MPS/Experiments/Likefile2/likefile/TestLikeFile.py | #!/usr/bin/python
import time
from background import background
from Kamaelia.UI.Pygame.Text import Textbox, TextDisplayer
from LikeFile import LikeFile
background().start()
import Queue
TD = LikeFile(
TextDisplayer(position=(20, 90),
text_height=36,
screen_width=900,
screen_height=200,
background_color=(130,0,70),
text_color=(255,255,255)
)
).activate()
TB = LikeFile(
Textbox(position=(20, 340),
text_height=36,
screen_width=900,
screen_height=400,
background_color=(130,0,70),
text_color=(255,255,255)
)
).activate()
while 1:
time.sleep(1)
print "."
try:
print TB.get()
except Queue.Empty:
pass
TD.put("hello\n", "inbox")
| #!/usr/bin/python
import time
from background import background
from Kamaelia.UI.Pygame.Text import Textbox, TextDisplayer
from LikeFile import LikeFile
background().start()
import Queue
TD = LikeFile(
TextDisplayer(position=(20, 90),
text_height=36,
screen_width=900,
screen_height=200,
background_color=(130,0,70),
text_color=(255,255,255)
)
).activate()
TB = LikeFile(
Textbox(position=(20, 340),
text_height=36,
screen_width=900,
screen_height=400,
background_color=(130,0,70),
text_color=(255,255,255)
)
).activate()
message = "hello\n"
while 1:
time.sleep(1)
print "."
try:
data,box = TB.get()
print data, box
message = data
except Queue.Empty:
pass
TD.put(message, "inbox")
| Test harness changed to forward the message recieved over the like-file interface to the other one, using it's like-file interface | Test harness changed to forward the message recieved over the like-file
interface to the other one, using it's like-file interface
Michael
| Python | apache-2.0 | sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia | ---
+++
@@ -27,11 +27,14 @@
)
).activate()
+message = "hello\n"
while 1:
time.sleep(1)
print "."
try:
- print TB.get()
+ data,box = TB.get()
+ print data, box
+ message = data
except Queue.Empty:
pass
- TD.put("hello\n", "inbox")
+ TD.put(message, "inbox") |
ff73134e836b3950ba15410bac6e1bfe1dcd6d65 | django_rq/decorators.py | django_rq/decorators.py | from rq.decorators import job as _rq_job
from .queues import get_queue
def job(func_or_queue, connection=None, *args, **kwargs):
"""
The same as RQ's job decorator, but it works automatically works out
the ``connection`` argument from RQ_QUEUES.
And also, it allows simplified ``@job`` syntax to put job into
default queue.
"""
if callable(func_or_queue):
func = func_or_queue
queue = 'default'
else:
func = None
queue = func_or_queue
if isinstance(queue, basestring):
try:
queue = get_queue(queue)
if connection is None:
connection = queue.connection
except KeyError:
pass
decorator = _rq_job(queue, connection=connection, *args, **kwargs)
if func:
return decorator(func)
return decorator
| from django.utils import six
from rq.decorators import job as _rq_job
from .queues import get_queue
def job(func_or_queue, connection=None, *args, **kwargs):
"""
The same as RQ's job decorator, but it works automatically works out
the ``connection`` argument from RQ_QUEUES.
And also, it allows simplified ``@job`` syntax to put job into
default queue.
"""
if callable(func_or_queue):
func = func_or_queue
queue = 'default'
else:
func = None
queue = func_or_queue
if isinstance(queue, six.string_types):
try:
queue = get_queue(queue)
if connection is None:
connection = queue.connection
except KeyError:
pass
decorator = _rq_job(queue, connection=connection, *args, **kwargs)
if func:
return decorator(func)
return decorator
| Replace basestring to six.string_types. Now python 3.3, 3.2 pass tests. | Replace basestring to six.string_types. Now python 3.3, 3.2 pass tests.
Take django.utils.six dependency
| Python | mit | ryanisnan/django-rq,viaregio/django-rq,lechup/django-rq,viaregio/django-rq,ui/django-rq,1024inc/django-rq,sbussetti/django-rq,meteozond/django-rq,sbussetti/django-rq,ryanisnan/django-rq,ui/django-rq,lechup/django-rq,mjec/django-rq,meteozond/django-rq,1024inc/django-rq,mjec/django-rq | ---
+++
@@ -1,3 +1,4 @@
+from django.utils import six
from rq.decorators import job as _rq_job
from .queues import get_queue
@@ -18,7 +19,7 @@
func = None
queue = func_or_queue
- if isinstance(queue, basestring):
+ if isinstance(queue, six.string_types):
try:
queue = get_queue(queue)
if connection is None: |
0332284ce3ef43af7d3010688514f457ffaac774 | support/appveyor-build.py | support/appveyor-build.py | #!/usr/bin/env python
# Build the project on AppVeyor.
import os
from subprocess import check_call
build = os.environ['BUILD']
config = os.environ['CONFIG']
path = os.environ['PATH']
cmake_command = ['cmake', '-DFMT_PEDANTIC=ON', '-DCMAKE_BUILD_TYPE=' + config]
if build == 'mingw':
cmake_command.append('-GMinGW Makefiles')
build_command = ['mingw32-make', '-j4']
test_command = ['mingw32-make', 'test']
# Remove the path to Git bin directory from $PATH because it breaks MinGW config.
path = path.replace(r'C:\Program Files (x86)\Git\bin', '')
os.environ['PATH'] = path + r';C:\MinGW\bin'
else:
# Add MSBuild 14.0 to PATH as described in
# http://help.appveyor.com/discussions/problems/2229-v140-not-found-on-vs2105rc.
os.environ['PATH'] = r'C:\Program Files (x86)\MSBuild\14.0\Bin;' + path
build_command = ['msbuild', '/m:4', '/p:Config=' + config, 'FORMAT.sln']
test_command = ['msbuild', 'RUN_TESTS.vcxproj']
check_call(cmake_command)
check_call(build_command)
check_call(test_command)
| #!/usr/bin/env python
# Build the project on AppVeyor.
import os
from subprocess import check_call
build = os.environ['BUILD']
config = os.environ['CONFIG']
path = os.environ['PATH']
cmake_command = ['cmake', '-DFMT_PEDANTIC=ON', '-DCMAKE_BUILD_TYPE=' + config]
if build == 'mingw':
cmake_command.append('-GMinGW Makefiles')
build_command = ['mingw32-make', '-j4']
test_command = ['mingw32-make', 'test']
# Remove the path to Git bin directory from $PATH because it breaks MinGW config.
path = path.replace(r'C:\Program Files (x86)\Git\bin', '')
os.environ['PATH'] = r'C:\MinGW\bin;' + path
else:
# Add MSBuild 14.0 to PATH as described in
# http://help.appveyor.com/discussions/problems/2229-v140-not-found-on-vs2105rc.
os.environ['PATH'] = r'C:\Program Files (x86)\MSBuild\14.0\Bin;' + path
build_command = ['msbuild', '/m:4', '/p:Config=' + config, 'FORMAT.sln']
test_command = ['msbuild', 'RUN_TESTS.vcxproj']
check_call(cmake_command)
check_call(build_command)
check_call(test_command)
| Fix MinGW build on Appveyor by changing search path order | Fix MinGW build on Appveyor by changing search path order
C:\MinGW\bin should go first to prevent executables from older
version of MinGW in C:\MinGW\mingw32 being picked up.
| Python | bsd-2-clause | cppformat/cppformat,seungrye/cppformat,dean0x7d/cppformat,dean0x7d/cppformat,seungrye/cppformat,mojoBrendan/fmt,lightslife/cppformat,nelson4722/cppformat,lightslife/cppformat,blaquee/cppformat,alabuzhev/fmt,lightslife/cppformat,Jopie64/cppformat,cppformat/cppformat,seungrye/cppformat,wangshijin/cppformat,blaquee/cppformat,Jopie64/cppformat,blaquee/cppformat,alabuzhev/fmt,cppformat/cppformat,mojoBrendan/fmt,alabuzhev/fmt,dean0x7d/cppformat,wangshijin/cppformat,nelson4722/cppformat,Jopie64/cppformat,mojoBrendan/fmt,wangshijin/cppformat,nelson4722/cppformat | ---
+++
@@ -14,7 +14,7 @@
test_command = ['mingw32-make', 'test']
# Remove the path to Git bin directory from $PATH because it breaks MinGW config.
path = path.replace(r'C:\Program Files (x86)\Git\bin', '')
- os.environ['PATH'] = path + r';C:\MinGW\bin'
+ os.environ['PATH'] = r'C:\MinGW\bin;' + path
else:
# Add MSBuild 14.0 to PATH as described in
# http://help.appveyor.com/discussions/problems/2229-v140-not-found-on-vs2105rc. |
d1a2a4c2ee7fda2bfde369bb6311719e72c75a3d | corehq/blobs/tasks.py | corehq/blobs/tasks.py | from __future__ import absolute_import
from datetime import datetime
from celery.task import periodic_task
from celery.schedules import crontab
from corehq.util.datadog.gauges import datadog_counter
from corehq.blobs.models import BlobExpiration
from corehq.blobs import get_blob_db
@periodic_task(run_every=crontab(minute=0, hour='0,12'))
def delete_expired_blobs():
blob_expirations = BlobExpiration.objects.filter(expires_on__lt=_utcnow(), deleted=False)
db = get_blob_db()
paths = []
bytes_deleted = 0
for blob_expiration in blob_expirations:
paths.append(db.get_path(blob_expiration.identifier, blob_expiration.bucket))
bytes_deleted += blob_expiration.length
db.bulk_delete(paths)
blob_expirations.update(deleted=True)
datadog_counter(
'commcare.temp_blobs.bytes_deleted',
value=bytes_deleted,
)
return bytes_deleted
def _utcnow():
return datetime.utcnow()
| from __future__ import absolute_import
from datetime import datetime
from celery.task import periodic_task
from celery.schedules import crontab
from corehq.util.datadog.gauges import datadog_counter
from corehq.blobs.models import BlobExpiration
from corehq.blobs import get_blob_db
@periodic_task(run_every=crontab(minute=0, hour='0,12'))
def delete_expired_blobs():
blob_expirations = BlobExpiration.objects.filter(expires_on__lt=_utcnow(), deleted=False)
db = get_blob_db()
total_bytes_deleted = 0
while blob_expirations.exists():
paths = []
deleted_ids = []
bytes_deleted = 0
for blob_expiration in blob_expirations[:1000]:
paths.append(db.get_path(blob_expiration.identifier, blob_expiration.bucket))
deleted_ids.append(blob_expiration.id)
bytes_deleted += blob_expiration.length
db.bulk_delete(paths)
BlobExpiration.objects.filter(id__in=deleted_ids).update(deleted=True)
datadog_counter(
'commcare.temp_blobs.bytes_deleted',
value=bytes_deleted,
)
total_bytes_deleted += bytes_deleted
return total_bytes_deleted
def _utcnow():
return datetime.utcnow()
| Delete expired blobs in batches | Delete expired blobs in batches | Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -14,19 +14,25 @@
blob_expirations = BlobExpiration.objects.filter(expires_on__lt=_utcnow(), deleted=False)
db = get_blob_db()
- paths = []
- bytes_deleted = 0
- for blob_expiration in blob_expirations:
- paths.append(db.get_path(blob_expiration.identifier, blob_expiration.bucket))
- bytes_deleted += blob_expiration.length
+ total_bytes_deleted = 0
+ while blob_expirations.exists():
+ paths = []
+ deleted_ids = []
+ bytes_deleted = 0
+ for blob_expiration in blob_expirations[:1000]:
+ paths.append(db.get_path(blob_expiration.identifier, blob_expiration.bucket))
+ deleted_ids.append(blob_expiration.id)
+ bytes_deleted += blob_expiration.length
- db.bulk_delete(paths)
- blob_expirations.update(deleted=True)
- datadog_counter(
- 'commcare.temp_blobs.bytes_deleted',
- value=bytes_deleted,
- )
- return bytes_deleted
+ db.bulk_delete(paths)
+ BlobExpiration.objects.filter(id__in=deleted_ids).update(deleted=True)
+ datadog_counter(
+ 'commcare.temp_blobs.bytes_deleted',
+ value=bytes_deleted,
+ )
+ total_bytes_deleted += bytes_deleted
+
+ return total_bytes_deleted
def _utcnow(): |
4e2d0d037c6e028b0ff25042d4283c147801f0a2 | once-internet-is-on-d.py | once-internet-is-on-d.py | """
Author: Ashish Gaikwad <ash.gkwd@gmail.com>
Copyright (c) 2015 Ashish Gaikwad
Description: This daemon will execute command once
Internet is connected. Then it will exit.
"""
import socket
from subprocess import call
import time
commands = [["python", "/usr/bin/beat.sh"]]
def internet(host='8.8.8.8', port=53):
try:
socket.setdefaulttimeout(1)
socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((host, port))
return True
except Exception as ex:
pass
return False
def main():
print "[once-internet-is-on-d started]"
while not internet():
pass
time.sleep(40)
for x in commands:
print "[once-internet-is-on-d calling] : ", x
call(x)
print "[once-internet-is-on-d finished]"
if __name__ == '__main__':
main() | """
Author: Ashish Gaikwad <ash.gkwd@gmail.com>
Copyright (c) 2015 Ashish Gaikwad
Description: This daemon will execute command once
Internet is connected. Then it will exit.
"""
import socket
from subprocess import call
import time
commands = [["bash", "/usr/bin/beat.sh"]]
def internet(host='8.8.8.8', port=53):
try:
socket.setdefaulttimeout(1)
socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((host, port))
return True
except Exception as ex:
pass
return False
def main():
print "[once-internet-is-on-d started]"
while not internet():
pass
time.sleep(40)
for x in commands:
print "[once-internet-is-on-d calling] : ", x
call(x)
print "[once-internet-is-on-d finished]"
if __name__ == '__main__':
main() | FIX - beat.sh is now called by bash and not python | FIX - beat.sh is now called by bash and not python
| Python | mit | ashgkwd/brainy-beats,ashgkwd/brainy-beats | ---
+++
@@ -9,7 +9,7 @@
from subprocess import call
import time
-commands = [["python", "/usr/bin/beat.sh"]]
+commands = [["bash", "/usr/bin/beat.sh"]]
def internet(host='8.8.8.8', port=53):
try: |
d98829d34e49b542097b113d17e6216199483986 | rbopt.py | rbopt.py | #-----------------------------------------------------------------------------#
# MODULE DESCRIPTION #
#-----------------------------------------------------------------------------#
"""RedBrick Options Module; contains RBOpt class."""
#-----------------------------------------------------------------------------#
# DATA #
#-----------------------------------------------------------------------------#
__version__ = '$Revision$'
__author__ = 'Cillian Sharkey'
#-----------------------------------------------------------------------------#
# CLASSES #
#-----------------------------------------------------------------------------#
class RBOpt:
"""Class for storing options to be shared by modules"""
def __init__(self):
"""Create new RBOpt object."""
# Used by all modules.
self.override = None
# Used by useradm, RBUserDB & RBAccount.
self.test = None
# Used by useradm & rrs.
self.mode = None
self.setpasswd = None
# Used by useradm.
self.args = []
self.help = None
self.username = None
self.dbonly = None
self.aconly = None
self.updatedby = None
self.newbie = None
self.mailuser = None
self.usertype = None
self.name = None
self.email = None
self.id = None
self.course = None
self.year = None
self.years_paid = None
self.birthday = None
self.quiet = None
# Used by rrs.
self.action = None
| #-----------------------------------------------------------------------------#
# MODULE DESCRIPTION #
#-----------------------------------------------------------------------------#
"""RedBrick Options Module; contains RBOpt class."""
#-----------------------------------------------------------------------------#
# DATA #
#-----------------------------------------------------------------------------#
__version__ = '$Revision: 1.2 $'
__author__ = 'Cillian Sharkey'
#-----------------------------------------------------------------------------#
# CLASSES #
#-----------------------------------------------------------------------------#
class RBOpt:
"""Class for storing options to be shared by modules"""
def __init__(self):
"""Create new RBOpt object."""
# Used by all modules.
self.override = None
# Used by useradm, RBUserDB & RBAccount.
self.test = None
# Used by useradm & rrs.
self.mode = None
self.setpasswd = None
# Used by useradm.
self.args = []
self.help = None
self.uid = None
self.dbonly = None
self.aconly = None
self.updatedby = None
self.newbie = None
self.mailuser = None
self.usertype = None
self.cn = None
self.altmail = None
self.id = None
self.course = None
self.year = None
self.yearsPaid = None
self.birthday = None
self.quiet = None
# Used by rrs.
self.action = None
| Change to new attribute names. | Change to new attribute names.
| Python | unlicense | gruunday/useradm,gruunday/useradm,gruunday/useradm | ---
+++
@@ -8,7 +8,7 @@
# DATA #
#-----------------------------------------------------------------------------#
-__version__ = '$Revision$'
+__version__ = '$Revision: 1.2 $'
__author__ = 'Cillian Sharkey'
#-----------------------------------------------------------------------------#
@@ -31,19 +31,19 @@
# Used by useradm.
self.args = []
self.help = None
- self.username = None
+ self.uid = None
self.dbonly = None
self.aconly = None
self.updatedby = None
self.newbie = None
self.mailuser = None
self.usertype = None
- self.name = None
- self.email = None
+ self.cn = None
+ self.altmail = None
self.id = None
self.course = None
self.year = None
- self.years_paid = None
+ self.yearsPaid = None
self.birthday = None
self.quiet = None
# Used by rrs. |
53b22654b015d1450fe124bc01a2f1bffba816a2 | test_hpack_integration.py | test_hpack_integration.py | # -*- coding: utf-8 -*-
"""
This module defines substantial HPACK integration tests. These can take a very
long time to run, so they're outside the main test suite, but they need to be
run before every change to HPACK.
"""
from hyper.http20.hpack import Decoder
from binascii import unhexlify
class TestHPACKDecoderIntegration(object):
def test_can_decode_a_story(self, story):
d = Decoder()
for case in story['cases']:
d.header_table_size = case['header_table_size']
decoded_headers = d.decode(unhexlify(case['wire']))
# The correct headers are a list of dicts, which is annoying.
correct_headers = {(item[0], item[1]) for header in case['headers'] for item in header.items()}
assert correct_headers == decoded_headers
| # -*- coding: utf-8 -*-
"""
This module defines substantial HPACK integration tests. These can take a very
long time to run, so they're outside the main test suite, but they need to be
run before every change to HPACK.
"""
from hyper.http20.hpack import Decoder
from hyper.http20.huffman import HuffmanDecoder
from hyper.http20.huffman_constants import REQUEST_CODES, REQUEST_CODES_LENGTH
from binascii import unhexlify
class TestHPACKDecoderIntegration(object):
def test_can_decode_a_story(self, story):
d = Decoder()
if story['context'] == 'request':
d.huffman_coder = HuffmanDecoder(REQUEST_CODES, REQUEST_CODES_LENGTH)
for case in story['cases']:
d.header_table_size = case['header_table_size']
decoded_headers = d.decode(unhexlify(case['wire']))
# The correct headers are a list of dicts, which is annoying.
correct_headers = {(item[0], item[1]) for header in case['headers'] for item in header.items()}
assert correct_headers == decoded_headers
| Use the correct decoder for the test. | Use the correct decoder for the test.
| Python | mit | Lukasa/hyper,masaori335/hyper,lawnmowerlatte/hyper,fredthomsen/hyper,irvind/hyper,lawnmowerlatte/hyper,masaori335/hyper,jdecuyper/hyper,irvind/hyper,fredthomsen/hyper,plucury/hyper,plucury/hyper,Lukasa/hyper,jdecuyper/hyper | ---
+++
@@ -5,11 +5,17 @@
run before every change to HPACK.
"""
from hyper.http20.hpack import Decoder
+from hyper.http20.huffman import HuffmanDecoder
+from hyper.http20.huffman_constants import REQUEST_CODES, REQUEST_CODES_LENGTH
from binascii import unhexlify
class TestHPACKDecoderIntegration(object):
def test_can_decode_a_story(self, story):
d = Decoder()
+
+ if story['context'] == 'request':
+ d.huffman_coder = HuffmanDecoder(REQUEST_CODES, REQUEST_CODES_LENGTH)
+
for case in story['cases']:
d.header_table_size = case['header_table_size']
decoded_headers = d.decode(unhexlify(case['wire'])) |
4a099c315800c2f348c5a5491c0728c6dcbba4ba | setup.py | setup.py | # -*- coding: utf-8 -*-
from setuptools import setup
import ibei
setup(name="ibei",
version=ibei.__version__,
author="Joshua Ryan Smith",
author_email="joshua.r.smith@gmail.com",
packages=["ibei", "physicalproperty"],
url="https://github.com/jrsmith3/ibei",
description="Calculator for incomplete Bose-Einstein integral",
classifiers=["Programming Language :: Python",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Physics",
"Natural Language :: English", ],
install_requires=["numpy",
"sympy",
"astropy"],)
| # -*- coding: utf-8 -*-
from setuptools import setup
import ibei
setup(name="ibei",
version=ibei.__version__,
author="Joshua Ryan Smith",
author_email="joshua.r.smith@gmail.com",
packages=["ibei", "physicalproperty"],
url="https://github.com/jrsmith3/ibei",
description="Calculator for incomplete Bose-Einstein integral",
classifiers=["Programming Language :: Python",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Physics",
"Natural Language :: English", ],
install_requires=["numpy",
"sympy",
"astropy",
"physicalproperty"],)
| Add dependency on `physicalproperty` module | Add dependency on `physicalproperty` module
Closes #23.
| Python | mit | jrsmith3/ibei | ---
+++
@@ -18,4 +18,5 @@
"Natural Language :: English", ],
install_requires=["numpy",
"sympy",
- "astropy"],)
+ "astropy",
+ "physicalproperty"],) |
e18fbe4344083d4244e6b5b312240d580426b5b7 | setup.py | setup.py | import imp
import os
from setuptools import setup
ver = imp.load_source('version',
os.path.join(os.path.dirname(__file__), 'hessianfree',
'version.py')).__version__
with open("README.rst") as f:
long_description = f.read()
setup(
name='hessianfree',
packages=['hessianfree'],
version=ver,
description='Hessian-free optimization for deep networks',
long_description=long_description,
author='Daniel Rasmussen',
author_email='drasmussen@princeton.edu',
url='https://github.com/drasmuss/hessianfree',
download_url='https://github.com/drasmuss/hessianfree/tarball/%s' % ver,
keywords=['neural network', 'hessian free', 'deep learning'],
license="BSD",
classifiers=['Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: Microsoft :: Windows',
'Operating System :: Unix',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Topic :: Scientific/Engineering'],
)
| import imp
import os
from setuptools import setup, find_packages
ver = imp.load_source('version',
os.path.join(os.path.dirname(__file__), 'hessianfree',
'version.py')).__version__
with open("README.rst") as f:
long_description = f.read()
setup(
name='hessianfree',
packages=find_packages(),
package_data={'': ['*.cu']},
version=ver,
description='Hessian-free optimization for deep networks',
long_description=long_description,
author='Daniel Rasmussen',
author_email='drasmussen@princeton.edu',
url='https://github.com/drasmuss/hessianfree',
download_url='https://github.com/drasmuss/hessianfree/tarball/%s' % ver,
keywords=['neural network', 'hessian free', 'deep learning'],
license="BSD",
classifiers=['Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: Microsoft :: Windows',
'Operating System :: Unix',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Topic :: Scientific/Engineering'],
)
| Include GPU code in installation | Include GPU code in installation
| Python | bsd-2-clause | drasmuss/hessianfree | ---
+++
@@ -1,6 +1,6 @@
import imp
import os
-from setuptools import setup
+from setuptools import setup, find_packages
ver = imp.load_source('version',
os.path.join(os.path.dirname(__file__), 'hessianfree',
@@ -11,7 +11,8 @@
setup(
name='hessianfree',
- packages=['hessianfree'],
+ packages=find_packages(),
+ package_data={'': ['*.cu']},
version=ver,
description='Hessian-free optimization for deep networks',
long_description=long_description, |
c4adbb8f213e39225092fa7abe978bdde5591edb | setup.py | setup.py | #!/usr/bin/env python,
from setuptools import setup, find_packages
import versioneer
setup(
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
name='conda-build-utils',
description='toolset for analyzing automated conda package building at NSLS2',
author='Eric Dill',
author_email='edill@bnl.gov',
url='https://github.com/ericdill/conda_build_utils',
packages=find_packages(),
include_package_data=True,
install_requires=['pyyaml'],
entry_points="""
[console_scripts]
devbuild=nsls2_build_tools.build:cli
"""
)
| #!/usr/bin/env python,
from setuptools import setup, find_packages
import versioneer
setup(
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
name='conda-build-utils',
description='toolset for analyzing automated conda package building at NSLS2',
author='Eric Dill',
author_email='edill@bnl.gov',
url='https://github.com/ericdill/conda_build_utils',
packages=find_packages(),
include_package_data=True,
install_requires=['pyyaml'],
entry_points="""
[console_scripts]
devbuild=nsls2_build_tools.build:cli
build_from_yaml=nsls2_build_tools.build:build_from_yaml
"""
)
| Add entry point script for build from yaml spec | ENH: Add entry point script for build from yaml spec
| Python | bsd-3-clause | NSLS-II/lightsource2-recipes,NSLS-II/auto-build-tagged-recipes,NSLS-II/auto-build-tagged-recipes,NSLS-II/lightsource2-recipes,NSLS-II/lightsource2-recipes,NSLS-II/lightsource2-recipes | ---
+++
@@ -16,6 +16,7 @@
entry_points="""
[console_scripts]
devbuild=nsls2_build_tools.build:cli
+ build_from_yaml=nsls2_build_tools.build:build_from_yaml
"""
) |
440fb64008c847b04dd872518bc723bc0ad4a34a | setup.py | setup.py | # -*- coding: utf-8 -*-
import os
from setuptools import setup
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except:
return ''
setup(
name='todoist-python',
version='7.0.18',
packages=['todoist', 'todoist.managers'],
author='Doist Team',
author_email='info@todoist.com',
license='BSD',
description='todoist-python - The official Todoist Python API library',
long_description = read('README.md'),
install_requires=[
'requests',
],
# see here for complete list of classifiers
# http://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=(
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
),
)
| # -*- coding: utf-8 -*-
import os
from setuptools import setup
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except:
return ''
setup(
name='todoist-python',
version='8.0.0',
packages=['todoist', 'todoist.managers'],
author='Doist Team',
author_email='info@todoist.com',
license='BSD',
description='todoist-python - The official Todoist Python API library',
long_description = read('README.md'),
install_requires=[
'requests',
],
# see here for complete list of classifiers
# http://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=(
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
),
)
| Update the PyPI version to 8.0.0. | Update the PyPI version to 8.0.0.
| Python | mit | Doist/todoist-python | ---
+++
@@ -10,7 +10,7 @@
setup(
name='todoist-python',
- version='7.0.18',
+ version='8.0.0',
packages=['todoist', 'todoist.managers'],
author='Doist Team',
author_email='info@todoist.com', |
4bf9c53b6cbb02889e721d8180a2d20b979bf8d5 | setup.py | setup.py | # coding: utf-8
from os.path import join, dirname
from setuptools import setup
with open(join(dirname(__file__), 'README.rst')) as f:
long_description = f.read()
setup(
name='django-speedinfo',
version='1.0.1',
packages=['speedinfo'],
include_package_data=True,
install_requires=['Django>=1.10'],
license='MIT',
description='Live profiling tool for Django framework to measure views performance',
long_description=long_description,
url='https://github.com/catcombo/django-speedinfo',
author='Evgeniy Krysanov',
author_email='evgeniy.krysanov@gmail.com',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Environment :: Web Environment',
'Framework :: Django',
'Framework :: Django :: 1.10',
'Framework :: Django :: 1.11',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
keywords='django profiler views performance',
)
| # coding: utf-8
from os.path import join, dirname
from setuptools import setup
with open(join(dirname(__file__), 'README.rst')) as f:
long_description = f.read()
setup(
name='django-speedinfo',
version='1.0.1',
packages=['speedinfo', 'speedinfo.migrations'],
include_package_data=True,
install_requires=['Django>=1.10'],
license='MIT',
description='Live profiling tool for Django framework to measure views performance',
long_description=long_description,
url='https://github.com/catcombo/django-speedinfo',
author='Evgeniy Krysanov',
author_email='evgeniy.krysanov@gmail.com',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Environment :: Web Environment',
'Framework :: Django',
'Framework :: Django :: 1.10',
'Framework :: Django :: 1.11',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
keywords='django profiler views performance',
)
| Add missing migrations to package. | Add missing migrations to package.
| Python | mit | catcombo/django-speedinfo,catcombo/django-speedinfo,catcombo/django-speedinfo | ---
+++
@@ -10,7 +10,7 @@
setup(
name='django-speedinfo',
version='1.0.1',
- packages=['speedinfo'],
+ packages=['speedinfo', 'speedinfo.migrations'],
include_package_data=True,
install_requires=['Django>=1.10'],
license='MIT', |
761b155dffaba55e927a32a99aef7312290c22c1 | setup.py | setup.py | #! /usr/bin/env python
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
# Complain on 32-bit systems. See README for more details
import struct
if struct.calcsize('P') < 8:
raise RuntimeError(
'Simhash-py does not work on 32-bit systems. See README.md')
ext_modules = [Extension('simhash.table', [
'simhash/table.pyx',
'simhash/simhash-cpp/src/simhash.cpp'
], language='c++', libraries=['Judy']),
]
setup(name = 'simhash',
version = '0.1.1',
description = 'Near-Duplicate Detection with Simhash',
url = 'http://github.com/seomoz/simhash-py',
author = 'Dan Lecocq',
author_email = 'dan@seomoz.org',
packages = ['simhash'],
package_dir = {'simhash': 'simhash'},
cmdclass = {'build_ext': build_ext},
dependencies = [],
ext_modules = ext_modules,
classifiers = [
'Programming Language :: Python',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP'
],
)
| #! /usr/bin/env python
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
# Complain on 32-bit systems. See README for more details
import struct
if struct.calcsize('P') < 8:
raise RuntimeError(
'Simhash-py does not work on 32-bit systems. See README.md')
ext_modules = [Extension('simhash.table', [
'simhash/table.pyx',
'simhash/simhash-cpp/src/simhash.cpp'
], language='c++', libraries=['Judy']),
]
setup(name = 'simhash',
version = '0.1.1',
description = 'Near-Duplicate Detection with Simhash',
url = 'http://github.com/seomoz/simhash-py',
author = 'Dan Lecocq',
author_email = 'dan@moz.com',
packages = ['simhash'],
package_dir = {'simhash': 'simhash'},
cmdclass = {'build_ext': build_ext},
dependencies = [],
ext_modules = ext_modules,
classifiers = [
'Programming Language :: Python',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP'
],
)
| Update email address to @moz | Update email address to @moz
| Python | mit | pombredanne/simhash-py,seomoz/simhash-py,pombredanne/simhash-py,seomoz/simhash-py | ---
+++
@@ -22,7 +22,7 @@
description = 'Near-Duplicate Detection with Simhash',
url = 'http://github.com/seomoz/simhash-py',
author = 'Dan Lecocq',
- author_email = 'dan@seomoz.org',
+ author_email = 'dan@moz.com',
packages = ['simhash'],
package_dir = {'simhash': 'simhash'},
cmdclass = {'build_ext': build_ext}, |
1a3f5a4f4af85ccdff4d4d49962b276d7dc5a5dd | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name = 'robotframework-serverspeclibrary',
version = '0.2',
description = 'Server spec on Robot Framework inspired from Serverspec on Ruby',
url = 'https://github.com/wingyplus/robotframework-serverspeclibrary',
keywords = 'serverspec robotframework robot',
license = 'MIT',
author = 'Thanabodee Charoenpiriyakij',
author_email = 'wingyminus@gmail.com',
install_requires = ['robotframework>=2.8.5,<3', 'paramiko>=1.14.0'],
package_dir = {'': 'src'},
packages = ['ServerSpecLibrary', 'ServerSpecLibrary.keywords']
)
| from setuptools import setup, find_packages
setup(
name = 'robotframework-serverspeclibrary',
version = '0.1',
description = 'Server spec on Robot Framework inspired from Serverspec on Ruby',
url = 'https://github.com/wingyplus/robotframework-serverspeclibrary',
keywords = 'serverspec robotframework robot',
license = 'MIT',
author = 'Thanabodee Charoenpiriyakij',
author_email = 'wingyminus@gmail.com',
install_requires = ['robotframework>=2.8.5', 'paramiko>=1.14.0'],
package_dir = {'': 'src'},
packages = ['ServerSpecLibrary', 'ServerSpecLibrary.keywords']
)
| Revert "keyword package fails since roborframeowrk version 3" | Revert "keyword package fails since roborframeowrk version 3"
This reverts commit a2ba4d807a3fd720a24118164b6785486aa445b6.
| Python | mit | wingyplus/robotframework-serverspeclibrary,wingyplus/robotframework-serverspeclibrary | ---
+++
@@ -2,14 +2,14 @@
setup(
name = 'robotframework-serverspeclibrary',
- version = '0.2',
+ version = '0.1',
description = 'Server spec on Robot Framework inspired from Serverspec on Ruby',
url = 'https://github.com/wingyplus/robotframework-serverspeclibrary',
keywords = 'serverspec robotframework robot',
license = 'MIT',
author = 'Thanabodee Charoenpiriyakij',
author_email = 'wingyminus@gmail.com',
- install_requires = ['robotframework>=2.8.5,<3', 'paramiko>=1.14.0'],
+ install_requires = ['robotframework>=2.8.5', 'paramiko>=1.14.0'],
package_dir = {'': 'src'},
packages = ['ServerSpecLibrary', 'ServerSpecLibrary.keywords']
) |
9915097d9f53ac7fec7748ee221bb63a01638c9b | setup.py | setup.py | from distutils.core import setup
__version__ = '0.1'
setup_args = {
'name': 'hera_librarian',
'author': 'HERA Team',
'license': 'BSD',
'packages': ['hera_librarian'],
'scripts': [
'scripts/add_librarian_file_event.py',
'scripts/add_obs_librarian.py',
'scripts/launch_librarian_copy.py',
'scripts/librarian_assign_sessions.py',
'scripts/librarian_delete_files.py',
'scripts/librarian_initiate_offload.py',
'scripts/librarian_locate_file.py',
'scripts/librarian_offload_helper.py',
'scripts/librarian_set_file_deletion_policy.py',
'scripts/librarian_stream_file_or_directory.sh',
'scripts/upload_to_librarian.py',
],
'version': __version__
}
if __name__ == '__main__':
apply(setup, (), setup_args)
| from distutils.core import setup
__version__ = '0.1.0.99'
setup_args = {
'name': 'hera_librarian',
'author': 'HERA Team',
'license': 'BSD',
'packages': ['hera_librarian'],
'scripts': [
'scripts/add_librarian_file_event.py',
'scripts/add_obs_librarian.py',
'scripts/launch_librarian_copy.py',
'scripts/librarian_assign_sessions.py',
'scripts/librarian_delete_files.py',
'scripts/librarian_initiate_offload.py',
'scripts/librarian_locate_file.py',
'scripts/librarian_offload_helper.py',
'scripts/librarian_set_file_deletion_policy.py',
'scripts/librarian_stream_file_or_directory.sh',
'scripts/upload_to_librarian.py',
],
'version': __version__
}
if __name__ == '__main__':
apply(setup, (), setup_args)
| Call the previous commit version 0.1. | Call the previous commit version 0.1.
And tag it as v0.1. Master is now 0.1.0.99, slated to become 0.1.1 when we feel
like labeling the next thing as a release.
| Python | bsd-2-clause | HERA-Team/librarian,HERA-Team/librarian,HERA-Team/librarian | ---
+++
@@ -1,6 +1,6 @@
from distutils.core import setup
-__version__ = '0.1'
+__version__ = '0.1.0.99'
setup_args = {
'name': 'hera_librarian', |
86b447be632c18292369c100f93d3c036231b832 | setup.py | setup.py | from distutils.core import setup
from perfection import __version__ as VERSION
setup(
name='perfection',
version=VERSION,
url='https://github.com/eddieantonio/perfection',
license='MIT',
author='Eddie Antonio Santos',
author_email='easantos@ualberta.ca',
description='Perfect hashing utilities for Python',
long_description=open('README.rst',encoding="UTF-8").read(),
packages=['perfection',],
platforms='any',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules'
],
download_url = 'https://github.com/eddieantonio/perfection/tarball/v' + VERSION,
)
| from distutils.core import setup
from perfection import __version__ as VERSION
from codecs import open
setup(
name='perfection',
version=VERSION,
url='https://github.com/eddieantonio/perfection',
license='MIT',
author='Eddie Antonio Santos',
author_email='easantos@ualberta.ca',
description='Perfect hashing utilities for Python',
long_description=open('README.rst',encoding="UTF-8").read(),
packages=['perfection',],
platforms='any',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules'
],
download_url = 'https://github.com/eddieantonio/perfection/tarball/v' + VERSION,
)
| Use codecs in Python 2. | Use codecs in Python 2.
| Python | mit | eddieantonio/perfection | ---
+++
@@ -1,5 +1,7 @@
from distutils.core import setup
from perfection import __version__ as VERSION
+
+from codecs import open
setup(
name='perfection', |
70f58979b17bb20282ac37daf298dbe0b506973f | setup.py | setup.py | from setuptools import setup
version = '0.14.dev0'
long_description = '\n\n'.join([
open('README.rst').read(),
open('CREDITS.rst').read(),
open('CHANGES.rst').read(),
])
install_requires = [
'Django',
'django-extensions',
'django-nose',
'requests',
'itsdangerous',
'south',
'mock',
],
tests_require = [
]
setup(name='lizard-auth-client',
version=version,
description="A client for lizard-auth-server",
long_description=long_description,
# Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers
classifiers=['Programming Language :: Python',
'Framework :: Django',
],
keywords=[],
author='Erik-Jan Vos, Remco Gerlich',
author_email='remco.gerlich@nelen-schuurmans.nl',
url='http://www.nelen-schuurmans.nl/',
license='MIT',
packages=['lizard_auth_client'],
include_package_data=True,
zip_safe=False,
install_requires=install_requires,
tests_require=tests_require,
extras_require={'test': tests_require},
entry_points={
'console_scripts': [
]},
)
| from setuptools import setup
version = '0.14.dev0'
long_description = '\n\n'.join([
open('README.rst').read(),
open('CREDITS.rst').read(),
open('CHANGES.rst').read(),
])
install_requires = [
'Django >= 1.4, < 1.7',
'django-extensions',
'django-nose',
'requests',
'itsdangerous',
'south',
'mock',
],
tests_require = [
]
setup(name='lizard-auth-client',
version=version,
description="A client for lizard-auth-server",
long_description=long_description,
# Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers
classifiers=['Programming Language :: Python',
'Framework :: Django',
],
keywords=[],
author='Erik-Jan Vos, Remco Gerlich',
author_email='remco.gerlich@nelen-schuurmans.nl',
url='http://www.nelen-schuurmans.nl/',
license='MIT',
packages=['lizard_auth_client'],
include_package_data=True,
zip_safe=False,
install_requires=install_requires,
tests_require=tests_require,
extras_require={'test': tests_require},
entry_points={
'console_scripts': [
]},
)
| Document that we don't support Django 1.7 yet | Document that we don't support Django 1.7 yet
| Python | mit | lizardsystem/lizard-auth-client,lizardsystem/lizard-auth-client,lizardsystem/lizard-auth-client | ---
+++
@@ -9,7 +9,7 @@
])
install_requires = [
- 'Django',
+ 'Django >= 1.4, < 1.7',
'django-extensions',
'django-nose',
'requests', |
271f73f83759b40e6bac5595941b4b3616345886 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
def install():
desc = 'A Python client library for nyaa.se!',
setup(
name='py-nyaa',
version='1.0',
description=desc,
long_description=desc,
author='SuHun Han',
author_email='ssut@ssut.me',
url='https://github.com/ssut/py-nyaa',
classifiers = ['Development Status :: 5 - Production/Stable',
'Intended Audience :: Education',
'Intended Audience :: End Users/Desktop',
'License :: Freeware',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',
'Topic :: Education',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4'],
packages=find_packages(),
install_requires=[
'requests',
'xmltodict',
],
)
if __name__ == "__main__":
install() | #!/usr/bin/env python
from setuptools import setup, find_packages
def install():
desc = 'A Python client library for nyaa.se!',
setup(
name='nyaa',
version='1.0',
description=desc,
long_description=desc,
author='SuHun Han',
author_email='ssut@ssut.me',
url='https://github.com/ssut/py-nyaa',
classifiers = ['Development Status :: 5 - Production/Stable',
'Intended Audience :: Education',
'Intended Audience :: End Users/Desktop',
'License :: Freeware',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',
'Topic :: Education',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4'],
packages=find_packages(),
install_requires=[
'requests',
'xmltodict',
],
)
if __name__ == "__main__":
install() | Rename the package to "nyaa" | Rename the package to "nyaa"
| Python | mit | ssut/py-nyaa | ---
+++
@@ -4,7 +4,7 @@
def install():
desc = 'A Python client library for nyaa.se!',
setup(
- name='py-nyaa',
+ name='nyaa',
version='1.0',
description=desc,
long_description=desc, |
2a084d4efcd59ba599d56376770748ccbae117ab | setup.py | setup.py | '''A setuptools based installer for proptools.
Based on https://github.com/pypa/sampleproject/blob/master/setup.py
Matt Vernacchia
proptools
2016 Sept 21
'''
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
setup(
name='proptools',
version='0.0.0a0',
description='Rocket propulsion design calculation tools.',
author='Matt Vernacchia',
author_email='mvernacc@mit.edu.',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
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 :: Science/Research',
'Topic :: Scientific/Engineering',
# 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 :: 2.7',
],
# What does your project relate to?
keywords='rocket propulsion engineering aerospace',
install_requires=['numpy', 'sphinx_rtd_theme'],
packages=find_packages(),
scripts=[],
)
| '''A setuptools based installer for proptools.
Based on https://github.com/pypa/sampleproject/blob/master/setup.py
Matt Vernacchia
proptools
2016 Sept 21
'''
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
setup(
name='proptools',
version='0.0.0a0',
description='Rocket propulsion design calculation tools.',
author='Matt Vernacchia',
author_email='mvernacc@mit.edu.',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
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 :: Science/Research',
'Topic :: Scientific/Engineering',
# 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 :: 2.7',
],
# What does your project relate to?
keywords='rocket propulsion engineering aerospace',
install_requires=['numpy', 'sphinx_rtd_theme', 'matplotlib', 'scikit-aero'],
packages=find_packages(),
scripts=[],
)
| Add matplotlib and scikit-aero dependencies. | Add matplotlib and scikit-aero dependencies.
| Python | mit | mvernacc/proptools | ---
+++
@@ -46,7 +46,7 @@
keywords='rocket propulsion engineering aerospace',
- install_requires=['numpy', 'sphinx_rtd_theme'],
+ install_requires=['numpy', 'sphinx_rtd_theme', 'matplotlib', 'scikit-aero'],
packages=find_packages(),
|
195a0d853bd8add0d0955b8f5e681d8c8b0016c6 | setup.py | setup.py | from setuptools import setup, find_packages
author = 'Michael Maurizi'
author_email = 'info@azavea.com'
setup(
name='django-tinsel',
version='0.1.0',
description='A python module for decorating function-based Django views',
long_description=open('README.rst').read(),
author=author,
author_email=author_email,
maintainer=author,
maintainer_email=author_email,
url='http://github.com/azavea/django-tinsel',
packages=find_packages(exclude=('test_app',)),
license='Apache License (2.0)',
keywords="django view decorator",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python",
"Environment :: Plugins",
"Framework :: Django",
"License :: OSI Approved :: Apache Software License"
],
install_requires=['django>=1.5'],
)
| from setuptools import setup, find_packages
author = 'Michael Maurizi'
author_email = 'info@azavea.com'
setup(
name='django-tinsel',
version='0.1.1',
description='A python module for decorating function-based Django views',
long_description=open('README.rst').read(),
author=author,
author_email=author_email,
maintainer=author,
maintainer_email=author_email,
url='http://github.com/azavea/django-tinsel',
packages=find_packages(exclude=('test_app',)),
license='Apache License (2.0)',
keywords="django view decorator",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python",
"Environment :: Plugins",
"Framework :: Django",
"License :: OSI Approved :: Apache Software License"
],
install_requires=['django>=1.5'],
)
| Bump up version number for PyPI release | Bump up version number for PyPI release
| Python | apache-2.0 | azavea/django-tinsel,azavea/django-tinsel | ---
+++
@@ -5,7 +5,7 @@
setup(
name='django-tinsel',
- version='0.1.0',
+ version='0.1.1',
description='A python module for decorating function-based Django views',
long_description=open('README.rst').read(),
author=author, |
31d61511f5342f78cc8e6c31ff281aea8ed804b7 | setup.py | setup.py | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
try:
long_description = open("README.md").read()
except IOError:
long_description = ""
setup(
name="vania",
version="0.1.0",
description="A module to fairly distribute objects among targets considering weights.",
license="MIT",
author="Hackathonners",
packages=find_packages(),
install_requires=[
'pulp',
],
package_dir={'': '.'},
long_description=long_description,
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 3",
],
test_suite='nose.collector',
tests_require=['nose'],
)
| # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import setuptools.command.build_py
import subprocess
class GenDocsCommand(setuptools.command.build_py.build_py):
"""Command to generate docs."""
def run(self):
subprocess.Popen(
['pdoc', '--html', 'vania/fair_distributor.py', '--html-dir=docs/', '--overwrite'])
setuptools.command.build_py.build_py.run(self)
try:
long_description = open("README.md").read()
except IOError:
long_description = ""
setup(
name="vania",
version="0.1.0",
description="A module to fairly distribute objects among targets considering weights.",
license="MIT",
author="Hackathonners",
packages=find_packages(),
install_requires=[
'pulp',
'pdoc'
],
package_dir={'': '.'},
long_description=long_description,
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 3",
],
test_suite='nose.collector',
tests_require=['nose'],
cmdclass={
'gendocs': GenDocsCommand
},
)
| Add command to generate docs | Add command to generate docs
| Python | mit | Hackathonners/vania | ---
+++
@@ -1,5 +1,17 @@
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
+import setuptools.command.build_py
+import subprocess
+
+
+class GenDocsCommand(setuptools.command.build_py.build_py):
+
+ """Command to generate docs."""
+
+ def run(self):
+ subprocess.Popen(
+ ['pdoc', '--html', 'vania/fair_distributor.py', '--html-dir=docs/', '--overwrite'])
+ setuptools.command.build_py.build_py.run(self)
try:
long_description = open("README.md").read()
@@ -15,6 +27,7 @@
packages=find_packages(),
install_requires=[
'pulp',
+ 'pdoc'
],
package_dir={'': '.'},
long_description=long_description,
@@ -24,4 +37,7 @@
],
test_suite='nose.collector',
tests_require=['nose'],
+ cmdclass={
+ 'gendocs': GenDocsCommand
+ },
) |
a921605204a7a89839ef01f0b76d62cfacd3af25 | setup.py | setup.py | #!/usr/bin/env python
import os
from distutils.core import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='whack',
version='0.3.4',
description='Utility for installing binaries from source with a single command',
long_description=read("README"),
author='Michael Williamson',
url='http://github.com/mwilliamson/whack',
scripts=["scripts/whack"],
packages=['whack'],
install_requires=[
'blah>=0.1.10,<0.2',
'requests>=1,<2',
"catchy>=0.1.2,<0.2",
"spur>=0.3,<0.4",
"locket>=0.1,<0.2",
],
)
| #!/usr/bin/env python
import os
from distutils.core import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='whack',
version='0.3.4',
description='Utility for installing binaries from source with a single command',
long_description=read("README"),
author='Michael Williamson',
url='http://github.com/mwilliamson/whack',
scripts=["scripts/whack"],
packages=['whack'],
install_requires=[
'blah>=0.1.10,<0.2',
'requests>=1,<2',
"catchy>=0.1.2,<0.2",
"spur>=0.3,<0.4",
"locket>=0.1.1,<0.2",
],
)
| Update locket to 0.1.1 for bug fix | Update locket to 0.1.1 for bug fix
| Python | bsd-2-clause | mwilliamson/whack | ---
+++
@@ -20,6 +20,6 @@
'requests>=1,<2',
"catchy>=0.1.2,<0.2",
"spur>=0.3,<0.4",
- "locket>=0.1,<0.2",
+ "locket>=0.1.1,<0.2",
],
) |
3117668799506f41c24a6705529ce72a1c18f600 | setup.py | setup.py | import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'pyramid',
'SQLAlchemy',
'transaction',
'pyramid_tm',
'pyramid_debugtoolbar',
'zope.sqlalchemy',
'waitress',
]
setup(name='uptrack',
version='0.0',
description='uptrack',
long_description=README + '\n\n' + CHANGES,
classifiers=[
"Programming Language :: Python",
"Framework :: Pyramid",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
],
author='',
author_email='',
url='',
keywords='web wsgi bfg pylons pyramid',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
test_suite='uptrack',
install_requires=requires,
entry_points="""\
[paste.app_factory]
main = uptrack:main
[console_scripts]
initialize_uptrack_db = uptrack.scripts.initializedb:main
""",
)
| # There is a conflict with older versions on EL 6
__requires__ = ['PasteDeploy>=1.5.0',
'WebOb>=1.2b3',
]
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'pyramid',
'SQLAlchemy',
'transaction',
'pyramid_tm',
'pyramid_debugtoolbar',
'zope.sqlalchemy',
'waitress',
]
setup(name='uptrack',
version='0.0',
description='uptrack',
long_description=README + '\n\n' + CHANGES,
classifiers=[
"Programming Language :: Python",
"Framework :: Pyramid",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
],
author='',
author_email='',
url='',
keywords='web wsgi bfg pylons pyramid',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
test_suite='uptrack',
install_requires=requires,
entry_points="""\
[paste.app_factory]
main = uptrack:main
[console_scripts]
initialize_uptrack_db = uptrack.scripts.initializedb:main
""",
)
| Fix conflict with older versions on EL 6 | Fix conflict with older versions on EL 6
| Python | agpl-3.0 | network-box/uptrack,network-box/uptrack | ---
+++
@@ -1,3 +1,8 @@
+# There is a conflict with older versions on EL 6
+__requires__ = ['PasteDeploy>=1.5.0',
+ 'WebOb>=1.2b3',
+ ]
+
import os
from setuptools import setup, find_packages |
02c26a2ced9348e10504ffbac2dd7cca69ded3c0 | setup.py | setup.py | #!/usr/bin/env python
# Copyright (c) 2013 Hewlett-Packard Development Company, 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.
import setuptools
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup(
setup_requires=['pbr>=1.3'],
pbr=True)
| #!/usr/bin/env python
# Copyright (c) 2013 Hewlett-Packard Development Company, 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.
import setuptools
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup(
setup_requires=['pbr>=1.8'],
pbr=True)
| Enforce that pbr used is >= 1.8 | Enforce that pbr used is >= 1.8
It otherwise fails if used against older pbr (e.g distro packaging build)
Change-Id: I19dbd5d14a9135408ad21a34834f0bd1fb3ea55d
| Python | mit | openstack/sqlalchemy-migrate,rcherrueau/sqlalchemy-migrate,stackforge/sqlalchemy-migrate,openstack/sqlalchemy-migrate,rcherrueau/sqlalchemy-migrate | ---
+++
@@ -25,5 +25,5 @@
pass
setuptools.setup(
- setup_requires=['pbr>=1.3'],
+ setup_requires=['pbr>=1.8'],
pbr=True) |
cf3322e1e85418e480f75d960244e506c0df4505 | setup.py | setup.py | #
# setup.py
#
# Copyright (c) 2013 Luis Garcia.
# This source file is subject to terms of the MIT License. (See file LICENSE)
#
"""Setup script for the scope library."""
from distutils.core import setup
NAME = 'scope'
VERSION = '0.1.1'
DESCRIPTION = 'Template library for multi-language code generation'
AUTHOR = 'Luis Garcia'
AUTHOR_EMAIL = 'lgarcia@codespot.in'
URL = 'https://github.com/lrgar/scope'
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: C++',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Software Development :: Code Generators',
'Topic :: Software Development :: Libraries'
]
LICENSE = 'MIT'
setup(
name=NAME,
version=VERSION,
description=DESCRIPTION,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
url=URL,
packages=['scope', 'scope.lang'],
license=LICENSE,
classifiers=CLASSIFIERS
)
| #
# setup.py
#
# Copyright (c) 2013 Luis Garcia.
# This source file is subject to terms of the MIT License. (See file LICENSE)
#
"""Setup script for the scope library."""
from distutils.core import setup
NAME = 'scope'
VERSION = '0.1.1'
DESCRIPTION = 'Python library for creating code templates'
AUTHOR = 'Luis Garcia'
AUTHOR_EMAIL = 'lgarcia@codespot.in'
URL = 'https://github.com/lrgar/scope'
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: C++',
'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',
'Programming Language :: Python :: 3.3',
'Topic :: Software Development :: Code Generators',
'Topic :: Software Development :: Libraries'
]
LICENSE = 'MIT'
setup(
name=NAME,
version=VERSION,
description=DESCRIPTION,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
url=URL,
packages=['scope', 'scope.lang'],
license=LICENSE,
classifiers=CLASSIFIERS
)
| Update description and add more classifiers | Update description and add more classifiers
| Python | mit | lrgar/scope | ---
+++
@@ -11,7 +11,7 @@
NAME = 'scope'
VERSION = '0.1.1'
-DESCRIPTION = 'Template library for multi-language code generation'
+DESCRIPTION = 'Python library for creating code templates'
AUTHOR = 'Luis Garcia'
AUTHOR_EMAIL = 'lgarcia@codespot.in'
URL = 'https://github.com/lrgar/scope'
@@ -23,7 +23,13 @@
'Programming Language :: C++',
'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',
+ 'Programming Language :: Python :: 3.3',
'Topic :: Software Development :: Code Generators',
'Topic :: Software Development :: Libraries'
] |
36323768087a716fdc61f9991c761d64c15a9cf1 | setup.py | setup.py | import os
from setuptools import setup, find_packages
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).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-swiftbrowser',
version='1.2.3',
packages=['swiftbrowser'],
include_package_data=True,
license='Apache License (2.0)',
description='A simple Django app to access Openstack Swift',
long_description=README,
url='http://www.cschwede.com/',
author='Christian Schwede',
author_email='info@cschwede.de',
install_requires=[
'django>=1.8',
'python-swiftclient>=2.7',
'django-jfu',
'PIL',
'keystoneauth1',
'django_openstack_auth',
],
zip_safe=False,
classifiers=[
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache License (2.0)',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
)
| import os
from setuptools import setup, find_packages
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).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-swiftbrowser',
version='1.2.3',
packages=['swiftbrowser'],
include_package_data=True,
license='Apache License (2.0)',
description='A simple Django app to access Openstack Swift',
long_description=README,
url='http://www.cschwede.com/',
author='Christian Schwede',
author_email='info@cschwede.de',
install_requires=[
'django>=1.8',
'python-swiftclient>=2.7',
'django-jfu',
'PIL',
'keystoneauth1>=2.2.0',
'django-openstack-auth>=2.1.1',
],
zip_safe=False,
classifiers=[
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache License (2.0)',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
)
| Set minimum versions for openstack autha nd keystone | Set minimum versions for openstack autha nd keystone
| Python | apache-2.0 | bkawula/django-swiftbrowser,bkawula/django-swiftbrowser,bkawula/django-swiftbrowser,bkawula/django-swiftbrowser | ---
+++
@@ -22,8 +22,8 @@
'python-swiftclient>=2.7',
'django-jfu',
'PIL',
- 'keystoneauth1',
- 'django_openstack_auth',
+ 'keystoneauth1>=2.2.0',
+ 'django-openstack-auth>=2.1.1',
],
zip_safe=False,
classifiers=[ |
4ae89d7a3adf9541c7e1fb202aabdf15489289a6 | setup.py | setup.py | #!/usr/bin/env python
import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f:
readme = f.read()
setup(
name='ctop',
version='1.0.0',
description='A lightweight top like monitor for linux CGroups',
long_description=readme,
author='Jean-Tiare Le Bigot',
author_email='jt@yadutaf.fr',
url='https://github.com/yadutaf/ctop',
py_modules=['cgroup_top'],
scripts=['bin/ctop'],
license='MIT',
platforms = 'any',
classifiers=[
'Environment :: Console',
'Environment :: Console :: Curses',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Topic :: System :: Monitoring',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
],
)
| #!/usr/bin/env python
import os
from io import open
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8') as f:
readme = f.read()
setup(
name='ctop',
version='1.0.0',
description='A lightweight top like monitor for linux CGroups',
long_description=readme,
author='Jean-Tiare Le Bigot',
author_email='jt@yadutaf.fr',
url='https://github.com/yadutaf/ctop',
py_modules=['cgroup_top'],
scripts=['bin/ctop'],
license='MIT',
platforms = 'any',
classifiers=[
'Environment :: Console',
'Environment :: Console :: Curses',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Topic :: System :: Monitoring',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
],
)
| Fix encoding issues with open() | Fix encoding issues with open()
Traceback (most recent call last):
File "setup.py", line 7, in <module>
readme = f.read()
File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 4610: ordinal not in range(128)
When opening files in text mode, a good practice is to use io.open()
with an explicit encoding argument. io.open() works in Python 2.6 and
all later versions. In Python 3, io.open() is an alias for the built-in
open().
| Python | mit | yadutaf/ctop | ---
+++
@@ -1,9 +1,10 @@
#!/usr/bin/env python
import os
+from io import open
from setuptools import setup
-with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f:
+with open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8') as f:
readme = f.read()
setup( |
e69c47fb47535ee19310f7e5aa4bfb744bf0c627 | setup.py | setup.py | # encoding: utf-8
import sys
from setuptools import setup
def read_description():
with open('README.md', 'r', encoding='utf-8') as f:
return f.read()
setup(
name='Inject',
version='4.1.1',
url='https://github.com/ivankorobkov/python-inject',
license='Apache License 2.0',
author='Ivan Korobkov',
author_email='ivan.korobkov@gmail.com',
description='Python dependency injection framework',
long_description=read_description(),
long_description_content_type="text/markdown",
packages=['inject'],
package_data={'inject': ['py.typed']},
include_package_data=True,
zip_safe=False,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development :: Libraries :: Python Modules']
)
| # encoding: utf-8
import sys
from setuptools import setup
def read_description():
with open('README.md', 'r', encoding='utf-8') as f:
return f.read()
setup(
name='Inject',
version='4.1.1',
url='https://github.com/ivankorobkov/python-inject',
license='Apache License 2.0',
author='Ivan Korobkov',
author_email='ivan.korobkov@gmail.com',
description='Python dependency injection framework',
long_description=read_description(),
long_description_content_type="text/markdown",
packages=['inject'],
package_data={'inject': ['py.typed']},
zip_safe=False,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development :: Libraries :: Python Modules']
)
| Remove include_package_data to install py.typed | Remove include_package_data to install py.typed
I found that sdist file does not include `py.typed`. For workaround, I found that when I remove `include_package_data` it works. | Python | apache-2.0 | ivankorobkov/python-inject | ---
+++
@@ -24,7 +24,6 @@
packages=['inject'],
package_data={'inject': ['py.typed']},
- include_package_data=True,
zip_safe=False,
classifiers=[ |
44fd612067f7cac357db76ec21a6e03403f84015 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
setup(
name='ckanapi',
version='3.3-dev',
description=
'A command line interface and Python module for '
'accessing the CKAN Action API',
license='MIT',
author='Ian Ward',
author_email='ian@excess.org',
url='https://github.com/ckan/ckanapi',
packages=[
'ckanapi',
'ckanapi.tests',
'ckanapi.tests.mock',
'ckanapi.cli',
],
test_suite='ckanapi.tests',
zip_safe=False,
entry_points = """
[console_scripts]
ckanapi=ckanapi.cli.main:main
[paste.paster_command]
ckanapi=ckanapi.cli.paster:CKANAPICommand
"""
)
| #!/usr/bin/env python
from setuptools import setup
setup(
name='ckanapi',
version='3.3-dev',
description=
'A command line interface and Python module for '
'accessing the CKAN Action API',
license='MIT',
author='Ian Ward',
author_email='ian@excess.org',
url='https://github.com/ckan/ckanapi',
packages=[
'ckanapi',
'ckanapi.tests',
'ckanapi.tests.mock',
'ckanapi.cli',
],
install_requires=[
'setuptools',
'docopt',
'requests',
'simplejson',
],
test_suite='ckanapi.tests',
zip_safe=False,
entry_points = """
[console_scripts]
ckanapi=ckanapi.cli.main:main
[paste.paster_command]
ckanapi=ckanapi.cli.paster:CKANAPICommand
"""
)
| Add required packages for pip install | Add required packages for pip install | Python | mit | LaurentGoderre/ckanapi,xingyz/ckanapi,perceptron-XYZ/ckanapi,eawag-rdm/ckanapi,wardi/ckanapi,metaodi/ckanapi | ---
+++
@@ -18,6 +18,12 @@
'ckanapi.tests.mock',
'ckanapi.cli',
],
+ install_requires=[
+ 'setuptools',
+ 'docopt',
+ 'requests',
+ 'simplejson',
+ ],
test_suite='ckanapi.tests',
zip_safe=False,
entry_points = """ |
ef2763b0bf47d659cc8c57cdda19286feb35cb44 | setup.py | setup.py | from setuptools import setup
setup(
name='broadbean',
version='0.9',
# We might as well require what we know will work
# although older numpy and matplotlib version will probably work too
install_requires=['numpy>=1.12.1',
'matplotlib>=2.0.1'],
author='William H.P. Nielsen',
author_email='whpn@mailbox.org',
description=("Package for easily generating and manipulating signal "
"pulses. Developed for use with qubits in the quantum "
"computing labs of Copenhagen, Delft, and Sydney, but "
"should be generally useable."),
license='MIT',
packages=['broadbean'],
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'Programming Language :: Python :: 3.5'
],
keywords='Pulsebuilding signal processing arbitrary waveforms',
url='https://github.com/QCoDeS/broadbean'
)
| from setuptools import setup
setup(
name='broadbean',
version='0.9',
# We might as well require what we know will work
# although older numpy and matplotlib version will probably work too
install_requires=['numpy>=1.12.1',
'matplotlib>=2.0.1',
'PyQt5>5.7.1'],
author='William H.P. Nielsen',
author_email='whpn@mailbox.org',
description=("Package for easily generating and manipulating signal "
"pulses. Developed for use with qubits in the quantum "
"computing labs of Copenhagen, Delft, and Sydney, but "
"should be generally useable."),
license='MIT',
packages=['broadbean'],
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'Programming Language :: Python :: 3.5'
],
keywords='Pulsebuilding signal processing arbitrary waveforms',
url='https://github.com/QCoDeS/broadbean'
)
| Add PyQt5 to install requirements | fix: Add PyQt5 to install requirements
Add PyQt5 to install requirements
| Python | mit | WilliamHPNielsen/broadbean | ---
+++
@@ -7,7 +7,8 @@
# We might as well require what we know will work
# although older numpy and matplotlib version will probably work too
install_requires=['numpy>=1.12.1',
- 'matplotlib>=2.0.1'],
+ 'matplotlib>=2.0.1',
+ 'PyQt5>5.7.1'],
author='William H.P. Nielsen',
author_email='whpn@mailbox.org', |
172d3eecfbd92671a941303eff777436780c7d5e | 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='windpowerlib',
version='0.2.0dev',
description='Creating time series of wind power plants.',
url='http://github.com/wind-python/windpowerlib',
author='oemof developer group',
author_email='windpowerlib@rl-institut.de',
license=None,
packages=['windpowerlib'],
package_data={
'windpowerlib': [os.path.join('data', '*.csv')]},
long_description=read('README.rst'),
zip_safe=False,
install_requires=['pandas >= 0.19.1, < 0.25',
'requests < 3.0'],
extras_require={
'dev': ['pytest', 'jupyter', 'sphinx_rtd_theme', 'nbformat']})
| import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name='windpowerlib',
version='0.2.0dev',
description='Creating time series of wind power plants.',
url='http://github.com/wind-python/windpowerlib',
author='oemof developer group',
author_email='windpowerlib@rl-institut.de',
license=None,
packages=['windpowerlib'],
package_data={
'windpowerlib': [os.path.join('data', '*.csv'),
os.path.join('oedb', '*.csv')]},
long_description=read('README.rst'),
zip_safe=False,
install_requires=['pandas >= 0.19.1, < 0.25',
'requests < 3.0'],
extras_require={
'dev': ['pytest', 'jupyter', 'sphinx_rtd_theme', 'nbformat']})
| Add new oedb data directory to package | Add new oedb data directory to package
| Python | mit | wind-python/windpowerlib | ---
+++
@@ -15,7 +15,8 @@
license=None,
packages=['windpowerlib'],
package_data={
- 'windpowerlib': [os.path.join('data', '*.csv')]},
+ 'windpowerlib': [os.path.join('data', '*.csv'),
+ os.path.join('oedb', '*.csv')]},
long_description=read('README.rst'),
zip_safe=False,
install_requires=['pandas >= 0.19.1, < 0.25', |
214d788073532c1ae2aecea1a61dc35e08d5e78f | cybox/common/__init__.py | cybox/common/__init__.py | from contributor import Contributor
from daterange import Date_Range
from defined_object import DefinedObject
from personnel import Personnel
| from contributor import Contributor
from daterange import DateRange
from defined_object import DefinedObject
from personnel import Personnel
| Remove underscore from class name. | Remove underscore from class name.
| Python | bsd-3-clause | CybOXProject/python-cybox | ---
+++
@@ -1,5 +1,5 @@
from contributor import Contributor
-from daterange import Date_Range
+from daterange import DateRange
from defined_object import DefinedObject
from personnel import Personnel
|
3f9a6944763a75171388c3c8b812d71bf45c1219 | test/test_integration.py | test/test_integration.py | import unittest
import http.client
import time
class TestStringMethods(unittest.TestCase):
def test_404NoConfig(self):
connRouter = http.client.HTTPConnection("localhost", 8666)
connConfig = http.client.HTTPConnection("localhost", 8888)
connRouter.request("GET", "/google2")
response = connRouter.getresponse()
connRouter.close()
self.assertEqual(response.status, 404)
def test_200WithConfig(self):
connConfig = http.client.HTTPConnection("localhost", 8888)
connConfig.request("GET","/configure?location=/google&upstream=http://www.google.com/&ttl=10")
response = connConfig.getresponse()
data = response.read()
connConfig.close()
self.assertEqual(response.status, 200)
connRouter = http.client.HTTPConnection("localhost", 8666)
connRouter.request("GET", "/google")
response = connRouter.getresponse()
data = response.read()
self.assertEqual(response.status, 302)
connRouter.close()
connConfig2 = http.client.HTTPConnection("localhost", 8888)
connConfig2.request("DELETE","/configure?location=/google")
response2 = connConfig2.getresponse()
data = response2.read()
self.assertEqual(response2.status, 200)
connConfig2.close()
time.sleep(20)
if __name__ == '__main__':
unittest.main()
| import unittest
import http.client
import time
class TestStringMethods(unittest.TestCase):
def test_404NoConfig(self):
connRouter = http.client.HTTPConnection("localhost", 8666)
connConfig = http.client.HTTPConnection("localhost", 8888)
connRouter.request("GET", "/google")
response = connRouter.getresponse()
connRouter.close()
self.assertEqual(response.status, 404)
def test_200WithConfig(self):
connConfig = http.client.HTTPConnection("localhost", 8888)
connConfig.request("GET","/configure?location=/google&upstream=http://www.google.com/&ttl=10")
response = connConfig.getresponse()
data = response.read()
connConfig.close()
self.assertEqual(response.status, 200)
connRouter = http.client.HTTPConnection("localhost", 8666)
connRouter.request("GET", "/google")
response = connRouter.getresponse()
data = response.read()
self.assertEqual(response.status, 302)
connRouter.close()
connConfig2 = http.client.HTTPConnection("localhost", 8888)
connConfig2.request("DELETE","/configure?location=/google")
response2 = connConfig2.getresponse()
data = response2.read()
self.assertEqual(response2.status, 200)
connConfig2.close()
time.sleep(20)
if __name__ == '__main__':
unittest.main()
| Fix test to use /google instead of /google2 | Fix test to use /google instead of /google2
| Python | apache-2.0 | dhiaayachi/dynx,dhiaayachi/dynx | ---
+++
@@ -7,13 +7,12 @@
def test_404NoConfig(self):
connRouter = http.client.HTTPConnection("localhost", 8666)
connConfig = http.client.HTTPConnection("localhost", 8888)
- connRouter.request("GET", "/google2")
+ connRouter.request("GET", "/google")
response = connRouter.getresponse()
connRouter.close()
self.assertEqual(response.status, 404)
def test_200WithConfig(self):
-
connConfig = http.client.HTTPConnection("localhost", 8888)
connConfig.request("GET","/configure?location=/google&upstream=http://www.google.com/&ttl=10")
response = connConfig.getresponse() |
8c46e91ec66fc1ee15f037109e78030c2fcd1bf8 | tests/test_middleware.py | tests/test_middleware.py | from os import environ
from unittest import TestCase
environ['DJANGO_SETTINGS_MODULE'] = 'test_settings'
from incuna_auth.middleware import LoginRequiredMiddleware
class AuthenticatedUser(object):
def is_authenticated(self):
return True
class AnonymousUser(object):
def is_authenticated(self):
return False
class Request(object):
def __init__(self, path_info, method='GET'):
self.path_info = path_info
self.method = method
class TestLoginRequiredMiddleware(TestCase):
def setUp(self):
self.middleware = LoginRequiredMiddleware()
def test_skip_middleware_if_url_is_exempt(self):
self.request = Request('exempt-and-protected-url/')
self.request.user = AnonymousUser()
response = self.middleware.process_request(self.request)
self.assertEqual(response, None)
def test_skip_middleware_if_user_is_authenticated(self):
self.request = Request('protected-url/')
self.request.user = AuthenticatedUser()
response = self.middleware.process_request(self.request)
self.assertEqual(response, None)
| from os import environ
from unittest import TestCase
environ['DJANGO_SETTINGS_MODULE'] = 'test_settings'
from incuna_auth.middleware import LoginRequiredMiddleware
class AuthenticatedUser(object):
def is_authenticated(self):
return True
class AnonymousUser(object):
def is_authenticated(self):
return False
class Request(object):
def __init__(self, path_info, method='GET'):
self.path_info = path_info
self.method = method
class TestLoginRequiredMiddleware(TestCase):
def setUp(self):
self.middleware = LoginRequiredMiddleware()
def test_skip_middleware_if_url_is_exempt(self):
self.request = Request('exempt-and-protected-url/')
self.request.user = AnonymousUser()
response = self.middleware.process_request(self.request)
self.assertEqual(response, None)
def test_skip_middleware_if_url_is_not_protected(self):
self.request = Request('non-protected-url/')
self.request.user = AnonymousUser()
response = self.middleware.process_request(self.request)
self.assertEqual(response, None)
def test_skip_middleware_if_user_is_authenticated(self):
self.request = Request('protected-url/')
self.request.user = AuthenticatedUser()
response = self.middleware.process_request(self.request)
self.assertEqual(response, None)
| Add test for non-exempt, non-protected URLs. | Add test for non-exempt, non-protected URLs.
| Python | bsd-2-clause | incuna/incuna-auth,incuna/incuna-auth,ghickman/incuna-auth,ghickman/incuna-auth | ---
+++
@@ -32,6 +32,12 @@
response = self.middleware.process_request(self.request)
self.assertEqual(response, None)
+ def test_skip_middleware_if_url_is_not_protected(self):
+ self.request = Request('non-protected-url/')
+ self.request.user = AnonymousUser()
+ response = self.middleware.process_request(self.request)
+ self.assertEqual(response, None)
+
def test_skip_middleware_if_user_is_authenticated(self):
self.request = Request('protected-url/')
self.request.user = AuthenticatedUser() |
1f75b173b85cc107e7bdb3be4629e7916a9851d9 | setup.py | setup.py | from setuptools import setup
setup(
name='python-cephclient',
packages=['cephclient'],
version='0.1.0.5',
url='https://github.com/dmsimard/python-cephclient',
author='David Moreau Simard',
author_email='moi@dmsimard.com',
description='A client library in python for the Ceph REST API.',
long_description=open('README.rst', 'rt').read(),
license='Apache License, Version 2.0',
keywords='ceph rest api ceph-rest-api client library',
install_requires=['lxml>=3.2.5', 'requests>=2.2.1'],
classifiers=[
'License :: OSI Approved :: Apache Software License',
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Intended Audience :: Information Technology',
'Programming Language :: Python :: 2.7',
'Topic :: Utilities'
]
)
| from setuptools import setup
setup(
name='python-cephclient',
packages=['cephclient'],
version='0.1.0.5',
url='https://github.com/dmsimard/python-cephclient',
author='David Moreau Simard',
author_email='moi@dmsimard.com',
description='A client library in python for the Ceph REST API.',
long_description=open('README.rst', 'rt').read(),
license='Apache License, Version 2.0',
keywords='ceph rest api ceph-rest-api client library',
install_requires=['lxml>=3.2.5', 'requests>=2.2.1'],
classifiers=[
'License :: OSI Approved :: Apache Software License',
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Intended Audience :: Information Technology',
'Programming Language :: Python :: 2.7',
'Topic :: Utilities'
]
)
| Tag python-cephclient as beta instead of alpha | Tag python-cephclient as beta instead of alpha
It's pretty much beyond alpha now.
| Python | apache-2.0 | dmsimard/python-cephclient | ---
+++
@@ -14,7 +14,7 @@
install_requires=['lxml>=3.2.5', 'requests>=2.2.1'],
classifiers=[
'License :: OSI Approved :: Apache Software License',
- 'Development Status :: 3 - Alpha',
+ 'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Intended Audience :: Information Technology', |
38f36398cf7862d22e3fa0f1047446b6d5e9ce17 | setup.py | setup.py | """Set up script"""
from setuptools import setup
import os
def _create_long_desc():
"""Create long description and README formatted with rst."""
_long_desc = ''
if os.path.isfile('README.md'):
with open('README.md', 'r') as rf:
return rf.read()
if os.path.isfile('README.rst'):
with open('README.rst', 'r') as rf:
return rf.read()
long_desc = _create_long_desc()
# Setup
setup(name='cronquot',
version='0.1.2',
description='Cron scheduler.',
long_description=long_desc,
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
'License :: OSI Approved :: MIT License',
'Topic :: Software Development :: Libraries :: Python Modules'
],
keywords='cron crontab schedule',
author='Shohei Mukai',
author_email='mukaishohei76@gmail.com',
url='https://github.com/pyohei/cronquot',
license='MIT',
packages=['cronquot'],
entry_points={
'console_scripts': [
'cronquot = cronquot.cronquot:execute_from_console'],
},
install_requires=['crontab'],
test_suite='test'
)
| """Set up script"""
from setuptools import setup
import os
def _create_long_desc():
"""Create long description and README formatted with rst."""
_long_desc = ''
if os.path.isfile('README.md'):
with open('README.md', 'r') as rf:
return rf.read()
if os.path.isfile('README.rst'):
with open('README.rst', 'r') as rf:
return rf.read()
long_desc = _create_long_desc()
# Setup
setup(name='cronquot',
version='0.1.3',
description='Cron scheduler.',
long_description=long_desc,
long_description_content_type='text/markdown',
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
'License :: OSI Approved :: MIT License',
'Topic :: Software Development :: Libraries :: Python Modules'
],
keywords='cron crontab schedule',
author='Shohei Mukai',
author_email='mukaishohei76@gmail.com',
url='https://github.com/pyohei/cronquot',
license='MIT',
packages=['cronquot'],
entry_points={
'console_scripts': [
'cronquot = cronquot.cronquot:execute_from_console'],
},
install_requires=['crontab'],
test_suite='test'
)
| Add text type as markdown. | Add text type as markdown.
| Python | mit | pyohei/cronquot,pyohei/cronquot | ---
+++
@@ -17,9 +17,10 @@
# Setup
setup(name='cronquot',
- version='0.1.2',
+ version='0.1.3',
description='Cron scheduler.',
long_description=long_desc,
+ long_description_content_type='text/markdown',
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2.7', |
b4ebc0ce26a1b0e77ced117be1c18c43364cd27d | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
import conveyor
install_requires = [
"APScheduler",
"forklift",
"PyYAML",
"redis",
"xmlrpc2",
]
setup(
name="conveyor",
version=conveyor.__version__,
description="Warehouse and PyPI Synchronization",
long_description=open("README.rst").read(),
url="https://github.com/crateio/conveyor/",
license=open("LICENSE").read(),
author="Donald Stufft",
author_email="donald.stufft@gmail.com",
install_requires=install_requires,
packages=find_packages(exclude=["tests"]),
zip_safe=False,
)
| #!/usr/bin/env python
from setuptools import setup, find_packages
import conveyor
install_requires = [
"APScheduler",
"forklift",
"redis",
"xmlrpc2",
]
setup(
name="conveyor",
version=conveyor.__version__,
description="Warehouse and PyPI Synchronization",
long_description=open("README.rst").read(),
url="https://github.com/crateio/conveyor/",
license=open("LICENSE").read(),
author="Donald Stufft",
author_email="donald.stufft@gmail.com",
install_requires=install_requires,
packages=find_packages(exclude=["tests"]),
zip_safe=False,
)
| Remove the no longer needed PyYAML requirement | Remove the no longer needed PyYAML requirement
| Python | bsd-2-clause | crateio/carrier | ---
+++
@@ -7,7 +7,6 @@
install_requires = [
"APScheduler",
"forklift",
- "PyYAML",
"redis",
"xmlrpc2",
] |
8d15170cb298d06a74b2cdc07c18b4d81cf8f84a | setup.py | setup.py | #! /usr/bin/env python
# coding: utf-8
from setuptools import find_packages, setup
setup(name='ego.io',
author='openego development group',
author_email='oemof@rl-institut.de',
description='ego input/output repository',
version='0.0.1rc3',
url='https://github.com/openego/ego.io',
packages=find_packages(),
install_requires=[
'geoalchemy2',
"sqlalchemy[postgresql]",
"numpy",
"psycopg2"]
)
| #! /usr/bin/env python
# coding: utf-8
from setuptools import find_packages, setup
setup(name='ego.io',
author='openego development group',
author_email='oemof@rl-institut.de',
description='ego input/output repository',
version='0.0.1rc4',
url='https://github.com/openego/ego.io',
packages=find_packages(),
install_requires=[
'geoalchemy2',
"sqlalchemy[postgresql] <=1.0.15",
"numpy",
"psycopg2"]
)
| Fix dependency specification and update version | Fix dependency specification and update version
| Python | agpl-3.0 | openego/ego.io,openego/ego.io | ---
+++
@@ -7,12 +7,12 @@
author='openego development group',
author_email='oemof@rl-institut.de',
description='ego input/output repository',
- version='0.0.1rc3',
+ version='0.0.1rc4',
url='https://github.com/openego/ego.io',
packages=find_packages(),
install_requires=[
'geoalchemy2',
- "sqlalchemy[postgresql]",
+ "sqlalchemy[postgresql] <=1.0.15",
"numpy",
"psycopg2"]
) |
45c60c3eb2b13a028470ca41fe518562028213f7 | setup.py | setup.py | import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options(self):
# XXX sometimes TestCommand is not a newstyle class
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
# XXX import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)
try:
with open('README.rst') as readme:
README = readme.read()
except IOError:
README = ''
setup(
name='rdio_dl',
version='0.0.1dev',
packages=['rdio_dl'],
install_requires=['requests', 'youtube_dl'],
dependency_links=[
'git+https://github.com/ravishi/youtube-dl.git@f77da1fae6#egg=youtube_dl',
],
author='Dirley Rodrigues',
author_email='dirleyrls@gmail.com',
long_description=README,
entry_points={
'youtube_dl.extractors': [
'rdio = rdio_dl.extractor:RdioIE',
'rdio_playlist = rdio_dl.extractor:RdioPlaylistIE',
],
},
test_suite='tests',
tests_require=['pytest'],
cmdclass={'test': PyTest},
)
| import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options(self):
# XXX sometimes TestCommand is not a newstyle class
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
# XXX import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)
try:
with open('README.rst') as readme:
README = readme.read()
except IOError:
README = ''
setup(
name='rdio_dl',
version='0.0.1dev',
packages=['rdio_dl'],
install_requires=['requests', 'youtube_dl'],
dependency_links=[
'git+https://github.com/ravishi/youtube-dl.git@f77da1fae6#egg=youtube_dl',
],
author='Dirley Rodrigues',
author_email='dirleyrls@gmail.com',
long_description=README,
entry_points={
'youtube_dl.extractors': [
'rdio = rdio_dl.extractor:RdioIE',
],
},
test_suite='tests',
tests_require=['pytest'],
cmdclass={'test': PyTest},
)
| Remove absent extractor from entry points | Remove absent extractor from entry points
| Python | mit | ravishi/rdio-dl | ---
+++
@@ -37,7 +37,6 @@
entry_points={
'youtube_dl.extractors': [
'rdio = rdio_dl.extractor:RdioIE',
- 'rdio_playlist = rdio_dl.extractor:RdioPlaylistIE',
],
},
test_suite='tests', |
02e92e5989f140cca86b6826f6be57f240f54b9f | setup.py | setup.py | from setuptools import setup, find_packages
from version import get_git_version
setup(name='thecut-durationfield',
author='The Cut', author_email='development@thecut.net.au',
url='http://projects.thecut.net.au/projects/thecut-durationfield',
namespace_packages=['thecut'],
version=get_git_version(),
packages=find_packages(),
include_package_data=True,
install_requires=['distribute'],
)
| from setuptools import setup, find_packages
from version import get_git_version
setup(name='thecut-durationfield',
author='The Cut', author_email='development@thecut.net.au',
url='http://projects.thecut.net.au/projects/thecut-durationfield',
namespace_packages=['thecut'],
version=get_git_version(),
packages=find_packages(),
include_package_data=True,
install_requires=['distribute', 'isodate == 0.4.9',],
)
| Add isodate to the required dependencies. | Add isodate to the required dependencies.
| Python | apache-2.0 | thecut/thecut-durationfield,mighty-justice/thecut-durationfield | ---
+++
@@ -8,5 +8,5 @@
version=get_git_version(),
packages=find_packages(),
include_package_data=True,
- install_requires=['distribute'],
+ install_requires=['distribute', 'isodate == 0.4.9',],
) |
43447fd417adc475f5e077d75cc81b14083c097a | setup.py | setup.py | import codecs
from os import path
from setuptools import find_packages, setup
def read(*parts):
filename = path.join(path.dirname(__file__), *parts)
with codecs.open(filename, encoding="utf-8") as fp:
return fp.read()
setup(
author="",
author_email="",
description="",
name="pinax-{{ app_name }}",
long_description=read("README.rst"),
version="0.1",
url="http://github.com/pinax/pinax-{{ app_name }}/",
license="MIT",
packages=find_packages(),
package_data={
"{{ app_name }}": []
},
test_suite="runtests.runtests",
tests_require=[
],
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Framework :: Django",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries :: Python Modules",
],
zip_safe=False
)
| import codecs
from os import path
from setuptools import find_packages, setup
def read(*parts):
filename = path.join(path.dirname(__file__), *parts)
with codecs.open(filename, encoding="utf-8") as fp:
return fp.read()
setup(
author="",
author_email="",
description="",
name="pinax-{{ app_name }}",
long_description=read("README.rst"),
version="0.1",
url="http://github.com/pinax/pinax-{{ app_name }}/",
license="MIT",
packages=find_packages(),
package_data={
"{{ app_name }}": []
},
test_suite="runtests.runtests",
install_requires=[
"Django>=1.8"
],
tests_require=[
],
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Framework :: Django",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries :: Python Modules",
],
zip_safe=False
)
| Make sure Django is required | Make sure Django is required
| Python | mit | pinax/pinax-starter-app | ---
+++
@@ -24,6 +24,9 @@
"{{ app_name }}": []
},
test_suite="runtests.runtests",
+ install_requires=[
+ "Django>=1.8"
+ ],
tests_require=[
],
classifiers=[ |
53521d92b14603229521840d48e5b10b8882011c | setup.py | setup.py | import re
from setuptools import setup, find_packages
INIT_FILE = 'pg_grant/__init__.py'
init_data = open(INIT_FILE).read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", init_data))
VERSION = metadata['version']
LICENSE = metadata['license']
DESCRIPTION = metadata['description']
AUTHOR = metadata['author']
EMAIL = metadata['email']
requires = {
'attrs',
}
extras_require = {
':python_version<"3.5"': {
'typing',
},
'query': {
'sqlalchemy',
},
'test': {
'pytest>=3.0',
'testcontainers',
},
'docstest': {
'doc8',
'sphinx',
'sphinx_rtd_theme',
},
'pep8test': {
'flake8',
'pep8-naming',
},
}
setup(
name='pg_grant',
version=VERSION,
description=DESCRIPTION,
# long_description=open('README.rst').read(),
author=AUTHOR,
author_email=EMAIL,
url='https://github.com/RazerM/pg_grant',
packages=find_packages(exclude=['tests']),
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
],
license=LICENSE,
install_requires=requires,
extras_require=extras_require,
tests_require=extras_require['test'])
| import re
from setuptools import setup, find_packages
INIT_FILE = 'pg_grant/__init__.py'
init_data = open(INIT_FILE).read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", init_data))
VERSION = metadata['version']
LICENSE = metadata['license']
DESCRIPTION = metadata['description']
AUTHOR = metadata['author']
EMAIL = metadata['email']
requires = {
'attrs',
}
extras_require = {
':python_version<"3.5"': {
'typing',
},
'query': {
'sqlalchemy[postgresql]',
},
'test': {
'pytest>=3.0',
'testcontainers',
},
'docstest': {
'doc8',
'sphinx',
'sphinx_rtd_theme',
},
'pep8test': {
'flake8',
'pep8-naming',
},
}
setup(
name='pg_grant',
version=VERSION,
description=DESCRIPTION,
# long_description=open('README.rst').read(),
author=AUTHOR,
author_email=EMAIL,
url='https://github.com/RazerM/pg_grant',
packages=find_packages(exclude=['tests']),
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
],
license=LICENSE,
install_requires=requires,
extras_require=extras_require,
tests_require=extras_require['test'])
| Add postgresql extra to sqlalchemy | Add postgresql extra to sqlalchemy
Was implicitly being installed with testcontainers
| Python | mit | RazerM/pg_grant,RazerM/pg_grant | ---
+++
@@ -23,7 +23,7 @@
'typing',
},
'query': {
- 'sqlalchemy',
+ 'sqlalchemy[postgresql]',
},
'test': {
'pytest>=3.0', |
34d4cb8826394c408da41e42f7331ee71aba85dc | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='panoptes_client',
url='https://github.com/zooniverse/panoptes-python-client',
author='Adam McMaster',
author_email='adam@zooniverse.org',
version='1.1.1',
packages=find_packages(),
include_package_data=True,
install_requires=[
'requests>=2.4.2,<2.23',
'future>=0.16,<0.19',
'python-magic>=0.4,<0.5',
'redo>=1.7',
'six>=1.9',
],
extras_require={
'testing': [
'mock>=2.0,<3.1',
],
'docs': [
'sphinx',
],
':python_version == "2.7"': ['futures'],
}
)
| from setuptools import setup, find_packages
setup(
name='panoptes_client',
url='https://github.com/zooniverse/panoptes-python-client',
author='Adam McMaster',
author_email='adam@zooniverse.org',
version='1.1.1',
packages=find_packages(),
include_package_data=True,
install_requires=[
'requests>=2.4.2,<2.23',
'future>=0.16,<0.19',
'python-magic>=0.4,<0.5',
'redo>=1.7',
'six>=1.9',
],
extras_require={
'testing': [
'mock>=2.0,<4.1',
],
'docs': [
'sphinx',
],
':python_version == "2.7"': ['futures'],
}
)
| Update mock requirement from <3.1,>=2.0 to >=2.0,<4.1 | Update mock requirement from <3.1,>=2.0 to >=2.0,<4.1
Updates the requirements on [mock](https://github.com/testing-cabal/mock) to permit the latest version.
- [Release notes](https://github.com/testing-cabal/mock/releases)
- [Changelog](https://github.com/testing-cabal/mock/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/testing-cabal/mock/compare/2.0.0...4.0.0)
Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com> | Python | apache-2.0 | zooniverse/panoptes-python-client | ---
+++
@@ -17,7 +17,7 @@
],
extras_require={
'testing': [
- 'mock>=2.0,<3.1',
+ 'mock>=2.0,<4.1',
],
'docs': [
'sphinx', |
6924917e5b5d62d330c8f21774d1871e4fd4e746 | setup.py | setup.py | import os
from setuptools import setup, find_packages
def read_file(filename):
"""Read a file into a string"""
path = os.path.abspath(os.path.dirname(__file__))
filepath = os.path.join(path, filename)
try:
return open(filepath).read()
except IOError:
return ''
setup(
name='django-{{ app_name }}',
version=__import__('{{ app_name }}').__version__,
author='Caktus Consulting Group',
author_email='solutions@caktusgroup.com',
packages=find_packages(),
include_package_data=True,
url='https://github.com/caktus/django-{{ app_name }}/',
license='BSD',
description=u' '.join(__import__('{{ app_name }}').__doc__.splitlines()).strip(),
classifiers=[
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Framework :: Django',
'Development Status :: 4 - Beta',
'Operating System :: OS Independent',
],
long_description=read_file('README.rst'),
test_suite="runtests.runtests",
zip_safe=False,
)
| import os
from setuptools import setup, find_packages
def read_file(filename):
"""Read a file into a string"""
path = os.path.abspath(os.path.dirname(__file__))
filepath = os.path.join(path, filename)
try:
return open(filepath).read()
except IOError:
return ''
setup(
name='django-{{ app_name }}',
version=__import__('{{ app_name }}').__version__,
author='Caktus Consulting Group',
author_email='solutions@caktusgroup.com',
packages=find_packages(),
include_package_data=True,
url='https://github.com/caktus/django-{{ app_name }}/',
license='BSD',
description=u' '.join(__import__('{{ app_name }}').__doc__.splitlines()).strip(),
classifiers=[
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Framework :: Django',
'Development Status :: 4 - Beta',
'Operating System :: OS Independent',
],
long_description=read_file('README.rst'),
test_suite="runtests.runtests",
zip_safe=False,
)
| Include Python 3.2 and 3.3 classifiers. | Include Python 3.2 and 3.3 classifiers.
| Python | bsd-3-clause | caktus/django-app-template | ---
+++
@@ -29,6 +29,8 @@
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3.2',
+ 'Programming Language :: Python :: 3.3',
'Framework :: Django',
'Development Status :: 4 - Beta',
'Operating System :: OS Independent', |
2e4241c74385b8679f2b8fa8c16385c91b9e8ef7 | setup.py | setup.py | import sys
from setuptools import setup
_requires = [
'msgpack-python',
]
if sys.version_info < (2, 7, 0, ) :
_requires.append('ordereddict', )
setup(
name='serf-python',
version='0.2.2',
description='serf client for python',
long_description="""
For more details, please see https://github.com/spikeekips/serf-python .
""",
author='Spike^ekipS',
author_email='spikeekips@gmail.com',
url='https://github.com/spikeekips/serf-python',
license='License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
install_requires=tuple(_requires, ),
packages=('serf', ),
package_dir={'': 'src', },
)
| import sys
from setuptools import setup
_requires = [
'msgpack',
]
if sys.version_info < (2, 7, 0, ) :
_requires.append('ordereddict', )
setup(
name='serf-python',
version='0.2.2',
description='serf client for python',
long_description="""
For more details, please see https://github.com/spikeekips/serf-python .
""",
author='Spike^ekipS',
author_email='spikeekips@gmail.com',
url='https://github.com/spikeekips/serf-python',
license='License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
install_requires=tuple(_requires, ),
packages=('serf', ),
package_dir={'': 'src', },
)
| Change msgpack-python requirement to msgpack | Change msgpack-python requirement to msgpack
This package has been renamed to `msgpack` starting with their `0.5.0` version. The old package seems likely to be deprecated soon, but this change will keep the dependency being updated as intended.
https://pypi.python.org/pypi/msgpack
https://pypi.python.org/pypi/msgpack-python | Python | mpl-2.0 | spikeekips/serf-python | ---
+++
@@ -2,7 +2,7 @@
from setuptools import setup
_requires = [
- 'msgpack-python',
+ 'msgpack',
]
if sys.version_info < (2, 7, 0, ) : |
ab97b48a0e1e80967a6d14ac3996a4288b6003e6 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
def reqs_from_file(filename):
with open(filename) as f:
lineiter = (line.rstrip() for line in f)
return filter(None, lineiter)
setup(
name='git-tools',
version='0.1',
description='git tools',
# Required packages
install_requires=reqs_from_file('requirements.txt'),
tests_require=reqs_from_file('test-requirements.txt'),
# Main packages
packages=[
'src',
],
# Command line scripts
scripts=[
'src/git-pep8',
],
)
| #!/usr/bin/env python
from setuptools import setup
def reqs_from_file(filename):
with open(filename) as f:
lineiter = (line.rstrip() for line in f)
return list(filter(None, lineiter))
setup(
name='git-tools',
version='0.1',
description='git tools',
# Required packages
install_requires=reqs_from_file('requirements.txt'),
tests_require=reqs_from_file('test-requirements.txt'),
# Main packages
packages=[
'src',
],
# Command line scripts
scripts=[
'src/git-pep8',
],
)
| Change filter() to list(filter()) for python 3+ | Change filter() to list(filter()) for python 3+
| Python | mit | hughdbrown/git-tools | ---
+++
@@ -6,7 +6,7 @@
def reqs_from_file(filename):
with open(filename) as f:
lineiter = (line.rstrip() for line in f)
- return filter(None, lineiter)
+ return list(filter(None, lineiter))
setup( |
f6b90f0a3ed43d0136b902259158c62788f1f766 | setup.py | setup.py | #! /usr/bin/env python
from setuptools import find_packages, setup
# import subprocess
#
# subprocess.call(["sudo", "apt-get", "install", "libgeos-dev"])
setup(name='dingo',
author='openego development group',
description='DIstribution Network GeneratOr',
packages=find_packages(),
install_requires=['networkx >= 1.11',
'geopy >= 1.11.0',
'pandas >= 0.17.0',
'pyomo >= 1.9.5.1',
'pyproj',
'geoalchemy2',
#'matplotlib', #should be included but fails via pip3
'ego.io >= 0.0.1-pre',
'oemof.db']
)
| from setuptools import find_packages, setup
# import subprocess
#
# subprocess.call(["sudo", "apt-get", "install", "libgeos-dev"])
setup(name='dingo',
author='openego development group',
description='DIstribution Network GeneratOr',
packages=find_packages(),
install_requires=['networkx >= 1.11',
'geopy >= 1.11.0',
'pandas >= 0.17.0',
'pyomo >= 1.9.5.1',
'pyproj',
'geoalchemy2',
#'matplotlib', #should be included but fails via pip3
'ego.io >= 0.0.1-pre',
'oemof.db']
)
| Remove shebang line that directed to python2 | Remove shebang line that directed to python2 | Python | agpl-3.0 | openego/dingo,openego/dingo | ---
+++
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-
from setuptools import find_packages, setup
# import subprocess
# |
ee4862e88f5cc726f0974b31b05deb599bbe9422 | setup.py | setup.py | from setuptools import find_packages, setup
from virtualenvapi import __version__
setup(
name='virtualenv-api',
version=__version__,
license='BSD',
author='Sam Kingston and AUTHORS',
author_email='sam@sjkwi.com.au',
description='An API for virtualenv/pip',
long_description=open('README.rst', 'r').read(),
url='https://github.com/sjkingo/virtualenv-api',
install_requires=['six'],
packages=find_packages(),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)
| from setuptools import find_packages, setup
from virtualenvapi import __version__
setup(
name='virtualenv-api',
version=__version__,
license='BSD',
author='Sam Kingston and AUTHORS',
author_email='sam@sjkwi.com.au',
description='An API for virtualenv/pip',
long_description=open('README.rst', 'r').read(),
url='https://github.com/sjkingo/virtualenv-api',
install_requires=['six'],
packages=find_packages(),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)
| Update classifiers for supported Python versions | Update classifiers for supported Python versions [ci skip]
| Python | bsd-2-clause | sjkingo/virtualenv-api | ---
+++
@@ -22,10 +22,9 @@
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.4',
- 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
'Topic :: Software Development :: Libraries :: Python Modules',
],
) |
490edfaab48ec010f53e1653c2ec4593fcd11a44 | setup.py | setup.py | from __future__ import with_statement
import os
from setuptools import setup
this_dir = os.path.dirname(__file__)
with open(os.path.join(this_dir, 'src', 'pydocstyle', 'utils.py')) as f:
for line in f:
if line.startswith('__version__'):
version = eval(line.split('=')[-1])
setup(
name='pydocstyle',
version=version,
description="Python docstring style checker",
long_description=open('README.rst').read(),
license='MIT',
author='Amir Rachum',
author_email='amir@rachum.com',
url='https://github.com/PyCQA/pydocstyle/',
classifiers=[
'Intended Audience :: Developers',
'Environment :: Console',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Operating System :: OS Independent',
'License :: OSI Approved :: MIT License',
],
keywords='pydocstyle, PEP 257, pep257, PEP 8, pep8, docstrings',
packages=('pydocstyle',),
package_dir={'': 'src'},
package_data={'pydocstyle': ['data/*.txt']},
install_requires=[
'snowballstemmer==1.2.1',
],
entry_points={
'console_scripts': [
'pydocstyle = pydocstyle.cli:main',
],
},
)
| from __future__ import with_statement
import os
from setuptools import setup
this_dir = os.path.dirname(__file__)
with open(os.path.join(this_dir, 'src', 'pydocstyle', 'utils.py')) as f:
for line in f:
if line.startswith('__version__'):
version = eval(line.split('=')[-1])
setup(
name='pydocstyle',
version=version,
description="Python docstring style checker",
long_description=open('README.rst').read(),
license='MIT',
author='Amir Rachum',
author_email='amir@rachum.com',
url='https://github.com/PyCQA/pydocstyle/',
classifiers=[
'Intended Audience :: Developers',
'Environment :: Console',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Operating System :: OS Independent',
'License :: OSI Approved :: MIT License',
],
keywords='pydocstyle, PEP 257, pep257, PEP 8, pep8, docstrings',
packages=('pydocstyle',),
package_dir={'': 'src'},
package_data={'pydocstyle': ['data/*.txt']},
install_requires=[
'snowballstemmer',
],
entry_points={
'console_scripts': [
'pydocstyle = pydocstyle.cli:main',
],
},
)
| Remove version number for snowballstemmer | Remove version number for snowballstemmer | Python | mit | farmersez/pydocstyle,Nurdok/pydocstyle,PyCQA/pydocstyle,GreenSteam/pep257,Nurdok/pep257 | ---
+++
@@ -33,7 +33,7 @@
package_dir={'': 'src'},
package_data={'pydocstyle': ['data/*.txt']},
install_requires=[
- 'snowballstemmer==1.2.1',
+ 'snowballstemmer',
],
entry_points={
'console_scripts': [ |
df66df626012bab0cf6a5887e7f11ca64ca9d02c | setup.py | setup.py | # -*- coding: utf-8 -*-
# HACK for `nose.collector` to work on python 2.7.3 and earlier
import multiprocessing
from setuptools import setup, find_packages
setup(name='quantized-mesh-tile',
version='0.0.1',
description='Quantized-Mesh format reader and writer',
author='Loicc Gaer',
author_email='loicgasser4@gmail.com',
license='MIT',
url='https://github.com/loicgasser/quantized-mesh-tile',
packages=find_packages(exclude=['tests']),
zip_safe=False,
test_suite='nose.collector',
install_requires=['shapely', 'numpy'],
)
| # -*- coding: utf-8 -*-
# HACK for `nose.collector` to work on python 2.7.3 and earlier
import multiprocessing
from setuptools import setup, find_packages
setup(name='quantized-mesh-tile',
version='0.1.1',
description='Quantized-Mesh format reader and writer',
author='Loicc Gaer',
author_email='loicgasser4@gmail.com',
license='MIT',
url='https://github.com/loicgasser/quantized-mesh-tile',
packages=find_packages(exclude=['tests', 'doc']),
zip_safe=False,
test_suite='nose.collector',
install_requires=['shapely', 'numpy'],
)
| Exclude doc from pypi module | Exclude doc from pypi module
| Python | mit | loicgasser/quantized-mesh-tile | ---
+++
@@ -5,13 +5,13 @@
from setuptools import setup, find_packages
setup(name='quantized-mesh-tile',
- version='0.0.1',
+ version='0.1.1',
description='Quantized-Mesh format reader and writer',
author='Loicc Gaer',
author_email='loicgasser4@gmail.com',
license='MIT',
url='https://github.com/loicgasser/quantized-mesh-tile',
- packages=find_packages(exclude=['tests']),
+ packages=find_packages(exclude=['tests', 'doc']),
zip_safe=False,
test_suite='nose.collector',
install_requires=['shapely', 'numpy'], |
e2e0600d111ca871141a1522c3c5356622db922d | setup.py | setup.py | from distutils.core import setup
import os
f = open("README.rst")
try:
try:
readme_text = f.read()
except:
readme_text = ""
finally:
f.close()
setup(name="ftptool", version="0.2",
url="http://blogg.se",
description="Higher-level interface to ftplib",
author="Blogg Esse AB",
author_email="opensource@blogg.se",
long_description=readme_text,
py_modules=["ftptool"])
| from distutils.core import setup
import os
f = open("README.rst")
try:
try:
readme_text = f.read()
except:
readme_text = ""
finally:
f.close()
setup(name="ftptool", version="0.3",
url="http://blogg.se",
description="Higher-level interface to ftplib",
author="Blogg Esse AB",
author_email="opensource@blogg.se",
long_description=readme_text,
py_modules=["ftptool"])
| Prepare for new version: 0.3 | Prepare for new version: 0.3
| Python | bsd-3-clause | bloggse/ftptool | ---
+++
@@ -10,7 +10,7 @@
finally:
f.close()
-setup(name="ftptool", version="0.2",
+setup(name="ftptool", version="0.3",
url="http://blogg.se",
description="Higher-level interface to ftplib",
author="Blogg Esse AB", |
8e1d07fd4ae8a2415a133fa46555869238bacaf2 | setup.py | setup.py | from setuptools import setup
setup(name='glreg',
version='0.9.0',
description='OpenGL XML API registry parser',
url='https://github.com/pyokagan/pyglreg',
author='Paul Tan',
author_email='pyokagan@gmail.com',
license='MIT',
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Topic :: Software Development :: Code Generators',
'Topic :: Software Development :: Libraries :: Python Module',
],
keywords='opengl',
py_modules=['glreg'],
entry_points={
'console_scripts': [
'glreg=glreg:main'
]
})
| from setuptools import setup
setup(name='glreg',
version='0.9.0',
description='OpenGL XML API registry parser',
url='https://github.com/pyokagan/pyglreg',
author='Paul Tan',
author_email='pyokagan@gmail.com',
license='MIT',
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Topic :: Software Development :: Code Generators',
'Topic :: Software Development :: Libraries :: Python Module',
],
keywords='opengl',
py_modules=['glreg'],
entry_points={
'console_scripts': [
'glreg=glreg:main'
]
})
| Add more pypi trove classifiers | Add more pypi trove classifiers
| Python | mit | pyokagan/pyglreg,pyokagan/pyglreg | ---
+++
@@ -16,6 +16,8 @@
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
+ 'Programming Language :: Python :: 3.3',
+ 'Programming Language :: Python :: 3.4',
'Topic :: Software Development :: Code Generators',
'Topic :: Software Development :: Libraries :: Python Module',
], |
3073a03e7d2d801226c525e574f9bba295e12ddd | setup.py | setup.py | # coding:utf-8
from setuptools import setup, find_packages
setup(
name = 'qsctl',
version = '1.0.2',
description = 'Advanced command line tool for QingStor.',
long_description = open('README.rst', 'rb').read().decode('utf-8'),
keywords = 'qingcloud qingstor qsctl',
author = 'Daniel Zheng',
author_email = 'daniel@yunify.com',
url = 'https://docs.qingcloud.com',
scripts = ['bin/qsctl', 'bin/qsctl.cmd'],
packages = find_packages('.'),
package_dir = {'qsctl': 'qingstor',},
namespace_packages = ['qingstor',],
include_package_data = True,
install_requires = [
'argparse >= 1.1',
'PyYAML >= 3.1',
'qingcloud-sdk >= 1.0.7',
'docutils >= 0.10',
]
)
| # coding:utf-8
from setuptools import setup, find_packages
setup(
name = 'qsctl',
version = '1.0.3',
description = 'Advanced command line tool for QingStor.',
long_description = open('README.rst', 'rb').read().decode('utf-8'),
keywords = 'qingcloud qingstor qsctl',
author = 'Daniel Zheng',
author_email = 'daniel@yunify.com',
url = 'https://docs.qingcloud.com',
scripts = ['bin/qsctl', 'bin/qsctl.cmd'],
packages = find_packages('.'),
package_dir = {'qsctl': 'qingstor',},
namespace_packages = ['qingstor',],
include_package_data = True,
install_requires = [
'argparse >= 1.1',
'PyYAML >= 3.1',
'qingcloud-sdk >= 1.0.7',
'docutils >= 0.10',
]
)
| Change version number to '1.0.3' | Change version number to '1.0.3'
Signed-off-by: daniel <3d0f3b9ddcacec30c4008c5e030e6c13a478cb4f@yunify.com>
| Python | apache-2.0 | yunify/qsctl,Fiile/qsctl | ---
+++
@@ -4,7 +4,7 @@
setup(
name = 'qsctl',
- version = '1.0.2',
+ version = '1.0.3',
description = 'Advanced command line tool for QingStor.',
long_description = open('README.rst', 'rb').read().decode('utf-8'),
keywords = 'qingcloud qingstor qsctl', |
297ba0a2a3e1d91031093881bcd8d57977e9597c | setup.py | setup.py | from distutils.core import setup
setup(
name='Supermega',
version='0.1.0',
author='Lorenz Bauer',
packages=['supermega', 'supermega.schemata'],
# scripts=['bin/*.py'],
# url='http://pypi.python.org/pypi/TowelStuff/',
license='LICENSE.txt',
description='The overengineered way to access the MEGA.co.nz service from Python.',
long_description=open('README.md').read(),
install_requires=[
"requests",
"pycrypto"
],
) | from distutils.core import setup
setup(
name='Supermega',
version='0.1.0',
author='Lorenz Bauer',
packages=['supermega', 'supermega.schemata'],
# scripts=['bin/*.py'],
# url='http://pypi.python.org/pypi/TowelStuff/',
license='LICENSE.txt',
description='The overengineered way to access the MEGA.co.nz service from Python.',
long_description=open('README.md').read(),
install_requires=[
"requests >= 1.1.0",
"pycrypto >= 2.6",
"jsonschema >= 0.8.0"
],
)
| Update dependencies and add tested version information | Update dependencies and add tested version information
| Python | bsd-3-clause | lmb/Supermega | ---
+++
@@ -11,7 +11,8 @@
description='The overengineered way to access the MEGA.co.nz service from Python.',
long_description=open('README.md').read(),
install_requires=[
- "requests",
- "pycrypto"
+ "requests >= 1.1.0",
+ "pycrypto >= 2.6",
+ "jsonschema >= 0.8.0"
],
) |
403098f581af6517eb57e08b4a0d460f3d7abd54 | setup.py | setup.py | # -*- coding: utf-8 -*-
import sys
from setuptools import setup, find_packages
IS_PY3 = sys.version_info > (3,)
install_requires = [
'jinja2',
'lxml',
]
tests_require = [
]
extras_require = {
'test': tests_require,
}
description = "Library for building and paring Connexions' EPUBs."
if not IS_PY3:
tests_require.append('mock')
setup(
name='cnx-epub',
version='0.8.0',
author='Connexions team',
author_email='info@cnx.org',
url="https://github.com/connexions/cnx-epub",
license='AGPL, See also LICENSE.txt',
description=description,
install_requires=install_requires,
tests_require=tests_require,
extras_require=extras_require,
packages=find_packages(),
include_package_data=True,
entry_points={
'console_scripts': [
'cnx-epub-single_html = cnxepub.scripts.single_html.main:main',
],
},
test_suite='cnxepub.tests',
zip_safe=False,
)
| # -*- coding: utf-8 -*-
import sys
from setuptools import setup, find_packages
IS_PY3 = sys.version_info > (3,)
install_requires = [
'jinja2',
'lxml',
]
collation_requires = [
'cnx-easybake',
]
tests_require = [
]
tests_require.extend(collation_requires)
extras_require = {
'collation': collation_requires,
'test': tests_require,
}
description = "Library for building and paring Connexions' EPUBs."
if not IS_PY3:
tests_require.append('mock')
setup(
name='cnx-epub',
version='0.8.0',
author='Connexions team',
author_email='info@cnx.org',
url="https://github.com/connexions/cnx-epub",
license='AGPL, See also LICENSE.txt',
description=description,
install_requires=install_requires,
tests_require=tests_require,
extras_require=extras_require,
packages=find_packages(),
include_package_data=True,
entry_points={
'console_scripts': [
'cnx-epub-single_html = cnxepub.scripts.single_html.main:main',
],
},
test_suite='cnxepub.tests',
zip_safe=False,
)
| Add optional dependency for collation | :tada: Add optional dependency for collation
| Python | agpl-3.0 | Connexions/cnx-epub,Connexions/cnx-epub,Connexions/cnx-epub | ---
+++
@@ -10,9 +10,14 @@
'jinja2',
'lxml',
]
+collation_requires = [
+ 'cnx-easybake',
+ ]
tests_require = [
]
+tests_require.extend(collation_requires)
extras_require = {
+ 'collation': collation_requires,
'test': tests_require,
}
description = "Library for building and paring Connexions' EPUBs." |
93017638db261e223aed7e07a8bc02f344bcc4a9 | setup.py | setup.py | #!/usr/bin/env python
"""
sentry-twilio
=============
A plugin for Sentry which sends SMS notifications via Twilio.
:copyright: (c) 2012 by Matt Robenolt
:license: BSD, see LICENSE for more details.
"""
from setuptools import setup, find_packages
install_requires = [
'sentry>=5.0.0',
'phonenumbers',
]
setup(
name='sentry-twilio',
version='0.1.0',
author='Matt Robenolt',
author_email='matt@ydekproductons.com',
url='https://github.com/mattrobenolt/sentry-twilio',
description='A plugin for Sentry which sends SMS notifications via Twilio',
long_description=__doc__,
license='BSD',
packages=find_packages(exclude=['tests']),
zip_safe=False,
install_requires=install_requires,
include_package_data=True,
entry_points={
'sentry.apps': [
'twilio = sentry_twilio',
],
'sentry.plugins': [
'twilio = sentry_twilio.models:TwilioPlugin',
]
},
classifiers=[
'Framework :: Django',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Operating System :: OS Independent',
'Topic :: Software Development'
],
)
| #!/usr/bin/env python
"""
sentry-twilio
=============
A plugin for Sentry which sends SMS notifications via Twilio.
:copyright: (c) 2012 by Matt Robenolt
:license: BSD, see LICENSE for more details.
"""
from setuptools import setup, find_packages
install_requires = [
'sentry>=5.0.0',
# We don't need full `phonenumbers` library
'phonenumberslite<8.0',
]
setup(
name='sentry-twilio',
version='0.1.0',
author='Matt Robenolt',
author_email='matt@ydekproductons.com',
url='https://github.com/mattrobenolt/sentry-twilio',
description='A plugin for Sentry which sends SMS notifications via Twilio',
long_description=__doc__,
license='BSD',
packages=find_packages(exclude=['tests']),
zip_safe=False,
install_requires=install_requires,
include_package_data=True,
entry_points={
'sentry.apps': [
'twilio = sentry_twilio',
],
'sentry.plugins': [
'twilio = sentry_twilio.models:TwilioPlugin',
]
},
classifiers=[
'Framework :: Django',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Operating System :: OS Independent',
'Topic :: Software Development'
],
)
| Use phonenumberslite and pin to <8.0 Justin Case | Use phonenumberslite and pin to <8.0 Justin Case
| Python | bsd-2-clause | mattrobenolt/sentry-twilio | ---
+++
@@ -13,7 +13,9 @@
install_requires = [
'sentry>=5.0.0',
- 'phonenumbers',
+
+ # We don't need full `phonenumbers` library
+ 'phonenumberslite<8.0',
]
setup( |
9c71195ac286da6fabc854b58145a08fe0a9daf1 | setup.py | setup.py | import os
import sys
from setuptools import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
import quill
with open('README.md', 'r') as readme_file:
readme = readme_file.read()
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-quill',
version=quill.__version__,
author='Ryan Senkbeil',
author_email='ryan.senkbeil@gsdesign.com',
description='Reusable components for the Django admin.',
long_description=readme,
packages=['quill'],
zip_safe=False,
include_package_data=True,
platforms='any',
install_requires=[],
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',
'Programming Language :: Python :: 3',
'Topic :: Internet :: WWW/HTTP',
]
)
| import os
import sys
from setuptools import setup
if sys.argv[-1] == 'publish':
os.system('make build')
os.system('python setup.py sdist upload')
sys.exit()
import quill
with open('README.md', 'r') as readme_file:
readme = readme_file.read()
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-quill',
version=quill.__version__,
author='Ryan Senkbeil',
author_email='ryan.senkbeil@gsdesign.com',
description='Reusable components for the Django admin.',
long_description=readme,
packages=['quill'],
zip_safe=False,
include_package_data=True,
platforms='any',
install_requires=[],
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',
'Programming Language :: Python :: 3',
'Topic :: Internet :: WWW/HTTP',
]
)
| Add build step to PyPI publish command. | Add build step to PyPI publish command.
| Python | bsd-3-clause | gsmke/django-quill,gsmke/django-quill,gsmke/django-quill | ---
+++
@@ -4,6 +4,7 @@
from setuptools import setup
if sys.argv[-1] == 'publish':
+ os.system('make build')
os.system('python setup.py sdist upload')
sys.exit()
|
3721067c0b18b1f8fb90057bccb206dc9e374f21 | srrun.py | srrun.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
import copy
import os
import subprocess
import sys
mypath = os.path.abspath(__file__)
mydir = os.path.split(mypath)[0]
srhome = os.path.join(mydir, '..')
srhome = os.path.abspath(srhome)
srbin = os.path.join(srhome, 'bin')
srpython = os.path.join(srbin, 'python')
srpypath = [mydir, os.path.join(mydir, 'wpr')]
env = copy.copy(os.environ)
env['PYTHONPATH'] = ':'.join(srpypath)
sys.exit(subprocess.call([srpython] + sys.argv[1:], env=env))
| #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
import copy
import os
import subprocess
import sys
mypath = os.path.abspath(__file__)
mydir = os.path.split(mypath)[0]
srhome = os.path.join(mydir, '..')
srhome = os.path.abspath(srhome)
srbin = os.path.join(srhome, 'bin')
srpython = os.path.join(srbin, 'python')
srpypath = [mydir, os.path.join(mydir, 'wpr')]
env = copy.copy(os.environ)
env['PYTHONPATH'] = ':'.join(srpypath)
# Set a sane umask for all children
os.umask(022)
sys.exit(subprocess.call([srpython] + sys.argv[1:], env=env))
| Set umask appropriately for all processes | Set umask appropriately for all processes
| Python | mpl-2.0 | mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge | ---
+++
@@ -19,4 +19,7 @@
env = copy.copy(os.environ)
env['PYTHONPATH'] = ':'.join(srpypath)
+# Set a sane umask for all children
+os.umask(022)
+
sys.exit(subprocess.call([srpython] + sys.argv[1:], env=env)) |
3ac532d719472c634bcddd21c146d80ccb217f4c | blog/forms.py | blog/forms.py | from .models import BlogPost, Comment
from django.forms import ModelForm
class BlogPostForm(ModelForm):
class Meta:
model = BlogPost
exclude = ('user',)
class CommentForm(ModelForm):
class Meta:
model = Comment
exclude = ('post', 'user', 'date',)
| from .models import BlogPost, BlogComment
from django.forms import ModelForm
class BlogPostForm(ModelForm):
class Meta:
model = BlogPost
exclude = ('user',)
class CommentForm(ModelForm):
class Meta:
model = BlogComment
exclude = ('post', 'user', 'date',)
| Fix model name for BlogComment after previous refactoring | Fix model name for BlogComment after previous refactoring
| Python | mit | andreagrandi/bloggato,andreagrandi/bloggato | ---
+++
@@ -1,4 +1,4 @@
-from .models import BlogPost, Comment
+from .models import BlogPost, BlogComment
from django.forms import ModelForm
class BlogPostForm(ModelForm):
@@ -8,5 +8,5 @@
class CommentForm(ModelForm):
class Meta:
- model = Comment
+ model = BlogComment
exclude = ('post', 'user', 'date',) |
dad401390178c9f96a0a68f1fa9e5c82304ad60d | mail_factory/previews.py | mail_factory/previews.py | from base64 import b64encode
from django.conf import settings
from mail_factory.messages import EmailMultiRelated
class PreviewMessage(EmailMultiRelated):
def has_body_html(self):
"""Test if a message contains an alternative rendering in text/html"""
return 'text/html' in self.alternatives
@property
def body_html(self):
"""Return an alternative rendering in text/html"""
return self.alternatives.get('text/html', '')
@property
def body_html_escaped(self):
"""Return an alternative rendering in text/html escaped to work in a iframe"""
return b64encode(self.body_html)
class BasePreviewMail(object):
"""Abstract class that helps creating preview emails.
You also may overwrite:
* get_context_data: to add global context such as SITE_NAME
"""
message_class = PreviewMessage
def get_message(self, lang=None):
"""Return a new message instance based on your MailClass"""
return self.mail.create_email_msg(self.get_email_receivers(),
lang=lang,
message_class=self.message_class)
@property
def mail(self):
return self.mail_class(self.get_context_data())
def get_email_receivers(self):
"""Returns email receivers."""
return [settings.SERVER_EMAIL, ]
def get_context_data():
"""Returns automatic context_data."""
return {}
@property
def mail_class(self):
raise NotImplementedError
| # -*- coding: utf-8 -*-
from django.conf import settings
from django.utils.encoding import smart_str
from mail_factory.messages import EmailMultiRelated
class PreviewMessage(EmailMultiRelated):
def has_body_html(self):
"""Test if a message contains an alternative rendering in text/html"""
return 'text/html' in self.rendering_formats
@property
def body_html(self):
"""Return an alternative rendering in text/html"""
return self.rendering_formats.get('text/html', '')
@property
def rendering_formats(self):
return dict((v, k) for k, v in self.alternatives)
class BasePreviewMail(object):
"""Abstract class that helps creating preview emails.
You also may overwrite:
* get_context_data: to add global context such as SITE_NAME
"""
message_class = PreviewMessage
def get_message(self, lang=None):
"""Return a new message instance based on your MailClass"""
return self.mail.create_email_msg(self.get_email_receivers(),
lang=lang,
message_class=self.message_class)
@property
def mail(self):
return self.mail_class(self.get_context_data())
def get_email_receivers(self):
"""Returns email receivers."""
return [settings.SERVER_EMAIL, ]
def get_context_data():
"""Returns automatic context_data."""
return {}
@property
def mail_class(self):
raise NotImplementedError
| Remove `body_html_escaped`. Add rendering filtered by formats. | Remove `body_html_escaped`.
Add rendering filtered by formats.
| Python | bsd-3-clause | novafloss/django-mail-factory,novafloss/django-mail-factory | ---
+++
@@ -1,6 +1,6 @@
-from base64 import b64encode
-
+# -*- coding: utf-8 -*-
from django.conf import settings
+from django.utils.encoding import smart_str
from mail_factory.messages import EmailMultiRelated
@@ -8,17 +8,16 @@
class PreviewMessage(EmailMultiRelated):
def has_body_html(self):
"""Test if a message contains an alternative rendering in text/html"""
- return 'text/html' in self.alternatives
+ return 'text/html' in self.rendering_formats
@property
def body_html(self):
"""Return an alternative rendering in text/html"""
- return self.alternatives.get('text/html', '')
+ return self.rendering_formats.get('text/html', '')
@property
- def body_html_escaped(self):
- """Return an alternative rendering in text/html escaped to work in a iframe"""
- return b64encode(self.body_html)
+ def rendering_formats(self):
+ return dict((v, k) for k, v in self.alternatives)
class BasePreviewMail(object): |
ce2df91a790aedcd0ec08f3526141cd01c63560d | tasks.py | tasks.py | from os import mkdir
from os.path import join
from shutil import rmtree, copytree
from invoke import Collection, ctask as task
from invocations.docs import docs, www
from invocations.packaging import publish
# Until we move to spec-based testing
@task
def test(ctx):
ctx.run("python test.py --verbose", pty=True)
@task
def coverage(ctx):
ctx.run("coverage run --source=paramiko test.py --verbose")
# Until we stop bundling docs w/ releases. Need to discover use cases first.
@task
def release(ctx):
# Build docs first. Use terribad workaround pending invoke #146
ctx.run("inv docs")
# Move the built docs into where Epydocs used to live
target = 'docs'
rmtree(target, ignore_errors=True)
# TODO: make it easier to yank out this config val from the docs coll
copytree('sites/docs/_build', target)
# Publish
publish(ctx)
# Remind
print("\n\nDon't forget to update RTD's versions page for new minor releases!")
ns = Collection(test, coverage, release, docs, www)
| from os import mkdir
from os.path import join
from shutil import rmtree, copytree
from invoke import Collection, ctask as task
from invocations.docs import docs, www
from invocations.packaging import publish
# Until we move to spec-based testing
@task
def test(ctx, coverage=False, flags=""):
if "--verbose" not in flags.split():
flags += " --verbose"
runner = "python"
if coverage:
runner = "coverage run --source=paramiko"
ctx.run("{0} test.py {1}".format(runner, flags), pty=True)
@task
def coverage(ctx):
ctx.run("coverage run --source=paramiko test.py --verbose")
# Until we stop bundling docs w/ releases. Need to discover use cases first.
@task
def release(ctx):
# Build docs first. Use terribad workaround pending invoke #146
ctx.run("inv docs")
# Move the built docs into where Epydocs used to live
target = 'docs'
rmtree(target, ignore_errors=True)
# TODO: make it easier to yank out this config val from the docs coll
copytree('sites/docs/_build', target)
# Publish
publish(ctx)
# Remind
print("\n\nDon't forget to update RTD's versions page for new minor releases!")
ns = Collection(test, coverage, release, docs, www)
| Allow specifying test.py flags in 'inv test' | Allow specifying test.py flags in 'inv test'
| Python | lgpl-2.1 | jaraco/paramiko,mirrorcoder/paramiko,ameily/paramiko,dorianpula/paramiko,SebastianDeiss/paramiko,reaperhulk/paramiko,paramiko/paramiko | ---
+++
@@ -9,8 +9,14 @@
# Until we move to spec-based testing
@task
-def test(ctx):
- ctx.run("python test.py --verbose", pty=True)
+def test(ctx, coverage=False, flags=""):
+ if "--verbose" not in flags.split():
+ flags += " --verbose"
+ runner = "python"
+ if coverage:
+ runner = "coverage run --source=paramiko"
+ ctx.run("{0} test.py {1}".format(runner, flags), pty=True)
+
@task
def coverage(ctx): |
3045f6ffbd8433d60178fee59550d30064015b46 | tm/tm.py | tm/tm.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import subprocess
import argparse
__version__ = 1.0
__description__ = "A tmux wrapper featuring shortcuts and session presets."
def main(argv):
parser = argparse.ArgumentParser(description=__description__)
parser.add_argument("session",
metavar="session",
type=str,
nargs="?",
help="the name of the tmux session to start or attach")
parser.add_argument("-l", "--list",
action="store_true",
help="list all open sessions and session presets")
parser.add_argument("-k", "--kill",
metavar="session",
action="store",
help="kill a session")
args = parser.parse_args()
err = ""
if args.kill:
pass
elif args.list:
pass
elif args.session:
pass
if __name__ == "__main__":
main(sys.argv[1:]) | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import subprocess
import argparse
__version__ = 1.0
__description__ = "A tmux wrapper featuring shortcuts and session presets."
def main(argv):
parser = argparse.ArgumentParser(description=__description__)
parser.add_argument("session",
metavar="session",
type=str,
nargs="?",
help="the name of the tmux session to start or attach")
parser.add_argument("-l", "--list",
action="store_true",
help="list all open sessions and session presets")
parser.add_argument("-k", "--kill",
metavar="session",
action="store",
help="kill a session")
args = parser.parse_args()
if len(argv) == 0:
parser.print_help()
if args.kill:
p = subprocess.Popen("tmux kill-session -t {}".format(args.kill),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True)
out, err = p.communicate()
elif args.list:
p = subprocess.Popen("tmux ls",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True)
out, err = p.communicate()
elif args.session:
p = subprocess.Popen("tmux new -s {}".format(args.session),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True)
out, err = p.communicate()
if __name__ == "__main__":
main(sys.argv[1:]) | Add kill, list, and create commands | Add kill, list, and create commands
| Python | mit | ethanal/tm | ---
+++
@@ -26,13 +26,27 @@
args = parser.parse_args()
- err = ""
+ if len(argv) == 0:
+ parser.print_help()
+
if args.kill:
- pass
+ p = subprocess.Popen("tmux kill-session -t {}".format(args.kill),
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=True)
+ out, err = p.communicate()
elif args.list:
- pass
+ p = subprocess.Popen("tmux ls",
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=True)
+ out, err = p.communicate()
elif args.session:
- pass
+ p = subprocess.Popen("tmux new -s {}".format(args.session),
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=True)
+ out, err = p.communicate()
if __name__ == "__main__":
main(sys.argv[1:]) |
ba4a20ee94355464ec8b35750660f7b8fe0cc3db | tests/test_yaml2ncml.py | tests/test_yaml2ncml.py | from __future__ import (absolute_import, division, print_function)
import subprocess
import tempfile
def test_call():
output = subprocess.check_output(['yaml2ncml', 'roms_0.yaml'])
with open('base_roms_test.ncml') as f:
expected = f.read()
assert output.decode() == expected
def test_save_file():
outfile = tempfile.mktemp(suffix='.ncml')
subprocess.call(['yaml2ncml',
'roms_0.yaml',
'--output={}'.format(outfile)])
with open('base_roms_test.ncml') as f:
expected = f.read()
with open(outfile) as f:
output = f.read()
assert output == expected
| from __future__ import (absolute_import, division, print_function)
import subprocess
import tempfile
import pytest
import ruamel.yaml as yaml
from yaml2ncml import build
def test_call():
output = subprocess.check_output(['yaml2ncml', 'roms_0.yaml'])
with open('base_roms_test.ncml') as f:
expected = f.read()
assert output.decode() == expected
def test_save_file():
outfile = tempfile.mktemp(suffix='.ncml')
subprocess.call(['yaml2ncml',
'roms_0.yaml',
'--output={}'.format(outfile)])
with open('base_roms_test.ncml') as f:
expected = f.read()
with open(outfile) as f:
output = f.read()
assert output == expected
@pytest.fixture
def load_ymal(fname='roms_1.yaml'):
with open(fname, 'r') as stream:
yml = yaml.load(stream, Loader=yaml.RoundTripLoader)
return yml
def test_bad_yaml():
with pytest.raises(ValueError):
yml = load_ymal(fname='roms_1.yaml')
build(yml)
| Test bad call/better error msg | Test bad call/better error msg
| Python | mit | ocefpaf/yaml2ncml,USGS-CMG/yaml2ncml | ---
+++
@@ -2,6 +2,11 @@
import subprocess
import tempfile
+
+import pytest
+import ruamel.yaml as yaml
+
+from yaml2ncml import build
def test_call():
@@ -21,3 +26,16 @@
with open(outfile) as f:
output = f.read()
assert output == expected
+
+
+@pytest.fixture
+def load_ymal(fname='roms_1.yaml'):
+ with open(fname, 'r') as stream:
+ yml = yaml.load(stream, Loader=yaml.RoundTripLoader)
+ return yml
+
+
+def test_bad_yaml():
+ with pytest.raises(ValueError):
+ yml = load_ymal(fname='roms_1.yaml')
+ build(yml) |
42710918df931a6839364e58548dcce2d1346324 | src/tests/gopigo_stub.py | src/tests/gopigo_stub.py | """A stub for the gopigo module."""
calls = []
def servo(angle):
calls.append('servo({0})'.format(angle))
def set_speed(speed):
calls.append('set_speed({0}'.format(speed))
def stop():
calls.append('stop()')
def trim_write(trim):
calls.append('trim_write({0})'.format(trim))
def us_dist(pin):
calls.append('us_dist({0})'.format(pin))
return 600 # approximate max range
| """A stub for the gopigo module."""
calls = []
def servo(angle):
calls.append('servo({0})'.format(angle))
def set_speed(speed):
calls.append('set_speed({0})'.format(speed))
def set_left_speed(speed):
calls.append('set_left_speed({0})'.format(speed))
def set_right_speed(speed):
calls.append('set_right_speed({0})'.format(speed))
def stop():
calls.append('stop()')
def fwd():
calls.append('fwd()')
def trim_write(trim):
calls.append('trim_write({0})'.format(trim))
def us_dist(pin):
calls.append('us_dist({0})'.format(pin))
return 600 # approximate max range
| Support for testing robot steering. | Support for testing robot steering.
| Python | mit | RLGarner1/robot_maze,mattskone/robot_maze | ---
+++
@@ -6,10 +6,19 @@
calls.append('servo({0})'.format(angle))
def set_speed(speed):
- calls.append('set_speed({0}'.format(speed))
+ calls.append('set_speed({0})'.format(speed))
+
+def set_left_speed(speed):
+ calls.append('set_left_speed({0})'.format(speed))
+
+def set_right_speed(speed):
+ calls.append('set_right_speed({0})'.format(speed))
def stop():
calls.append('stop()')
+
+def fwd():
+ calls.append('fwd()')
def trim_write(trim):
calls.append('trim_write({0})'.format(trim)) |
6683bf5e248bdd52f0ebc175dc7c94d5677ba6dd | tools/manifest/utils.py | tools/manifest/utils.py | import os
from contextlib import contextmanager
@contextmanager
def effective_user(uid, gid):
"""
A ContextManager that executes code in the with block with effective uid / gid given
"""
original_uid = os.geteuid()
original_gid = os.getegid()
os.setegid(gid)
os.seteuid(uid)
yield
os.setegid(original_gid)
os.setuid(original_uid)
| import os
from contextlib import contextmanager
@contextmanager
def effective_user(uid, gid):
"""
A ContextManager that executes code in the with block with effective uid / gid given
"""
original_uid = os.geteuid()
original_gid = os.getegid()
os.setegid(gid)
os.seteuid(uid)
try:
yield
finally:
os.setegid(original_gid)
os.setuid(original_uid)
| Make effective_user handle exceptions properly | Make effective_user handle exceptions properly
Right now the context manager is just syntactic sugar - setegid
and seteuid aren't called if there's an exception.
Change-Id: I9e2f1d0ada00b03099fe60a8735db1caef8527e9
| Python | mit | wikimedia/operations-software-tools-manifest | ---
+++
@@ -11,6 +11,8 @@
original_gid = os.getegid()
os.setegid(gid)
os.seteuid(uid)
- yield
- os.setegid(original_gid)
- os.setuid(original_uid)
+ try:
+ yield
+ finally:
+ os.setegid(original_gid)
+ os.setuid(original_uid) |
004345f50edd4c4b08727efaf5de7ee60f1f1e48 | caffe2/python/operator_test/softplus_op_test.py | caffe2/python/operator_test/softplus_op_test.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core
from hypothesis import given
import caffe2.python.hypothesis_test_util as hu
import unittest
class TestSoftplus(hu.HypothesisTestCase):
@given(X=hu.tensor(),
**hu.gcs)
def test_softplus(self, X, gc, dc):
op = core.CreateOperator("Softplus", ["X"], ["Y"])
self.assertDeviceChecks(dc, op, [X], [0])
self.assertGradientChecks(gc, op, [X], 0, [0], stepsize=0.0005)
if __name__ == "__main__":
unittest.main()
| from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core
from hypothesis import given
import caffe2.python.hypothesis_test_util as hu
import unittest
class TestSoftplus(hu.HypothesisTestCase):
@given(X=hu.tensor(),
**hu.gcs)
def test_softplus(self, X, gc, dc):
op = core.CreateOperator("Softplus", ["X"], ["Y"])
self.assertDeviceChecks(dc, op, [X], [0])
self.assertGradientChecks(gc, op, [X], 0, [0])
if __name__ == "__main__":
unittest.main()
| Fix gradient checking for softplus op | Fix gradient checking for softplus op
Summary:
kmatzen why did you set the stepsize in https://github.com/caffe2/caffe2/commit/ff84e7dea6e118710859d62a7207c06b87ae992e?
The test is flaky before this change. Solid afterwards.
Closes https://github.com/caffe2/caffe2/pull/841
Differential Revision: D5292112
Pulled By: akyrola
fbshipit-source-id: c84715261194ff047606d4ec659b7f89dac3cbb1
| Python | apache-2.0 | sf-wind/caffe2,xzturn/caffe2,sf-wind/caffe2,pietern/caffe2,sf-wind/caffe2,xzturn/caffe2,Yangqing/caffe2,Yangqing/caffe2,davinwang/caffe2,sf-wind/caffe2,xzturn/caffe2,pietern/caffe2,bwasti/caffe2,sf-wind/caffe2,bwasti/caffe2,davinwang/caffe2,davinwang/caffe2,xzturn/caffe2,pietern/caffe2,pietern/caffe2,davinwang/caffe2,Yangqing/caffe2,Yangqing/caffe2,bwasti/caffe2,bwasti/caffe2,xzturn/caffe2,pietern/caffe2,caffe2/caffe2,davinwang/caffe2,Yangqing/caffe2,bwasti/caffe2 | ---
+++
@@ -17,7 +17,7 @@
def test_softplus(self, X, gc, dc):
op = core.CreateOperator("Softplus", ["X"], ["Y"])
self.assertDeviceChecks(dc, op, [X], [0])
- self.assertGradientChecks(gc, op, [X], 0, [0], stepsize=0.0005)
+ self.assertGradientChecks(gc, op, [X], 0, [0])
if __name__ == "__main__": |
a06c3845b2e827ff34bdd34844db39a74826f123 | meteocalc/mimicfloat.py | meteocalc/mimicfloat.py | import operator
def math_method(name, right=False):
def wrapper(self, other):
value = self.value
math_func = getattr(operator, name)
if right:
value, other = other, value
result = math_func(value, other)
return type(self)(result, units=self.units)
return wrapper
class MimicFloat(type):
overrride_methods = ('__add__', '__sub__', '__mul__', '__truediv__')
overrride_rmethods = ('__radd__', '__rsub__', '__rmul__', '__rtruediv__')
def __new__(cls, name, bases, namespace):
for method in cls.overrride_methods:
namespace[method] = math_method(method)
for rmethod in cls.overrride_rmethods:
method = rmethod.replace('__r', '__')
namespace[rmethod] = math_method(method, right=True)
return super(MimicFloat, cls).__new__(cls, name, bases, namespace)
| from functools import wraps
import operator
def math_method(name, right=False):
math_func = getattr(operator, name)
@wraps(math_func)
def wrapper(self, other):
value = self.value
if right:
value, other = other, value
result = math_func(value, other)
return type(self)(result, units=self.units)
return wrapper
class MimicFloat(type):
math_methods = ('__add__', '__sub__', '__mul__', '__truediv__')
math_rmethods = ('__radd__', '__rsub__', '__rmul__', '__rtruediv__')
def __new__(cls, name, bases, namespace):
for method in cls.math_methods:
namespace[method] = math_method(method)
for rmethod in cls.math_rmethods:
method = rmethod.replace('__r', '__')
namespace[rmethod] = math_method(method, right=True)
return super(MimicFloat, cls).__new__(cls, name, bases, namespace)
| Make math method wrapping nicer | Make math method wrapping nicer
| Python | mit | malexer/meteocalc | ---
+++
@@ -1,10 +1,13 @@
+from functools import wraps
import operator
def math_method(name, right=False):
+ math_func = getattr(operator, name)
+
+ @wraps(math_func)
def wrapper(self, other):
value = self.value
- math_func = getattr(operator, name)
if right:
value, other = other, value
@@ -17,14 +20,14 @@
class MimicFloat(type):
- overrride_methods = ('__add__', '__sub__', '__mul__', '__truediv__')
- overrride_rmethods = ('__radd__', '__rsub__', '__rmul__', '__rtruediv__')
+ math_methods = ('__add__', '__sub__', '__mul__', '__truediv__')
+ math_rmethods = ('__radd__', '__rsub__', '__rmul__', '__rtruediv__')
def __new__(cls, name, bases, namespace):
- for method in cls.overrride_methods:
+ for method in cls.math_methods:
namespace[method] = math_method(method)
- for rmethod in cls.overrride_rmethods:
+ for rmethod in cls.math_rmethods:
method = rmethod.replace('__r', '__')
namespace[rmethod] = math_method(method, right=True)
|
a8b4553b76f3303017818e60df5504445a6556d0 | dj_experiment/conf.py | dj_experiment/conf.py | import os
from appconf import AppConf
from django.conf import settings
class DjExperimentAppConf(AppConf):
DATA_DIR = "./"
BASE_DATA_DIR = os.path.join(settings.BASE_DIR, 'data')
SEPARATOR = "."
OUTPUT_PREFIX = ""
OUTPUT_SUFFIX = ".nc"
CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//'
CELERY_RESULT_BACKEND = 'rpc://'
class Meta:
prefix = 'dj_experiment'
holder = 'dj_experiment.conf.settings'
| import os
from appconf import AppConf
from django.conf import settings
class DjExperimentAppConf(AppConf):
DATA_DIR = "./"
BASE_DATA_DIR = os.path.join(settings.BASE_DIR, 'data')
SEPARATOR = "."
OUTPUT_PREFIX = ""
OUTPUT_SUFFIX = ".nc"
CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//'
CELERY_RESULT_BACKEND = 'rpc://'
TAGGIT_CASE_INSENSITIVE = True
class Meta:
prefix = 'dj_experiment'
holder = 'dj_experiment.conf.settings'
| Make taggit case-insensitive by default | Make taggit case-insensitive by default
| Python | mit | francbartoli/dj-experiment,francbartoli/dj-experiment | ---
+++
@@ -12,6 +12,7 @@
OUTPUT_SUFFIX = ".nc"
CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//'
CELERY_RESULT_BACKEND = 'rpc://'
+ TAGGIT_CASE_INSENSITIVE = True
class Meta:
prefix = 'dj_experiment' |
5eb9c9bf89904f25785955050d991bd4ec20db66 | PRESUBMIT.py | PRESUBMIT.py | # Copyright (c) 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Top-level presubmit script for catapult.
See https://www.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into depot_tools.
"""
def GetPreferredTryMasters(project, change):
return {
'tryserver.client.catapult': {
'Catapult Linux Tryserver': set(['defaulttests']),
'Catapult Mac Tryserver': set(['defaulttests']),
'Catapult Windows Tryserver': set(['defaulttests']),
}
}
def _CommonChecks(input_api, output_api):
results = []
results.extend(input_api.canned_checks.PanProjectChecks(
input_api, output_api, project_name='catapult'))
return results
def CheckChangeOnUpload(input_api, output_api):
results = []
results.extend(_CommonChecks(input_api, output_api))
return results
def CheckChangeOnCommit(input_api, output_api):
results = []
results.extend(_CommonChecks(input_api, output_api))
return results
| # Copyright (c) 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Top-level presubmit script for catapult.
See https://www.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into depot_tools.
"""
def GetPreferredTryMasters(project, change):
return {
'tryserver.client.catapult': {
'Catapult Linux Tryserver': set(['defaulttests']),
'Catapult Mac Tryserver': set(['defaulttests']),
'Catapult Windows Tryserver': set(['defaulttests']),
}
}
def _CommonChecks(input_api, output_api):
results = []
results.extend(input_api.canned_checks.PanProjectChecks(
input_api, output_api))
return results
def CheckChangeOnUpload(input_api, output_api):
results = []
results.extend(_CommonChecks(input_api, output_api))
return results
def CheckChangeOnCommit(input_api, output_api):
results = []
results.extend(_CommonChecks(input_api, output_api))
return results
| Remove custom project name, since it changes copyright statements. | Remove custom project name, since it changes copyright statements.
R=qyearsley@chromium.org
Review URL: https://codereview.chromium.org/1212843006.
| Python | bsd-3-clause | SummerLW/Perf-Insight-Report,catapult-project/catapult-csm,catapult-project/catapult-csm,benschmaus/catapult,SummerLW/Perf-Insight-Report,scottmcmaster/catapult,catapult-project/catapult-csm,danbeam/catapult,benschmaus/catapult,scottmcmaster/catapult,benschmaus/catapult,benschmaus/catapult,modulexcite/catapult,catapult-project/catapult,catapult-project/catapult,0x90sled/catapult,zeptonaut/catapult,catapult-project/catapult,catapult-project/catapult-csm,0x90sled/catapult,SummerLW/Perf-Insight-Report,sahiljain/catapult,scottmcmaster/catapult,sahiljain/catapult,dstockwell/catapult,modulexcite/catapult,benschmaus/catapult,catapult-project/catapult,SummerLW/Perf-Insight-Report,benschmaus/catapult,catapult-project/catapult-csm,catapult-project/catapult,catapult-project/catapult,sahiljain/catapult,sahiljain/catapult,benschmaus/catapult,dstockwell/catapult,dstockwell/catapult,catapult-project/catapult-csm,catapult-project/catapult-csm,zeptonaut/catapult,danbeam/catapult,danbeam/catapult,catapult-project/catapult,sahiljain/catapult,0x90sled/catapult,SummerLW/Perf-Insight-Report,dstockwell/catapult,danbeam/catapult,SummerLW/Perf-Insight-Report,sahiljain/catapult,modulexcite/catapult,zeptonaut/catapult | ---
+++
@@ -22,7 +22,7 @@
def _CommonChecks(input_api, output_api):
results = []
results.extend(input_api.canned_checks.PanProjectChecks(
- input_api, output_api, project_name='catapult'))
+ input_api, output_api))
return results
|
686a71b4493adf39ed0b9335a1c8f83cf8ce5bfe | ml_metadata/__init__.py | ml_metadata/__init__.py | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# 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.
"""Init module for ML Metadata."""
from ml_metadata import proto
# Import metadata_store API.
from ml_metadata.metadata_store import downgrade_schema
from ml_metadata.metadata_store import ListOptions
from ml_metadata.metadata_store import MetadataStore
from ml_metadata.metadata_store import OrderByField
# Import version string.
from ml_metadata.version import __version__
| # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# 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.
"""Init module for ML Metadata."""
# pylint: disable=g-import-not-at-top
try:
from ml_metadata import proto
# Import metadata_store API.
from ml_metadata.metadata_store import downgrade_schema
from ml_metadata.metadata_store import ListOptions
from ml_metadata.metadata_store import MetadataStore
from ml_metadata.metadata_store import OrderByField
# Import version string.
from ml_metadata.version import __version__
except ImportError as err:
import sys
sys.stderr.write('Error importing: {}'.format(err))
# pylint: enable=g-import-not-at-top
| Add import exception module init. | Add import exception module init.
PiperOrigin-RevId: 421941098
| Python | apache-2.0 | google/ml-metadata,google/ml-metadata,google/ml-metadata,google/ml-metadata | ---
+++
@@ -12,13 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Init module for ML Metadata."""
-from ml_metadata import proto
-# Import metadata_store API.
-from ml_metadata.metadata_store import downgrade_schema
-from ml_metadata.metadata_store import ListOptions
-from ml_metadata.metadata_store import MetadataStore
-from ml_metadata.metadata_store import OrderByField
-# Import version string.
-from ml_metadata.version import __version__
+# pylint: disable=g-import-not-at-top
+try:
+ from ml_metadata import proto
+
+ # Import metadata_store API.
+ from ml_metadata.metadata_store import downgrade_schema
+ from ml_metadata.metadata_store import ListOptions
+ from ml_metadata.metadata_store import MetadataStore
+ from ml_metadata.metadata_store import OrderByField
+
+ # Import version string.
+ from ml_metadata.version import __version__
+
+except ImportError as err:
+ import sys
+ sys.stderr.write('Error importing: {}'.format(err))
+# pylint: enable=g-import-not-at-top |
fd3ee57a352fd815d2746f3a72196ac62fdceb5c | src/integrationtest/python/shutdown_daemon_tests.py | src/integrationtest/python/shutdown_daemon_tests.py | #!/usr/bin/env python
from __future__ import print_function, absolute_import, division
import os
import shutil
import subprocess
import tempfile
import time
import unittest2
class ShutdownDaemonTests(unittest2.TestCase):
def setUp(self):
self.temp_dir = tempfile.mkdtemp(prefix="succubus-test")
self.pid_file = os.path.join(self.temp_dir, 'succubus.pid')
os.environ['PID_FILE'] = self.pid_file
def tearDown(self):
#shutil.rmtree(self.temp_dir)
print(self.temp_dir)
def test_daemon_start_status_stop(self):
daemon = "./src/integrationtest/python/shutdown_daemon.py"
subprocess.check_call([daemon, "start"])
time.sleep(0.3)
subprocess.check_call([daemon, "status"])
subprocess.check_call([daemon, "stop"])
success_file = os.path.join(self.temp_dir, "success")
self.assertTrue(os.path.exists(success_file))
if __name__ == "__main__":
unittest2.main()
| #!/usr/bin/env python
from __future__ import print_function, absolute_import, division
import os
import shutil
import subprocess
import tempfile
import time
import unittest2
class ShutdownDaemonTests(unittest2.TestCase):
def setUp(self):
self.temp_dir = tempfile.mkdtemp(prefix="succubus-test")
self.pid_file = os.path.join(self.temp_dir, 'succubus.pid')
os.environ['PID_FILE'] = self.pid_file
def tearDown(self):
shutil.rmtree(self.temp_dir)
def test_daemon_start_status_stop(self):
daemon = "./src/integrationtest/python/shutdown_daemon.py"
subprocess.check_call([daemon, "start"])
time.sleep(0.3)
subprocess.check_call([daemon, "status"])
subprocess.check_call([daemon, "stop"])
success_file = os.path.join(self.temp_dir, "success")
self.assertTrue(os.path.exists(success_file))
if __name__ == "__main__":
unittest2.main()
| Revert debugging changes: clean up tempfiles | Revert debugging changes: clean up tempfiles
| Python | apache-2.0 | ImmobilienScout24/succubus | ---
+++
@@ -15,8 +15,7 @@
os.environ['PID_FILE'] = self.pid_file
def tearDown(self):
- #shutil.rmtree(self.temp_dir)
- print(self.temp_dir)
+ shutil.rmtree(self.temp_dir)
def test_daemon_start_status_stop(self):
daemon = "./src/integrationtest/python/shutdown_daemon.py" |
055c15a8e837014bb74a601df776eae642edfd61 | auth_mac/models.py | auth_mac/models.py | from django.db import models
from django.contrib.auth.models import User
import datetime
def default_expiry_time():
return datetime.datetime.now() + datetime.timedelta(days=1)
def random_string():
return User.objects.make_random_password(16)
class Credentials(models.Model):
"Keeps track of issued MAC credentials"
user = models.ForeignKey(User)
expiry = models.DateTimeField("Expires On", default=default_expiry_time)
identifier = models.CharField("MAC Key Identifier", max_length=16, default=random_string)
key = models.CharField("MAC Key", max_length=16, default=random_string)
def __unicode__(self):
return u"{0}:{1}".format(self.identifier, self.key)
@property
def expired(self):
"""Returns whether or not the credentials have expired"""
if self.expiry < datetime.datetime.now():
return True
return False
class Nonce(models.Model):
"""Keeps track of any NONCE combinations that we have used"""
nonce = models.CharField("NONCE", max_length=16, null=True, blank=True)
timestamp = models.DateTimeField("Timestamp", auto_now_add=True)
credentials = models.ForeignKey(Credentials) | from django.db import models
from django.contrib.auth.models import User
import datetime
def default_expiry_time():
return datetime.datetime.now() + datetime.timedelta(days=1)
def random_string():
return User.objects.make_random_password(16)
class Credentials(models.Model):
"Keeps track of issued MAC credentials"
user = models.ForeignKey(User)
expiry = models.DateTimeField("Expires On", default=default_expiry_time)
identifier = models.CharField("MAC Key Identifier", max_length=16, default=random_string)
key = models.CharField("MAC Key", max_length=16, default=random_string)
def __unicode__(self):
return u"{0}:{1}".format(self.identifier, self.key)
@property
def expired(self):
"""Returns whether or not the credentials have expired"""
if self.expiry < datetime.datetime.now():
return True
return False
class Nonce(models.Model):
"""Keeps track of any NONCE combinations that we have used"""
nonce = models.CharField("NONCE", max_length=16, null=True, blank=True)
timestamp = models.DateTimeField("Timestamp", auto_now_add=True)
credentials = models.ForeignKey(Credentials)
def __unicode__(self):
timestamp = self.timestamp - datetime.datetime(1970,1,1)
timestamp = timestamp.days * 24 * 3600 + timestamp.seconds
return u"[{0}/{1}/{2}]".format(self.nonce, timestamp, self.credentials.identifier) | Add a unicode method for the Nonces | Add a unicode method for the Nonces
| Python | mit | ndevenish/auth_mac | ---
+++
@@ -30,3 +30,8 @@
nonce = models.CharField("NONCE", max_length=16, null=True, blank=True)
timestamp = models.DateTimeField("Timestamp", auto_now_add=True)
credentials = models.ForeignKey(Credentials)
+
+ def __unicode__(self):
+ timestamp = self.timestamp - datetime.datetime(1970,1,1)
+ timestamp = timestamp.days * 24 * 3600 + timestamp.seconds
+ return u"[{0}/{1}/{2}]".format(self.nonce, timestamp, self.credentials.identifier) |
978b812c9db8c11098aa38b7c630a61cac5574b8 | examples/pltparser.py | examples/pltparser.py | #!/usr/bin/env python
import sys
import networkx as nx
from matplotlib import pyplot
from davies.compass.plt import CompassPltParser
def pltparser(pltfilename):
parser = CompassPltParser(pltfilename)
plt = parser.parse()
g = nx.Graph()
pos = {}
ele = {}
for segment in plt:
prev = None
for cmd in segment:
pos[cmd.name] = (-cmd.x, cmd.y)
ele[cmd.name] = cmd.z
if not prev or cmd.cmd == 'M':
prev = cmd # move
continue
g.add_edge(prev.name, cmd.name)
prev = cmd
pyplot.figure().suptitle(plt.name, fontweight='bold')
colors = [ele[n] for n in g]
nx.draw(g, pos, node_color=colors, vmin=min(colors), vmax=max(colors), with_labels=False, node_size=15)
pyplot.show()
if __name__ == '__main__':
pltparser(sys.argv[1])
| #!/usr/bin/env python
import sys
import networkx as nx
from matplotlib import pyplot
from davies.compass.plt import CompassPltParser
def pltparser(pltfilename):
parser = CompassPltParser(pltfilename)
plt = parser.parse()
g = nx.Graph()
pos = {}
ele = {}
for segment in plt:
prev = None
for cmd in segment:
pos[cmd.name] = (cmd.x, cmd.y)
ele[cmd.name] = cmd.z
if not prev or cmd.cmd == 'M':
prev = cmd # move
continue
g.add_edge(prev.name, cmd.name)
prev = cmd
pyplot.figure().suptitle(plt.name, fontweight='bold')
colors = [ele[n] for n in g]
nx.draw(g, pos, node_color=colors, vmin=min(colors), vmax=max(colors), with_labels=True, node_size=15)
pyplot.show()
if __name__ == '__main__':
pltparser(sys.argv[1])
| Fix inverted coordinate bug in Compass .PLT Parser example script | Fix inverted coordinate bug in Compass .PLT Parser example script
| Python | mit | riggsd/davies | ---
+++
@@ -13,7 +13,6 @@
parser = CompassPltParser(pltfilename)
plt = parser.parse()
-
g = nx.Graph()
pos = {}
ele = {}
@@ -21,7 +20,7 @@
prev = None
for cmd in segment:
- pos[cmd.name] = (-cmd.x, cmd.y)
+ pos[cmd.name] = (cmd.x, cmd.y)
ele[cmd.name] = cmd.z
if not prev or cmd.cmd == 'M':
prev = cmd # move
@@ -31,7 +30,7 @@
pyplot.figure().suptitle(plt.name, fontweight='bold')
colors = [ele[n] for n in g]
- nx.draw(g, pos, node_color=colors, vmin=min(colors), vmax=max(colors), with_labels=False, node_size=15)
+ nx.draw(g, pos, node_color=colors, vmin=min(colors), vmax=max(colors), with_labels=True, node_size=15)
pyplot.show()
|
97a068d7a83fffd6ed9307ac33da3835e449a935 | obj_sys/default_settings.py | obj_sys/default_settings.py | __author__ = 'weijia'
INSTALLED_APPS += (
'mptt',
'django_mptt_admin',
'tagging',
'ajax_select',
'django_extensions',
'geoposition',
'obj_sys',
# "obj_sys.apps.ObjSysConfig",
)
TEMPLATE_CONTEXT_PROCESSORS += (
'django.core.context_processors.request',
) | __author__ = 'weijia'
INSTALLED_APPS += (
'mptt',
'reversion',
'django_mptt_admin',
'tagging',
'ajax_select',
'django_extensions',
'geoposition',
'obj_sys',
# "obj_sys.apps.ObjSysConfig",
)
TEMPLATE_CONTEXT_PROCESSORS += (
'django.core.context_processors.request',
)
# MIDDLEWARE_CLASSES += (
# 'reversion.middleware.RevisionMiddleware',
# )
| Add reversion middle ware, but not work. | Add reversion middle ware, but not work.
| Python | bsd-3-clause | weijia/obj_sys,weijia/obj_sys | ---
+++
@@ -3,6 +3,7 @@
INSTALLED_APPS += (
'mptt',
+ 'reversion',
'django_mptt_admin',
'tagging',
'ajax_select',
@@ -15,3 +16,7 @@
TEMPLATE_CONTEXT_PROCESSORS += (
'django.core.context_processors.request',
)
+
+# MIDDLEWARE_CLASSES += (
+# 'reversion.middleware.RevisionMiddleware',
+# ) |
df131a8f482e712546555e0cb28a58edcf960bf2 | apps/planet/management/commands/update_all_feeds.py | apps/planet/management/commands/update_all_feeds.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from planet.management.commands import process_feed
from planet.models import Feed
from planet.signals import feeds_updated
class Command(BaseCommand):
"""
Command to add a complete blog feed to our db.
Usage:
./manage.py add_feed <feed_url>
"""
def handle(self, *args, **options):
for feed_url in Feed.site_objects.all().values_list("url", flat=True):
# process feed in create-mode
process_feed(feed_url, create=False)
feeds_updated.send(sender=self, instance=self)
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime
from django.core.management.base import BaseCommand
from planet.management.commands import process_feed
from planet.models import Feed
from planet.signals import feeds_updated
class Command(BaseCommand):
"""
Command to add a complete blog feed to our db.
Usage:
./manage.py add_feed <feed_url>
"""
def handle(self, *args, **options):
new_posts_count = 0
start = datetime.now()
for feed_url in Feed.site_objects.all().values_list("url", flat=True):
# process feed in create-mode
new_posts_count += process_feed(feed_url, create=False)
delta = datetime.now() - start
print "Added %s posts in %d seconds" % (new_posts_count, delta.seconds)
feeds_updated.send(sender=self, instance=self)
| Print total number of posts added and total elapsed time | Print total number of posts added and total elapsed time
| Python | bsd-3-clause | matagus/django-planet,matagus/django-planet,jilljenn/django-planet,jilljenn/django-planet | ---
+++
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-
+from datetime import datetime
from django.core.management.base import BaseCommand
from planet.management.commands import process_feed
@@ -17,8 +17,12 @@
./manage.py add_feed <feed_url>
"""
def handle(self, *args, **options):
+ new_posts_count = 0
+ start = datetime.now()
for feed_url in Feed.site_objects.all().values_list("url", flat=True):
# process feed in create-mode
- process_feed(feed_url, create=False)
+ new_posts_count += process_feed(feed_url, create=False)
+ delta = datetime.now() - start
+ print "Added %s posts in %d seconds" % (new_posts_count, delta.seconds)
feeds_updated.send(sender=self, instance=self)
-
+ |
4c2b4d10beac508747364680d9e9a5d7c3488f97 | confab/api.py | confab/api.py | """
Non-init module for doing convenient * imports from.
"""
from confab.diff import diff
from confab.generate import generate
from confab.pull import pull
from confab.push import push
| """
Non-init module for doing convenient * imports from.
"""
# core
from confab.conffiles import ConfFiles
# jinja2 environment loading
from confab.loaders import load_environment_from_dir, load_environment_from_package
# data loading
from confab.data import load_data_from_dir
# fabric tasks
from confab.diff import diff
from confab.generate import generate
from confab.pull import pull
from confab.push import push
| Add loaders and ConfFiles model to public API. | Add loaders and ConfFiles model to public API.
| Python | apache-2.0 | locationlabs/confab | ---
+++
@@ -2,6 +2,16 @@
Non-init module for doing convenient * imports from.
"""
+# core
+from confab.conffiles import ConfFiles
+
+# jinja2 environment loading
+from confab.loaders import load_environment_from_dir, load_environment_from_package
+
+# data loading
+from confab.data import load_data_from_dir
+
+# fabric tasks
from confab.diff import diff
from confab.generate import generate
from confab.pull import pull |
1a7bf8c3fd5560a8f6cba88607facf8321a97818 | police_api/exceptions.py | police_api/exceptions.py | from requests.exceptions import HTTPError
class BaseException(Exception):
pass
class APIError(BaseException, HTTPError):
"""
The API responded with a non-200 status code.
"""
def __init__(self, http_error):
self.message = getattr(http_error, 'message', None)
self.response = getattr(http_error, 'response', None)
def __str__(self):
return self.message or '<unknown error code>'
class InvalidCategoryException(BaseException):
"""
The requested category was not found, or is unavailable for the given date.
"""
pass
| from requests.exceptions import HTTPError
class BaseException(Exception):
pass
class APIError(BaseException, HTTPError):
"""
The API responded with a non-200 status code.
"""
def __init__(self, http_error):
self.message = getattr(http_error, 'message', None)
self.response = getattr(http_error, 'response', None)
self.status_code = getattr(self.response, 'status_code', None)
def __str__(self):
return self.message or '<unknown error code>'
class InvalidCategoryException(BaseException):
"""
The requested category was not found, or is unavailable for the given date.
"""
pass
| Add the 'status_code' attribute to the APIError exception if it's available | Add the 'status_code' attribute to the APIError exception if it's available
| Python | mit | rkhleics/police-api-client-python | ---
+++
@@ -13,6 +13,7 @@
def __init__(self, http_error):
self.message = getattr(http_error, 'message', None)
self.response = getattr(http_error, 'response', None)
+ self.status_code = getattr(self.response, 'status_code', None)
def __str__(self):
return self.message or '<unknown error code>' |
bc20949f8e5461d6ffa901d24677acb1bae922dd | mangopaysdk/types/payinexecutiondetailsdirect.py | mangopaysdk/types/payinexecutiondetailsdirect.py | from mangopaysdk.types.payinexecutiondetails import PayInExecutionDetails
class PayInExecutionDetailsDirect(PayInExecutionDetails):
def __init__(self):
# direct card
self.CardId = None
self.SecureModeReturnURL = None
self.SecureModeRedirectURL = None
# Mode3DSType { DEFAULT, FORCE }
self.SecureMode = None
| from mangopaysdk.types.payinexecutiondetails import PayInExecutionDetails
class PayInExecutionDetailsDirect(PayInExecutionDetails):
def __init__(self):
# direct card
self.CardId = None
self.SecureModeReturnURL = None
self.SecureModeRedirectURL = None
# Mode3DSType { DEFAULT, FORCE }
self.SecureMode = None
self.StatementDescriptor = None
| Add StatementDescriptor for card direct payins | Add StatementDescriptor for card direct payins | Python | mit | chocopoche/mangopay2-python-sdk,Mangopay/mangopay2-python-sdk | ---
+++
@@ -10,3 +10,4 @@
self.SecureModeRedirectURL = None
# Mode3DSType { DEFAULT, FORCE }
self.SecureMode = None
+ self.StatementDescriptor = None |
b7a8711afdbd4eaf7dfbf4ae4daab9d340c192b3 | numdifftools/testing.py | numdifftools/testing.py | '''
Created on Apr 4, 2016
@author: pab
'''
import inspect
import numpy as np
def rosen(x):
"""Rosenbrock function
This is a non-convex function used as a performance test problem for
optimization algorithms introduced by Howard H. Rosenbrock in 1960.[1]
"""
x = np.atleast_1d(x)
return (1 - x[0])**2 + 105. * (x[1] - x[0]**2)**2
def test_docstrings():
# np.set_printoptions(precision=6)
import doctest
print('Testing docstrings in %s' % inspect.stack()[1][1])
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)
| '''
Created on Apr 4, 2016
@author: pab
'''
import inspect
import numpy as np
def rosen(x):
"""Rosenbrock function
This is a non-convex function used as a performance test problem for
optimization algorithms introduced by Howard H. Rosenbrock in 1960.[1]
"""
x = np.atleast_1d(x)
return (1 - x[0])**2 + 105. * (x[1] - x[0]**2)**2
def test_docstrings():
# np.set_printoptions(precision=6)
import doctest
print('Testing docstrings in {}'.format(inspect.stack()[1][1]))
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)
| Replace string interpolation with format() | Replace string interpolation with format()
| Python | bsd-3-clause | pbrod/numdifftools,pbrod/numdifftools | ---
+++
@@ -20,5 +20,5 @@
def test_docstrings():
# np.set_printoptions(precision=6)
import doctest
- print('Testing docstrings in %s' % inspect.stack()[1][1])
+ print('Testing docstrings in {}'.format(inspect.stack()[1][1]))
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS) |
f4d1cebe889e4c55bab104f9a2c993c8ed153d34 | ubitflashtool/__main__.py | ubitflashtool/__main__.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
from ubitflashtool.cli import main
from ubitflashtool.gui import open_editor
if __name__ == "__main__":
if len(sys.argv) > 1 and (sys.argv[1] == '-g' or sys.argv[1] == '--gui'):
open_editor()
else:
main(sys.argv[1:])
| #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
from ubitflashtool.cli import main as cli_main
from ubitflashtool.gui import open_editor
def main():
if len(sys.argv) > 1 and (sys.argv[1] == '-g' or sys.argv[1] == '--gui'):
open_editor()
else:
cli_main(sys.argv[1:])
if __name__ == "__main__":
main()
| Fix command line entry point | Fix command line entry point
| Python | mit | carlosperate/ubitflashtool | ---
+++
@@ -1,12 +1,14 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
-from ubitflashtool.cli import main
+from ubitflashtool.cli import main as cli_main
from ubitflashtool.gui import open_editor
-
-if __name__ == "__main__":
+def main():
if len(sys.argv) > 1 and (sys.argv[1] == '-g' or sys.argv[1] == '--gui'):
open_editor()
else:
- main(sys.argv[1:])
+ cli_main(sys.argv[1:])
+
+if __name__ == "__main__":
+ main() |
aafb16a0f96f31a5371ae19bfc1dfc38cc2bb878 | romanesco/executors/python.py | romanesco/executors/python.py | import imp
import json
import sys
def run(task, inputs, outputs, task_inputs, task_outputs, **kwargs):
custom = imp.new_module("custom")
for name in inputs:
custom.__dict__[name] = inputs[name]["script_data"]
custom.__dict__['_job_manager'] = kwargs.get('_job_manager')
try:
exec task["script"] in custom.__dict__
except Exception, e:
trace = sys.exc_info()[2]
lines = task["script"].split("\n")
lines = [(str(i+1) + ": " + lines[i]) for i in xrange(len(lines))]
error = (
str(e) + "\nScript:\n" + "\n".join(lines) +
"\nTask:\n" + json.dumps(task, indent=4)
)
raise Exception(error), None, trace
for name, task_output in task_outputs.iteritems():
outputs[name]["script_data"] = custom.__dict__[name]
| import imp
import json
import sys
def run(task, inputs, outputs, task_inputs, task_outputs, **kwargs):
custom = imp.new_module("custom")
custom.__dict__['_job_manager'] = kwargs.get('_job_manager')
for name in inputs:
custom.__dict__[name] = inputs[name]["script_data"]
try:
exec task["script"] in custom.__dict__
except Exception, e:
trace = sys.exc_info()[2]
lines = task["script"].split("\n")
lines = [(str(i+1) + ": " + lines[i]) for i in xrange(len(lines))]
error = (
str(e) + "\nScript:\n" + "\n".join(lines) +
"\nTask:\n" + json.dumps(task, indent=4)
)
raise Exception(error), None, trace
for name, task_output in task_outputs.iteritems():
outputs[name]["script_data"] = custom.__dict__[name]
| Allow _job_manager special object to be overriden by task if desired | Allow _job_manager special object to be overriden by task if desired
| Python | apache-2.0 | Kitware/romanesco,girder/girder_worker,girder/girder_worker,Kitware/romanesco,Kitware/romanesco,Kitware/romanesco,girder/girder_worker | ---
+++
@@ -6,10 +6,10 @@
def run(task, inputs, outputs, task_inputs, task_outputs, **kwargs):
custom = imp.new_module("custom")
+ custom.__dict__['_job_manager'] = kwargs.get('_job_manager')
+
for name in inputs:
custom.__dict__[name] = inputs[name]["script_data"]
-
- custom.__dict__['_job_manager'] = kwargs.get('_job_manager')
try:
exec task["script"] in custom.__dict__ |
5101a6626f26ff62ea9e3159aad98bc19b680500 | core/urls.py | core/urls.py | from django.conf.urls import url
import core.views
urlpatterns = [
url(r'^u/(?P<slug>[\w-]+)/$', core.views.run_fn, name="run_fn"),
]
| from django.conf.urls import url
import core.views
urlpatterns = [
url(r'^u/(?P<slug>[\w-\.]+)/?$', core.views.run_fn, name="run_fn"),
]
| Handle period in url slugs | Handle period in url slugs
| Python | mit | theju/urlscript | ---
+++
@@ -3,5 +3,5 @@
import core.views
urlpatterns = [
- url(r'^u/(?P<slug>[\w-]+)/$', core.views.run_fn, name="run_fn"),
+ url(r'^u/(?P<slug>[\w-\.]+)/?$', core.views.run_fn, name="run_fn"),
] |
caf6514b6af278583d9816b722fab9456d0ad9f1 | pelicanconf.py | pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'DLR'
SITENAME = u'RCE'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'Europe/Paris'
DEFAULT_LANG = u'en'
DEFAULT_DATE_FORMAT = '%a %d %B %Y'
THEME = 'themes/polar'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None
# Blogroll
LINKS = (('Simulation and Software Technology', 'https://www.dlr.de/sc'),
('Imprint', '/pages/imprint.html'),
('Privacy', '/pages/privacy.html'),)
# Social widget
SOCIAL = (('Twitter', 'https://twitter.com/RCEnvironment'),
('YouTube', 'https://www.youtube.com/user/rcenvironment'),)
DEFAULT_PAGINATION = 10
# Uncomment following line if you want document-relative URLs when developing
#RELATIVE_URLS = True
# Static paths
STATIC_PATHS = ['images', 'pages/images', 'extra/CNAME']
# Plugins
PLUGIN_PATHS = ["plugins", "d:\\rce\\plugins"]
PLUGINS = ['pelican-page-hierarchy.page_hierarchy',]
# Github pages domain name
EXTRA_PATH_METADATA = {'extra/CNAME': {'path': 'CNAME'},} | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'DLR'
SITENAME = u'RCE'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'Europe/Paris'
DEFAULT_LANG = u'en'
DEFAULT_DATE_FORMAT = '%a %d %B %Y'
THEME = 'themes/polar'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None
# Blogroll
LINKS = (('Institute for Software Technology', 'https://www.dlr.de/sc'),
('Imprint', '/pages/imprint.html'),
('Privacy', '/pages/privacy.html'),)
# Social widget
SOCIAL = (('Twitter', 'https://twitter.com/RCEnvironment'),
('YouTube', 'https://www.youtube.com/user/rcenvironment'),)
DEFAULT_PAGINATION = 10
# Uncomment following line if you want document-relative URLs when developing
#RELATIVE_URLS = True
# Static paths
STATIC_PATHS = ['images', 'pages/images', 'extra/CNAME']
# Plugins
PLUGIN_PATHS = ["plugins", "d:\\rce\\plugins"]
PLUGINS = ['pelican-page-hierarchy.page_hierarchy',]
# Github pages domain name
EXTRA_PATH_METADATA = {'extra/CNAME': {'path': 'CNAME'},} | Update link to institute in footer to say "Institute for Software Technology" | Update link to institute in footer to say "Institute for Software Technology" | Python | cc0-1.0 | DLR-SC/rce-website,DLR-SC/rce-website,DLR-SC/rce-website,DLR-SC/rce-website,DLR-SC/rce-website | ---
+++
@@ -25,7 +25,7 @@
AUTHOR_FEED_RSS = None
# Blogroll
-LINKS = (('Simulation and Software Technology', 'https://www.dlr.de/sc'),
+LINKS = (('Institute for Software Technology', 'https://www.dlr.de/sc'),
('Imprint', '/pages/imprint.html'),
('Privacy', '/pages/privacy.html'),)
|
4511fef9b2c6521197dc64963c58c1a77e3475b3 | counterid.py | counterid.py | #!/usr/bin/env python
"""counterid - Simple utility to discover perfmon counter paths"""
# Compile to EXE using c:\Python27\scripts\pyinstaller.exe -F counterid.py
__author__ = 'scottv@rbh.com (Scott Vintinner)'
import win32pdh
# Will display a window with available counters. Click add to print out counter name.
def print_counter(counter):
print counter
win32pdh.BrowseCounters(None, 0, print_counter, win32pdh.PERF_DETAIL_WIZARD, "Counter List") | #!/usr/bin/env python
"""counterid - Simple utility to discover perfmon counter paths"""
# pip install pyinstaller
# Compile to EXE using pyinstaller.exe -F counterid.py
__author__ = 'scottv@rbh.com (Scott Vintinner)'
import win32pdh
# Will display a window with available counters. Click add to print out counter name.
def print_counter(counter):
print(counter)
win32pdh.BrowseCounters(None, 0, print_counter, win32pdh.PERF_DETAIL_WIZARD, "Counter List") | Update to make compatible with Python 3 | Update to make compatible with Python 3
| Python | mit | flakshack/pyPerfmon | ---
+++
@@ -1,6 +1,7 @@
#!/usr/bin/env python
"""counterid - Simple utility to discover perfmon counter paths"""
-# Compile to EXE using c:\Python27\scripts\pyinstaller.exe -F counterid.py
+# pip install pyinstaller
+# Compile to EXE using pyinstaller.exe -F counterid.py
__author__ = 'scottv@rbh.com (Scott Vintinner)'
import win32pdh
@@ -8,6 +9,7 @@
# Will display a window with available counters. Click add to print out counter name.
def print_counter(counter):
- print counter
+ print(counter)
+
win32pdh.BrowseCounters(None, 0, print_counter, win32pdh.PERF_DETAIL_WIZARD, "Counter List") |
828be5ee4640ddd9ee595b4ba15fa973ccbcb82f | account_fiscal_position_no_source_tax/account.py | account_fiscal_position_no_source_tax/account.py | from openerp import models, api, fields
class account_fiscal_position(models.Model):
_inherit = 'account.fiscal.position'
@api.v8 # noqa
def map_tax(self, taxes):
result = super(account_fiscal_position, self).map_tax(taxes)
taxes_without_src_ids = [
x.tax_dest_id.id for x in self.tax_ids if not x.tax_src_id]
result += result.browse(taxes_without_src_ids)
return result
class account_fiscal_position_tax(models.Model):
_inherit = 'account.fiscal.position.tax'
tax_src_id = fields.Many2one(required=False)
| from openerp import models, api, fields
class account_fiscal_position(models.Model):
_inherit = 'account.fiscal.position'
@api.v7
def map_tax(self, cr, uid, fposition_id, taxes, context=None):
result = super(account_fiscal_position, self).map_tax(
cr, uid, fposition_id, taxes, context=context)
taxes_without_src_ids = [
x.tax_dest_id.id for x in fposition_id.tax_ids if not x.tax_src_id]
result = set(result) | set(taxes_without_src_ids)
return list(result)
@api.v8 # noqa
def map_tax(self, taxes):
result = super(account_fiscal_position, self).map_tax(taxes)
taxes_without_src_ids = [
x.tax_dest_id.id for x in self.tax_ids if not x.tax_src_id]
result += result.browse(taxes_without_src_ids)
return result
class account_fiscal_position_tax(models.Model):
_inherit = 'account.fiscal.position.tax'
tax_src_id = fields.Many2one(required=False)
| FIX fiscal position no source tax on v7 api | FIX fiscal position no source tax on v7 api
| Python | agpl-3.0 | ingadhoc/partner,ingadhoc/odoo-addons,maljac/odoo-addons,bmya/odoo-addons,levkar/odoo-addons,ingadhoc/odoo-addons,ingadhoc/sale,levkar/odoo-addons,ingadhoc/account-financial-tools,sysadminmatmoz/ingadhoc,ClearCorp/account-financial-tools,HBEE/odoo-addons,jorsea/odoo-addons,sysadminmatmoz/ingadhoc,adhoc-dev/odoo-addons,jorsea/odoo-addons,ingadhoc/sale,adhoc-dev/odoo-addons,dvitme/odoo-addons,bmya/odoo-addons,ingadhoc/odoo-addons,adhoc-dev/account-financial-tools,jorsea/odoo-addons,dvitme/odoo-addons,ingadhoc/account-payment,ClearCorp/account-financial-tools,syci/ingadhoc-odoo-addons,levkar/odoo-addons,ingadhoc/account-invoicing,HBEE/odoo-addons,maljac/odoo-addons,maljac/odoo-addons,adhoc-dev/odoo-addons,bmya/odoo-addons,syci/ingadhoc-odoo-addons,ingadhoc/product,ingadhoc/product,sysadminmatmoz/ingadhoc,ingadhoc/sale,ingadhoc/sale,dvitme/odoo-addons,ingadhoc/stock,ingadhoc/account-analytic,syci/ingadhoc-odoo-addons,levkar/odoo-addons,adhoc-dev/account-financial-tools,HBEE/odoo-addons | ---
+++
@@ -4,6 +4,15 @@
class account_fiscal_position(models.Model):
_inherit = 'account.fiscal.position'
+
+ @api.v7
+ def map_tax(self, cr, uid, fposition_id, taxes, context=None):
+ result = super(account_fiscal_position, self).map_tax(
+ cr, uid, fposition_id, taxes, context=context)
+ taxes_without_src_ids = [
+ x.tax_dest_id.id for x in fposition_id.tax_ids if not x.tax_src_id]
+ result = set(result) | set(taxes_without_src_ids)
+ return list(result)
@api.v8 # noqa
def map_tax(self, taxes): |
6a0ab2b681b4a9ce9392687b6b7d9e1d14015147 | nustack/doc/genall.py | nustack/doc/genall.py | #!python3
import os, glob, sys
import nustack
import nustack.doc.gen as gen
exportdir = sys.argv[1]
# Get module names
path = os.path.join(os.path.dirname(nustack.__file__), "stdlib")
print("Path to standard library:", path)
os.chdir(path)
modnames = (f[:-3] for f in glob.iglob("*.py") if f != '__init__.py')
for mod in modnames:
print("Generating docs for %s..." % mod)
gen.gendoc("nustack.stdlib.%s" % mod, os.path.join(exportdir, mod + ".md"))
print("Done!")
| #!python3
import os, glob, sys
import nustack
import gen
exportdir = sys.argv[1]
# Get module names
path = os.path.join(nustack.__path__[0], "stdlib")
print("Path to standard library:", path)
os.chdir(path)
modnames = (f[:-3] for f in glob.iglob("*.py") if f != '__init__.py')
for mod in modnames:
print("Generating docs for %s..." % mod)
gen.gendoc("nustack.stdlib.%s" % mod, os.path.join(exportdir, mod + ".md"))
print("Done!")
| Update documentation generator for new directory structure. | Update documentation generator for new directory structure.
| Python | mit | BookOwl/nustack | ---
+++
@@ -1,12 +1,12 @@
#!python3
import os, glob, sys
import nustack
-import nustack.doc.gen as gen
+import gen
exportdir = sys.argv[1]
# Get module names
-path = os.path.join(os.path.dirname(nustack.__file__), "stdlib")
+path = os.path.join(nustack.__path__[0], "stdlib")
print("Path to standard library:", path)
os.chdir(path)
modnames = (f[:-3] for f in glob.iglob("*.py") if f != '__init__.py') |
8760fa44a7acb8d79ed177349d8c148c0682a2ab | pybossa/auth/category.py | pybossa/auth/category.py | from flask.ext.login import current_user
def create(app=None):
if current_user.is_authenticated():
if current_user.admin is True:
return True
else:
return False
else:
return False
def read(app=None):
return True
def update(app):
return create(app)
def delete(app):
return create(app)
| from flask.ext.login import current_user
def create(category=None):
if current_user.is_authenticated():
if current_user.admin is True:
return True
else:
return False
else:
return False
def read(category=None):
return True
def update(category):
return create(category)
def delete(category):
return create(category)
| Fix a typo in the variable name | Fix a typo in the variable name
| Python | agpl-3.0 | geotagx/geotagx-pybossa-archive,Scifabric/pybossa,proyectos-analizo-info/pybossa-analizo-info,geotagx/geotagx-pybossa-archive,CulturePlex/pybossa,geotagx/pybossa,proyectos-analizo-info/pybossa-analizo-info,jean/pybossa,harihpr/tweetclickers,CulturePlex/pybossa,geotagx/pybossa,harihpr/tweetclickers,stefanhahmann/pybossa,geotagx/geotagx-pybossa-archive,Scifabric/pybossa,proyectos-analizo-info/pybossa-analizo-info,PyBossa/pybossa,CulturePlex/pybossa,geotagx/geotagx-pybossa-archive,PyBossa/pybossa,stefanhahmann/pybossa,jean/pybossa,inteligencia-coletiva-lsd/pybossa,OpenNewsLabs/pybossa,OpenNewsLabs/pybossa,inteligencia-coletiva-lsd/pybossa,geotagx/geotagx-pybossa-archive | ---
+++
@@ -1,7 +1,7 @@
from flask.ext.login import current_user
-def create(app=None):
+def create(category=None):
if current_user.is_authenticated():
if current_user.admin is True:
return True
@@ -11,13 +11,13 @@
return False
-def read(app=None):
+def read(category=None):
return True
-def update(app):
- return create(app)
+def update(category):
+ return create(category)
-def delete(app):
- return create(app)
+def delete(category):
+ return create(category) |
0381f2b72f495e18240eb9affc382905303a5ad9 | CurveAnalysis/fft_norm.py | CurveAnalysis/fft_norm.py | #!/usr/bin/env python
import numpy as np
import sys
import scipy.io as sio
import os
import operator
base_dir = '/data/amnh/darwin/'
curves_fft_dir = base_dir + 'image_csvs_fft/'
fft_norm_map = {}
def compute_fft_norm(curve_filename):
curve_name = curves_fft_dir + curve_filename
fft_array = sio.loadmat(curve_name)['fft']
# zero out scaling and rotation components
fft_array[0][0] = 0
fft_norm = np.linalg.norm(fft_array)
return fft_norm
def stringify(x):
float_score = '%.20f' % x[1]
return x[0] + '\t' + float_score
input_files = os.listdir(curves_fft_dir)
fft_norm_filename = base_dir + 'fft_norms.csv'
for curve_filename in input_files:
norm_value = compute_fft_norm(curve_filename)
fft_norm_map[curve_filename] = norm_value
# sort by magnitude of the fft norm
final_sorted_results = sorted(fft_norm_map.items(), key=operator.itemgetter(1), reverse=True)[:100]
fft_sim_file = open(fft_norm_filename, 'w')
stringified_results = [stringify(x) for x in final_sorted_results]
fft_sim_file.write('\n'.join(stringified_results))
fft_sim_file.close()
| #!/usr/bin/env python
import numpy as np
import sys
import scipy.io as sio
import os
import operator
base_dir = '/data/amnh/darwin/'
curves_fft_dir = base_dir + 'image_csvs_fft/'
fft_norm_map = {}
def compute_fft_norm(curve_filename):
curve_name = curves_fft_dir + curve_filename
fft_array = sio.loadmat(curve_name)['fft']
# zero out scaling and rotation components
fft_array[0][0] = 0
fft_norm = np.linalg.norm(fft_array)
return fft_norm
def stringify(x):
float_score = '%.20f' % x[1]
return x[0] + '\t' + float_score
input_files = os.listdir(curves_fft_dir)
fft_norm_filename = base_dir + 'fft_norms.csv'
for curve_filename in input_files:
norm_value = compute_fft_norm(curve_filename)
fft_norm_map[curve_filename] = norm_value
# sort by magnitude of the fft norm
final_sorted_results = sorted(fft_norm_map.items(), key=operator.itemgetter(1), reverse=True)
fft_sim_file = open(fft_norm_filename, 'w')
stringified_results = [stringify(x) for x in final_sorted_results]
fft_sim_file.write('\n'.join(stringified_results))
fft_sim_file.close()
| Remove the limitation to the top 100 items. | Remove the limitation to the top 100 items.
| Python | apache-2.0 | HackTheStacks/darwin-notes-image-processing,HackTheStacks/darwin-notes-image-processing | ---
+++
@@ -30,7 +30,7 @@
fft_norm_map[curve_filename] = norm_value
# sort by magnitude of the fft norm
-final_sorted_results = sorted(fft_norm_map.items(), key=operator.itemgetter(1), reverse=True)[:100]
+final_sorted_results = sorted(fft_norm_map.items(), key=operator.itemgetter(1), reverse=True)
fft_sim_file = open(fft_norm_filename, 'w')
stringified_results = [stringify(x) for x in final_sorted_results]
fft_sim_file.write('\n'.join(stringified_results)) |
244a51de04410335309446bb9a051338ea6d2a6a | pycnic/data.py | pycnic/data.py | STATUSES = {
200: "200 OK",
201: "201 Created",
202: "202 Accepted",
300: "300 Multiple Choices",
301: "301 Moved Permanently",
302: "302 Found",
304: "304 Not Modified",
400: "400 Bad Request",
401: "401 Unauthorized",
403: "403 Forbidden",
404: "404 Not Found",
405: "405 Method Not Allowed",
408: "408 Request Timeout",
500: "500 Internal Server Error",
501: "501 Not Implemented",
577: "577 Unknown Status",
}
| STATUSES = {
200: "200 OK",
201: "201 Created",
202: "202 Accepted",
204: "204 No Content",
300: "300 Multiple Choices",
301: "301 Moved Permanently",
302: "302 Found",
303: "303 See Other",
304: "304 Not Modified",
307: "307 Temporary Redirect",
308: "308 Permanent Redirect",
400: "400 Bad Request",
401: "401 Unauthorized",
402: "402 Payment Required",
403: "403 Forbidden",
404: "404 Not Found",
405: "405 Method Not Allowed",
406: "406 Not Acceptable",
408: "408 Request Timeout",
409: "409 Conflict",
410: "410 Gone",
411: "411 Length Required",
412: "412 Precondition Failed",
413: "413 Payload Too Large",
414: "414 URI Too Long",
415: "415 Unsupported Media Type",
417: "417 Expectation Failed",
422: "422 Unprocessable Entity",
428: "428 Precondition Required",
429: "429 Too Many Requests",
431: "431 Request Header Fields Too Large",
500: "500 Internal Server Error",
501: "501 Not Implemented",
502: "502 Bad Gateway",
503: "503 Service Unavailable",
504: "504 Gateway Timeout",
577: "577 Unknown Status",
}
| Add more HTTP/1.1 status codes | Add more HTTP/1.1 status codes
| Python | mit | nullism/pycnic,nullism/pycnic | ---
+++
@@ -2,18 +2,39 @@
200: "200 OK",
201: "201 Created",
202: "202 Accepted",
+ 204: "204 No Content",
300: "300 Multiple Choices",
301: "301 Moved Permanently",
302: "302 Found",
+ 303: "303 See Other",
304: "304 Not Modified",
+ 307: "307 Temporary Redirect",
+ 308: "308 Permanent Redirect",
400: "400 Bad Request",
401: "401 Unauthorized",
+ 402: "402 Payment Required",
403: "403 Forbidden",
404: "404 Not Found",
405: "405 Method Not Allowed",
+ 406: "406 Not Acceptable",
408: "408 Request Timeout",
+ 409: "409 Conflict",
+ 410: "410 Gone",
+ 411: "411 Length Required",
+ 412: "412 Precondition Failed",
+ 413: "413 Payload Too Large",
+ 414: "414 URI Too Long",
+ 415: "415 Unsupported Media Type",
+ 417: "417 Expectation Failed",
+ 422: "422 Unprocessable Entity",
+ 428: "428 Precondition Required",
+ 429: "429 Too Many Requests",
+ 431: "431 Request Header Fields Too Large",
500: "500 Internal Server Error",
501: "501 Not Implemented",
+ 502: "502 Bad Gateway",
+ 503: "503 Service Unavailable",
+ 504: "504 Gateway Timeout",
577: "577 Unknown Status",
}
|
783ce62c7dd6b553c37c984113a0964fa1837e76 | whats_fresh/settings.py | whats_fresh/settings.py | # flake8: noqa
# This module is how we import settings, and override settings with various
# precedences.
# First our base.py settings module is imported, with all of the
# important defaults.
#
# Next our yaml file is opened, read, and settings defined in the yaml config
# may override settings already defined.
import os
from .base import *
if os.environ['ENVIRONMENTCONFIG']:
from whats_fresh.environment_config import *
else:
from .yaml_config import *
| # flake8: noqa
# This module is how we import settings, and override settings with various
# precedences.
# First our base.py settings module is imported, with all of the
# important defaults.
#
# Next our yaml file is opened, read, and settings defined in the yaml config
# may override settings already defined.
import os
from .base import *
if os.environ.get('ENVIRONMENTCONFIG'):
from whats_fresh.environment_config import *
else:
from .yaml_config import *
| Use dict.get not dict[] to fail gracefully | Use dict.get not dict[] to fail gracefully
| Python | apache-2.0 | osu-cass/whats-fresh-api,osu-cass/whats-fresh-api,osu-cass/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,iCHAIT/whats-fresh-api,iCHAIT/whats-fresh-api,iCHAIT/whats-fresh-api | ---
+++
@@ -12,7 +12,7 @@
from .base import *
-if os.environ['ENVIRONMENTCONFIG']:
+if os.environ.get('ENVIRONMENTCONFIG'):
from whats_fresh.environment_config import *
else:
from .yaml_config import * |
a350fb8264c9691a1a1711e1c786fb967e6aaf0b | updateable/middleware.py | updateable/middleware.py | # -*- coding: utf-8 -*-
from django.http import HttpResponse
from updateable import settings
class UpdateableMiddleware(object):
def process_request(self, request):
updateable = bool(request.GET.get(settings.UPDATEABLE_GET_VARIABLE))
hashvals = {}
if updateable:
ids = request.GET.getlist('ids[]')
hashes = request.GET.getlist('hash[]')
for id, hash in zip(ids, hashes):
hashvals[id] = hash
updateable_dict = {
'updateable': updateable,
'hashes': hashvals,
'contents': [],
}
setattr(request, settings.UPDATEABLE_REQUEST_OBJECT, updateable_dict)
def process_response(self, request, response):
updateable_dict = getattr(request, settings.UPDATEABLE_REQUEST_OBJECT)
if updateable_dict['updateable']:
contents = updateable_dict['contents']
content = ''.join(contents)
response['Content-length'] = str(len(content))
if getattr(response, 'streaming', False):
response.streaming_response = (content,)
else:
response.content = content
return response
| # -*- coding: utf-8 -*-
from django.http import HttpResponse
from updateable import settings
class UpdateableMiddleware(object):
def process_request(self, request):
updateable = bool(request.GET.get(settings.UPDATEABLE_GET_VARIABLE))
hashvals = {}
if updateable:
ids = request.GET.getlist('ids[]')
hashes = request.GET.getlist('hash[]')
for id, hash in zip(ids, hashes):
hashvals[id] = hash
updateable_dict = {
'updateable': updateable,
'hashes': hashvals,
'contents': [],
}
setattr(request, settings.UPDATEABLE_REQUEST_OBJECT, updateable_dict)
def process_response(self, request, response):
updateable_dict = getattr(request, settings.UPDATEABLE_REQUEST_OBJECT)
if updateable_dict['updateable']:
contents = updateable_dict['contents']
content = ''.join(contents)
response['Content-length'] = str(len(content))
if getattr(response, 'streaming', False):
response.streaming_response = (content,)
else:
response.content = content
response['Cache-control'] = 'no-cache' # Preventing IE bug
return response
| Fix for AJAX cache bug in IE | Fix for AJAX cache bug in IE
| Python | bsd-3-clause | baldurthoremilsson/django-updateable,baldurthoremilsson/django-updateable | ---
+++
@@ -31,5 +31,6 @@
response.streaming_response = (content,)
else:
response.content = content
+ response['Cache-control'] = 'no-cache' # Preventing IE bug
return response
|
cc80be915b6912056990bf71324826e244432533 | docs/conf.py | docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import setuptools_scm
extensions = [
'sphinx.ext.autodoc',
'rst.linker',
]
# General information about the project.
project = 'skeleton'
copyright = '2016 Jason R. Coombs'
# The short X.Y version.
version = setuptools_scm.get_version(root='..', relative_to=__file__)
# The full version, including alpha/beta/rc tags.
release = version
master_doc = 'index'
link_files = {
'CHANGES.rst': dict(
using=dict(
GH='https://github.com',
project=project,
),
replace=[
dict(
pattern=r"(Issue )?#(?P<issue>\d+)",
url='{GH}/jaraco/{project}/issues/{issue}',
),
dict(
pattern=r"^(?m)((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n",
with_scm="{text}\n{rev[timestamp]:%d %b %Y}\n",
),
],
),
}
| #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pkg_resources
extensions = [
'sphinx.ext.autodoc',
'rst.linker',
]
# General information about the project.
project = 'skeleton'
copyright = '2016 Jason R. Coombs'
# The short X.Y version.
version = pkg_resources.require(project)[0].version
# The full version, including alpha/beta/rc tags.
release = version
master_doc = 'index'
link_files = {
'CHANGES.rst': dict(
using=dict(
GH='https://github.com',
project=project,
),
replace=[
dict(
pattern=r"(Issue )?#(?P<issue>\d+)",
url='{GH}/jaraco/{project}/issues/{issue}',
),
dict(
pattern=r"^(?m)((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n",
with_scm="{text}\n{rev[timestamp]:%d %b %Y}\n",
),
],
),
}
| Use pkg_resources to resolve the version. Requires that the necessary package metadata have been built before building docs. | Use pkg_resources to resolve the version. Requires that the necessary package metadata have been built before building docs.
| Python | mit | jaraco/jaraco.path,jaraco/zipp,jaraco/jaraco.functools,jaraco/jaraco.collections,jaraco/backports.functools_lru_cache,jaraco/portend,yougov/mettle,jazzband/inflect,jaraco/jaraco.context,yougov/mettle,jaraco/rwt,yougov/mettle,pytest-dev/pytest-runner,hugovk/inflect.py,jaraco/keyring,cherrypy/magicbus,yougov/mettle,python/importlib_metadata,jaraco/jaraco.logging,jaraco/hgtools,jaraco/jaraco.text,yougov/pmxbot,jaraco/irc,yougov/librarypaste,yougov/pmxbot,yougov/pmxbot,yougov/librarypaste,jaraco/calendra,jaraco/jaraco.classes,cherrypy/cheroot,pwdyson/inflect.py,jaraco/jaraco.itertools,jaraco/tempora,jaraco/jaraco.stream | ---
+++
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
-import setuptools_scm
+import pkg_resources
extensions = [
'sphinx.ext.autodoc',
@@ -13,7 +13,7 @@
copyright = '2016 Jason R. Coombs'
# The short X.Y version.
-version = setuptools_scm.get_version(root='..', relative_to=__file__)
+version = pkg_resources.require(project)[0].version
# The full version, including alpha/beta/rc tags.
release = version
|
ce380319562eb94e252c74de7b6b1ac18a357466 | chainer/training/extensions/value_observation.py | chainer/training/extensions/value_observation.py | import time
from chainer.training import extension
def observe_value(key, target_func):
"""Returns a trainer extension to continuously record a value.
Args:
key (str): Key of observation to record.
target_func (function): Function that returns the value to record.
It must take one argument: trainer object.
Returns:
The extension function.
"""
@extension.make_extension(
trigger=(1, 'epoch'), priority=extension.PRIORITY_WRITER)
def _observe_value(trainer):
trainer.observation[key] = target_func(trainer)
return _observe_value
def observe_time(key='time'):
"""Returns a trainer extension to record the elapsed time.
Args:
key (str): Key of observation to record.
Returns:
The extension function.
"""
start_time = time.time()
return observe_value(key, lambda _: time.time() - start_time)
def observe_lr(optimizer, key='lr'):
"""Returns a trainer extension to record the learning rate.
Args:
optimizer: Optimizer object whose learning rate is recorded.
key (str): Key of observation to record.
Returns:
The extension function.
"""
return observe_value(key, lambda _: optimizer.lr)
| import time
from chainer.training import extension
def observe_value(key, target_func):
"""Returns a trainer extension to continuously record a value.
Args:
key (str): Key of observation to record.
target_func (function): Function that returns the value to record.
It must take one argument: :class:~chainer.training.Trainer object.
Returns:
The extension function.
"""
@extension.make_extension(
trigger=(1, 'epoch'), priority=extension.PRIORITY_WRITER)
def _observe_value(trainer):
trainer.observation[key] = target_func(trainer)
return _observe_value
def observe_time(key='time'):
"""Returns a trainer extension to record the elapsed time.
Args:
key (str): Key of observation to record.
Returns:
The extension function.
"""
start_time = time.time()
return observe_value(key, lambda _: time.time() - start_time)
def observe_lr(optimizer, key='lr'):
"""Returns a trainer extension to record the learning rate.
Args:
optimizer (~chainer.Optimizer): Optimizer object whose learning rate is recorded.
key (str): Key of observation to record.
Returns:
The extension function.
"""
return observe_value(key, lambda _: optimizer.lr)
| Add links for the document | Add links for the document
| Python | mit | ktnyt/chainer,hvy/chainer,aonotas/chainer,niboshi/chainer,okuta/chainer,chainer/chainer,anaruse/chainer,niboshi/chainer,ronekko/chainer,okuta/chainer,jnishi/chainer,wkentaro/chainer,cupy/cupy,chainer/chainer,okuta/chainer,wkentaro/chainer,jnishi/chainer,delta2323/chainer,rezoo/chainer,hvy/chainer,hvy/chainer,jnishi/chainer,pfnet/chainer,niboshi/chainer,keisuke-umezawa/chainer,tkerola/chainer,jnishi/chainer,chainer/chainer,cupy/cupy,keisuke-umezawa/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,ktnyt/chainer,okuta/chainer,ysekky/chainer,wkentaro/chainer,cupy/cupy,wkentaro/chainer,chainer/chainer,niboshi/chainer,kiyukuta/chainer,ktnyt/chainer,cupy/cupy,ktnyt/chainer,kashif/chainer,hvy/chainer | ---
+++
@@ -9,7 +9,7 @@
Args:
key (str): Key of observation to record.
target_func (function): Function that returns the value to record.
- It must take one argument: trainer object.
+ It must take one argument: :class:~chainer.training.Trainer object.
Returns:
The extension function.
"""
@@ -37,7 +37,7 @@
"""Returns a trainer extension to record the learning rate.
Args:
- optimizer: Optimizer object whose learning rate is recorded.
+ optimizer (~chainer.Optimizer): Optimizer object whose learning rate is recorded.
key (str): Key of observation to record.
Returns: |
2b6fcb362a6dbf875075af13787bba76928098c3 | kinoreel_backend/urls.py | kinoreel_backend/urls.py | from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth.views import login
from movies.urls import urlpatterns as movie_urls
urlpatterns = [
url(r'^', movie_urls, name='movies'),
url(r'^admin/', admin.site.urls),
]
| from django.conf.urls import include, url
from django.contrib import admin
from movies.urls import urlpatterns as movie_urls
urlpatterns = [
url(r'^', include(movie_urls), name='movies'),
url(r'^admin/', admin.site.urls),
]
| Include is still needed for the url patterns | Include is still needed for the url patterns
| Python | mit | kinoreel/kinoreel-backend,kinoreel/kinoreel-backend | ---
+++
@@ -1,10 +1,9 @@
from django.conf.urls import include, url
from django.contrib import admin
-from django.contrib.auth.views import login
from movies.urls import urlpatterns as movie_urls
urlpatterns = [
- url(r'^', movie_urls, name='movies'),
+ url(r'^', include(movie_urls), name='movies'),
url(r'^admin/', admin.site.urls),
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.