commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
8337575314ae02e99eeded1ffb537a87a423b2c0 | spam/ansiInventory.py | spam/ansiInventory.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
AnsibleInventory:
INTRO:
USAGE:
"""
import os
import ansible.inventory
class AnsibleInventory(object):
'''
Ansible Inventory wrapper class.
'''
def __init__(self, inventory_filename):
'''
Initialize Inventory
'''
if... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
AnsibleInventory:
INTRO:
USAGE:
"""
import os
import ansible.inventory
class AnsibleInventory(object):
'''
Ansible Inventory wrapper class.
'''
def __init__(self, inventory_filename):
'''
Initialize Inventory
'''
if... | Make changes to get_hosts() to return a list of dict | Make changes to get_hosts() to return a list of dict
| Python | apache-2.0 | bdastur/spam,bdastur/spam |
ffa3d12e5b45cad56367726bdce83de509bc33a7 | state_tracker/state_defs.py | state_tracker/state_defs.py | # Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.
import sys
sys.path.append( "../glapi_parser" )
import apiutil
apiutil.CopyrightDef()
print """DESCRIPTION ""
EXPORTS
"""
keys = apiutil.GetDispatchedFunctions("../glapi_p... | # Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.
import sys
sys.path.append( "../glapi_parser" )
import apiutil
apiutil.CopyrightDef()
print """DESCRIPTION ""
EXPORTS
"""
keys = apiutil.GetDispatchedFunctions("../glapi_p... | Fix defs for ReadPixels and GetChromiumParametervCR | Fix defs for ReadPixels and GetChromiumParametervCR
| Python | bsd-3-clause | rpavlik/chromium,rpavlik/chromium,rpavlik/chromium,rpavlik/chromium,rpavlik/chromium |
2b249d8a81c51d30d9175ac033c7a0b208684d59 | tests/test_basic.py | tests/test_basic.py | import sys
import pubrunner
def test_countwords():
pubrunner.pubrun('examples/CountWords/',True,True)
| import sys
import pubrunner
import pubrunner.command_line
def test_countwords():
#pubrunner.pubrun('examples/CountWords/',True,True)
sys.argv = ['--test','examples/CountWords/']
pubrunner.command_line.main()
| Test case now runs main directly | Test case now runs main directly
| Python | mit | jakelever/pubrunner,jakelever/pubrunner |
806d3293ebbbd0f30f923e73def902e9c14a0879 | tests/test_match.py | tests/test_match.py | import cv2
import numpy
from nose.tools import raises
import stbt
from _stbt.core import _load_template
def black(width=1280, height=720):
return numpy.zeros((height, width, 3), dtype=numpy.uint8)
def test_that_matchresult_image_matches_template_passed_to_match():
assert stbt.match("black.png", frame=black... | import cv2
import numpy
from nose.tools import raises
import stbt
from _stbt.core import _load_template
def black(width=1280, height=720):
return numpy.zeros((height, width, 3), dtype=numpy.uint8)
def test_that_matchresult_image_matches_template_passed_to_match():
assert stbt.match("black.png", frame=black... | Add test for the region reported for a failed match | tests: Add test for the region reported for a failed match
If the match fails at the first level of the pyramid algorithm (when
we're searching in a down-scaled version of the frame) then we have to
up-scale the region we report for the best (but not good enough) match.
This passes currently, but there was no test fo... | Python | lgpl-2.1 | martynjarvis/stb-tester,LewisHaley/stb-tester,LewisHaley/stb-tester,LewisHaley/stb-tester,martynjarvis/stb-tester,stb-tester/stb-tester,LewisHaley/stb-tester,martynjarvis/stb-tester,LewisHaley/stb-tester,stb-tester/stb-tester,martynjarvis/stb-tester,LewisHaley/stb-tester,martynjarvis/stb-tester,martynjarvis/stb-tester,... |
d254cf6960f2d04e02ed252c4461994483a9d0f5 | launch_control/models/hw_device.py | launch_control/models/hw_device.py | """
Module with the HardwareDevice model.
"""
from launch_control.utils.json import PlainOldData
class HardwareDevice(PlainOldData):
"""
Model representing any HardwareDevice
A device is just a "device_type" attribute with a bag of properties
and a human readable description. Individual device types... | """
Module with the HardwareDevice model.
"""
from launch_control.utils.json import PlainOldData
class HardwareDevice(PlainOldData):
"""
Model representing any HardwareDevice
A device is just a "device_type" attribute with a bag of properties
and a human readable description. Individual device types... | Fix HardwareDevice docstring to match implementation | Fix HardwareDevice docstring to match implementation
| Python | agpl-3.0 | Linaro/lava-server,OSSystems/lava-server,OSSystems/lava-server,Linaro/lava-server,OSSystems/lava-server,Linaro/lava-server,Linaro/lava-server |
b97fd14bba5d45a6e4e3caa02bd947bddfd0ba8b | tools/sniper_stats_jobid.py | tools/sniper_stats_jobid.py | import sniper_stats, intelqueue, iqclient
class SniperStatsJobid(sniper_stats.SniperStatsBase):
def __init__(self, jobid):
self.jobid = jobid
self.ic = iqclient.IntelClient()
def read_metricnames(self):
return self.ic.graphite_dbresults(self.jobid, 'read_metricnames')
def get_snapshots(self):
... | import sniper_stats, intelqueue, iqclient
class SniperStatsJobid(sniper_stats.SniperStatsBase):
def __init__(self, jobid):
self.jobid = jobid
self.ic = iqclient.IntelClient()
self.names = self.read_metricnames()
def read_metricnames(self):
return self.ic.graphite_dbresults(self.jobid, 'read_metri... | Read metric names on startup for jobid-based stats so self.names is available as expected | [sniper_stats] Read metric names on startup for jobid-based stats so self.names is available as expected
| Python | mit | abanaiyan/sniper,abanaiyan/sniper,abanaiyan/sniper,abanaiyan/sniper,abanaiyan/sniper |
2a17b9fdb55806d6397f506066a2a7e8c480020b | pylinks/main/tests.py | pylinks/main/tests.py | from django.test import TestCase
from analytics.models import GoogleAnalytics
class GoogleAnalyticsTests(TestCase):
def test_ga_tracking(self):
GoogleAnalytics(site_id=1, web_property_id='12345').save()
response = self.client.get('/')
self.assertContains(response, "_gaq.push(['_setAccount'... | from django.test import TestCase
from analytics.models import GoogleAnalytics
class GoogleAnalyticsTests(TestCase):
def test_ga_tracking(self):
GoogleAnalytics(site_id=1, web_property_id='12345').save()
response = self.client.get('/')
self.assertContains(response, "_gaq.push(['_setAccount'... | Add simple admin test just so we catch breakage early | Add simple admin test just so we catch breakage early
| Python | mit | michaelmior/pylinks,michaelmior/pylinks,michaelmior/pylinks |
36e8b7f7dd4de93c61f49d65106f2a0410945e2d | pyoracc/model/line.py | pyoracc/model/line.py | from mako.template import Template
class Line(object):
template = Template("""${label}. \\
% for word in words:
${word} \\
% endfor
% if lemmas:
\n#lem: \\
% for lemma in lemmas:
${lemma}; \\
% endfor \n
%endif
""", output_encoding='utf-8')
def __init__(self, label):
self.label = label
self.... | from mako.template import Template
class Line(object):
template = Template("""\n${label}.\t\\
${' '.join(words)}\\
% if references:
% for reference in references:
^${reference}^
% endfor
% endif
% if lemmas:
\n#lem:\\
${'; '.join(lemmas)}\\
% endif
% if notes:
\n
% for note in notes:
${note.serialize()}
% endfor
... | Use join for serializing words and lemmas to avoid printing last ; as required by ATF format. Print also references, notes and links. | Use join for serializing words and lemmas to avoid printing last ; as required by ATF format. Print also references, notes and links.
| Python | mit | UCL/pyoracc |
b7acc8ca9c6c41aff7ffb419125f54d21da09652 | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name='plyprotobuf',
version='1.0',
description='Protobuf Parsing Library that uses ply',
author='Dusan Klinec',
url='https://github.com/sb98052/plyprotobuf',
packages=['plyproto'],
)
| #!/usr/bin/env python
from distutils.core import setup
setup(name='plyprotobuf',
version='1.0',
description='Protobuf Parsing Library that uses ply',
author='Dusan Klinec',
url='https://github.com/sb98052/plyprotobuf',
packages=['plyproto'],
install_requires=['ply']
)
| Add dependency to ply package | Add dependency to ply package
| Python | apache-2.0 | sb98052/plyprotobuf |
4b03c2c39c90bd1563954df16f353348f20d7280 | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The Screen class lets you to do positioned writes to the dos terminal.
The Screen class also allows you to specify the colors for foreground and
background, to the extent the dos terminal allows.
"""
classifiers = """\
Development Status :: 3 - Alpha
Environment :: Win... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The Screen class lets you to do positioned writes to the dos terminal.
The Screen class also allows you to specify the colors for foreground and
background, to the extent the dos terminal allows.
"""
classifiers = """\
Development Status :: 3 - Alpha
Environment :: Win... | Add install_requires and remove ctypes from requirements. | Add install_requires and remove ctypes from requirements.
| Python | mit | thebjorn/doscmd-screen |
55745f668715c294cd5662712b2d1ccb7726f125 | setup.py | setup.py | from distutils.core import setup
import multi_schema
setup(
name = "django-multi-schema",
version = multi_schema.__version__,
description = "Postgres schema support in django.",
url = "http://hg.schinckel.net/django-multi-schema",
author = "Matthew Schinckel",
author_email = "matt@schinckel.net... | from distutils.core import setup
import multi_schema
setup(
name = "django-multi-schema",
version = multi_schema.__version__,
description = "Postgres schema support in django.",
url = "http://hg.schinckel.net/django-multi-schema",
author = "Matthew Schinckel",
author_email = "matt@schinckel.net... | Add south as a dependency, so we can apply a version. Does not need to be installed in INSTALLED_APPS. | Add south as a dependency, so we can apply a version.
Does not need to be installed in INSTALLED_APPS.
| Python | bsd-3-clause | schinckel/django-boardinghouse,schinckel/django-boardinghouse,schinckel/django-boardinghouse |
a714511115bfee0fbdc6c70bd0abfceaa08384f6 | idlk/__init__.py | idlk/__init__.py | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import os
import sys
import unicodedata
import idlk.base41
if sys.version_info[0] == 3:
_get_byte = lambda c: c
else:
_get_byte = ord
def hash_macroman(data):
h = 0
for c in data:
h ... | """
A lock filename generator for idlk files used by a well known DTP suite.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import os
import sys
import unicodedata
from idlk import base41
if sys.version_info[0] == 3:
_get_byte = lambda c: c
else:... | Fix issues reported by pylint | Fix issues reported by pylint
| Python | mit | znerol/py-idlk |
3bc0876e7bae2cfb62724f1e5dce1a93f71b7252 | docstring_parser/parser/__init__.py | docstring_parser/parser/__init__.py | """Docstring parsing."""
from . import rest
from .common import ParseError
_styles = {"rest": rest.parse}
def parse(text: str, style: str = "auto"):
"""
Parse the docstring into its components.
:param str text: docstring text to parse
:param text style: docstring style, choose from: 'rest', 'auto'... | """Docstring parsing."""
from . import rest
from .common import ParseError, Docstring
_styles = {"rest": rest.parse}
def _parse_score(docstring: Docstring) -> int:
"""
Produce a score for the parsing.
:param Docstring docstring: parsed docstring representation
:returns int: parse score, higher is ... | Fix parsing when style specified, add 'auto' score | Fix parsing when style specified, add 'auto' score
| Python | mit | rr-/docstring_parser |
0e1bdcb4e6d2404bb832ab86ec7bf526c1c90bbb | teami18n/teami18n/models.py | teami18n/teami18n/models.py | from django.db import models
from django_countries import countries
class Country(models.Model):
code = models.CharField(max_length=2, choices=tuple(countries),
unique=True)
class Podcast(models.Model):
story_id = models.CharField(max_length=16, unique=True)
link = models.UR... | from django.db import models
from django_countries import countries
class Country(models.Model):
code = models.CharField(max_length=2, choices=tuple(countries),
unique=True)
def __unicode__(self):
return self.code
class Podcast(models.Model):
story_id = models.CharF... | Add nice name for working in the shell | Add nice name for working in the shell
| Python | mit | team-i18n/hackaway,team-i18n/hackaway,team-i18n/hackaway |
e1a0e3e6895ce14822b111ee17b182a79b7b28c9 | miniraf/calc.py | miniraf/calc.py | def create_parser(subparsers):
pass
| import argparse
from astropy.io import fits
import sys
OP_MAP = {"+": lambda x, y: x + y,
"-": lambda x, y: x - y,
"*": lambda x, y: x * y,
"/": lambda x, y: x / y}
def create_parser(subparsers):
parser_calc = subparsers.add_parser("calc", help="calc help")
parser_calc.add_argume... | Add simple four-function output option | Add simple four-function output option
Signed-off-by: Lizhou Sha <d6acb26e253550574bc1141efa0eb5e6de15daeb@mit.edu>
| Python | mit | vulpicastor/miniraf |
8ca16832b54c887e6e3a84d7018181bf7e55fba0 | comrade/core/context_processors.py | comrade/core/context_processors.py | from django.conf import settings
from django.contrib.sites.models import Site
from settings import DeploymentType
def default(request):
context = {}
context['DEPLOYMENT'] = settings.DEPLOYMENT
context['site'] = Site.objects.get_current()
if settings.DEPLOYMENT != DeploymentType.PRODUCTION:
cont... | from django.conf import settings
from django.contrib.sites.models import Site
from settings import DeploymentType
def default(request):
context = {}
context['DEPLOYMENT'] = settings.DEPLOYMENT
context['site'] = Site.objects.get_current()
if settings.DEPLOYMENT != DeploymentType.PRODUCTION:
cont... | Add SSL media context processor. | Add SSL media context processor.
| Python | mit | bueda/django-comrade |
7a85762ead43d8ba75547488eecda120417e8c2a | lib/python/opendiamond/helpers.py | lib/python/opendiamond/helpers.py | #
# The OpenDiamond Platform for Interactive Search
# Version 4
#
# Copyright (c) 2009 Carnegie Mellon University
# All rights reserved.
#
# This software is distributed under the terms of the Eclipse Public
# License, Version 1.0 which can be found in the file named LICENSE.
# ANY USE, REPRODUCTION OR DISTRIBUT... | #
# The OpenDiamond Platform for Interactive Search
# Version 4
#
# Copyright (c) 2009 Carnegie Mellon University
# All rights reserved.
#
# This software is distributed under the terms of the Eclipse Public
# License, Version 1.0 which can be found in the file named LICENSE.
# ANY USE, REPRODUCTION OR DISTRIBUT... | Remove Python wrapper function for executing cookiecutter program | Remove Python wrapper function for executing cookiecutter program
| Python | epl-1.0 | cmusatyalab/opendiamond,cmusatyalab/opendiamond,cmusatyalab/opendiamond,cmusatyalab/opendiamond,cmusatyalab/opendiamond |
41b241de6f2afa94b442007518d481526bfb66ae | linked-list/remove-k-from-list.py | linked-list/remove-k-from-list.py | # Given a singly linked list of integers l and an integer k, remove all elements from list l that have a value equal to k
class Node(object): # define constructor
def __init__(self, value):
self.value = value
self.next = None
| # Given a singly linked list of integers l and an integer k, remove all elements from list l that have a value equal to k
class Node(object): # define constructor
def __init__(self, value):
self.value = value
self.next = None
class LinkedList(object):
def __init__(self, head=None):
self.head = head
| Add initialization to linked list class | Add initialization to linked list class
| Python | mit | derekmpham/interview-prep,derekmpham/interview-prep |
da50d1b66f662f5e3e1b89fd88632f7076c32084 | apps/careers/models.py | apps/careers/models.py | from cms import sitemaps
from cms.apps.pages.models import ContentBase
from cms.models import HtmlField, PageBase
from django.db import models
from historylinks import shortcuts as historylinks
class Careers(ContentBase):
classifier = 'apps'
urlconf = '{{ project_name }}.apps.careers.urls'
per_page = mo... | from cms import sitemaps
from cms.apps.pages.models import ContentBase
from cms.models import HtmlField, PageBase
from django.db import models
from historylinks import shortcuts as historylinks
class Careers(ContentBase):
classifier = 'apps'
urlconf = '{{ project_name }}.apps.careers.urls'
per_page = mo... | Remove duplicate fields from Career | Remove duplicate fields from Career
| Python | mit | onespacemedia/cms-jobs,onespacemedia/cms-jobs |
8416a3ed1a6af2d0037f77744d809441591086cd | mrp_bom_location/models/mrp_bom.py | mrp_bom_location/models/mrp_bom.py | # Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MrpBom(models.Model):
_inherit = "mrp.bom"
location_id = fields.Many2one(
related='picking_type_id.default_location_dest_id',
... | # Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MrpBom(models.Model):
_inherit = "mrp.bom"
location_id = fields.Many2one(
related='picking_type_id.default_location_dest_id',
... | Make the related location readonly | [IMP] Make the related location readonly
| Python | agpl-3.0 | OCA/manufacture,OCA/manufacture |
21afbaab7deb874703f4968ea1337b59120f0ad0 | music-stream.py | music-stream.py | import urllib.request
import subprocess
LIMIT = 10
PLAYER = 'vlc'
url = 'http://streams.twitch.tv/kraken/streams?limit='+str(LIMIT)+'&offset=0&game=Music&broadcaster_language=&on_site=1'
with urllib.request.urlopen(url) as response:
html = response.read().decode('utf8')
i = 0
urls = []
for line in html.split(','... | import urllib.request
import subprocess
LIMIT = 10
PLAYER = 'vlc'
STREAMS_URL = 'http://streams.twitch.tv/kraken/streams?limit='+str(LIMIT)+'&offset=0&game=Music&broadcaster_language=&on_site=1'
while True:
with urllib.request.urlopen(STREAMS_URL) as response:
html = response.read().decode('utf8')
i ... | Refresh streams list when player is closed | Refresh streams list when player is closed | Python | mit | GaudyZircon/music-stream |
9d9827721e3d4c45f8917662d2f59759fb4ecd66 | muv/__init__.py | muv/__init__.py | """
Miscellaneous utilities.
"""
import numpy as np
def kennard_stone(d, k):
"""
Use the Kennard-Stone algorithm to select k maximally separated
examples from a dataset.
See R. W. Kennard and L. A. Stone (1969): Computer Aided Design of
Experiments, Technometrics, 11:1, 137-148.
Algorithm
... | """
Miscellaneous utilities.
"""
import numpy as np
class MUV(object):
"""
Generate maximum unbiased validation (MUV) datasets for virtual
screening as described in Rohrer and Baumann, J. Chem. Inf. Model.
2009, 49, 169-184.
"""
def kennard_stone(d, k):
"""
Use the Kennard-Stone algo... | Fix reference and add MUV class | Fix reference and add MUV class
| Python | bsd-3-clause | skearnes/muv |
d616642e11c0151f44cdae6038d8cdae07abdf8c | setup.py | setup.py | from distutils.core import setup
setup(
name='Getty Art',
version='0.0.1',
author='Clemens Wolff',
author_email='clemens.wolff+pypi@gmail.com',
packages=['getty_art'],
url='https://github.com/c-w/GettyArt',
download_url='http://pypi.python.org/pypi/GettyArt',
license='LICENSE.txt',
... | from distutils.core import setup
setup(
name='Getty Art',
version='0.0.1',
author='Clemens Wolff',
author_email='clemens.wolff+pypi@gmail.com',
packages=['getty_art'],
url='https://github.com/c-w/GettyArt',
download_url='http://pypi.python.org/pypi/GettyArt',
license='LICENSE.txt',
... | Make tag-line consistent with GitHub | Make tag-line consistent with GitHub
| Python | mit | c-w/GettyArt |
4ee409a5635b1d027f5d3c68fb2a62f554c9c801 | ib_insync/__init__.py | ib_insync/__init__.py | import sys
import importlib
from .version import __version__, __version_info__ # noqa
from . import util
if sys.version_info < (3, 6, 0):
raise RuntimeError('ib_insync requires Python 3.6 or higher')
try:
import ibapi
except ImportError:
raise RuntimeError(
'IB API from http://interactivebroker... | import sys
import importlib
if sys.version_info < (3, 6, 0):
raise RuntimeError('ib_insync requires Python 3.6 or higher')
try:
import ibapi
except ImportError:
raise RuntimeError(
'IB API from http://interactivebrokers.github.io is required')
from . import util # noqa
if util.ibapiVersionInfo()... | Fix explicit check for presence of ibapi package | Fix explicit check for presence of ibapi package
| Python | bsd-2-clause | erdewit/ib_insync,erdewit/ib_insync |
525c224080b3ac13864fbd3b5b9db2e884691edf | polyaxon/sidecar/sidecar/sidecar/monitor.py | polyaxon/sidecar/sidecar/sidecar/monitor.py | import ocular
from polyaxon_schemas.pod import PodLifeCycle
def is_container_terminated(event, container_id):
statuses_by_name = ocular.processor.get_container_statuses_by_name(
event.status.to_dict().get('container_statuses', []))
statuses = ocular.processor.get_container_status(statuses_by_name, (c... | import ocular
from polyaxon_schemas.pod import PodLifeCycle
def is_container_terminated(event, container_id):
container_statuses = event.status.to_dict().get('container_statuses') or []
statuses_by_name = ocular.processor.get_container_statuses_by_name(container_statuses)
statuses = ocular.processor.get_... | Fix sidecar check for terminated containers | Fix sidecar check for terminated containers
| Python | apache-2.0 | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon |
d387ab6335ba73a0ecbc1ffa55e9b35ff119bd58 | journal/views.py | journal/views.py | import json
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View
from django.http import JsonResponse
from .models import Entry
@method_decorator(csrf_exempt, name='dispatch')
class RestView(View):
def get(self, request):... | import json
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View
from django.http import JsonResponse
from .models import Entry
@method_decorator(csrf_exempt, name='dispatch')
class RestView(View):
def get(self, request):... | Update the protocol to mirror the return result of get. | Update the protocol to mirror the return result of get.
| Python | agpl-3.0 | etesync/journal-manager |
c87c4a972f0f2d4966142fa666a900112762ed76 | scipy/constants/tests/test_codata.py | scipy/constants/tests/test_codata.py |
import warnings
from scipy.constants import find
from numpy.testing import assert_equal
def test_find():
warnings.simplefilter('ignore', DeprecationWarning)
keys = find('weak mixing', disp=False)
assert_equal(keys, ['weak mixing angle'])
keys = find('qwertyuiop', disp=False)
assert_equal(keys,... |
import warnings
from scipy.constants import find
from numpy.testing import assert_equal, run_module_suite
def test_find():
warnings.simplefilter('ignore', DeprecationWarning)
keys = find('weak mixing', disp=False)
assert_equal(keys, ['weak mixing angle'])
keys = find('qwertyuiop', disp=False)
... | Allow codata tests to be run as script. | ENH: Allow codata tests to be run as script.
| Python | bsd-3-clause | zerothi/scipy,zxsted/scipy,josephcslater/scipy,rgommers/scipy,grlee77/scipy,sargas/scipy,dch312/scipy,ilayn/scipy,apbard/scipy,jakevdp/scipy,niknow/scipy,vanpact/scipy,jakevdp/scipy,rmcgibbo/scipy,zxsted/scipy,pnedunuri/scipy,raoulbq/scipy,lhilt/scipy,mgaitan/scipy,mingwpy/scipy,maciejkula/scipy,njwilson23/scipy,Dapid/... |
3a2f4940ff83d3d2645505b82d1207a96f6d209e | linked-list/is-list-palindrome.py | linked-list/is-list-palindrome.py | # Given a singly linked list of integers, determine whether or not it's a palindrome
class Node(object): # define constructor
def __init__(self, value):
self.value = value
self.next = None
def is_list_palindrome(l):
if l.value is None:
return True
# find center of list
fast = l
slow = l
while fast.next an... | # Given a singly linked list of integers, determine whether or not it's a palindrome
class Node(object): # define constructor
def __init__(self, value):
self.value = value
self.next = None
def is_list_palindrome(l):
if l is None or l.next is None:
return True
# find center of list
fast = l
slow = l
while ... | Add check for palindrome component of method | Add check for palindrome component of method
| Python | mit | derekmpham/interview-prep,derekmpham/interview-prep |
b43dfa19979dc74efb27e56771535b102547e792 | utils.py | utils.py | import sqlite3
import shelve
def connect_db(name):
"""
Open a connection to the database used to store quotes.
:param name: (str) Name of database file
:return: (shelve.DbfilenameShelf)
"""
try:
return shelve.open(name)
except Exception:
raise Exception('Unable to connect... | import sqlite3
import shelve
def connect_db(name):
"""
Open a connection to the database used to store quotes.
:param name: (str) Name of database file
:return: (shelve.DbfilenameShelf)
"""
try:
return shelve.open(name)
except Exception:
raise Exception('Unable to connect... | Add method to insert quotes into database | Add method to insert quotes into database
Fix schema for quotes table
| Python | mit | nickdibari/Get-Quote |
918b001cb6d9743d3d2ee1b2bab8f14c90e1adf7 | src/ice/rom_finder.py | src/ice/rom_finder.py |
from console import Console
from rom import ROM
from functools import reduce
class ROMFinder(object):
def __init__(self, filesystem):
self.filesystem = filesystem
def roms_for_console(self, console):
"""
@param console - A console object
@returns A list of ROM objects representing all of the va... |
from console import Console
from rom import ROM
from functools import reduce
class ROMFinder(object):
def __init__(self, filesystem):
self.filesystem = filesystem
def roms_for_console(self, console):
"""
@param console - A console object
@returns A list of ROM objects representing all of the va... | Replace 'list.extend' call with '+' operator | [Cleanup] Replace 'list.extend' call with '+' operator
I knew there had to be an easier way for merging lists other than `extend`. Turns out the plus operator does exactly what I need.
| Python | mit | rdoyle1978/Ice,scottrice/Ice |
cdd79aa60f4ef707714a632188373a5c2c4b0af4 | mass_mailing_switzerland/models/crm_event_compassion.py | mass_mailing_switzerland/models/crm_event_compassion.py | ##############################################################################
#
# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Nathan Fluckiger <nathan.fluckiger@hotmail.ch>
#
# The licence is in the file __manifest__.py
#
#########... | ##############################################################################
#
# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Nathan Fluckiger <nathan.fluckiger@hotmail.ch>
#
# The licence is in the file __manifest__.py
#
#########... | FIX bug in event creation | FIX bug in event creation
| Python | agpl-3.0 | CompassionCH/compassion-switzerland,eicher31/compassion-switzerland,CompassionCH/compassion-switzerland,eicher31/compassion-switzerland,CompassionCH/compassion-switzerland,eicher31/compassion-switzerland |
19e6c020bc7d640fe4c8ffbdf7825693d7e4a03a | scripts/missing-qq.py | scripts/missing-qq.py | #!/usr/bin/env python
import os
import xml.etree.ElementTree as ET
RES_FOLDER = os.path.abspath(os.path.join(os.path.dirname(__file__), "../app/src/main/res"))
EN_STRINGS = os.path.join(RES_FOLDER, "values/strings.xml")
QQ_STRINGS = os.path.join(RES_FOLDER, "values-qq/strings.xml")
# Get ElementTree containing all me... | #!/usr/bin/env python
import os
import sys
import xml.etree.ElementTree as ET
RES_FOLDER = os.path.abspath(os.path.join(os.path.dirname(__file__), "../app/src/main/res"))
EN_STRINGS = os.path.join(RES_FOLDER, "values/strings.xml")
QQ_STRINGS = os.path.join(RES_FOLDER, "values-qq/strings.xml")
# Get ElementTree contai... | Exit with nonzero when qq strings are missing | Exit with nonzero when qq strings are missing
Change-Id: Ife0f114dbe48faa445397aa7a94f74de2309d117
| Python | apache-2.0 | anirudh24seven/apps-android-wikipedia,wikimedia/apps-android-wikipedia,SAGROUP2/apps-android-wikipedia,SAGROUP2/apps-android-wikipedia,SAGROUP2/apps-android-wikipedia,SAGROUP2/apps-android-wikipedia,wikimedia/apps-android-wikipedia,wikimedia/apps-android-wikipedia,SAGROUP2/apps-android-wikipedia,dbrant/apps-android-wik... |
174c570d69d0958aa734794ffb7712ea37e70c6f | parse.py | parse.py | import sys
import configparser
def main():
config = configparser.ConfigParser(strict=False)
try:
section = sys.argv[1]
config_key = sys.argv[2]
config_value = sys.argv[3]
except IndexError:
print("Usage: cat test.ini | python parse.py <section> <option> <value>")
s... | import sys
import configparser
def main():
config = configparser.ConfigParser(strict=False)
try:
section = sys.argv[1]
config_key = sys.argv[2]
config_value = sys.argv[3]
except IndexError:
print("Usage: cat test.ini | python parse.py <section> <option> <value>")
s... | Add new key to existing section. | Add new key to existing section.
| Python | mit | tonigrigoriu/ini-parser |
2e71f1a9deaf160ee666423e94ae526041cd32ff | engine.py | engine.py | # Use x, y coords for unit positions
# (97, 56) ... (104, 56)
# ... ...
# (97, 49) ... (104, 49)
#
# Algebraic notation for a position is:
# algebraic_pos = chr(x) + chr(y)
| # Use x, y coords for unit positions
# (97, 56) ... (104, 56)
# ... ...
# (97, 49) ... (104, 49)
#
# Algebraic notation for a position is:
# algebraic_pos = chr(x) + chr(y)
def _coord_to_algebraic(coord):
x, y = coord
return chr(x) + chr(y)
def _algebraic_to_coord(algebraic):
x, y = algebrai... | Add _coord_to_algebraic() and _algebraic_to_coord() to convert positions between (x, y) coords and 'a1' algebraic chess notation | Add _coord_to_algebraic() and _algebraic_to_coord() to convert positions between (x, y) coords and 'a1' algebraic chess notation
| Python | mit | EyuelAbebe/gamer,EyuelAbebe/gamer |
215e37fce8b3fedf7bf31bf7c6393271c84141a2 | src/tapdisk/plugin.py | src/tapdisk/plugin.py | #!/usr/bin/env python
import os
import sys
import xapi
import xapi.plugin
from xapi.storage.datapath import log
class Implementation(xapi.plugin.Plugin_skeleton):
def query(self, dbg):
return {
"plugin": "tapdisk",
"name": "The tapdisk user-space datapath plugin",
"de... | #!/usr/bin/env python
import os
import sys
import xapi
import xapi.storage.api.plugin
from xapi.storage import log
class Implementation(xapi.storage.api.plugin.Plugin_skeleton):
def query(self, dbg):
return {
"plugin": "tapdisk",
"name": "The tapdisk user-space datapath plugin",
... | Use the new xapi.storage package structure | Use the new xapi.storage package structure
Signed-off-by: David Scott <63c9eb0ea83039690fefa11afe17873ba8278a56@eu.citrix.com>
| Python | lgpl-2.1 | xapi-project/xapi-storage-datapath-plugins,stefanopanella/xapi-storage-plugins,djs55/xapi-storage-datapath-plugins,stefanopanella/xapi-storage-plugins,stefanopanella/xapi-storage-plugins,jjd27/xapi-storage-datapath-plugins,robertbreker/xapi-storage-datapath-plugins |
90b1567ee8e1906b1d1724cf63cf8d383530da29 | nimp/commands/cis_tomat_mining.py | nimp/commands/cis_tomat_mining.py | # -*- coding: utf-8 -*-
from nimp.commands._cis_command import *
from nimp.utilities.ue3 import *
from nimp.utilities.deployment import *
from nimp.utilities.file_mapper import *
#-------------------------------------------------------------------------------
class CisTomatMining(CisCommand):
abstract = ... | # -*- coding: utf-8 -*-
from nimp.commands._cis_command import *
from nimp.utilities.ue3 import *
from nimp.utilities.deployment import *
from nimp.utilities.file_mapper import *
import tempfile
import shutil
#-------------------------------------------------------------------------------
class CisTomatMini... | Split the Tomat mining commandlet into an Unreal part and a TomatConsole part. | Split the Tomat mining commandlet into an Unreal part and a TomatConsole part.
| Python | mit | dontnod/nimp |
e356ce2c6fc6a3383a4ab8f7eea1ecb3ef7aa978 | linter.py | linter.py | from SublimeLinter.lint import ComposerLinter
class Phpcs(ComposerLinter):
cmd = ('phpcs', '--report=emacs', '${args}', '-')
regex = r'^.*:(?P<line>[0-9]+):(?P<col>[0-9]+): (?:(?P<error>error)|(?P<warning>warning)) - (?P<message>(.(?!\(\S+\)$))+)( \((?P<code>\S+)\)$)?' # noqa: E501
defaults = {
'... | from SublimeLinter.lint import ComposerLinter
class Phpcs(ComposerLinter):
cmd = ('phpcs', '--report=emacs', '${args}', '-')
regex = r'^.*:(?P<line>[0-9]+):(?P<col>[0-9]+): (?:(?P<error>error)|(?P<warning>warning)) - (?P<message>(.(?!\(\S+\)$))+)( \((?P<code>\S+)\)$)?' # noqa: E501
defaults = {
'... | Update selector for Sublime Text >= 4134 | Update selector for Sublime Text >= 4134
| Python | mit | SublimeLinter/SublimeLinter-phpcs |
f61b81e968384859eb51a2ff14ca7709e8322ae8 | yunity/walls/models.py | yunity/walls/models.py | from django.db.models import ForeignKey, TextField
from config import settings
from yunity.base.models import BaseModel
class Wall(BaseModel):
pass
class WallPost(BaseModel):
wall = ForeignKey(Wall)
author = ForeignKey(settings.AUTH_USER_MODEL)
class WallPostContent(BaseModel):
post = ForeignKey(... | from django.db.models import ForeignKey, TextField
from config import settings
from yunity.base.models import BaseModel
class Wall(BaseModel):
def resolve_permissions(self, collector):
h = self.hub
if h.target_content_type.model == 'group':
g = h.target
""":type : Group"""... | Implement basic permissions resolver for walls | Implement basic permissions resolver for walls
To be seen as a poc, collect all hub permissions for a basic permission
and settings/inheritance model for reading a wall.
with @nicksellen
| Python | agpl-3.0 | yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend |
f4f5852944d1fd1b9e96a70cb4496ee6e1e66dc0 | genome_designer/main/celery_util.py | genome_designer/main/celery_util.py | """
Methods for interfacing with the Celery task queue management library.
"""
from errno import errorcode
from celery.task.control import inspect
CELERY_ERROR_KEY = 'ERROR'
def get_celery_worker_status():
"""Checks whether celery is running and reports the error if not.
Source: http://stackoverflow.com/q... | """
Methods for interfacing with the Celery task queue management library.
"""
from errno import errorcode
from celery.task.control import inspect
from django.conf import settings
CELERY_ERROR_KEY = 'ERROR'
def get_celery_worker_status():
"""Checks whether celery is running and reports the error if not.
S... | Fix tests: Allow for celery not to be running when doing in-memory celery for tests. | Fix tests: Allow for celery not to be running when doing in-memory celery for tests.
| Python | mit | churchlab/millstone,churchlab/millstone,churchlab/millstone,churchlab/millstone,woodymit/millstone_accidental_source,woodymit/millstone_accidental_source,woodymit/millstone_accidental_source,woodymit/millstone,woodymit/millstone,woodymit/millstone_accidental_source,woodymit/millstone,woodymit/millstone |
0b7f99bcb4e42c50263a7d8a42513876b02b445a | scikits/talkbox/tools/__init__.py | scikits/talkbox/tools/__init__.py | __all__ = []
import correlations
from correlations import *
__all__ += correlations.__all__
import cffilter
from cffilter import cslfilter as slfilter
__all__ += ['slfilter']
| __all__ = []
import correlations
from correlations import *
__all__ += correlations.__all__
import cffilter
from cffilter import cslfilter as slfilter
__all__ += ['slfilter']
from segmentaxis import segment_axis
__all__ += ['segment_axis']
| Put segment_axis in the main scikits.talkbox namespace. | Put segment_axis in the main scikits.talkbox namespace.
| Python | mit | cournape/talkbox,cournape/talkbox |
91fd97d7579673a0c310c734a1c1ef83a07b50d1 | phantasy/library/scan/datautil.py | phantasy/library/scan/datautil.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""utils for data crunching, saving.
"""
import numpy as np
class ScanDataFactory(object):
"""Post processor of data from scan server.
Parameters
----------
data : dict
Raw data retrieving from scan server regarding scan ID, after
comple... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""utils for data crunching, saving.
"""
import numpy as np
class ScanDataFactory(object):
"""Post processor of data from scan server.
Parameters
----------
data : dict
Raw data retrieving from scan server regarding scan ID, after
comple... | Make raw_data and data as properties | Make raw_data and data as properties
| Python | bsd-3-clause | archman/phantasy,archman/phantasy |
f8cbdf038a3d5cd8ba229cb627ecd1831265ca02 | context.py | context.py | from llvm.core import Module
from llvm.ee import ExecutionEngine
from llvm.passes import (FunctionPassManager,
PASS_GVN,
PASS_INSTCOMBINE,
PASS_REASSOCIATE,
PASS_SIMPLIFYCFG)
class Context(object):
optimizations =... | from llvm.core import Module
from llvm.ee import ExecutionEngine
from llvm.passes import (FunctionPassManager,
PASS_GVN,
PASS_INSTCOMBINE,
PASS_REASSOCIATE,
PASS_SIMPLIFYCFG)
class Context(object):
optimizations =... | Add target_data from ExecutionEngine to FunctionPassManager | Add target_data from ExecutionEngine to FunctionPassManager
| Python | mit | guilload/kaleidoscope |
45b71ea93db90ccb4b2b42947a73ea7a50bb91dd | grouprise/features/files/views.py | grouprise/features/files/views.py | import grouprise.features
from . import forms
class Create(grouprise.features.content.views.Create):
template_name = 'files/create.html'
form_class = forms.Create
| import grouprise.features.content.views
from . import forms
class Create(grouprise.features.content.views.Create):
template_name = 'files/create.html'
form_class = forms.Create
| Use full import in files view | Use full import in files view
Previously it seemed to work only by accident (the importer imported the
package before).
| Python | agpl-3.0 | stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten |
8621d6c0826beb4a4b4e920ce27786b01546ed28 | impactstoryanalytics/highcharts.py | impactstoryanalytics/highcharts.py | boilerplate = {
'chart': {
'renderTo': 'container',
'plotBackgroundColor': 'none',
'backgroundColor': 'none',
'spacingTop': 5
},
'title': {'text': None},
'subtitle': {'text': None},
'yAxis': {
'title':{
'text': None
},
'gridLineColo... | boilerplate = {
'chart': {
'renderTo': 'container',
'plotBackgroundColor': 'none',
'backgroundColor': 'none',
'spacingTop': 5
},
'title': {'text': None},
'subtitle': {'text': None},
'yAxis': {
'min': 0,
'title':{
'text': None
},
... | Set y-axis min to 0 | Set y-axis min to 0
| Python | mit | Impactstory/impactstory-analytics,Impactstory/impactstory-analytics,total-impact/impactstory-analytics,total-impact/impactstory-analytics,Impactstory/impactstory-analytics,total-impact/impactstory-analytics,Impactstory/impactstory-analytics,total-impact/impactstory-analytics |
bcccdbdb1b18128d96c37b7a5a888b55c5f99e9a | src/pybel_tools/analysis/__init__.py | src/pybel_tools/analysis/__init__.py | # -*- coding: utf-8 -*-
"""This submodule contains functions for applying algorithms to BEL graphs"""
from . import concordance, mechanisms, rcr, stability, ucmpa
from .concordance import *
from .mechanisms import *
from .rcr import *
from .stability import *
from .ucmpa import *
__all__ = (
concordance.__all__ ... | # -*- coding: utf-8 -*-
"""This submodule contains functions for applying algorithms to BEL graphs.
Each analysis might have weird requirements, and therefore they should all be imported explicitly.
"""
| Remove star imports from analysis | Remove star imports from analysis
| Python | mit | pybel/pybel-tools,pybel/pybel-tools,pybel/pybel-tools |
dcb58a29df0c8ab28b08fa8ca080dfd2f1c7552a | gunicorn.conf.py | gunicorn.conf.py | import os, multiprocessing
bind = "0.0.0.0:{}".format(os.environ["PORT"])
workers = multiprocessing.cpu_count() * 2 + 1
worker_class = "gevent"
def post_fork(server, worker):
from psycogreen.gevent import patch_psycopg
patch_psycopg()
worker.log.info("Colored psycopg green.")
| import multiprocessing
import os
bind = '0.0.0.0:{}'.format(os.environ['PORT'])
preload = True
workers = multiprocessing.cpu_count() * 2 + 1
| Remove the greens to (hopefully) recover tracebacks. | Remove the greens to (hopefully) recover tracebacks.
| Python | apache-2.0 | hello-base/web,hello-base/web,hello-base/web,hello-base/web |
4377eb3738eac414aecc52cbe7003cc887d82614 | setup.py | setup.py | from distutils.core import setup
setup(
name = 'apns',
version = '1.0',
py_modules = ['pyapns'],
url = 'http://www.goosoftware.co.uk/',
author = 'Simon Whitaker',
author_email = 'simon@goosoftware.co.uk',
description = 'A python library fo... | from distutils.core import setup
setup(
author = 'Simon Whitaker',
author_email = 'simon@goosoftware.co.uk',
description = 'A python library for interacting with the Apple Push Notification Service',
download_url = 'http://github.com/simonwhitaker/PyAPNs',
license = 'unlicense.org',
name = 'apn... | Tweak to py_modules, misc tidying | Tweak to py_modules, misc tidying
| Python | mit | AlexKordic/PyAPNs,duanhongyi/PyAPNs,miraculixx/PyAPNs,RatenGoods/PyAPNs,postmates/PyAPNs,korhner/PyAPNs,tenmalin/PyAPNs |
d8295756e73cb096acd5e3ef7e2b076b8b871c31 | apps/domain/src/main/routes/general/routes.py | apps/domain/src/main/routes/general/routes.py | from .blueprint import root_blueprint as root_route
from ...core.node import node
# syft absolute
from syft.core.common.message import SignedImmediateSyftMessageWithReply
from syft.core.common.message import SignedImmediateSyftMessageWithoutReply
from syft.core.common.serde.deserialize import _deserialize
from flask ... | from .blueprint import root_blueprint as root_route
from ...core.node import node
# syft absolute
from syft.core.common.message import SignedImmediateSyftMessageWithReply
from syft.core.common.message import SignedImmediateSyftMessageWithoutReply
from syft.core.common.serde.deserialize import _deserialize
from flask ... | Update /users/login endpoint to return serialized metadata | Update /users/login endpoint to return serialized metadata
| Python | apache-2.0 | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft |
c341259964b4874656f0394d459fe46b5e7d010e | temporenc/__init__.py | temporenc/__init__.py | """
Temporenc, a comprehensive binary encoding format for dates and times
"""
# Export public API
from .temporenc import ( # noqa
pack,
packb,
unpack,
unpackb,
Moment,
)
| """
Temporenc, a comprehensive binary encoding format for dates and times
"""
__version__ = '0.1.0'
__version_info__ = tuple(map(int, __version__.split('.')))
# Export public API
from .temporenc import ( # noqa
pack,
packb,
unpack,
unpackb,
Moment,
)
| Add __version__ and __version_info__ package attributes | Add __version__ and __version_info__ package attributes
See #3.
| Python | bsd-3-clause | wbolster/temporenc-python |
48cead9dc1fae0a3916aabb8950e1e31921b1bd7 | chessfellows/chess/models.py | chessfellows/chess/models.py | # from django.db import models
# from django.contrib.auth.models import User
# class Player(models.Model):
# user = models.OneToOneField(User)
# rating = models.PositiveSmallIntegerField()
# wins = models.PositiveIntegerField()
# losses = models.PositiveIntegerField()
# matches = models.ManyToMany... | from django.db import models
from django.contrib.auth.models import User
class Match(models.Model):
white = models.ForeignKey(User, related_name="White")
black = models.ForeignKey(User, related_name="Black")
moves = models.TextField()
class Player(models.Model):
user = models.OneToOneField(User)
... | Add Player.calc_rating() and Player.save() methods to update player rating after saving | Add Player.calc_rating() and Player.save() methods to update player rating after saving
| Python | mit | EyuelAbebe/gamer,EyuelAbebe/gamer |
b2150d8929d4db80e72d6baafaa38fda28424f7b | score.py | score.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import wikipedia
import sys
sample = 'Philosophers'
# help(cat_page)
def getPagesIn(category):
"""Should return the list of pages that the provided category contains"""
page_name = 'Category:' + category
page = wikipedia.page(page_name)
return page.lin... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import wikipedia
import sys
import os
sample = 'Philosophers'
# help(cat_page)
def getPagesIn(category):
"""Return the list of pages contained in the provided category"""
# wikipedia module doesn't provide category listing, let's retrieve it
# with some qu... | Use wget to fetch a list of categories + short description of each function | Use wget to fetch a list of categories + short description of each function
| Python | agpl-3.0 | psychoslave/catscore,psychoslave/catscore |
a3ee1841e4459ce734f621ad2aac86168f6ae3da | astral/models/ticket.py | astral/models/ticket.py | from elixir import ManyToOne, Entity
from elixir.events import after_insert
import json
from astral.models.base import BaseEntityMixin
from astral.models.event import Event
class Ticket(BaseEntityMixin, Entity):
source = ManyToOne('Node')
destination = ManyToOne('Node')
stream = ManyToOne('Stream')
... | from elixir import ManyToOne, Entity
from elixir.events import after_insert
import json
from astral.models.base import BaseEntityMixin
from astral.models.event import Event
class Ticket(BaseEntityMixin, Entity):
source = ManyToOne('Node')
destination = ManyToOne('Node')
stream = ManyToOne('Stream')
... | Add API_FIELDS so we can pass a Ticket as an event. | Add API_FIELDS so we can pass a Ticket as an event.
| Python | mit | peplin/astral |
3e40f0bd3941a48e3b792573c0058f1cc339d5db | fabfile.py | fabfile.py |
# It's for me, sorry
from fabric.api import *
import slackbot_settings as settings
from urllib import request, parse
env.hosts = settings.DEPLOY_HOSTS
def deploy():
slack("Deploy Started")
with cd("/var/bot/slack-shogi"):
run("git pull")
run("supervisorctl reload")
slack("Deploy Finishe... |
# It's for me, sorry
from fabric.api import *
import slackbot_settings as settings
from urllib import request, parse
env.hosts = settings.DEPLOY_HOSTS
def deploy():
slack("Deploy Started")
try:
with cd("/var/bot/slack-shogi"):
run("git pull")
run("supervisorctl reload")
... | Add fallback slack message for deploy script | Add fallback slack message for deploy script
| Python | mit | setokinto/slack-shogi |
9a986495eeaa1e331ee0404d09fcdea4e4e9299c | opps/contrib/notifications/views.py | opps/contrib/notifications/views.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import time
from django.http import StreamingHttpResponse
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from opps.views.generic.detail import DetailView
from opps.db import Db
from .models import Noti... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import time
from django.http import StreamingHttpResponse
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from opps.api.views.generic.list import ListView as ListAPIView
from opps.views.generic.detail im... | Create APIServer view on notification used to json render | Create APIServer view on notification
used to json render
| Python | mit | YACOWS/opps,williamroot/opps,YACOWS/opps,YACOWS/opps,opps/opps,williamroot/opps,jeanmask/opps,opps/opps,williamroot/opps,opps/opps,jeanmask/opps,opps/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,jeanmask/opps |
cd62369097feba54172c0048c4ef0ec0713be6d3 | linter.py | linter.py |
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Ivan Sobolev
# Copyright (c) 2016 Ivan Sobolev
#
# License: MIT
#
"""This module exports the Bemlint plugin class."""
from SublimeLinter.lint import NodeLinter, util
class Bemlint(NodeLinter):
"""Provides an ... |
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Ivan Sobolev
# Copyright (c) 2016 Ivan Sobolev
#
# License: MIT
#
"""This module exports the Bemlint plugin class."""
from SublimeLinter.lint import NodeLinter, util
class Bemlint(NodeLinter):
"""Provides an ... | Fix compatibility for SublimeLinter 4.12.0 | Fix compatibility for SublimeLinter 4.12.0
Signed-off-by: Jack Cherng <159f0f32a62cc912ca55f89bb5e06807cf019bc7@gmail.com>
| Python | mit | DesTincT/SublimeLinter-contrib-bemlint |
a8708203a9de77c34d1df05986aee2f4033bdf63 | invoice/tasks.py | invoice/tasks.py | # -*- encoding: utf-8 -*-
import logging
from celery import shared_task
from django.utils import timezone
from invoice.models import InvoiceUser
from mail.service import queue_mail_message
from mail.tasks import process_mail
from .report import time_summary
logger = logging.getLogger(__name__)
@shared_task
def ma... | # -*- encoding: utf-8 -*-
import logging
from celery import shared_task
from django.utils import timezone
from invoice.models import InvoiceUser
from mail.service import queue_mail_message
from mail.tasks import process_mail
from .report import time_summary
logger = logging.getLogger(__name__)
@shared_task
def ma... | Put the time summary in an html table | Put the time summary in an html table
| Python | apache-2.0 | pkimber/invoice,pkimber/invoice,pkimber/invoice |
04ff248c628e5523bc22c532cf4518f210376307 | setup.py | setup.py | #!/usr/bin/env python
# NOTE: setup.py does NOT install the contents of the library dir
# for you, you should go through "make install" or "make RPMs"
# for that, or manually copy modules over.
import os
import sys
sys.path.insert(0, os.path.abspath('lib'))
from ansible import __version__, __author__
from distutils.... | #!/usr/bin/env python
# NOTE: setup.py does NOT install the contents of the library dir
# for you, you should go through "make install" or "make RPMs"
# for that, or manually copy modules over.
import os
import sys
sys.path.insert(0, os.path.abspath('lib'))
from ansible import __version__, __author__
from distutils.... | Include bin/ansible-pull as part of the sdist in distutils. | Include bin/ansible-pull as part of the sdist in distutils.
| Python | mit | thaim/ansible,thaim/ansible |
a8826a8ce89dcb697b747285b276c4d2ccc9685d | setup.py | setup.py | from cx_Freeze import setup, Executable
packages = [
"encodings",
"uvloop",
"motor",
"appdirs",
"packaging",
"packaging.version",
"_cffi_backend",
"asyncio",
"asyncio.base_events",
"asyncio.compat",
"raven.conf",
"raven.handlers",
"raven.processors"
]
# Dependencies... | from cx_Freeze import setup, Executable
packages = [
"encodings",
"uvloop",
"motor",
"appdirs",
"packaging",
"packaging.version",
"_cffi_backend",
"asyncio",
"asyncio.base_events",
"asyncio.compat",
"raven",
"raven.conf",
"raven.handlers",
"raven.processors"
]
#... | Fix missing raven module again | Fix missing raven module again
| Python | mit | igboyes/virtool,virtool/virtool,igboyes/virtool,virtool/virtool |
fc3a02ed585bfb4d8ad404bceeebefae5496ebd4 | setup.py | setup.py | # coding: utf8
from distutils.core import setup
import trans
long_description = open('README.rst', 'r').read()
description = 'National characters transcription module.'
setup(
name='trans',
version=trans.__version__,
description=description,
long_description=long_description,
... | # coding: utf8
from distutils.core import setup
import trans
long_description = open('README.rst', 'r').read()
description = 'National characters transcription module.'
setup(
name='trans',
version=trans.__version__,
description=description,
long_description=long_description,
author='Zelenyak A... | Extend supported python versions and some pep8 fixes | Extend supported python versions and some pep8 fixes
| Python | bsd-2-clause | zzzsochi/trans |
0905772851b4911466eb8f31dd4853aefb88e478 | manage.py | manage.py | import os
from app import create_app, db
from app.models import User, Category
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)
#pyli... | import os
from app import create_app, db
from app.models import User, Category
from flask_script import Manager, Server
from flask_migrate import Migrate, MigrateCommand
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand... | Change the runserver command to run a server at a host ip of 127.0.0.1 to easily change the xternal visibility of the application later | Change the runserver command to run a server at a host ip of 127.0.0.1 to easily change the xternal visibility of the application later
| Python | mit | finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is |
47e0bf3b451f37f09e1dd98edceec8a7432c184e | tests/test_appinfo.py | tests/test_appinfo.py | import io
import os
import pickle
import pytest
from steamfiles import appinfo
test_file_name = os.path.join(os.path.dirname(__file__), 'test_data/appinfo.vdf')
@pytest.yield_fixture
def vdf_data():
with open(test_file_name, 'rb') as f:
yield f.read()
@pytest.yield_fixture
def pickled_data():
with ... | import io
import os
import pickle
import pytest
from steamfiles import appinfo
test_file_name = os.path.join(os.path.dirname(__file__), 'test_data/appinfo.vdf')
@pytest.yield_fixture
def vdf_data():
with open(test_file_name, 'rb') as f:
yield f.read()
@pytest.mark.usefixtures('vdf_data')
def test_load_... | Remove unused fixture from a test | Remove unused fixture from a test
| Python | mit | leovp/steamfiles |
602f537ad3ee6365aa781bc7776d5e797bfb65a3 | refactor_scripts/set_manufacturer.py | refactor_scripts/set_manufacturer.py | #!/usr/bin/python
import copy
import os
import os.path
import sys
import merge
def setManufacturer(manufacturer, destinations, test=False):
base_part = {u'category': "", u'name': "", u'subpart': [], u'equivalent': [], u'urls': {u'store': [], u'related': [], u'manufacturer': []}, u'manufacturer': manufacturer, u're... | #!/usr/bin/python
import copy
import os
import os.path
import sys
import merge
def setManufacturer(manufacturer, destinations, test=False):
base_part = {u'category': "", u'name': "", u'subpart': [], u'equivalent': [], u'urls': {u'store': [], u'related': [], u'manufacturer': []}, u'manufacturer': manufacturer, u're... | Handle refactoring manufacturers with spaces in their name. | Handle refactoring manufacturers with spaces in their name.
| Python | apache-2.0 | rcbuild-info/scrape,rcbuild-info/scrape |
b87073e7c7d4387b6608142de7fd6216a1d093b9 | setup.py | setup.py | from distutils.core import setup
setup(name = "bitey",
description="Bitcode Import Tool",
long_description = """
Bitey allows LLVM bitcode to be directly imported into Python as
an high performance extension module without the need for writing wrappers.
""",
license="""BSD""",
... | from distutils.core import setup
setup(name = "bitey",
description="Bitcode Import Tool",
long_description = """
Bitey allows LLVM bitcode to be directly imported into Python as
an high performance extension module without the need for writing wrappers.
""",
license="""BSD""",
... | Add trove classifier for Python 3 | Add trove classifier for Python 3
| Python | bsd-3-clause | dabeaz/bitey,dabeaz/bitey |
b11166f648c6c9c225b45fd13d57eb3124df81cc | setup.py | setup.py | from distutils.core import setup
import skyfield # to learn the version
setup(
name='skyfield',
version=skyfield.__version__,
description=skyfield.__doc__,
long_description=open('README.rst').read(),
license='MIT',
author='Brandon Rhodes',
author_email='brandon@rhodesmill.org',
url='ht... | from distutils.core import setup
import skyfield # to learn the version
setup(
name='skyfield',
version=skyfield.__version__,
description=skyfield.__doc__,
long_description=open('README.rst').read(),
license='MIT',
author='Brandon Rhodes',
author_email='brandon@rhodesmill.org',
url='ht... | Declare Python 2.7 and 3.3 compatibility | Declare Python 2.7 and 3.3 compatibility
| Python | mit | GuidoBR/python-skyfield,skyfielders/python-skyfield,ozialien/python-skyfield,skyfielders/python-skyfield,GuidoBR/python-skyfield,exoanalytic/python-skyfield,exoanalytic/python-skyfield,ozialien/python-skyfield |
19e2753f957d26883be1703a1c3098c4f858424c | setup.py | setup.py | from distutils.core import setup
import pkg_resources
import sys
requires = ['six']
if sys.version_info < (2, 7):
requires.append('argparse')
version = pkg_resources.require("fitparse")[0].version
setup(
name='fitparse',
version=version,
description='Python library to parse ANT/Garmin .FIT files',
... | # -*- coding: utf-8 -*-
import re
import sys
from distutils.core import setup
requires = ['six']
if sys.version_info < (2, 7):
requires.append('argparse')
with open('fitparse/__init__.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTIL... | Read the __version__ from the fitparse/__init__.py without importing it | Read the __version__ from the fitparse/__init__.py without importing it
It avoids having to read an extra VERSION file in the module code itself
and leaves all the ugliness in setup.py, where ugliness belongs. This
is the same technique that the requests module uses.
| Python | isc | K-Phoen/python-fitparse |
5e92c0ef714dea823e1deeef21b5141d9e0111a0 | setup.py | setup.py | from distutils.core import setup
import sys
import os
import re
PACKAGENAME = 'OpSimSummary'
packageDir = os.path.join(os.path.dirname(os.path.abspath(__file__)),
PACKAGENAME)
versionFile = os.path.join(packageDir, 'version.py')
# Obtain the package version
with open(versionFile, 'r') as f:... | from distutils.core import setup
import sys
import os
import re
PACKAGENAME = 'OpSimSummary'
packageDir = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'opsimsummary')
versionFile = os.path.join(packageDir, 'version.py')
# Obtain the package version
with open(versionFile, 'r') as... | Revert "Changed back due to problems, will fix later" | Revert "Changed back due to problems, will fix later"
This reverts commit 613dad26fdb260f586f829b00f6eb25c4b28e448.
modified: setup.py
| Python | mit | rbiswas4/simlib |
1525d327adf76a37bdbd6b0b9f63308ad55c5dbc | setup.py | setup.py | from distutils.core import setup
setup(
name='django-databrowse',
version='1.3',
packages=['django_databrowse', 'django_databrowse.plugins'],
package_dir={'django_databrowse': 'django_databrowse'},
package_data={
'django_databrowse': [
'templates/databrowse/*.html',
... | from distutils.core import setup
setup(
name='django-databrowse',
version='1.3',
packages=['django_databrowse', 'django_databrowse.plugins'],
package_dir={'django_databrowse': 'django_databrowse'},
package_data={
'django_databrowse': [
'templates/databrowse/*.html',
... | Change the pkg url to its github repo | Change the pkg url to its github repo
| Python | bsd-3-clause | Alir3z4/django-databrowse,Alir3z4/django-databrowse |
3b30dcc70cca6430594bdb3e35299252866b8577 | array/move_zeros_to_end.py | array/move_zeros_to_end.py | """
Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements.
move_zeros([false,1,0,1,2,0,1,3,"a"]) # returns[false,1,1,2,1,3,"a",0,0]
The time complexity of the below algorithm is O(n).
"""
def move_zeros(array):
if len(array) < 1:
return ar... | """
Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements.
move_zeros([false,1,0,1,2,0,1,3,"a"]) # returns[false,1,1,2,1,3,"a",0,0]
The time complexity of the below algorithm is O(n).
"""
def move_zeros(array):
result = []
zeros = 0
for i... | Change the variable name for clarity | Change the variable name for clarity | Python | mit | keon/algorithms,amaozhao/algorithms |
01d73eb5b27f82707b9819277f4d1fe6e4f07a6b | setup.py | setup.py | from distutils.core import setup
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Win32 (MS Windows)',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
'Operating System :: Microsoft :: Windows',... | from distutils.core import setup
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Win32 (MS Windows)',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
'Operating System :: Microsoft :: Windows',... | Switch to a built-in long_description so pip succeeds | Switch to a built-in long_description so pip succeeds
| Python | mit | tjguk/winshell,tjguk/winshell,tjguk/winshell |
d5e1f7d690d9f663e12cd4ee85979d10e2df04ea | test/test_get_rest.py | test/test_get_rest.py | import os
import unittest
import subprocess
import utils
TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
test_dir = utils.set_search_paths(TOPDIR)
utils.set_search_paths(TOPDIR)
from allosmod.util import check_output
class Tests(unittest.TestCase):
def test_bad(self):
"""Test wrong... | import os
import unittest
import subprocess
import utils
TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
test_dir = utils.set_search_paths(TOPDIR)
utils.set_search_paths(TOPDIR)
from allosmod.util import check_output
class Tests(unittest.TestCase):
def test_bad(self):
"""Test wrong... | Make sure that output is text in Python 2 & 3. | Make sure that output is text in Python 2 & 3.
| Python | lgpl-2.1 | salilab/allosmod-lib,salilab/allosmod-lib,salilab/allosmod-lib,salilab/allosmod-lib,salilab/allosmod-lib |
f6a713df2393d51cccbf99345f65165019608778 | setup.py | setup.py | from distutils.core import setup
setup(
name = "django-tweetar",
url = "http://github.com/adamfast/django-tweetar",
author = "Adam Fast",
author_email = "adamfast@gmail.com",
version = "0.1",
license = "BSD",
packages = ["djtweetar"],
install_requires = ['python-tweetar'],
descripti... | from distutils.core import setup
setup(
name = "django-tweetar",
url = "http://github.com/adamfast/django-tweetar",
author = "Adam Fast",
author_email = "adamfast@gmail.com",
version = "0.1",
license = "BSD",
packages = ["djtweetar", "djtweetar.runlogs"],
install_requires = ['python-twe... | Include the run logs app | Include the run logs app | Python | bsd-3-clause | adamfast/django-tweetar |
df264c490f8600c5047db328c9388c1d07d4cbd5 | setup.py | setup.py | import distutils.core
# Uploading to PyPI
# =================
# $ python setup.py register -r pypi
# $ python setup.py sdist upload -r pypi
version = '0.0'
distutils.core.setup(
name='vecrec',
version=version,
author='Kale Kundert and Alex Mitchell',
packages=['vecrec'],
url='h... | import distutils.core
# Uploading to PyPI
# =================
# $ python setup.py register -r pypi
# $ python setup.py sdist upload -r pypi
version = '0.0'
distutils.core.setup(
name='vecrec',
version=version,
author='Kale Kundert and Alex Mitchell',
url='https://github.com/kxgames/vec... | Add finalexam and coverage as dependencies. | Add finalexam and coverage as dependencies.
| Python | mit | kxgames/vecrec,kxgames/vecrec |
cb7226bbf5080e8a742f5262242a26e0a73ffd15 | setup.py | setup.py | from distutils.core import setup
setup(
name='hy-py',
version='0.0.1',
packages=['hy'],
license='MIT',
url='https://github.com/kalasjocke/hy',
long_description=open('README.md').read(),
)
| from distutils.core import setup
setup(
name='hy-py',
version='0.0.1',
packages=['hy'],
license='MIT',
author='Joakim Ekberg',
author_email='jocke.ekberg@gmail.com',
url='https://github.com/kalasjocke/hy',
long_description=open('README.md').read(),
)
| Add author to PyPI package | Add author to PyPI package
| Python | mit | kalasjocke/hyp |
7cf346794075bab025926549ee4ebe35bf188038 | Timetable.py | Timetable.py | import json
import urllib.request
import ast
# get the bus lines from the website and parse it to a list
def get_list():
url = 'http://widgets.vvo-online.de/abfahrtsmonitor/Abfahrten.do?ort=Dresden&hst=CasparDavidFriedrichStra%C3%9Fe'
response = urllib.request.urlopen(url)
data_raw = response.read()
da... | # -*- coding: utf-8 -*-
import json
from urllib2 import Request as request
import urllib2
import ast
# get the bus lines from the website and parse it to a list
def get_list(start):
# url = 'http://widgets.vvo-online.de/abfahrtsmonitor/Abfahrten.do?ort=Dresden&hst=CasparDavidFriedrichStra%C3%9Fe'
url = 'http://... | Change Python3 to Python and so use urllib2 | Change Python3 to Python and so use urllib2
| Python | apache-2.0 | NWuensche/TimetableBus |
7ebfbbc8aaf7642d0f1c99862974452289762357 | __init__.py | __init__.py | from .backends import *
from .shapes import *
from .grids import *
from .colors import *
from .solarized import *
| from .backends import *
from .colors import *
from .grids import *
from .reference_image import *
from .shapes import *
from .solarized import *
| Include reference_image, and alphabetize imports | Include reference_image, and alphabetize imports
| Python | mit | zacbir/geometer |
f0cf9d295aabeaa5ee69e47831e50f52f94a1df5 | tests/api/conftest.py | tests/api/conftest.py | import pytest
from werkzeug.datastructures import Headers
from flask import Response, json
from flask.testing import FlaskClient
import config
from skylines import create_api_app
@pytest.fixture(scope="session")
def app():
"""Set up global front-end app for functional tests
Initialized once per test-run
... | import pytest
from werkzeug.datastructures import Headers
from flask import Response, json
from flask.testing import FlaskClient
import config
from skylines import create_api_app
@pytest.fixture(scope="session")
def app():
"""Set up global front-end app for functional tests
Initialized once per test-run
... | Add support for passing json keyword arguments to request methods | tests/api: Add support for passing json keyword arguments to request methods
| Python | agpl-3.0 | Harry-R/skylines,RBE-Avionik/skylines,Turbo87/skylines,Turbo87/skylines,skylines-project/skylines,shadowoneau/skylines,shadowoneau/skylines,Turbo87/skylines,Harry-R/skylines,Harry-R/skylines,Turbo87/skylines,RBE-Avionik/skylines,RBE-Avionik/skylines,Harry-R/skylines,shadowoneau/skylines,RBE-Avionik/skylines,skylines-pr... |
8442e89d005af039252b0f8ab757bb54fa4ed71c | tests.py | tests.py | import unittest
from pollster.pollster import Pollster, Chart
class TestBasic(unittest.TestCase):
def test_basic_setup(self):
p = Pollster()
self.assertIsNotNone(p)
def test_charts(self):
c = Pollster().charts()
self.assertIsNotNone(c)
self.assertIsInstance(c, list)
... | import unittest
from pollster.pollster import Pollster, Chart
class TestBasic(unittest.TestCase):
def test_basic_setup(self):
p = Pollster()
self.assertIsNotNone(p)
def test_charts(self):
c = Pollster().charts()
self.assertIsNotNone(c)
self.assertIsInstance(c, list)
... | Update Poll test to check members. | Update Poll test to check members.
| Python | bsd-2-clause | huffpostdata/python-pollster,ternus/python-pollster |
162406757890e78ba50dc777be9f9501ce3c3414 | tests.py | tests.py | import unittest
from app import app
class TestScorepy(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
self.app.testing = True
def tearDown(self):
pass
def test_index_response(self):
response = self.app.get('/')
self.assertEqual(response.status_cod... | import unittest
from app import create_app
class TestScorepy(unittest.TestCase):
def setUp(self):
app = create_app('config.TestingConfiguration')
self.app = app.test_client()
def tearDown(self):
pass
def test_index_response(self):
response = self.app.get('/')
self.... | Fix test file for factory pattern | Fix test file for factory pattern
| Python | mit | rtfoley/scorepy,rtfoley/scorepy,rtfoley/scorepy |
548bdb45796e7e12a1c4294b49dc1ac1fb3fe647 | launch_pyslvs.py | launch_pyslvs.py | # -*- coding: utf-8 -*-
##Pyslvs - Dimensional Synthesis of Planar Four-bar Linkages in PyQt5 GUI.
##Copyright (C) 2016 Yuan Chang [daan0014119@gmail.com]
from os import _exit
if __name__=='__main__':
try:
from core.info.info import show_info, Pyslvs_Splash
args = show_info()
from PyQt5.QtWi... | # -*- coding: utf-8 -*-
##Pyslvs - Dimensional Synthesis of Planar Four-bar Linkages in PyQt5 GUI.
##Copyright (C) 2016 Yuan Chang [daan0014119@gmail.com]
from sys import exit
if __name__=='__main__':
try:
from core.info.info import show_info, Pyslvs_Splash
args = show_info()
from PyQt5.QtWi... | Change the way of exit application. | Change the way of exit application.
| Python | agpl-3.0 | 40323230/Pyslvs-PyQt5,KmolYuan/Pyslvs-PyQt5,KmolYuan/Pyslvs-PyQt5 |
2f46d5468b7eaabfb23081669e6c1c2760a1bc16 | tests.py | tests.py | from __future__ import unicode_literals
from tqdm import format_interval
def test_format_interval():
assert format_interval(60) == '01:00'
assert format_interval(6160) == '1:42:40'
assert format_interval(238113) == '66:08:33'
| from __future__ import unicode_literals
from tqdm import format_interval, format_meter
def test_format_interval():
assert format_interval(60) == '01:00'
assert format_interval(6160) == '1:42:40'
assert format_interval(238113) == '66:08:33'
def test_format_meter():
assert format_meter(231, 1000, 392)... | Test of format_meter (failed on py32) | Test of format_meter (failed on py32)
| Python | mit | lrq3000/tqdm,kmike/tqdm |
0f10d6f5ac06fcec3ef7df0688edcf3f6466301a | setup.py | setup.py | from distutils.core import setup
import sys
import os
import re
PACKAGENAME = 'OpSimSummary'
packageDir = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'opsimsummary')
versionFile = os.path.join(packageDir, 'version.py')
# Obtain the package version
with open(versionFile, 'r') as... | from distutils.core import setup
import sys
import os
import re
PACKAGENAME = 'OpSimSummary'
packageDir = os.path.join(os.path.dirname(os.path.abspath(__file__)),
PACKAGENAME)
versionFile = os.path.join(packageDir, 'version.py')
# Obtain the package version
with open(versionFile, 'r') as f:... | Revert "Revert "Changed back due to problems, will fix later"" | Revert "Revert "Changed back due to problems, will fix later""
This reverts commit 37fa1b22539dd31b8efc4c22b1ba9269822f77e1.
modified: setup.py
| Python | mit | rbiswas4/simlib |
f9393f8ae2a0552e2d23862d42ca3ddd2a6267fd | Afterscripts/H264.720p/h264-720p.py | Afterscripts/H264.720p/h264-720p.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import hyperspeed.afterscript
title = 'H264.720p'
cmd = '-vsync 0 -movflags faststart -crf 20 -minrate 0 -maxrate 4M -bufsize 15M -filter_complex "scale=1280:720,setsar=1" -pix_fmt yuv420p -vcodec libx264 -c:a aac -b:a 160k -strict -2 -ac 2 -ar 44100 ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import hyperspeed.afterscript
title = 'H264.720p'
cmd = '-vsync 0 -movflags faststart -crf 20 -minrate 0 -maxrate 4M -bufsize 15M -filter_complex "scale=1280:720:out_color_matrix=bt709,setsar=1" -pix_fmt yuv420p -vcodec libx264 -c:a aac -b:a 160k -stri... | Use 709 matrix when converting rgb to yuv | Use 709 matrix when converting rgb to yuv
| Python | apache-2.0 | bovesan/mistika-hyperspeed,bovesan/mistika-hyperspeed |
9b154aaa839bab65244dbba83244473f2932cadb | tests/test_parsing.py | tests/test_parsing.py | #!/usr/bin/env python
#encoding:utf-8
#author:dbr/Ben
#project:tvnamer
#repository:http://github.com/dbr/tvnamer
#license:Creative Commons GNU GPL v2
# http://creativecommons.org/licenses/GPL/2.0/
"""Test tvnamer's filename parser
"""
import os
import sys
import unittest
sys.path.append(os.path.join(os.path.abspath(... | #!/usr/bin/env python
#encoding:utf-8
#author:dbr/Ben
#project:tvnamer
#repository:http://github.com/dbr/tvnamer
#license:Creative Commons GNU GPL v2
# http://creativecommons.org/licenses/GPL/2.0/
"""Test tvnamer's filename parser
"""
import os
import sys
from copy import copy
import unittest
sys.path.append(os.path... | Use nose's test generator function | Use nose's test generator function | Python | unlicense | m42e/tvnamer,dbr/tvnamer,lahwaacz/tvnamer |
3aeab31830469bea9d470fc13d1906b7a755d6d3 | tests/pytasa_tests.py | tests/pytasa_tests.py | from nose.tools import *
import pytasa
def test_basic():
print "nothing to test"
| from __future__ import print_function
from nose.tools import *
import pytasa
def test_basic():
print("nothing to test")
| Print needs to be python 3 and python 2 compatible | Print needs to be python 3 and python 2 compatible
| Python | mit | alanfbaird/PyTASA |
1772eb9da2169d88c7ecad9ca21c89d4d6472e94 | tests/test_cycling.py | tests/test_cycling.py | import os
from unittest import TestCase
from tcxparser import TCXParser
class TestParseCyclingTCX(TestCase):
def setUp(self):
tcx_file = "test2.tcx"
path = os.path.join(os.path.dirname(__file__), "files", tcx_file)
self.tcx = TCXParser(path)
def test_cadence_max_is_correct(self):
... | import os
from unittest import TestCase
from tcxparser import TCXParser
class TestParseCyclingTCX(TestCase):
def setUp(self):
"""
TCX file test2.tcx was taken from the following dataset:
S. Rauter, I. Jr. Fister, I. Fister. A collection of sport activity files
for data analysis an... | Add a source of test file | Add a source of test file
| Python | bsd-2-clause | vkurup/python-tcxparser,vkurup/python-tcxparser |
b1b0919f47f43d27bc409528617af8dbd4eea41c | tests/test_imports.py | tests/test_imports.py | import unittest
class TestImport(unittest.TestCase):
# Basic import tests for packages without any.
def test_basic(self):
import bq_helper
import cleverhans
from rl.agents.dqn import DQNAgent
| import unittest
class TestImport(unittest.TestCase):
# Basic import tests for packages without any.
def test_basic(self):
import bq_helper
import cleverhans
| Remove import test for keras-rl | Remove import test for keras-rl
This package was removed in #747 | Python | apache-2.0 | Kaggle/docker-python,Kaggle/docker-python |
dd4f4beb23c1a51c913cf2a2533c72df9fdca5fe | en-2017-06-25-consuming-and-publishing-celery-tasks-in-cpp-via-amqp/python/hello.py | en-2017-06-25-consuming-and-publishing-celery-tasks-in-cpp-via-amqp/python/hello.py | #
# Sends a request to call hello() from within a worker.
#
import sys
from tasks import hello
if __name__ == '__main__':
if len(sys.argv) != 3:
print('usage: {} NAME AGE'.format(sys.argv[0]))
sys.exit(1)
# By calling hello.delay(), we request hello() to be executed in a worker
# rather ... | #
# Sends a request to call hello() from within a worker.
#
import sys
from tasks import hello
if __name__ == '__main__':
if len(sys.argv) != 3:
print('usage: {} NAME AGE'.format(sys.argv[0]))
sys.exit(1)
# By calling hello.delay(), we request hello() to be executed in a worker
# rather ... | Fix the phrasing in a comment. | en-2017-06-25: Fix the phrasing in a comment.
| Python | bsd-3-clause | s3rvac/blog,s3rvac/blog,s3rvac/blog,s3rvac/blog |
67ab2070206fc1313e1f83948b6c29565c189861 | test/features/test_create_pages.py | test/features/test_create_pages.py | import time
import unittest
from hamcrest import *
from splinter import Browser
from support.stub_server import HttpStub
class test_create_pages(unittest.TestCase):
def setUp(self):
HttpStub.start()
time.sleep(2)
def tearDown(self):
HttpStub.stop()
def test_about_page(self):
... | import time
import unittest
from hamcrest import *
from splinter import Browser
from support.stub_server import HttpStub
class test_create_pages(unittest.TestCase):
def setUp(self):
HttpStub.start()
time.sleep(2)
def tearDown(self):
HttpStub.stop()
def test_about_page(self):
... | Use phantomjs instead of a real browser | Use phantomjs instead of a real browser
| Python | mit | alphagov/transactions-explorer,gds-attic/transactions-explorer,gds-attic/transactions-explorer,alphagov/transactions-explorer,gds-attic/transactions-explorer,gds-attic/transactions-explorer,alphagov/transactions-explorer,gds-attic/transactions-explorer,alphagov/transactions-explorer,alphagov/transactions-explorer |
ae89d5de1a9d248951bed0b992500121860c47d4 | tvsort_sl/messages.py | tvsort_sl/messages.py | import os
from sendgrid import sendgrid, Email
from sendgrid.helpers.mail import Content, Mail, MailSettings, SandBoxMode
def send_email(subject, content):
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
from_email = Email(name='TV sort', email='tvsortsl@gmail.com')
to_email = ... | import os
from sendgrid import sendgrid, Email
from sendgrid.helpers.mail import Content, Mail, MailSettings, SandBoxMode
def send_email(subject, content):
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
from_email = Email(name='TV sort', email='tvsortsl@gmail.com')
to_email = ... | Add debug prints to send_email | Add debug prints to send_email
| Python | mit | shlomiLan/tvsort_sl |
a0211fa99dfb0647bf78ce672ebb3a778f6fb6b7 | flaskext/lesscss.py | flaskext/lesscss.py | # -*- coding: utf-8 -*-
"""
flaskext.lesscss
~~~~~~~~~~~~~
A small Flask extension that makes it easy to use LessCSS with your Flask
application.
:copyright: (c) 2010 by Steve Losh.
:license: MIT, see LICENSE for more details.
"""
import os, subprocess
def lesscss(app):
@app.before_reque... | # -*- coding: utf-8 -*-
"""
flaskext.lesscss
~~~~~~~~~~~~~
A small Flask extension that makes it easy to use LessCSS with your Flask
application.
:copyright: (c) 2010 by Steve Losh.
:license: MIT, see LICENSE for more details.
"""
import os, subprocess
def lesscss(app):
@app.before_reque... | Fix errors when the css files do not exist. | Fix errors when the css files do not exist.
| Python | mit | bpollack/flask-lesscss,fitoria/flask-lesscss,b4oshany/flask-lesscss,fitoria/flask-lesscss,sjl/flask-lesscss |
26e0a0ce2cb8b907ca7ea7ad098c644c2213fa1b | usb/tests/test_api.py | usb/tests/test_api.py | import json
from unittest import TestCase
from usb import create_application
from usb.models import db
class APITestCase(TestCase):
def setUp(self):
self.app = create_application('config/test.py')
self.client = self.app.test_client()
db.app = self.app
db.create_all()
def te... | import json
from unittest import TestCase
from usb import create_application
from usb.models import db
class APITestCase(TestCase):
def setUp(self):
self.app = create_application('config/test.py')
self.client = self.app.test_client()
db.app = self.app
db.create_all()
def te... | Test content type for JSON API | Test content type for JSON API
| Python | mit | dizpers/usb |
49724932966fc509b202a80b6dcb9b309f0135a7 | flexget/__init__.py | flexget/__init__.py | #!/usr/bin/python
from __future__ import unicode_literals, division, absolute_import
import logging
import os
from flexget import logger, plugin
from flexget.manager import Manager
from flexget.options import get_parser
__version__ = '{git}'
log = logging.getLogger('main')
def main(args=None):
"""Main entry ... | #!/usr/bin/python
from __future__ import unicode_literals, division, absolute_import
__version__ = '{git}'
import logging
import os
from flexget import logger, plugin
from flexget.manager import Manager
from flexget.options import get_parser
log = logging.getLogger('main')
def main(args=None):
"""Main entry p... | Move __version__ declaration before imports | Move __version__ declaration before imports
| Python | mit | lildadou/Flexget,oxc/Flexget,JorisDeRieck/Flexget,tsnoam/Flexget,malkavi/Flexget,oxc/Flexget,crawln45/Flexget,tsnoam/Flexget,grrr2/Flexget,sean797/Flexget,dsemi/Flexget,drwyrm/Flexget,jawilson/Flexget,malkavi/Flexget,malkavi/Flexget,v17al/Flexget,jawilson/Flexget,drwyrm/Flexget,patsissons/Flexget,antivirtel/Flexget,tar... |
0aa97f39cdc91820385cdda4741802d09c30aa37 | src/lib/pipeline_tools.py | src/lib/pipeline_tools.py | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Fix a debug line in a test lib | Fix a debug line in a test lib
| Python | apache-2.0 | GoogleCloudPlatform/covid-19-open-data,GoogleCloudPlatform/covid-19-open-data |
4364ffc7efd69a0d85dab6cb2c0efd1d2f4bf612 | get_sonos_ip.py | get_sonos_ip.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: Benjamin Preisig
import soco
import re
zone_list = list(soco.discover())
for zone in zone_list:
print u"Player: {0} at IP: {1}".format(zone.player_name, zone) | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: Benjamin Preisig
import soco
import re
import codecs
zone_list = list(soco.discover())
with codecs.open('discovered.csv', "w", "utf-8-sig") as the_file:
for zone in zone_list:
print u"Player: {0} at IP: {1}".format(zone.player_name, zone)
... | Write Zone Information to File | Write Zone Information to File
| Python | mit | prebm/SonosRemote,prebm/SonosRemote |
85d3b1203d9861f986356e593a2b79d96c38c1b3 | utils/aiohttp_wrap.py | utils/aiohttp_wrap.py | #!/bin/env python
import aiohttp
async def aio_get_text(url, headers=None):
async with aiohttp.ClientSession() as session:
async with session.get(url, headers=headers) as r:
if r.status == 200:
return r.text()
else:
return None
async def aio_get_js... | #!/bin/env python
import aiohttp
async def aio_get(url: str):
async with aiohttp.ClientSession() as session:
<<<<<<< HEAD
async with session.get(url, headers=headers) as r:
if r.status == 200:
return r.text()
else:
return None
async def aio_get_jso... | Revert "progress on DDG cog & aiohttp wrapper" | Revert "progress on DDG cog & aiohttp wrapper"
This reverts commit 6b6d243e96bd13583e7f02dfe6669578d238a594.
| Python | mit | Naught0/qtbot |
04f4c11ff52069475a3818de74b4cd89695cfa2c | scrapi/harvesters/tdar/__init__.py | scrapi/harvesters/tdar/__init__.py | """
Harvester for the The Digital Archaeological Record (tDAR) for the SHARE project
More information at https://github.com/CenterForOpenScience/SHARE/blob/master/providers/org.tdar.md
Example API call: http://core.tdar.org/oai-pmh/oai?verb=ListRecords&metadataPrefix=oai_dc&from=2014-10-05
"""
from __future__ impor... | """
Harvester for the The Digital Archaeological Record (tDAR) for the SHARE project
More information at https://github.com/CenterForOpenScience/SHARE/blob/master/providers/org.tdar.md
Example API call: http://core.tdar.org/oai-pmh/oai?verb=ListRecords&metadataPrefix=oai_dc&from=2014-10-05
"""
from __future__ impor... | Update tdar harvester with custom url gatheriing | Update tdar harvester with custom url gatheriing
| Python | apache-2.0 | icereval/scrapi,ostwald/scrapi,mehanig/scrapi,CenterForOpenScience/scrapi,erinspace/scrapi,erinspace/scrapi,fabianvf/scrapi,CenterForOpenScience/scrapi,alexgarciac/scrapi,mehanig/scrapi,felliott/scrapi,fabianvf/scrapi,felliott/scrapi,jeffreyliu3230/scrapi |
0b0664536056c755befae4c5aaa83f100f76e8e8 | apps/actors/models.py | apps/actors/models.py | from django.utils.translation import ugettext_lazy as _
from django.db import models
from django.db.models import DateTimeField, BooleanField, OneToOneField
from agenda.models import Calendar
class Actor(models.Model):
"""
An actor is an entity playing a role in your system. It can be anything that
belon... | from django.utils.translation import ugettext_lazy as _
from django.db import models
from django.db.models import DateTimeField, BooleanField, OneToOneField
from agenda.models import Calendar
class Actor(models.Model):
"""
An actor is an entity playing a role in your system. It can be anything that
belon... | Make calendar not editbale for actors | Make calendar not editbale for actors
| Python | agpl-3.0 | SpreadBand/SpreadBand,SpreadBand/SpreadBand |
0f3704a73ec54f015bff9a391d3a6dabc34368cd | palette/core/palette_selection.py | palette/core/palette_selection.py | # -*- coding: utf-8 -*-
## @package palette.core.palette_selection
#
# Implementation of automatic color palette selection.
# @author tody
# @date 2015/08/20
| # -*- coding: utf-8 -*-
## @package palette.core.palette_selection
#
# Implementation of automatic color palette selection.
# @author tody
# @date 2015/08/20
import os
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import matplotlib.animation as animation
impo... | Add initial plaette selection code. | Add initial plaette selection code.
| Python | mit | tody411/PaletteSelection |
f7e80d42ce10e07eac45dad9ccced5818cee56fe | examples/terminal_mongo_example.py | examples/terminal_mongo_example.py | from chatterbot import ChatBot
from chatterbot.filters import LanguageFilter
import logging
# Uncomment the following line to enable verbose logging
# logging.basicConfig(level=logging.INFO)
# Create a new ChatBot instance
bot = ChatBot("Terminal",
storage_adapter="chatterbot.adapters.storage.MongoDatabaseAdapte... | from chatterbot import ChatBot
from chatterbot.filters import LanguageFilter, RepetitiveResponseFilter
import logging
# Uncomment the following line to enable verbose logging
# logging.basicConfig(level=logging.INFO)
# Create a new ChatBot instance
bot = ChatBot("Terminal",
storage_adapter="chatterbot.adapters.s... | Add filters to the Mongo DB example. | Add filters to the Mongo DB example.
| Python | bsd-3-clause | vkosuri/ChatterBot,maclogan/VirtualPenPal,Reinaesaya/OUIRL-ChatBot,davizucon/ChatterBot,gunthercox/ChatterBot,Gustavo6046/ChatterBot,Reinaesaya/OUIRL-ChatBot |
e09894b92823392891fd0dddb63fd30bfd5bdc2a | pyclient/integtest.py | pyclient/integtest.py | #!/usr/bin/python
from lockd import LockdClient
lockd_client = LockdClient()
# Lock
assert lockd_client.lock("foo")
# Dup lock should fail
assert not lockd_client.lock("foo")
# Lock another entry should work
assert lockd_client.lock("bar")
# Unlock entries
assert lockd_client.unlock("foo")
assert lockd_client.unl... | #!/usr/bin/python
from lockd import LockdClient
lockd_client = LockdClient()
# Initial state
assert not lockd_client.is_locked("foo")
assert not lockd_client.is_locked("bar")
# Lock
assert lockd_client.lock("foo")
assert lockd_client.is_locked("foo")
# Dup lock should fail
assert not lockd_client.lock("foo")
asser... | Add is_locked calls to integration test | Add is_locked calls to integration test
| Python | mit | divtxt/lockd,divtxt/lockd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.