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 |
|---|---|---|---|---|---|---|---|---|---|---|
dccc36a49111cd978add1ea9cd1fe26e6526c69f | data/calculate_totals.py | data/calculate_totals.py | # calculate_totals.py
import json
import datetime
from collections import defaultdict
# http://stackoverflow.com/questions/6999726/how-can-i-convert-a-datetime-object-to-milliseconds-since-epoch-unix-time-in-p
def unix_time(dt):
epoch = datetime.datetime.utcfromtimestamp(0)
delta = dt - epoch
return delta... | Add a py script to get monthly totals. | Add a py script to get monthly totals.
| Python | mit | jimbo00000/meetup-attendance-graph | ---
+++
@@ -0,0 +1,48 @@
+# calculate_totals.py
+
+import json
+import datetime
+from collections import defaultdict
+
+# http://stackoverflow.com/questions/6999726/how-can-i-convert-a-datetime-object-to-milliseconds-since-epoch-unix-time-in-p
+def unix_time(dt):
+ epoch = datetime.datetime.utcfromtimestamp(0)
+ ... | |
920e578c7ff192621a982b154f0b22c408667fed | main_circle.py | main_circle.py | #!/usr/bin/python2
import sys
sys.path = ['', 'pyglet-1.1.4'] + sys.path
import math
import pyglet
from pyglet.graphics import vertex_list
from pyglet import gl
from pyglet.window import key
window = pyglet.window.Window(width=800, height=600, resizable=True)
fps_display = pyglet.clock.ClockDisplay()
num_points =... | Add magice circle demo app | Add magice circle demo app
| Python | mit | dragonfi/snowfall,dragonfi/snowfall | ---
+++
@@ -0,0 +1,56 @@
+#!/usr/bin/python2
+
+import sys
+sys.path = ['', 'pyglet-1.1.4'] + sys.path
+
+import math
+
+import pyglet
+from pyglet.graphics import vertex_list
+from pyglet import gl
+from pyglet.window import key
+
+window = pyglet.window.Window(width=800, height=600, resizable=True)
+
+fps_display =... | |
243744ce6f692b524c4cf65508f2aecba8a035d2 | nodes/transform_stamped_to_tf2.py | nodes/transform_stamped_to_tf2.py | #!/usr/bin/env python
import rospy
import tf2_ros
from geometry_msgs.msg import TransformStamped
class TransformBroadcaster(object):
'''This is hack to avoid tf2_ros on python3
'''
def __init__(self):
self._sub = rospy.Subscriber('transforms', TransformStamped,
... | Add node to use tf2 | Add node to use tf2
| Python | apache-2.0 | sem23/cozmo_driver,OTL/cozmo_driver | ---
+++
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+import rospy
+import tf2_ros
+from geometry_msgs.msg import TransformStamped
+
+
+class TransformBroadcaster(object):
+ '''This is hack to avoid tf2_ros on python3
+ '''
+ def __init__(self):
+ self._sub = rospy.Subscriber('transforms', TransformStamp... | |
1ec07fa16d3be0796b7783fe3b5a3ba0728fb7bc | prototype/speed/rpcsize.py | prototype/speed/rpcsize.py | #!/usr/bin/env python
from pyon.net.endpoint import RPCClient
#from interface.services.idatastore_service import IDatastoreService
from interface.services.ihello_service import IHelloService
from pyon.net.messaging import make_node
import gevent
import time
import base64
import os
import argparse
import msgpack
parse... | Add more direct RPC size tests | Add more direct RPC size tests
| Python | bsd-2-clause | mkl-/scioncc,ooici/pyon,scionrep/scioncc,scionrep/scioncc,mkl-/scioncc,crchemist/scioncc,scionrep/scioncc,mkl-/scioncc,crchemist/scioncc,ooici/pyon,crchemist/scioncc | ---
+++
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+
+from pyon.net.endpoint import RPCClient
+#from interface.services.idatastore_service import IDatastoreService
+from interface.services.ihello_service import IHelloService
+from pyon.net.messaging import make_node
+import gevent
+import time
+import base64
+import os
... | |
2c071f2d8cdcf92f0d383422017ddc2a24189f68 | scripts/add_new_plugin.py | scripts/add_new_plugin.py | import os
import click
@click.command()
@click.option(
'--matcher',
type=click.Choice(['url', 'body', 'header']),
required=True,
help='Set the matcher type.',
)
@click.option(
'--value',
type=str,
required=True,
help='Set the matcher value.',
)
@click.option(
'--category',
typ... | Add script to create plugins faster | Add script to create plugins faster
| Python | mit | spectresearch/detectem | ---
+++
@@ -0,0 +1,81 @@
+import os
+
+import click
+
+
+@click.command()
+@click.option(
+ '--matcher',
+ type=click.Choice(['url', 'body', 'header']),
+ required=True,
+ help='Set the matcher type.',
+)
+@click.option(
+ '--value',
+ type=str,
+ required=True,
+ help='Set the matcher value.'... | |
cb1a0aa689f9f86ba576f9637a8548cfaeaf0439 | tests/src/test_data_seeder.py | tests/src/test_data_seeder.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2010-2012 Cidadania S. Coop. Galega
#
# This file is part of e-cidadania.
#
# e-cidadania is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | Add tests for the data seeder. | Add tests for the data seeder.
| Python | apache-2.0 | cidadania/e-cidadania,cidadania/e-cidadania | ---
+++
@@ -0,0 +1,76 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2010-2012 Cidadania S. Coop. Galega
+#
+# This file is part of e-cidadania.
+#
+# e-cidadania is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Found... | |
e8b3d1ea64407322cc578752c49eaa1a33027d40 | mars_r00_harmatheque.py | mars_r00_harmatheque.py | #!/usr/bin/env python
'''
Script for removing Harmatheque e-book records from MARS R00 report.
Created for the Harvard Library ITS MARS Reports Pilot Project, 2014.
'''
import codecs
import csv
import glob
import requests
import time
from lxml import html
nets = []
not_nets = []
counter = 0
for file in glob.glob('*... | Add script for removing e-book records | Add script for removing e-book records
Added temporary script to remove Harmatheque e-book records from R00
report. Script should be integrated into mars_enhance.csv.
| Python | mit | mbeckett7/mars-reports-project | ---
+++
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+'''
+Script for removing Harmatheque e-book records from MARS R00 report.
+Created for the Harvard Library ITS MARS Reports Pilot Project, 2014.
+'''
+import codecs
+import csv
+import glob
+import requests
+import time
+from lxml import html
+
+nets = []
+not_nets = [... | |
3a6dc8d05f158f08d064fd6bccd6d93843651deb | enqueue-test.py | enqueue-test.py | #!/usr/bin/env python
# encoding: utf-8
"""
enqueue-test.py
Created by Gavin M. Roy on 2009-09-11.
Copyright (c) 2009 Insider Guides, Inc.. All rights reserved.
"""
import amqplib.client_0_8 as amqp
import sys
import os
def main():
conn = amqp.Connection(host="mq07:5672 ", userid="guest",
password="gues... | Throw things into a queue. | Throw things into a queue.
| Python | bsd-3-clause | gmr/rejected,gmr/rejected | ---
+++
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+# encoding: utf-8
+"""
+enqueue-test.py
+
+Created by Gavin M. Roy on 2009-09-11.
+Copyright (c) 2009 Insider Guides, Inc.. All rights reserved.
+"""
+
+import amqplib.client_0_8 as amqp
+import sys
+import os
+
+
+def main():
+ conn = amqp.Connection(host="mq07:567... | |
4c1d5641ec1d1bc74c7738558b3e9a6312114cba | morsefit/leastsq2opt.py | morsefit/leastsq2opt.py | """Defines subroutines for converting a leastsq closure to minimize closure
Since the :py:func:`scipy.optimize.leastsq` seems to be limited in terms of its
performance, the more generate :py:func:`scipy.optimize.minimize` function can be
tried to be used. However, they required different kind of closures for
computing... | Add the closure conversion functions | Add the closure conversion functions
In order to utilize the general minimization functions of scipy,
conversion routines are added to convert the previous residue and
Jacobian closure to be used with the general function.
| Python | mpl-2.0 | tschijnmo/morsefit | ---
+++
@@ -0,0 +1,64 @@
+"""Defines subroutines for converting a leastsq closure to minimize closure
+
+Since the :py:func:`scipy.optimize.leastsq` seems to be limited in terms of its
+performance, the more generate :py:func:`scipy.optimize.minimize` function can be
+tried to be used. However, they required differen... | |
842035001d5119e1cb5effd192ab245450be01d8 | examples/mayavi/surface_from_irregular_data.py | examples/mayavi/surface_from_irregular_data.py | """
An example which shows how to plot a surface from data acquired
irregularly.
Data giving the variation of a parameter 'z' as a function of two others
('x' and 'y') is often plotted as a `carpet plot`, using a surface to
visualize the underlying function. when the data has been acquired on a
regular grid for parame... | Add an example showing the use of the delaunay2d filter to build a surface from a scattered set of points. | Add an example showing the use of the delaunay2d filter to build a surface from a scattered set of points.
| Python | bsd-3-clause | alexandreleroux/mayavi,liulion/mayavi,dmsurti/mayavi,liulion/mayavi,alexandreleroux/mayavi,dmsurti/mayavi | ---
+++
@@ -0,0 +1,50 @@
+"""
+An example which shows how to plot a surface from data acquired
+irregularly.
+
+Data giving the variation of a parameter 'z' as a function of two others
+('x' and 'y') is often plotted as a `carpet plot`, using a surface to
+visualize the underlying function. when the data has been acq... | |
cb45cea953880bf87a774bec4120bb0e7331d480 | tcconfig/parser/_model.py | tcconfig/parser/_model.py | from simplesqlite.model import Integer, Model, Text
from .._const import Tc
class Filter(Model):
device = Text(attr_name=Tc.Param.DEVICE, not_null=True)
filter_id = Text(attr_name=Tc.Param.FILTER_ID)
flowid = Text(attr_name=Tc.Param.FLOW_ID)
protocol = Text(attr_name=Tc.Param.PROTOCOL)
priority =... | Add ORM models for filter/qdisc | Add ORM models for filter/qdisc
| Python | mit | thombashi/tcconfig,thombashi/tcconfig | ---
+++
@@ -0,0 +1,32 @@
+from simplesqlite.model import Integer, Model, Text
+
+from .._const import Tc
+
+
+class Filter(Model):
+ device = Text(attr_name=Tc.Param.DEVICE, not_null=True)
+ filter_id = Text(attr_name=Tc.Param.FILTER_ID)
+ flowid = Text(attr_name=Tc.Param.FLOW_ID)
+ protocol = Text(attr_n... | |
0291ac95161db254e5daa111670c422fdd2b1571 | test/expressions/expr8.py | test/expressions/expr8.py | assert a or b, 'aaa'
assert : keyword.control.flow.python, source.python
a : source.python
or : keyword.operator.python, source.python
b, : source.python
' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python
aaa : sou... | Add a test for the assert statement | Add a test for the assert statement
| Python | mit | MagicStack/MagicPython,MagicStack/MagicPython,MagicStack/MagicPython | ---
+++
@@ -0,0 +1,11 @@
+assert a or b, 'aaa'
+
+
+
+assert : keyword.control.flow.python, source.python
+ a : source.python
+or : keyword.operator.python, source.python
+ b, : source.python
+' : punctuation.definition.string.begin.python, source.python, string.quot... | |
804f2dbc31a36d55d422c69d35cc93e645634f09 | test/lib/test_download.py | test/lib/test_download.py | # Run the following command to test:
#
# (in /usr/local/googkit)
# $ python -m {test_module_name}
#
# See also: http://docs.python.org/3.3/library/unittest.html#command-line-interface
#
# We cannot use unittest.mock on python 2.x!
# Please install the Mock module when you use Python 2.x.
#
# $ easy_install ... | Add a test for lib.download | Add a test for lib.download
| Python | mit | googkit/googkit,googkit/googkit,googkit/googkit | ---
+++
@@ -0,0 +1,54 @@
+# Run the following command to test:
+#
+# (in /usr/local/googkit)
+# $ python -m {test_module_name}
+#
+# See also: http://docs.python.org/3.3/library/unittest.html#command-line-interface
+#
+# We cannot use unittest.mock on python 2.x!
+# Please install the Mock module when you use... | |
ac3447251395a0f6ee445d76e1c32910505a5bd4 | scripts/remove_after_use/reindex_quickfiles.py | scripts/remove_after_use/reindex_quickfiles.py | import sys
import progressbar
from django.core.paginator import Paginator
from website.app import setup_django
setup_django()
from website.search.search import update_file
from osf.models import QuickFilesNode
PAGE_SIZE = 50
def reindex_quickfiles(dry):
qs = QuickFilesNode.objects.all().order_by('id')
coun... | Add script to re-index users' files in quickfiles nodes | Add script to re-index users' files in quickfiles nodes
| Python | apache-2.0 | caseyrollins/osf.io,sloria/osf.io,erinspace/osf.io,aaxelb/osf.io,pattisdr/osf.io,sloria/osf.io,CenterForOpenScience/osf.io,pattisdr/osf.io,HalcyonChimera/osf.io,icereval/osf.io,adlius/osf.io,brianjgeiger/osf.io,mattclark/osf.io,Johnetordoff/osf.io,adlius/osf.io,aaxelb/osf.io,caseyrollins/osf.io,CenterForOpenScience/osf... | ---
+++
@@ -0,0 +1,32 @@
+import sys
+
+import progressbar
+from django.core.paginator import Paginator
+
+from website.app import setup_django
+setup_django()
+
+from website.search.search import update_file
+from osf.models import QuickFilesNode
+
+PAGE_SIZE = 50
+
+def reindex_quickfiles(dry):
+ qs = QuickFiles... | |
2e5dbd5f76839e65e7d6658a0f5fabe9ce00f3d4 | tests/unit/modules/test_tomcat.py | tests/unit/modules/test_tomcat.py | # -*- coding: utf-8 -*-
# Import future libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Testing libs
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import TestCase
from tests.support.mock import MagicMock, patch
# Import salt module
import s... | Add unit test for _wget method in tomcat module | Add unit test for _wget method in tomcat module
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+
+# Import future libs
+from __future__ import absolute_import, print_function, unicode_literals
+
+# Import Salt Testing libs
+from tests.support.mixins import LoaderModuleMockMixin
+from tests.support.unit import TestCase
+from tests.support.mock import MagicMock, ... | |
ebfe1254ea11112689fa606cd6c29100a26e058d | acme/acme/__init__.py | acme/acme/__init__.py | """ACME protocol implementation.
This module is an implementation of the `ACME protocol`_. Latest
supported version: `v02`_.
.. _`ACME protocol`: https://github.com/letsencrypt/acme-spec
.. _`v02`:
https://github.com/letsencrypt/acme-spec/commit/d328fea2d507deb9822793c512830d827a4150c4
"""
| """ACME protocol implementation.
This module is an implementation of the `ACME protocol`_. Latest
supported version: `draft-ietf-acme-01`_.
.. _`ACME protocol`: https://github.com/ietf-wg-acme/acme/
.. _`draft-ietf-acme-01`:
https://github.com/ietf-wg-acme/acme/tree/draft-ietf-acme-acme-01
"""
| Update the ACME github repository URL. | Update the ACME github repository URL.
| Python | apache-2.0 | jsha/letsencrypt,letsencrypt/letsencrypt,mitnk/letsencrypt,stweil/letsencrypt,bsmr-misc-forks/letsencrypt,stweil/letsencrypt,letsencrypt/letsencrypt,VladimirTyrin/letsencrypt,lmcro/letsencrypt,lmcro/letsencrypt,DavidGarciaCat/letsencrypt,DavidGarciaCat/letsencrypt,twstrike/le_for_patching,brentdax/letsencrypt,mitnk/let... | ---
+++
@@ -1,12 +1,12 @@
"""ACME protocol implementation.
This module is an implementation of the `ACME protocol`_. Latest
-supported version: `v02`_.
+supported version: `draft-ietf-acme-01`_.
-.. _`ACME protocol`: https://github.com/letsencrypt/acme-spec
+.. _`ACME protocol`: https://github.com/ietf-wg-acme/... |
dac411035f12f92f336d6c42aa3103b3c04f01ab | backend/populate_dimkarakostas.py | backend/populate_dimkarakostas.py | from string import ascii_lowercase
import django
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
django.setup()
from breach.models import Target, Victim
endpoint = 'https://dimkarakostas.com/rupture/test.php?ref=%s'
prefix = 'imper'
alphabet = ascii_lowercase
secretlength = 9
target_1 ... | from string import ascii_lowercase
import django
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
django.setup()
from breach.models import Target, Victim
endpoint = 'https://dimkarakostas.com/rupture/test.php?ref=%s'
prefix = 'imper'
alphabet = ascii_lowercase
secretlength = 9
target_1 ... | Add method comment to population script for easy deploy | Add method comment to population script for easy deploy
| Python | mit | dionyziz/rupture,dimkarakostas/rupture,esarafianou/rupture,dionyziz/rupture,dimriou/rupture,dimkarakostas/rupture,dionyziz/rupture,dimriou/rupture,dimkarakostas/rupture,dimkarakostas/rupture,dionyziz/rupture,esarafianou/rupture,dimriou/rupture,dimriou/rupture,esarafianou/rupture,esarafianou/rupture,dimkarakostas/ruptur... | ---
+++
@@ -28,7 +28,8 @@
victim_1 = Victim(
target=target_1,
snifferendpoint=snifferendpoint,
- sourceip=sourceip
+ sourceip=sourceip,
+ # method='serial'
)
victim_1.save()
|
1eb2d3b9fa773455e9c69921b58529241e59b00e | thezombies/management/commands/report_invalid_urls.py | thezombies/management/commands/report_invalid_urls.py | from __future__ import division
from django.core.management.base import BaseCommand
from django.utils import timezone
from thezombies.models import (Agency, Probe)
REPORT_DATE_FORMATTER = u"{:%Y-%m-%d %I:%M%p %Z}\n"
class Command(BaseCommand):
"""Show some information on invalid/bad urls"""
def handle(self,... | from __future__ import division
from django.core.management.base import BaseCommand
from django.utils import timezone
from thezombies.models import (Agency, Probe)
REPORT_DATE_FORMATTER = u"{:%Y-%m-%d %I:%M%p %Z}\n"
class Command(BaseCommand):
"""Show some information on invalid/bad urls"""
def handle(self,... | Add url count per agency to the invalid url report | Add url count per agency to the invalid url report
| Python | bsd-3-clause | sunlightlabs/thezombies,sunlightlabs/thezombies,sunlightlabs/thezombies,sunlightlabs/thezombies | ---
+++
@@ -19,9 +19,9 @@
probe_list = Probe.objects.filter(audit__agency=agency, result__contains={'valid_url': 'false'})
if probe_list.count() == 0:
self.stdout.write('None!\n\n')
+ else:
+ self.stdout.write('URL Count: {0}\n\n'.format(probe_list.... |
462b8e53c8a1add0f471f53d31718816939f1372 | cineapp/utils.py | cineapp/utils.py | # -*- coding: utf-8 -*-
def frange(start, end, step):
tmp = start
while(tmp <= end):
yield tmp
tmp += step
| # -*- coding: utf-8 -*-
from cineapp import db
from cineapp.models import Movie, Mark
from sqlalchemy.sql.expression import literal, desc
def frange(start, end, step):
tmp = start
while(tmp <= end):
yield tmp
tmp += step
def get_activity_list(start, length):
"""
Returns an array containing activity records ... | Move activity SQL query into a dedicated function | Move activity SQL query into a dedicated function
The SQL query based on the UNION predicate is now into a function which takes as
parameters the number of record we want to have in the result. This function
will be used for the activity dashboard and also for the new global activity
page using the datatable plugin.
... | Python | mit | ptitoliv/cineapp,ptitoliv/cineapp,ptitoliv/cineapp | ---
+++
@@ -1,7 +1,48 @@
# -*- coding: utf-8 -*-
+from cineapp import db
+from cineapp.models import Movie, Mark
+from sqlalchemy.sql.expression import literal, desc
def frange(start, end, step):
tmp = start
while(tmp <= end):
yield tmp
tmp += step
+
+def get_activity_list(start, length):
+
+ """
+ Ret... |
2280624b54ec8f1ebae656336fab13d032f504ad | antevents/__init__.py | antevents/__init__.py | # Copyright 2016 by MPI-SWS and Data-Ken Research.
# Licensed under the Apache 2.0 License.
"""
This is the main package for antevents. Directly within this package you fill
find the following modules:
* `base` - the core abstractions and classes of the system.
* `sensor` - defines data types and functions specifica... | # Copyright 2016 by MPI-SWS and Data-Ken Research.
# Licensed under the Apache 2.0 License.
"""
This is the main package for antevents. Directly within this package you fill
find the following module:
* `base` - the core abstractions and classes of the system.
The rest of the functionality is in sub-packages:
* `a... | Update doc string on location of sensors | Update doc string on location of sensors
| Python | apache-2.0 | mpi-sws-rse/thingflow-python,mpi-sws-rse/antevents-python,mpi-sws-rse/thingflow-python,mpi-sws-rse/antevents-python | ---
+++
@@ -2,16 +2,16 @@
# Licensed under the Apache 2.0 License.
"""
This is the main package for antevents. Directly within this package you fill
-find the following modules:
+find the following module:
* `base` - the core abstractions and classes of the system.
- * `sensor` - defines data types and functio... |
d36053764e8a5776d3c37a7e35beb9ba5cb67386 | dask/diagnostics/__init__.py | dask/diagnostics/__init__.py | from .profile import Profiler, ResourceProfiler
from .progress import ProgressBar
| from .profile import Profiler, ResourceProfiler
from .progress import ProgressBar
try:
from .profile_visualize import visualize
except ImportError:
pass
| Add visualize to diagnostics import | Add visualize to diagnostics import
| Python | bsd-3-clause | PhE/dask,mraspaud/dask,vikhyat/dask,dask/dask,jcrist/dask,vikhyat/dask,mrocklin/dask,mrocklin/dask,cpcloud/dask,pombredanne/dask,ContinuumIO/dask,ContinuumIO/dask,dask/dask,gameduell/dask,blaze/dask,blaze/dask,jakirkham/dask,chrisbarber/dask,jcrist/dask,PhE/dask,mikegraham/dask,jakirkham/dask,cowlicks/dask,mraspaud/das... | ---
+++
@@ -1,2 +1,6 @@
from .profile import Profiler, ResourceProfiler
from .progress import ProgressBar
+try:
+ from .profile_visualize import visualize
+except ImportError:
+ pass |
bae391e1f5485dfb3f973144ef8d8413a2ac2f75 | circuits/app/dropprivileges.py | circuits/app/dropprivileges.py | from pwd import getpwnam
from grp import getgrnam
from traceback import format_exc
from os import getuid, setgroups, setgid, setuid, umask
from circuits.core import handler, BaseComponent
class DropPrivileges(BaseComponent):
def init(self, user="nobody", group="nobody", **kwargs):
self.user = user
... | from pwd import getpwnam
from grp import getgrnam
from traceback import format_exc
from os import getuid, setgroups, setgid, setuid, umask
from circuits.core import handler, BaseComponent
class DropPrivileges(BaseComponent):
def init(self, user="nobody", group="nobody", **kwargs):
self.user = user
... | Fix DropPrivileges component to be compatible with python3 | Fix DropPrivileges component to be compatible with python3
| Python | mit | nizox/circuits,treemo/circuits,treemo/circuits,eriol/circuits,eriol/circuits,eriol/circuits,treemo/circuits | ---
+++
@@ -36,7 +36,7 @@
setuid(uid)
# Ensure a very conservative umask
- umask(077)
+ umask(0o077)
except Exception as error:
print("ERROR: Could not drop privileges {0:s}".format(error))
print(format_exc()) |
6c417f49ebd0f466ebf8100a28006e7c5ea2ff3d | tests/lib/__init__.py | tests/lib/__init__.py | from os.path import abspath, dirname, join
import sh
import psycopg2
import requests
PROJECT_FOLDER=dirname(dirname(abspath(__file__)))
DOCKER_FOLDER=join(PROJECT_FOLDER, 'docker')
def docker_compose(version, *args):
sh.docker_compose('-f', 'docker/{version}/docker-compose.yml'.format(version=version), *args)
d... | from os.path import abspath, dirname, join
import sh
import psycopg2
import requests
PROJECT_FOLDER=dirname(dirname(abspath(__file__)))
DOCKER_FOLDER=join(PROJECT_FOLDER, 'docker')
def docker_compose(version, *args):
sh.docker_compose('-f', 'docker/{version}/docker-compose.yml'.format(version=version), *args)
d... | Create somewhat questionable sql function | Create somewhat questionable sql function
| Python | mit | matthewfranglen/postgres-elasticsearch-fdw | ---
+++
@@ -11,16 +11,24 @@
sh.docker_compose('-f', 'docker/{version}/docker-compose.yml'.format(version=version), *args)
def test_pg():
- try:
- with psycopg2.connect(host='localhost', port=5432, user='postgres', dbname='postgres') as conn:
- with conn.cursor() as cursor:
- ... |
3fc1637350cb85b3c83d1a4561493bf526cea810 | kolibri/__init__.py | kolibri/__init__.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from .utils.version import get_version
#: This may not be the exact version as it's subject to modification with
#: get_version() - use ``kolibri.__version__`` for the exact version string.
VERSION = (... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from .utils.version import get_version
#: This may not be the exact version as it's subject to modification with
#: get_version() - use ``kolibri.__version__`` for the exact version string.
VERSION = (... | Update 0.9 alpha to 0.10 alpha | Update 0.9 alpha to 0.10 alpha
| Python | mit | benjaoming/kolibri,indirectlylit/kolibri,lyw07/kolibri,mrpau/kolibri,DXCanas/kolibri,indirectlylit/kolibri,indirectlylit/kolibri,DXCanas/kolibri,benjaoming/kolibri,benjaoming/kolibri,jonboiser/kolibri,learningequality/kolibri,lyw07/kolibri,mrpau/kolibri,jonboiser/kolibri,lyw07/kolibri,lyw07/kolibri,learningequality/kol... | ---
+++
@@ -6,7 +6,7 @@
#: This may not be the exact version as it's subject to modification with
#: get_version() - use ``kolibri.__version__`` for the exact version string.
-VERSION = (0, 9, 0, 'alpha', 0)
+VERSION = (0, 10, 0, 'alpha', 0)
__author__ = 'Learning Equality'
__email__ = 'info@learningequality.... |
6ecc64a7a22b9b57958dad704d309b18028140e1 | tests/test_drivers.py | tests/test_drivers.py |
import logging
import os.path
import shutil
import sys
import tempfile
import fiona
def test_options(tmpdir=None):
"""Test that setting CPL_DEBUG=ON works"""
if tmpdir is None:
tempdir = tempfile.mkdtemp()
logfile = os.path.join(tempdir, 'example.log')
else:
logfile = str(tmpdir.j... |
import logging
import os.path
import shutil
import sys
import tempfile
import fiona
def test_options(tmpdir=None):
"""Test that setting CPL_DEBUG=ON works"""
if tmpdir is None:
tempdir = tempfile.mkdtemp()
logfile = os.path.join(tempdir, 'example.log')
else:
logfile = str(tmpdir.j... | Test log for a string with no "'b" | Test log for a string with no "'b"
| Python | bsd-3-clause | perrygeo/Fiona,Toblerity/Fiona,rbuffat/Fiona,perrygeo/Fiona,rbuffat/Fiona,Toblerity/Fiona,johanvdw/Fiona | ---
+++
@@ -24,7 +24,7 @@
c = fiona.open("docs/data/test_uk.shp")
c.close()
log = open(logfile).read()
- assert "OGR Error 0: OGR: OGROpen(docs/data/test_uk.shp" in log
+ assert "Option CPL_DEBUG" in log
if tempdir and tmpdir is None:
shutil.rmtree(tempdir) |
b69301c57076f86e99f738d5434dd75fd912753d | tests/test_preview.py | tests/test_preview.py | import pytest
from web_test_base import *
class TestIATIPreview(WebTestBase):
requests_to_load = {
'IATI Preview': {
'url': 'http://preview.iatistandard.org/'
}
}
def test_contains_links(self, loaded_request):
"""
Test that each page contains links to the define... | import pytest
from web_test_base import *
class TestIATIPreview(WebTestBase):
requests_to_load = {
'IATI Preview': {
'url': 'http://preview.iatistandard.org/'
}
}
def test_contains_links(self, loaded_request):
"""
Test that each page contains links to the define... | Add test for form on Preview Tool | Add test for form on Preview Tool
Test to see that the form to enter a URL to use the Preview Tool
exists, has the correct action and has the correct elements.
| Python | mit | IATI/IATI-Website-Tests | ---
+++
@@ -15,3 +15,27 @@
result = utility.get_links_from_page(loaded_request)
assert "http://www.iatistandard.org/" in result
+
+ @pytest.mark.parametrize("target_request", ["IATI Preview"])
+ def test_xml_web_address_form_presence(self, target_request):
+ """
+ Test that the... |
1b0d153b0f08e0ca5b962b0b9d839f745a035c62 | tests/test_stock.py | tests/test_stock.py | import unittest
from datetime import datetime
from stock import Stock
class StockTest(unittest.TestCase):
def test_price_of_a_new_stock_class_should_be_None(self):
stock = Stock("GOOG")
self.assertIsNone(stock.price)
def test_stock_update(self):
"""An update should set the price on t... | import unittest
from datetime import datetime
from stock import Stock
class StockTest(unittest.TestCase):
def test_new_stock_price(self):
"""A new stock should have a price that is None.
"""
stock = Stock("GOOG")
self.assertIsNone(stock.price)
def test_stock_update(self):
... | Add comment and clean up code. | Add comment and clean up code.
| Python | mit | bsmukasa/stock_alerter | ---
+++
@@ -5,7 +5,9 @@
class StockTest(unittest.TestCase):
- def test_price_of_a_new_stock_class_should_be_None(self):
+ def test_new_stock_price(self):
+ """A new stock should have a price that is None.
+ """
stock = Stock("GOOG")
self.assertIsNone(stock.price)
@@ -15,9 ... |
9138112f3abef61a96485ade7e0b484a43429b81 | tests/unit/actions.py | tests/unit/actions.py | """Unit tests for `pycall.actions`."""
class TestActions(TestCase):
"""Test all `pycall.actions` classes to ensure they are actual
`pycall.actions.Action` subclasses.
"""
pass
| """Unit tests for `pycall.actions`."""
| Revert "Adding test case stub." | Revert "Adding test case stub."
This reverts commit 6c6b08a63b308690144d73f54b98000e3b1b5672.
| Python | unlicense | rdegges/pycall | ---
+++
@@ -1,8 +1 @@
"""Unit tests for `pycall.actions`."""
-
-
-class TestActions(TestCase):
- """Test all `pycall.actions` classes to ensure they are actual
- `pycall.actions.Action` subclasses.
- """
- pass |
ec6099421bad222595be15f4f0b2596952d8c9cc | username_to_uuid.py | username_to_uuid.py | """ Username to UUID
Converts a Minecraft username to it's UUID equivalent.
Uses the official Mojang API to fetch player data.
"""
import http.client
import json
class UsernameToUUID:
def __init__(self, username):
self.username = username
def get_uuid(self, timestamp=None):
"""
Ge... | """ Username to UUID
Converts a Minecraft username to it's UUID equivalent.
Uses the official Mojang API to fetch player data.
"""
import http.client
import json
class UsernameToUUID:
def __init__(self, username):
self.username = username
def get_uuid(self, timestamp=None):
"""
Ge... | Improve robustness: surround the 'id' fetch from result array with a try clause. | Improve robustness: surround the 'id' fetch from result array with a try clause.
| Python | mit | mrlolethan/MinecraftUsernameToUUID | ---
+++
@@ -33,6 +33,9 @@
return ""
json_data = json.loads(response)
- uuid = json_data['id']
+ try:
+ uuid = json_data['id']
+ except KeyError as e:
+ print("KeyError raised:", e);
return uuid |
fcb5c5756299a2804c08c8682430d4a0545ae3d9 | linkatos/message.py | linkatos/message.py | import re
link_re = re.compile("(\s|^)<(https?://[\w./?+]+)>(\s|$)")
def extract_url(message):
"""
Returns the first url in a message. If there aren't any returns None
"""
answer = link_re.search(message)
if answer is not None:
answer = answer.group(2).strip()
return answer
| import re
link_re = re.compile("(?:\s|^)<(https?://[\w./?+]+)>(?:\s|$)")
def extract_url(message):
"""
Returns the first url in a message. If there aren't any returns None
"""
answer = link_re.search(message)
if answer is not None:
answer = answer.group(1).strip()
return answer
| Change regex to not capture the useless groups | feature: Change regex to not capture the useless groups
| Python | mit | iwi/linkatos,iwi/linkatos | ---
+++
@@ -1,6 +1,6 @@
import re
-link_re = re.compile("(\s|^)<(https?://[\w./?+]+)>(\s|$)")
+link_re = re.compile("(?:\s|^)<(https?://[\w./?+]+)>(?:\s|$)")
def extract_url(message):
@@ -10,6 +10,6 @@
answer = link_re.search(message)
if answer is not None:
- answer = answer.group(2).strip(... |
88bd75c4b0e039c208a1471d84006cdfb4bbaf93 | starbowmodweb/site/templatetags/bbformat.py | starbowmodweb/site/templatetags/bbformat.py | """
This module defines all of our bbcode capabilities.
To add a new bbcode tag do the following:
def bbcode_<tag_name>(tag_name, value, options, parent, context):
return formatted_html
bbcode_parser.add_formatter("<tag_name>", func_name, **tag_options)
For more information on the different argumnen... | """
This module defines all of our bbcode capabilities.
To add a new bbcode tag do the following:
def bbcode_<tag_name>(tag_name, value, options, parent, context):
return formatted_html
bbcode_parser.add_formatter("<tag_name>", func_name, **tag_options)
For more information on the different argumnen... | Add support for email and font bbcode tags. | Add support for email and font bbcode tags.
| Python | mit | Starbow/StarbowWebSite,Starbow/StarbowWebSite,Starbow/StarbowWebSite | ---
+++
@@ -25,8 +25,17 @@
return ('<img src="{}" '+attrs+' />').format(value, *options.values())
+def bbcode_email(tag_name, value, options, parent, context):
+ return '<a href="mailto:{}">{}</a>'.format(value, value)
+
+
+def bbcode_font(tag_name, value, options, parent, context):
+ return '<span sty... |
689f700fcfcdfcdc7d027f204a9654b101ac9ecb | docs/conf.py | docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
extensions = [
'sphinx.ext.autodoc',
'jaraco.packaging.sphinx',
'rst.linker',
]
master_doc = 'index'
link_files = {
'../CHANGES.rst': dict(
using=dict(
GH='https://github.com',
),
replace=[
dict(
pattern=r"(Issue )?#(?P<issue>\d+)",
url=... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
extensions = [
'sphinx.ext.autodoc',
'jaraco.packaging.sphinx',
'rst.linker',
]
master_doc = 'index'
link_files = {
'../CHANGES.rst': dict(
using=dict(
GH='https://github.com',
),
replace=[
dict(
pattern=r'(Issue )?#(?P<issue>\d+)',
url=... | Use single-quotes to satisfy the style nazis. | Use single-quotes to satisfy the style nazis.
| Python | mit | yougov/mettle,cherrypy/magicbus,python/importlib_metadata,jaraco/keyring,jaraco/jaraco.context,pwdyson/inflect.py,yougov/mettle,yougov/librarypaste,jaraco/jaraco.text,jaraco/jaraco.collections,jaraco/jaraco.functools,jaraco/hgtools,yougov/pmxbot,jaraco/zipp,hugovk/inflect.py,jaraco/jaraco.path,yougov/mettle,jaraco/jara... | ---
+++
@@ -16,15 +16,15 @@
),
replace=[
dict(
- pattern=r"(Issue )?#(?P<issue>\d+)",
+ pattern=r'(Issue )?#(?P<issue>\d+)',
url='{package_url}/issues/{issue}',
),
dict(
- pattern=r"^(?m)((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n",
- with_scm="{text}\n{rev[timestamp]:%d %b %Y}\n"... |
4594ed6599d98f1773a6e393c617c3230a1d8bec | django_evolution/__init__.py | django_evolution/__init__.py | """Django Evolution version and package information.
These variables and functions can be used to identify the version of
Review Board. They're largely used for packaging purposes.
"""
from __future__ import unicode_literals
# The version of Django Evolution
#
# This is in the format of:
#
# (Major, Minor, Micro,... | """Django Evolution version and package information.
These variables and functions can be used to identify the version of
Review Board. They're largely used for packaging purposes.
"""
from __future__ import unicode_literals
# The version of Django Evolution
#
# This is in the format of:
#
# (Major, Minor, Micro,... | Remove a deprecation warning when computing the package version. | Remove a deprecation warning when computing the package version.
In pretty much all of our Python packages, we generate a package version
using legacy identifiers of "alpha" and "beta". These get turned into
"a" and "b" by `pkg_resources`, and a warning is thrown to inform us
that we're doing it wrong.
To reduce thos... | Python | bsd-3-clause | beanbaginc/django-evolution | ---
+++
@@ -40,8 +40,15 @@
if VERSION[2]:
version += ".%s" % VERSION[2]
- if VERSION[3] != 'final':
- version += '%s%s' % (VERSION[3], VERSION[4])
+ tag = VERSION[3]
+
+ if tag != 'final':
+ if tag == 'alpha':
+ tag = 'a'
+ elif tag == 'beta':
+ tag ... |
14c872b3405326079ba01f9309622bb0188bf8ce | Install/toolbox/scripts/utils.py | Install/toolbox/scripts/utils.py | import sys
import collections
def parameters_from_args(defaults_tuple=None, sys_args):
"""Provided a set of tuples for default values, return a list of mapped
variables."""
defaults = collections.OrderedDict(defaults_tuple)
if defaults_tuple is not None:
args = len(sys_args) - 1
... | # -*- coding: utf-8 -*-
import csv
import collections
import sys
import re
import os
import binascii
def parameters_from_args(defaults_tuple=None, sys_args):
"""Provided a set of tuples for default values, return a list of mapped
variables."""
defaults = collections.OrderedDict(defaults_tuple... | Update includes; set encoding for file. | Update includes; set encoding for file.
| Python | mpl-2.0 | genegis/genegis,genegis/genegis,genegis/genegis | ---
+++
@@ -1,5 +1,10 @@
+# -*- coding: utf-8 -*-
+import csv
+import collections
import sys
-import collections
+import re
+import os
+import binascii
def parameters_from_args(defaults_tuple=None, sys_args):
"""Provided a set of tuples for default values, return a list of mapped |
d4c9603e4c5913b02746af3dec21f682d906e001 | nn/file/__init__.py | nn/file/__init__.py | import functools
import tensorflow as tf
from . import cnn_dailymail_rc
from .. import collections
from ..flags import FLAGS
from ..util import func_scope, dtypes
from .util import batch_queue, add_queue_runner
READERS = { "cnn_dailymail_rc": cnn_dailymail_rc.read_files }
@func_scope()
def read_files(file_pattern... | import functools
import tensorflow as tf
from . import cnn_dailymail_rc
from .. import collections
from ..flags import FLAGS
from ..util import func_scope, dtypes
from .util import batch_queue, add_queue_runner
READERS = { "cnn_dailymail_rc": cnn_dailymail_rc.read_files }
@func_scope()
def read_files(file_pattern... | Make metric_name option of monitored_batch_queue | Make metric_name option of monitored_batch_queue
| Python | unlicense | raviqqe/tensorflow-extenteten,raviqqe/tensorflow-extenteten | ---
+++
@@ -26,9 +26,9 @@
@func_scope()
-def monitored_batch_queue(*tensors):
+def monitored_batch_queue(*tensors, metric_name="batches_in_queue"):
queue = batch_queue(dtypes(*tensors))
- collections.add_metric(queue.size(), "batches_in_queue")
+ collections.add_metric(queue.size(), metric_name)
add_qu... |
4d64841bcf9a4eb4862643f9038d865c0b9dacf5 | goodtablesio/helpers/retrieve.py | goodtablesio/helpers/retrieve.py | from goodtablesio import services
# Module API
def get_job(job_id):
"""Get job by identifier.
Args:
job_id (str): job identifier
Returns:
dict: job result if job was found, None otherwise
"""
result = services.database['jobs'].find_one(job_id=job_id)
if not result:
... | from goodtablesio import services
# Module API
def get_job(job_id):
"""Get job by identifier.
Args:
job_id (str): job identifier
Returns:
dict: job result if job was found, None otherwise
"""
result = services.database['jobs'].find_one(job_id=job_id)
if not result:
... | Make sure report is part of the job dict | Make sure report is part of the job dict
To get around failures like this for now:
https://travis-ci.org/frictionlessdata/goodtables.io/builds/179121528
This should definitely be investigated and fixed as part of #33
| Python | agpl-3.0 | frictionlessdata/goodtables.io,frictionlessdata/goodtables.io,frictionlessdata/goodtables.io,frictionlessdata/goodtables.io | ---
+++
@@ -20,6 +20,13 @@
# TODO: we need to store the status in the DB as we can no longer rely on
# the job id being the same one used by a celery task
status = 'Not Implemented'
+
+ # TODO: this should not be needed after #33
+ if 'report' not in result:
+ result['report'] = None
+ ... |
e8ad5aafb63c2aea5b855b000cafcc1ba9248af6 | malcolm/modules/scanning/parts/simultaneousaxespart.py | malcolm/modules/scanning/parts/simultaneousaxespart.py | from annotypes import Anno, Array, Union, Sequence, add_call_types
from malcolm.core import Part, StringArrayMeta, Widget, config_tag, \
PartRegistrar, APartName
from ..hooks import ValidateHook, AAxesToMove
with Anno("Initial value for set of axes that can be moved at the same time"):
ASimultaneousAxes = Ar... | from annotypes import Anno, Array, Union, Sequence, add_call_types
from malcolm.core import Part, StringArrayMeta, Widget, config_tag, \
PartRegistrar, APartName
from ..hooks import ValidateHook, AAxesToMove
with Anno("Initial value for set of axes that can be moved at the same time"):
ASimultaneousAxes = Ar... | Change Widget tag on SimultaneousAxes to TEXTINPUT | Change Widget tag on SimultaneousAxes to TEXTINPUT
| Python | apache-2.0 | dls-controls/pymalcolm,dls-controls/pymalcolm,dls-controls/pymalcolm | ---
+++
@@ -16,7 +16,7 @@
super(SimultaneousAxesPart, self).__init__(name)
self.attr = StringArrayMeta(
"Set of axes that can be specified in axesToMove at configure",
- tags=[Widget.TABLE.tag(), config_tag()]
+ tags=[Widget.TEXTINPUT.tag(), config_tag()]
... |
02f8f992aca37d21b9ae119f13b46de8eb1541ae | gsl/utils.py | gsl/utils.py | #!/usr/bin/env python
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger()
def yield_packages(handle, meta=False, retcode=None):
for lineno, line in enumerate(handle):
if line.startswith('#'):
continue
try:
data = line.split('\t')
keys... | #!/usr/bin/env python
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger()
def yield_packages(handle, meta=False, retcode=None):
for lineno, line in enumerate(handle):
if line.startswith('#'):
continue
try:
data = line.split('\t')
keys... | Return retcode properly iff erroring | Return retcode properly iff erroring
fixes #13
| Python | mit | erasche/community-package-cache,erasche/community-package-cache,gregvonkuster/cargo-port,erasche/community-package-cache,galaxyproject/cargo-port,galaxyproject/cargo-port,gregvonkuster/cargo-port,gregvonkuster/cargo-port | ---
+++
@@ -13,6 +13,7 @@
'alt_url', 'comment']
if len(data) != len(keys):
log.error('[%s] data has wrong number of columns. %s != %s', lineno + 1, len(data), len(keys))
+ retcode = 1
ld = {k: v for (k, v) in zip(keys, line.split('\t'))}... |
508167ee3c289258857aee0963d4917c39201d9a | tailor/listeners/mainlistener.py | tailor/listeners/mainlistener.py | from tailor.swift.swiftlistener import SwiftListener
from tailor.utils.charformat import isUpperCamelCase
class MainListener(SwiftListener):
def enterClassName(self, ctx):
className = ctx.getText()
if not isUpperCamelCase(className):
print('Line', str(ctx.start.line) + ':', 'Class nam... | from tailor.swift.swiftlistener import SwiftListener
from tailor.utils.charformat import isUpperCamelCase
class MainListener(SwiftListener):
def enterClassName(self, ctx):
self.__verify_upper_camel_case(ctx, 'Class names should be in UpperCamelCase')
def enterEnumName(self, ctx):
pass
d... | Add method to handle UpperCamelCase verification | Add method to handle UpperCamelCase verification
| Python | mit | sleekbyte/tailor,sleekbyte/tailor,sleekbyte/tailor,sleekbyte/tailor,sleekbyte/tailor | ---
+++
@@ -5,9 +5,7 @@
class MainListener(SwiftListener):
def enterClassName(self, ctx):
- className = ctx.getText()
- if not isUpperCamelCase(className):
- print('Line', str(ctx.start.line) + ':', 'Class names should be in UpperCamelCase')
+ self.__verify_upper_camel_case(ctx... |
a9abf8361f8728dfb1ef18a27c5eaad84ca2f054 | accounting/apps/clients/forms.py | accounting/apps/clients/forms.py | from django.forms import ModelForm
from .models import Client
class ClientForm(ModelForm):
class Meta:
model = Client
fields = (
"name",
"address_line_1",
"address_line_2",
"city",
"postal_code",
"country",
)
| from django.forms import ModelForm
from .models import Client
class ClientForm(ModelForm):
class Meta:
model = Client
fields = (
"name",
"address_line_1",
"address_line_2",
"city",
"postal_code",
"country",
"organ... | Add the relationship field to the Client form | Add the relationship field to the Client form
| Python | mit | kenjhim/django-accounting,dulaccc/django-accounting,kenjhim/django-accounting,kenjhim/django-accounting,dulaccc/django-accounting,dulaccc/django-accounting,kenjhim/django-accounting,dulaccc/django-accounting | ---
+++
@@ -13,4 +13,5 @@
"city",
"postal_code",
"country",
+ "organization",
) |
b95fbc22615e94cea4bd16b17c887214aba44175 | dthm4kaiako/config/__init__.py | dthm4kaiako/config/__init__.py | """Configuration for Django system."""
__version__ = "0.14.2"
__version_info__ = tuple(
[
int(num) if num.isdigit() else num
for num in __version__.replace("-", ".", 1).split(".")
]
)
| """Configuration for Django system."""
__version__ = "0.15.0"
__version_info__ = tuple(
[
int(num) if num.isdigit() else num
for num in __version__.replace("-", ".", 1).split(".")
]
)
| Increment version number to 0.15.0 | Increment version number to 0.15.0
| Python | mit | uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers | ---
+++
@@ -1,6 +1,6 @@
"""Configuration for Django system."""
-__version__ = "0.14.2"
+__version__ = "0.15.0"
__version_info__ = tuple(
[
int(num) if num.isdigit() else num |
a485998447ffbe5a19ce8f9b49e61ac313c8241a | glitter_events/search_indexes.py | glitter_events/search_indexes.py | # -*- coding: utf-8 -*-
from haystack import indexes
from .models import Event
class EventIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
def get_model(self):
return Event
def index_queryset(self, using=None):
return self.get_mo... | # -*- coding: utf-8 -*-
import datetime
from django.conf import settings
from django.utils import timezone
from haystack import indexes
from .models import Event
class EventIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
def get_model(self):
... | Add option to ignore expired events for the search index | Add option to ignore expired events for the search index
| Python | bsd-3-clause | blancltd/django-glitter-events,blancltd/django-glitter-events | ---
+++
@@ -1,4 +1,9 @@
# -*- coding: utf-8 -*-
+
+import datetime
+
+from django.conf import settings
+from django.utils import timezone
from haystack import indexes
@@ -12,4 +17,11 @@
return Event
def index_queryset(self, using=None):
- return self.get_model().objects.published().select... |
cccd6e8fe76fc96b39791912ecfd07f867d8dacc | cms/djangoapps/export_course_metadata/management/commands/export_course_metadata_for_all_courses.py | cms/djangoapps/export_course_metadata/management/commands/export_course_metadata_for_all_courses.py | """
Export course metadata for all courses
"""
from django.core.management.base import BaseCommand
from xmodule.modulestore.django import modulestore
from cms.djangoapps.export_course_metadata.signals import export_course_metadata
class Command(BaseCommand):
"""
Export course metadata for all courses
"... | """
Export course metadata for all courses
"""
from django.core.management.base import BaseCommand
from xmodule.modulestore.django import modulestore
from cms.djangoapps.export_course_metadata.signals import export_course_metadata
from cms.djangoapps.export_course_metadata.tasks import export_course_metadata_task
... | Call celery task directly from management command instead of calling the signal | Call celery task directly from management command instead of calling the signal
AA-461
| Python | agpl-3.0 | eduNEXT/edunext-platform,EDUlib/edx-platform,arbrandes/edx-platform,edx/edx-platform,angelapper/edx-platform,edx/edx-platform,eduNEXT/edx-platform,eduNEXT/edx-platform,EDUlib/edx-platform,eduNEXT/edunext-platform,eduNEXT/edunext-platform,angelapper/edx-platform,EDUlib/edx-platform,eduNEXT/edx-platform,angelapper/edx-pl... | ---
+++
@@ -7,6 +7,7 @@
from xmodule.modulestore.django import modulestore
from cms.djangoapps.export_course_metadata.signals import export_course_metadata
+from cms.djangoapps.export_course_metadata.tasks import export_course_metadata_task
class Command(BaseCommand):
@@ -28,6 +29,5 @@
"""
module_s... |
e04cec6c4260a181c773371406323758d9f162bf | examples/adaptive_scan_demo.py | examples/adaptive_scan_demo.py | import matplotlib.pyplot as plt
from bluesky import RunEngine, Mover, SynGauss
from bluesky.examples import adaptive_scan
RE = RunEngine()
RE.verbose = False
motor = Mover('motor', ['pos'])
det = SynGauss('det', motor, 'pos', center=0, Imax=1, sigma=1)
def live_scalar_plotter(ax, y, x):
x_data, y_data = [], []... | import matplotlib.pyplot as plt
from bluesky import RunEngine
from bluesky.scans import AdaptiveAscan
from bluesky.examples import Mover, SynGauss
from bluesky.callbacks import LivePlot, LiveTable
from bluesky.tests.utils import setup_test_run_engine
#plt.ion()
RE = setup_test_run_engine()
motor = Mover('motor', ['p... | Fix adaptive example with LivePlot | WIP: Fix adaptive example with LivePlot
| Python | bsd-3-clause | dchabot/bluesky,sameera2004/bluesky,ericdill/bluesky,klauer/bluesky,ericdill/bluesky,sameera2004/bluesky,dchabot/bluesky,klauer/bluesky | ---
+++
@@ -1,37 +1,23 @@
import matplotlib.pyplot as plt
-from bluesky import RunEngine, Mover, SynGauss
-from bluesky.examples import adaptive_scan
+from bluesky import RunEngine
+from bluesky.scans import AdaptiveAscan
+from bluesky.examples import Mover, SynGauss
+from bluesky.callbacks import LivePlot, LiveTa... |
c3ed431f97e4ca24a00ff979a5204d65b251dd87 | greenlight/views/__init__.py | greenlight/views/__init__.py | from .base import APIView
from django.http import Http404
from three import Three
class QCThree(Three):
def __init__(self):
self.endpoint = "http://dev-api.ville.quebec.qc.ca/open311/v2/"
self.format = "json"
self.jurisdiction = "ville.quebec.qc.ca"
QC_three = QCThree()
class ServicesView(APIView):
def get(... | from three import Three
from django.http import Http404
from .base import APIView
QC_three = Three(
endpoint = "http://dev-api.ville.quebec.qc.ca/open311/v2/",
format = "json",
jurisdiction = "ville.quebec.qc.ca",
)
class ServicesView(APIView):
def get(self, request):
return self.OkAPIResponse(QC_three.servic... | Initialize the three API wrapper differently to fix a bug. | Initialize the three API wrapper differently to fix a bug.
| Python | mit | ironweb/lesfeuxverts-backend | ---
+++
@@ -1,15 +1,14 @@
-from .base import APIView
+from three import Three
from django.http import Http404
-from three import Three
+from .base import APIView
-class QCThree(Three):
- def __init__(self):
- self.endpoint = "http://dev-api.ville.quebec.qc.ca/open311/v2/"
- self.format = "json"
- self.jurisdi... |
9c11fa9d0a26d1e4caa47d2b3f0f1bf92cf8e965 | examples/enable/gadgets/vu_demo.py | examples/enable/gadgets/vu_demo.py |
from traits.api import HasTraits, Instance
from traitsui.api import View, UItem, Item, RangeEditor, Group, VGroup, HGroup
from enable.api import ComponentEditor
from enable.gadgets.vu_meter import VUMeter
class Demo(HasTraits):
vu = Instance(VUMeter)
traits_view = \
View(
HGroup(
... |
from traits.api import HasTraits, Instance
from traitsui.api import View, UItem, Item, RangeEditor, Group, VGroup
from enable.api import ComponentEditor
from enable.gadgets.vu_meter import VUMeter
class Demo(HasTraits):
vu = Instance(VUMeter)
traits_view = \
View(
VGroup(
... | Remove extraneous Groups from the View in the VU Meter demo. | Remove extraneous Groups from the View in the VU Meter demo.
| Python | bsd-3-clause | tommy-u/enable,tommy-u/enable,tommy-u/enable,tommy-u/enable | ---
+++
@@ -1,7 +1,7 @@
from traits.api import HasTraits, Instance
-from traitsui.api import View, UItem, Item, RangeEditor, Group, VGroup, HGroup
+from traitsui.api import View, UItem, Item, RangeEditor, Group, VGroup
from enable.api import ComponentEditor
from enable.gadgets.vu_meter import VUMeter
@@ -13,... |
8e8986a17b7fa38417fe39ec8fbf4e1d3ee43f64 | arduino_flasher/reset_arduino.py | arduino_flasher/reset_arduino.py | #!/usr/local/bin/python
import mraa
import time
resetPin = mraa.Gpio(8)
resetPin.dir(mraa.DIR_OUT)
resetPin.write(0)
time.sleep(0.2)
resetPin.write(1)
| #!/usr/local/bin/python
import mraa
import time
resetPin = mraa.Gpio(8)
resetPin.dir(mraa.DIR_OUT)
resetPin.write(1)
time.sleep(0.2)
resetPin.write(0)
time.sleep(0.2)
resetPin.write(1)
| Reset script first pulls pin high | Reset script first pulls pin high
| Python | bsd-3-clause | Pavlos1/SensoringJMSS,Pavlos1/SensoringJMSS,Pavlos1/SensoringJMSS,Pavlos1/SensoringJMSS | ---
+++
@@ -6,6 +6,8 @@
resetPin = mraa.Gpio(8)
resetPin.dir(mraa.DIR_OUT)
+resetPin.write(1)
+time.sleep(0.2)
resetPin.write(0)
time.sleep(0.2)
resetPin.write(1) |
1371f1a1b2914a7f2e328f69bdc599c1eada54db | Python-practice/fy_print_seq_len_in_fasta.py | Python-practice/fy_print_seq_len_in_fasta.py | #!/usr/bin/env python
'''
Script: fy_print_seq_len_in_fasta.py
Function: Print sequence length to STDOUT in fasta file
Note: Python3 is not default installed for most computer,
and the extra-installed module like Biopython could
not be directly used by python3. So, it's not the
righ time to use Pyth... | #!/usr/bin/env python
'''
Script: fy_print_seq_len_in_fasta.py
Function: Print sequence length to STDOUT in fasta file
Note: Python3 is not default installed for most computer,
and the extra-installed module like Biopython could
not be directly used by python3. So, it's not the
righ time to use Pyth... | Add the statistics information of sequence length | Add the statistics information of sequence length
Include number of sequences, total length, maximum length, and minimum
length
| Python | bsd-2-clause | lileiting/gfat | ---
+++
@@ -16,5 +16,20 @@
sys.exit()
from Bio import SeqIO
+seqlen = []
+num_of_seq = 0
+total_len = 0
for record in SeqIO.parse(sys.argv[1], 'fasta'):
print("%s %i" % (record.id, len(record)))
+ num_of_seq += 1
+ total_len += len(record)
+ seqlen.append(len(record))
+
+seqlen.sort()
+min... |
01a60e0a0ab1e3b178cf7a56b4250ddee965e742 | 01_todo_list/test.py | 01_todo_list/test.py | #!/usr/bin/env python
# coding=utf-8
"Clase de Test"
import unittest
import json
from app import app
class BasicTestCase(unittest.TestCase):
"Test Class"
def setUp(self):
"""
Setup function
"""
self.tester = app.test_client(self)
def test_empty_list_taks(self):
... | #!/usr/bin/env python
# coding=utf-8
"Clase de Test"
import unittest
import json
from app import app
class BasicTestCase(unittest.TestCase):
"Test Class"
def setUp(self):
"""
Setup function
"""
self.tester = app.test_client(self)
def test_empty_list_taks(self):
... | Test para obtener una tarea que no existe | Test para obtener una tarea que no existe
| Python | apache-2.0 | kamaxeon/learning-flask,kamaxeon/learning-flask | ---
+++
@@ -27,6 +27,16 @@
data = json.loads(response.get_data(as_text=True))
self.assertEqual(data['tasks'], [])
+ def test_get_a_non_existing_taks(self):
+ """
+ Get a non existing tasks
+ """
+ response = self.tester.get('/todo/api/tasks/99',
+ ... |
24c6e2852e319ec0d0f4e8d0539bc69a9915c3e7 | tests/server/test_server.py | tests/server/test_server.py | import logging
import mock
import oauth2u
import oauth2u.server.log
def test_should_have_optional_port():
server = oauth2u.Server()
assert 8000 == server.port
def test_should_accept_custom_port():
server = oauth2u.Server(8888)
assert 8888 == server.port
def test_should_configure_log_with_default... | import logging
import mock
import oauth2u
import oauth2u.server.log
def teardown_function(func):
logging.disable(logging.INFO)
def test_should_have_optional_port():
server = oauth2u.Server()
assert 8000 == server.port
def test_should_accept_custom_port():
server = oauth2u.Server(8888)
assert 8... | Disable logging on test runner process | Disable logging on test runner process
| Python | mit | globocom/oauth2u,globocom/oauth2u | ---
+++
@@ -5,6 +5,8 @@
import oauth2u
import oauth2u.server.log
+def teardown_function(func):
+ logging.disable(logging.INFO)
def test_should_have_optional_port():
server = oauth2u.Server() |
1e29540ee08ca8faaed5e3a8ab1ac9def290155b | fileconversions/file_converter.py | fileconversions/file_converter.py | from . import conversions
from .file_formats import FileFormats
class FileConverter(object):
def get_conversion(self, source_format, target_format):
return {
'application/pdf': conversions.NoOp,
'image/jpeg': conversions.JpegToPdf,
'image/png': conversions.PngToPdf,
... | from . import conversions
from .file_formats import FileFormats
class FileConverter(object):
def get_conversion(self, source_format, target_format):
return {
FileFormats.PDF: conversions.NoOp,
FileFormats.JPEG: conversions.JpegToPdf,
FileFormats.PNG: conversions.PngTo... | Fix how we find conversion to use file formats | Fix how we find conversion to use file formats
| Python | mit | wilbertom/fileconversions | ---
+++
@@ -7,16 +7,16 @@
def get_conversion(self, source_format, target_format):
return {
- 'application/pdf': conversions.NoOp,
- 'image/jpeg': conversions.JpegToPdf,
- 'image/png': conversions.PngToPdf,
- 'image/gif': conversions.GifToPdf,
- 'i... |
5dbd9019744621f84c3775de12b895021c3b8eb8 | senlin/drivers/openstack/__init__.py | senlin/drivers/openstack/__init__.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | Fix a typo in lbaas driver plugin | Fix a typo in lbaas driver plugin
Change-Id: I0cfbd95d41ea1d6c798a78595ac63ea049a87dbc
| Python | apache-2.0 | stackforge/senlin,openstack/senlin,Alzon/senlin,openstack/senlin,openstack/senlin,tengqm/senlin-container,stackforge/senlin,Alzon/senlin,tengqm/senlin-container | ---
+++
@@ -28,5 +28,5 @@
return neutron_v2.NeutronClient(params)
-def LoadBlanacingClient(params):
+def LoadBalancingClient(params):
return lbaas.LoadBalancerDriver(params) |
db80c8f857b0c4ff3a5ad02a59e6442629599914 | setuptools/tests/test_upload_docs.py | setuptools/tests/test_upload_docs.py | import os
import zipfile
import pytest
from setuptools.command.upload_docs import upload_docs
from setuptools.dist import Distribution
from .textwrap import DALS
from . import contexts
SETUP_PY = DALS(
"""
from setuptools import setup
setup(name='foo')
""")
@pytest.fixture
def sample_project(tmp... | import os
import zipfile
import contextlib
import pytest
from setuptools.command.upload_docs import upload_docs
from setuptools.dist import Distribution
from .textwrap import DALS
from . import contexts
SETUP_PY = DALS(
"""
from setuptools import setup
setup(name='foo')
""")
@pytest.fixture
def ... | Use closing for Python 2.6 compatibility | Use closing for Python 2.6 compatibility
| Python | mit | pypa/setuptools,pypa/setuptools,pypa/setuptools | ---
+++
@@ -1,5 +1,6 @@
import os
import zipfile
+import contextlib
import pytest
@@ -54,5 +55,5 @@
assert zipfile.is_zipfile(tmp_file)
- with zipfile.ZipFile(tmp_file) as zip_file:
+ with contextlib.closing(zipfile.ZipFile(tmp_file)) as zip_file:
assert ... |
5aad2212340a5eba4bbf4615d58ed6b3c205bc7f | fabtools/tests/fabfiles/python.py | fabtools/tests/fabfiles/python.py | from __future__ import with_statement
from fabric.api import *
from fabtools import require
import fabtools
@task
def python():
"""
Check Python package installation
"""
require.python.virtualenv('/tmp/venv')
assert fabtools.files.is_dir('/tmp/venv')
assert fabtools.files.is_file('/tmp/venv/b... | from __future__ import with_statement
from fabric.api import task
@task
def python_virtualenv():
"""
Test Python virtualenv creation
"""
from fabtools import require
import fabtools
require.python.virtualenv('/tmp/venv')
assert fabtools.files.is_dir('/tmp/venv')
assert fabtools.file... | Speed up Python tests by caching pip downloads | Speed up Python tests by caching pip downloads
| Python | bsd-2-clause | prologic/fabtools,ahnjungho/fabtools,ronnix/fabtools,davidcaste/fabtools,pombredanne/fabtools,pahaz/fabtools,badele/fabtools,AMOSoft/fabtools,wagigi/fabtools-python,fabtools/fabtools,hagai26/fabtools,n0n0x/fabtools-python,sociateru/fabtools,bitmonk/fabtools | ---
+++
@@ -1,19 +1,32 @@
from __future__ import with_statement
-from fabric.api import *
-from fabtools import require
-import fabtools
+from fabric.api import task
@task
-def python():
+def python_virtualenv():
"""
- Check Python package installation
+ Test Python virtualenv creation
"""
+ ... |
c27a1fc4c0251b896667e21a0a88fb44a403242f | cistern/migrations.py | cistern/migrations.py | import os
from playhouse.migrate import *
cistern_folder = os.getenv('CISTERNHOME', os.path.join(os.environ['HOME'], '.cistern'))
db = SqliteDatabase(os.path.join(cistern_folder, 'cistern.db'))
migrator = SqliteMigrator(db)
date_added = DateTimeField(default=None)
migrate(
migrator.add_column('torrent', 'date_a... | import datetime
import os
from playhouse.migrate import *
def update():
cistern_folder = os.getenv('CISTERNHOME', os.path.join(os.environ['HOME'], '.cistern'))
db = SqliteDatabase(os.path.join(cistern_folder, 'cistern.db'))
migrator = SqliteMigrator(db)
date_added = DateTimeField(default=datetime.dat... | Move migration to a function | Move migration to a function
| Python | mit | archangelic/cistern | ---
+++
@@ -1,13 +1,15 @@
+import datetime
import os
from playhouse.migrate import *
-cistern_folder = os.getenv('CISTERNHOME', os.path.join(os.environ['HOME'], '.cistern'))
-db = SqliteDatabase(os.path.join(cistern_folder, 'cistern.db'))
-migrator = SqliteMigrator(db)
+def update():
+ cistern_folder = os.ge... |
5e6d52277e34c254bad6b386cf05f490baf6a6f2 | webapp-django/accounts/models.py | webapp-django/accounts/models.py | from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
class UserProfile(models.Model):
user = models.OneToOneField(User)
bio = models.TextField(max_length=256, blank=True)
solvedChallenges=models.CharFie... | from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from challenges.models import Challenge
from questionnaire.models import Question
class UserProfile(models.Model):
user = models.OneToOneField(User)
bio... | Update accounts model with scoring system | Update accounts model with scoring system
| Python | mit | super1337/Super1337-CTF,super1337/Super1337-CTF,super1337/Super1337-CTF | ---
+++
@@ -3,17 +3,35 @@
from django.db.models.signals import post_save
from django.dispatch import receiver
+from challenges.models import Challenge
+from questionnaire.models import Question
+
class UserProfile(models.Model):
user = models.OneToOneField(User)
bio = models.TextField(max_length=256,... |
e95f2c986f407e0c6f65ef1cd37bdefa98a01213 | coffeedomain/setup.py | coffeedomain/setup.py | from setuptools import setup, find_packages
if __name__ == '__main__':
setup(name='sphinxcontrib-coffee',
version='0.1.0',
license='BSD',
author="Stephen Sugden",
author_email="glurgle@gmail.com",
description='Sphinx extension to add CoffeeScript support',
... | from setuptools import setup, find_packages
if __name__ == '__main__':
setup(name='sphinxcontrib-coffee',
version='0.1.1',
license='BSD',
author="Stephen Sugden",
author_email="glurgle@gmail.com",
description='Sphinx extension to add CoffeeScript support',
... | Bump version for requirejs support | Bump version for requirejs support
--HG--
extra : rebase_source : cf5a3545b3e1e2e70a8fe0607461564432a55464
| Python | bsd-2-clause | sphinx-contrib/spelling,sphinx-contrib/spelling | ---
+++
@@ -2,7 +2,7 @@
if __name__ == '__main__':
setup(name='sphinxcontrib-coffee',
- version='0.1.0',
+ version='0.1.1',
license='BSD',
author="Stephen Sugden",
author_email="glurgle@gmail.com", |
39e03951ec882f4dbff1ef4c42a71339d2a5d4fa | gaphor/UML/tests/test_activity.py | gaphor/UML/tests/test_activity.py | import pytest
from gaphor import UML
from gaphor.ui.diagrampage import tooliter
from gaphor.UML.toolbox import uml_toolbox_actions
@pytest.fixture
def action_factory():
return next(
t for t in tooliter(uml_toolbox_actions) if t.id == "toolbox-action"
).item_factory
def test_create_action_should_cre... | import pytest
from gaphor import UML
from gaphor.ui.diagrampage import tooliter
from gaphor.UML.toolbox import uml_toolbox_actions
activity_node_names = [
"action",
"initial-node",
"activity-final-node",
"flow-final-node",
"decision-node",
"fork-node",
"object-node",
"send-signal-actio... | Test all activity nodes for namespacing | Test all activity nodes for namespacing
| Python | lgpl-2.1 | amolenaar/gaphor,amolenaar/gaphor | ---
+++
@@ -4,37 +4,52 @@
from gaphor.ui.diagrampage import tooliter
from gaphor.UML.toolbox import uml_toolbox_actions
+activity_node_names = [
+ "action",
+ "initial-node",
+ "activity-final-node",
+ "flow-final-node",
+ "decision-node",
+ "fork-node",
+ "object-node",
+ "send-signal-act... |
862301e319be09d3c163c8248f18ed23c3b1fab5 | mla_game/apps/transcript/urls.py | mla_game/apps/transcript/urls.py | from django.conf.urls import url
urlpatterns = [
url(r'^upload-batch/', 'mla_game.apps.transcript.views.upload_batch', name='upload-batch'),
]
| from django.conf.urls import url
urlpatterns = [
]
| Remove unused URL, will revisit later | Remove unused URL, will revisit later
| Python | mit | WGBH/FixIt,WGBH/FixIt,WGBH/FixIt | ---
+++
@@ -1,5 +1,4 @@
from django.conf.urls import url
urlpatterns = [
- url(r'^upload-batch/', 'mla_game.apps.transcript.views.upload_batch', name='upload-batch'),
] |
2a843e46fabf616517847a304170fbce75afd167 | zeus/api/resources/auth_index.py | zeus/api/resources/auth_index.py | import json
from zeus import auth
from zeus.api import client
from zeus.exceptions import ApiError
from zeus.models import Email, Identity
from .base import Resource
from ..schemas import EmailSchema, IdentitySchema, UserSchema
emails_schema = EmailSchema(many=True, strict=True)
identities_schema = IdentitySchema(ma... | import json
from zeus import auth
from zeus.api import client
from zeus.exceptions import ApiError
from zeus.models import Email, Identity
from .base import Resource
from ..schemas import EmailSchema, IdentitySchema, UserSchema
emails_schema = EmailSchema(many=True, strict=True)
identities_schema = IdentitySchema(ma... | Raise non-auth errors from GitHub | fix: Raise non-auth errors from GitHub
| Python | apache-2.0 | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus | ---
+++
@@ -26,6 +26,8 @@
if exc.code == 401:
return {"isAuthenticated": False}
+ raise
+
user = json.loads(user_response.data)
identity_list = list(Identity.query.filter(Identity.user_id == user["id"])) |
9174de810bc4be3376521eecdb82a84486591e73 | oslo_utils/_i18n.py | oslo_utils/_i18n.py | # Copyright 2014 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | # Copyright 2014 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | Update Oslo imports to remove namespace package | Update Oslo imports to remove namespace package
Change-Id: I4ec9b2a310471e4e07867073e9577731ac34027d
Blueprint: drop-namespace-packages
| Python | apache-2.0 | magic0704/oslo.utils,varunarya10/oslo.utils,openstack/oslo.utils | ---
+++
@@ -18,10 +18,10 @@
"""
-from oslo import i18n
+import oslo_i18n
-_translators = i18n.TranslatorFactory(domain='oslo.utils')
+_translators = oslo_i18n.TranslatorFactory(domain='oslo.utils')
# The primary translation function using the well-known name "_"
_ = _translators.primary |
47eddebccf80bd066fd12f07316a2d283ff21774 | numba/tests/compile_with_pycc.py | numba/tests/compile_with_pycc.py | from numba import exportmany, export
from numba.pycc import CC
# New API
cc = CC('pycc_test_output')
@cc.export('multf', 'f4(f4, f4)')
@cc.export('multi', 'i4(i4, i4)')
def mult(a, b):
return a * b
_two = 2
# This one can't be compiled by the legacy API as it doesn't execute
# the script in a proper module.
@... | from numba import exportmany, export
from numba.pycc import CC
# New API
cc = CC('pycc_test_output')
@cc.export('multf', 'f4(f4, f4)')
@cc.export('multi', 'i4(i4, i4)')
def mult(a, b):
return a * b
_two = 2
# This one can't be compiled by the legacy API as it doesn't execute
# the script in a proper module.
@... | Fix function definition to actually fail | Fix function definition to actually fail
| Python | bsd-2-clause | jriehl/numba,seibert/numba,ssarangi/numba,gmarkall/numba,stonebig/numba,stuartarchibald/numba,pitrou/numba,pombredanne/numba,gmarkall/numba,IntelLabs/numba,sklam/numba,gmarkall/numba,pitrou/numba,stonebig/numba,stuartarchibald/numba,numba/numba,sklam/numba,pombredanne/numba,pombredanne/numba,sklam/numba,cpcloud/numba,s... | ---
+++
@@ -22,7 +22,7 @@
# Fails because it needs _helperlib
#@cc.export('power', 'i8(i8, i8)')
def power(u, v):
- return u ** 2
+ return u ** v
# Legacy API |
6a15b33d69d8d66643bb8886f9916fa28ecaedea | molo/yourwords/templatetags/competition_tag.py | molo/yourwords/templatetags/competition_tag.py | from django import template
from copy import copy
from molo.yourwords.models import (YourWordsCompetition, ThankYou,
YourWordsCompetitionIndexPage)
from molo.core.templatetags.core_tags import get_pages
register = template.Library()
@register.inclusion_tag(
'yourwords/your_word... | from django import template
from copy import copy
from molo.yourwords.models import (YourWordsCompetition, ThankYou,
YourWordsCompetitionIndexPage)
from molo.core.templatetags.core_tags import get_pages
register = template.Library()
@register.inclusion_tag(
'yourwords/your_word... | Return None if there is no competition | Return None if there is no competition
| Python | bsd-2-clause | praekelt/molo.yourwords,praekelt/molo.yourwords | ---
+++
@@ -20,7 +20,7 @@
YourWordsCompetition.objects.child_of(page).filter(
languages__language__is_main_language=True).specific())
else:
- competitions = []
+ competitions = YourWordsCompetition.objects.none()
context.update({
'competitions': get_pag... |
8c07012e423d592a4638d6dac58ca5e67d9dd5a6 | apps/cowry/views.py | apps/cowry/views.py | from rest_framework import generics
from .permissions import IsOrderCreator
from .serializers import PaymentSerializer
from .models import Payment
class PaymentDetail(generics.RetrieveUpdateAPIView):
"""
View for working with Payments. Payments can be retrieved and the payment method and submethod can updated... | from rest_framework import generics
from rest_framework import response
from rest_framework import status
from . import payments
from .exceptions import PaymentException
from .models import Payment
from .permissions import IsOrderCreator
from .serializers import PaymentSerializer
class PaymentDetail(generics.Retrieve... | Add payment cancel (delete) to Payment REST API. | Add payment cancel (delete) to Payment REST API.
| Python | bsd-3-clause | onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site | ---
+++
@@ -1,13 +1,27 @@
from rest_framework import generics
+from rest_framework import response
+from rest_framework import status
+from . import payments
+from .exceptions import PaymentException
+from .models import Payment
from .permissions import IsOrderCreator
from .serializers import PaymentSerializer
-fr... |
b434c8dd697b4aa5c2d6daa345c0d9de27e7c05a | apps/survey/urls.py | apps/survey/urls.py | from django.conf.urls.defaults import *
from . import views
urlpatterns = patterns('',
url(r'^profile/$', views.profile_index, name='survey_profile'),
url(r'^profile/electric/$', views.profile_electric, name='survey_profile_electric'),
url(r'^profile/surveys/$', views.survey_management, name='survey_manag... | from django.conf.urls.defaults import *
from . import views
urlpatterns = patterns('',
url(r'^profile/$', views.profile_index, name='survey_profile'),
url(r'^profile/electric/$', views.profile_electric, name='survey_profile_electric'),
#url(r'^profile/intake/$', views.survey_intake, name='survey_profile_i... | Add new decorator for suvery_data | Add new decorator for suvery_data
| Python | agpl-3.0 | chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork | ---
+++
@@ -5,15 +5,15 @@
urlpatterns = patterns('',
url(r'^profile/$', views.profile_index, name='survey_profile'),
url(r'^profile/electric/$', views.profile_electric, name='survey_profile_electric'),
+ #url(r'^profile/intake/$', views.survey_intake, name='survey_profile_intake'),
url(r'^profile/s... |
1f6c1a4f596222b424d9f51ca30f5eb4d80f9942 | mopidy_alsamixer/__init__.py | mopidy_alsamixer/__init__.py | import os
from mopidy import config, ext
__version__ = "1.1.1"
class Extension(ext.Extension):
dist_name = "Mopidy-ALSAMixer"
ext_name = "alsamixer"
version = __version__
def get_default_config(self):
conf_file = os.path.join(os.path.dirname(__file__), "ext.conf")
return config.re... | import pathlib
from mopidy import config, ext
__version__ = "1.1.1"
class Extension(ext.Extension):
dist_name = "Mopidy-ALSAMixer"
ext_name = "alsamixer"
version = __version__
def get_default_config(self):
return config.read(pathlib.Path(__file__).parent / "ext.conf")
def get_config_... | Use pathlib to read ext.conf | Use pathlib to read ext.conf
| Python | apache-2.0 | mopidy/mopidy-alsamixer | ---
+++
@@ -1,4 +1,4 @@
-import os
+import pathlib
from mopidy import config, ext
@@ -13,8 +13,7 @@
version = __version__
def get_default_config(self):
- conf_file = os.path.join(os.path.dirname(__file__), "ext.conf")
- return config.read(conf_file)
+ return config.read(pathlib.P... |
641b2d07a4250a779ad6ff31f579968f69362cc0 | numscons/numdist/__init__.py | numscons/numdist/__init__.py | from numdist_copy import default_lib_dirs, default_include_dirs, \
default_src_dirs, get_standard_file
from numdist_copy import msvc_runtime_library
from conv_template import process_file as process_c_file
from from_template import process_file as process_f_file
| from numdist_copy import default_lib_dirs, default_include_dirs, \
default_src_dirs, get_standard_file
from numdist_copy import msvc_runtime_library
from conv_template import process_file as process_c_file, process_str as process_c_str
from from_template import process_file as process_f_file
| Add process_c_str function to the numdist API | Add process_c_str function to the numdist API | Python | bsd-3-clause | cournape/numscons,cournape/numscons,cournape/numscons | ---
+++
@@ -2,5 +2,5 @@
default_src_dirs, get_standard_file
from numdist_copy import msvc_runtime_library
-from conv_template import process_file as process_c_file
+from conv_template import process_file as process_c_file, process_str as process_c_str
from from_template import process_fi... |
22e3ed1791698e2f2ffa7b8ce9b62a9f4c533b7b | open_budget_data_api/main.py | open_budget_data_api/main.py | import logging
import os
from flask import Flask
from flask_cors import CORS
from apisql import apisql_blueprint
app = Flask(__name__)
log = logging.getLogger(__name__)
log.setLevel(logging.INFO)
MAX_ROWS = int(os.environ.get('MAX_ROWS', 1000))
app.register_blueprint(
apisql_blueprint(connection_string=os.envir... | import logging
import os
from flask import Flask
from flask_cors import CORS
from apisql import apisql_blueprint
app = Flask(__name__)
log = logging.getLogger(__name__)
log.setLevel(logging.INFO)
MAX_ROWS = int(os.environ.get('MAX_ROWS', 1000))
app.register_blueprint(
apisql_blueprint(connection_string=os.envir... | Reduce cache time on db queries | Reduce cache time on db queries
| Python | mit | OpenBudget/open-budget-data-api,OpenBudget/open-budget-data-api | ---
+++
@@ -19,5 +19,5 @@
@app.after_request
def add_header(response):
- response.cache_control.max_age = 3600
+ response.cache_control.max_age = 600
return response |
d792679461357fa17b1f852d7a72921aed2fe271 | bermann/rdd_test.py | bermann/rdd_test.py | import unittest
from bermann import RDD
class TestRDD(unittest.TestCase):
def test_cache_is_noop(self):
rdd = RDD([1, 2, 3])
cached = rdd.cache()
self.assertEqual(rdd, cached)
# collect
# count
# countByKey
# conntByValue
# distinct
# filter
# first
... | import unittest
from bermann import RDD
class TestRDD(unittest.TestCase):
def test_cache_is_noop(self):
rdd = RDD([1, 2, 3])
cached = rdd.cache()
self.assertEqual(rdd, cached)
def test_collect_empty_rdd_returns_empty_list(self):
rdd = RDD()
self.assertEqual([], rd... | Add tests for count and collect | Add tests for count and collect
| Python | mit | oli-hall/bermann | ---
+++
@@ -12,9 +12,25 @@
self.assertEqual(rdd, cached)
- # collect
+ def test_collect_empty_rdd_returns_empty_list(self):
+ rdd = RDD()
- # count
+ self.assertEqual([], rdd.collect())
+
+ def test_collect_non_empty_rdd_returns_contents(self):
+ rdd = RDD([1, 2, 3])
+
... |
8dd1164979ae8fce031fea153178ab7940e21069 | zproject/jinja2/__init__.py | zproject/jinja2/__init__.py | from typing import Any
from django.conf import settings
from django.contrib.staticfiles.storage import staticfiles_storage
from django.template.defaultfilters import pluralize, slugify
from django.urls import reverse
from django.utils import translation
from django.utils.timesince import timesince
from jinja2 import E... | from typing import Any
from django.conf import settings
from django.contrib.staticfiles.storage import staticfiles_storage
from django.template.defaultfilters import pluralize, slugify
from django.urls import reverse
from django.utils import translation
from django.utils.timesince import timesince
from jinja2 import E... | Make debug_mode for default_page_params follow the setting. | static: Make debug_mode for default_page_params follow the setting.
For pages that don't have page_params, the default_page_params now
ensures that debug_mode will correctly follow settings.DEBUG.
This allows blueslip exception popups to work on portico pages for
development environment.
Fixes: #17540.
| Python | apache-2.0 | punchagan/zulip,andersk/zulip,andersk/zulip,zulip/zulip,hackerkid/zulip,rht/zulip,eeshangarg/zulip,eeshangarg/zulip,punchagan/zulip,punchagan/zulip,hackerkid/zulip,hackerkid/zulip,eeshangarg/zulip,rht/zulip,zulip/zulip,rht/zulip,rht/zulip,eeshangarg/zulip,kou/zulip,eeshangarg/zulip,zulip/zulip,andersk/zulip,kou/zulip,h... | ---
+++
@@ -16,7 +16,7 @@
env = Environment(**options)
env.globals.update(
default_page_params={
- "debug_mode": False,
+ "debug_mode": settings.DEBUG,
"webpack_public_path": staticfiles_storage.url(
settings.WEBPACK_LOADER["DEFAULT"]["BUNDLE_DIR_... |
889a2fc46567bffb4034de5785b03b8b87289c15 | trac/versioncontrol/web_ui/__init__.py | trac/versioncontrol/web_ui/__init__.py | from trac.versioncontrol.web_ui.browser import *
from trac.versioncontrol.web_ui.changeset import *
from trac.versioncontrol.web_ui.log import *
| from trac.versioncontrol.web_ui.browser import *
from trac.versioncontrol.web_ui.changeset import *
from trac.versioncontrol.web_ui.log import *
| Add missing `svn:eol-style : native` prop, which prevented making clean patches against the early 0.9b1 archives (now both the .zip and the .tar.gz have CRLFs for this file) | Add missing `svn:eol-style : native` prop, which prevented making clean patches against the early 0.9b1 archives (now both the .zip and the .tar.gz have CRLFs for this file) | Python | bsd-3-clause | pkdevbox/trac,pkdevbox/trac,pkdevbox/trac,pkdevbox/trac | |
bcc79588e5e49c928210d6830fbe1a7386fcf5bb | apps/search/tasks.py | apps/search/tasks.py | import logging
from django.conf import settings
from django.db.models.signals import pre_delete
from elasticutils.contrib.django.tasks import index_objects, unindex_objects
from wiki.signals import render_done
def render_done_handler(**kwargs):
if not settings.ES_LIVE_INDEX or 'instance' not in kwargs:
... | import logging
import warnings
from django.conf import settings
from django.db.models.signals import pre_delete
# ignore a deprecation warning from elasticutils until the fix is released
# refs https://github.com/mozilla/elasticutils/pull/160
warnings.filterwarnings("ignore",
category=Deprecat... | Stop a deprecation warning that is thrown in elasticutils. | Stop a deprecation warning that is thrown in elasticutils.
This is not going to be needed once https://github.com/mozilla/elasticutils/pull/160
has been released.
| Python | mpl-2.0 | jezdez/kuma,whip112/Whip112,FrankBian/kuma,YOTOV-LIMITED/kuma,SphinxKnight/kuma,jgmize/kuma,RanadeepPolavarapu/kuma,ollie314/kuma,nhenezi/kuma,FrankBian/kuma,surajssd/kuma,YOTOV-LIMITED/kuma,yfdyh000/kuma,cindyyu/kuma,SphinxKnight/kuma,openjck/kuma,MenZil/kuma,RanadeepPolavarapu/kuma,yfdyh000/kuma,whip112/Whip112,carne... | ---
+++
@@ -1,7 +1,14 @@
import logging
+import warnings
from django.conf import settings
from django.db.models.signals import pre_delete
+
+# ignore a deprecation warning from elasticutils until the fix is released
+# refs https://github.com/mozilla/elasticutils/pull/160
+warnings.filterwarnings("ignore",
+ ... |
6155cfa0d16bfde8b412a3b2c68983ef939d518c | synapse/tests/test_init.py | synapse/tests/test_init.py | import os
import imp
import synapse
from synapse.tests.common import *
class InitTest(SynTest):
def test_init_modules(self):
os.environ['SYN_MODULES'] = 'fakenotrealmod , badnothere,math'
msg = 'SYN_MODULES failed: badnothere (NoSuchDyn: name=\'badnothere\')'
with self.getLoggerStream('sy... | import os
import imp
import synapse
from synapse.tests.common import *
class InitTest(SynTest):
pass
'''
def test_init_modules(self):
os.environ['SYN_MODULES'] = 'fakenotrealmod , badnothere,math'
msg = 'SYN_MODULES failed: badnothere (NoSuchDyn: name=\'badnothere\')'
with self.ge... | Comment out broken init test | Comment out broken init test
| Python | apache-2.0 | vertexproject/synapse,vertexproject/synapse,vivisect/synapse,vertexproject/synapse | ---
+++
@@ -5,7 +5,9 @@
from synapse.tests.common import *
class InitTest(SynTest):
+ pass
+ '''
def test_init_modules(self):
os.environ['SYN_MODULES'] = 'fakenotrealmod , badnothere,math'
msg = 'SYN_MODULES failed: badnothere (NoSuchDyn: name=\'badnothere\')'
@@ -16,3 +18,4 @@
... |
5f70d83408d177e803ce8edfb0ebd2b909722a64 | troposphere/certificatemanager.py | troposphere/certificatemanager.py | # Copyright (c) 2012-2019, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
# Resource specification version: 15.1.0
from . import AWSObject
from . import AWSProperty
from troposphere import Tags
class DomainValidationOpti... | # Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
# Resource specification version: 31.1.0
from . import AWSObject
from . import AWSProperty
from troposphere import Tags
from .validators import inte... | Update CertificateManager per 2021-03-11 changes | Update CertificateManager per 2021-03-11 changes
| Python | bsd-2-clause | cloudtools/troposphere,cloudtools/troposphere | ---
+++
@@ -1,15 +1,30 @@
-# Copyright (c) 2012-2019, Mark Peek <mark@peek.org>
+# Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
-# Resource specification version: 15.1.0
+# Resource specific... |
c947ecffd771117ce531f5058356a17b7db82fdb | mockaioredis/commands/__init__.py | mockaioredis/commands/__init__.py | from mockredis import MockRedis as _MockRedis
from .generic import GenericCommandsMixin
from .hash import HashCommandsMixin
from .list import ListCommandsMixin
from .set import SetCommandsMixin
__all__ = ['MockRedis']
class MockRedis(GenericCommandsMixin, HashCommandsMixin, ListCommandsMixin, SetCommandsMixin):
... | from mockredis import MockRedis as _MockRedis
from .generic import GenericCommandsMixin
from .hash import HashCommandsMixin
from .list import ListCommandsMixin
from .set import SetCommandsMixin
__all__ = ['MockRedis']
class MockRedis(GenericCommandsMixin, HashCommandsMixin, ListCommandsMixin, SetCommandsMixin):
... | Add close comands to MockRedis class | chore: Add close comands to MockRedis class
This closes #15
Signed-off-by: Kai Blin <ad3597797f6179d503c382b2627cc19939309418@biosustain.dtu.dk>
| Python | apache-2.0 | kblin/mockaioredis,kblin/mockaioredis | ---
+++
@@ -19,6 +19,13 @@
self._encoding = encoding
+ async def wait_closed(self):
+ if self._conn:
+ await self._conn.wait_closed()
+
+ def close(self):
+ if self._conn:
+ self._conn.close()
async def create_redis(address, *, db=None, password=None, ssl=None... |
022d8b992a88fd4c489c068ba57b4b2fcf6dde98 | cloudsizzle/studyplanner/completedstudies/models.py | cloudsizzle/studyplanner/completedstudies/models.py | from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class CompletedCourse(models.Model):
"""
Model for completed studies
"""
student = models.ForeignKey(User, related_name='completed_courses')
code = models.CharField(max_length=11)
name = model... | from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class CompletedCourse(models.Model):
"""
Model for completed studies
"""
student = models.ForeignKey(User, related_name='completed_courses')
code = models.CharField(max_length=11)
name = models... | Allow null values for ocr and cr fields of CompletedCourse | Allow null values for ocr and cr fields of CompletedCourse
| Python | mit | jpvanhal/cloudsizzle,jpvanhal/cloudsizzle | ---
+++
@@ -8,15 +8,15 @@
"""
Model for completed studies
"""
- student = models.ForeignKey(User, related_name='completed_courses')
+ student = models.ForeignKey(User, related_name='completed_courses')
code = models.CharField(max_length=11)
name = models.CharField(max_length=100)
- ... |
8dbcd07e0db34d39ad8f79067282d4359d79439d | usr/bin/graphical-app-launcher.py | usr/bin/graphical-app-launcher.py | #!/usr/bin/env python
import os
import subprocess
if __name__ == '__main__':
if os.environ.has_key('APP'):
graphical_app = os.environ['APP']
process = subprocess.Popen(graphical_app, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdoutdata... | #!/usr/bin/env python
import os
import subprocess
if __name__ == '__main__':
if os.environ.has_key('APP'):
graphical_app = os.environ['APP']
if os.environ.has_key('ARGS'):
extra_args = os.environ['ARGS']
command = graphical_app + ' ' + extra_args
else:
c... | Support an ARGS enviromental variable for extra command arguments. | Support an ARGS enviromental variable for extra command arguments.
| Python | apache-2.0 | thewtex/docker-opengl,thewtex/docker-opengl | ---
+++
@@ -6,7 +6,13 @@
if __name__ == '__main__':
if os.environ.has_key('APP'):
graphical_app = os.environ['APP']
- process = subprocess.Popen(graphical_app, shell=True,
+ if os.environ.has_key('ARGS'):
+ extra_args = os.environ['ARGS']
+ command = graphical_app + ... |
830c73beafa359e01fb839901bcb91360c1de365 | web/thesaurus_template_generators.py | web/thesaurus_template_generators.py | import json
from web.MetaInfo import MetaInfo
def generate_language_template(language_id, structure_id, version=None):
meta_info = MetaInfo()
if structure_id not in meta_info.data_structures:
raise ValueError
language_name = meta_info.languages.get(
language_id,
{'name': 'Human-Rea... | """Generator functions for thesaurus files"""
import json
from web.MetaInfo import MetaInfo
def generate_language_template(language_id, structure_id, version=None):
"""Generate a template for the given language and structure"""
meta_info = MetaInfo()
if structure_id not in meta_info.data_structures:
... | Add name fields to generated templates | Add name fields to generated templates
| Python | agpl-3.0 | codethesaurus/codethesaur.us,codethesaurus/codethesaur.us | ---
+++
@@ -1,8 +1,10 @@
+"""Generator functions for thesaurus files"""
import json
from web.MetaInfo import MetaInfo
def generate_language_template(language_id, structure_id, version=None):
+ """Generate a template for the given language and structure"""
meta_info = MetaInfo()
if structure_id not... |
7039dd833186ba8430aae55de3e856ac0426f90c | examples/rust_with_cffi/setup.py | examples/rust_with_cffi/setup.py | #!/usr/bin/env python
import platform
import sys
from setuptools import setup
from setuptools_rust import RustExtension
setup(
name="rust-with-cffi",
version="0.1.0",
classifiers=[
"License :: OSI Approved :: MIT License",
"Development Status :: 3 - Alpha",
"Intended Audience :: De... | #!/usr/bin/env python
import platform
import sys
from setuptools import setup
from setuptools_rust import RustExtension
setup(
name="rust-with-cffi",
version="0.1.0",
classifiers=[
"License :: OSI Approved :: MIT License",
"Development Status :: 3 - Alpha",
"Intended Audience :: De... | Use py_limited_api="auto" in rust_with_cffi example | Use py_limited_api="auto" in rust_with_cffi example
| Python | mit | PyO3/setuptools-rust,PyO3/setuptools-rust | ---
+++
@@ -19,7 +19,7 @@
],
packages=["rust_with_cffi"],
rust_extensions=[
- RustExtension("rust_with_cffi.rust"),
+ RustExtension("rust_with_cffi.rust", py_limited_api="auto"),
],
cffi_modules=["cffi_module.py:ffi"],
install_requires=["cffi"], |
4c799fe2c14d5c602f1eda83a3ab226eb2e7060e | octane/tests/test_upgrade_node.py | octane/tests/test_upgrade_node.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Fix test for upgrade-node command parser | Fix test for upgrade-node command parser
Change-Id: I87746a3806f7dada04f5e650e17796fd4e65f55b
| Python | apache-2.0 | stackforge/fuel-octane,Mirantis/octane,stackforge/fuel-octane,Mirantis/octane | ---
+++
@@ -16,4 +16,4 @@
octane_app.run(["upgrade-node", "--isolated", "1", "2", "3"])
assert not octane_app.stdout.getvalue()
assert not octane_app.stderr.getvalue()
- m.assert_called_once_with(1, [2, 3], isolated=True, template=None)
+ m.assert_called_once_with(1, [2, 3], isolated=True, networ... |
fe9e11af28e2ffe2b3da5ebb0971cd712136284c | nodeconductor/iaas/migrations/0011_cloudprojectmembership_availability_zone.py | nodeconductor/iaas/migrations/0011_cloudprojectmembership_availability_zone.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('iaas', '0010_auto_20150118_1834'),
]
operations = [
migrations.AddField(
model_name='cloudprojectmembership',
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('iaas', '0010_auto_20150118_1834'),
]
operations = [
migrations.AddField(
model_name='cloudprojectmembership',
... | Add help_text to availability_zone field (nc-327) | Add help_text to availability_zone field (nc-327)
| Python | mit | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | ---
+++
@@ -14,7 +14,7 @@
migrations.AddField(
model_name='cloudprojectmembership',
name='availability_zone',
- field=models.CharField(max_length=100, blank=True),
+ field=models.CharField(help_text='Optional availability group. Will be used for all instances p... |
a6606da129674fa47b2d32711a6c81f6bcd7d8ca | readthedocs/settings/postgres.py | readthedocs/settings/postgres.py | from .base import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'docs',
'USER': 'postgres', # Not used with sqlite3.
'PASSWORD': '',
'HOST': '10.177.73.97',
'PORT': '',
}
}
DEBUG = False
TEMPLATE_DE... | from .base import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'docs',
'USER': 'postgres', # Not used with sqlite3.
'PASSWORD': '',
'HOST': '10.177.73.97',
'PORT': '',
}
}
DEBUG = False
TEMPLATE_DE... | Use protocol-specific URL for media. | Use protocol-specific URL for media.
| Python | mit | agjohnson/readthedocs.org,tddv/readthedocs.org,VishvajitP/readthedocs.org,sils1297/readthedocs.org,GovReady/readthedocs.org,jerel/readthedocs.org,soulshake/readthedocs.org,fujita-shintaro/readthedocs.org,raven47git/readthedocs.org,Carreau/readthedocs.org,LukasBoersma/readthedocs.org,gjtorikian/readthedocs.org,Tazer/rea... | ---
+++
@@ -15,7 +15,7 @@
TEMPLATE_DEBUG = False
CELERY_ALWAYS_EAGER = False
-MEDIA_URL = 'http://media.readthedocs.org/'
+MEDIA_URL = '//media.readthedocs.org/'
ADMIN_MEDIA_PREFIX = MEDIA_URL + 'admin/'
CACHE_BACKEND = 'memcached://localhost:11211/'
SESSION_ENGINE = "django.contrib.sessions.backends.cached_db... |
1187deb4140ad0c7d66f0f25ae6d019f8ffb6168 | bluebottle/homepage/views.py | bluebottle/homepage/views.py | from django.utils import translation
from rest_framework import response
from bluebottle.utils.views import GenericAPIView
from .models import HomePage
from .serializers import HomePageSerializer
# Instead of serving all the objects separately we combine Slide, Quote and Stats into a dummy object
class HomePageDeta... | from django.utils import translation
from rest_framework import response
from bluebottle.utils.views import GenericAPIView
from .models import HomePage
from .serializers import HomePageSerializer
# Instead of serving all the objects separately we combine Slide, Quote and Stats into a dummy object
class HomePageDeta... | Add proper context to homepage serializer | Add proper context to homepage serializer
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -19,5 +19,7 @@
request.LANGUAGE_CODE = translation.get_language()
homepage = HomePage().get(language)
- serialized = HomePageSerializer().to_representation(homepage)
+ serialized = HomePageSerializer(
+ context=self.get_serializer_context()
+ ).to_represe... |
424980a48e451d1b99397843001bd75fa58e474e | tests/test_fullqualname.py | tests/test_fullqualname.py | """Tests for fullqualname."""
import nose
import sys
from fullqualname import fullqualname
def test_builtin_function():
# Test built-in function object.
obj = len
# Type is 'builtin_function_or_method'.
assert type(obj).__name__ == 'builtin_function_or_method'
# Object is a function.
asse... | """Tests for fullqualname."""
import inspect
import nose
import sys
from fullqualname import fullqualname
def test_builtin_function():
# Test built-in function object.
obj = len
# Type is 'builtin_function_or_method'.
assert type(obj).__name__ == 'builtin_function_or_method'
# Object is a fun... | Add built-in method object test | Add built-in method object test
| Python | bsd-3-clause | etgalloway/fullqualname | ---
+++
@@ -1,5 +1,6 @@
"""Tests for fullqualname."""
+import inspect
import nose
import sys
@@ -23,3 +24,25 @@
expected = '__builtin__.len'
nose.tools.assert_equals(fullqualname(obj), expected)
+
+
+def test_builtin_method():
+ # Test built-in method object.
+
+ obj = [1, 2, 3].append
+
... |
2af6e066509689ed14f40b122c600bed39dea543 | setup.py | setup.py | #!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name='ppp_datamodel',
version='0.4',
description='Data model for the Projet Pensées Profondes.',
url='https://github.com/ProjetPP/PPP-datamodel-Python',
author='Valentin Lorentz',
author_email='valentin.lorentz+ppp@ens-l... | #!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name='ppp_datamodel',
version='0.5',
description='Data model for the Projet Pensées Profondes.',
url='https://github.com/ProjetPP/PPP-datamodel-Python',
author='Valentin Lorentz',
author_email='valentin.lorentz+ppp@ens-l... | Bump version number to 0.5 | Bump version number to 0.5
| Python | agpl-3.0 | ProjetPP/PPP-datamodel-Python,ProjetPP/PPP-datamodel-Python | ---
+++
@@ -4,7 +4,7 @@
setup(
name='ppp_datamodel',
- version='0.4',
+ version='0.5',
description='Data model for the Projet Pensées Profondes.',
url='https://github.com/ProjetPP/PPP-datamodel-Python',
author='Valentin Lorentz', |
0b05101696989a3b88a4a630a6886c5db142175b | setup.py | setup.py | from setuptools import setup, find_packages
import pydle
setup(
name=pydle.__name__,
version=pydle.__version__,
packages=[
'pydle',
'pydle.features',
'pydle.features.rfc1459',
'pydle.features.ircv3_1',
'pydle.features.ircv3_2',
'pydle.utils'
],
requir... | from setuptools import setup, find_packages
import pydle
setup(
name=pydle.__name__,
version=pydle.__version__,
packages=[
'pydle',
'pydle.features',
'pydle.features.rfc1459',
'pydle.features.ircv3_1',
'pydle.features.ircv3_2',
'pydle.utils'
],
requir... | Install irccat as pydle-irccat instead. | Install irccat as pydle-irccat instead.
| Python | bsd-3-clause | Shizmob/pydle | ---
+++
@@ -18,9 +18,9 @@
},
entry_points={
'console_scripts': [
- 'irccat = pydle.utils.irccat:main',
'pydle = pydle.utils.run:main',
- 'ipydle = pydle.utils.console:main'
+ 'ipydle = pydle.utils.console:main',
+ 'pydle-irccat = pydle.utils.... |
fd79655ff898b715273512cd8a655b262321444a | setup.py | setup.py | from setuptools import setup
setup(
name="django-minio-storage-py-pa",
license="MIT",
use_scm_version=True,
description="Django file storage using the minio python client",
author="Tom Houlé",
author_email="tom@kafunsho.be",
url="https://github.com/py-pa/django-minio-storage",
packages=... | from setuptools import setup
setup(
name="django-minio-storage-py-pa",
license="MIT",
use_scm_version=True,
description="Django file storage using the minio python client",
author="Tom Houlé",
author_email="tom@kafunsho.be",
url="https://github.com/py-pa/django-minio-storage",
packages=... | Fix minimum django version spec | Fix minimum django version spec
| Python | apache-2.0 | tomhoule/django-minio-storage | ---
+++
@@ -11,7 +11,7 @@
packages=['minio_storage'],
setup_requires=['setuptools_scm'],
install_requires=[
- "django>=1.9",
+ "django>=1.8",
"minio>=2.2.2",
],
extras_require={ |
16374d0fde1a9e88211090da58fa06dba968501b | setup.py | setup.py | from setuptools import setup
setup(
name='tangled.session',
version='0.1a3.dev0',
description='Tangled session integration',
long_description=open('README.rst').read(),
url='http://tangledframework.org/',
download_url='https://github.com/TangledWeb/tangled.session/tags',
author='Wyatt Bald... | from setuptools import setup
setup(
name='tangled.session',
version='0.1a3.dev0',
description='Tangled session integration',
long_description=open('README.rst').read(),
url='http://tangledframework.org/',
download_url='https://github.com/TangledWeb/tangled.session/tags',
author='Wyatt Bald... | Upgrade tangled 0.1a5 => 0.1a9 | Upgrade tangled 0.1a5 => 0.1a9
| Python | mit | TangledWeb/tangled.session | ---
+++
@@ -16,12 +16,12 @@
'tangled.session.tests',
],
install_requires=[
- 'tangled>=0.1a5',
'Beaker>=1.6.4',
+ 'tangled>=0.1a9',
],
extras_require={
'dev': [
- 'tangled[dev]>=0.1a5',
+ 'tangled[dev]>=0.1a9',
],
},
... |
0fae9740d62d25469b42e8912bcad7de7d904b26 | setup.py | setup.py | import os.path
from setuptools import setup
thisdir = os.path.abspath(os.path.dirname(__file__))
version = open(os.path.join(thisdir, 'asciigraf', 'VERSION')).read().strip()
def readme():
with open("README.rst", 'r') as f:
return f.read()
setup(
name="asciigraf",
version=version,
packages=[... | import os.path
from setuptools import setup
thisdir = os.path.abspath(os.path.dirname(__file__))
version = open(os.path.join(thisdir, 'asciigraf', 'VERSION')).read().strip()
def readme():
with open("README.rst", 'r') as f:
return f.read()
setup(
name="asciigraf",
version=version,
packages=[... | Add python3.7 as a classifier | Add python3.7 as a classifier | Python | mit | AnjoMan/asciigraf | ---
+++
@@ -26,6 +26,7 @@
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
+ "Programming Language :: Python :: 3.7",
"Topic :: Software Development :: Libraries :: Python Modules",
],
long_d... |
b42d2239d24bb651f95830899d972e4302a10d77 | setup.py | setup.py | #!/usr/bin/env python
import setuptools
import samsungctl
setuptools.setup(
name=samsungctl.__title__,
version=samsungctl.__version__,
description=samsungctl.__doc__,
url=samsungctl.__url__,
author=samsungctl.__author__,
author_email=samsungctl.__author_email__,
license=samsungctl.__licen... | #!/usr/bin/env python
import setuptools
import samsungctl
setuptools.setup(
name=samsungctl.__title__,
version=samsungctl.__version__,
description=samsungctl.__doc__,
url=samsungctl.__url__,
author=samsungctl.__author__,
author_email=samsungctl.__author_email__,
license=samsungctl.__licen... | Use comma on every line on multi-line lists | Use comma on every line on multi-line lists
| Python | mit | dominikkarall/samsungctl,Ape/samsungctl | ---
+++
@@ -23,6 +23,6 @@
"Environment :: Console",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
- "Topic :: Home Automation"
- ]
+ "Topic :: Home Automation",
+ ],
) |
13c060f47d16860e0c67ace5adbde3c9167f343e | setup.py | setup.py | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name = 'ferretmagic',
packages = ['ferretmagic'],
py_modules = ['ferretmagic'],
version = '20181001',
description = 'ipython extension for pyferret',
author = 'Patrick Brockmann',
author_email = 'Patr... | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name = 'ferretmagic',
packages = ['ferretmagic'],
py_modules = ['ferretmagic'],
version = '20181001',
description = 'ipython extension for pyferret',
author = 'Patrick Brockmann',
author_email = 'Patr... | Test for compatibility python2 and python3 | Test for compatibility python2 and python3
| Python | mit | PBrockmann/ipython-ferretmagic,PBrockmann/ipython_ferretmagic,PBrockmann/ipython_ferretmagic | ---
+++
@@ -17,7 +17,8 @@
download_url = 'https://github.com/PBrockmann/ipython_ferretmagic/tarball/master',
keywords = ['jupyter', 'ipython', 'ferret', 'pyferret', 'magic', 'extension'],
classifiers = [
- 'Programming Language :: Python',
+ 'Programming Language :: Python :: 3',
+ 'Programming... |
c259e42ea95fdc43ad9345d702d3cab901d88f93 | rx/core/__init__.py | rx/core/__init__.py | # flake8: noqa
from .typing import Observer, Scheduler
from .disposable import Disposable
from .anonymousobserver import AnonymousObserver
from . import observerextensions
from .pipe import pipe
from .observable import Observable
from .observable import AnonymousObservable, ConnectableObservable
from .observable imp... | # flake8: noqa
from .typing import Observer, Scheduler
from .disposable import Disposable
from .anonymousobserver import AnonymousObserver
from .pipe import pipe
from .observable import Observable
from .observable import AnonymousObservable, ConnectableObservable
from .observable import GroupedObservable, BlockingOb... | Remove observer extension from init | Remove observer extension from init
| Python | mit | ReactiveX/RxPY,ReactiveX/RxPY | ---
+++
@@ -1,10 +1,9 @@
# flake8: noqa
from .typing import Observer, Scheduler
+from .disposable import Disposable
-from .disposable import Disposable
from .anonymousobserver import AnonymousObserver
-from . import observerextensions
from .pipe import pipe
from .observable import Observable |
4068605116cb04b999c66d29056c88cf2c4ab46c | scripts/analytics/addon_count.py | scripts/analytics/addon_count.py | import sys
import logging
from datetime import datetime
from dateutil.parser import parse
from website.settings import ADDONS_AVAILABLE
from website.app import init_app
from website.settings import KEEN as keen_settings
from keen.client import KeenClient
logger = logging.getLogger(__name__)
logging.basicConfig(level=... | import logging
from website.settings import ADDONS_AVAILABLE
from website.app import init_app
from website.settings import KEEN as keen_settings
from keen.client import KeenClient
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def count():
counts = []
for addon in ADDONS_AVAILA... | Remove date from addon count script | Remove date from addon count script
| Python | apache-2.0 | pattisdr/osf.io,saradbowman/osf.io,binoculars/osf.io,caneruguz/osf.io,HalcyonChimera/osf.io,mattclark/osf.io,cslzchen/osf.io,chrisseto/osf.io,acshi/osf.io,mfraezz/osf.io,acshi/osf.io,CenterForOpenScience/osf.io,monikagrabowska/osf.io,sloria/osf.io,aaxelb/osf.io,caseyrollins/osf.io,monikagrabowska/osf.io,Johnetordoff/os... | ---
+++
@@ -1,7 +1,4 @@
-import sys
import logging
-from datetime import datetime
-from dateutil.parser import parse
from website.settings import ADDONS_AVAILABLE
from website.app import init_app
@@ -42,8 +39,4 @@
if __name__ == '__main__':
init_app()
- try:
- date = parse(sys.argv[1])
- exc... |
cced850df75679de3fbdf92856baf060202d9449 | setup.py | setup.py | from setuptools import setup
setup(name='mailosaur',
version='3.0.2',
description='Python client library for Mailosaur',
url='https://mailosaur.com',
author='Mailosaur Ltd',
author_email='support@mailosaur.com',
keywords='email automation testing selenium robot framework',
lic... | from setuptools import setup
setup(name='mailosaur',
version='3.0.3',
description='Python client library for Mailosaur',
url='https://mailosaur.com',
author='Mailosaur Ltd',
author_email='support@mailosaur.com',
keywords='email automation testing selenium robot framework',
lic... | Increment version to 3.0.3 which now supports Python 2 and 3 | Increment version to 3.0.3 which now supports Python 2 and 3
| Python | mit | mailosaurapp/mailosaur-python,mailosaur/mailosaur-python,mailosaur/mailosaur-python | ---
+++
@@ -1,7 +1,7 @@
from setuptools import setup
setup(name='mailosaur',
- version='3.0.2',
+ version='3.0.3',
description='Python client library for Mailosaur',
url='https://mailosaur.com',
author='Mailosaur Ltd', |
3faffe4188c33147199a7c189407d10ce3af8ab5 | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='sgevents',
version='0.1-dev',
description='A simplifying Shotgun event daemon',
url='http://github.com/westernx/sgevents',
packages=find_packages(exclude=['build*', 'tests*']),
author='Mike Boers',
author_email='sgevents@mi... | from setuptools import setup, find_packages
setup(
name='sgevents',
version='0.1-dev',
description='A simplifying Shotgun event daemon',
url='http://github.com/westernx/sgevents',
packages=find_packages(exclude=['build*', 'tests*']),
author='Mike Boers',
author_email='sgevents@mi... | Remove dependence on sgapi (since we can use shotgun_api3 as well) | Remove dependence on sgapi (since we can use shotgun_api3 as well)
| Python | bsd-3-clause | westernx/sgevents,westernx/sgevents | ---
+++
@@ -14,7 +14,7 @@
license='BSD-3',
install_requires=[
- 'sgapi',
+ # one of `sgapi` or `shotgun_api3` is required
],
classifiers=[ |
6f47a8a0dfa0fa3ad1659848cce1a764b239406a | setup.py | setup.py | from sqlalchemy_mptt import __version__
from setuptools import setup
setup(
name='sqlalchemy_mptt',
version=__version__,
url='http://github.com/ITCase/sqlalchemy_mptt/',
author='Svintsov Dmitry',
author_email='root@uralbash.ru',
packages=['sqlalchemy_mptt', ],
include_package_data=True,
... | import os
import re
from setuptools import setup
with open(os.path.join('sqlalchemy_mptt', '__init__.py'), 'rb') as fh:
__version__ = (re.search(r'__version__\s*=\s*u?"([^"]+)"', fh.read())
.group(1).strip())
setup(
name='sqlalchemy_mptt',
version=__version__,
url='http://github.c... | Make the package installable at the same time of its requirements. | Make the package installable at the same time of its requirements.
`python setup.py --version` now works even if sqlalchemy is not
installed.
| Python | mit | uralbash/sqlalchemy_mptt,uralbash/sqlalchemy_mptt,ITCase/sqlalchemy_mptt,ITCase/sqlalchemy_mptt | ---
+++
@@ -1,5 +1,12 @@
-from sqlalchemy_mptt import __version__
+import os
+import re
from setuptools import setup
+
+
+with open(os.path.join('sqlalchemy_mptt', '__init__.py'), 'rb') as fh:
+ __version__ = (re.search(r'__version__\s*=\s*u?"([^"]+)"', fh.read())
+ .group(1).strip())
+
setup... |
6bb1c15243d04acf8980a21720f6577d73e2f4b0 | setup.py | setup.py | from setuptools import setup, find_packages
import sys, os
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.rst')).read()
except IOError:
README = ''
version = "0.0.1a2"
setup(name='backlash',
version=version,
description="Standalone WebOb port of th... | from setuptools import setup, find_packages
import sys, os
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.rst')).read()
except IOError:
README = ''
version = "0.0.2"
setup(name='backlash',
version=version,
description="Standalone WebOb port of the ... | Raise version for release due to font licensing issues resolution | Raise version for release due to font licensing issues resolution
| Python | mit | TurboGears/backlash,TurboGears/backlash | ---
+++
@@ -7,7 +7,7 @@
except IOError:
README = ''
-version = "0.0.1a2"
+version = "0.0.2"
setup(name='backlash',
version=version,
@@ -19,6 +19,7 @@
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Program... |
df095a5d08a9ffa7b54be946b19f356cc3201819 | setup.py | setup.py | #!/usr/bin/env python
import re
from setuptools import find_packages, setup
with open('py_mstr/__init__.py', 'rb') as f:
version = str(re.search('__version__ = "(.+?)"', f.read().decode('utf-8')).group(1))
setup(
name='py-mstr',
version=version,
packages=find_packages(),
description='Python AP... | #!/usr/bin/env python
import re
from setuptools import find_packages, setup
with open('py_mstr/__init__.py', 'rb') as f:
version = str(re.search('__version__ = "(.+?)"', f.read().decode('utf-8')).group(1))
setup(
name='py-mstr',
version=version,
packages=find_packages(),
description='Python AP... | Add six to the requirements. | RDL-4689: Add six to the requirements.
| Python | mit | infoscout/py-mstr | ---
+++
@@ -21,6 +21,7 @@
install_requires=[
'pyquery >= 1.2.8, < 1.3.0',
'requests >= 2.3.0',
+ 'six >= 1.9.0'
],
tests_require=['discover', 'mock'],
test_suite="tests", |
9995a3bb8b95caddc6319e68f405c70fd2a15d09 | aldryn_faq/search_indexes.py | aldryn_faq/search_indexes.py | from aldryn_search.base import AldrynIndexBase
from aldryn_search.utils import strip_tags
from django.template import RequestContext
from haystack import indexes
from .models import Question
class QuestionIndex(AldrynIndexBase, indexes.Indexable):
INDEX_TITLE = True
def get_title(self, obj):
return... | from aldryn_search.base import AldrynIndexBase
from aldryn_search.utils import strip_tags
from django.template import RequestContext
from haystack import indexes
from .models import Question, Category
class QuestionIndex(AldrynIndexBase, indexes.Indexable):
INDEX_TITLE = True
def get_title(self, obj):
... | Add search index for faq categories | Add search index for faq categories
| Python | bsd-3-clause | czpython/aldryn-faq,czpython/aldryn-faq,mkoistinen/aldryn-faq,czpython/aldryn-faq,czpython/aldryn-faq | ---
+++
@@ -3,7 +3,7 @@
from django.template import RequestContext
from haystack import indexes
-from .models import Question
+from .models import Question, Category
class QuestionIndex(AldrynIndexBase, indexes.Indexable):
@@ -34,3 +34,23 @@
else:
text += strip_tags(instance.ren... |
082bcfefddb4ba566e35e827d9e726aacdfb80d6 | collection_pipelines/core.py | collection_pipelines/core.py | import functools
def coroutine(fn):
def wrapper(*args, **kwargs):
generator = fn(*args, **kwargs)
next(generator)
return generator
return wrapper
class CollectionPipelineProcessor:
sink = None
start_source = None
receiver = None
def process(self, item):
rais... | import functools
def coroutine(fn):
def wrapper(*args, **kwargs):
generator = fn(*args, **kwargs)
next(generator)
return generator
return wrapper
class CollectionPipelineProcessor:
sink = None
start_source = None
receiver = None
def process(self, item):
rais... | Allow to overwrite the pipeline processor return value | Allow to overwrite the pipeline processor return value
| Python | mit | povilasb/pycollection-pipelines | ---
+++
@@ -25,6 +25,18 @@
def source(self, start_source):
self.start_source = start_source
+ def return_value(self):
+ """Processor return value when used with __or__ operator.
+
+ Returns:
+ CollectionPipelineProcessor: when processor is to be chained
+ wit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.