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 |
|---|---|---|---|---|---|---|---|---|---|---|
a31a3a9fd5f9f26bc9e06b7c682a9544f71806ad | tests/basics/dict_fromkeys.py | tests/basics/dict_fromkeys.py | d = dict.fromkeys([1, 2, 3, 4])
l = list(d.keys())
l.sort()
print(l)
d = dict.fromkeys([1, 2, 3, 4], 42)
l = list(d.values())
l.sort()
print(l)
| d = dict.fromkeys([1, 2, 3, 4])
l = list(d.keys())
l.sort()
print(l)
d = dict.fromkeys([1, 2, 3, 4], 42)
l = list(d.values())
l.sort()
print(l)
# argument to fromkeys is a generator
d = dict.fromkeys(i + 1 for i in range(1))
print(d)
| Add test for dict.fromkeys where arg is a generator. | tests/basics: Add test for dict.fromkeys where arg is a generator.
Improves coverage because it tests the case where the arg does not have a
__len__ slot.
| Python | mit | AriZuu/micropython,toolmacher/micropython,deshipu/micropython,infinnovation/micropython,swegener/micropython,adafruit/micropython,adafruit/micropython,TDAbboud/micropython,torwag/micropython,hiway/micropython,MrSurly/micropython,TDAbboud/micropython,trezor/micropython,cwyark/micropython,swegener/micropython,pozetroninc... | ---
+++
@@ -8,3 +8,6 @@
l.sort()
print(l)
+# argument to fromkeys is a generator
+d = dict.fromkeys(i + 1 for i in range(1))
+print(d) |
9ee301c525600cfeb8b8ca3d59f75ff9b7823008 | test/buildbot/buildbot_config/master/schedulers.py | test/buildbot/buildbot_config/master/schedulers.py | """
This module contains the logic which returns the set of
schedulers to use for the build master.
"""
from buildbot.changes.filter import ChangeFilter
from buildbot.schedulers.basic import SingleBranchScheduler
def get_schedulers():
# Run the unit tests for master
master_unit = SingleBranchScheduler(name="f... | """
This module contains the logic which returns the set of
schedulers to use for the build master.
"""
from buildbot.changes.filter import ChangeFilter
from buildbot.schedulers.basic import (
Dependent,
SingleBranchScheduler)
def get_schedulers():
# Run the unit tests for master
master_unit = SingleB... | Make the acceptance tests dependent on the unit tests passing | Buildbot: Make the acceptance tests dependent on the unit tests passing
| Python | mit | zsjohny/vagrant,bheuvel/vagrant,lonniev/vagrant,dharmab/vagrant,petems/vagrant,tjanez/vagrant,senglin/vagrant,benh57/vagrant,lonniev/vagrant,tomfanning/vagrant,cgvarela/vagrant,gpkfr/vagrant,krig/vagrant,philoserf/vagrant,philwrenn/vagrant,modulexcite/vagrant,tschortsch/vagrant,bmhatfield/vagrant,mitchellh/vagrant,tbar... | ---
+++
@@ -4,13 +4,19 @@
"""
from buildbot.changes.filter import ChangeFilter
-from buildbot.schedulers.basic import SingleBranchScheduler
+from buildbot.schedulers.basic import (
+ Dependent,
+ SingleBranchScheduler)
def get_schedulers():
# Run the unit tests for master
- master_unit = SingleBr... |
727939269aef168513ad6d62913e20f0af95b4e6 | dduplicated/hashs.py | dduplicated/hashs.py | import hashlib
import os
def get_hash(path):
return get_md5(path)
def get_md5(path):
hash_md5 = hashlib.md5()
if os.path.isfile(path):
with open(path, "rb") as file:
while True:
buffer = file.read(4096)
if not buffer:
break
hash_md5.update(buffer)
return hash_md5.hexdigest()
| import hashlib
import os
def get_hash(path):
return get_md5(path)
# MD5 methods is based on second answer from: https://exceptionshub.com/get-md5-hash-of-big-files-in-python.html
def get_md5(path):
hash_md5 = hashlib.md5()
if os.path.isfile(path):
with open(path, "rb") as file:
while True:
buffer = file.re... | Add reference to md5 method. | Add reference to md5 method. | Python | mit | messiasthi/dduplicated-cli | ---
+++
@@ -3,7 +3,7 @@
def get_hash(path):
return get_md5(path)
-
+# MD5 methods is based on second answer from: https://exceptionshub.com/get-md5-hash-of-big-files-in-python.html
def get_md5(path):
hash_md5 = hashlib.md5()
if os.path.isfile(path): |
9cc3cf8a2911fedce7f08d2412388154c24a9ed1 | engine.py | engine.py | # Use x, y coords for unit positions
# (97, 56) ... (104, 56)
# ... ...
# (97, 49) ... (104, 49)
#
# Algebraic notation for a position is:
# algebraic_pos = chr(x) + chr(y)
def _coord_to_algebraic(coord):
x, y = coord
return chr(x) + chr(y)
def _algebraic_to_coord(algebraic):
x, y = algebrai... | # Use x, y coords for unit positions
# (97, 56) ... (104, 56)
# ... ...
# (97, 49) ... (104, 49)
#
# Algebraic notation for a position is:
# algebraic_pos = chr(x) + chr(y)
def _coord_to_algebraic(coord):
x, y = coord
return chr(x) + chr(y)
def _algebraic_to_coord(algebraic):
x, y = algebrai... | Add Piece() to serve as the parent class for all chess pieces | Add Piece() to serve as the parent class for all chess pieces
| Python | mit | EyuelAbebe/gamer,EyuelAbebe/gamer | ---
+++
@@ -24,3 +24,14 @@
return True
else:
return False
+
+
+class Piece(object):
+ """Parent class for chess pieces."""
+ def __init__(self, pos):
+ """Instantiate a piece at a coordinate position."""
+ super(Piece, self).__init__()
+ if isinstance(pos, str):
+ ... |
3784b04109b2ca92633a788cc02562898064282c | factor.py | factor.py | import numpy as np
def LU(A):
m = A.shape[0]
U = A.copy()
L = np.eye( m )
for j in range(m):
for i in range(j+1,m):
L[i,j] = U[i,j]/U[j,j]
U[i,:] -= L[i,j]*U[j,:]
return L, U
| import numpy as np
def LU(A):
r"""Factor a square matrix by Gaussian elimination.
The argument A should be a square matrix (an m-by-m numpy array).
The outputs L and U are also m-by-m. L is lower-triangular with
unit diagonal entries and U is strictly upper-triangular.
This impl... | Add docstring, with an example. | Add docstring, with an example.
| Python | bsd-2-clause | ketch/rock-solid-code-demo | ---
+++
@@ -1,6 +1,39 @@
import numpy as np
def LU(A):
+ r"""Factor a square matrix by Gaussian elimination.
+
+ The argument A should be a square matrix (an m-by-m numpy array).
+
+ The outputs L and U are also m-by-m. L is lower-triangular with
+ unit diagonal entries and U is strictly ... |
e26a49220835cd3df14820be7b400dc045092bb9 | examples/load_ui_base_instance.py | examples/load_ui_base_instance.py | import sys
import os
os.environ["QT_PREFERRED_BINDING"] = "PySide"
from Qt import QtWidgets, load_ui
def setup_ui(uifile, base_instance=None):
ui = load_ui(uifile)
if not base_instance:
return ui
else:
for member in dir(ui):
if not member.startswith('__') and \
... | import sys
import os
# Set preferred binding
# os.environ["QT_PREFERRED_BINDING"] = "PySide"
from Qt import QtWidgets, load_ui
def setup_ui(uifile, base_instance=None):
ui = load_ui(uifile)
if not base_instance:
return ui
else:
for member in dir(ui):
if not member.startswith(... | Remove preffered binding, use obj.__class__ instead of type() | Remove preffered binding, use obj.__class__ instead of type()
| Python | mit | mottosso/Qt.py,fredrikaverpil/Qt.py,mottosso/Qt.py,fredrikaverpil/Qt.py | ---
+++
@@ -1,7 +1,9 @@
import sys
import os
-os.environ["QT_PREFERRED_BINDING"] = "PySide"
+# Set preferred binding
+# os.environ["QT_PREFERRED_BINDING"] = "PySide"
+
from Qt import QtWidgets, load_ui
@@ -30,9 +32,9 @@
window = MainWindow()
# Tests
- assert isinstance(window.__class__, type(Q... |
07517c43b3d61431e8c7c40ea5e8b545b353bee4 | imagersite/imagersite/urls.py | imagersite/imagersite/urls.py | """imagersite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... | """imagersite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... | Add static url to urlconf | Add static url to urlconf
| Python | mit | jesseklein406/django-imager,jesseklein406/django-imager,jesseklein406/django-imager | ---
+++
@@ -14,8 +14,16 @@
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
+from django.conf.urls.static import static
from django.contrib import admin
+from django.conf import settings
urlpatterns = [
url(r'^admin/', include(admin.site.ur... |
1975b33b5f251198b59a772a38b6302fbea89017 | tests/test_create_template.py | tests/test_create_template.py | # -*- coding: utf-8 -*-
"""
test_create_template
--------------------
"""
import os
import pytest
import subprocess
def run_tox(plugin):
"""Run the tox suite of the newly created plugin."""
try:
subprocess.check_call([
'tox',
plugin,
'-c', os.path.join(plugin, 't... | # -*- coding: utf-8 -*-
"""
test_create_template
--------------------
"""
import os
import pytest
import subprocess
def run_tox(plugin):
"""Run the tox suite of the newly created plugin."""
try:
subprocess.check_call([
'tox',
plugin,
'-c', os.path.join(plugin, 't... | Extend test to check for the exit code and for an exception | Extend test to check for the exit code and for an exception
| Python | mit | pytest-dev/cookiecutter-pytest-plugin | ---
+++
@@ -28,6 +28,8 @@
"""Create a new plugin via cookiecutter and run its tests."""
result = cookies.bake()
+ assert result.exit_code == 0
+ assert result.exception is None
assert result.project.basename == 'pytest-foobar'
assert result.project.isdir()
|
36213a31a1870cf38ec0ce3d208c6a2072e2b133 | acapi/tests/test_client.py | acapi/tests/test_client.py | import os
import requests
import requests_mock
import unittest
from .. import Client
@requests_mock.Mocker()
class TestClient(unittest.TestCase):
"""Tests the Acquia Cloud API client class."""
req = None
"""
def setup(self, ):
" ""
Set up the tests with the mock requests ... | import os
import requests
import requests_mock
import unittest
from .. import Client
from ..exceptions import AcquiaCloudException
@requests_mock.Mocker()
class TestClient(unittest.TestCase):
"""Tests the Acquia Cloud API client class."""
req = None
"""
def setup(self, ):
" ""
... | Add test for failing to find credentials | Add test for failing to find credentials
| Python | mit | skwashd/python-acquia-cloud | ---
+++
@@ -4,6 +4,7 @@
import unittest
from .. import Client
+from ..exceptions import AcquiaCloudException
@requests_mock.Mocker()
class TestClient(unittest.TestCase):
@@ -32,6 +33,17 @@
self.assertEqual(user, 'user')
self.assertEqual(token, 'token')
+ def test_find_credentials_none_s... |
ee24b8b57bc73947cd5140aca15389861b33ab00 | gui/qt.py | gui/qt.py | from lib.version import AMON_VERSION
from lib.keybase import KeybaseUser
from lib.gmail import GmailUser
from lib.addresses import AddressBook
import lib.gpg as gpg
import sys
import logging
import json
from PyQt4 import QtGui
class Amon(QtGui.QMainWindow):
def __init__(self):
super(Amon, self).__init__(... | from lib.version import AMON_VERSION
from lib.keybase import KeybaseUser
from lib.gmail import GmailUser
from lib.addresses import AddressBook
import lib.gpg as gpg
import sys
import logging
import json
from PyQt4 import QtGui
class Amon(QtGui.QMainWindow):
def __init__(self):
super(Amon, self).__init__(... | Update Qt gui to have status bar and menu bar | Update Qt gui to have status bar and menu bar
| Python | unlicense | CodingAnarchy/Amon | ---
+++
@@ -16,3 +16,30 @@
self.keybase_user = KeybaseUser()
self.gmail = GmailUser()
self.address_book = AddressBook()
+
+ self.initUI()
+
+ def initUI(self):
+ exitAction = QtGui.QAction(QtGui.QIcon('exit.png'), '&Exit', self)
+ exitAction.setShortcut('Ctrl+Q')
+ ... |
6226d620078089b961fa2782d1bddb99534485ba | bin/system-info.py | bin/system-info.py | #!/usr/bin/env python
"""
System information for Tmux status line
Author: Roman Belikin roman[dot]sstu[at]gmail.com
"""
import os
import sys
import psutil
def info():
mem = psutil.virtual_memory()
return "mem >> %s/%sMB cpu >> %s%%" % (
str(int(mem.used / 1024 / 1024)),
str(int(mem.total / ... | #!/usr/bin/env python
"""
System information for Tmux status line
Author: Roman Belikin roman[dot]sstu[at]gmail.com
"""
import os
import sys
import psutil
def info():
mem = psutil.virtual_memory()
return "mem >> %s/%sMB cpu >> %s%% " % (
str(int(mem.used / 1024 / 1024)),
str(int(mem.total /... | Add space at left statusbar message | Add space at left statusbar message
| Python | mit | emmit8/dotfiles,emmit8/dotfiles,emmit8/dotfiles,trippyroman/dotfiles,trippyroman/dotfiles,trippyroman/dotfiles | ---
+++
@@ -13,7 +13,7 @@
def info():
mem = psutil.virtual_memory()
- return "mem >> %s/%sMB cpu >> %s%%" % (
+ return "mem >> %s/%sMB cpu >> %s%% " % (
str(int(mem.used / 1024 / 1024)),
str(int(mem.total / 1024 / 1024)),
psutil.cpu_percent(interval=0.1), |
d5d2bff8ad68f6a3d743d9eb80b26d6d0bba4a0f | bluebottle/events/tasks.py | bluebottle/events/tasks.py | from celery.schedules import crontab
from celery.task import periodic_task
from django.utils.timezone import now
from bluebottle.clients.models import Client
from bluebottle.clients.utils import LocalTenant
import logging
from bluebottle.events.models import Event
logger = logging.getLogger('bluebottle')
@periodic... | from celery.schedules import crontab
from celery.task import periodic_task
from django.utils.timezone import now
from bluebottle.clients.models import Client
from bluebottle.clients.utils import LocalTenant
import logging
from bluebottle.events.models import Event
logger = logging.getLogger('bluebottle')
@periodic... | Check once every 15 minutes | Check once every 15 minutes
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -12,7 +12,7 @@
@periodic_task(
- run_every=(crontab(minute='*/1')),
+ run_every=(crontab(minute='*/15')),
name="check_event_start",
ignore_result=True
)
@@ -32,7 +32,7 @@
@periodic_task(
- run_every=(crontab(minute='*/1')),
+ run_every=(crontab(minute='*/15')),
name="c... |
fb1a5f892e684143cd254447b5e1607a4b9e2c03 | blaze/io/_printing/array_repr.py | blaze/io/_printing/array_repr.py | from __future__ import absolute_import, division, print_function
from . import _arrayprint
from ...datadescriptor import RemoteDataDescriptor
def array_repr(a):
# TODO: create a mechanism for data descriptor to override
# printing.
if isinstance(a._data, RemoteDataDescriptor):
body = 'Remot... | from __future__ import absolute_import, division, print_function
from . import _arrayprint
from ...datadescriptor import RemoteDataDescriptor
def array_repr(a):
pre = 'array('
post = ',\n' + ' '*len(pre) + "dshape='" + str(a.dshape) + "'" + ')'
# TODO: create a mechanism for data descriptor to override
... | Revert repr change, it looks worse for small example arrays | Revert repr change, it looks worse for small example arrays
| Python | bsd-3-clause | xlhtc007/blaze,cowlicks/blaze,alexmojaki/blaze,FrancescAlted/blaze,maxalbert/blaze,mrocklin/blaze,dwillmer/blaze,ContinuumIO/blaze,nkhuyu/blaze,jdmcbr/blaze,jcrist/blaze,FrancescAlted/blaze,aterrel/blaze,AbhiAgarwal/blaze,AbhiAgarwal/blaze,alexmojaki/blaze,mwiebe/blaze,dwillmer/blaze,AbhiAgarwal/blaze,maxalbert/blaze,j... | ---
+++
@@ -5,18 +5,16 @@
def array_repr(a):
+ pre = 'array('
+ post = ',\n' + ' '*len(pre) + "dshape='" + str(a.dshape) + "'" + ')'
+
# TODO: create a mechanism for data descriptor to override
# printing.
if isinstance(a._data, RemoteDataDescriptor):
body = 'RemoteDataDescrip... |
7dced29bcf8b2b5f5220f5dbfeaf631d9d5fc409 | examples/backtest.py | examples/backtest.py | import time
import logging
from pythonjsonlogger import jsonlogger
from flumine import FlumineBacktest, clients
from strategies.lowestlayer import LowestLayer
logger = logging.getLogger()
custom_format = "%(asctime) %(levelname) %(message)"
log_handler = logging.StreamHandler()
formatter = jsonlogger.JsonFormatter(c... | import time
import logging
from pythonjsonlogger import jsonlogger
from flumine import FlumineBacktest, clients
from strategies.lowestlayer import LowestLayer
logger = logging.getLogger()
custom_format = "%(asctime) %(levelname) %(message)"
log_handler = logging.StreamHandler()
formatter = jsonlogger.JsonFormatter(c... | Comment to say using logging.CRITICAL is faster | Comment to say using logging.CRITICAL is faster
| Python | mit | liampauling/flumine | ---
+++
@@ -13,7 +13,7 @@
formatter.converter = time.gmtime
log_handler.setFormatter(formatter)
logger.addHandler(log_handler)
-logger.setLevel(logging.INFO)
+logger.setLevel(logging.INFO) # Set to logging.CRITICAL to speed up backtest
client = clients.BacktestClient()
|
245628bf53bf7255ccd5aa15d21ff8c1f5751ef8 | examples/listdevs.py | examples/listdevs.py | #!/usr/bin/env python
import usb1
def main():
context = usb1.USBContext()
for device in context.getDeviceList(skip_on_error=True):
print str(device)
if __name__ == '__main__':
main()
| #!/usr/bin/env python
import usb1
def main():
context = usb1.USBContext()
for device in context.getDeviceList(skip_on_error=True):
print 'ID %04x:%04x' % (device.getVendorID(), device.getProductID()), '->'.join(str(x) for x in ['Bus %03i' % (device.getBusNumber(), )] + device.getPortNumberList()), 'Dev... | Modify listdev to exercise getPortNumberList . | examples: Modify listdev to exercise getPortNumberList .
| Python | lgpl-2.1 | vpelletier/python-libusb1,vpelletier/python-libusb1 | ---
+++
@@ -4,7 +4,7 @@
def main():
context = usb1.USBContext()
for device in context.getDeviceList(skip_on_error=True):
- print str(device)
+ print 'ID %04x:%04x' % (device.getVendorID(), device.getProductID()), '->'.join(str(x) for x in ['Bus %03i' % (device.getBusNumber(), )] + device.getP... |
0668a4bba21e44a028cb008b03165f63eba5b457 | acute/models.py | acute/models.py | """
acute models.
"""
from django.db.models import fields
from opal import models
class Demographics(models.Demographics): pass
class Location(models.Location): pass
class Allergies(models.Allergies): pass
class Diagnosis(models.Diagnosis): pass
class PastMedicalHistory(models.PastMedicalHistory): pass
class Treatmen... | """
acute models.
"""
from django.db.models import fields
from opal import models
class Demographics(models.Demographics): pass
class Location(models.Location): pass
class Allergies(models.Allergies): pass
class Diagnosis(models.Diagnosis): pass
class PastMedicalHistory(models.PastMedicalHistory): pass
class Treatmen... | Rename Clerking -> Seen by | Rename Clerking -> Seen by
closes #1
| Python | agpl-3.0 | openhealthcare/acute,openhealthcare/acute,openhealthcare/acute | ---
+++
@@ -15,6 +15,7 @@
class Clerking(models.EpisodeSubrecord):
_icon = 'fa fa-user'
+ _title = 'Seen by'
referrer = fields.CharField(max_length=200, blank=True, null=True)
clerked_by = fields.CharField(max_length=200, blank=True, null=True) |
eb606f58b695dbb215b46cec3c895045e811bbad | scanpointgenerator/maskedgenerator.py | scanpointgenerator/maskedgenerator.py |
class Factory(object):
def __init__(self, generator, roi):
self.generator = generator
self.roi = roi
def iterator(self):
for point in self.generator.iterator():
if self.roi.contains_point(point):
yield point
|
class MaskedGenerator(object):
def __init__(self, generator, roi):
self.generator = generator
self.roi = roi
def iterator(self):
for point in self.generator.iterator():
if self.roi.contains_point(point):
yield point
| Rename Factory class to MaskedGenerator | Rename Factory class to MaskedGenerator
| Python | apache-2.0 | dls-controls/scanpointgenerator | ---
+++
@@ -1,6 +1,6 @@
-class Factory(object):
+class MaskedGenerator(object):
def __init__(self, generator, roi):
|
861d4f9773193a03d1f53c6e0c3f78d48b096d45 | juliet_importer.py | juliet_importer.py | import os
class loader:
modules = {};
def __init__(self):
self.load_modules();
def load_modules(self, path="./modules/"): # Consider adding recursive sorting at some point in the future
names = os.listdir(path);
pwd = os.getcwd();
os.chdir(path);
for name in names:... | import os
import imp
modules = {}
def load_modules(path="./modules/"): # Consider adding recursive sorting at some point in the future
names = os.listdir(path)
for name in names:
if not name.endswith(".py"): continue
print("Importing module {0}".format(name))
name = name.split('.')[0]
... | Remove superfluous class from importer | Remove superfluous class from importer
| Python | bsd-2-clause | halfbro/juliet | ---
+++
@@ -1,23 +1,21 @@
import os
+import imp
-class loader:
- modules = {};
+modules = {}
- def __init__(self):
- self.load_modules();
+def load_modules(path="./modules/"): # Consider adding recursive sorting at some point in the future
+ names = os.listdir(path)
+ for name in names:
+ ... |
99592279585c27ad2c41f50d49c1e3264173eae6 | actions/actions.py | actions/actions.py | #!/usr/bin/python
import sys
import os
sys.path.append('hooks/')
import subprocess
from charmhelpers.core.hookenv import action_fail
from utils import (
pause_unit,
resume_unit,
)
def pause(args):
"""Pause the Ceilometer services.
@raises Exception should the service fail to stop.
"""
pause_un... | #!/usr/bin/python
import sys
import os
sys.path.append('hooks/')
import subprocess
from charmhelpers.core.hookenv import action_fail
from utils import (
pause_unit,
resume_unit,
)
def pause(args):
"""Pause the hacluster services.
@raises Exception should the service fail to stop.
"""
pause_uni... | Fix copy and pasta error | Fix copy and pasta error | Python | apache-2.0 | CanonicalBootStack/charm-hacluster,CanonicalBootStack/charm-hacluster,CanonicalBootStack/charm-hacluster | ---
+++
@@ -11,13 +11,13 @@
)
def pause(args):
- """Pause the Ceilometer services.
+ """Pause the hacluster services.
@raises Exception should the service fail to stop.
"""
pause_unit()
def resume(args):
- """Resume the Ceilometer services.
+ """Resume the hacluster services.
@r... |
16945303e5092bbd37f914ea10936d95e054f703 | harvesting_blog_data.py | harvesting_blog_data.py | import os
import sys
import json
import feedparser
from bs4 import BeautifulSoup
FEED_URL = 'http://g1.globo.com/dynamo/rss2.xml'
def cleanHtml(html):
return BeautifulSoup(html, 'lxml').get_text()
fp = feedparser.parse(FEED_URL)
print "Fetched %s entries from '%s'" % (len(fp.entries[0].title), fp.feed.title)
b... | # -*- coding: UTF-8 -*-
import os
import sys
import json
import feedparser
from bs4 import BeautifulSoup
FEED_URL = 'http://g1.globo.com/dynamo/rss2.xml'
fp = feedparser.parse(FEED_URL)
print "Fetched %s entries from '%s'" % (len(fp.entries[0].title), fp.feed.title)
blog_posts = []
for e in fp.entries:
blog_po... | Add G1 example and utf-8 | Add G1 example and utf-8
| Python | apache-2.0 | fabriciojoc/redes-sociais-web,fabriciojoc/redes-sociais-web | ---
+++
@@ -1,3 +1,5 @@
+# -*- coding: UTF-8 -*-
+
import os
import sys
import json
@@ -5,9 +7,6 @@
from bs4 import BeautifulSoup
FEED_URL = 'http://g1.globo.com/dynamo/rss2.xml'
-
-def cleanHtml(html):
- return BeautifulSoup(html, 'lxml').get_text()
fp = feedparser.parse(FEED_URL)
@@ -17,13 +16,13 @@
... |
bb045a6be1deacb1ee1c0e8746079ae77ec906f0 | admin/base/wsgi.py | admin/base/wsgi.py | """
WSGI config for api project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
from website import settings
if not settings.DEBUG_MODE:
from gevent import monkey
monkey.pat... | """
WSGI config for api project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
from website import settings
if not settings.DEBUG_MODE:
from gevent import monkey
monkey.pat... | Patch psycopg correctly in admin | Patch psycopg correctly in admin
[skip ci]
| Python | apache-2.0 | caseyrollins/osf.io,mattclark/osf.io,Nesiehr/osf.io,acshi/osf.io,laurenrevere/osf.io,pattisdr/osf.io,cwisecarver/osf.io,acshi/osf.io,felliott/osf.io,felliott/osf.io,adlius/osf.io,pattisdr/osf.io,Nesiehr/osf.io,erinspace/osf.io,cslzchen/osf.io,chennan47/osf.io,crcresearch/osf.io,HalcyonChimera/osf.io,felliott/osf.io,Joh... | ---
+++
@@ -13,7 +13,10 @@
monkey.patch_all()
# PATCH: avoid deadlock on getaddrinfo, this patch is necessary while waiting for
# the final gevent 1.1 release (https://github.com/gevent/gevent/issues/349)
- unicode('foo').encode('idna') # noqa
+ # unicode('foo').encode('idna') # noqa
+
+ fro... |
9c2951d794bb27952606cae77da1ebcd0d651e72 | aiodownload/api.py | aiodownload/api.py | # -*- coding: utf-8 -*-
from aiodownload import AioDownloadBundle, AioDownload
import asyncio
def one(url, download=None):
return [s for s in swarm([url], download=download)][0]
def swarm(urls, download=None):
return [e for e in each(urls, download=download)]
def each(iterable, url_map=None, download=N... | # -*- coding: utf-8 -*-
from aiodownload import AioDownloadBundle, AioDownload
import asyncio
def one(url, download=None):
return [s for s in swarm([url], download=download)][0]
def swarm(urls, download=None):
return [e for e in each(urls, download=download)]
def each(iterable, url_map=None, download=N... | Fix - needed to provide create_task a function, not a class | Fix - needed to provide create_task a function, not a class
| Python | mit | jelloslinger/aiodownload | ---
+++
@@ -25,7 +25,7 @@
info = None if i == url else i
tasks.append(
download._loop.create_task(
- AioDownload(url, info=info)
+ download.main(AioDownloadBundle(url, info=info))
)
)
|
633f84411e26201233e3c68c584b236363f79f62 | server/conf/vhosts/available/token.py | server/conf/vhosts/available/token.py | import core.provider.authentication as authentication
import core.notify.dispatcher as notify
import core.notify.plugins.available.changes as changes
import core.provider.storage as storage
import core.resource.base as resource
import conf.vhosts.available.default as default
class VHost(default.VHost):
host = ['lo... | import core.provider.authentication as authentication
import core.notify.dispatcher as notify
import core.notify.plugins.available.changes as changes
import core.provider.storage as storage
import core.resource.base as resource
import conf.vhosts.available.default as default
class VHost(default.VHost):
host = ['lo... | Allow access to root leaves. | Allow access to root leaves.
| Python | mit | slaff/attachix,slaff/attachix,slaff/attachix | ---
+++
@@ -26,6 +26,11 @@
xsltResource.isLeaf = True
self.root.children['~static'].putChild('propfind.xslt', xsltResource)
+ leaves = {}
+ for path, child in self.root.children.items():
+ if child.isLeaf == True:
+ leaves[path] = child
+
tree = res... |
7da1326848cba8ff7bf61dde4583a12e5bad8ae2 | centinel/backend.py | centinel/backend.py | import requests
import config
def get_recommended_versions():
return request("/versions")
def get_experiments():
return request("/experiments")
def get_results():
return request("/results")
def get_clients():
return request("/clients")
def request(slug):
url = "%s%s" % (config.server_url, slug)... | import requests
import config
def request(slug):
url = "%s%s" % (config.server_url, slug)
req = requests.get(url)
if req.status_code != requests.codes.ok:
raise req.raise_for_status()
return req.json()
def get_recommended_versions():
return request("/versions")
def get_experiments():
... | Raise exception if status code is not ok | Raise exception if status code is not ok
| Python | mit | JASONews/centinel,iclab/centinel,lianke123321/centinel,lianke123321/centinel,Ashish1805/centinel,rpanah/centinel,rpanah/centinel,ben-jones/centinel,iclab/centinel,lianke123321/centinel,iclab/centinel,rpanah/centinel | ---
+++
@@ -1,5 +1,14 @@
import requests
import config
+
+def request(slug):
+ url = "%s%s" % (config.server_url, slug)
+ req = requests.get(url)
+
+ if req.status_code != requests.codes.ok:
+ raise req.raise_for_status()
+
+ return req.json()
def get_recommended_versions():
return reques... |
5225392a305e8e83a5a0fae91d3c2090914f2e5c | resolwe/flow/executors/docker.py | resolwe/flow/executors/docker.py | """Local workflow executor"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import shlex
import subprocess
from django.conf import settings
from .local import FlowExecutor as LocalFlowExecutor
class FlowExecutor(LocalFlowExecutor):
def start(self):
contain... | """Local workflow executor"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import random
import shlex
import subprocess
from django.conf import settings
from .local import FlowExecutor as LocalFlowExecutor
class FlowExecutor(LocalFlowExecutor):
def start(self):
... | Set random container name for tests | Set random container name for tests
| Python | apache-2.0 | jberci/resolwe,jberci/resolwe,genialis/resolwe,genialis/resolwe | ---
+++
@@ -2,6 +2,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals
import os
+import random
import shlex
import subprocess
@@ -13,8 +14,17 @@
class FlowExecutor(LocalFlowExecutor):
def start(self):
container_image = settings.FLOW_EXECUTOR['CONTAINER_IMAGE... |
304a7da03072dbe6e099bbda37fb8aca0567e64b | organizer/models.py | organizer/models.py | from django.db import models
# Model Field Reference
# https://docs.djangoproject.com/en/1.8/ref/models/fields/
class Tag(models.Model):
name = models.CharField(max_length=31)
slug = models.SlugField()
class Startup(models.Model):
name = models.CharField(max_length=31)
slug = models.SlugField()
... | from django.db import models
# Model Field Reference
# https://docs.djangoproject.com/en/1.8/ref/models/fields/
class Tag(models.Model):
name = models.CharField(max_length=31)
slug = models.SlugField()
class Startup(models.Model):
name = models.CharField(max_length=31)
slug = models.SlugField()
... | Define Startup model related fields. | Ch03: Define Startup model related fields. [skip ci]
https://docs.djangoproject.com/en/1.8/ref/models/fields/#manytomanyfield
A many-to-many relationship allows for different models to be related
to many of the other. For instance, students may take many classes, and
classes are taught to many students. In our co... | Python | bsd-2-clause | jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8 | ---
+++
@@ -17,6 +17,7 @@
founded_date = models.DateField()
contact = models.EmailField()
website = models.URLField()
+ tags = models.ManyToManyField(Tag)
class NewsLink(models.Model): |
d0bea0fa49eb6c70f4c014d210fddf3a3a500ce6 | ci/testsettings.py | ci/testsettings.py | # This file is exec'd from settings.py, so it has access to and can
# modify all the variables in settings.py.
# If this file is changed in development, the development server will
# have to be manually restarted because changes will not be noticed
# immediately.
DEBUG = False
# disable compression for tests that ch... | # This file is exec'd from settings.py, so it has access to and can
# modify all the variables in settings.py.
# If this file is changed in development, the development server will
# have to be manually restarted because changes will not be noticed
# immediately.
DEBUG = False
# disable compression for tests that ch... | Update travis-ci settings to use local backend with range queries | Update travis-ci settings to use local backend with range queries
| Python | apache-2.0 | Princeton-CDH/derrida-django,Princeton-CDH/derrida-django,Princeton-CDH/derrida-django,Princeton-CDH/derrida-django | ---
+++
@@ -29,7 +29,7 @@
# must be defined for initial setup
HAYSTACK_CONNECTIONS = {
'default': {
- 'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
+ 'ENGINE': 'derrida.common.solr_backend.RangeSolrEngine',
'URL': 'http://127.0.0.1:8983/solr/test-derrida',
'ADMIN_URL': ... |
748e2e51a9ead7be4047e112aad2ed07a3d7a2c9 | systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py | systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Check both ip and hosts when building dhcp bag | Check both ip and hosts when building dhcp bag
| Python | apache-2.0 | GabrielBrascher/cloudstack,resmo/cloudstack,resmo/cloudstack,resmo/cloudstack,jcshen007/cloudstack,GabrielBrascher/cloudstack,wido/cloudstack,wido/cloudstack,DaanHoogland/cloudstack,wido/cloudstack,wido/cloudstack,GabrielBrascher/cloudstack,DaanHoogland/cloudstack,resmo/cloudstack,DaanHoogland/cloudstack,wido/cloudstac... | ---
+++
@@ -21,6 +21,7 @@
def merge(dbag, data):
+ search(dbag, data['host_name'])
# A duplicate ip address wil clobber the old value
# This seems desirable ....
if "add" in data and data['add'] is False and \
@@ -31,3 +32,18 @@
else:
dbag[data['ipv4_adress']] = data
return d... |
855724c4e52a55d141e2ef72cf7181710fb33d44 | dwitter/user/urls.py | dwitter/user/urls.py | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^(?P<url_username>[a-z0-9]*)$', views.user_feed, {'page_nr':'1'}, name='user_feed'),
url(r'^(?P<url_username>[a-z0-9]*)/(?P<page_nr>\d+)$', views.user_feed, name='user_feed_page'),
]
| from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^(?P<url_username>\w+)$', views.user_feed, {'page_nr':'1'}, name='user_feed'),
url(r'^(?P<url_username>\w+)/(?P<page_nr>\d+)$', views.user_feed, name='user_feed_page'),
]
| Fix error when usernames have capital characters | Fix error when usernames have capital characters
| Python | apache-2.0 | lionleaf/dwitter,lionleaf/dwitter,lionleaf/dwitter | ---
+++
@@ -3,6 +3,6 @@
from . import views
urlpatterns = [
- url(r'^(?P<url_username>[a-z0-9]*)$', views.user_feed, {'page_nr':'1'}, name='user_feed'),
- url(r'^(?P<url_username>[a-z0-9]*)/(?P<page_nr>\d+)$', views.user_feed, name='user_feed_page'),
+ url(r'^(?P<url_username>\w+)$', views.us... |
fccc3be65ee5b82c8ac4f4810193ecaa7c6aed6c | backend/unichat/helpers.py | backend/unichat/helpers.py | from .models import School, User
import re
from django.contrib.auth.models import User as Django_User
from django.contrib.auth.hashers import make_password
def get_school_list():
schools = School.objects.all()
school_list = []
for s in schools:
school = {}
school['id'] = s.id
schoo... | from .models import School, User
import re
def get_school_list():
schools = School.objects.all()
school_list = []
for s in schools:
school = {}
school['id'] = s.id
school['name'] = s.name
school['site'] = s.site
school['university'] = s.university.name
schoo... | Change create_user helper with new User model | Change create_user helper with new User model
| Python | mit | dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet | ---
+++
@@ -1,7 +1,5 @@
from .models import School, User
import re
-from django.contrib.auth.models import User as Django_User
-from django.contrib.auth.hashers import make_password
def get_school_list():
@@ -27,9 +25,8 @@
def create_user(email, school):
- password = Django_User.objects.make_random_pas... |
2a72b26f63c81e3ceb64d8fd920f3a1327aa0e13 | cookiecutter/vcs.py | cookiecutter/vcs.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cookiecutter.vcs
----------------
Helper functions for working with version control systems.
"""
import logging
import os
import shutil
import subprocess
import sys
from .prompt import query_yes_no
def git_clone(repo, checkout=None):
"""
Clone a git repo t... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cookiecutter.vcs
----------------
Helper functions for working with version control systems.
"""
import logging
import os
import shutil
import subprocess
import sys
from .prompt import query_yes_no
def git_clone(repo, checkout=None):
"""
Clone a git repo t... | Use subprocess instead of os.system to git clone. | Use subprocess instead of os.system to git clone.
| Python | bsd-3-clause | atlassian/cookiecutter,benthomasson/cookiecutter,luzfcb/cookiecutter,drgarcia1986/cookiecutter,moi65/cookiecutter,alex/cookiecutter,tylerdave/cookiecutter,drgarcia1986/cookiecutter,Vauxoo/cookiecutter,cguardia/cookiecutter,vintasoftware/cookiecutter,cichm/cookiecutter,agconti/cookiecutter,lgp171188/cookiecutter,nhomar/... | ---
+++
@@ -40,7 +40,7 @@
else:
sys.exit()
- os.system('git clone {0}'.format(repo))
+ subprocess.check_call(['git', 'clone', repo], cwd='.')
if checkout is not None:
subprocess.check_call(['git', 'checkout', checkout], cwd=repo_dir) |
93a7616d949494888f5357f5491aa3278e7de234 | cupy/logic/truth.py | cupy/logic/truth.py | import cupy
def all(a, axis=None, out=None, keepdims=False):
assert isinstance(a, cupy.ndarray)
return a.all(axis=axis, out=out, keepdims=keepdims)
def any(a, axis=None, out=None, keepdims=False):
assert isinstance(a, cupy.ndarray)
return a.any(axis=axis, out=out, keepdims=keepdims)
| import cupy
def all(a, axis=None, out=None, keepdims=False):
"""Tests whether all array elements along a given axis evaluate to True.
Args:
a (cupy.ndarray): Input array.
axis (int or tuple of ints): Along which axis to compute all.
The flattened array is used by default.
... | Add documents of cupy.all and cupy.any function | Add documents of cupy.all and cupy.any function
| Python | mit | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | ---
+++
@@ -2,10 +2,42 @@
def all(a, axis=None, out=None, keepdims=False):
+ """Tests whether all array elements along a given axis evaluate to True.
+
+ Args:
+ a (cupy.ndarray): Input array.
+ axis (int or tuple of ints): Along which axis to compute all.
+ The flattened array is ... |
4785a5e8d639dea1a9cf767d2c77f6bd9dbe2433 | leapp/cli/upgrade/__init__.py | leapp/cli/upgrade/__init__.py | from leapp.utils.clicmd import command, command_opt
from leapp.repository.scan import find_and_scan_repositories
from leapp.config import get_config
from leapp.logger import configure_logger
def load_repositories_from(name, repo_path, manager=None):
if get_config().has_option('repositories', name):
repo_p... | from leapp.utils.clicmd import command, command_opt
from leapp.repository.scan import find_and_scan_repositories
from leapp.config import get_config
from leapp.logger import configure_logger
def load_repositories_from(name, repo_path, manager=None):
if get_config().has_option('repositories', name):
repo_p... | Add back missing manager creation | leapp: Add back missing manager creation
| Python | lgpl-2.1 | leapp-to/prototype,vinzenz/prototype,leapp-to/prototype,vinzenz/prototype,vinzenz/prototype,leapp-to/prototype,vinzenz/prototype,leapp-to/prototype | ---
+++
@@ -11,7 +11,7 @@
def load_repositories():
- load_repositories_from('custom_repo_path', '/etc/leapp/repos.d/', manager=None)
+ manager = load_repositories_from('custom_repo_path', '/etc/leapp/repos.d/', manager=None)
manager.load()
return manager
|
8993ad7d2b15d05e26788c9bf39ed81794f724dc | branchconfig.py | branchconfig.py | #!/usr/bin/env python
import argparse
from git import Repo
import configprocessor
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-p", "--path", help="Path to git working copy")
parser.add_argument("-c", "--configfile", help="Configuration file to parse")
parser.add_argument("-o",... | #!/usr/bin/env python
import argparse
from git import Repo
import configprocessor
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-p", "--path", help="Path to git working copy")
parser.add_argument("-c", "--configfile", help="Configuration file to parse")
parser.add_argument("-o",... | Convert branch to string explicitly | Convert branch to string explicitly
| Python | apache-2.0 | igoris/branch-config | ---
+++
@@ -13,7 +13,7 @@
args = parser.parse_args()
branch = getCurrentBranch(args.path)
- configprocessor.run(args.configfile, args.outputfile, branch)
+ configprocessor.run(args.configfile, args.outputfile, str(branch))
def getCurrentBranch(path):
repo = Repo(path) |
6e1a211ff1834f8047261d51737afcb0412075b5 | memleak.py | memleak.py | import torch
from torch import FloatTensor, LongTensor
from torch.autograd import Variable
from torch import nn, optim
from torch.nn import Parameter
from tqdm import trange
import util, logging, os, psutil
import hyper
logging.basicConfig(filename='memleak.log',level=logging.INFO)
torch.manual_seed(2)
B = 256
M =... | import torch
from torch import FloatTensor, LongTensor
from torch.autograd import Variable
from torch import nn, optim
from torch.nn import Parameter
from tqdm import trange
import util, logging, os, psutil
import hyper
logging.basicConfig(filename='memleak.log',level=logging.INFO)
torch.manual_seed(2)
B = 256
M =... | Add logging of memory use | Add logging of memory use
| Python | mit | MaestroGraph/sparse-hyper | ---
+++
@@ -27,3 +27,7 @@
x, _ = hyper.flatten_indices(x, IN, OUT)
+ if i % 25 == 0:
+ logging.info(util.nvidia_smi())
+
+ |
badfa5c7c0572e36a94598ec6cc8a845e453d233 | chipy_org/settings_test.py | chipy_org/settings_test.py | # pylint: disable=unused-wildcard-import,wildcard-import
from .settings import *
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:", "TEST": {}}}
DEBUG = True
ADMINS = ["admin@chipy.org"]
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
ENVELOPE_EMAIL_RECIPIENTS = [
... | # pylint: disable=unused-wildcard-import,wildcard-import
from .settings import *
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:", "TEST": {}}}
DEBUG = True
ADMINS = ["admin@chipy.org"]
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
ENVELOPE_EMAIL_RECIPIENTS = [
... | Add dev_utils to test settings | Add dev_utils to test settings
| Python | mit | chicagopython/chipy.org,chicagopython/chipy.org,chicagopython/chipy.org,chicagopython/chipy.org | ---
+++
@@ -9,6 +9,8 @@
"admin@example.com",
]
+INSTALLED_APPS.append("chipy_org.dev_utils")
+
SECRET_KEY = "somesecretkeyfordjangogoeshere"
SECURE_SSL_REDIRECT = False
|
c1ab2795152d50de9f535e90b550d033feadf778 | tests/test_storage.py | tests/test_storage.py | import json
import os
from mock import patch
import pytest
from inmemorystorage.storage import InMemoryStorage
TEST_DATA_PATH = os.path.join(os.path.dirname(__file__), 'images')
@pytest.mark.django_db
def test_alternate_storage(admin_client, settings):
"""Verify can plugin alternate storage backend"""
set... | import json
import os
from mock import patch
import pytest
from inmemorystorage.storage import InMemoryStorage
TEST_DATA_PATH = os.path.join(os.path.dirname(__file__), 'images')
@pytest.mark.django_db
def test_alternate_storage(admin_client, settings):
"""Verify can plugin alternate storage backend"""
set... | Fix case-sensitive filename in storage test | Fix case-sensitive filename in storage test
| Python | mit | theonion/betty-cropper,theonion/betty-cropper,theonion/betty-cropper,theonion/betty-cropper | ---
+++
@@ -19,7 +19,7 @@
with patch('django.db.models.fields.files.default_storage._wrapped', storage):
# Create Image
- path = os.path.join(TEST_DATA_PATH, 'lenna.png')
+ path = os.path.join(TEST_DATA_PATH, 'Lenna.png')
with open(path, "rb") as image:
resp = adm... |
95d71d5a84f05de7d655fd788a4139c3a1316d74 | text/__init__.py | text/__init__.py | #! /usr/bin/env python
import os
def get_files(path, ext=None):
"""
Get all files in directory path, optionally with the specified extension
"""
if ext is None:
ext = ''
return [
os.path.abspath(fname)
for fname in os.listdir(path)
if os.path.isfile(fname)
... | #! /usr/bin/env python
import os
def get_files(path, ext=None):
"""
Get all files in directory path, optionally with the specified extension
"""
if ext is None:
ext = ''
return [
os.path.abspath(fname)
for fname in os.listdir(path)
if os.path.isfile(fname)
... | Add function to generate a blob of text from a list of files | Add function to generate a blob of text from a list of files
| Python | mit | IanLee1521/utilities | ---
+++
@@ -16,3 +16,10 @@
if os.path.isfile(fname)
if fname.endswith(ext)
]
+
+
+def blob_text(filenames):
+ """
+ Create a blob of text by reading in all filenames into a string
+ """
+ return '\n'.join([open(fname).read() for fname in filenames]) |
9891fa25d905bb2aa34c9c55fc420d29438f9499 | leonardo_ckeditor/__init__.py | leonardo_ckeditor/__init__.py |
from django.apps import AppConfig
from .ckeditor_config import DEFAULT_CONFIG
default_app_config = 'leonardo_ckeditor.Config'
LEONARDO_APPS = [
'leonardo_ckeditor',
'ckeditor',
'ckeditor_uploader'
]
LEONARDO_CONFIG = {
'CKEDITOR_UPLOAD_PATH': ('uploads/', ('CKEditor upload directory')),
'CKEDIT... |
from django.apps import AppConfig
from .ckeditor_config import DEFAULT_CONFIG
default_app_config = 'leonardo_ckeditor.Config'
LEONARDO_APPS = [
'leonardo_ckeditor',
'ckeditor',
'ckeditor_uploader'
]
LEONARDO_CONFIG = {
'CKEDITOR_UPLOAD_PATH': ('', ('CKEditor upload directory')),
'CKEDITOR_CONFI... | Use upload widget in the default state. | Use upload widget in the default state.
| Python | bsd-3-clause | leonardo-modules/leonardo-ckeditor,leonardo-modules/leonardo-ckeditor | ---
+++
@@ -12,7 +12,7 @@
]
LEONARDO_CONFIG = {
- 'CKEDITOR_UPLOAD_PATH': ('uploads/', ('CKEditor upload directory')),
+ 'CKEDITOR_UPLOAD_PATH': ('', ('CKEditor upload directory')),
'CKEDITOR_CONFIGS': ({'default': DEFAULT_CONFIG}, 'ckeditor config')
}
LEONARDO_OPTGROUP = 'CKEditor'
@@ -33,6 +33,6 @@... |
038ea41054c3b7d07a7297d392e5e5d5f9c59d6a | logout.py | logout.py | #!/usr/local/bin/python3
# ^^^ this is bad practice, DON'T do as I did!
import cgitb # debugging
import footer
import header
from htmlify import *
print("Content-Type: text/html;charset=utf-8\n")
cgitb.enable() # enable debugging
header.showHeader()
# content
startTag("div", id="container") # start container
dis... | #!/usr/local/bin/python3
# ^^^ this is bad practice, DON'T do as I did!
import cgitb # debugging
import footer
import header
from htmlify import *
print("Content-Type: text/html;charset=utf-8\n")
print('<meta http-equiv="set-cookie" content="password="";>')
cgitb.enable() # enable debugging
header.showHeader()
# ... | Fix inability to log out | Fix inability to log out
| Python | apache-2.0 | ISD-Sound-and-Lights/InventoryControl | ---
+++
@@ -7,16 +7,17 @@
print("Content-Type: text/html;charset=utf-8\n")
+print('<meta http-equiv="set-cookie" content="password="";>')
cgitb.enable() # enable debugging
header.showHeader()
# content
startTag("div", id="container") # start container
dispHTML("h3", contents="Logout")
-startTag("form", ... |
532bebd01822917f89ec18080bf8e5a75c16832d | config_template.py | config_template.py | chatbot_ubuntu = {
'path': '',
'model_id': '',
'python_env': ''
}
chatbot_swisscom = {
'path': '',
'model_id': '',
'python_env': ''
}
chatbot_ubuntu_seq2seq = {
'socket_address': '',
'socket_port': ''
}
ate = {
'path': '',
'python_env': ''
}
neuroate = {
'path': '',
'pyth... | chatbot_ubuntu = {
'path': '',
'model_id': '',
'python_env': ''
}
chatbot_swisscom = {
'path': '',
'model_id': '',
'python_env': ''
}
chatbot_ubuntu_seq2seq = {
'socket_address': '',
'socket_port': ''
}
ate = {
'path': '',
'python_env': ''
}
neuroate = {
'path': '',
'pyth... | Add churn entry in the file | Add churn entry in the file
| Python | mit | nachoaguadoc/aimlx-demos,nachoaguadoc/aimlx-demos,nachoaguadoc/aimlx-demos | ---
+++
@@ -48,3 +48,9 @@
machine_translation_stdlangs = {
'base_url': ''
}
+churn = {
+ 'path' : '',
+ 'python_env': '',
+ 'e_host':'',
+ 'e_port':
+} |
e4452ff7e8c27e2e8315c2edb8627a2e92ca86e3 | panoptes_cli/scripts/panoptes.py | panoptes_cli/scripts/panoptes.py | import click
import os
import yaml
from panoptes_client import Panoptes
@click.group()
@click.option(
'--endpoint', type=str
)
@click.pass_context
def cli(ctx, endpoint):
ctx.config_dir = os.path.join(os.environ['HOME'], '.panoptes')
ctx.config_file = os.path.join(ctx.config_dir, 'config.yml')
ctx.conf... | import click
import os
import yaml
from panoptes_client import Panoptes
@click.group()
@click.option(
'--endpoint', type=str
)
@click.pass_context
def cli(ctx, endpoint):
ctx.config_dir = os.path.expanduser('~/.panoptes/')
ctx.config_file = os.path.join(ctx.config_dir, 'config.yml')
ctx.config = {
... | Use os.path.expanduser to find config directory | Use os.path.expanduser to find config directory
Works on Windows and Unix.
| Python | apache-2.0 | zooniverse/panoptes-cli | ---
+++
@@ -9,7 +9,7 @@
)
@click.pass_context
def cli(ctx, endpoint):
- ctx.config_dir = os.path.join(os.environ['HOME'], '.panoptes')
+ ctx.config_dir = os.path.expanduser('~/.panoptes/')
ctx.config_file = os.path.join(ctx.config_dir, 'config.yml')
ctx.config = {
'endpoint': 'https://pano... |
57a477985f3591258dee8a5cbf4ba2a173c749fc | dashboard/views.py | dashboard/views.py | from django.contrib.auth.decorators import login_required
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from actstream.models import Action
from teams.models import Team
@lo... | from django.contrib.auth.decorators import login_required
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from actstream.models import Action
from teams.models import Team
@lo... | Fix dashboard bug when user is not in any teams. | Fix dashboard bug when user is not in any teams. | Python | apache-2.0 | snswa/swsites,snswa/swsites,snswa/swsites | ---
+++
@@ -21,7 +21,10 @@
q = subq
else:
q |= subq
- team_actions = Action.objects.filter(q).order_by('-timestamp')
+ if q is not None:
+ team_actions = Action.objects.filter(q).order_by('-timestamp')
+ else:
+ team_actions = []
template_context = {
... |
7ebd46c4a698b642dd1da355e413eb1bc9ce2727 | learntris.py | learntris.py | #!/usr/bin/env python
import sys
class Grid(object):
def __init__(self):
self.board = [[None] * 10 for i in range(22)]
self.score = 0
self.lines_clear = 0
def draw_board(self):
current_board = self.board
for row in current_board:
row = map(lambda... | #!/usr/bin/env python
import sys
class Grid(object):
def __init__(self):
self.board = [[None] * 10 for i in range(22)]
self.score = 0
self.lines_clear = 0
def draw_board(self):
current_board = self.board
for row in current_board:
row = map(lambda... | Update rest of functions with new data structure; Passes Test 8 | Update rest of functions with new data structure; Passes Test 8
| Python | mit | mosegontar/learntris | ---
+++
@@ -14,16 +14,16 @@
current_board = self.board
for row in current_board:
- row = map(lambda cell: '.' if cell == None else y, row)
+ row = map(lambda cell: '.' if cell == None else cell, row)
print ' '.join(row)
def given(self):
- se... |
604102af89c0f3ab3b9562b3baa246f24de3fe90 | locations/spiders/la_salsa.py | locations/spiders/la_salsa.py | # -*- coding: utf-8 -*-
import scrapy
from locations.items import GeojsonPointItem
import json
import re
class LaSalsaSpider(scrapy.Spider):
name = "la_salsa"
allowed_domains = ["www.lasalsa.com"]
start_urls = (
'http://lasalsa.com/wp-content/themes/lasalsa-main/locations-search.php?lat=0&lng=0&rad... | # -*- coding: utf-8 -*-
import scrapy
from locations.items import GeojsonPointItem
class LaSalsaSpider(scrapy.Spider):
name = "la_salsa"
allowed_domains = ["www.lasalsa.com"]
start_urls = (
'http://lasalsa.com/wp-content/themes/lasalsa-main/locations-search.php?lat=0&lng=0&radius=99999999',
)... | Use xpath instead of regex | Use xpath instead of regex
| Python | mit | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | ---
+++
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
import scrapy
+
from locations.items import GeojsonPointItem
-import json
-import re
+
class LaSalsaSpider(scrapy.Spider):
name = "la_salsa"
@@ -12,25 +12,14 @@
)
def parse(self, response):
- restaurantData = response.xpath("//markers").ext... |
7588bab65a098cbc0b5e2ba2c1b9a45b08adfc46 | fsspec/__init__.py | fsspec/__init__.py | try:
from importlib.metadata import entry_points
except ImportError: # python < 3.8
try:
from importlib_metadata import entry_points
except ImportError:
entry_points = None
from . import caching
from ._version import get_versions
from .core import get_fs_token_paths, open, open_files, ope... | try:
from importlib.metadata import entry_points
except ImportError: # python < 3.8
try:
from importlib_metadata import entry_points
except ImportError:
entry_points = None
from . import caching
from ._version import get_versions
from .core import get_fs_token_paths, open, open_files, ope... | Make the exceptions valid on fsspec module level | Make the exceptions valid on fsspec module level
| Python | bsd-3-clause | intake/filesystem_spec,fsspec/filesystem_spec,fsspec/filesystem_spec | ---
+++
@@ -10,6 +10,7 @@
from . import caching
from ._version import get_versions
from .core import get_fs_token_paths, open, open_files, open_local
+from .exceptions import FSBaseException, FSTimeoutError
from .mapping import FSMap, get_mapper
from .registry import (
filesystem,
@@ -25,6 +26,8 @@
__all... |
c126950f653169ad3d5035ea1580a7c4c7250f22 | test/test_Spectrum.py | test/test_Spectrum.py | #!/usr/bin/env python3
from __future__ import division, print_function
import pytest
import sys
# Add Spectrum location to path
sys.path.append('../')
import Spectrum
# Test using hypothesis
def test_spectrum_assigns_data():
x = [1,2,3,4,5,6]
y = [1,1,0.9,0.95,1,1]
spec = Spectrum(x, y)
assert spec... | #!/usr/bin/env python3
from __future__ import division, print_function
import pytest
import sys
# Add Spectrum location to path
sys.path.append('../')
import Spectrum
# Test using hypothesis
def test_spectrum_assigns_data():
x = [1,2,3,4,5,6]
y = [1,1,0.9,0.95,1,1]
z = 2200*x
spec = Spectrum.Spectr... | Fix test to pass, get class from module and add wavelength assignment | Fix test to pass, get class from module and add wavelength assignment
| Python | mit | jason-neal/spectrum_overload,jason-neal/spectrum_overload,jason-neal/spectrum_overload | ---
+++
@@ -14,6 +14,8 @@
x = [1,2,3,4,5,6]
y = [1,1,0.9,0.95,1,1]
- spec = Spectrum(x, y)
+ z = 2200*x
+ spec = Spectrum.Spectrum(x, y, z)
assert spec.flux == y
- assert spec.x == x
+ assert spec.pixel == x
+ assert spec.wavelength == z |
1c01423e0cccd64ab249a9749f04cf3e155d3f53 | 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()
try:
import pypandoc
long_description = pypandoc.convert(long_description, 'rst')
except(IOError, ImportError):
long_description = ... | 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', 'markdown')
except(IOError, ImportError):
long_de... | Convert md to rst readme specially for PyPi | Convert md to rst readme specially for PyPi
| Python | mit | sashgorokhov/argparse-autogen | ---
+++
@@ -7,7 +7,7 @@
try:
import pypandoc
- long_description = pypandoc.convert(long_description, 'rst')
+ long_description = pypandoc.convert(long_description, 'rst', 'markdown')
except(IOError, ImportError):
long_description = long_description
|
7844aa93d4f6836fbb8bba3a0af6b2e0e17c6fde | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='django-oscar-fancypages',
version=":versiontools:fancypages:",
url='https://github.com/tangentlabs/django-oscar-fancypages',
author="Sebastian Vetter",
author_email="sebastian.vetter@tangentsnowball.com.au",
descript... | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='django-oscar-fancypages',
version=":versiontools:fancypages:",
url='https://github.com/tangentlabs/django-oscar-fancypages',
author="Sebastian Vetter",
author_email="sebastian.vetter@tangentsnowball.com.au",
descript... | Update dependencies for node and less | Update dependencies for node and less
| Python | bsd-3-clause | tangentlabs/django-oscar-fancypages,tangentlabs/django-oscar-fancypages | ---
+++
@@ -17,12 +17,14 @@
install_requires=[
'versiontools>=1.9.1',
'Django>=1.4.1',
- #'django-oscar>=0.3.3',
+ 'django-oscar>=0.4',
'django-model-utils>=1.1.0',
'django-compressor>=1.2',
+ 'virtual-node>=0.0.1',
+ 'virtual-less>=0.0.1',
],
... |
3fd264c4927a11bb3915dee38a17b169ea801c63 | setup.py | setup.py | #!/usr/bin/env python
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
import os.path
tests_require = [
'redis',
'unittest2',
]
setup(
name='Mule',
version='1.0',
a... | #!/usr/bin/env python
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
import os.path
tests_require = [
'redis',
'unittest2',
]
setup(
name='Mule',
version='0.1.0',
... | Drop verison to 0.1.0 for internal release | Drop verison to 0.1.0 for internal release
| Python | apache-2.0 | disqus/mule | ---
+++
@@ -15,7 +15,7 @@
]
setup(
name='Mule',
- version='1.0',
+ version='0.1.0',
author='DISQUS',
author_email='opensource@disqus.com',
url='http://github.com/disqus/mule', |
08335e060311994a897b95302fc54a0a2b196614 | mdx_linkify/__init__.py | mdx_linkify/__init__.py | from mdx_linkify.mdx_linkify import makeExtension
| import sys
is_python3 = sys.version_info >= (3, 0)
if is_python3:
from mdx_linkify.mdx_linkify import makeExtension
else:
from mdx_linkify import makeExtension
assert makeExtension # Silences pep8.
| Fix import for python2 and pypy | Fix import for python2 and pypy
| Python | mit | daGrevis/mdx_linkify | ---
+++
@@ -1 +1,12 @@
-from mdx_linkify.mdx_linkify import makeExtension
+import sys
+
+
+is_python3 = sys.version_info >= (3, 0)
+
+if is_python3:
+ from mdx_linkify.mdx_linkify import makeExtension
+else:
+ from mdx_linkify import makeExtension
+
+
+assert makeExtension # Silences pep8. |
3f00fc50b0eba9516cfc92b2448df299a68b5524 | main_test.py | main_test.py | fuckit('checktz')
import asyncio
import sys, os
import fuckit
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../')
def test_time():
assert checktz.GetTime("test") == "Finished with no errors!"
| import asyncio
import sys, os
import fuckit
fuckit('checktz')
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../')
def test_time():
assert checktz.GetTime("test") == "Finished with no errors!"
| Make the builds actually pass | Make the builds actually pass | Python | epl-1.0 | Bentechy66/Interlaced-Minds-Bot | ---
+++
@@ -1,7 +1,7 @@
-fuckit('checktz')
import asyncio
import sys, os
import fuckit
+fuckit('checktz')
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../')
|
ca917fa28c5bf8fe3c431868951f429c48b58e0a | buysafe/urls.py | buysafe/urls.py | from django.conf.urls import patterns, url
urlpatterns = patterns(
'buysafe.views',
url(r'^entry/(?P<order_id>\d+)/$', 'entry', name='buysafe_pay'),
(r'^start/$', 'start'),
(r'^success/(?P<payment_type>[01])/$', 'success'),
(r'^fail/(?P<payment_type>[01])/$', 'fail'),
(r'^check/(?P<payment_typ... | from django.conf.urls import patterns, url
urlpatterns = patterns(
'buysafe.views',
url(r'^entry/(?P<order_id>\d+)/$', 'entry', name='buysafe_pay'),
url(r'^start/$', 'start', name="buysafe_start"),
(r'^success/(?P<payment_type>[01])/$', 'success'),
(r'^fail/(?P<payment_type>[01])/$', 'fail'),
... | Add view label to buysafe_start | Add view label to buysafe_start
| Python | bsd-3-clause | uranusjr/django-buysafe | ---
+++
@@ -4,7 +4,7 @@
urlpatterns = patterns(
'buysafe.views',
url(r'^entry/(?P<order_id>\d+)/$', 'entry', name='buysafe_pay'),
- (r'^start/$', 'start'),
+ url(r'^start/$', 'start', name="buysafe_start"),
(r'^success/(?P<payment_type>[01])/$', 'success'),
(r'^fail/(?P<payment_type>[01])/$... |
320981553f589d801d17b000d6f74c301f552811 | survey/tests/test_default_settings.py | survey/tests/test_default_settings.py | from survey.tests import BaseTest
from django.test import override_settings
from django.conf import settings
from survey import set_default_settings
@override_settings()
class TestDefaultSettings(BaseTest):
def test_set_choices_separator(self):
url = "/admin/survey/survey/1/change/"
del settings.C... | from django.conf import settings
from django.test import override_settings
from survey import set_default_settings
from survey.tests import BaseTest
@override_settings()
class TestDefaultSettings(BaseTest):
def test_set_choices_separator(self):
url = "/admin/survey/survey/1/change/"
del settings.... | Apply black following @gjelsas MR | Apply black following @gjelsas MR
| Python | agpl-3.0 | Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey | ---
+++
@@ -1,7 +1,8 @@
+from django.conf import settings
+from django.test import override_settings
+
+from survey import set_default_settings
from survey.tests import BaseTest
-from django.test import override_settings
-from django.conf import settings
-from survey import set_default_settings
@override_settin... |
15030074c73f41a2a298c5de77b584875b7a5441 | sympy/logic/benchmarks/run-solvers.py | sympy/logic/benchmarks/run-solvers.py | from __future__ import print_function, division
from sympy.logic.utilities import load_file
from sympy.logic import satisfiable
import time
import os
import sys
input_path = os.getcwd() + '/' + '/'.join(sys.argv[0].split('/')[:-1])
INPUT = [5 * i for i in range(2, 16)]
ALGORITHMS = ['dpll', 'dpll2']
results = {}
fo... | from __future__ import print_function, division
from sympy.logic.utilities import load_file
from sympy.logic import satisfiable
import time
import os
import sys
input_path = os.path.dirname(__file__)
INPUT = [5 * i for i in range(2, 16)]
ALGORITHMS = ['dpll', 'dpll2']
results = {}
if __name__ == '__main__':
for... | Make logic benchmarks runner more portable | Make logic benchmarks runner more portable
| Python | bsd-3-clause | abloomston/sympy,wyom/sympy,madan96/sympy,sunny94/temp,liangjiaxing/sympy,kaichogami/sympy,Davidjohnwilson/sympy,shikil/sympy,AunShiLord/sympy,shipci/sympy,sahilshekhawat/sympy,pbrady/sympy,jaimahajan1997/sympy,MechCoder/sympy,Davidjohnwilson/sympy,mcdaniel67/sympy,atreyv/sympy,debugger22/sympy,madan96/sympy,sampadsaha... | ---
+++
@@ -6,31 +6,32 @@
import os
import sys
-input_path = os.getcwd() + '/' + '/'.join(sys.argv[0].split('/')[:-1])
+input_path = os.path.dirname(__file__)
INPUT = [5 * i for i in range(2, 16)]
ALGORITHMS = ['dpll', 'dpll2']
results = {}
-for test in INPUT:
- results[test] = {}
+if __name__ == '__mai... |
adfcd15e8c9f3c4b08bdb358d041401bf77d2a25 | calicoctl/calico_ctl/__init__.py | calicoctl/calico_ctl/__init__.py | __version__ = "0.13.0-dev"
__kubernetes_plugin_version__ = "v0.6.0"
__rkt_plugin_version__ = "v0.1.0"
__libnetwork_plugin_version__ = "v0.6.0"
__libcalico_version__ = "v0.6.0"
__felix_version__ = "1.2.1"
| __version__ = "0.13.0-dev"
__kubernetes_plugin_version__ = "v0.7.0"
__rkt_plugin_version__ = "v0.1.0"
__libnetwork_plugin_version__ = "v0.7.0"
__libcalico_version__ = "v0.7.0"
__felix_version__ = "1.3.0-pre5"
| Fix release numbers to be latest values | Fix release numbers to be latest values
| Python | apache-2.0 | caseydavenport/calico-containers,Metaswitch/calico-docker,caseydavenport/calico-containers,projectcalico/calico-containers,quater/calico-containers,Metaswitch/calico-docker,insequent/calico-docker,projectcalico/calico-containers,TrimBiggs/calico-containers,tomdee/calico-docker,TrimBiggs/calico-docker,caseydavenport/cal... | ---
+++
@@ -1,6 +1,6 @@
__version__ = "0.13.0-dev"
-__kubernetes_plugin_version__ = "v0.6.0"
+__kubernetes_plugin_version__ = "v0.7.0"
__rkt_plugin_version__ = "v0.1.0"
-__libnetwork_plugin_version__ = "v0.6.0"
-__libcalico_version__ = "v0.6.0"
-__felix_version__ = "1.2.1"
+__libnetwork_plugin_version__ = "v0.7.0"
... |
2060a89cc008e3fc19b90b2278001350ef6b49ad | stellar/data/stellargraph.py | stellar/data/stellargraph.py | # -*- coding: utf-8 -*-
#
# Copyright 2017-2018 Data61, CSIRO
#
# 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 ... | # -*- coding: utf-8 -*-
#
# Copyright 2017-2018 Data61, CSIRO
#
# 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 ... | Split StellarGraph class into two: undirected and directed graph classes | Split StellarGraph class into two: undirected and directed graph classes
| Python | apache-2.0 | stellargraph/stellargraph,stellargraph/stellargraph | ---
+++
@@ -17,9 +17,21 @@
import networkx as nx
-class StellarGraph(nx.MultiDiGraph):
+class StellarGraph(nx.MultiGraph):
"""
- Our own StellarGraph class, inherited from nx.MultiDiGraph, with extra stuff to be added that's needed by samplers and mappers
+ Our own class for heterogeneous undirected g... |
0f9d3b0ed9efc72b8b3fd4d466caa4517691546c | strategies/alexStrategies.py | strategies/alexStrategies.py | class FixFoldStrategy:
"""This strategy folds every time there is a small card available."""
def __init__(self, N=3):
self.N = N
def play(self, info):
if info.bestFold(self.player)[1] > self.N:
return 'Hit me'
else:
return 'fold'
class RatioFoldStrategy:
... | class FixFoldStrategy:
"""This strategy folds every time there is a small card available."""
def __init__(self, N=3):
self.N = N
def play(self, info):
if info.bestFold(self.player)[1] > self.N:
return 'Hit me'
else:
return 'fold'
class RatioFoldStrategy:
... | Add a simple card counting strategy | Add a simple card counting strategy
| Python | mit | AlexMooney/pairsTournament | ---
+++
@@ -17,3 +17,16 @@
return 'Hit me'
else:
return 'fold'
+
+class CardCounter:
+ """This strategy folds based on card counting expectation values."""
+ def __init__(self, scared=0.23):
+ from collections import Counter
+ self.Counter = Counter
+ self... |
619462203f3369b807e14e4715f992c40224b37a | account_fiscal_position_no_source_tax/account.py | account_fiscal_position_no_source_tax/account.py | from openerp import models, api, fields
class account_fiscal_position(models.Model):
_inherit = 'account.fiscal.position'
@api.v7
def map_tax(self, cr, uid, fposition_id, taxes, context=None):
result = super(account_fiscal_position, self).map_tax(
cr, uid, fposition_id, taxes, contex... | from openerp import models, api, fields
class account_fiscal_position(models.Model):
_inherit = 'account.fiscal.position'
@api.v7
def map_tax(self, cr, uid, fposition_id, taxes, context=None):
result = super(account_fiscal_position, self).map_tax(
cr, uid, fposition_id, taxes, contex... | FIX fiscal position no source tax | FIX fiscal position no source tax
| Python | agpl-3.0 | csrocha/account_check,csrocha/account_check | ---
+++
@@ -9,9 +9,11 @@
def map_tax(self, cr, uid, fposition_id, taxes, context=None):
result = super(account_fiscal_position, self).map_tax(
cr, uid, fposition_id, taxes, context=context)
- taxes_without_src_ids = [
- x.tax_dest_id.id for x in fposition_id.tax_ids if not... |
5c341fc463840bc2e237e1529a43aa5915a70c77 | luhn/luhn.py | luhn/luhn.py | # File: luhn.py
# Purpose: Write a program that can take a number and determine whether
# or not it is valid per the Luhn formula.
# Programmer: Amal Shehu
# Course: Exercism
# Date: Sunday 18 September 2016, 09:55 PM
def Luhn(card_number):
def digits_of(n):
return [in... | # File: luhn.py
# Purpose: Write a program that can take a number and determine whether
# or not it is valid per the Luhn formula.
# Programmer: Amal Shehu
# Course: Exercism
# Date: Sunday 18 September 2016, 09:55 PM
def Luhn(card_number):
def digits_of(n):
return [in... | Return the remainder of checksum | Return the remainder of checksum
| Python | mit | amalshehu/exercism-python | ---
+++
@@ -14,5 +14,8 @@
even = digits[-2::-2]
checksum = 0
checksum += sum(odd_digits)
+ for d in even_digits:
+ checksum += sum(digits_of(d*2))
+ return checksum % 10
def checksum(card_number):
return luhn(card_number) |
7cf2d39f4822a50f4a9347ba6c82498abc8e9bb7 | index/createIndex.py | index/createIndex.py | #!/usr/bin/python
import requests
import json
import os
myElasticServerIp = os.environ.get('ES_SERVER_IP', 'localhost')
myIndexName = os.environ.get('ES_INDEX_NAME', 'bestbuy-products')
def main():
deleteIndex()
createIndex()
def createIndex():
with open('mapping.json') as mappingFile:
jsonData ... | #!/usr/bin/python
import requests
import json
import os
myElasticServerIp = os.environ.get('ES_SERVER_IP', 'localhost')
myIndexName = os.environ.get('ES_INDEX_NAME', 'bestbuy-products')
def main():
deleteIndex()
createIndex()
def createIndex():
with open('mapping.json') as mappingFile:
jsonData ... | Remove type when creating index | Remove type when creating index | Python | mit | zpurcey/bestbuy-demo,zpurcey/bestbuy-demo,zpurcey/bestbuy-demo | ---
+++
@@ -14,7 +14,7 @@
with open('mapping.json') as mappingFile:
jsonData = json.load(mappingFile)
type = 'product'
- postUrl = 'http://' + myElasticServerIp + ':9200/' + myIndexName + '/'+type+'/'
+ postUrl = 'http://' + myElasticServerIp + ':9200/' + myIndexName + '/'
print(postUrl)... |
c4d2e4c4f49db961dae59780fa8f5ec351a11353 | projects/models.py | projects/models.py | # -*- encoding:utf-8 -*-
from django.db import models
class Project(models.Model):
STATUS = (
('unrevised', u'Неразгледан'),
('returned', u'Върнат за корекция'),
('pending', u'Предстои да бъде разгледан на СИС'),
('approved', u'Разгледан и одобрен на СИС'),
('rejected', u'Р... | # -*- encoding:utf-8 -*-
from django.db import models
class Project(models.Model):
STATUS = (
('unrevised', u'Неразгледан'),
('returned', u'Върнат за корекция'),
('pending', u'Предстои да бъде разгледан на СИС'),
('approved', u'Разгледан и одобрен на СИС'),
('rejected', u'Р... | Add incoming number for the project and attutude | Add incoming number for the project and attutude
| Python | mit | Hackfmi/Diaphanum,Hackfmi/Diaphanum | ---
+++
@@ -27,6 +27,8 @@
choices=STATUS,
default='unrevised')
discussed_at = models.DateField(blank=True, null=True)
+ attitute = models.TextField(blank=True, null=True)
+ number = models.CharField(max_length=30, blank=True, null=True)
d... |
30a16da0089d0f7afa46fb129a6f426c75cbcd3b | modules/test_gitdata.py | modules/test_gitdata.py | from nose import with_setup
from nose.tools import *
import os
import sys
from gitdata import GitData
import simplejson as json
def test_fetch():
gd = GitData(repo="./treenexus")
study_id = 438
study_nexson = gd.fetch_study(study_id)
valid = 1
try:
json.loads(study_nexson)
except... | import unittest
import os
import sys
from gitdata import GitData
import simplejson as json
class TestGitData(unittest.TestCase):
def test_fetch(self):
gd = GitData(repo="./treenexus")
study_id = 438
study_nexson = gd.fetch_study(study_id)
valid = 1
try:
json.loa... | Convert GitData tests to a unittest suite | Convert GitData tests to a unittest suite
| Python | bsd-2-clause | leto/new_opentree_api,leto/new_opentree_api | ---
+++
@@ -1,39 +1,48 @@
-from nose import with_setup
-from nose.tools import *
+import unittest
import os
import sys
from gitdata import GitData
import simplejson as json
-def test_fetch():
- gd = GitData(repo="./treenexus")
+class TestGitData(unittest.TestCase):
+ def test_fetch(self):
+ g... |
9beb8378831f33c2256b5a7bf73f24d155122bea | nasa_data.py | nasa_data.py |
import requests
import os
def get_apod():
os.makedirs("APODs", exist_ok=True)
try:
apod_data = requests.get("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY").json()
image_url = apod_data["url"]
if image_url.endswith(".gif"):
return
image_data = requests.get(... |
import requests
import os
def get_apod():
os.makedirs("APODs", exist_ok=True)
try:
apod_data = requests.get("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY").json()
image_url = apod_data["url"]
if image_url.endswith(".gif"):
raise TypeError
image_data = requ... | Update 0.6.4 - Fixed exception error | Update 0.6.4
- Fixed exception error
| Python | mit | FXelix/space_facts_bot | ---
+++
@@ -10,9 +10,9 @@
apod_data = requests.get("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY").json()
image_url = apod_data["url"]
if image_url.endswith(".gif"):
- return
+ raise TypeError
image_data = requests.get(image_url, stream=True)
- exce... |
f35494ebc7c710af45c8973eb1c2b4d31ec1c7c0 | tests/fakes.py | tests/fakes.py | class FakeHttpRequest(object):
def __init__(self, method='GET', body=''):
self.method = method.upper()
self.body = body
class FakeHttpResponse(object):
def __init__(self, body, content_type='text/html'):
self.body = body
self.content_type = content_type
self.status_code... | import six
class FakeHttpRequest(object):
def __init__(self, method='GET', body=''):
self.method = method.upper()
self.body = body
if six.PY3:
self.body = body.encode('utf-8')
class FakeHttpResponse(object):
def __init__(self, body, content_type='text/html'):
self... | Update tests to reproduce bug | Update tests to reproduce bug
| Python | bsd-3-clause | pobear/restless,viniciuscainelli/restless,toastdriven/restless,tonybajan/restless,CraveFood/restkiss,jangeador/restless | ---
+++
@@ -1,7 +1,12 @@
+import six
+
+
class FakeHttpRequest(object):
def __init__(self, method='GET', body=''):
self.method = method.upper()
self.body = body
+ if six.PY3:
+ self.body = body.encode('utf-8')
class FakeHttpResponse(object): |
ed85bde14d8c37144352d7526c674c26fa577407 | dnsimple/record.py | dnsimple/record.py | from .model import Model
class Record(Model, object):
def __init__(self, request, domain, attributes):
self.domain = domain
super(Record, self).__init__(request, attributes)
def update(self, attributes):
success = False
self.assign(attributes)
response = self.reque... | from .model import Model
class Record(Model, object):
def __init__(self, request, domain, attributes):
self.domain = domain
super(Record, self).__init__(request, attributes)
def update(self, attributes):
self.assign(attributes)
response = self.request.put(
'doma... | Remove unused assignment in `Record` class | Remove unused assignment in `Record` class | Python | mit | vigetlabs/dnsimple | ---
+++
@@ -8,8 +8,6 @@
super(Record, self).__init__(request, attributes)
def update(self, attributes):
- success = False
-
self.assign(attributes)
response = self.request.put( |
304713ca8731c2ef27743abb772456d55ad0f3a8 | python/ql/test/library-tests/frameworks/django-v2-v3/testapp/urls.py | python/ql/test/library-tests/frameworks/django-v2-v3/testapp/urls.py | from django.urls import path, re_path
# This version 1.x way of defining urls is deprecated in Django 3.1, but still works
from django.conf.urls import url
from . import views
urlpatterns = [
path("foo/", views.foo), # $routeSetup="foo/"
# TODO: Doesn't include standard `$` to mark end of string, due to pro... | from django.urls import path, re_path
from . import views
urlpatterns = [
path("foo/", views.foo), # $routeSetup="foo/"
# TODO: Doesn't include standard `$` to mark end of string, due to problems with
# inline expectation tests (which thinks the `$` would mark the beginning of a new
# line)
re_pa... | Handle django v4 as well in tests | Python: Handle django v4 as well in tests
| Python | mit | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | ---
+++
@@ -1,7 +1,4 @@
from django.urls import path, re_path
-
-# This version 1.x way of defining urls is deprecated in Django 3.1, but still works
-from django.conf.urls import url
from . import views
@@ -11,7 +8,6 @@
# inline expectation tests (which thinks the `$` would mark the beginning of a new
... |
bb0728a6e73f3995968ee7c59ffcb03fae65d983 | quotes/templatetags/quote_tags.py | quotes/templatetags/quote_tags.py | from django import template
from quotes.models import Quote
register = template.Library()
@register.inclusion_tag('quotes/random_quote.html')
def show_random_quote():
"""
For generating a single random quote
"""
random_quote = Quote.objects.order_by('?')[0]
return {'random_quote': random_quote} | from django import template
from quotes.models import Quote
register = template.Library()
@register.inclusion_tag('quotes/random_quote.html')
def show_random_quote():
"""
For generating a single random quote
"""
try:
random_quote = Quote.objects.order_by('?')[0]
except ValueError:
... | Fix for allowing for empty database | Fix for allowing for empty database | Python | bsd-3-clause | davemerwin/django-quotes | ---
+++
@@ -8,5 +8,7 @@
"""
For generating a single random quote
"""
- random_quote = Quote.objects.order_by('?')[0]
- return {'random_quote': random_quote}
+ try:
+ random_quote = Quote.objects.order_by('?')[0]
+ except ValueError:
+ print "There are no quotes" |
724b80b44229b531d7a11cb7cc9f6ad88d9aedb0 | bnw_handlers/command_userinfo.py | bnw_handlers/command_userinfo.py | from twisted.internet import defer
import bnw_core.bnw_objects as objs
@defer.inlineCallbacks
def cmd_userinfo(request, user=''):
if not user:
defer.returnValue(dict(ok=False, desc='Username required.'))
user_obj = yield objs.User.find_one({'name': user})
subscribers = yield objs.Subscription.fin... | from twisted.internet import defer
import bnw_core.bnw_objects as objs
@defer.inlineCallbacks
def cmd_userinfo(request, user=''):
if not user:
defer.returnValue(dict(ok=False, desc='Username required.'))
user_obj = yield objs.User.find_one({'name': user})
subscribers = yield objs.Subscription.fin... | Fix userinfo api command (send ok=True) | Fix userinfo api command (send ok=True)
| Python | bsd-2-clause | ojab/bnw,stiletto/bnw,stiletto/bnw,ojab/bnw,un-def/bnw,ojab/bnw,stiletto/bnw,ojab/bnw,un-def/bnw,un-def/bnw,un-def/bnw,stiletto/bnw | ---
+++
@@ -27,6 +27,7 @@
if not about:
about = vcard.get('desc', '')
defer.returnValue({
+ 'ok': True,
'user': user,
'regdate': user_obj.get('regdate', 0),
'messages_count': messages_count, |
3c01227bfef6e8cabdca9fe9fe620763a28bff88 | colorlog/logging.py | colorlog/logging.py | """Wrappers around the logging module."""
from __future__ import absolute_import
import functools
import logging
from colorlog.colorlog import ColoredFormatter
BASIC_FORMAT = "%(log_color)s%(levelname)s%(reset)s:%(name)s:%(message)s"
def basicConfig(**kwargs):
"""Call ``logging.basicConfig`` and override the ... | """Wrappers around the logging module."""
from __future__ import absolute_import
import functools
import logging
from colorlog.colorlog import ColoredFormatter
BASIC_FORMAT = "%(log_color)s%(levelname)s%(reset)s:%(name)s:%(message)s"
def basicConfig(style='%', log_colors=None, reset=True, secondary_log_colors=Non... | Add extra parameters for ColoredFormatter to the basicConfig | Add extra parameters for ColoredFormatter to the basicConfig
| Python | mit | borntyping/python-colorlog | ---
+++
@@ -10,7 +10,7 @@
BASIC_FORMAT = "%(log_color)s%(levelname)s%(reset)s:%(name)s:%(message)s"
-def basicConfig(**kwargs):
+def basicConfig(style='%', log_colors=None, reset=True, secondary_log_colors=None, **kwargs):
"""Call ``logging.basicConfig`` and override the formatter it creates."""
loggin... |
1afebd46c8cf786673adface7724e9488df17a7e | appengine-experimental/src/models.py | appengine-experimental/src/models.py | from datetime import datetime, timedelta
from google.appengine.ext import db
class CHPIncident(db.Model):
CenterID = db.StringProperty(required=True)
DispatchID = db.StringProperty(required=True)
LogID = db.StringProperty(required=True)
LogTime = db.DateTimeProperty()
LogType = db.StringProperty()
LogTypeID = ... | from datetime import datetime, timedelta
from google.appengine.ext import db
class CHPIncident(db.Model):
CenterID = db.StringProperty(required=True)
DispatchID = db.StringProperty(required=True)
LogID = db.StringProperty(required=True)
LogTime = db.DateTimeProperty()
LogType = db.StringProperty()
LogTypeID = ... | Tweak the "inactive" timeout a bit to take latency into account. | Tweak the "inactive" timeout a bit to take latency into account.
| Python | isc | lectroidmarc/SacTraffic,lectroidmarc/SacTraffic | ---
+++
@@ -24,8 +24,10 @@
if self.created > datetime.utcnow() - timedelta(minutes=5):
# less than 5 min old == new
return 'new'
- elif self.updated < datetime.utcnow() - timedelta(minutes=5):
- # not updated in 5 min == inactive
+ elif self.updated < datetime.utcnow() - timedelta(minutes=6):
+ # not... |
cb1de4cc77e3368ed730c14044f76f2d20c3d909 | dashi/generator.py | dashi/generator.py | import asyncio
import collections
import dashi.config
import dashi.db
import dashi.time
import datetime
import functools
import jinja2
import logging
import os
import pprint
LOGGER = logging.getLogger(__name__)
@asyncio.coroutine
def go():
config = dashi.config.parse()
template_loader = jinja2.FileSystemLoade... | import asyncio
import collections
import dashi.config
import dashi.db
import dashi.time
import datetime
import functools
import jinja2
import logging
import os
import pprint
LOGGER = logging.getLogger(__name__)
@asyncio.coroutine
def go():
config = dashi.config.parse()
template_loader = jinja2.FileSystemLoade... | Update more references to the old config style | Update more references to the old config style
| Python | mit | EliRibble/dashi,EliRibble/dashi | ---
+++
@@ -15,23 +15,24 @@
@asyncio.coroutine
def go():
config = dashi.config.parse()
- template_loader = jinja2.FileSystemLoader(searchpath=config.template_path)
+ template_loader = jinja2.FileSystemLoader(searchpath=config['paths']['template'])
template_environment = jinja2.Environment(loader=tem... |
8948536f0faf12d36b0da48ae5f45d00a022ebb7 | InvenTree/InvenTree/helpers.py | InvenTree/InvenTree/helpers.py | import io
from wsgiref.util import FileWrapper
from django.http import StreamingHttpResponse
def WrapWithQuotes(text):
# TODO - Make this better
if not text.startswith('"'):
text = '"' + text
if not text.endswith('"'):
text = text + '"'
return text
def DownloadFile(data, filename,... | import io
from wsgiref.util import FileWrapper
from django.http import StreamingHttpResponse
def WrapWithQuotes(text):
# TODO - Make this better
if not text.startswith('"'):
text = '"' + text
if not text.endswith('"'):
text = text + '"'
return text
def DownloadFile(data, filename,... | Allow export of binary file data | Allow export of binary file data
- Use io.BytesIO for non-string-data file objects
| Python | mit | inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree | ---
+++
@@ -23,7 +23,10 @@
filename = WrapWithQuotes(filename)
- wrapper = FileWrapper(io.StringIO(data))
+ if type(data) == str:
+ wrapper = FileWrapper(io.StringIO(data))
+ else:
+ wrapper = FileWrapper(io.BytesIO(data))
response = StreamingHttpResponse(wrapper, content_type=c... |
fbb532473bc6434628c6f01fabb8eae3ad60a171 | nn/linear.py | nn/linear.py | import tensorflow as tf
from . import var_init
from .util import static_shape
from .variable import variable
def linear(x, output_layer_size):
weight = variable([static_shape(x)[1], output_layer_size])
bias = variable([output_layer_size])
tf.add_to_collection(tf.GraphKeys.WEIGHTS, weight)
tf.add_to_collecti... | import tensorflow as tf
from .util import static_shape
from .variable import variable
def linear(x, output_layer_size):
weight = variable([static_shape(x)[1], output_layer_size])
bias = variable([output_layer_size])
tf.add_to_collection(tf.GraphKeys.WEIGHTS, weight)
tf.add_to_collection(tf.GraphKeys.BIASES,... | Remove an extra import statement | Remove an extra import statement
| Python | unlicense | raviqqe/tensorflow-extenteten,raviqqe/tensorflow-extenteten | ---
+++
@@ -1,6 +1,5 @@
import tensorflow as tf
-from . import var_init
from .util import static_shape
from .variable import variable
|
dcecd75cae428bb27ec8759a21e52267a55f149a | django_comments/signals.py | django_comments/signals.py | """
Signals relating to comments.
"""
from django.dispatch import Signal
# Sent just before a comment will be posted (after it's been approved and
# moderated; this can be used to modify the comment (in place) with posting
# details or other such actions. If any receiver returns False the comment will be
# discarded a... | """
Signals relating to comments.
"""
from django.dispatch import Signal
# Sent just before a comment will be posted (after it's been approved and
# moderated; this can be used to modify the comment (in place) with posting
# details or other such actions. If any receiver returns False the comment will be
# discarded a... | Remove Signal(providing_args) argument b/c it is deprecated | Remove Signal(providing_args) argument b/c it is deprecated
RemovedInDjango40Warning: The providing_args argument is deprecated.
As it is purely documentational, it has no replacement. If you rely
on this argument as documentation, you can move the text to a code
comment or docstring.
| Python | bsd-3-clause | django/django-contrib-comments,django/django-contrib-comments | ---
+++
@@ -9,13 +9,16 @@
# discarded and a 400 response. This signal is sent at more or less
# the same time (just before, actually) as the Comment object's pre-save signal,
# except that the HTTP request is sent along with this signal.
-comment_will_be_posted = Signal(providing_args=["comment", "request"])
+# Ar... |
75dca1c2d39126556ded5f328461986a9eabb230 | django_webtest/backends.py | django_webtest/backends.py | from __future__ import absolute_import
from django.contrib.auth.backends import RemoteUserBackend
from .compat import from_wsgi_safe_string
class WebtestUserBackend(RemoteUserBackend):
""" Auth backend for django-webtest auth system """
def authenticate(self, request, django_webtest_user):
return sup... | from __future__ import absolute_import
from django.utils.version import get_complete_version
from django.contrib.auth.backends import RemoteUserBackend
from .compat import from_wsgi_safe_string
class WebtestUserBackend(RemoteUserBackend):
""" Auth backend for django-webtest auth system """
if get_complete_ver... | Define WebtestUserBackend.authenticate based on Django version | Define WebtestUserBackend.authenticate based on Django version
This is required because the signature of RemoteUserBackend.authenticate
has changed in Django 1.11.
| Python | mit | django-webtest/django-webtest,kmike/django-webtest,django-webtest/django-webtest,kmike/django-webtest | ---
+++
@@ -1,14 +1,19 @@
from __future__ import absolute_import
+from django.utils.version import get_complete_version
from django.contrib.auth.backends import RemoteUserBackend
from .compat import from_wsgi_safe_string
-
class WebtestUserBackend(RemoteUserBackend):
""" Auth backend for django-webtest aut... |
03d628abc4711bb0de4a7a0ef13cc4c0ecb92032 | opps/articles/tests/models.py | opps/articles/tests/models.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.test import TestCase
from opps.articles.models import Post
class PostModelTest(TestCase):
fixtures = ['tests/initial_data.json']
def test_basic_post_exist(self):
post = Post.objects.all()
self.assertTrue(post)
self.assertEqu... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.test import TestCase
from opps.articles.models import Post
class PostModelTest(TestCase):
fixtures = ['tests/initial_data.json']
def test_basic_post_exist(self):
post = Post.objects.all()
self.assertTrue(post)
self.assertEqu... | Add test articles (post), check child_class | Add test articles (post), check child_class
| Python | mit | YACOWS/opps,jeanmask/opps,williamroot/opps,opps/opps,YACOWS/opps,opps/opps,jeanmask/opps,opps/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,opps/opps,williamroot/opps | ---
+++
@@ -17,3 +17,9 @@
self.assertEqual(post[0].slug, u'test-post-application')
self.assertEqual(post[0].title, u'test post application')
self.assertTrue(post[0].short_url)
+
+ def test_child_class(self):
+ post = Post.objects.get(id=1)
+
+ self.assertTrue(post.child_cla... |
dc1b2ce87bdd5aa3b891d43f5d8b5c465dc909d1 | project_user_story/project.py | project_user_story/project.py | # -*- coding: utf-8 -*-
from openerp import models, fields, api, _
class task(models.Model):
_inherit = 'project.task'
user_story = fields.Boolean(
'Is User Story?',
default=False)
@api.multi
def action_open_task(self):
return {
'name': _('User Story'),
... | # -*- coding: utf-8 -*-
from openerp import models, fields, api, _
class task(models.Model):
_inherit = 'project.task'
user_story = fields.Boolean(
'Is User Story?',
default=False)
@api.multi
def action_open_task(self):
print 'context', self._context
return {
... | FIX don loose context when creating from story form view | FIX don loose context when creating from story form view
| Python | agpl-3.0 | levkar/odoo-addons,ingadhoc/partner,ingadhoc/odoo-addons,ingadhoc/stock,dvitme/odoo-addons,ingadhoc/product,ingadhoc/account-analytic,ingadhoc/product,adhoc-dev/odoo-addons,sysadminmatmoz/ingadhoc,maljac/odoo-addons,levkar/odoo-addons,maljac/odoo-addons,ClearCorp/account-financial-tools,sysadminmatmoz/ingadhoc,adhoc-de... | ---
+++
@@ -11,13 +11,14 @@
@api.multi
def action_open_task(self):
+ print 'context', self._context
return {
'name': _('User Story'),
'view_type': 'form',
'view_mode': 'form',
# 'view_id': [res_id],
'res_model': 'project.task... |
eefc9f9757c0cf21c2ca06a791d03c4dea608fd2 | tools/update_chipmunk_src.py | tools/update_chipmunk_src.py |
import sys, os.path
import subprocess
import shutil
pymunk_src_path = os.path.join("..", "chipmunk_src")
shutil.rmtree(os.path.join(pymunk_src_path, "src"), True)
shutil.rmtree(os.path.join(pymunk_src_path, "include"), True)
if len(sys.argv) > 1:
chipmunk_git_path = sys.argv[1]
else:
chipmunk_g... |
import sys, os.path
import subprocess
import shutil
pymunk_src_path = os.path.join("..", "chipmunk_src")
shutil.rmtree(os.path.join(pymunk_src_path, "src"), True)
shutil.rmtree(os.path.join(pymunk_src_path, "include"), True)
if len(sys.argv) > 1:
chipmunk_git_path = sys.argv[1]
else:
chipmunk_g... | Fix update chipmunk src script to run on python 3 | Fix update chipmunk src script to run on python 3
| Python | mit | viblo/pymunk,viblo/pymunk | ---
+++
@@ -11,7 +11,7 @@
if len(sys.argv) > 1:
chipmunk_git_path = sys.argv[1]
else:
- chipmunk_git_path = raw_input("Enter path to chipmunk source")
+ chipmunk_git_path = input("Enter path to chipmunk source")
shutil.copytree(os.path.join(chipmunk_git_path,"src"), os.path.join(pymunk_src_path,"src")... |
f845fcfc145edd2ef55df3275971f5c940a61bb4 | tests/list_match.py | tests/list_match.py | from bedrock import *
@annot('void -> int')
def main():
a = hint(Cons(0, Cons(1, Nil())), a='int')
a = Cons(1, Cons(2, Cons(3, Nil)))
b = match(a, ("Cons(_, Cons(two, Cons(_, Nil())))", identity),
("_", lambda: 4))
assert b == 2, "List pattern match"
return 0
| from bedrock import *
@annot('void -> int')
def main():
a = hint(Cons(0, Cons(1, Nil())), a='int')
a = hint(Cons(1, Cons(2, Cons(3, Nil))), a='int')
#b = hint(match(a, ("Cons(_, Cons(two, Cons(_, Nil())))", identity),
# ("_", lambda: 4)), a='int')
#assert b == 2, "List pattern match"
... | Disable match() test for now | Disable match() test for now
| Python | mit | pshc/archipelago,pshc/archipelago,pshc/archipelago | ---
+++
@@ -3,8 +3,8 @@
@annot('void -> int')
def main():
a = hint(Cons(0, Cons(1, Nil())), a='int')
- a = Cons(1, Cons(2, Cons(3, Nil)))
- b = match(a, ("Cons(_, Cons(two, Cons(_, Nil())))", identity),
- ("_", lambda: 4))
- assert b == 2, "List pattern match"
+ a = hint(Cons(1, Con... |
6233207fd57d499bc2bcd313a5b6d829ed712eab | tests/test_check.py | tests/test_check.py | # -*- coding: utf-8 -*-
from unittest.mock import patch
import semver
from chaostoolkit import __version__
from chaostoolkit.check import check_newer_version
class FakeResponse:
def __init__(self, status=200, url=None, response=None):
self.status_code = status
self.url = url
self.respons... | # -*- coding: utf-8 -*-
from unittest.mock import patch
import semver
from chaostoolkit import __version__
from chaostoolkit.check import check_newer_version
class FakeResponse:
def __init__(self, status=200, url=None, response=None):
self.status_code = status
self.url = url
self.respons... | Handle differences between semver and PEP440 | Handle differences between semver and PEP440
Signed-off-by: Sylvain Hellegouarch <16795633e2c1543064a3ad70ac3ba71d3d589b3b@defuze.org>
| Python | apache-2.0 | chaostoolkit/chaostoolkit | ---
+++
@@ -31,7 +31,8 @@
@patch("chaostoolkit.check.requests", autospec=True)
def test_version_is_newer(requests):
- newer_version = semver.bump_minor(__version__)
+ version = __version__.replace("rc", "-rc")
+ newer_version = semver.bump_minor(version)
requests.get.return_value = FakeResponse(
... |
d89747e26371b1986b4cec5a7514ba2c99480487 | tests/test_codec.py | tests/test_codec.py | from .common import *
from av.codec import Codec, Encoder, Decoder
class TestCodecs(TestCase):
def test_codec_mpeg4(self):
for cls in (Encoder, Decoder):
c = cls('mpeg4')
self.assertEqual(c.name, 'mpeg4')
self.assertEqual(c.long_name, 'MPEG-4 part 2')
self.... | from .common import *
from av.codec import Codec, Encoder, Decoder
class TestCodecs(TestCase):
def test_codec_mpeg4(self):
for cls in (Encoder, Decoder):
c = cls('mpeg4')
self.assertEqual(c.name, 'mpeg4')
self.assertEqual(c.long_name, 'MPEG-4 part 2')
self.... | Allow codec test to have more than just the one format | Allow codec test to have more than just the one format
| Python | bsd-3-clause | mcpv/PyAV,danielballan/PyAV,pupil-labs/PyAV,PyAV-Org/PyAV,markreidvfx/PyAV,PyAV-Org/PyAV,xxr3376/PyAV,pupil-labs/PyAV,pupil-labs/PyAV,xxr3376/PyAV,mikeboers/PyAV,markreidvfx/PyAV,danielballan/PyAV,danielballan/PyAV,xxr3376/PyAV,markreidvfx/PyAV,mcpv/PyAV,mikeboers/PyAV,mcpv/PyAV,pupil-labs/PyAV | ---
+++
@@ -13,5 +13,5 @@
self.assertEqual(c.id, 13)
formats = c.video_formats
- self.assertEqual(len(formats), 1)
- self.assertEqual(formats[0].name, 'yuv420p')
+ self.assertTrue(formats)
+ self.assertTrue(any(f.name == 'yuv420p' for f in format... |
82380cc6631ae91e0ef961e3bdfde70b9710af0f | reddit_liveupdate/activity.py | reddit_liveupdate/activity.py | from r2.lib import amqp, websockets
from reddit_liveupdate.models import ActiveVisitorsByLiveUpdateEvent
def broadcast_update():
event_ids = ActiveVisitorsByLiveUpdateEvent._cf.get_range(
column_count=1, filter_empty=False)
for event_id, is_active in event_ids:
if is_active:
coun... | from r2.lib import amqp, websockets
from reddit_liveupdate.models import ActiveVisitorsByLiveUpdateEvent
def broadcast_update():
event_ids = ActiveVisitorsByLiveUpdateEvent._cf.get_range(
column_count=1, filter_empty=False)
for event_id, is_active in event_ids:
if is_active:
coun... | Add comment to amqp.worker.join call. | Add comment to amqp.worker.join call.
| Python | bsd-3-clause | florenceyeun/reddit-plugin-liveupdate,madbook/reddit-plugin-liveupdate,sim642/reddit-plugin-liveupdate,madbook/reddit-plugin-liveupdate,madbook/reddit-plugin-liveupdate,florenceyeun/reddit-plugin-liveupdate,sim642/reddit-plugin-liveupdate,florenceyeun/reddit-plugin-liveupdate,sim642/reddit-plugin-liveupdate | ---
+++
@@ -22,4 +22,6 @@
websockets.send_broadcast(
"/live/" + event_id, type="activity", payload=payload)
+ # ensure that all the amqp messages we've put on the worker's queue are
+ # sent before we allow this script to exit.
amqp.worker.join() |
6fee21a630a9ba3b54f58152cb4549b4170b833f | docdata/urls.py | docdata/urls.py | from django.conf.urls.defaults import *
urlpatterns = patterns('docdata.views',
# Status change notifications
url(r'^status_change/$', 'status_change', name='status_change'),
) | from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('docdata.views',
# Status change notifications
url(r'^status_change/$', 'status_change', name='status_change'),
)
| Fix URL's to work with Django 1.5 | Fix URL's to work with Django 1.5 | Python | agpl-3.0 | dokterbob/django-docdata | ---
+++
@@ -1,4 +1,4 @@
-from django.conf.urls.defaults import *
+from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('docdata.views', |
3f2d27f63c1cfe2cc4616a4314420fa23daca487 | django_lightweight_queue/task.py | django_lightweight_queue/task.py | from .job import Job
from .utils import get_backend
from . import app_settings
class task(object):
def __init__(self, queue='default', timeout=None, sigkill_on_stop=False):
self.queue = queue
self.timeout = timeout
self.sigkill_on_stop = sigkill_on_stop
app_settings.WORKERS.setdef... | from .job import Job
from .utils import get_backend
from . import app_settings
class task(object):
def __init__(self, queue='default', timeout=None, sigkill_on_stop=False):
self.queue = queue
self.timeout = timeout
self.sigkill_on_stop = sigkill_on_stop
app_settings.WORKERS.setdef... | Allow overriding timeout and sigkill_on_stop too. | Allow overriding timeout and sigkill_on_stop too.
Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@thread.com>
| Python | bsd-3-clause | thread/django-lightweight-queue,prophile/django-lightweight-queue,prophile/django-lightweight-queue,thread/django-lightweight-queue,lamby/django-lightweight-queue | ---
+++
@@ -27,10 +27,15 @@
return "<TaskWrapper: %s>" % self.path
def __call__(self, *args, **kwargs):
- # Allow us to override which queue at the last moment
+ # Allow us to override the default values dynamically
queue = kwargs.pop('django_lightweight_queue_queue', self.queue... |
2c013f4fd30e93dc50f844a6c507b6b9f7d1c80e | doc/users/figures/background2.py | doc/users/figures/background2.py | from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
# setup Lambert Conformal basemap.
# set resolution=None to skip processing of boundary datasets.
m = Basemap(width=12000000,height=9000000,projection='lcc',
resolution=None,lat_1=45.,lat_2=55,lat_0=50,lon_0=-107.)
# draw a land-sea ma... | from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
# setup Lambert Conformal basemap.
# set resolution=None to skip processing of boundary datasets.
m = Basemap(width=12000000,height=9000000,projection='lcc',
resolution=None,lat_1=45.,lat_2=55,lat_0=50,lon_0=-107.)
# draw a land-sea ma... | Remove a redudant "plt.show()" statement | Remove a redudant "plt.show()" statement
| Python | mit | matplotlib/basemap,guziy/basemap,guziy/basemap,matplotlib/basemap | ---
+++
@@ -8,4 +8,3 @@
# lakes=True means plot inland lakes with ocean color.
m.drawlsmask(land_color='coral',ocean_color='aqua',lakes=True)
plt.show()
-plt.show() |
542f0d6f3091e1cbc3ab0563d2915a9ac80c3c91 | edmunds/exceptions/handler.py | edmunds/exceptions/handler.py |
from werkzeug.exceptions import HTTPException
import sys
from six import reraise
class Handler(object):
"""
The Exception handler
"""
def __init__(self, app):
"""
Initiate
:param app: The application
:type app: Edmunds.Application
"""
self.ap... |
from werkzeug.exceptions import HTTPException
import sys
from six import reraise
class Handler(object):
"""
The Exception handler
"""
def __init__(self, app):
"""
Initiate
:param app: The application
:type app: Edmunds.Application
"""
self.ap... | Fix response for testing errors | Fix response for testing errors
| Python | apache-2.0 | LowieHuyghe/edmunds | ---
+++
@@ -55,6 +55,6 @@
elif isinstance(exception, HTTPException):
return exception.get_response()
elif self.app.testing and is_error_code:
- return str(status_code), '%s' % exception
+ return '%s' % exception, status_code
else:
return str(s... |
442567a959b9fd5796de2f13154f66cdb25534b3 | python/default_crab_config.py | python/default_crab_config.py | __author__ = 'sbrochet'
def create_config(is_mc):
"""
Create a default CRAB configuration suitable to run the framework
:return:
"""
from CRABClient.UserUtilities import config, getUsernameFromSiteDB
config = config()
config.General.workArea = 'tasks'
config.General.transferOutputs = ... | __author__ = 'sbrochet'
def create_config(is_mc):
"""
Create a default CRAB configuration suitable to run the framework
:return:
"""
from CRABClient.UserUtilities import config, getUsernameFromSiteDB
config = config()
config.General.workArea = 'tasks'
config.General.transferOutputs = ... | Allow crab to run on PRODUCTION datasets | Allow crab to run on PRODUCTION datasets
| Python | mit | cp3-llbb/GridIn,cp3-llbb/GridIn | ---
+++
@@ -20,6 +20,7 @@
config.JobType.sendExternalFolder = True # To send electron MVA ids with jobs
config.Data.inputDBS = 'global'
+ config.Data.allowNonValidInputDataset = True
if is_mc:
config.Data.splitting = 'FileBased' |
5834fd76b74650366eb73c759541116cfbbfcbbe | radar/web/template_filters.py | radar/web/template_filters.py | from jinja2 import escape, Markup, evalcontextfilter
from radar.lib.utils import date_to_datetime, is_date
def strftime(dt, dt_format):
if dt is None:
return ''
else:
return dt.strftime(dt_format)
def year_format(dt):
if dt is None:
return ''
else:
return '%04d' % dt... | from jinja2 import escape, Markup, evalcontextfilter
from radar.lib.utils import date_to_datetime, is_date
def strftime(dt, dt_format):
if dt is None:
return ''
else:
return dt.strftime(dt_format)
def year_format(dt):
if dt is None:
return ''
else:
return '%04d' % dt... | Update nl2br to work with None as input | Update nl2br to work with None as input
| Python | agpl-3.0 | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | ---
+++
@@ -41,6 +41,9 @@
@evalcontextfilter
def nl2br(eval_ctx, value):
+ if value is None:
+ return ''
+
value = escape(value)
value = value.replace('\n', Markup('<br />\n'))
|
8c07f3decfc5fb556c9818172e6b7749d31eca37 | purchase_open_qty/__manifest__.py | purchase_open_qty/__manifest__.py | # Copyright 2017 ForgeFlow S.L.
# (http://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Purchase Open Qty",
"summary": "Allows to identify the purchase orders that have quantities "
"pending to invoice or to receive.",
"version": "13.0.1.0.1",
... | # Copyright 2017 ForgeFlow S.L.
# (http://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Purchase Open Qty",
"summary": "Allows to identify the purchase orders that have quantities "
"pending to invoice or to receive.",
"version": "13.0.1.0.1",
... | Delete empty " " spaces in same string line | [FIX] Delete empty " " spaces in same string line
| Python | agpl-3.0 | OCA/purchase-workflow,OCA/purchase-workflow | ---
+++
@@ -7,7 +7,7 @@
"summary": "Allows to identify the purchase orders that have quantities "
"pending to invoice or to receive.",
"version": "13.0.1.0.1",
- "author": "ForgeFlow, " "Odoo Community Association (OCA)",
+ "author": "ForgeFlow, Odoo Community Association (OCA)",
"website": ... |
66039d5238c7c18156f6a5bbbe8c28232bb65483 | example/main.py | example/main.py | #!/usr/bin/env python3
import logging
import sys
assert sys.version >= '3.3', 'Please use Python 3.3 or higher.'
from nacho.routing import Router
from nacho.http import HttpServer
from nacho.multithreading import Superviser
from nacho.app import Application
class Home(Application):
def get(self, request_args=No... | #!/usr/bin/env python3
import logging
import sys
assert sys.version >= '3.3', 'Please use Python 3.3 or higher.'
from nacho.routing import Router
from nacho.http import HttpServer
from nacho.multithreading import Superviser
from nacho.app import Application, StaticFile
class Home(Application):
def get(self, req... | Add sample used StaticFile server | Add sample used StaticFile server
| Python | mit | beni55/nacho,beni55/nacho,avelino/nacho | ---
+++
@@ -7,7 +7,7 @@
from nacho.routing import Router
from nacho.http import HttpServer
from nacho.multithreading import Superviser
-from nacho.app import Application
+from nacho.app import Application, StaticFile
class Home(Application):
@@ -18,6 +18,8 @@
def urls():
router = Router()
+ router.... |
50c44a5708d1c054207eba264e1cdf9d1f6718da | deployer/logger.py | deployer/logger.py | from __future__ import absolute_import
import logging
from logging.handlers import SysLogHandler
from conf.appconfig import LOG_FORMAT, LOG_DATE, LOG_ROOT_LEVEL, TOTEM_ENV, \
LOG_IDENTIFIER
def init_logging(name=None):
app_logger = logging.getLogger(name)
app_logger.setLevel(LOG_ROOT_LEVEL)
app_logge... | from __future__ import absolute_import
import logging
from logging.handlers import SysLogHandler
from conf.appconfig import LOG_FORMAT, LOG_DATE, LOG_ROOT_LEVEL, TOTEM_ENV, \
LOG_IDENTIFIER
def init_logging(name=None):
app_logger = logging.getLogger(name)
app_logger.setLevel(LOG_ROOT_LEVEL)
app_logge... | Set log level for handler | Set log level for handler
| Python | mit | totem/cluster-deployer,totem/cluster-deployer,totem/cluster-deployer | ---
+++
@@ -24,7 +24,7 @@
address='/dev/log',
facility=SysLogHandler.LOG_DAEMON)
handler.setFormatter(formatter)
- handler.setLevel(logging.INFO)
+ handler.setLevel(LOG_ROOT_LEVEL)
app_logger.addHandler(handler)
app_logger.info('Logger initialized')
... |
01d812f83c5526cc304f8d691ce9203d3e95633a | sampleproj/settings/travis.py | sampleproj/settings/travis.py | """
Django settings for travis-ci builds.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
from __future__ import absolute_import
from .base import *
# SECURITY WAR... | """
Django settings for travis-ci builds.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
from __future__ import absolute_import
from .base import *
# SECURITY WAR... | Add dummy email addresses for unit tests. | Add dummy email addresses for unit tests.
| Python | apache-2.0 | charlon/mdot,uw-it-aca/mdot,uw-it-aca/mdot,charlon/mdot,uw-it-aca/mdot,uw-it-aca/mdot,charlon/mdot | ---
+++
@@ -12,3 +12,8 @@
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'travis-xxxxxxxxxxxxxxxx'
+
+#Emails
+MDOT_HELP_EMAIL = 'test@testcase.edu' # String for help desk email address
+MDOT_UX_EMAIL = 'test@testcase.edu' # String for UX team email address
+MDOT_FORM_EMAIL = 'tes... |
0179e6680efca8a9a6a5f05db703da1ce7447b3e | flexget/__init__.py | flexget/__init__.py | #!/usr/bin/python
import os
import sys
import logging
from flexget import logger
from flexget.options import CoreOptionParser
from flexget import plugin
from flexget.manager import Manager
__version__ = '{subversion}'
log = logging.getLogger('main')
def main():
"""Main entry point for Command Line Interface"""... | #!/usr/bin/python
import os
import sys
import logging
from flexget import logger
from flexget.options import CoreOptionParser
from flexget import plugin
from flexget.manager import Manager
__version__ = '{subversion}'
log = logging.getLogger('main')
def main():
"""Main entry point for Command Line Interface"""... | Fix traceback when config file is not found. | Fix traceback when config file is not found.
git-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@2541 3942dd89-8c5d-46d7-aeed-044bccf3e60c
| Python | mit | Danfocus/Flexget,tobinjt/Flexget,OmgOhnoes/Flexget,malkavi/Flexget,sean797/Flexget,vfrc2/Flexget,asm0dey/Flexget,vfrc2/Flexget,OmgOhnoes/Flexget,jawilson/Flexget,v17al/Flexget,qvazzler/Flexget,jawilson/Flexget,oxc/Flexget,dsemi/Flexget,qvazzler/Flexget,asm0dey/Flexget,Pretagonist/Flexget,qk4l/Flexget,OmgOhnoes/Flexget,... | ---
+++
@@ -27,7 +27,7 @@
manager = Manager(options)
except IOError, e:
# failed to load config, TODO: why should it be handled here? So sys.exit isn't called in webui?
- log.exception(e)
+ log.critical(e)
logger.flush_logging_to_console()
sys.exit(1)
|
e0f80de15d1ddabc3bd47d6396edbaaac5a08041 | examples/motion_example.py | examples/motion_example.py | #!/usr/bin/env python3
"""This example shows how to use the Motion Click wrapper of the LetMeCreate
library.
Whenever the motion click detects an event, it flashes all LED's ten times.
The user must press Ctrl+C to terminate the program.
The Motion Click must be inserted in Mikrobus 1 before running this program.
"""... | #!/usr/bin/env python3
"""This example shows how to use the Motion Click wrapper of the LetMeCreate
library.
Whenever the motion click detects an event, it flashes all LED's ten times.
The user must press Ctrl+C to terminate the program.
The Motion Click must be inserted in Mikrobus 1 before running this program.
"""... | Add missing import for sleep | motion: Add missing import for sleep
Signed-off-by: Francois Berder <59eaf4bb0211c66c3d7532da6d77ecf42a779d82@outlook.fr>
| Python | bsd-3-clause | francois-berder/PyLetMeCreate | ---
+++
@@ -11,6 +11,7 @@
from letmecreate.core.common import MIKROBUS_1
from letmecreate.core import led
from letmecreate.click import motion
+from time import sleep
def flash_leds(arg): |
14d9b5fd2e24245ac3333d1a1fe6a4a9fd33751a | example/example.py | example/example.py | from collections import OrderedDict
import os
import sys
from plumbium import call, record, pipeline, recorders
@record()
def pipeline_stage_1():
call([os.path.expanduser('~/programming/Plumbium/example/example_script.sh')])
@record()
def pipeline_stage_2():
call([os.path.expanduser('~/programming/Plumbium/... | from collections import OrderedDict
import os
import sys
from plumbium import call, record, pipeline
from plumbium.recorders import CSVFile
@record()
def pipeline_stage_1():
call(['echo', 'foo'])
@record()
def pipeline_stage_2():
call(['echo', 'data: 55'])
def my_pipeline():
pipeline_stage_1()
pip... | Update to work with recorders submodule | Update to work with recorders submodule
| Python | mit | jstutters/Plumbium | ---
+++
@@ -1,17 +1,18 @@
from collections import OrderedDict
import os
import sys
-from plumbium import call, record, pipeline, recorders
+from plumbium import call, record, pipeline
+from plumbium.recorders import CSVFile
@record()
def pipeline_stage_1():
- call([os.path.expanduser('~/programming/Plumbi... |
3c573e2b02a18627b82f4a25fef67adae295d653 | rbm2m/models/setting.py | rbm2m/models/setting.py | # -*- coding: utf-8 -*-
from sqlalchemy import Column, String
from .base import Base
class Setting(Base):
__tablename__ = 'settings'
name = Column(String(32), nullable=False, primary_key=True)
value = Column(String(512))
default_value = Column(String(512))
title = Column(String(127), nullable=Fa... | # -*- coding: utf-8 -*-
from sqlalchemy import Column, String, Text
from .base import Base
class Setting(Base):
__tablename__ = 'settings'
name = Column(String(32), nullable=False, primary_key=True)
value = Column(Text)
default_value = Column(Text)
title = Column(String(127), nullable=False)
... | Set setings.value type to text | Set setings.value type to text
| Python | apache-2.0 | notapresent/rbm2m,notapresent/rbm2m | ---
+++
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from sqlalchemy import Column, String
+from sqlalchemy import Column, String, Text
from .base import Base
@@ -8,8 +8,8 @@
__tablename__ = 'settings'
name = Column(String(32), nullable=False, primary_key=True)
- value = Column(String(512))
- defa... |
7f57e850619f0a4ca4f63aa26234ce3fba8b9cf0 | reference/gittaggers.py | reference/gittaggers.py | from setuptools.command.egg_info import egg_info
import subprocess
import time
class EggInfoFromGit(egg_info):
"""Tag the build with git commit timestamp.
If a build tag has already been set (e.g., "egg_info -b", building
from source package), leave it alone.
"""
def git_timestamp_tag(self):
... | from setuptools.command.egg_info import egg_info
import subprocess
import time
class EggInfoFromGit(egg_info):
"""Tag the build with git commit timestamp.
If a build tag has already been set (e.g., "egg_info -b", building
from source package), leave it alone.
"""
def git_timestamp_tag(self):
... | Fix Python packaging to use correct git log for package time/version stamps. | Fix Python packaging to use correct git log for package time/version stamps.
| Python | apache-2.0 | foreveremain/common-workflow-language,SciDAP/cwltool,brainstorm/common-workflow-language,dleehr/common-workflow-language,dleehr/cwltool,guillermo-carrasco/common-workflow-language,dleehr/cwltool,ohsu-computational-biology/common-workflow-language,StarvingMarvin/common-workflow-language,satra/common-workflow-language,mr... | ---
+++
@@ -11,7 +11,7 @@
def git_timestamp_tag(self):
gitinfo = subprocess.check_output(
['git', 'log', '--first-parent', '--max-count=1',
- '--format=format:%ct', '.']).strip()
+ '--format=format:%ct', '..']).strip()
return time.strftime('.%Y%m%d%H%M%S', t... |
599ec99b6f57e37f7f4009afb9498abffd70ff34 | grammpy_transforms/SplittedRules/splitted_rules.py | grammpy_transforms/SplittedRules/splitted_rules.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.12.2017 16:05
:Licence GNUv3
Part of transofmer
"""
from grammpy import Nonterminal
def splitted_rules(root: Nonterminal):
return root
| #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.12.2017 16:05
:Licence GNUv3
Part of transofmer
"""
from grammpy import Nonterminal, Rule, EPSILON
from grammpy.Grammars.MultipleRulesGrammar import SplitRule
class Adding:
def __init__(self, rule: Rule):
self.rule = rule
self.process... | Add implementation of splitted rules | Add implementation of splitted rules
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -7,8 +7,43 @@
"""
-from grammpy import Nonterminal
+from grammpy import Nonterminal, Rule, EPSILON
+from grammpy.Grammars.MultipleRulesGrammar import SplitRule
+class Adding:
+ def __init__(self, rule: Rule):
+ self.rule = rule
+ self.processed = False
+
+ def process(self):
+ ... |
1db16a65b114d514257d4525c41e0b3f74d1d479 | dataset/dataset/settings.py | dataset/dataset/settings.py | # Scrapy settings for dataset project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'dataset'
SPIDER_MODULES = ['dataset.spiders']
NEWSPIDER_MODULE = 'dataset.s... | # Scrapy settings for dataset project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'dataset'
SPIDER_MODULES = ['dataset.spiders']
NEWSPIDER_MODULE = 'dataset.s... | Enable Feed Exports and set to JSONLines | Enable Feed Exports and set to JSONLines
| Python | mit | MaxLikelihood/CODE | ---
+++
@@ -15,5 +15,8 @@
'dataset.pipelines.DatasetPipeline': 100,
}
+FEED_URI = 'file'
+FEED_FORMAT = 'jsonlines'
+
# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = 'dataset (+http://www.yourdomain.com)' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.