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 |
|---|---|---|---|---|---|---|---|---|---|---|
462656f9653ae43ea69080414735927b18e0debf | stats/random_walk.py | stats/random_walk.py | import neo4j
import random
from logbook import Logger
log = Logger('trinity.topics')
DEFAULT_DEPTH = 5
NUM_WALKS = 100
# Passed sorted list (desc order), return top nodes
TO_RETURN = lambda x: x[:10]
random.seed()
def random_walk(graph, node, depth=DEFAULT_DEPTH):
# Pick random neighbor
neighbors = {}
i... | import neo4j
import random
DEFAULT_DEPTH = 5
NUM_WALKS = 100
# Passed sorted list (desc order), return top nodes
TO_RETURN = lambda x: x[:10]
random.seed()
def random_walk(graph, node, depth=DEFAULT_DEPTH):
if depth == 0:
return [node]
# Pick random neighbor
neighbors = {}
i = 0
for r in... | Modify random walk so that it works. | Modify random walk so that it works.
| Python | mit | peplin/trinity | ---
+++
@@ -1,8 +1,5 @@
import neo4j
import random
-
-from logbook import Logger
-log = Logger('trinity.topics')
DEFAULT_DEPTH = 5
@@ -12,17 +9,22 @@
random.seed()
def random_walk(graph, node, depth=DEFAULT_DEPTH):
+ if depth == 0:
+ return [node]
+
# Pick random neighbor
neighbors = {}... |
8eed621a15dafc8b0965c59b8da2296f8193d0ca | karabo_data/tests/test_agipd_geometry.py | karabo_data/tests/test_agipd_geometry.py | import numpy as np
from karabo_data.geometry2 import AGIPD_1MGeometry
def test_snap_assemble_data():
geom = AGIPD_1MGeometry.from_quad_positions(quad_pos=[
(-525, 625),
(-550, -10),
(520, -160),
(542.5, 475),
])
snap_geom = geom.snap()
stacked_data = np.zeros((16, 512,... | import numpy as np
from karabo_data.geometry2 import AGIPD_1MGeometry
def test_snap_assemble_data():
geom = AGIPD_1MGeometry.from_quad_positions(quad_pos=[
(-525, 625),
(-550, -10),
(520, -160),
(542.5, 475),
])
snap_geom = geom.snap()
stacked_data = np.zeros((16, 512,... | Add test of reading & writing CrystFEL geometry | Add test of reading & writing CrystFEL geometry
| Python | bsd-3-clause | European-XFEL/h5tools-py | ---
+++
@@ -17,3 +17,28 @@
assert tuple(centre) == (651, 570)
assert np.isnan(img[0, 0])
assert img[50, 50] == 0
+
+def test_write_read_crystfel_file(tmpdir):
+ geom = AGIPD_1MGeometry.from_quad_positions(quad_pos=[
+ (-525, 625),
+ (-550, -10),
+ (520, -160),
+ (542.5, 4... |
2e6823676dace8b3219aeeef69ab04a2a0dd533a | rally-scenarios/plugins/sample_plugin.py | rally-scenarios/plugins/sample_plugin.py | # Copyright 2014 Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | # Copyright 2014 Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | Fix outdated link in sample plugin | Fix outdated link in sample plugin
Link in sample_plugin.py is outdated
and is changed
Change-Id: I2f3a7b59c6380e4584a8ce2a5313fe766a40a52a
Closes-Bug: #1491975
| Python | apache-2.0 | steveb/heat,pratikmallya/heat,openstack/heat,gonzolino/heat,dragorosson/heat,dims/heat,steveb/heat,cwolferh/heat-scratch,openstack/heat,takeshineshiro/heat,dragorosson/heat,noironetworks/heat,noironetworks/heat,cwolferh/heat-scratch,jasondunsmore/heat,jasondunsmore/heat,maestro-hybrid-cloud/heat,dims/heat,maestro-hybri... | ---
+++
@@ -16,7 +16,7 @@
"""Sample plugin for Heat.
For more Heat related benchmarks take a look here:
-http://github.com/stackforge/rally/blob/master/rally/benchmark/scenarios/heat/
+http://github.com/openstack/rally/tree/master/rally/plugins/openstack/scenarios/heat
About plugins: https://rally.readthedocs.... |
eb22e8931b9ffe9c82b52451a7c17943ea43625d | python-tool/script/project.py | python-tool/script/project.py | $py_copyright
def _main():
print("Hello from $project_name")
if __name__ == "__main__":
_main()
| #!/usr/bin/env python
$py_copyright
from __future__ import print_function
def _main():
print("Hello from $project_name")
if __name__ == "__main__":
_main()
| Add shebang and future import | Add shebang and future import
| Python | mit | rcook/ptool-templates,rcook/ptool-templates,rcook/ptool-templates,rcook/ptool-templates,rcook/ptool-templates,rcook/ptool-templates,rcook/ptool-templates,rcook/ptool-templates | ---
+++
@@ -1,4 +1,6 @@
+#!/usr/bin/env python
$py_copyright
+from __future__ import print_function
def _main():
print("Hello from $project_name") |
879b15779c921445ca4412d5e63319408d8e32bf | python/islp/02statlearn-ex.py | python/islp/02statlearn-ex.py | import pandas as pd
print('\nKNN\n---')
d = {'X1': [ 0, 2, 0, 0, -1, 1 ],
'X2': [ 3, 0, 1, 1, 0, 1 ],
'X3': [ 0, 0, 3, 2, 1, 1 ],
'Y': ['R', 'R', 'R', 'G', 'G', 'R']}
df = pd.DataFrame(data = d)
df = df.assign(dist = (df.X1**2 + df.X2**2 + df.X3**2)**(0.5))
df = df.sort_val... | import matplotlib.pyplot as plt
import pandas as pd
print('\nKNN\n---')
d = {'X1': [ 0, 2, 0, 0, -1, 1 ],
'X2': [ 3, 0, 1, 1, 0, 1 ],
'X3': [ 0, 0, 3, 2, 1, 1 ],
'Y': ['R', 'R', 'R', 'G', 'G', 'R']}
df = pd.DataFrame(data = d)
df = df.assign(dist = (df.X1**2 + df.X2**2 + df... | Add scatterplot matrix for college.csv. | Add scatterplot matrix for college.csv.
| Python | apache-2.0 | pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff,pdbartlett/misc-stuff | ---
+++
@@ -1,3 +1,4 @@
+import matplotlib.pyplot as plt
import pandas as pd
print('\nKNN\n---')
@@ -15,4 +16,19 @@
print('\nCollege.csv\n-----------')
df = pd.read_csv('College.csv')
-print(df)
+df.rename(columns={'Unnamed: 0': 'Name'}, inplace=True)
+df.set_index('Name', inplace=True)
+print(df.describe())
... |
35514dcb70ed5ede39299802e82fa352188f3546 | examples/nested_inline_tasksets.py | examples/nested_inline_tasksets.py | from locust import HttpUser, TaskSet, task, between
class WebsiteUser(HttpUser):
"""
Example of the ability of inline nested TaskSet classes
"""
host = "http://127.0.0.1:8089"
wait_time = between(2, 5)
class TopLevelTaskSet(TaskSet):
@task
class IndexTaskSet(TaskSet):
... | from locust import HttpUser, TaskSet, task, between
class WebsiteUser(HttpUser):
"""
Example of the ability of inline nested TaskSet classes
"""
host = "http://127.0.0.1:8089"
wait_time = between(2, 5)
@task
class TopLevelTaskSet(TaskSet):
@task
class IndexTaskSet(TaskSet)... | Use @task decorator in taskset example | Use @task decorator in taskset example
| Python | mit | mbeacom/locust,locustio/locust,mbeacom/locust,locustio/locust,mbeacom/locust,mbeacom/locust,locustio/locust,locustio/locust | ---
+++
@@ -7,7 +7,8 @@
"""
host = "http://127.0.0.1:8089"
wait_time = between(2, 5)
-
+
+ @task
class TopLevelTaskSet(TaskSet):
@task
class IndexTaskSet(TaskSet):
@@ -22,5 +23,3 @@
@task
def stats(self):
self.client.get("/stats/requests")
-
... |
8af483f6bfd0576f694b6693deacbf25a782fe5a | pyfire/logger.py | pyfire/logger.py | # -*- coding: utf-8 -*-
"""
pyfire.logger
~~~~~~~~~~~~~
Use pocoo's logbook or a simple no-op fallback
:copyright: (c) 2011 by the pyfire Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
try:
from logbook import Logger
except ImportError:
class Logger(o... | # -*- coding: utf-8 -*-
"""
pyfire.logger
~~~~~~~~~~~~~
Use pocoo's logbook or a simple no-op fallback
:copyright: (c) 2011 by the pyfire Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import warnings
import pyfire.configuration as config
try:
import lo... | Implement configuration support in logging | Implement configuration support in logging
| Python | bsd-3-clause | IgnitedAndExploded/pyfire,IgnitedAndExploded/pyfire | ---
+++
@@ -9,8 +9,28 @@
:license: BSD, see LICENSE for more details.
"""
+import warnings
+import pyfire.configuration as config
+
+
try:
- from logbook import Logger
+ import logbook
+ class Logger(logbook.Logger):
+ def __init__(self, name):
+ try:
+ level = confi... |
1a1aab7c0a107b2a02d08f13c40c515ff265b60b | tempwatcher/watch.py | tempwatcher/watch.py | import json
import requests
class TemperatureWatch(object):
thermostat_url = None
alert_high = 80
alert_low = 60
_last_response = None
def get_info(self):
r = requests.get(self.thermostat_url + '/tstat')
self._last_response = json.loads(r.text)
return r.text
def check... | import json
import requests
class TemperatureWatch(object):
thermostat_url = None
alert_high = 80
alert_low = 60
_last_response = None
def get_info(self):
r = requests.get(self.thermostat_url + '/tstat')
self._last_response = json.loads(r.text)
return r.text
def check... | Break the alert into a method so subclasses can choose how the alert is relayed. | Break the alert into a method so subclasses can choose how the alert is relayed. | Python | bsd-3-clause | adamfast/tempwatcher | ---
+++
@@ -18,10 +18,13 @@
self.get_info()
if self._last_response['temp'] > self.alert_high:
- print('Temperature max of %s exceeded. Currently %s' % (self.alert_high, self._last_response['temp']))
+ self.alert('Temperature max of %s exceeded. Currently %s' % (self.alert... |
616d33e1c69af979163231ef8e9ca9a1f6c7bdf2 | pyts/__init__.py | pyts/__init__.py | """Time series transformation and classification module for Python.
pyts is a Python package for time series transformation and classification.
It aims to make time series classification easily accessible by providing
preprocessing and utility tools, and implementations of state-of-the-art
algorithms. Most of these al... | """Time series transformation and classification module for Python.
pyts is a Python package for time series transformation and classification.
It aims to make time series classification easily accessible by providing
preprocessing and utility tools, and implementations of state-of-the-art
algorithms. Most of these al... | Update the version on master | Update the version on master
| Python | bsd-3-clause | johannfaouzi/pyts | ---
+++
@@ -7,7 +7,7 @@
several tools to perform these transformations.
"""
-__version__ = '0.8.0'
+__version__ = '0.9.dev0'
__all__ = ['approximation', 'bag_of_words', 'classification', 'decomposition',
'image', 'metrics', 'preprocessing', 'transformation', 'utils'] |
fff22f9305fd73f464a6ee9a66b676b66ef88cad | test/parseResults.py | test/parseResults.py | #!/usr/bin/env python3
import json
import sys
PREFIXES = [
["FAIL", "PASS"],
["EXPECTED FAIL", "UNEXPECTED PASS"],
]
def parse_expected_failures():
expected_failures = set()
with open("expected-failures.txt", "r") as fp:
for line in fp:
line = line.strip()
if not line... | #!/usr/bin/env python3
import ijson
import sys
PREFIXES = [
["FAIL", "PASS"],
["EXPECTED FAIL", "UNEXPECTED PASS"],
]
def parse_expected_failures():
expected_failures = set()
with open("expected-failures.txt", "r") as fp:
for line in fp:
line = line.strip()
if not lin... | Use ijson to parse the test262 results. | Use ijson to parse the test262 results.
Parsing the output all at once can cause out-of-memory errors in automated
testing.
| Python | isc | js-temporal/temporal-polyfill,js-temporal/temporal-polyfill,js-temporal/temporal-polyfill | ---
+++
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-import json
+import ijson
import sys
PREFIXES = [
@@ -25,19 +25,19 @@
def main(filename):
expected_failures = parse_expected_failures()
with open(filename, "r") as fp:
- results = json.load(fp)
+ results = ijson.items(fp, "item")
- u... |
695ee95faf0ae80f0c69bf47e881af22ab0f00cd | l10n_it_esigibilita_iva/models/account.py | l10n_it_esigibilita_iva/models/account.py | # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo import models, fields
class AccountTax(models.Model):
_inherit = 'account.tax'
payability = fields.Selection([
('I', 'Immediate payability'),
('D', 'Deferred payability'),
('S', 'Split payment'),
], string="... | # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo import models, fields
class AccountTax(models.Model):
_inherit = 'account.tax'
payability = fields.Selection([
('I', 'VAT payable immediately'),
('D', 'unrealized VAT'),
('S', 'split payments'),
], string="V... | Use correct english terms, from APPENDIX A -TECHNICAL SPECIFICATIONS | Use correct english terms, from APPENDIX A -TECHNICAL SPECIFICATIONS
| Python | agpl-3.0 | dcorio/l10n-italy,OCA/l10n-italy,OCA/l10n-italy,dcorio/l10n-italy,dcorio/l10n-italy,OCA/l10n-italy | ---
+++
@@ -6,7 +6,7 @@
_inherit = 'account.tax'
payability = fields.Selection([
- ('I', 'Immediate payability'),
- ('D', 'Deferred payability'),
- ('S', 'Split payment'),
+ ('I', 'VAT payable immediately'),
+ ('D', 'unrealized VAT'),
+ ('S', 'split payments'),
... |
628ab56107783841d1e64b11c4b82eac4806c019 | selenium_testcase/testcases/content.py | selenium_testcase/testcases/content.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from .utils import dom_contains, wait_for
class ContentTestMixin:
# Assert that the DOM contains the given text
def should_see_immediately(self, text):
self.assertTrue(dom_contains(self.browser, text))
# Repeatedly look for the giv... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from .utils import dom_contains, wait_for
class ContentTestMixin:
def should_see_immediately(self, text):
""" Assert that DOM contains the given text. """
self.assertTrue(dom_contains(self.browser, text))
@wait_for
def shou... | Add should_not_see, has_not_title, title_does_not_contain to ContentTestMixin. | Add should_not_see, has_not_title, title_does_not_contain to ContentTestMixin.
These methods cause a wait for the full duration of the @wait_for timeout when
the assertion test is successful (and the given text is missing). It will fail
fast, but success is slow. These negative information tests should be used
sparin... | Python | bsd-3-clause | nimbis/django-selenium-testcase,nimbis/django-selenium-testcase | ---
+++
@@ -7,17 +7,33 @@
class ContentTestMixin:
- # Assert that the DOM contains the given text
def should_see_immediately(self, text):
+ """ Assert that DOM contains the given text. """
self.assertTrue(dom_contains(self.browser, text))
- # Repeatedly look for the given text until ... |
e23dd39880dc849a56d5376dca318f8bcb2cd998 | discover/__init__.py | discover/__init__.py | import logging
import socket
import boto
LOG_FORMAT = '%(asctime)s [%(name)s] %(levelname)s %(message)s'
LOG_DATE = '%Y-%m-%d %I:%M:%S %p'
logging.basicConfig(format=LOG_FORMAT, datefmt=LOG_DATE, level=logging.WARN)
logger = logging.getLogger('yoda-discover')
logger.level = logging.INFO
def port_test(port, host, p... | import logging
import socket
from boto.utils import get_instance_metadata
LOG_FORMAT = '%(asctime)s [%(name)s] %(levelname)s %(message)s'
LOG_DATE = '%Y-%m-%d %I:%M:%S %p'
logging.basicConfig(format=LOG_FORMAT, datefmt=LOG_DATE, level=logging.WARN)
logger = logging.getLogger('yoda-discover')
logger.level = logging.... | Fix import error for boto.utils | Fix import error for boto.utils
| Python | mit | totem/yoda-discover | ---
+++
@@ -1,6 +1,7 @@
import logging
import socket
-import boto
+from boto.utils import get_instance_metadata
+
LOG_FORMAT = '%(asctime)s [%(name)s] %(levelname)s %(message)s'
LOG_DATE = '%Y-%m-%d %I:%M:%S %p'
@@ -32,5 +33,5 @@
proxy_host = proxy_host.lower()
if proxy_host.startswith('ec2:meta-data:... |
12aaf389356966e7f82c4a588e0ae888073da8dd | discussion/models.py | discussion/models.py | from django.contrib.auth.models import User
from django.db import models
class Discussion(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=255)
slug = models.SlugField()
def __unicode__(self):
return self.name
class Post(models.Model):
discussion = models... | from django.contrib.auth.models import User
from django.db import models
class Discussion(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=255)
slug = models.SlugField()
def __unicode__(self):
return self.name
class Post(models.Model):
discussion = models... | Remove "name" from discussion post | Remove "name" from discussion post
| Python | bsd-2-clause | incuna/django-discussion,incuna/django-discussion,lehins/lehins-discussion,lehins/lehins-discussion,lehins/lehins-discussion | ---
+++
@@ -14,7 +14,6 @@
class Post(models.Model):
discussion = models.ForeignKey(Discussion)
user = models.ForeignKey(User)
- name = models.CharField(max_length=255)
slug = models.SlugField()
body = models.TextField()
posts_file = models.FileField(upload_to='uploads/posts', |
e59f8e72996b036b7c2df8f6b1054f82d730bdf8 | tinycontent/admin.py | tinycontent/admin.py | from django.contrib import admin
from tinycontent.models import TinyContent, TinyContentFileUpload
class TinyContentAdmin(admin.ModelAdmin):
list_display = ('name', )
search_fields = ('name', 'content', )
admin.site.register(TinyContent, TinyContentAdmin)
class TinyContentFileUploadAdmin(admin.ModelAdmin):... | from django.contrib import admin
from tinycontent.models import TinyContent, TinyContentFileUpload
class TinyContentAdmin(admin.ModelAdmin):
list_display = ('name', )
search_fields = ('name', 'content', )
admin.site.register(TinyContent, TinyContentAdmin)
class TinyContentFileUploadAdmin(admin.ModelAdmin):... | Make it easier to figure out a given file's slug | Make it easier to figure out a given file's slug
| Python | bsd-3-clause | ad-m/django-tinycontent,dominicrodger/django-tinycontent,watchdogpolska/django-tinycontent,dominicrodger/django-tinycontent,ad-m/django-tinycontent,watchdogpolska/django-tinycontent | ---
+++
@@ -10,7 +10,7 @@
class TinyContentFileUploadAdmin(admin.ModelAdmin):
- list_display = ('name', )
+ list_display = ('name', 'slug', )
search_fields = ('name', )
admin.site.register(TinyContentFileUpload, TinyContentFileUploadAdmin) |
a5d7306cdda9e109abbb673b8474f8955a371266 | partner_contact_birthdate/__openerp__.py | partner_contact_birthdate/__openerp__.py | # -*- coding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version ... | # -*- coding: utf-8 -*-
# © <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Contact's birthdate",
"version": "9.0.1.0.0",
"author": "Odoo Community Association (OCA)",
"category": "Customer Relationship Management",
"website": "https://odoo-comm... | Fix header to short version | Fix header to short version
| Python | agpl-3.0 | sergiocorato/partner-contact | ---
+++
@@ -1,20 +1,6 @@
# -*- coding: utf-8 -*-
-
-# Odoo, Open Source Management Solution
-# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free S... |
a3c68f6f70a2d4d1ecdcdb982eda9ec15fa4c127 | utils.py | utils.py | from google.appengine.api import users
from google.appengine.ext import db
from model import User
@db.transactional
def create_user(google_user):
user = User(
google_user=google_user
)
user.put()
return user
def get_current_user():
google_user = users.get_current_user()
user = get_use... | from google.appengine.api import users
from google.appengine.ext import db
from model import User
latest_signup = None
@db.transactional
def create_user(google_user):
global latest_signup
user = User(
google_user=google_user
)
user.put()
latest_signup = user
return user
def get_curre... | Fix bug where user could not be found | Fix bug where user could not be found
This problem only occured when a request tried to find the user right
after it had been created.
| Python | mit | youtify/newscontrol,studyindenmark/newscontrol,studyindenmark/newscontrol,youtify/newscontrol | ---
+++
@@ -3,16 +3,24 @@
from model import User
+latest_signup = None
+
@db.transactional
def create_user(google_user):
+ global latest_signup
user = User(
google_user=google_user
)
user.put()
+ latest_signup = user
return user
def get_current_user():
google_user = u... |
9f8b555698471987a5a635f69fa0ad68a4b28134 | 14/src.py | 14/src.py | import sys
import itertools
import re
from md5 import md5
puzzle_input = 'abc' # 'yjdafjpo'
def key(n):
return md5(puzzle_input + str(n)).hexdigest()
def otp_keys(horizon):
lookahead = {k: -1 for k in '0123456789abcdef'}
def update_lookahead(n):
for quint in re.finditer(r'(.)\1{4}', key(n)):
lookahea... | import sys
import itertools
import re
from md5 import md5
puzzle_input = 'yjdafjpo'
def key(n):
return md5(puzzle_input + str(n)).hexdigest()
def otp_keys(horizon):
lookahead = {k: -1 for k in '0123456789abcdef'}
def update_lookahead(n):
for quint in re.finditer(r'(.)\1{4}', key(n)):
lookahead[quint.... | Fix problem in previous version | Fix problem in previous version
I was accidentally allowing the current hash's quint to match its triple
| Python | mit | amalloy/advent-of-code-2016 | ---
+++
@@ -3,7 +3,7 @@
import re
from md5 import md5
-puzzle_input = 'abc' # 'yjdafjpo'
+puzzle_input = 'yjdafjpo'
def key(n):
return md5(puzzle_input + str(n)).hexdigest()
@@ -20,7 +20,7 @@
update_lookahead(i + horizon)
triple = re.search(r'(.)\1{2}', key(i))
if triple:
- if lookahead[... |
2cdb6a5eeb1730627cea2a812d590efed82d03fb | acceptance_tests/test_course_learners.py | acceptance_tests/test_course_learners.py | from unittest import skipUnless
from bok_choy.web_app_test import WebAppTest
from acceptance_tests import ENABLE_LEARNER_ANALYTICS
from acceptance_tests.mixins import CoursePageTestsMixin
from acceptance_tests.pages import CourseLearnersPage
@skipUnless(ENABLE_LEARNER_ANALYTICS, 'Learner Analytics must be enabled t... | from unittest import skipUnless
from bok_choy.web_app_test import WebAppTest
from acceptance_tests import ENABLE_LEARNER_ANALYTICS
from acceptance_tests.mixins import CoursePageTestsMixin
from acceptance_tests.pages import CourseLearnersPage
@skipUnless(ENABLE_LEARNER_ANALYTICS, 'Learner Analytics must be enabled t... | Add test for learners help link | Add test for learners help link
| Python | agpl-3.0 | Stanford-Online/edx-analytics-dashboard,Stanford-Online/edx-analytics-dashboard,edx/edx-analytics-dashboard,Stanford-Online/edx-analytics-dashboard,edx/edx-analytics-dashboard,edx/edx-analytics-dashboard,Stanford-Online/edx-analytics-dashboard,edx/edx-analytics-dashboard | ---
+++
@@ -9,6 +9,8 @@
@skipUnless(ENABLE_LEARNER_ANALYTICS, 'Learner Analytics must be enabled to run CourseLearnersTests')
class CourseLearnersTests(CoursePageTestsMixin, WebAppTest):
+ help_path = 'engagement/learners.html'
+
def setUp(self):
super(CourseLearnersTests, self).setUp()
... |
743064dbe22e40928c50817417077b8d52de641c | twistedchecker/functionaltests/comments.py | twistedchecker/functionaltests/comments.py | # enable: W9401,W9402
#A comment does not begin with a whitespace.
a = 1 + 2 # A comment begins with two whitespace.
# a comment begins with a lowercase letter.
# Good comment examples.
# A sentence that spans multiple lines
# doesn't need to have capitalization on second line.
# Here's some code samples:
# x ... | # enable: W9401,W9402
#A comment does not begin with a whitespace.
a = 1 + 2 # A comment begins with two whitespace.
# a comment begins with a lowercase letter.
# Good comment examples.
# A sentence that spans multiple lines
# doesn't need to have capitalization on second line.
# Here's some code samples:
# x ... | Add example with back ticks. | Add example with back ticks.
| Python | mit | twisted/twistedchecker | ---
+++
@@ -20,3 +20,5 @@
# '\r\n\t' a comment can start with a new lines characters.
var = 1 + 2 # \r\n same for inline comments.
+
+# `literal` is fine at the start. |
aabf28c02a4dff593e5e4b156052adb9b81a70c7 | skflow/ops/tests/test_dropout_ops.py | skflow/ops/tests/test_dropout_ops.py | # Copyright 2015-present Scikit Flow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | # Copyright 2015-present Scikit Flow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | Test for dropout probability be a tensor | Test for dropout probability be a tensor
| Python | apache-2.0 | handroissuazo/tensorflow,elingg/tensorflow,awni/tensorflow,aselle/tensorflow,theflofly/tensorflow,ishay2b/tensorflow,XueqingLin/tensorflow,DavidNorman/tensorflow,odejesush/tensorflow,taknevski/tensorflow-xsmm,AndreasMadsen/tensorflow,Kongsea/tensorflow,hfp/tensorflow-xsmm,jhaux/tensorflow,JingJunYin/tensorflow,tensorfl... | ---
+++
@@ -21,11 +21,21 @@
class DropoutTest(tf.test.TestCase):
def test_dropout_float(self):
- with self.test_session():
+ with self.test_session() as session:
x = tf.placeholder(tf.float32, [5, 5])
y = ops.dropout(x, 0.5)
probs = tf.get_collection(ops.DR... |
0e83eff1b63eeb5203b4abc55e6278fc411567ae | setup.py | setup.py | from os.path import dirname, join
from setuptools import find_packages, setup
from channels_redis import __version__
# We use the README as the long_description
readme = open(join(dirname(__file__), "README.rst")).read()
crypto_requires = ["cryptography>=1.3.0"]
test_requires = crypto_requires + [
"pytest>=3.0... | from os.path import dirname, join
from setuptools import find_packages, setup
from channels_redis import __version__
# We use the README as the long_description
readme = open(join(dirname(__file__), "README.rst")).read()
crypto_requires = ["cryptography>=1.3.0"]
test_requires = crypto_requires + [
"pytest>=3.0... | Update dependencies to be more loose (and match Channels) | Update dependencies to be more loose (and match Channels)
| Python | bsd-3-clause | django/asgi_redis | ---
+++
@@ -32,8 +32,8 @@
install_requires=[
"aioredis~=1.0.0",
"msgpack~=0.5.0",
- "asgiref~=2.0.1",
- "channels~=2.0.0",
+ "asgiref~=2.1",
+ "channels~=2.0",
],
extras_require={
"cryptography": crypto_requires, |
0ba4eb026c34b85e0413bc83015398eeb33e6547 | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name = 'thespian',
version = '2.1.4',
description = 'Python Actor concurrency library',
author = 'Kevin Quick',
author_email = 'kquick@godaddy.com',
url = 'http://thespianpy.com',
license = 'MIT',
scripts = [ 'thespianShell.py' ],
p... | from setuptools import setup, find_packages
setup(
name = 'thespian',
version = '2.1.4',
description = 'Python Actor concurrency library',
author = 'Kevin Quick',
author_email = 'kquick@godaddy.com',
url = 'http://thespianpy.com',
license = 'MIT',
scripts = [ 'thespianShell.py' ],
p... | Add more classifiers, including Python 3.3 and 3.4 declarations. | Add more classifiers, including Python 3.3 and 3.4 declarations.
| Python | mit | kquick/Thespian,godaddy/Thespian,kquick/Thespian,godaddy/Thespian | ---
+++
@@ -11,13 +11,20 @@
scripts = [ 'thespianShell.py' ],
packages = find_packages(exclude=['thespian/test']),
classifiers = [
+ 'Development Status :: 3 - Production/Stable',
'Environment :: Library',
'Intended Audience :: Developers',
+ 'License :: OSI Approved :: ... |
da765334ffbc87c5cc20c8b3cdf7e31768c97bf7 | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from tornado_redis_sentinel import __version__
tests_require = [
'mock',
'nose',
'coverage',
'yanc',
'preggy',
'tox',
'ipdb',
'coveralls',
]
setup(
name='tornado-redis-sentinel',
version=... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from tornado_redis_sentinel import __version__
tests_require = [
'mock',
'nose',
'coverage',
'yanc',
'preggy',
'tox',
'ipdb',
'coveralls',
]
setup(
name='tornado-redis-sentinel',
version=... | Remove upper limit for tornado's version | Remove upper limit for tornado's version
My use case seems to work with tornado 4.0.2.
| Python | mit | ms7s/tornado-redis-sentinel | ---
+++
@@ -41,7 +41,7 @@
packages=find_packages(),
include_package_data=True,
install_requires=[
- 'tornado>3.2,<4.0',
+ 'tornado>3.2',
'toredis',
'six'
], |
565c66982965c5abbc88083fa505efb4ce8a92c0 | setup.py | setup.py | #
# This file is part of gruvi. Gruvi is free software available under the terms
# of the MIT license. See the file "LICENSE" that was provided together with
# this source file for the licensing terms.
#
# Copyright (c) 2012 the gruvi authors. See the file "AUTHORS" for a complete
# list.
from setuptools import setup
... | #
# This file is part of gruvi. Gruvi is free software available under the terms
# of the MIT license. See the file "LICENSE" that was provided together with
# this source file for the licensing terms.
#
# Copyright (c) 2012 the gruvi authors. See the file "AUTHORS" for a complete
# list.
from setuptools import setup
... | Use nose as the test driver. | Use nose as the test driver.
| Python | mit | swegener/gruvi,geertj/gruvi,geertj/gruvi,swegener/gruvi | ---
+++
@@ -33,5 +33,6 @@
packages = [ 'gruvi', 'gruvi.test' ],
requires = ['greenlet'],
install_requires = ['setuptools'],
+ test_suite = 'nose.collector',
**version_info
) |
d4feda3b91585576708f56ebc8f2c8592f877e2c | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
with open('README.rst') as file:
long_description = file.read()
setup(name='parmap',
version='1.5.1.9000',
description=('map and starmap implementations passing additional '
'arguments and parallelizing if possible'),
long_de... | #!/usr/bin/env python
from setuptools import setup
with open('README.rst') as file:
long_description = file.read()
setup(name='parmap',
version='1.5.1.9000',
description=('map and starmap implementations passing additional '
'arguments and parallelizing if possible'),
long_de... | Add long description content type | Add long description content type
| Python | apache-2.0 | zeehio/parmap | ---
+++
@@ -10,6 +10,7 @@
description=('map and starmap implementations passing additional '
'arguments and parallelizing if possible'),
long_description=long_description,
+ long_description_content_type = "text/x-rst",
author='Sergio Oller',
license='APACHE-2.0',
... |
29600a6a8e8fa17e1c5b9f53dde57167450cbf4d | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from distutils.core import setup
# 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-zxcvbn-password',
version='1.0.3.0',
packages=['zxcvbn_password'],
packa... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from distutils.core import setup
# 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-zxcvbn-password',
version='1.0.3.0',
packages=['zxcvbn_password'],
packa... | Fix package data (str to []) | Fix package data (str to [])
| Python | isc | Pawamoy/django-zxcvbn-password,Pawamoy/django-zxcvbn-password,Pawamoy/django-zxcvbn-password | ---
+++
@@ -11,7 +11,7 @@
name='django-zxcvbn-password',
version='1.0.3.0',
packages=['zxcvbn_password'],
- package_data={'': '*.js'},
+ package_data={'': ['*.js']},
include_package_data=True,
license='BSD License',
|
9260852d12ca686843ba30f3786b542e6418e4ff | setup.py | setup.py | import os
import sys
import imp
from setuptools import find_packages
try:
from restricted_pkg import setup
except:
# allow falling back to setuptools only if
# we are not trying to upload
if 'upload' in sys.argv:
raise ImportError('restricted_pkg is required to upload, first do pip install rest... | ### GAMECHANGER_CI_PREVENT_BUILD
import os
import sys
import imp
from setuptools import find_packages
try:
from restricted_pkg import setup
except:
# allow falling back to setuptools only if
# we are not trying to upload
if 'upload' in sys.argv:
raise ImportError('restricted_pkg is required to ... | Add magic comment to stop our CI from building a package | Add magic comment to stop our CI from building a package
| Python | mit | gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty | ---
+++
@@ -1,3 +1,4 @@
+### GAMECHANGER_CI_PREVENT_BUILD
import os
import sys
import imp |
7db466f94fbca57482947fa982f56ae77b11f9fa | setup.py | setup.py | #!/usr/bin/env python
"""
Setup file for toolaudit.
"""
import codecs
import os
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
def read(filename):
"""
Read the contents of the files listed in filenames and return it as a
string.
"""
return codecs.open(os.path.jo... | #!/usr/bin/env python
"""
Setup file for toolaudit.
"""
import codecs
import os
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
def read(filename):
"""
Read the contents of the files listed in filenames and return it as a
string.
"""
return codecs.open(os.path.jo... | Set zip_safe to False to eliminate a variable getting the tests to run | Set zip_safe to False to eliminate a variable getting the tests to run
| Python | mit | jstutters/toolaudit | ---
+++
@@ -23,6 +23,7 @@
name='toolaudit',
version='0.0.3',
packages=['toolaudit'],
+ zip_safe=False,
install_requires=[
"argparse>=1.3.0",
"PyYAML>=3.11", |
ad855c1466cfa374aad397fcc3f0e72551e4133f | setup.py | setup.py |
from setuptools import setup
setup(name = 'OWSLib',
version = '0.1.0',
description = 'OGC Web Service utility library',
license = 'GPL',
keywords = 'gis ogc ows wfs wms capabilities metadata',
author = 'Sean Gillies',
author_email = 'sgillies@fri... |
from setuptools import setup
setup(name = 'OWSLib',
version = '0.2.0',
description = 'OGC Web Service utility library',
license = 'BSD',
keywords = 'gis ogc ows wfs wms capabilities metadata',
author = 'Sean Gillies',
author_email = 'sgillies@fri... | Change version and license for 0.2 | Change version and license for 0.2
| Python | bsd-3-clause | dblodgett-usgs/OWSLib,geographika/OWSLib,bird-house/OWSLib,ocefpaf/OWSLib,daf/OWSLib,kalxas/OWSLib,tomkralidis/OWSLib,jaygoldfinch/OWSLib,mbertrand/OWSLib,KeyproOy/OWSLib,Jenselme/OWSLib,menegon/OWSLib,jachym/OWSLib,kwilcox/OWSLib,jaygoldfinch/OWSLib,JuergenWeichand/OWSLib,b-cube/OWSLib,gfusca/OWSLib,robmcmullen/OWSLib... | ---
+++
@@ -2,9 +2,9 @@
from setuptools import setup
setup(name = 'OWSLib',
- version = '0.1.0',
+ version = '0.2.0',
description = 'OGC Web Service utility library',
- license = 'GPL',
+ license = 'BSD',
keywords = 'gis ogc ows wfs wms cap... |
5b2691dcc89fb9d9b7b1db77e9512976950adf45 | setup.py | setup.py | """Package Keysmith."""
import codecs
import os.path
import setuptools # type: ignore
import keysmith # This project only depends on the standard library.
def read(*parts):
"""Read a file in this repository."""
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, *pa... | """Package Keysmith."""
import codecs
import os.path
import setuptools # type: ignore
import keysmith # This project only depends on the standard library.
def read(*parts):
"""Read a file in this repository."""
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, *pa... | Update the project Development Status | Update the project Development Status
| Python | bsd-3-clause | dmtucker/keysmith | ---
+++
@@ -41,5 +41,5 @@
py_modules=[keysmith.__name__],
entry_points=ENTRY_POINTS,
keywords='diceware generator keygen passphrase password',
- classifiers=['Development Status :: 5 - Production/Stable'],
+ classifiers=['Development Status :: 7 - Inactive'],
) |
05ed915cab57ec8014a4d4636687132694171218 | setup.py | setup.py | from setuptools import setup, find_packages
import populous
requirements = [
"click",
]
setup(
name="populous",
version=populous.__version__,
url=populous.__url__,
description=populous.__doc__,
author=populous.__author__,
license=populous.__license__,
long_description="TODO",
pack... | from setuptools import setup, find_packages
import populous
requirements = [
"click",
"cached-property",
]
setup(
name="populous",
version=populous.__version__,
url=populous.__url__,
description=populous.__doc__,
author=populous.__author__,
license=populous.__license__,
long_descr... | Add cached-property to the dependencies | Add cached-property to the dependencies
| Python | mit | novafloss/populous | ---
+++
@@ -4,6 +4,7 @@
requirements = [
"click",
+ "cached-property",
]
setup( |
6edb67deeb3f19b3b5d24e262afc266ce2cb7600 | setup.py | setup.py | from setuptools import setup
import io
# Take from Jeff Knupp's excellent article:
# http://www.jeffknupp.com/blog/2013/08/16/open-sourcing-a-python-project-the-right-way/
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filename in... | from setuptools import setup
import io
# Take from Jeff Knupp's excellent article:
# http://www.jeffknupp.com/blog/2013/08/16/open-sourcing-a-python-project-the-right-way/
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filename in... | Add pytz to installation requirements, needed for pedometerpp | Add pytz to installation requirements, needed for pedometerpp
| Python | mit | durden/dayonetools | ---
+++
@@ -26,7 +26,7 @@
author_email='durdenmisc@gmail.com',
url='https://github.com/durden/dayonetools',
packages=['dayonetools', 'dayonetools.services'],
- install_requires=['python-dateutil>=2.2'],
+ install_requires=['python-dateutil>=2.2', 'pytz==2014.4'],
platforms='any',... |
edd54a7e34fdce5268ef1d15bd04b09e724a8508 | setup.py | setup.py | #!/usr/bin/env python
# coding=utf-8
from setuptools import setup
# Get long description (used on PyPI project page)
def get_long_description():
try:
# Use pandoc to create reStructuredText README if possible
import pypandoc
return pypandoc.convert('README.md', 'rst')
except:
... | #!/usr/bin/env python
# coding=utf-8
from setuptools import setup
# Get long description (used on PyPI project page)
def get_long_description():
try:
# Use pandoc to create reStructuredText README if possible
import pypandoc
return pypandoc.convert('README.md', 'rst')
except:
... | Remove long utility command names in favor of awp | Remove long utility command names in favor of awp
| Python | mit | caleb531/alfred-workflow-packager | ---
+++
@@ -36,8 +36,6 @@
],
entry_points={
'console_scripts': [
- 'alfred-workflow-packager=awp.main:main',
- 'workflow-packager=awp.main:main',
'awp=awp.main:main'
]
} |
be8ea4018641cf79a347f2da04b078e725b0801e | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
import sys
with open('README.md') as f:
readme = f.read()
install_requires = [
'seria',
'python-gnupg'
]
setup(
name='figgypy',
version='0.3.dev',
description='Simple configuration tool. Get config from yaml, json, or xml.',
... | #!/usr/bin/env python
from setuptools import setup, find_packages
import sys
with open('README.md') as f:
readme = f.read()
install_requires = [
'gnupg>=2.0.2',
'seria',
'python-gnupg'
]
setup(
name='figgypy',
version='0.3.dev',
description='Simple configuration tool. Get config from ya... | Add requirement for fork version of gnupg | Add requirement for fork version of gnupg
| Python | mit | theherk/figgypy | ---
+++
@@ -8,6 +8,7 @@
readme = f.read()
install_requires = [
+ 'gnupg>=2.0.2',
'seria',
'python-gnupg'
] |
d8de5888e4519ba32d63d5f31aa4806d81c37399 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
VERSION = '0.0.1'
test_requirements = [
'nose>=1.3.7',
'responses>=0.5.1'
]
install_requires = test_requirements + [
'requests>=2.4.3',
]
setup(
name="mondo",
version=VERSION,
description="Mondo Banking API Client",
author=', '.join((
... | #!/usr/bin/env python
from setuptools import setup
VERSION = '0.0.1'
test_requirements = [
'nose>=1.3.4',
'responses>=0.5.1'
]
install_requires = test_requirements + [
'requests>=2.4.3',
]
setup(
name="mondo",
version=VERSION,
description="Mondo Banking API Client",
author=', '.join((
... | Update nose version for Python2 | Update nose version for Python2
| Python | mit | gabalese/mondo-python | ---
+++
@@ -5,7 +5,7 @@
test_requirements = [
- 'nose>=1.3.7',
+ 'nose>=1.3.4',
'responses>=0.5.1'
]
|
bc687afb9421d61afe95f1c3a444e6c91971a113 | setup.py | setup.py | import os.path
# Install setuptools if not installed.
try:
import setuptools
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
# read README as the long description
readme = 'README' if os.path.exists('README') else 'README.md'
with open... | import os.path
# Install setuptools if not installed.
try:
import setuptools
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
# read README as the long description
readme = 'README' if os.path.exists('README') else 'README.md'
with open... | Add comment for updated Pandas requirement | Add comment for updated Pandas requirement
| Python | bsd-3-clause | UDST/spandex,SANDAG/spandex | ---
+++
@@ -30,7 +30,7 @@
packages=find_packages(exclude=['*.tests']),
install_requires=[
'GeoAlchemy2>=0.2.1', # Bug fix for schemas other than public.
- 'pandas>=0.15.0',
+ 'pandas>=0.15.0', # pandas.Index.difference.
'psycopg2>=2.5', # connection and cursor con... |
61f9f96645daaa42369b86f2af9404f3d228b22e | setup.py | setup.py | #!/usr/bin/env python3
from setuptools import setup
from ipyrmd import __version__
setup(name="ipyrmd",
version=__version__,
description="Convert between IPython/Jupyter notebooks and RMarkdown",
author="Gordon Ball",
author_email="gordon@chronitis.net",
url="https://github.com/chronitis... | #!/usr/bin/env python3
from setuptools import setup
from ipyrmd import __version__
setup(name="ipyrmd",
version=__version__,
description="Convert between IPython/Jupyter notebooks and RMarkdown",
author="Gordon Ball",
author_email="gordon@chronitis.net",
url="https://github.com/chronitis... | Add missing comma in classifier list | Add missing comma in classifier list
| Python | mit | chronitis/ipyrmd | ---
+++
@@ -17,7 +17,7 @@
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
- "Intended Audience :: Science/Research"
+ "Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: ... |
5c0c0a86827ec6d2b8ece7cffddec3afbfcf72b6 | setup.py | setup.py | import os
from setuptools import setup, find_packages
__version__ = '0.1'
HERE = os.path.dirname(__file__)
try:
long_description = open(os.path.join(HERE, 'README.rst')).read()
except:
long_description = None
setup(
name='rubberjack-cli',
version=__version__,
packages=find_packages(exclude=['tes... | import os
from setuptools import setup, find_packages
__version__ = '0.1'
HERE = os.path.dirname(__file__)
def readme():
with open('README.rst') as f:
return f.read()
setup(
name='rubberjack-cli',
version=__version__,
packages=find_packages(exclude=['test*']),
include_package_data=True... | Include README in package cf. PyPA recommendation | Include README in package cf. PyPA recommendation
http://python-packaging.readthedocs.io/en/latest/metadata.html#a-readme-long-description
| Python | mit | laterpay/rubberjack-cli | ---
+++
@@ -5,10 +5,11 @@
HERE = os.path.dirname(__file__)
-try:
- long_description = open(os.path.join(HERE, 'README.rst')).read()
-except:
- long_description = None
+
+def readme():
+ with open('README.rst') as f:
+ return f.read()
+
setup(
name='rubberjack-cli',
@@ -21,7 +22,7 @@
... |
bdee28d919458449d882df352ed6e2d675b87901 | setup.py | setup.py | from setuptools import setup, find_packages
version = __import__('eemeter').get_version()
setup(
name='eemeter',
version=version,
description='Open Energy Efficiency Meter',
long_description=(
"Standard methods for calculating energy efficiency savings."
),
url='https://github.com/ope... | from setuptools import setup, find_packages
version = __import__('eemeter').get_version()
setup(
name='eemeter',
version=version,
description='Open Energy Efficiency Meter',
long_description=(
"Standard methods for calculating energy efficiency savings."
),
url='https://github.com/ope... | Use higher pandas version for python 3.6.0 support | Use higher pandas version for python 3.6.0 support
| Python | apache-2.0 | openeemeter/eemeter,openeemeter/eemeter | ---
+++
@@ -26,7 +26,7 @@
'lxml <= 3.6.1',
'numpy >= 1.10.2',
'scipy',
- 'pandas >= 0.18,<0.19',
+ 'pandas >= 0.19.2',
'patsy',
'pytz',
'requests', |
e91d22d34027429f7d0db86d2800ba9ed73056be | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name = 'django-news-sitemaps',
version = '0.1.7',
description = 'Generates sitemaps compatible with the Google News schema',
author = 'TWT Web Devs',
author_email = 'webdev@washingtontimes.com',
url = 'http://github.com/washingtontimes/django-n... | from setuptools import setup, find_packages
setup(
name = 'django-news-sitemaps',
version = '1.0.0',
description = 'Generates sitemaps compatible with the Google News schema',
author = 'TWT Web Devs',
author_email = 'webdev@washingtontimes.com',
url = 'http://github.com/washingtontimes/django-n... | Increment version number to 1.0.0 | Increment version number to 1.0.0 | Python | apache-2.0 | theatlantic/django-news-sitemaps | ---
+++
@@ -2,7 +2,7 @@
setup(
name = 'django-news-sitemaps',
- version = '0.1.7',
+ version = '1.0.0',
description = 'Generates sitemaps compatible with the Google News schema',
author = 'TWT Web Devs',
author_email = 'webdev@washingtontimes.com', |
96499391091a81302ac3947536b573c21f571677 | setup.py | setup.py | from setuptools import setup
from distutils import sysconfig
import re
#from setuptools.dist import Distribution
site_packages_path = sysconfig.get_python_lib()
sprem = re.match(
r'.*(lib[\\/](python\d\.\d[\\/])?site-packages)', site_packages_path, re.I)
rel_site_packages = sprem.group(1)
#class PureDistribution(... | from setuptools import setup
from distutils import sysconfig
import re
#from setuptools.dist import Distribution
site_packages_path = sysconfig.get_python_lib()
try:
sprem = re.match(
r'.*(lib[\\/](python\d(\.\d)*[\\/])?site-packages)', site_packages_path, re.I)
if sprem is None:
sprem = re.mat... | Expand regex for location of site-packages. Provide more info to user about possible failure to find site-packages | Expand regex for location of site-packages. Provide more info to user about possible failure to find site-packages
| Python | bsd-2-clause | dougn/coverage_pth | ---
+++
@@ -4,9 +4,18 @@
#from setuptools.dist import Distribution
site_packages_path = sysconfig.get_python_lib()
-sprem = re.match(
- r'.*(lib[\\/](python\d\.\d[\\/])?site-packages)', site_packages_path, re.I)
-rel_site_packages = sprem.group(1)
+try:
+ sprem = re.match(
+ r'.*(lib[\\/](python\d(\.... |
42043217547f05eb1652d481840d15b581b80434 | setup.py | setup.py | # -*- coding: utf-8 -*-
import os
from setuptools import find_packages
from setuptools import setup
base_dir = os.path.dirname(__file__)
setup(
name='elastalert',
version='0.0.99',
description='Runs custom filters on Elasticsearch and alerts on matches',
author='Quentin Long',
author_email='qlo@y... | # -*- coding: utf-8 -*-
import os
from setuptools import find_packages
from setuptools import setup
base_dir = os.path.dirname(__file__)
setup(
name='elastalert',
version='0.1.0',
description='Runs custom filters on Elasticsearch and alerts on matches',
author='Quentin Long',
author_email='qlo@ye... | Bump elastalert version to 0.1.0 | Bump elastalert version to 0.1.0
| Python | apache-2.0 | Yelp/elastalert,jetyang2005/elastalert,jetyang2005/elastalert,jetyang2005/elastalert,dvopsway/elastalert,rprabhat/elastalert | ---
+++
@@ -8,7 +8,7 @@
base_dir = os.path.dirname(__file__)
setup(
name='elastalert',
- version='0.0.99',
+ version='0.1.0',
description='Runs custom filters on Elasticsearch and alerts on matches',
author='Quentin Long',
author_email='qlo@yelp.com', |
a1a651acf48604ab135961b324d3b9e271a2128b | setup.py | setup.py | from distutils.core import setup
with open('README.md') as readme:
with open('HISTORY.md') as history:
long_description = readme.read() + '\n\n' + history.read()
VERSION = '1.0'
setup(
name='argparse-autogen',
py_modules=['argparse_autogen'],
version=VERSION,
url='https://github.com/sashg... | from distutils.core import setup
with open('README.md') as readme:
with open('HISTORY.md') as history:
long_description = readme.read() + '\n\n' + history.read()
try:
import pypandoc
long_description = pypandoc.convert(long_description, 'rst')
except(IOError, ImportError):
long_description = ... | Convert md to rst readme specially for PyPi | Convert md to rst readme specially for PyPi
| Python | mit | sashgorokhov/argparse-autogen | ---
+++
@@ -4,7 +4,14 @@
with open('HISTORY.md') as history:
long_description = readme.read() + '\n\n' + history.read()
-VERSION = '1.0'
+try:
+ import pypandoc
+
+ long_description = pypandoc.convert(long_description, 'rst')
+except(IOError, ImportError):
+ long_description = long_descriptio... |
4a7a7a0b558358840440f937a03dcc88e469ca01 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
README = readme_file.read()
install_requires = [
'click==6.2',
'botocore>=1.4.8,<2.0.0',
'virtualenv>=15.0.0,<16.0.0',
'typing==3.5.2.2',
]
setup(
name='chalice',
version='0.5.0',
... | #!/usr/bin/env python
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
README = readme_file.read()
install_requires = [
'click==6.6',
'botocore>=1.4.8,<2.0.0',
'virtualenv>=15.0.0,<16.0.0',
'typing==3.5.3.0',
]
setup(
name='chalice',
version='0.5.0',
... | Upgrade type and click versions | Upgrade type and click versions
| Python | apache-2.0 | freaker2k7/chalice,awslabs/chalice | ---
+++
@@ -7,10 +7,10 @@
install_requires = [
- 'click==6.2',
+ 'click==6.6',
'botocore>=1.4.8,<2.0.0',
'virtualenv>=15.0.0,<16.0.0',
- 'typing==3.5.2.2',
+ 'typing==3.5.3.0',
]
|
e5e6d4ac9e86aa7e44694cf4746c4c9ec91df107 | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name = 'skeleton',
version = '0.0',
description = 'A python skeleton project',
long_description = '''
This project represents a basic python skeleton project that can be used as
the basis for other projects. Feel free to fork this project... | #!/usr/bin/env python
from distutils.core import setup
setup(name = 'skeleton',
version = '0.0',
description = 'A python skeleton project',
long_description = '''
This project represents a basic python skeleton project that can be used as
the basis for other projects. Feel free to fork this project... | Move generic lib to botton of config. | Move generic lib to botton of config.
| Python | bsd-2-clause | arlaneenalra/python-skeleton | ---
+++
@@ -21,8 +21,8 @@
],
license = 'License :: OSI Approved :: BSD License',
packages = [],
- package_dir = { '': 'lib'},
scripts = [],
py_modules = [],
+ package_dir = { '': 'lib'},
)
|
0ef968528f31da5dd09f016134b4a1ffa6377f84 | scripts/slave/chromium/package_source.py | scripts/slave/chromium/package_source.py | #!/usr/bin/python
# Copyright (c) 2011 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.
"""A tool to package a checkout's source and upload it to Google Storage."""
import sys
if '__main__' == __name__:
sys.exit(0)
| #!/usr/bin/python
# Copyright (c) 2011 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.
"""A tool to package a checkout's source and upload it to Google Storage."""
import os
import sys
from common import chromium_utils
... | Create source snapshot and upload to GS. | Create source snapshot and upload to GS.
BUG=79198
Review URL: http://codereview.chromium.org/7129020
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@88372 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | eunchong/build,eunchong/build,eunchong/build,eunchong/build | ---
+++
@@ -6,8 +6,35 @@
"""A tool to package a checkout's source and upload it to Google Storage."""
+import os
import sys
+
+from common import chromium_utils
+from slave import slave_utils
+
+
+FILENAME = 'chromium-src.tgz'
+GSBASE = 'chromium-browser-csindex'
+
+
+def main(argv):
+ if not os.path.exists('s... |
6c8dd596a0f5f84acee54938d2f948f25445327d | src/Scripts/correlation-histogram.py | src/Scripts/correlation-histogram.py | # Take the output of the BitFunnel correlate command and generate histograms.
from collections import defaultdict
import csv
term_term_correlation = defaultdict(int)
term_all_correlation = defaultdict(int)
# TODO: don't hardcode name.
with open("/tmp/Correlate-0.csv") as f:
reader = csv.reader(f)
for row in ... | # Take the output of the BitFunnel correlate command and generate histograms.
from collections import defaultdict
import csv
term_term_correlation = defaultdict(lambda:defaultdict(int))
term_all_correlation = defaultdict(lambda:defaultdict(int))
def bf_correlate_to_dicts(term_term_correlation,
... | Put multple treatments into the same histogram. | Put multple treatments into the same histogram.
| Python | mit | danluu/BitFunnel,BitFunnel/BitFunnel,BitFunnel/BitFunnel,danluu/BitFunnel,danluu/BitFunnel,danluu/BitFunnel,BitFunnel/BitFunnel,BitFunnel/BitFunnel,BitFunnel/BitFunnel,danluu/BitFunnel,BitFunnel/BitFunnel,danluu/BitFunnel | ---
+++
@@ -3,28 +3,42 @@
from collections import defaultdict
import csv
-term_term_correlation = defaultdict(int)
-term_all_correlation = defaultdict(int)
+term_term_correlation = defaultdict(lambda:defaultdict(int))
+term_all_correlation = defaultdict(lambda:defaultdict(int))
-# TODO: don't hardcode name.
-wi... |
55dc12dcac51109b4974c58252929066ca985569 | sqjobs/contrib/django/djsqjobs/finders.py | sqjobs/contrib/django/djsqjobs/finders.py | from sqjobs.utils import get_jobs_from_module
import logging
logger = logging.getLogger('sqjobs.contrib.django.utils')
def get_apps_names():
"""
copied from django-extensions compatibility sheam
"""
try:
# django >= 1.7, to support AppConfig
from django.apps import apps
return... | from sqjobs.utils import get_jobs_from_module
import logging
logger = logging.getLogger('sqjobs.contrib.django.utils')
def get_apps_names():
"""
copied from django-extensions compatibility sheam
"""
try:
# django >= 1.7, to support AppConfig
from django.apps import apps
return... | Remove 7 characters to get rid of ".models" | Remove 7 characters to get rid of ".models"
| Python | bsd-3-clause | gnufede/sqjobs,gnufede/sqjobs | ---
+++
@@ -14,7 +14,7 @@
return [app.name for app in apps.get_app_configs()]
except ImportError:
from django.db import models
- return [app.__name__[:-6] for app in models.get_apps()]
+ return [app.__name__[:-7] for app in models.get_apps()]
def register_all_jobs(worker): |
24f69b587ce38c581f9ee68e22978963b266f010 | html_to_telegraph.py | html_to_telegraph.py | # encoding=utf8
from lxml import html
def _recursive_convert(element):
# All strings outside tags should be ignored
if not isinstance(element, html.HtmlElement):
return
fragment_root_element = {
'_': element.tag
}
content = []
if element.text:
content.append({'t': ele... | # encoding=utf8
from lxml import html
import json
def _recursive_convert(element):
# All strings outside tags should be ignored
fragment_root_element = {
'_': element.tag
}
content = []
if element.text:
content.append({'t': element.text})
if element.attrib:
fragment_... | Return string instead of list | Return string instead of list
| Python | mit | mercuree/html-telegraph-poster | ---
+++
@@ -1,11 +1,10 @@
# encoding=utf8
from lxml import html
+import json
def _recursive_convert(element):
# All strings outside tags should be ignored
- if not isinstance(element, html.HtmlElement):
- return
fragment_root_element = {
'_': element.tag
@@ -35,6 +34,10 @@
d... |
962fc49f734b04e717bf936745013ab0c19c4ee1 | utils.py | utils.py | import cv2
import itertools
import numpy as np
def partition(pred, iterable):
"""
Partition the iterable into two disjoint entries based
on the predicate.
@return: Tuple (iterable1, iterable2)
"""
iter1, iter2 = itertools.tee(iterable)
return itertools.filterfalse(pred, iter1), filter(pred, iter2)
def ... | from six.moves import filterfalse
import cv2
import itertools
import numpy as np
def partition(pred, iterable):
"""
Partition the iterable into two disjoint entries based
on the predicate.
@return: Tuple (iterable1, iterable2)
"""
iter1, iter2 = itertools.tee(iterable)
return filterfalse(pred, iter1), ... | Fix python 2.7 compatibility issue | Fix python 2.7 compatibility issue
| Python | mit | viswanathgs/dist-dqn,viswanathgs/dist-dqn | ---
+++
@@ -1,3 +1,5 @@
+from six.moves import filterfalse
+
import cv2
import itertools
import numpy as np
@@ -10,7 +12,7 @@
@return: Tuple (iterable1, iterable2)
"""
iter1, iter2 = itertools.tee(iterable)
- return itertools.filterfalse(pred, iter1), filter(pred, iter2)
+ return filterfalse(pred, iter1... |
1016664a5d0285a51455f90d47940b39f77562e4 | src/pretix/base/views/cachedfiles.py | src/pretix/base/views/cachedfiles.py | import os
from django.http import FileResponse, HttpRequest, HttpResponse
from django.shortcuts import get_object_or_404
from django.utils.functional import cached_property
from django.views.generic import TemplateView
from pretix.base.models import CachedFile
class DownloadView(TemplateView):
template_name = "... | import os
from django.http import FileResponse, HttpRequest, HttpResponse
from django.shortcuts import get_object_or_404
from django.utils.functional import cached_property
from django.views.generic import TemplateView
from pretix.base.models import CachedFile
class DownloadView(TemplateView):
template_name = "... | Remove duplicate dot in file downloads | Remove duplicate dot in file downloads
| Python | apache-2.0 | Flamacue/pretix,Flamacue/pretix,Flamacue/pretix,Flamacue/pretix | ---
+++
@@ -21,7 +21,7 @@
elif self.object.file:
resp = FileResponse(self.object.file.file, content_type=self.object.type)
_, ext = os.path.splitext(self.object.filename)
- resp['Content-Disposition'] = 'attachment; filename="{}.{}"'.format(self.object.id, ext)
+ ... |
917ba14418f01fa2fc866fc1c18989cc500c2cfd | bin/license_finder_pip.py | bin/license_finder_pip.py | #!/usr/bin/env python
import json
import sys
from pip._internal.req import parse_requirements
from pip._internal.download import PipSession
from pip._vendor import pkg_resources
from pip._vendor.six import print_
requirements = [pkg_resources.Requirement.parse(str(req.req)) for req
in parse_requiremen... | #!/usr/bin/env python
import json
import sys
try:
from pip._internal.req import parse_requirements
except ImportError:
from pip.req import parse_requirements
try:
from pip._internal.download import PipSession
except ImportError:
from pip.download import PipSession
from pip._vendor imp... | Add backwards compatibility with pip v9 | Add backwards compatibility with pip v9 | Python | mit | pivotal/LicenseFinder,pivotal/LicenseFinder,pivotal/LicenseFinder,pivotal/LicenseFinder,pivotal/LicenseFinder,pivotal/LicenseFinder,pivotal/LicenseFinder | ---
+++
@@ -2,8 +2,16 @@
import json
import sys
-from pip._internal.req import parse_requirements
-from pip._internal.download import PipSession
+
+try:
+ from pip._internal.req import parse_requirements
+except ImportError:
+ from pip.req import parse_requirements
+try:
+ from pip._internal.... |
3ba549b00e4ee8491e9adab7baa36e27edd45fa9 | {{cookiecutter.extension_name}}/setup.py | {{cookiecutter.extension_name}}/setup.py | from setuptools import setup
from setupbase import create_cmdclass, install_npm
cmdclass = create_cmdclass(['js'])
cmdclass['js'] = install_npm()
setup_args = dict(
name = '{{cookiecutter.extension_name}}',
version = '0.18.0',
packages = ['{{cookiecutter.extension_... | from setuptools import setup
from setupbase import create_cmdclass, install_npm
cmdclass = create_cmdclass(['labextension', 'nbextension'])
cmdclass['labextension'] = install_npm('labextension')
cmdclass['nbextension'] = install_npm('nbextension')
setup_args = dict(
name = '{{cookiecutter.extensio... | Create commands for labextension and nbextension | Create commands for labextension and nbextension
| Python | cc0-1.0 | jupyterlab/mimerender-cookiecutter,gnestor/mimerender-cookiecutter,jupyterlab/mimerender-cookiecutter,gnestor/mimerender-cookiecutter | ---
+++
@@ -1,8 +1,9 @@
from setuptools import setup
from setupbase import create_cmdclass, install_npm
-cmdclass = create_cmdclass(['js'])
-cmdclass['js'] = install_npm()
+cmdclass = create_cmdclass(['labextension', 'nbextension'])
+cmdclass['labextension'] = install_npm('labextension')
+cmdclass['nbextension'] ... |
9d5300f6688038ca59b07ed4033c8768658377c6 | examples/prompts/multi-column-autocompletion-with-meta.py | examples/prompts/multi-column-autocompletion-with-meta.py | #!/usr/bin/env python
"""
Autocompletion example that shows meta-information alongside the completions.
"""
from __future__ import unicode_literals
from prompt_toolkit.contrib.completers import WordCompleter
from prompt_toolkit import prompt
animal_completer = WordCompleter([
'alligator',
'ant',
'ape',
... | #!/usr/bin/env python
"""
Autocompletion example that shows meta-information alongside the completions.
"""
from __future__ import unicode_literals
from prompt_toolkit.contrib.completers import WordCompleter
from prompt_toolkit import prompt
animal_completer = WordCompleter([
'alligator',
'ant',
'ape',
... | Fix typo: `dolphine` -> `dolphin` | Fix typo: `dolphine` -> `dolphin`
| Python | bsd-3-clause | jonathanslenders/python-prompt-toolkit | ---
+++
@@ -15,7 +15,7 @@
'bat',
'bear', 'beaver', 'bee', 'bison', 'butterfly', 'cat', 'chicken',
- 'crocodile', 'dinosaur', 'dog', 'dolphine', 'dove', 'duck', 'eagle',
+ 'crocodile', 'dinosaur', 'dog', 'dolphin', 'dove', 'duck', 'eagle',
'elephant',
], meta_dict={
'alligator': 'An alliga... |
973c6a541deadb5a4b7c23dae191acf9d4c1be27 | buffer/tests/test_link.py | buffer/tests/test_link.py | from nose.tools import eq_, raises
from mock import MagicMock, patch
from buffer.models.link import Link
def test_links_shares():
'''
Test link's shares retrieving from constructor
'''
mocked_api = MagicMock()
mocked_api.get.return_value = {'shares': 123}
link = Link(api=mocked_api, url='www.google.co... | from nose.tools import eq_, raises
from mock import MagicMock, patch
from buffer.models.link import Link
def test_links_shares():
'''
Test link's shares retrieving from constructor
'''
mocked_api = MagicMock()
mocked_api.get.return_value = {'shares': 123}
link = Link(api=mocked_api, url='www.google.co... | Test link's shares retrieving using get_share method | Test link's shares retrieving using get_share method
| Python | mit | bufferapp/buffer-python,vtemian/buffpy | ---
+++
@@ -14,3 +14,19 @@
link = Link(api=mocked_api, url='www.google.com')
eq_(link, {'shares': 123, 'url': 'www.google.com', 'api': mocked_api})
+ mocked_api.get.assert_called_once_with(url='links/shares.json?url=www.google.com')
+
+def test_links_get_shares():
+ '''
+ Test link's shares retrieving me... |
fbf42c288a6faa13ac918047eac09985cbd6f6e0 | cal/v1/network/drivers/openstack_network.py | cal/v1/network/drivers/openstack_network.py | """ OpenstackDriver for Network
based on NetworkDriver
"""
from neutronclient.v2_0 import client
from network_driver import NetworkDriver
class OpenstackNetWorkDriver(NetworkDriver):
"""docstring for OpenstackNetWorkDriver"""
def __init__(self, auth_url, project_name,
username, password... | """ OpenstackDriver for Network
based on NetworkDriver
"""
from neutronclient.v2_0 import client
from network_driver import NetworkDriver
class OpenstackNetWorkDriver(NetworkDriver):
"""docstring for OpenstackNetWorkDriver"""
def __init__(self, auth_url, project_name,
username, passwor... | Add neutron client without test | Add neutron client without test
| Python | apache-2.0 | cloudcomputinghust/CAL | ---
+++
@@ -7,45 +7,39 @@
class OpenstackNetWorkDriver(NetworkDriver):
+
"""docstring for OpenstackNetWorkDriver"""
def __init__(self, auth_url, project_name,
- username, password, user_domain_name=None,
- project_domain_name=None, driver_name=None):
+ ... |
10ae884bd68feca56b3893b84221b867f3b0aec3 | orangecontrib/text/vectorization/base.py | orangecontrib/text/vectorization/base.py | import numpy as np
from gensim import matutils
from gensim.corpora import Dictionary
class BaseVectorizer:
"""Base class for vectorization objects. """
name = NotImplemented
def transform(self, corpus, copy=True):
"""Transforms a corpus to a new one with additional attributes. """
if copy... | import numpy as np
from gensim import matutils
from gensim.corpora import Dictionary
class BaseVectorizer:
"""Base class for vectorization objects. """
name = NotImplemented
def transform(self, corpus, copy=True):
"""Transforms a corpus to a new one with additional attributes. """
if copy... | Mark features to skip normalization | BoW: Mark features to skip normalization
This fixes SVM on sparse data.
| Python | bsd-2-clause | cheral/orange3-text,cheral/orange3-text,cheral/orange3-text | ---
+++
@@ -29,5 +29,5 @@
order = np.argsort([dictionary[i] for i in range(len(dictionary))])
corpus.extend_attributes(X[:, order],
feature_names=(dictionary[i] for i in order),
- var_attrs={'hidden': True})
+ ... |
2d6babf3bf6107b8a5c42fe76a4d17d7fa0b51f6 | catkin/src/statistics/scripts/listener.py | catkin/src/statistics/scripts/listener.py | #!/usr/bin/env python
import rospy
import socket
from statistics.msg import StatsD
class StatsHandler():
def __init__(self, statsd_host, statsd_port):
self.statsd_target = (statsd_host, statsd_port)
self.sock = socket.socket(
socket.AF_INET,
socket.SOCK_DGRAM
)
def _send_msg(self, statsd_... | #!/usr/bin/env python
import rospy
import socket
from statistics.msg import StatsD
class StatsDHandler():
def __init__(self, statsd_host, statsd_port):
self.statsd_target = (statsd_host, statsd_port)
self.sock = socket.socket(
socket.AF_INET,
socket.SOCK_DGRAM
)
def _send_msg(self, statsd... | Rename statistics handler to be more specific | Rename statistics handler to be more specific
| Python | apache-2.0 | EndPointCorp/appctl,EndPointCorp/appctl | ---
+++
@@ -4,7 +4,7 @@
import socket
from statistics.msg import StatsD
-class StatsHandler():
+class StatsDHandler():
def __init__(self, statsd_host, statsd_port):
self.statsd_target = (statsd_host, statsd_port)
self.sock = socket.socket(
@@ -37,7 +37,7 @@
8125
)
- handler = StatsHandler(... |
01059774f04d26b69a1ddc058416f627da396a58 | src/tempel/models.py | src/tempel/models.py | from django.db import models
from django.conf import settings
from tempel import utils
class Entry(models.Model):
content = models.TextField()
language = models.CharField(max_length=20,
choices=utils.get_languages())
created = models.DateTimeField(auto_now_add=True)
act... | from datetime import datetime
from django.db import models
from django.conf import settings
from tempel import utils
class Entry(models.Model):
content = models.TextField()
language = models.CharField(max_length=20,
choices=utils.get_languages())
created = models.DateTimeF... | Replace Entry's created's auto_now_add=True with default=datetime.now | Replace Entry's created's auto_now_add=True with default=datetime.now
| Python | agpl-3.0 | fajran/tempel | ---
+++
@@ -1,3 +1,5 @@
+from datetime import datetime
+
from django.db import models
from django.conf import settings
@@ -7,7 +9,7 @@
content = models.TextField()
language = models.CharField(max_length=20,
choices=utils.get_languages())
- created = models.DateTimeFie... |
9a061d7b13482046509c6c231b0018a600cb9155 | tests/__init__.py | tests/__init__.py | import os
NOSQL = any([name in (os.getenv("DB") or "")
for name in ("datastore", "mongodb", "imap")])
if NOSQL:
from test_dal_nosql import *
else:
from sql import *
| import os
NOSQL = any([name in (os.getenv("DB") or "")
for name in ("datastore", "mongodb", "imap")])
if NOSQL:
from nosql import *
else:
from sql import *
| Fix wrong import in tests | Fix wrong import in tests
| Python | bsd-3-clause | niphlod/pydal,willimoa/pydal,kmcheung12/pydal,manuelep/pydal,stephenrauch/pydal,michele-comitini/pydal,web2py/pydal | ---
+++
@@ -4,6 +4,6 @@
for name in ("datastore", "mongodb", "imap")])
if NOSQL:
- from test_dal_nosql import *
+ from nosql import *
else:
from sql import * |
5ebe17f5dc88fef7718d2c3665b905cc8d7fab7c | alembic/versions/147d1de2e5e4_add_periodicity_of_script.py | alembic/versions/147d1de2e5e4_add_periodicity_of_script.py | """Add periodicity of script
Revision ID: 147d1de2e5e4
Revises:
Create Date: 2019-04-19 18:48:33.526449
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '147d1de2e5e4'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.add_colum... | """Add periodicity of script
Revision ID: 147d1de2e5e4
Revises:
Create Date: 2019-04-19 18:48:33.526449
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '147d1de2e5e4'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.add_colum... | Handle downgrade on a sqlite db | Handle downgrade on a sqlite db
| Python | mit | e-henry/scripto,e-henry/scripto,e-henry/scripto,e-henry/scripto | ---
+++
@@ -21,4 +21,7 @@
def downgrade():
- op.drop_column('script', 'periodicity')
+ # Sqlite does not handle the drop column directive, but alembic can take care of
+ # creating a migration script if we use its batch mode
+ with op.batch_alter_table("script") as batch_op:
+ batch_op.drop_co... |
83c64e096ff8b79e2ae22edbcabb483dcf27302f | tests/conftest.py | tests/conftest.py | import pytest
@pytest.fixture(autouse=True)
def platform(request):
marker = request.node.get_marker('platform')
if marker:
expected = marker.args[0]
minion = request.getfuncargvalue('minion')
platform = minion['container'].get_os_release()['ID']
action = marker.kwargs.get('acti... | import pytest
@pytest.fixture(autouse=True)
def platform(request):
marker = request.node.get_marker('platform')
if marker:
expected = marker.args[0]
minion = request.getfuncargvalue('minion')
os_release = minion['container'].get_os_release()
platform = os_release.get('ID', 'sle... | Fix platform detection for sles <12 | Fix platform detection for sles <12
| Python | mit | dincamihai/salt-toaster,dincamihai/salt-toaster | ---
+++
@@ -7,7 +7,8 @@
if marker:
expected = marker.args[0]
minion = request.getfuncargvalue('minion')
- platform = minion['container'].get_os_release()['ID']
+ os_release = minion['container'].get_os_release()
+ platform = os_release.get('ID', 'sles')
action = ma... |
c5a0f1f26d2527f49ec00d842ffd56be5f0a9965 | detect/findIgnoreLists.py | detect/findIgnoreLists.py | #!/usr/bin/env python
import os
THIS_SCRIPT_DIRECTORY = os.path.dirname(os.path.abspath(__file__))
THIS_REPO_PATH = os.path.abspath(os.path.join(THIS_SCRIPT_DIRECTORY, os.pardir))
REPO_PARENT_PATH = os.path.abspath(os.path.join(THIS_SCRIPT_DIRECTORY, os.pardir, os.pardir))
# Lets us combine ignore lists:
# from pr... | #!/usr/bin/env python
import os
THIS_SCRIPT_DIRECTORY = os.path.dirname(os.path.abspath(__file__))
THIS_REPO_PATH = os.path.abspath(os.path.join(THIS_SCRIPT_DIRECTORY, os.pardir))
REPO_PARENT_PATH = os.path.abspath(os.path.join(THIS_SCRIPT_DIRECTORY, os.pardir, os.pardir))
# Lets us combine ignore lists:
# from pr... | Stop looking in the old fuzzing/ directory | Stop looking in the old fuzzing/ directory
| Python | mpl-2.0 | nth10sd/funfuzz,MozillaSecurity/funfuzz,MozillaSecurity/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz,nth10sd/funfuzz | ---
+++
@@ -19,7 +19,7 @@
r = []
assert not targetRepo.startswith("/")
for name in sorted(os.listdir(REPO_PARENT_PATH)):
- if name.startswith("fuzzing") or name.startswith("funfuzz"):
+ if name.startswith("funfuzz"):
knownPath = os.path.join(REPO_PARENT_PATH, name, "known", t... |
f182bb2dd76483891148476b14ccad08a596b080 | tests/test_lesson_4_temperature.py | tests/test_lesson_4_temperature.py | import unittest
from lessons.lesson_4_temperature import temperature
class CtoFTestCase(unittest.TestCase):
def test_handles_freezing_point(self):
freezing = temperature.c_to_f(0)
self.assertEqual(freezing, 32)
def test_handles_boiling_point(self):
boiling = temperature.c_to_f(100)
... | Add tests for temperature conversions in lesson 4. | Add tests for temperature conversions in lesson 4.
| Python | mit | thejessleigh/test_driven_python,thejessleigh/test_driven_python,thejessleigh/test_driven_python | ---
+++
@@ -0,0 +1,39 @@
+import unittest
+
+from lessons.lesson_4_temperature import temperature
+
+
+class CtoFTestCase(unittest.TestCase):
+ def test_handles_freezing_point(self):
+ freezing = temperature.c_to_f(0)
+ self.assertEqual(freezing, 32)
+
+ def test_handles_boiling_point(self):
+ ... | |
72c00dca2c8310744c424296d8f712909bc95b95 | infosystem/subsystem/capability/entity.py | infosystem/subsystem/capability/entity.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | # 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 t... | Fix unique contraint in capability | Fix unique contraint in capability
| Python | apache-2.0 | samueldmq/infosystem | ---
+++
@@ -21,7 +21,7 @@
name = db.Column(db.String(30), nullable=False)
url = db.Column(db.String(100), nullable=False)
method = db.Column(db.String(10), nullable=False)
- UniqueConstraint('url', 'method', name='capability_uk')
+ __table_args__ = (UniqueConstraint('url', 'method', name='capabil... |
93c6a89bd6f0d8ff9a32e37d4f6e9c4ed0aa3f8f | openedx/core/djangoapps/schedules/apps.py | openedx/core/djangoapps/schedules/apps.py | from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class SchedulesConfig(AppConfig):
name = 'openedx.core.djangoapps.schedules'
verbose_name = _('Schedules')
def ready(self):
# noinspection PyUnresolvedReferences
from . import signals, tasks # pylin... | from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class SchedulesConfig(AppConfig):
name = 'openedx.core.djangoapps.schedules'
verbose_name = _('Schedules')
plugin_app = {}
def ready(self):
# noinspection PyUnresolvedReferences
from . import si... | Update schedules app to be a Django App Plugin | Update schedules app to be a Django App Plugin
| Python | agpl-3.0 | EDUlib/edx-platform,ahmedaljazzar/edx-platform,procangroup/edx-platform,gsehub/edx-platform,edx/edx-platform,stvstnfrd/edx-platform,teltek/edx-platform,ahmedaljazzar/edx-platform,angelapper/edx-platform,EDUlib/edx-platform,ahmedaljazzar/edx-platform,kmoocdev2/edx-platform,appsembler/edx-platform,msegado/edx-platform,cp... | ---
+++
@@ -6,6 +6,8 @@
name = 'openedx.core.djangoapps.schedules'
verbose_name = _('Schedules')
+ plugin_app = {}
+
def ready(self):
# noinspection PyUnresolvedReferences
from . import signals, tasks # pylint: disable=unused-variable |
ca6a758f525c741f277e7e7be115b5b9d20fa5c1 | openxc/tools/dump.py | openxc/tools/dump.py | """
This module contains the methods for the ``openxc-dump`` command line program.
`main` is executed when ``openxc-dump`` is run, and all other callables in this
module are internal only.
"""
from __future__ import absolute_import
import argparse
import time
from openxc.formats.json import JsonFormatter
from .commo... | """
This module contains the methods for the ``openxc-dump`` command line program.
`main` is executed when ``openxc-dump`` is run, and all other callables in this
module are internal only.
"""
from __future__ import absolute_import
import argparse
import time
from openxc.formats.json import JsonFormatter
from .commo... | Remove a resolved TODO - trace file formats now standardized. | Remove a resolved TODO - trace file formats now standardized.
| Python | bsd-3-clause | openxc/openxc-python,openxc/openxc-python,openxc/openxc-python | ---
+++
@@ -14,7 +14,6 @@
def receive(message, **kwargs):
message['timestamp'] = time.time()
- # TODO update docs on trace file format
print(JsonFormatter.serialize(message))
|
b07037277b28f80aaa6d6f74d6f79d4146b5ee23 | oshi_rest_server/oshi_rest_server/urls.py | oshi_rest_server/oshi_rest_server/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'oshi_rest_server.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| from django.conf.urls import patterns, include, url
from django.contrib import admin
from rest_framework import routers
admin.autodiscover()
urlpatterns = patterns('',
url(r'^', include(routers.urls)),
url(r'^admin/', include(admin.site.urls)),
url... | Configure Django REST framework URLs | Configure Django REST framework URLs
| Python | isc | ferrarimarco/OSHI-REST-server,ferrarimarco/OSHI-REST-server | ---
+++
@@ -1,12 +1,12 @@
from django.conf.urls import patterns, include, url
from django.contrib import admin
+from rest_framework import routers
+
admin.autodiscover()
urlpatterns = patterns('',
- # Examples:
- # url(r'^$', 'oshi_rest_server.views.home', name='home'),
- # url(r'^blog/', include('bl... |
72e509be8415e628613b2341c136018ff5bb0f44 | openpathsampling/engines/openmm/__init__.py | openpathsampling/engines/openmm/__init__.py | def missing_openmm(*args, **kwargs):
raise RuntimeError("Install OpenMM to use this feature")
try:
import simtk.openmm
import simtk.openmm.app
except ImportError:
HAS_OPENMM = False
Engine = missing_openmm
empty_snapshot_from_openmm_topology = missing_openmm
snapshot_from_pdb = missing_open... | def missing_openmm(*args, **kwargs):
raise RuntimeError("Install OpenMM to use this feature")
try:
import simtk.openmm
import simtk.openmm.app
except ImportError:
HAS_OPENMM = False
Engine = missing_openmm
empty_snapshot_from_openmm_topology = missing_openmm
snapshot_from_pdb = missing_open... | Fix backward compatiblity for MDTrajTopology | Fix backward compatiblity for MDTrajTopology
| Python | mit | openpathsampling/openpathsampling,dwhswenson/openpathsampling,openpathsampling/openpathsampling,choderalab/openpathsampling,openpathsampling/openpathsampling,choderalab/openpathsampling,dwhswenson/openpathsampling,dwhswenson/openpathsampling,choderalab/openpathsampling,openpathsampling/openpathsampling,dwhswenson/openp... | ---
+++
@@ -29,5 +29,6 @@
from . import features
from .snapshot import Snapshot, MDSnapshot
+ from . import topology
from openpathsampling.engines import NoEngine, SnapshotDescriptor |
f3be5184dfccdcbbf5b95c7fcd75fbbda8d2ce1c | packages/grid/backend/grid/core/security.py | packages/grid/backend/grid/core/security.py | # stdlib
from datetime import datetime
from datetime import timedelta
from typing import Any
from typing import Optional
from typing import Union
# third party
from jose import jwt
from passlib.context import CryptContext
# grid absolute
from grid.core.config import settings
pwd_context = CryptContext(schemes=["bcry... | # stdlib
from datetime import datetime
from datetime import timedelta
from typing import Any
from typing import Optional
from typing import Union
# third party
from jose import jwt
from passlib.context import CryptContext
# grid absolute
from grid.core.config import settings
pwd_context = CryptContext(schemes=["bcry... | UPDATE create_access_token to handle guest sessions | UPDATE create_access_token to handle guest sessions
| Python | apache-2.0 | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | ---
+++
@@ -19,7 +19,9 @@
def create_access_token(
- subject: Union[str, Any], expires_delta: Optional[timedelta] = None
+ subject: Union[str, Any],
+ expires_delta: Optional[timedelta] = None,
+ guest: bool = False,
) -> str:
if expires_delta:
expire = datetime.utcnow() + expires_delt... |
ef41e90cf49856a6d0ca1b363440edb542dd2e0d | tests/test_config.py | tests/test_config.py | # Copyright 2015-2016 Masayuki Yamamoto
#
# 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 agree... | # Copyright 2015-2016 Masayuki Yamamoto
#
# 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 agree... | Add test case for user path | Add test case for user path
Expect filepath joinning '.yanico.conf' under $HOME.
| Python | apache-2.0 | ma8ma/yanico | ---
+++
@@ -13,8 +13,22 @@
# limitations under the License.
"""Unittest of configuration loading."""
+import os
import unittest
+from unittest import mock
+
+from yanico import config
class TestUserPath(unittest.TestCase):
"""Test for yanico.config.user_path()."""
+
+ @mock.patch.dict(os.environ, {... |
b910900f72d6b25cb05c56563968aad102429c25 | gmrh/RepositoryHandler.py | gmrh/RepositoryHandler.py | import os.path
import subprocess
class DefaultRepositoryHandler():
def __init__(self, cwd):
self.cwd = cwd
def repository_exists(self, path):
return os.path.exists(path + os.path.sep + '.git')
def update_repository(self, path, remote_url, remote_branch):
print 'Updating repositor... | import os.path
import subprocess
class DefaultRepositoryHandler():
def __init__(self, cwd):
self.cwd = cwd
def repository_exists(self, path):
return os.path.exists(path + os.path.sep + '.git')
def update_repository(self, path, remote_url, remote_branch):
print 'Updating repositor... | Check the url of the remote & ensure the updating commands are executed in the correct directory | Check the url of the remote & ensure the updating commands are executed in the correct directory
| Python | bsd-3-clause | solarnz/polygamy,solarnz/polygamy | ---
+++
@@ -11,7 +11,14 @@
def update_repository(self, path, remote_url, remote_branch):
print 'Updating repository %s ...' % path
- subprocess.check_call(['git', 'pull', '--rebase'])
+
+ remote_name = 'origin'
+
+ url = subprocess.check_output(['git', 'config', 'remote.%s.url' % ... |
5a1c48403a912eedc4f5d87215fafdb05eb49ed5 | Python/find-all-duplicates-in-an-array.py | Python/find-all-duplicates-in-an-array.py | # Time: O(n)
# Space: O(1)
# Given an array of integers, 1 <= a[i] <= n (n = size of array),
# some elements appear twice and others appear once.
# Find all the elements that appear twice in this array.
# Could you do it without extra space and in O(n) runtime?
#
# Example:
# Input
#
# [4,3,2,7,8,2,3,1]
#
# Output
#
... | # Time: O(n)
# Space: O(1)
# Given an array of integers, 1 <= a[i] <= n (n = size of array),
# some elements appear twice and others appear once.
# Find all the elements that appear twice in this array.
# Could you do it without extra space and in O(n) runtime?
#
# Example:
# Input
#
# [4,3,2,7,8,2,3,1]
#
# Output
#
... | Add alternative solution for 'Find all duplicates in an array' | Add alternative solution for 'Find all duplicates in an array'
| Python | mit | kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015 | ---
+++
@@ -33,3 +33,15 @@
if i != nums[i]-1:
result.append(nums[i])
return result
+
+
+from collections import Counter
+
+
+class Solution2(object):
+ def findDuplicates(self, nums):
+ """
+ :type nums: List[int]
+ :rtype: List[int]
+ """
+ ... |
3f5e90a19881884408003ed01b04b4a29b3bd2fd | test/command_source/TestCommandSource.py | test/command_source/TestCommandSource.py | """
Test that lldb command "command source" works correctly.
See also http://llvm.org/viewvc/llvm-project?view=rev&revision=109673.
"""
import os, time
import unittest2
import lldb
from lldbtest import *
class CommandSourceTestCase(TestBase):
mydir = "command_source"
def test_command_source(self):
... | """
Test that lldb command "command source" works correctly.
See also http://llvm.org/viewvc/llvm-project?view=rev&revision=109673.
"""
import os, sys
import unittest2
import lldb
from lldbtest import *
class CommandSourceTestCase(TestBase):
mydir = "command_source"
def test_command_source(self):
"... | Add "import sys" for sys.stdout. | Add "import sys" for sys.stdout.
git-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@124504 91177308-0d34-0410-b5e6-96231b3b80d8
| Python | apache-2.0 | apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb | ---
+++
@@ -4,7 +4,7 @@
See also http://llvm.org/viewvc/llvm-project?view=rev&revision=109673.
"""
-import os, time
+import os, sys
import unittest2
import lldb
from lldbtest import * |
73243dc74b416fc42ccb8b684924f0b2a09919a3 | SnakesLadders/SnakesLadders.py | SnakesLadders/SnakesLadders.py | class State(object):
def __init__(self, ix):
self.index = ix
self.link = None # placeholder, not None if Snake or Ladder
def process(self):
"""Action when landed upon"""
if self.link:
if self.link > self.index:
# Ladder!
return self.l... | class State(object):
def __init__(self, ix):
self.index = ix
self.link = None # placeholder, not None if Snake or Ladder
def process(self):
"""Action when landed upon"""
if self.link:
if self.link > self.index:
# Ladder!
return self.l... | Update to move and run | Update to move and run
| Python | cc0-1.0 | robclewley/DataScotties | ---
+++
@@ -19,9 +19,29 @@
class GameFSM(object):
def __init__(self, n):
self.all_states = []
+ self.position = 0
+ self.n = n
for ix in range(n+1):
self.all_states.append(State(ix))
-
+
+ def move(self, die):
+ """die is an integer
+ ""... |
a4e959c1aeb705128898f07bdf9c9fb315ba593c | flexget/tests/test_plugin_interfaces.py | flexget/tests/test_plugin_interfaces.py | from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from flexget import plugin
class TestInterfaces(object):
"""Test that any plugins declaring certain interfaces at least superficially comply with those interfaces."""... | from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from flexget import plugin
class TestInterfaces(object):
"""Test that any plugins declaring certain interfaces at least superficially comply with those interfaces."""... | Add tests for search interface plugins | Add tests for search interface plugins
| Python | mit | malkavi/Flexget,tobinjt/Flexget,jacobmetrick/Flexget,jawilson/Flexget,tobinjt/Flexget,LynxyssCZ/Flexget,malkavi/Flexget,qk4l/Flexget,OmgOhnoes/Flexget,JorisDeRieck/Flexget,gazpachoking/Flexget,crawln45/Flexget,jacobmetrick/Flexget,jawilson/Flexget,jacobmetrick/Flexget,tobinjt/Flexget,poulpito/Flexget,JorisDeRieck/Flexg... | ---
+++
@@ -6,17 +6,22 @@
class TestInterfaces(object):
"""Test that any plugins declaring certain interfaces at least superficially comply with those interfaces."""
+ def get_plugins(self, interface):
+ plugins = list(plugin.get_plugins(interface=interface))
+ assert plugins, 'No plugins for... |
11cf55cf2859a23edd2d1dba56e574d01cacce4f | apps/funding/forms.py | apps/funding/forms.py | from django import forms
from django.utils.translation import ugettext_lazy as _, ugettext as __
from .models import Funding
from .widgets import PerksAmountWidget
class FundingForm(forms.Form):
required_css_class = 'required'
amount = forms.DecimalField(label=_("Amount"), decimal_places=2,
widget=Pe... | from django import forms
from django.utils.translation import ugettext_lazy as _, ugettext as __
from .models import Funding
from .widgets import PerksAmountWidget
class FundingForm(forms.Form):
required_css_class = 'required'
amount = forms.DecimalField(label=_("Amount"), decimal_places=2,
widget=Pe... | Set perks on form save. | Set perks on form save.
| Python | agpl-3.0 | fnp/wolnelektury,fnp/wolnelektury,fnp/wolnelektury,fnp/wolnelektury | ---
+++
@@ -31,10 +31,12 @@
return self.cleaned_data
def save(self):
- return Funding.objects.create(
+ funding = Funding.objects.create(
offer=self.offer,
name=self.cleaned_data['name'],
email=self.cleaned_data['email'],
amount=self.cl... |
145a72dc8439d4479b64a79e7c94cbc12f4afdd7 | test/__init__.py | test/__init__.py | """Package for regression testing of the blender nif scripts."""
import bpy
def setup(self):
"""Enables the nif scripts addon, so all tests can use it."""
bpy.ops.wm.addon_enable(module="io_scene_nif")
def teardown(self):
"""Disables the nif scripts addon."""
bpy.ops.wm.addon_disable(module="io_scene... | """Package for regression testing of the blender nif scripts."""
import bpy
def setup(self):
"""Enables the nif scripts addon, so all tests can use it."""
bpy.ops.wm.addon_enable(module="io_scene_nif")
# remove default objects
for obj in bpy.data.objects[:]:
bpy.context.scene.objects.unlink(ob... | Remove startup objects when setting up the test module. | Remove startup objects when setting up the test module.
| Python | bsd-3-clause | amorilia/blender_nif_plugin,nightstrike/blender_nif_plugin,amorilia/blender_nif_plugin,nightstrike/blender_nif_plugin | ---
+++
@@ -5,6 +5,10 @@
def setup(self):
"""Enables the nif scripts addon, so all tests can use it."""
bpy.ops.wm.addon_enable(module="io_scene_nif")
+ # remove default objects
+ for obj in bpy.data.objects[:]:
+ bpy.context.scene.objects.unlink(obj)
+ bpy.data.objects.remove(obj)
d... |
5d6b384a2f1b8caa9421b428e5d81aaa1d9a82e1 | tests/correct.py | tests/correct.py | """Check ringtophat results against scipy.ndimage.convolve""" | """Check ringtophat results against scipy.ndimage.convolve"""
import unittest
from numpy.testing import assert_equal, assert_almost_equal
import numpy as np
import ringtophat
class TestKernels(unittest.TestCase):
def test_binary_disk(self):
actual = ringtophat.binary_disk(1)
desired = np.array([[Fa... | Add first tests. disk and ring masks for simple cases. | Add first tests. disk and ring masks for simple cases. | Python | bsd-3-clause | gammapy/ringtophat,gammapy/ringtophat | ---
+++
@@ -1 +1,25 @@
"""Check ringtophat results against scipy.ndimage.convolve"""
+import unittest
+from numpy.testing import assert_equal, assert_almost_equal
+import numpy as np
+import ringtophat
+
+class TestKernels(unittest.TestCase):
+ def test_binary_disk(self):
+ actual = ringtophat.binary_disk(... |
2974972ce36f1cd2dec99a18edc49ac374cdf458 | tools/fitsevt.py | tools/fitsevt.py | #! /usr/bin/python3
import sys
import os
import math
from astropy.io import fits
inputFolder = sys.argv[1]
outputFolder = sys.argv[2]
eLo = int(sys.argv[3])
eHi = int(sys.argv[4])
binSize = int(sys.argv[5])
fnames = os.listdir(inputFolder)
for fname in fnames:
print(fname)
hdulist = fits.open(inputFolder+"/"+fna... | #! /usr/bin/python3
import sys
import os
import math
from astropy.io import fits
inputFolder = sys.argv[1]
outputFolder = sys.argv[2]
eLo = int(sys.argv[3])
eHi = int(sys.argv[4])
binSize = int(sys.argv[5])
fnames = os.listdir(inputFolder)
for fname in fnames:
print(fname)
hdulist = fits.open(inputFolder+"/"+fnam... | Change output filenaming to have .txt | Change output filenaming to have .txt
| Python | mit | fauzanzaid/IUCAA-GRB-detection-Feature-extraction | ---
+++
@@ -10,7 +10,6 @@
eLo = int(sys.argv[3])
eHi = int(sys.argv[4])
binSize = int(sys.argv[5])
-
fnames = os.listdir(inputFolder)
@@ -30,7 +29,8 @@
sigClass = 1
- with open(outputFolder+"/{0}_{1}".format(fname,i),'w') as f:
+ outputFile = outputFolder+"/"+os.path.splitext(fname)[0]+"_Q{0}.txt".fo... |
96871ef8de84653406749a2e503ef4b4fb800b2f | src/mist/io/tests/features/steps/shell.py | src/mist/io/tests/features/steps/shell.py | """
@given:
-------
@when:
------
I type the "{command}" shell command --> shell_command
@then:
------
I should see the "{command}" result in shell output --> shell_output
------
"""
@when(u'I type the "{command}" shell command')
def shell_command(context, command):
shell_input = context.browser.fi... | """
@given:
-------
@when:
------
I type the "{command}" shell command --> shell_command
@then:
------
I should see the "{command}" result in shell output --> shell_output
------
"""
@when(u'I type the "{command}" shell command')
def shell_command(context, command):
shell_input = context.browser.fi... | Fix Shell tests according to css changes | Fix Shell tests according to css changes
| Python | agpl-3.0 | kelonye/mist.io,Lao-liu/mist.io,DimensionDataCBUSydney/mist.io,Lao-liu/mist.io,johnnyWalnut/mist.io,DimensionDataCBUSydney/mist.io,zBMNForks/mist.io,munkiat/mist.io,Lao-liu/mist.io,afivos/mist.io,munkiat/mist.io,munkiat/mist.io,afivos/mist.io,johnnyWalnut/mist.io,Lao-liu/mist.io,munkiat/mist.io,DimensionDataCBUSydney/m... | ---
+++
@@ -26,7 +26,7 @@
@then(u'I should see the "{command}" result in shell output')
def shell_output(context, command):
- shell_output = context.browser.find_by_css('#shell-response .ui-btn')
+ shell_output = context.browser.find_by_css('#shell-return h3')
for output in shell_output:
if ... |
3c8f7752a6b47a8ce5395b9038a9280fe0369aae | risk_engine_tests.py | risk_engine_tests.py | from risk_engine import RiskEngine
import unittest
class RiskEngineTestCase(unittest.TestCase):
def setUp(self):
self.engine = RiskEngine()
def test_roll_is_near_even(self):
n = 1000000
payout_count = 0
for roll in range(n):
if self.engine.run():
payout_count += 1
payout_perc... | from risk_engine import RiskEngine
import unittest
class RiskEngineTestCase(unittest.TestCase):
def setUp(self):
self.engine = RiskEngine()
def test_roll_is_near_even(self):
n = 1000000
payout_count = 0
for roll in range(n):
if self.engine.run():
payout_count += 1
payout_perc... | Improve the users odds a little | Improve the users odds a little
| Python | mit | joelklabo/risk | ---
+++
@@ -14,7 +14,7 @@
payout_count += 1
payout_percentage = float(payout_count)/float(n)
print(payout_percentage)
- assert (payout_percentage > 0.0 and payout_percentage <= 0.49)
+ assert (payout_percentage > 0.0 and payout_percentage <= 0.499)
if __name__ == '__main__':
unitt... |
c3ca44b17b9e14e8570083ab49be4da8e64757bc | scripts/filter_fasta_on_length.py | scripts/filter_fasta_on_length.py | #!/usr/bin/env python
"""filter_fasta_on_length.py
Filter a fasta file so that the resulting sequences are all longer
or equal to the length threshold parameter. Only accepts stdin."""
import argparse
import sys
from Bio import SeqIO
def main(args):
seqs = []
for i, seq in enumerate(SeqIO.parse(sys.stdin, ... | #!/usr/bin/env python
"""filter_fasta_on_length.py
Filter a fasta file so that the resulting sequences are all longer
or equal to the length threshold parameter. Only accepts stdin."""
import argparse
import sys
from Bio import SeqIO
def main(args):
seqs = []
if args.input_fasta is not None:
input_... | Use either file input or stdin for filtering length | Use either file input or stdin for filtering length
| Python | mit | EnvGen/toolbox,EnvGen/toolbox | ---
+++
@@ -10,7 +10,12 @@
def main(args):
seqs = []
- for i, seq in enumerate(SeqIO.parse(sys.stdin, "fasta")):
+ if args.input_fasta is not None:
+ input_handle = open(args.input_fasta, 'r')
+ else:
+ input_handle = sys.stdin
+
+ for i, seq in enumerate(SeqIO.parse(input_handle, "f... |
91c502beb68acff1ad5194a572d5b75f607b7d00 | ckanext/qa/helpers.py | ckanext/qa/helpers.py | from ckan.plugins import toolkit as tk
def qa_openness_stars_resource_html(resource):
qa = resource.get('qa')
if not qa:
return '<!-- No qa info for this resource -->'
extra_vars = qa
return tk.literal(
tk.render('qa/openness_stars.html',
extra_vars=extra_vars))
def... | import copy
from ckan.plugins import toolkit as tk
def qa_openness_stars_resource_html(resource):
qa = resource.get('qa')
if not qa:
return '<!-- No qa info for this resource -->'
# Take a copy of the qa dict, because weirdly the renderer appears to add
# keys to it like _ and app_globals. Thi... | Fix bug that meant rendering debug info was v slow. | Fix bug that meant rendering debug info was v slow.
| Python | mit | ckan/ckanext-qa,ckan/ckanext-qa,ckan/ckanext-qa | ---
+++
@@ -1,3 +1,4 @@
+import copy
from ckan.plugins import toolkit as tk
@@ -5,7 +6,11 @@
qa = resource.get('qa')
if not qa:
return '<!-- No qa info for this resource -->'
- extra_vars = qa
+ # Take a copy of the qa dict, because weirdly the renderer appears to add
+ # keys to it l... |
e57d8f885c2be591bcfa7b5f337495cdb2e6ce64 | ooni/tests/test_errors.py | ooni/tests/test_errors.py | from twisted.trial import unittest
import ooni.errors
class TestErrors(unittest.TestCase):
def test_catch_child_failures_before_parent_failures(self):
"""
Verify that more specific Failures are caught first by
handleAllFailures() and failureToString().
Fails if a subclass is list... | from twisted.trial import unittest
import ooni.errors
class TestErrors(unittest.TestCase):
def test_catch_child_failures_before_parent_failures(self):
"""
Verify that more specific Failures are caught first by
handleAllFailures() and failureToString().
Fails if a subclass is list... | Fix typo in docstring spotted by @armadev | Fix typo in docstring spotted by @armadev
| Python | bsd-2-clause | 0xPoly/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe | ---
+++
@@ -9,7 +9,7 @@
Verify that more specific Failures are caught first by
handleAllFailures() and failureToString().
- Fails if a subclass is listed after it's parent Failure.
+ Fails if a subclass is listed after its parent Failure.
"""
# Check each Failure ... |
3d97a2ca6c4c285d59e3c823fbee94a494e85ba0 | app/tests/tests.py | app/tests/tests.py | import unittest
from app import serve
class PageCase(unittest.TestCase):
def setUp(self):
serve.app.config['TESTING'] = True
self.app = serve.app.test_client()
def test_index_load(self):
self.page_test('/', b'')
def test_robots_load(self):
self.page_test('/robots.txt', b... | import unittest
from varsnap import TestVarSnap # noqa: F401
from app import serve
class PageCase(unittest.TestCase):
def setUp(self):
serve.app.config['TESTING'] = True
self.app = serve.app.test_client()
def test_index_load(self):
self.page_test('/', b'')
def test_robots_load... | Add TestVarSnap as a TestCase | Add TestVarSnap as a TestCase
| Python | mit | albertyw/base-flask,albertyw/base-flask,albertyw/base-flask,albertyw/base-flask | ---
+++
@@ -1,4 +1,6 @@
import unittest
+
+from varsnap import TestVarSnap # noqa: F401
from app import serve
|
1975d5391f058f85272def4435b243440b72bff6 | weather/admin.py | weather/admin.py | from django.contrib.admin import ModelAdmin, register
from django.contrib.gis.admin import GeoModelAdmin
from weather.models import WeatherStation, Location
@register(Location)
class LocationAdmin(GeoModelAdmin):
openlayers_url = '//static.dpaw.wa.gov.au/static/libs/openlayers/2.13.1/OpenLayers.js'
list_displ... | from django.contrib.admin import ModelAdmin, register
from django.contrib.gis.admin import GeoModelAdmin
from weather.models import WeatherStation, Location
@register(Location)
class LocationAdmin(GeoModelAdmin):
list_display = ('pk', 'title', 'point', 'height')
@register(WeatherStation)
class WeatherStationAdm... | Remove custom OpenLayers.js from LocationAdmin. | Remove custom OpenLayers.js from LocationAdmin.
| Python | bsd-3-clause | parksandwildlife/resource_tracking,parksandwildlife/resource_tracking,parksandwildlife/resource_tracking,ropable/resource_tracking,ropable/resource_tracking,ropable/resource_tracking | ---
+++
@@ -5,7 +5,6 @@
@register(Location)
class LocationAdmin(GeoModelAdmin):
- openlayers_url = '//static.dpaw.wa.gov.au/static/libs/openlayers/2.13.1/OpenLayers.js'
list_display = ('pk', 'title', 'point', 'height')
|
b2d654cf2af71b608d81c6501b214a9b330e1ffe | battlenet/utils.py | battlenet/utils.py | import unicodedata
import urllib
def normalize(name):
if not isinstance(name, unicode):
name = name.decode('utf-8')
return unicodedata.normalize('NFKC', name.replace("'", '')).encode('utf-8')
def quote(name):
if isinstance(name, unicode):
name = normalize(name).encode('utf8')
retur... | import unicodedata
import urllib
def normalize(name):
if not isinstance(name, unicode):
name = name.decode('utf-8')
return unicodedata.normalize('NFKC', name.replace("'", '')).encode('utf-8')
def quote(name):
if isinstance(name, unicode):
name = normalize(name)
return urllib.quote(... | Normalize already returns encoded value. | Normalize already returns encoded value.
| Python | mit | PuckCh/battlenet,vishnevskiy/battlenet | ---
+++
@@ -11,7 +11,7 @@
def quote(name):
if isinstance(name, unicode):
- name = normalize(name).encode('utf8')
+ name = normalize(name)
return urllib.quote(name)
|
99b1edfcc317dbb71b8dad9ad501aaa21f8044f9 | zorp/__init__.py | zorp/__init__.py | """
Zorp
"""
from zorp.client import Client
from zorp.decorator import remote_method
from zorp.server import Server
| """
Zorp
"""
from zorp.client import Client, TriesExceededException
from zorp.decorator import remote_method
from zorp.server import Server
| Add TriesExceededException to the base package | Add TriesExceededException to the base package
| Python | mit | proxama/zorp | ---
+++
@@ -2,6 +2,6 @@
Zorp
"""
-from zorp.client import Client
+from zorp.client import Client, TriesExceededException
from zorp.decorator import remote_method
from zorp.server import Server |
cec7922ad7636f62be864d115f8e341ac511bbc9 | numba/tests/foreign_call/test_cffi_call.py | numba/tests/foreign_call/test_cffi_call.py | import os
import ctypes
import doctest
from numba import *
import numba
try:
import cffi
ffi = cffi.FFI()
except ImportError:
ffi = None
# ______________________________________________________________________
def test():
if ffi is not None:
test_cffi_calls()
# _____________________________... | import os
import ctypes
import doctest
from numba import *
import numba
try:
import cffi
ffi = cffi.FFI()
except ImportError:
ffi = None
# ______________________________________________________________________
def test():
if ffi is not None:
test_cffi_calls()
# _____________________________... | Fix CFFI test when executed multiple times | Fix CFFI test when executed multiple times
| Python | bsd-2-clause | stefanseefeld/numba,jriehl/numba,IntelLabs/numba,stonebig/numba,gmarkall/numba,numba/numba,GaZ3ll3/numba,stefanseefeld/numba,numba/numba,IntelLabs/numba,cpcloud/numba,sklam/numba,cpcloud/numba,IntelLabs/numba,shiquanwang/numba,stuartarchibald/numba,sklam/numba,pitrou/numba,gdementen/numba,gmarkall/numba,seibert/numba,s... | ---
+++
@@ -26,7 +26,7 @@
def test_cffi_calls():
# Test printf for nopython and no segfault
- ffi.cdef("int printf(char *, ...);")
+ ffi.cdef("int printf(char *, ...);", override=True)
lib = ffi.dlopen(None)
printf = lib.printf
call_cffi_func(printf, "Hello world!\n") |
6e2dae94239252f6b0338e609a838fa31e417842 | checks.d/veneur.py | checks.d/veneur.py | import datetime
from urlparse import urljoin
import requests
# project
from checks import AgentCheck
class Veneur(AgentCheck):
VERSION_METRIC_NAME = 'veneur.deployed_version'
BUILDAGE_METRIC_NAME = 'veneur.build_age'
ERROR_METRIC_NAME = 'veneur.agent_check.errors_total'
def check(self, instance):
... | import datetime
from urlparse import urljoin
import requests
# project
from checks import AgentCheck
class Veneur(AgentCheck):
VERSION_METRIC_NAME = 'veneur.deployed_version'
BUILDAGE_METRIC_NAME = 'veneur.build_age'
ERROR_METRIC_NAME = 'veneur.agent_check.errors_total'
def check(self, instance):
... | Add the sha to the tags in a way that won't cause an error | Add the sha to the tags in a way that won't cause an error
| Python | mit | stripe/stripe-datadog-checks,stripe/datadog-checks | ---
+++
@@ -15,10 +15,11 @@
success = 0
host = instance['host']
+ tags = instance.get('tags', [])
try:
r = requests.get(urljoin(host, '/version'))
- sha = r.text
+ tags.extend(['sha:{0}'.format(r.text)])
success = 1
r... |
cc00cc1c2539eb7dbeed2656e1929c8c53c4dd98 | pyverdict/pyverdict/datatype_converters/impala_converter.py | pyverdict/pyverdict/datatype_converters/impala_converter.py | from .converter_base import DatatypeConverterBase
import dateutil
def _str_to_datetime(java_obj, idx):
return dateutil.parser.parse(java_obj.getString(idx))
_typename_to_converter_fxn = {'timestamp': _str_to_datetime}
class ImpalaConverter(DatatypeConverterBase):
@staticmethod
def read_value(result_set... | from .converter_base import DatatypeConverterBase
import dateutil
def _str_to_datetime(java_obj, idx):
return dateutil.parser.parse(java_obj.getString(idx))
_typename_to_converter_fxn = {'timestamp': _str_to_datetime}
class ImpalaConverter(DatatypeConverterBase):
'''
Type conversion rule:
BIGI... | Add type conversion rule comment | Add type conversion rule comment
| Python | apache-2.0 | mozafari/verdict,mozafari/verdict,mozafari/verdict,mozafari/verdict,mozafari/verdict | ---
+++
@@ -9,6 +9,24 @@
class ImpalaConverter(DatatypeConverterBase):
+ '''
+ Type conversion rule:
+
+ BIGINT => int,
+ BOOLEAN => bool,
+ CHAR => str,
+ DECIMAL => decimal.Decimal,
+ DOUBLE => float,
+ FLOAT ... |
f5f4397d026678570ad271e84099d2bcec541c72 | whacked4/whacked4/ui/dialogs/startdialog.py | whacked4/whacked4/ui/dialogs/startdialog.py | #!/usr/bin/env python
#coding=utf8
from whacked4 import config
from whacked4.ui import windows
class StartDialog(windows.StartDialogBase):
"""
This dialog is meant to be displayed on startup of the application. It allows the user to quickly
access some common functions without having to dig down into a m... | #!/usr/bin/env python
#coding=utf8
from whacked4 import config
from whacked4.ui import windows
class StartDialog(windows.StartDialogBase):
"""
This dialog is meant to be displayed on startup of the application. It allows the user to quickly
access some common functions without having to dig down into a m... | Clean the recent files list before displaying it in the startup dialog. | Clean the recent files list before displaying it in the startup dialog.
| Python | bsd-2-clause | GitExl/WhackEd4,GitExl/WhackEd4 | ---
+++
@@ -18,6 +18,7 @@
self.FileList.InsertColumn(0, 'Filename', width=client_width)
# Populate the list of recently accessed Dehacked patches.
+ config.settings.recent_files_clean()
recent_files = config.settings['recent_files']
for index, filename in enumerate... |
84b27afce57232bc0c8170eaad1beb26fd96eef0 | tools/gyp/find_mac_gcc_version.py | tools/gyp/find_mac_gcc_version.py | #!/usr/bin/env python
# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import re
import subprocess
import sys
def main():
job = subprocess.Popen(['xcode... | #!/usr/bin/env python
# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import re
import subprocess
import sys
def main():
job = subprocess.Popen(['xcode... | Use clang on mac if XCode >= 4.5 | Use clang on mac if XCode >= 4.5
Review URL: https://codereview.chromium.org//14333010
git-svn-id: c93d8a2297af3b929165606efe145742a534bc71@21950 260f80e4-7a28-3924-810f-c04153c831b5
| Python | bsd-3-clause | dart-archive/dart-sdk,dartino/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dart-lang/sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dartino/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dart-archive/dart-sdk,dart-lang/sdk,dart-lang/sdk,dartino/dart-sdk,dart-archive/dar... | ---
+++
@@ -21,10 +21,13 @@
major = int(matches[0][0])
minor = int(matches[0][1])
- if major >= 4:
+ if major == 3 and minor >= 1:
+ return '4.2'
+ elif major == 4 and minor < 5:
return 'com.apple.compilers.llvmgcc42'
- elif major == 3 and minor >= 1:
- return '4.2'
+ elif ... |
16742262b6a37f34bf83b3b6d6bcfd72e69276b2 | imagersite/imager_profile/models.py | imagersite/imager_profile/models.py | import six
from django.db import models
from django.contrib.auth.models import User
@six.python_2_unicode_compatible
class ImagerProfile(models.Model):
user = models.OneToOneField(User)
fav_camera = models.CharField(max_length=30)
address = models.CharField(max_length=100)
web_url = models.URLField()... | import six
from django.db import models
from django.contrib.auth.models import ActiveProfileManager, User
@six.python_2_unicode_compatible
class ImagerProfile(models.Model):
user = models.OneToOneField(
User,
nullable=False
)
fav_camera = models.CharField(
max_length=30
)
... | Make sure a user has profile | Make sure a user has profile
| Python | mit | jesseklein406/django-imager,jesseklein406/django-imager,jesseklein406/django-imager | ---
+++
@@ -1,16 +1,27 @@
import six
from django.db import models
-from django.contrib.auth.models import User
+from django.contrib.auth.models import ActiveProfileManager, User
@six.python_2_unicode_compatible
class ImagerProfile(models.Model):
- user = models.OneToOneField(User)
- fav_camera = model... |
1a089ec6f34ebf81b4437b6f541ee2b9f4b85966 | osf/migrations/0145_pagecounter_data.py | osf/migrations/0145_pagecounter_data.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-12 17:18
from __future__ import unicode_literals
from django.db import migrations, connection
def reverse_func(state, schema):
with connection.cursor() as cursor:
cursor.execute(
"""
UPDATE osf_pagecounter
... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-12 17:18
from __future__ import unicode_literals
from django.db import migrations
reverse_func = [
"""
UPDATE osf_pagecounter
SET (action, guid_id, file_id, version) = ('download', NULL, NULL, NULL);
"""
]
# Splits the data in pagecount... | Call RunSQL instead of RunPython in pagecounter data migration. | Call RunSQL instead of RunPython in pagecounter data migration.
| Python | apache-2.0 | cslzchen/osf.io,cslzchen/osf.io,Johnetordoff/osf.io,saradbowman/osf.io,felliott/osf.io,baylee-d/osf.io,mattclark/osf.io,mfraezz/osf.io,aaxelb/osf.io,felliott/osf.io,mfraezz/osf.io,brianjgeiger/osf.io,cslzchen/osf.io,CenterForOpenScience/osf.io,aaxelb/osf.io,mattclark/osf.io,adlius/osf.io,saradbowman/osf.io,adlius/osf.i... | ---
+++
@@ -1,34 +1,28 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-12 17:18
from __future__ import unicode_literals
-
-from django.db import migrations, connection
+from django.db import migrations
-def reverse_func(state, schema):
- with connection.cursor() as cursor:
- curso... |
050394cc0c228edf8ac9c3ea6f2001d36d874841 | spdypy/connection.py | spdypy/connection.py | # -*- coding: utf-8 -*-
"""
spdypy.connection
~~~~~~~~~~~~~~~~~
Contains the code necessary for working with SPDY connections.
"""
# Define some states for SPDYConnections.
NEW = 'NEW'
class SPDYConnection(object):
"""
A representation of a single SPDY connection to a remote server. This
object takes resp... | # -*- coding: utf-8 -*-
"""
spdypy.connection
~~~~~~~~~~~~~~~~~
Contains the code necessary for working with SPDY connections.
"""
# Define some states for SPDYConnections.
NEW = 'NEW'
class SPDYConnection(object):
"""
A representation of a single SPDY connection to a remote server. This
object takes res... | Define the shell of the request method. | Define the shell of the request method.
| Python | mit | Lukasa/spdypy | ---
+++
@@ -7,6 +7,7 @@
"""
# Define some states for SPDYConnections.
NEW = 'NEW'
+
class SPDYConnection(object):
"""
@@ -21,3 +22,17 @@
def __init__(self, host):
self.host = host
self._state = NEW
+
+ def request(self, method, url, body=None, headers={}):
+ """
+ Th... |
e3a298bcbe0eac1d2a0ade13244b0f3650bd6c49 | pyinfra/pseudo_modules.py | pyinfra/pseudo_modules.py | # pyinfra
# File: pyinfra/pseudo_modules.py
# Desc: essentially a hack that provides dynamic imports for the current deploy (CLI only)
import sys
import pyinfra
class PseudoModule(object):
_module = None
def __getattr__(self, key):
return getattr(self._module, key)
def __setattr__(self, key, va... | # pyinfra
# File: pyinfra/pseudo_modules.py
# Desc: essentially a hack that provides dynamic imports for the current deploy (CLI only)
import sys
import pyinfra
class PseudoModule(object):
_module = None
def __getattr__(self, key):
return getattr(self._module, key)
def __setattr__(self, key, va... | Add getitem and len support for pseudo modules. | Add getitem and len support for pseudo modules.
| Python | mit | Fizzadar/pyinfra,Fizzadar/pyinfra | ---
+++
@@ -18,8 +18,14 @@
setattr(self._module, key, value)
+ def __getitem__(self, key):
+ return self._module[key]
+
def __iter__(self):
return iter(self._module)
+
+ def __len__(self):
+ return len(self._module)
def set(self, module):
self._module = m... |
e83019f67a3c93efac27566666bcff5eb0d2a0da | examples/autopost/auto_post.py | examples/autopost/auto_post.py | import time
import sys
import os
import glob
sys.path.append(os.path.join(sys.path[0], '../../'))
from instabot import Bot
posted_pic_list = []
try:
with open('pics.txt', 'r') as f:
posted_pic_list = f.read().splitlines()
except Exception:
posted_pic_list = []
timeout = 24 * 60 * 60 # pics will be p... | import glob
import os
import sys
import time
from io import open
sys.path.append(os.path.join(sys.path[0], '../../'))
from instabot import Bot
posted_pic_list = []
try:
with open('pics.txt', 'r', encoding='utf8') as f:
posted_pic_list = f.read().splitlines()
except Exception:
posted_pic_list = []
ti... | Add utf-8 in autopost example | Add utf-8 in autopost example
| Python | apache-2.0 | instagrambot/instabot,ohld/instabot,instagrambot/instabot | ---
+++
@@ -1,14 +1,16 @@
+import glob
+import os
+import sys
import time
-import sys
-import os
-import glob
+
+from io import open
sys.path.append(os.path.join(sys.path[0], '../../'))
from instabot import Bot
posted_pic_list = []
try:
- with open('pics.txt', 'r') as f:
+ with open('pics.txt', 'r', en... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.