commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
ae77a37cf7e8d0b8d32c7da7fafb532f5f971737 | support for seq_width==4 | MarcoVogt/basil,SiLab-Bonn/basil,SiLab-Bonn/basil | host/pydaq/RL/TrackRegister.py | host/pydaq/RL/TrackRegister.py | #
# ------------------------------------------------------------
# Copyright (c) SILAB , Physics Institute of Bonn University
# ------------------------------------------------------------
#
# SVN revision information:
# $Rev:: $:
# $Author:: $:
# $Date:: ... | #
# ------------------------------------------------------------
# Copyright (c) SILAB , Physics Institute of Bonn University
# ------------------------------------------------------------
#
# SVN revision information:
# $Rev:: $:
# $Author:: $:
# $Date:: ... | bsd-3-clause | Python |
6328de01c3953a70a4e6b4c387b3295d3fc7ffc1 | Complete Task | GeeksMadeThis/gmt | GuessRuleBook.py | GuessRuleBook.py | import random
class GuessBoard:
def __init__(self, min, max, target):
self.min = min
self.max = max
self.target = target
class GuessRuleBook:
def GetNewBoard():
min = 1
max = 6
if not isinstance(min, int): raise ValueError(f"The minimum value must be a whole ... | import random
class GuessBoard:
def __init__(self, min, max, target):
self.min = min
self.max = max
self.target = target
class GuessRuleBook:
def GetNewBoard():
min = 1
max = 6
if not isinstance(min, int): raise ValueError(f"min must be a whole number: {min}")... | mit | Python |
77cbb0361f70ae2c4debeb76b199f59a9e0abb48 | Fix any_match() and allow for passing kwargs through run() or quickrun(). | knipknap/exscript,maximumG/exscript,knipknap/exscript,maximumG/exscript | src/Exscript/util.py | src/Exscript/util.py | # Copyright (C) 2007 Samuel Abels, http://debain.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOU... | # Copyright (C) 2007 Samuel Abels, http://debain.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOU... | mit | Python |
ebdba8915386752d998053a938f39abf51643388 | Update logpm.py | TingPing/plugins,TingPing/plugins | HexChat/logpm.py | HexChat/logpm.py | import hexchat
__module_name__ = "LogPMs"
__module_author__ = "TingPing"
__module_version__ = "1"
__module_description__ = "Auto log pm's"
def open_cb(word, word_eol, userdata):
chan = hexchat.get_info('channel')
# Assume nick if not prefixed with #
# Use existing pref for nicks I usually ignore (i.e. chanserv)
i... | import hexchat
__module_name__ = "LogPMs"
__module_author__ = "TingPing"
__module_version__ = "1"
__module_description__ = "Auto log pm's"
def open_cb(word, word_eol, userdata):
chan = hexchat.get_info('channel')
# Assume nick if not prefixed with #
# Use existing pre for nicks I usually ignore (i.e. chanserv)
if... | mit | Python |
d5239467468fbc07f14daeeaed99c7a9b6cb295d | add filterUtils.hasNanPoints | patmarion/director,mitdrc/director,empireryan/director,rdeits/director,mitdrc/director,RussTedrake/director,mitdrc/director,gizatt/director,manuelli/director,openhumanoids/director,patmarion/director,empireryan/director,mitdrc/director,manuelli/director,manuelli/director,mithrandir123/director,patmarion/director,gizatt... | src/python/ddapp/filterUtils.py | src/python/ddapp/filterUtils.py | ''' Convienence methods on VTK routines only '''
import ddapp.vtkAll as vtk
import ddapp.vtkNumpy as vnp
from ddapp.shallowCopy import shallowCopy
import numpy as np
def thresholdPoints(polyData, arrayName, thresholdRange):
assert(polyData.GetPointData().GetArray(arrayName))
f = vtk.vtkThresholdPoints()
... | ''' Convienence methods on VTK routines only '''
import ddapp.vtkAll as vtk
import ddapp.vtkNumpy as vnp
from ddapp.shallowCopy import shallowCopy
import numpy as np
def thresholdPoints(polyData, arrayName, thresholdRange):
assert(polyData.GetPointData().GetArray(arrayName))
f = vtk.vtkThresholdPoints()
... | bsd-3-clause | Python |
493289f3f00c245f461bdd569b380f06135ca2c9 | fix import in tardis/base.py | kaushik94/tardis,kaushik94/tardis,kaushik94/tardis,kaushik94/tardis | tardis/base.py | tardis/base.py | # functions that are important for the general usage of TARDIS
def run_tardis(config, atom_data=None):
"""
This function is one of the core functions to run TARDIS from a given
config object.
It will return a model object containing
Parameters
----------
config: ~str or ~dict
fil... | # functions that are important for the general usage of TARDIS
def run_tardis(config, atom_data=None):
"""
This function is one of the core functions to run TARDIS from a given
config object.
It will return a model object containing
Parameters
----------
config: ~str or ~dict
fil... | bsd-3-clause | Python |
5b0b967b6093d9588f1f8738d05aa322bb316077 | Remove duplicate code from run_tardis | kaushik94/tardis,Tobychev/tardis,kaushik94/tardis,orbitfold/tardis,kaushik94/tardis,orbitfold/tardis,orbitfold/tardis,kaushik94/tardis,Tobychev/tardis,orbitfold/tardis,Tobychev/tardis | tardis/base.py | tardis/base.py | # functions that are important for the general usage of TARDIS
def run_tardis(config, atom_data=None):
"""
This function is one of the core functions to run TARDIS from a given
config object.
It will return a model object containing
Parameters
----------
config: ~str or ~dict
fil... | #functions that are important for the general usage of TARDIS
def run_tardis(config, atom_data=None):
"""
This function is one of the core functions to run TARDIS from a given
config object.
It will return a model object containing
Parameters
----------
config: ~str or ~dict
file... | bsd-3-clause | Python |
01d3c596462e9911e1b20d9cd06a5c78ffe10d08 | Update example to use preferred search criteria style | bechtoldt/imapclient,bechtoldt/imapclient | imapclient/examples/example.py | imapclient/examples/example.py | # Copyright (c) 2014, Menno Smits
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
from __future__ import unicode_literals
from imapclient import IMAPClient
HOST = 'imap.host.com'
USERNAME = 'someuser'
PASSWORD = 'secret'
ssl = False
server = IMAPClient(HOST, use_uid=... | # Copyright (c) 2014, Menno Smits
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
from __future__ import unicode_literals
from imapclient import IMAPClient
HOST = 'imap.host.com'
USERNAME = 'someuser'
PASSWORD = 'secret'
ssl = False
server = IMAPClient(HOST, use_uid=... | bsd-3-clause | Python |
fd651c3448b623a76cb8a2c4405472baa3f4c6bc | Fix formatting | akhilaananthram/nupic,go-bears/nupic,scottpurdy/nupic,rcrowder/nupic,pap/nupic,neuroidss/nupic,go-bears/nupic,blueburningcoder/nupic,allanino/nupic,fergalbyrne/nupic,BeiLuoShiMen/nupic,badlogicmanpreet/nupic,rcrowder/nupic,jcasner/nupic,runt18/nupic,SaganBolliger/nupic,loretoparisi/nupic,metaml/nupic,vitaly-krugl/nupic... | tests/unit/py2/regions/image_sensor_test.py | tests/unit/py2/regions/image_sensor_test.py | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2014, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2014, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | agpl-3.0 | Python |
f1185872dfef9250d6cb48c82c36ed63b1e68dc3 | remove intentionally failing test | gjvis/splinter,cobrateam/splinter,cobrateam/splinter,cobrateam/splinter,bubenkoff/splinter,nikolas/splinter,gjvis/splinter,bubenkoff/splinter,lrowe/splinter,underdogio/splinter,bmcculley/splinter,nikolas/splinter,lrowe/splinter,objarni/splinter,underdogio/splinter,objarni/splinter,nikolas/splinter,myself659/splinter,bm... | tests/test_webdriver_phantomjs.py | tests/test_webdriver_phantomjs.py | try:
import unittest2 as unittest
except ImportError:
import unittest
from splinter import Browser
from fake_webapp import EXAMPLE_APP
from base import WebDriverTests
class PhantomJSBrowserTest(WebDriverTests, unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.browser = Browser("phanto... | try:
import unittest2 as unittest
except ImportError:
import unittest
from splinter import Browser
from fake_webapp import EXAMPLE_APP
from base import WebDriverTests
class PhantomJSBrowserTest(WebDriverTests, unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.browser = Browser("phanto... | bsd-3-clause | Python |
885c285417c5e0586f66581ca067db4fd3dcc703 | add signals (#24) | FocusedSupport/thedoorman,FocusedSupport/thedoorman | thedoorman/components/dispatcher/signals.py | thedoorman/components/dispatcher/signals.py |
class Signals(object):
DOORBELL = "doorbell"
PICTURE = "picture"
PICTURE_REQUEST = "picture_request"
SLACK_MESSAGE = "slackmessage"
UNLOCK = "unlock"
UNLOCK_HISTORY = "unlock_history"
UNLOCKED = "unlocked"
LOCKED = "locked"
CLEANUP = "cleanup"
EXIT = "exit"
AUDIO_REQUEST = ... |
class Signals(object):
DOORBELL = "doorbell"
PICTURE = "picture"
PICTURE_REQUEST = "picture_request"
SLACK_MESSAGE = "slackmessage"
UNLOCK = "unlock"
UNLOCK_HISTORY = "unlock_history"
UNLOCKED = "unlocked"
LOCKED = "locked"
CLEANUP = "cleanup"
EXIT = "exit"
class Senders(obje... | mit | Python |
5b7789d519be7251c58b68879f013d5f3bf0c950 | Make stack-size test run correctly and reliable on uPy. | mhoffma/micropython,HenrikSolver/micropython,ryannathans/micropython,dmazzella/micropython,mhoffma/micropython,PappaPeppar/micropython,MrSurly/micropython,tuc-osg/micropython,oopy/micropython,oopy/micropython,SHA2017-badge/micropython-esp32,AriZuu/micropython,toolmacher/micropython,redbear/micropython,mhoffma/micropyth... | tests/thread/thread_stacksize1.py | tests/thread/thread_stacksize1.py | # test setting the thread stack size
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
import sys
import _thread
# different implementations have different minimum sizes
if sys.implementation.name == 'micropython':
sz = 2 * 1024
else:
sz = 32 * 1024
def foo():
pass
def thread_e... | # test setting the thread stack size
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
import sys
import _thread
# different implementations have different minimum sizes
if sys.implementation == 'micropython':
sz = 2 * 1024
else:
sz = 32 * 1024
def foo():
pass
def thread_entry(... | mit | Python |
c6c119201c73f56280eba1b4fdad005b4f713380 | correct register command - add spaces to sum up dialog; | Syncano/syncano-cli,Syncano/syncano-cli,Syncano/syncano-cli | syncano_cli/account/commands.py | syncano_cli/account/commands.py | import click
from syncano_cli.account.command import AccountCommands
from syncano_cli.config import ACCOUNT_CONFIG_PATH
@click.group()
def top_account():
pass
@top_account.group()
@click.pass_context
@click.option('--config', help=u'Account configuration file.')
def accounts(ctx, config):
"""Handle Syncano ... | import click
from syncano_cli.account.command import AccountCommands
from syncano_cli.config import ACCOUNT_CONFIG_PATH
@click.group()
def top_account():
pass
@top_account.group()
@click.pass_context
@click.option('--config', help=u'Account configuration file.')
def accounts(ctx, config):
"""Handle Syncano ... | mit | Python |
b9addbab81876ae4a1003faea874b0a8a21bfb6b | Update an example test | mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase | examples/parameterized_test.py | examples/parameterized_test.py | from seleniumbase import BaseCase
from parameterized import parameterized
class GoogleTests(BaseCase):
@parameterized.expand(
[
["PyPI", "pypi.org", 'img[alt="PyPI"]'],
["Wikipedia", "wikipedia.org", "img.central-featured-logo"],
["SeleniumBase", "seleniumbase/SeleniumB... | from seleniumbase import BaseCase
from parameterized import parameterized
class GoogleTests(BaseCase):
@parameterized.expand(
[
["PyPI", "pypi.org", 'img[alt="PyPI"]'],
["Wikipedia", "wikipedia.org", "div#p-logo"],
["SeleniumBase", "seleniumbase/SeleniumBase", 'img[titl... | mit | Python |
45249d022abcde45efd6227ca987408eb8d780fa | remove blanks | compas-dev/compas | tests/utilities/test_functions.py | tests/utilities/test_functions.py | import pytest
from compas.utilities import binomial
@pytest.mark.parametrize(("n", "k", "result"),
[
pytest.param(3, 1, 3),
pytest.param(21, 10, 352716),
pytest.param(10, 0, 1),
pytest.param(0, 0, 1),
pytest.param(1, 2, 0, marks=pytest.mark.xfail(raises=ValueError)),
pytest.param(2, -1, 0, marks=pytest.mark.x... | import pytest
from compas.utilities import binomial
@pytest.mark.parametrize(("n", "k", "result"),
[
pytest.param(3, 1, 3),
pytest.param(21, 10, 352716),
pytest.param(10, 0, 1),
pytest.param(0, 0, 1),
pytest.param(1, 2, 0, marks=pytest.mark.xfail(raises=ValueError)),
pytest.param(2, -1, 0, marks=pytest.mark.x... | mit | Python |
c0e0b5e14f606331572c0fb3764e0db5744ca710 | Fix incorrect APIException uses in avatarfield (#8794) | beeftornado/sentry,ifduyue/sentry,mvaled/sentry,mvaled/sentry,ifduyue/sentry,mvaled/sentry,ifduyue/sentry,looker/sentry,mvaled/sentry,mvaled/sentry,mvaled/sentry,beeftornado/sentry,looker/sentry,ifduyue/sentry,ifduyue/sentry,looker/sentry,looker/sentry,beeftornado/sentry,looker/sentry | src/sentry/api/fields/avatar.py | src/sentry/api/fields/avatar.py | from __future__ import absolute_import
from base64 import b64decode
from django.conf import settings
from rest_framework import serializers
from rest_framework.exceptions import APIException
from PIL import Image
from six import BytesIO
MIN_DIMENSION = 256
MAX_DIMENSION = 1024
class ImageTooLarge(APIException):
... | from __future__ import absolute_import
from base64 import b64decode
from django.conf import settings
from rest_framework import serializers
from rest_framework.exceptions import APIException
from PIL import Image
from six import BytesIO
MIN_DIMENSION = 256
MAX_DIMENSION = 1024
class AvatarField(serializers.Writabl... | bsd-3-clause | Python |
87bf2468d4e4b29afae0e005b9dbffb4a964d9d1 | Make modules uninstallable | OCA/operating-unit,OCA/operating-unit | crm_operating_unit/__openerp__.py | crm_operating_unit/__openerp__.py | # -*- coding: utf-8 -*-
# © 2015 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": "Operating Unit in CRM",
"version": "9.0.1.0.0",
"author"... | # -*- coding: utf-8 -*-
# © 2015 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": "Operating Unit in CRM",
"version": "9.0.1.0.0",
"author"... | agpl-3.0 | Python |
0b4bc26668d8311f0f04b05bea8aab078855a560 | Add redirects for wazimap | Code4SA/redirects | code4sa/middleware.py | code4sa/middleware.py | from django.http import HttpResponse, HttpResponsePermanentRedirect, Http404
import newrelic.agent
class RedirectsMiddleware(object):
redirects = {
# domain (without www.) -> full new URL
'living-wage.code4sa.org': 'http://livingwage.code4sa.org/',
'livingwagestory.code4sa.org': 'http://l... | from django.http import HttpResponse, HttpResponsePermanentRedirect, Http404
import newrelic.agent
class RedirectsMiddleware(object):
redirects = {
# domain (without www.) -> full new URL
'living-wage.code4sa.org': 'http://livingwage.code4sa.org/',
'livingwagestory.code4sa.org': 'http://l... | mit | Python |
7a04cbd3fa90e186ea4fea92c946a9498ddeea32 | add dylan and andy's email to ADMINS | OpenDataPolicingNC/Traffic-Stops,OpenDataPolicingNC/Traffic-Stops,OpenDataPolicingNC/Traffic-Stops,OpenDataPolicingNC/Traffic-Stops | traffic_stops/settings/staging.py | traffic_stops/settings/staging.py | from traffic_stops.settings.base import *
os.environ.setdefault('CACHE_HOST', '127.0.0.1:11211')
os.environ.setdefault('BROKER_HOST', '127.0.0.1:5672')
DEBUG = False
TEMPLATE_DEBUG = DEBUG
DATABASES['default']['NAME'] = 'traffic_stops_staging'
DATABASES['default']['USER'] = 'traffic_stops_staging'
DATABASES['default... | from traffic_stops.settings.base import *
os.environ.setdefault('CACHE_HOST', '127.0.0.1:11211')
os.environ.setdefault('BROKER_HOST', '127.0.0.1:5672')
DEBUG = False
TEMPLATE_DEBUG = DEBUG
DATABASES['default']['NAME'] = 'traffic_stops_staging'
DATABASES['default']['USER'] = 'traffic_stops_staging'
DATABASES['default... | mit | Python |
6c447422413a8a3e4483d10b4f77e70df426a3ae | Bump LXDUI version | AdaptiveScale/lxdui,AdaptiveScale/lxdui,AdaptiveScale/lxdui,AdaptiveScale/lxdui | app/__metadata__.py | app/__metadata__.py | APP_NAME = 'LXDUI'
APP_CLI_CMD = 'lxdui'
VERSION = '2.2'
GIT_URL = 'https://github.com/AdaptiveScale/lxdui.git'
LXD_URL = 'http://localhost:8443'
LICENSE = 'Apache 2.0'
AUTHOR = 'AdaptiveScale, Inc.'
AUTHOR_URL = 'http://www.adaptivescale.com'
AUTHOR_EMAIL = 'info@adaptivescale.com'
KEYWORDS = 'lxc lxc-containers lxd'
... | APP_NAME = 'LXDUI'
APP_CLI_CMD = 'lxdui'
VERSION = '2.1.2'
GIT_URL = 'https://github.com/AdaptiveScale/lxdui.git'
LXD_URL = 'http://localhost:8443'
LICENSE = 'Apache 2.0'
AUTHOR = 'AdaptiveScale, Inc.'
AUTHOR_URL = 'http://www.adaptivescale.com'
AUTHOR_EMAIL = 'info@adaptivescale.com'
KEYWORDS = 'lxc lxc-containers lxd... | apache-2.0 | Python |
c8de978088ec20d15da0388da0dceb6663f6dd4d | Apply Deque in palindrome checker solution | andela-kerinoso/data_structures_algo | app/applications.py | app/applications.py | from . import data_structures
# 1. Stack application
def balanced_parentheses_checker(symbol_string):
"""Verify that a set of parentheses is balanced."""
opening_symbols = '{[('
closing_symbols = '}])'
opening_symbols_stack = data_structures.Stack()
symbol_count = len(symbol_string)
counter ... | from . import data_structures
# 1. Stack application
def balanced_parentheses_checker(symbol_string):
"""Verify that a set of parentheses is balanced."""
opening_symbols = '{[('
closing_symbols = '}])'
opening_symbols_stack = data_structures.Stack()
symbol_count = len(symbol_string)
counter ... | mit | Python |
65d2de3680a709ac28cf0de7e58487b9ae9ba04c | Fix bug about get_field in sequencecolumn | arambadk/django-datatable,shymonk/django-datatable,shymonk/django-datatable,shymonk/django-datatable,arambadk/django-datatable,arambadk/django-datatable | table/columns/sequencecolumn.py | table/columns/sequencecolumn.py | #!/usr/bin/env python
# coding: utf-8
from .base import Column
class SequenceColumn(Column):
def __init__(self, field, headers, **kwargs):
self.headers = headers
self.kwargs = kwargs
super(SequenceColumn, self).__init__(field, **kwargs)
@property
def columns(self):
return ... | #!/usr/bin/env python
# coding: utf-8
from .base import Column
class SequenceColumn(Column):
def __init__(self, field, headers, **kwargs):
self.headers = headers
self.kwargs = kwargs
super(SequenceColumn, self).__init__(field, **kwargs)
@property
def columns(self):
return ... | mit | Python |
7a68eaf67ce57be832e37922c52f1b8bc73a5e69 | Fix networkx 1.11 compatibility issue | pvtodorov/indra,bgyori/indra,sorgerlab/indra,pvtodorov/indra,pvtodorov/indra,sorgerlab/belpy,johnbachman/belpy,sorgerlab/indra,sorgerlab/belpy,bgyori/indra,johnbachman/indra,johnbachman/belpy,pvtodorov/indra,johnbachman/indra,johnbachman/belpy,johnbachman/indra,sorgerlab/indra,bgyori/indra,sorgerlab/belpy | indra/tests/test_kappa_util.py | indra/tests/test_kappa_util.py | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import json
from os import path
from indra.util.kappa_util import im_json_to_graph
def test_kappy_influence_json_to_graph():
with open(path.join(path.dirname(path.abspath(__file__)),
'ka... | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import json
from os import path
from indra.util.kappa_util import im_json_to_graph
def test_kappy_influence_json_to_graph():
with open(path.join(path.dirname(path.abspath(__file__)),
'ka... | bsd-2-clause | Python |
ec9b1f0ebda55e3e02e597e10ac28d62286b922f | Fix import issue due to name changes | simpeg/simpeg | SimPEG/EM/NSEM/Utils/__init__.py | SimPEG/EM/NSEM/Utils/__init__.py | """ module SimPEG.EM.NSEM.Utils
Collection of utilities that are usefull for the NSEM problem
NOTE: These utilities are not well test, use with care
"""
from __future__ import absolute_import
from .MT1Dsolutions import get1DEfields # Add the names of the functions
from .MT1Danalytic import getEHfields, getImpedanc... | """ module SimPEG.EM.NSEM.Utils
Collection of utilities that are usefull for the NSEM problem
NOTE: These utilities are not well test, use with care
"""
from __future__ import absolute_import
from .MT1Dsolutions import get1DEfields # Add the names of the functions
from .MT1Danalytic import getEHfields, getImpedanc... | mit | Python |
8f5d390fc89dfc99f0bd930a0757957d2eaa8d30 | Add EE to java parser. | alnorth/stackdoc,alnorth/stackdoc,alnorth/stackdoc | update-database/stackdoc/namespaces/java.py | update-database/stackdoc/namespaces/java.py | import re
import urllib
############### Functions called by stackdoc
def get_version():
return 1
def get_ids(title, body, tags):
ids = []
if "http://java.sun.com/" in body or "http://docs.oracle.com/":
urls = re.findall(r'<a href="([^"]+)"', body)
for url in urls:
m = re.matc... | import re
import urllib
############### Functions called by stackdoc
def get_version():
return 1
def get_ids(title, body, tags):
ids = []
if "http://java.sun.com/" in body or "http://docs.oracle.com/":
urls = re.findall(r'<a href="([^"]+)"', body)
for url in urls:
m = re.matc... | bsd-3-clause | Python |
44432a189abdb01ad8d8646c81352b715532ac25 | Fix a lost debug string | kcsry/infokala,kcsry/infokala | infokala_test_site/settings.py | infokala_test_site/settings.py | import os
def mkpath(*parts):
return os.path.abspath(os.path.join(os.path.dirname(__file__), '..', *parts))
BASE_DIR = mkpath()
SECRET_KEY = '6g*1v8@jh5dohgl6%n+9l9%k9g3__9#5@7bptzawuis-4*git#'
DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'djan... | import os
def mkpath(*parts):
return os.path.abspath(os.path.join(os.path.dirname(__file__), '..', *parts))
BASE_DIR = mkpath()
SECRET_KEY = '6g*1v8@jh5dohgl6%n+9l9%k9g3__9#5@7bptzawuis-4*git#'
DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'djan... | mit | Python |
3a470c02a1a171f876200258897d6e277a1aab91 | Stop using the undocumented get_all_related_objects_with_model API | goodtune/vitriolic,goodtune/vitriolic,goodtune/vitriolic,goodtune/vitriolic | tournamentcontrol/competition/signals/__init__.py | tournamentcontrol/competition/signals/__init__.py | from django.db import models
from tournamentcontrol.competition.signals.custom import match_forfeit # noqa
from tournamentcontrol.competition.signals.ladders import ( # noqa
changed_points_formula,
scale_ladder_entry,
team_ladder_entry_aggregation,
)
from tournamentcontrol.competition.signals.matches imp... | from django.db import models
from tournamentcontrol.competition.signals.custom import match_forfeit # noqa
from tournamentcontrol.competition.signals.ladders import ( # noqa
changed_points_formula,
scale_ladder_entry,
team_ladder_entry_aggregation,
)
from tournamentcontrol.competition.signals.matches imp... | bsd-3-clause | Python |
9d213f85b676e048dc5a7ed3f43f037b7cd8956f | Add test comment | HERA-Team/Monitor_and_Control,HERA-Team/hera_mc,HERA-Team/hera_mc | hera_mc/tests/test_default_db_schema.py | hera_mc/tests/test_default_db_schema.py | # -*- mode: python; coding: utf-8 -*-
# Copyright 2016 the HERA Collaboration
# Licensed under the 2-clause BSD license.
"""
Test that default database matches code schema.
"""
from sqlalchemy.orm import sessionmaker
from hera_mc import mc, MCDeclarativeBase
from hera_mc.db_check import is_sane_database
def test_def... | # -*- mode: python; coding: utf-8 -*-
# Copyright 2016 the HERA Collaboration
# Licensed under the 2-clause BSD license.
"""
Test that default database matches code schema.
"""
from sqlalchemy.orm import sessionmaker
from hera_mc import mc, MCDeclarativeBase
from hera_mc.db_check import is_sane_database
def test_def... | bsd-2-clause | Python |
1377ad8b64d79b3e921965108734b579dd23ad68 | Fix pagination | dburr/SchoolIdolAPI,rdsathene/SchoolIdolAPI,dburr/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI,rdsathene/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI,dburr/SchoolIdolAPI,rdsathene/SchoolIdolAPI | web/templatetags/pagination.py | web/templatetags/pagination.py | from django import template
import re
register = template.Library()
def cleanpage(current_url):
current_url = re.sub(r'(\?page=\d+)', r'?', current_url)
current_url = re.sub(r'(\&page=\d+)', r'', current_url)
current_url = re.sub(r'(\?\&)', r'?', current_url)
return current_url
def nextpage(current_u... | from django import template
import re
register = template.Library()
def cleanpage(current_url):
current_url = re.sub(r'(\?page=\d+)', r'?', current_url)
current_url = re.sub(r'(\?\&)', r'?', current_url)
current_url = re.sub(r'(\&page=\d+)', r'', current_url)
return current_url
def nextpage(current_u... | apache-2.0 | Python |
85472b8b1583694b85cbce42598d1a7ba8d77f03 | Change generic 'Organisation' view into a 'Committee' view. | Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2 | backend/admin.py | backend/admin.py | from app import app, db
from models import *
from flask import Flask, flash, redirect, url_for, request, render_template, g, abort
from flask.ext.admin import Admin, expose, BaseView, AdminIndexView
from flask.ext.admin.contrib.sqla import ModelView
import urllib
from datetime import datetime
import time
from operator ... | from app import app, db
from models import *
from flask import Flask, flash, redirect, url_for, request, render_template, g, abort
from flask.ext.admin import Admin, expose, BaseView, AdminIndexView
from flask.ext.admin.contrib.sqla import ModelView
import urllib
from datetime import datetime
import time
from operator ... | apache-2.0 | Python |
cbb90d03b83a495b1c46514a583538f2cfc0d29c | Reduce number of tiles downloaded | hugovk/osmviz,hugovk/osmviz | test/functional/test_manager.py | test/functional/test_manager.py | from osmviz.manager import PILImageManager, OSMManager
import PIL.Image as Image
def test_pil():
image_manager = PILImageManager("RGB")
osm = OSMManager(image_manager=image_manager)
image, bounds = osm.createOSMImage((30, 31, -117, -116), 9)
wh_ratio = float(image.size[0]) / image.size[1]
image2 =... | from osmviz.manager import PILImageManager, OSMManager
import PIL.Image as Image
def test_pil():
imgr = PILImageManager("RGB")
osm = OSMManager(image_manager=imgr)
image, bnds = osm.createOSMImage((30, 35, -117, -112), 9)
wh_ratio = float(image.size[0]) / image.size[1]
image2 = image.resize((int(8... | mit | Python |
8cd49f13e00c6d5ae388d79e154e4ada5ffe879e | add to_pancodeblock test | ickc/pantable | tests/files/native_test.py | tests/files/native_test.py | from pathlib import Path
import sys
from typing import Tuple
from panflute import convert_text
from pantable.ast import PanTable
EXT = 'native'
DIR = Path(__file__).parent / EXT
def gen_funcs():
paths = list(Path(DIR).glob(f'*.{EXT}'))
paths.sort()
for path in paths:
name = path.stem
pr... | from pathlib import Path
import sys
from typing import Tuple
from panflute import convert_text
from pantable.ast import PanTable
EXT = 'native'
DIR = Path(__file__).parent / EXT
def gen_funcs():
paths = list(Path(DIR).glob(f'*.{EXT}'))
paths.sort()
for path in paths:
name = path.stem
pr... | bsd-3-clause | Python |
ba1463384f7ce825ea9e7927ee5eb3bbadf585e0 | Update tests/func/test_install.py | dmpetrov/dataversioncontrol,efiop/dvc,efiop/dvc,dmpetrov/dataversioncontrol | tests/func/test_install.py | tests/func/test_install.py | import os
import sys
import pytest
from dvc.utils import file_md5
from dvc.main import main
from dvc.stage import Stage
@pytest.mark.skipif(
sys.platform == "win32", reason="Git hooks aren't supported on Windows"
)
class TestInstall(object):
def _hook(self, name):
return os.path.join(".git", "hooks"... | import os
import sys
import pytest
from dvc.utils import file_md5
from dvc.main import main
from dvc.stage import Stage
@pytest.mark.skipif(
sys.platform == "win32", reason="Git hooks aren't " "supported on Windows"
)
class TestInstall(object):
def _hook(self, name):
return os.path.join(".git", "hoo... | apache-2.0 | Python |
148ae454f1a52ec119e621dc520ef970301cb53f | update version from 0.2 to 0.2.1 | zerovm/zpm,zerovm/zpm,zerovm/zerovm-cli,zerovm/zpm,zerovm/zerovm-cli,zerovm/zpm,zerovm/zerovm-cli,zerovm/zpm,zerovm/zerovm-cli,zerovm/zpm,zerovm/zerovm-cli,zerovm/zerovm-cli | zpmlib/__init__.py | zpmlib/__init__.py | # Copyright 2014 Rackspace, Inc.
#
# 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... | # Copyright 2014 Rackspace, Inc.
#
# 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... | apache-2.0 | Python |
5204039de0e1a502142f07a324c72a3f0bb37c3b | Update setup.py | GoogleCloudPlatform/professional-services,GoogleCloudPlatform/professional-services,GoogleCloudPlatform/professional-services,CloudVLab/professional-services,GoogleCloudPlatform/professional-services,CloudVLab/professional-services,GoogleCloudPlatform/professional-services,CloudVLab/professional-services,GoogleCloudPla... | infrastructure/gsuite-exporter/setup.py | infrastructure/gsuite-exporter/setup.py | # Copyright 2018 Google Inc.
#
# 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 wr... | # Copyright 2018 Google Inc.
#
# 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 wr... | apache-2.0 | Python |
c13a6f2c8ea53c285fbb30bc722428e05432dc1d | Bump rc version number | AlexSzatmary/bake | bake/__init__.py | bake/__init__.py | from api import *
__version__ = '0.1.0r0'
| from api import *
__version__ = '0.0.2-47-g008aaf6'
| mit | Python |
a6ef72027be6a6fb62b41acaed0340a8d8d91830 | Make test less verbose | FundedByMe/django-imagekit,FundedByMe/django-imagekit,tawanda/django-imagekit,tawanda/django-imagekit | tests/test_sourcegroups.py | tests/test_sourcegroups.py | from django.core.files import File
from imagekit.signals import source_saved
from imagekit.specs.sourcegroups import ImageFieldSourceGroup
from nose.tools import eq_
from . models import AbstractImageModel, ConcreteImageModel
from .utils import get_image_file
def make_counting_receiver(source_group):
def receiver... | from django.core.files import File
from imagekit.signals import source_saved
from imagekit.specs.sourcegroups import ImageFieldSourceGroup
from nose.tools import eq_
from . models import AbstractImageModel, ConcreteImageModel
from .utils import get_image_file
def make_counting_receiver(source_group):
def receiver... | bsd-3-clause | Python |
b7d2e4a4a60920320408baf8372ac2402566c7e3 | add .localhost to local-dist so local host works without changing etc/hosts | danielneis/osf.io,RomanZWang/osf.io,mluo613/osf.io,ZobairAlijan/osf.io,alexschiller/osf.io,ZobairAlijan/osf.io,doublebits/osf.io,jmcarp/osf.io,monikagrabowska/osf.io,cslzchen/osf.io,CenterForOpenScience/osf.io,ZobairAlijan/osf.io,petermalcolm/osf.io,pattisdr/osf.io,monikagrabowska/osf.io,ticklemepierce/osf.io,sbt9uc/os... | website/settings/local-dist.py | website/settings/local-dist.py | # -*- coding: utf-8 -*-
'''Example settings/local.py file.
These settings override what's in website/settings/defaults.py
NOTE: local.py will not be added to source control.
'''
from . import defaults
DEV_MODE = True
DEBUG_MODE = True # Sets app to debug mode, turns off template caching, etc.
SEARCH_ENGINE = 'elas... | # -*- coding: utf-8 -*-
'''Example settings/local.py file.
These settings override what's in website/settings/defaults.py
NOTE: local.py will not be added to source control.
'''
from . import defaults
DEV_MODE = True
DEBUG_MODE = True # Sets app to debug mode, turns off template caching, etc.
SEARCH_ENGINE = 'elas... | apache-2.0 | Python |
4de5eaf5943f31630c1fce4199f64d4a7d6eba9f | Fix images kwarg | sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer | falmer/matte/queries.py | falmer/matte/queries.py | import graphene
from falmer.schema.schema import DjangoConnectionField
from . import types
from . import models
class Query(graphene.ObjectType):
all_images = DjangoConnectionField(types.Image)
image = graphene.Field(types.Image, media_id=graphene.Int())
def resolve_all_images(self, info, **kwargs):
... | import graphene
from falmer.schema.schema import DjangoConnectionField
from . import types
from . import models
class Query(graphene.ObjectType):
all_images = DjangoConnectionField(types.Image)
image = graphene.Field(types.Image, media_id=graphene.Int())
def resolve_all_images(self, info):
if not... | mit | Python |
55d49e2d3b5c2a69b4783269e7d802062c246d9c | Update tests/test_vector2_ctor.py | ppb/ppb-vector,ppb/ppb-vector | tests/test_vector2_ctor.py | tests/test_vector2_ctor.py | import pickle
import pytest # type: ignore
from hypothesis import given
from ppb_vector import Vector2
from utils import floats, vector_likes, vectors
class V(Vector2):
pass
@pytest.mark.parametrize("cls", [Vector2, V])
@given(x=vectors())
def test_ctor_vector_like(cls, x: Vector2):
for x_like in vector_... | import pickle
import pytest # type: ignore
from hypothesis import given
from ppb_vector import Vector2
from utils import floats, vector_likes, vectors
class V(Vector2):
pass
@pytest.mark.parametrize("cls", [Vector2, V])
@given(x=vectors())
def test_ctor_vector_like(cls, x: Vector2):
for x_like in vector_... | artistic-2.0 | Python |
db47585c7737d43e9d03609ae7bb8180add06c20 | Remove popup tests. | gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com | tests/ttw/test_homepage.py | tests/ttw/test_homepage.py | from __future__ import absolute_import, division, print_function, unicode_literals
import time
from gratipay.testing import BrowserHarness
class Tests(BrowserHarness):
def test_homepage_renders_copy_correctly_for_anon(self):
assert self.css('#content h1').html == 'Projects'
assert self.css('#hea... | from __future__ import absolute_import, division, print_function, unicode_literals
import time
from gratipay.testing import BrowserHarness
class Tests(BrowserHarness):
def test_homepage_renders_copy_correctly_for_anon(self):
assert self.css('#content h1').html == 'Projects'
assert self.css('#hea... | mit | Python |
9693881316416817e8ce23aadf71be3e0850caeb | add test for str magic method | dralshehri/hijri-converter | tests/unit/test_convert.py | tests/unit/test_convert.py | import pytest
from hijriconverter import convert
@pytest.fixture()
def hijri():
return convert.Hijri(1410, 8, 13)
def test_representation_of_hijri(hijri):
assert hijri.__repr__() == 'Hijri(1410, 8, 13, lunar)'
def test_string_representation_of_hijri(hijri):
assert hijri.__str__() == '1410-08-13'
def... | import pytest
from hijriconverter import convert
@pytest.fixture()
def hijri():
return convert.Hijri(1410, 8, 13)
def test_representation_of_hijri_object(hijri):
assert hijri.__repr__() == 'Hijri(1410, 8, 13, lunar)'
def test_isoformat(hijri):
assert hijri.isoformat() == '1410-08-13'
def test_year(h... | mit | Python |
37cf47a953e558585303e6f7e2baed323361abb6 | Add score attribute | JesusMtnez/devexperto-challenge,JesusMtnez/devexperto-challenge | jesusmtnez/python/kata/game.py | jesusmtnez/python/kata/game.py | class Game():
def __init__(self):
self._score = 0
def roll(self, pins):
pass
def score(self):
return 0
| class Game():
def __init__(self):
pass
def roll(self, pins):
pass
def score(self):
return 0
| mit | Python |
7ea3af791e4862500bdadcb101fcadffbb1eee7c | Implement get_connection() | mfcloud/python-zvm-sdk,mfcloud/python-zvm-sdk,mfcloud/python-zvm-sdk,mfcloud/python-zvm-sdk | zvmsdk/database.py | zvmsdk/database.py | # Copyright 2017 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 t... | # Copyright 2017 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 t... | apache-2.0 | Python |
a1e90125199a12beaa132c4d1eba4c09be3f9ba0 | FIX add links to reports generated v2 | semitki/canales,semitki/canales,semitki/canales | fileupload/serialize.py | fileupload/serialize.py | # encoding: utf-8
import mimetypes
import re
from django.core.urlresolvers import reverse
def order_name(name):
"""order_name -- Limit a text to 20 chars length, if necessary strips the
middle of the text and substitute it for an ellipsis.
name -- text to be limited.
"""
name = re.sub(r'^.*/', '... | # encoding: utf-8
import mimetypes
import re
from django.core.urlresolvers import reverse
def order_name(name):
"""order_name -- Limit a text to 20 chars length, if necessary strips the
middle of the text and substitute it for an ellipsis.
name -- text to be limited.
"""
name = re.sub(r'^.*/', '... | mit | Python |
f0a2fc93cb3e4011e4540d9434fdd9c21714c3aa | add root_etree_to_dict function | arskom/spyne,soaplib/soaplib,martijnvermaat/rpclib,arskom/spyne,arskom/spyne,martijnvermaat/rpclib,soaplib/soaplib,martijnvermaat/rpclib,soaplib/soaplib | src/soaplib/util/etreeconv.py | src/soaplib/util/etreeconv.py |
#
# soaplib - Copyright (C) Soaplib contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This l... |
#
# soaplib - Copyright (C) Soaplib contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This l... | lgpl-2.1 | Python |
0a599478d0ef1ce8980292485f5e992798f754fe | Update input file, stdout and stderr upload to locations (#400) | taranjeet/EvalAI,taranjeet/EvalAI,taranjeet/EvalAI,taranjeet/EvalAI | apps/jobs/models.py | apps/jobs/models.py | from __future__ import unicode_literals
from os.path import join
from django.db import models
from django.contrib.auth.models import User
from base.models import (TimeStampedModel, )
from challenges.models import ChallengePhase
from participants.models import ParticipantTeam
def submission_root(instance):
retu... | from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
from base.models import (TimeStampedModel, )
from challenges.models import ChallengePhase
from participants.models import ParticipantTeam
def input_file_name(instance, filename):
return '/'.join(['su... | bsd-3-clause | Python |
921629cb81f1fdee01c9133b7b96e8d99d04d119 | Use decoding with ascii in stress test | babenek/base91,babenek/base91,babenek/base91 | test_base91.py | test_base91.py | import random
import string
from random import randbytes
import base91
TEXT = "The quick brown\r\nfox\tjumps\nover\rthe lazy\n\rdog!"
PANGRAM = "Thequickbrownfoxjumpsoverthelazydog!"
DATA = [88, 136, 162, 112, 31, 156, 195, 75, 208, 5, 61, 106, 20, 163, 227, 172, 240, 150, 163, 100, 63, 170, 82,
175, 58, 17, ... | import random
from random import randbytes
import base91
TEXT = "The quick brown\r\nfox\tjumps\nover\rthe lazy\n\rdog!"
PANGRAM = "Thequickbrownfoxjumpsoverthelazydog!"
DATA = [88, 136, 162, 112, 31, 156, 195, 75, 208, 5, 61, 106, 20, 163, 227, 172, 240, 150, 163, 100, 63, 170, 82,
175, 58, 17, 203, 5, 3]
d... | mit | Python |
7621689ed94925fa6802c1d59ac9f239db776426 | Add tests for string matchers | Xion/callee | test_callee.py | test_callee.py | """
Unit tests.
"""
try:
import unittest.mock as mock
except ImportError:
import mock
from taipan.testing import TestCase, skipIf, skipUnless
import callee as __unit__
class MatcherTestCase(TestCase):
"""Base class for matcher test cases."""
def assert_match(self, matcher, value):
m = mock.... | """
Unit tests.
"""
try:
import unittest.mock as mock
except ImportError:
import mock
from taipan.testing import TestCase
import callee as __unit__
class Any(TestCase):
test_none = lambda self: self._test(None)
test_zero = lambda self: self._test(0)
test_empty_string = lambda self: self._test(''... | bsd-3-clause | Python |
89408f761d112aac2f0ce380139de75bafc8e3e4 | change sort order | carolgrrr/trending-topics | wp.py | wp.py | from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import GetPosts, NewPost
from wordpress_xmlrpc.methods.users import GetUserInfo
from wordpress_xmlrpc.compat import xmlrpc_client
from wordpress_xmlrpc.methods import media, posts
import configparser
import fileinput
def create_word... | from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import GetPosts, NewPost
from wordpress_xmlrpc.methods.users import GetUserInfo
from wordpress_xmlrpc.compat import xmlrpc_client
from wordpress_xmlrpc.methods import media, posts
import configparser
import fileinput
def create_word... | mit | Python |
fe22f26a317c944b2f73864d349f098361c9f18f | Fix ArgumentError with driver in tests.py | ollien/Timpani,ollien/Timpani,ollien/Timpani | tests/tests.py | tests/tests.py | from selenium import webdriver
import tests
driver = webdriver.Chrome() #Will be replaced with selenium once test dev is finished
tests.login.test(driver, "tests", "password")
| from selenium import webdriver
import tests
driver = webdriver.Chrome() #Will be replaced with selenium once test dev is finished
tests.login.test("tests", "password")
| mit | Python |
1d3d50cb2f013c998a63cbe0bd9c9d010990b2bf | fix name of tests case | pombredanne/django-generic-follow,gizmag/django-generic-follow,gizmag/django-generic-follow | tests/tests.py | tests/tests.py | from django.test import TestCase
from django.contrib.auth.models import User
from generic_follow.models import Follow
from .models import Band
class GenericFollowUserMixinTests(TestCase):
def setUp(self):
self.user = User.objects.create_user(
username='john',
password='password'
... | from django.test import TestCase
from django.contrib.auth.models import User
from generic_follow.models import Follow
from .models import Band
class GenericFollowModelTests(TestCase):
def setUp(self):
self.user = User.objects.create_user(
username='john',
password='password'
... | mit | Python |
6d3df8fd43b3da95e9b5fb9879fbe513fc88d676 | Increment version | spacy-io/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc | thinc/about.py | thinc/about.py | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__name__ = 'thinc'
__version__ = '6.10.2.dev1'
__summary__ = "Practical Machine Learning for NLP"
__uri__ = 'https://github.com/explosion/thinc... | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__name__ = 'thinc'
__version__ = '6.10.2.dev0'
__summary__ = "Practical Machine Learning for NLP"
__uri__ = 'https://github.com/explosion/thinc... | mit | Python |
8325b23f19f51d5be2037dc79f6928e0a01701a9 | Update articles_invalid_url.py | DOAJ/doaj,DOAJ/doaj,DOAJ/doaj,DOAJ/doaj | portality/scripts/articles_invalid_url.py | portality/scripts/articles_invalid_url.py | from portality import models
from portality.core import app
from portality.clcsv import UnicodeWriter
import esprit
import codecs
import re
INVALID_URLS = {
"query": {
"filtered": {
"filter": {
"exists": {"field": "index.fulltext"}
},
"query": {
... | from portality import models
from portality.core import app
from portality.clcsv import UnicodeWriter
import esprit
import codecs
import re
INVALID_URLS = {
"query": {
"filtered": {
"filter": {
"exists": {"field": "index.fulltext"}
},
"query": {
... | apache-2.0 | Python |
2334eecd3e1f5e76183b9aed0803b57ca8c7b31d | add Bundle example using depends option | JDeuce/webassets,JDeuce/webassets | src/webassets/filter/libsass.py | src/webassets/filter/libsass.py | # coding: utf-8
"""
This filter based on Jesús Jerez <jerezmoreno@gmail.com> code [1].
[1] https://bitbucket.org/jhuss/webassets-libsass
"""
from __future__ import print_function
from __future__ import absolute_import
from webassets.filter import Filter
__all__ = ('LibSass',)
class LibSass(Filter):
"""Conve... | # coding: utf-8
"""
This filter based on Jesús Jerez <jerezmoreno@gmail.com> code [1].
[1] https://bitbucket.org/jhuss/webassets-libsass
"""
from __future__ import print_function
from __future__ import absolute_import
from webassets.filter import Filter
__all__ = ('LibSass',)
class LibSass(Filter):
"""Conve... | bsd-2-clause | Python |
da40ffd7af65997b41cd54f161635702a2a078d1 | Add some more sample python streamining tests | snithish/spark-testing-base,mahmoudhanafy/spark-testing-base,holdenk/spark-testing-base,hellofresh/spark-testing-base,holdenk/spark-testing-base,holdenk/spark-testing-base,jnadler/spark-testing-base,snithish/spark-testing-base,jnadler/spark-testing-base,snithish/spark-testing-base,holdenk/spark-testing-base,snithish/sp... | python/sparktestingbase/test/simple_streaming_test.py | python/sparktestingbase/test/simple_streaming_test.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 | Python |
40c15fb4300dfe729461e0bc09066f8176830188 | Exit process when exception not catch in async task | ucoin-io/cutecoin,ucoin-io/cutecoin,ucoin-io/cutecoin | src/cutecoin/main.py | src/cutecoin/main.py | """
Created on 1 févr. 2014
@author: inso
"""
import signal
import sys
import asyncio
import logging
import os
from quamash import QEventLoop
from PyQt5.QtWidgets import QApplication
from cutecoin.gui.mainwindow import MainWindow
from cutecoin.core.app import Application
def async_exception_handler(loop, context):
... | """
Created on 1 févr. 2014
@author: inso
"""
import signal
import sys
import asyncio
from quamash import QEventLoop
from PyQt5.QtWidgets import QApplication
from cutecoin.gui.mainwindow import MainWindow
from cutecoin.core.app import Application
if __name__ == '__main__':
# activate ctrl-c interrupt
signal.... | mit | Python |
413183f23e13501761618cf2411e5b4069ec9945 | add new info | wenpingzheng/new_test | 1.py | 1.py | a = 1
c = 3
b = 2
c = 3
#lovely boss
#update this file content
| a = 1
<<<<<<< HEAD
c = 3
b = 2
c = 3
#lovely boss
| mit | Python |
e168f810b1f57ef0d672a9c039aeb072b44f31b8 | change re complite | gregorianzhang/pythonchallenge | 3.py | 3.py | import urllib2
import re
url = "http://www.pythonchallenge.com/pc/def/equality.html"
aa= urllib2.urlopen(url)
data=aa.read()
num = data.find('<!--')
data1 = data[num:]
#dd=re.compile(r'[A-Z]{3}([a-z])[A-Z]{3}')
dd=re.compile(r'[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]')
tt=""
#print data1
for x in data1.split('\n'):
#... | import urllib2
import re
url = "http://www.pythonchallenge.com/pc/def/equality.html"
aa= urllib2.urlopen(url)
data=aa.read()
num = data.find('<!--')
data1 = data[num:]
#dd=re.compile(r'[A-Z]{3}([a-z])[A-Z]{3}')
dd=re.compile(r'.+[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z].+')
tt=""
#print data1
for x in data1.split('\n'):
... | apache-2.0 | Python |
ea1e5259be895457ad55c60ed560f829ecb9f4c1 | store Lokole emails in delivery tracking table | ascoderu/opwen-cloudserver,ascoderu/opwen-cloudserver | opwen_email_server/backend/server_datastore.py | opwen_email_server/backend/server_datastore.py | from json import loads
from typing import Iterable
from opwen_email_server import azure_constants as constants
from opwen_email_server import config
from opwen_email_server.services.index import AzureIndex
from opwen_email_server.services.storage import AzureTextStorage
from opwen_email_server.utils.collections import... | from json import loads
from typing import Iterable
from opwen_email_server import azure_constants as constants
from opwen_email_server import config
from opwen_email_server.services.index import AzureIndex
from opwen_email_server.services.storage import AzureTextStorage
from opwen_email_server.utils.collections import... | apache-2.0 | Python |
228ab2ed8422ff5f7f664e2b4cdf47d9f0cdfb4c | Edit import Api | s/InstagramPrinter | app.py | app.py | # -*- coding: utf-8 -*-
#################################################
# app.py
# 25 July 2013
# Said ÖZCAN
# Instagram Printer
#################################################
from classes.Api import Api
try:
if __name__ == '__main__':
Api()
except KeyboardInterrupt:
print '>>... | # -*- coding: utf-8 -*-
#################################################
# app.py
# 25 July 2013
# Said ÖZCAN
# Instagram Printer
#################################################
from classes.Api import *
try:
if __name__ == '__main__':
Api()
except KeyboardInterrupt:
print '>>In... | mit | Python |
281fc31923763dd281dc70a371cd571452a325c8 | fix listen | tjcsl/mhacksiv | app.py | app.py | import project
import os
app = project.app
app.debug = False
app.run(host='0.0.0.0', port=int(os.getenv('PORT', 5000))
| import project
import os
app = project.app
app.debug = False
app.run(port=os.getenv('PORT', 5000))
| apache-2.0 | Python |
92759832056ace34518268618aa24989e7af5887 | add ability to listen on an arbitrary port | keepcalm444/something-something-opal,keepcalm444/something-something-opal,keepcalm444/something-something-opal,keepcalm444/something-something-opal | app.py | app.py | #!/usr/bin/env python3
import tornado.ioloop
import tornado.web
import argparse
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, World!")
app= tornado.web.Application([
(r"/", MainHandler)
])
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.... | #!/usr/bin/env python3
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, World!")
app= tornado.web.Application([
(r"/", MainHandler)
])
if __name__ == "__main__":
app.listen(8080)
tornado.ioloop.IOLoop.instance().start()
... | agpl-3.0 | Python |
2b89b28b2a5900d8e5be5509b6f01054e2bfdb23 | Fix host and port for Heroku | xeBuz/CompanyDK,xeBuz/CompanyDK,xeBuz/CompanyDK,xeBuz/CompanyDK | app.py | app.py | import os
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.script import Manager, Server
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.heroku import Heroku
# Initialize Application
app = Flask(__name__)
manager = Manager(app)
manager.add_command("runserver", Se... | import os
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.script import Manager, Server
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.heroku import Heroku
# Initialize Application
app = Flask(__name__)
manager = Manager(app)
manager.add_command("runserver", Se... | mpl-2.0 | Python |
ea424b928faaa063a96e85eaadebd694cb006990 | Switch back to MD5 for shorter URLs | gehaxelt/Python-Pypaste,gehaxelt/Python-Pypaste | app.py | app.py | #!/usr/bin/python
from flask import Flask, request, jsonify
from config import PyPasteConfig
import re, time, hashlib, os.path
config = PyPasteConfig()
app = Flask(__name__)
hex_regex = re.compile('^[a-zA-Z0-9]+$')
# Send index.html
@app.route('/')
def index():
return app.send_static_file('index.html')
@app.r... | #!/usr/bin/python
from flask import Flask, request, jsonify
from config import PyPasteConfig
import re, time, hashlib, os.path
config = PyPasteConfig()
app = Flask(__name__)
hex_regex = re.compile('^[a-zA-Z0-9]+$')
# Send index.html
@app.route('/')
def index():
return app.send_static_file('index.html')
@app.r... | mit | Python |
257686cfa72318c0b476d4623731080f848c4942 | Use instance folder to load configuration file. | alchermd/headlines,alchermd/headlines | app.py | app.py | import requests
from flask import Flask, render_template
app = Flask(__name__, instance_relative_config=True)
app.config.from_pyfile("appconfig.py")
BBC_id= "bbc-news"
@app.route("/")
def index():
r = requests.get(
f"https://newsapi.org/v1/articles?source={BBC_id}&sortBy=top&apiKey={app.config['API_KEY']... | import requests
from flask import Flask, render_template
app = Flask(__name__)
BBC_id= "bbc-news"
API_KEY = "c4002216fa5446d582b5f31d73959d36"
@app.route("/")
def index():
r = requests.get(
f"https://newsapi.org/v1/articles?source={BBC_id}&sortBy=top&apiKey={API_KEY}"
)
return render_template("in... | mit | Python |
b59925a9d58c161891708013e399e6eb7dff1e2e | Create app.py | ashfaaq77/woo-commerce | app.py | app.py | from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
import json
import os
from flask import Flask
from flask import request
from flask im... | from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
import json
import os
from flask import Flask
from flask import request
from flask im... | apache-2.0 | Python |
a3957c95e33c9e385ea14f1ed24dd908a3acefeb | Update trajectory helpers again to export actual trajectory relative to the first pose, rather than the motion for each frame. | jskinn/robot-vision-experiment-framework,jskinn/robot-vision-experiment-framework | util/trajectory_helpers.py | util/trajectory_helpers.py | # Copyright (c) 2017, John Skinner
import typing
import database.client
import bson
import util.transform as tf
def get_trajectory_for_image_source(db_client: database.client.DatabaseClient,
image_collection_id: bson.ObjectId) -> typing.Mapping[float, tf.Transform]:
"""
Ima... | # Copyright (c) 2017, John Skinner
import typing
import database.client
import bson
import util.transform as tf
def get_trajectory_for_image_source(db_client: database.client.DatabaseClient,
image_collection_id: bson.ObjectId) -> typing.Mapping[float, tf.Transform]:
"""
Ima... | bsd-2-clause | Python |
a3fab18029b63763c8db1bcf76ee8458a0e125e0 | Add old sessions. | openstates/billy,sunlightlabs/billy,sunlightlabs/billy,openstates/billy,sunlightlabs/billy,openstates/billy | ak/__init__.py | ak/__init__.py | from pupa.scrape import Jurisdiction, Organization, Post
from openstates.people import OpenstatesPersonScraper
from openstates.bills import OpenstatesBillScraper
class PersonScraper(OpenstatesPersonScraper):
state = 'ak'
class BillScraper(OpenstatesBillScraper):
state = 'ak'
house = Organization('Alaska Sta... | from pupa.scrape import Jurisdiction, Organization, Post
from openstates.people import OpenstatesPersonScraper
from openstates.bills import OpenstatesBillScraper
class PersonScraper(OpenstatesPersonScraper):
state = 'ak'
class BillScraper(OpenstatesBillScraper):
state = 'ak'
house = Organization('Alaska Sta... | bsd-3-clause | Python |
49983ece6ab2f3b87d4f2341b7b39130b7d6150e | add example comment | ericfs/geb | mu.py | mu.py | # Chapter 1 The MU-Puzzle
import re
def r1(s):
if s[-1] == 'I':
return [s + 'U']
else:
return []
def r2(s):
if s[0] == 'M':
return [s + s[1:]]
else:
return []
def r3(s):
return [s[:m.start()] + 'U' + s[m.start() + 3:] for m in
re.finditer('(?=III)', s)]
def r4(s):
return [s[:m.star... | import re
def r1(s):
if s[-1] == 'I':
return [s + 'U']
else:
return []
def r2(s):
if s[0] == 'M':
return [s + s[1:]]
else:
return []
def r3(s):
return [s[:m.start()] + 'U' + s[m.start() + 3:] for m in
re.finditer('(?=III)', s)]
def r4(s):
return [s[:m.start()] + s[m.start() + 2:] f... | mit | Python |
379552a8e048d1e79d746d76d47d2cb87dd97bcb | initialize search. | constanthatz/data-structures2 | bst.py | bst.py | class Leaf(object):
'''Create leaf.'''
def __init__(self, left=None, value=None, right=None):
self.left = left
self.value = value
self.right = right
class Tree(object):
'''Create tree'''
def __init__(self, root=None):
self.root = root
def search(self, value):
... | class Leaf(object):
'''Create leaf.'''
def __init__(self, left=None, value=None, right=None):
self.left = left
self.value = value
self.right = right
class Tree(object):
'''Create tree'''
def __init__(self, root=None):
self.root = root
def insert(self, value, compar... | mit | Python |
7e748a2a74f130e81ca60716182c578f79123165 | indent code in docstring | mgaitan/one | one.py | one.py | def one(iterable):
"""
Return the object in the given iterable that evaluates to True.
If the given iterable has more than one object that evaluates to True,
or if there is no object that fulfills such condition, return False.
>>> one((True, False, False))
True
>>> one((True, F... | def one(iterable):
"""
Return the object in the given iterable that evaluates to True.
If the given iterable has more than one object that evaluates to True,
or if there is no object that fulfills such condition, return False.
>>> one((True, False, False))
True
>>> one((True, False, True))... | bsd-3-clause | Python |
1b3cea6840ef9607c60d4c989af1fe2a6f697d35 | Remove muda function | BeataBak/project-euler-problems | 001.py | 001.py | """
Project Euler Problem 1
=======================
If we list all the natural numbers below 10 that are multiples of 3 or 5,
we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
"""
def sum_multiples(f, n):
"""
Find the sum of all the multiples of ... | """
Project Euler Problem 1
=======================
If we list all the natural numbers below 10 that are multiples of 3 or 5,
we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
"""
def sum_multiples(f, n):
"""
Find the sum of all the multiples of ... | mit | Python |
3423a4762b604c658d4985f05e8bbc50ac4ddd21 | Raise exception for python2 (#16) | edouardswiac/python-edgar | run.py | run.py | from __future__ import print_function
import os
import datetime
import tempfile
import sys
from argparse import ArgumentParser
import logging
import edgar
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(asc... | from __future__ import print_function
import os
import datetime
import tempfile
import sys
from argparse import ArgumentParser
import logging
import edgar
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(asc... | mit | Python |
f6494b3994762c094d421cfd2e8c335815438dad | fix log file | yupbank/onekeyvpn | run.py | run.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
run.py
Author: yupbank
Email: yupbank@gmail.com
Created on
2013-09-30
'''
import sys
import os
import time
from daemon import Daemon
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
run.py
Author: yupbank
Email: yupbank@gmail.com
Created on
2013-09-30
'''
import sys
import os
import time
from daemon import Daemon
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, ... | bsd-3-clause | Python |
bfcba5e5b6d8764b10a936231f6d793b16d4c421 | add a check-in stub | Queens-Hacks/thoughtboard,Queens-Hacks/thoughtboard | app.py | app.py | #!/usr/bin/env python
import os
from flask import Flask
from flask.ext.pymongo import PyMongo
CONFIGS = (
'AUTH_TOKEN',
'CELL_NUM',
'MONGOLAB_URI',
'TWILIO_NUM',
)
# Set up the app
app = Flask(__name__)
app.config.update(**{v: os.environ[v] for v in CONFIGS})
app.config['MONGO_URI'] = app.config['MO... | #!/usr/bin/env python
import os
from flask import Flask
from flask.ext.pymongo import PyMongo
CONFIGS = (
'AUTH_TOKEN',
'CELL_NUM',
'MONGOLAB_URI',
'TWILIO_NUM',
)
# Set up the app
app = Flask(__name__)
app.config.update(**{v: os.environ[v] for v in CONFIGS})
app.config['MONGO_URI'] = app.config['MO... | mit | Python |
cd159717fd6791bba9f8515e15dd84b753b01219 | Add better error handling | tforrest/twilio-plays-roomba-flask | app.py | app.py | from flask import Flask, jsonify, request
from dotenv import load_dotenv, find_dotenv
from twilio import twiml
from Queue import Queue
from threading import Thread
from time import sleep
load_dotenv(find_dotenv())
directions = ['forward', 'backward']
task_q = Queue()
def send_rasp(task_q):
while True:
sleep(2)... | from flask import Flask, jsonify, request
from dotenv import load_dotenv, find_dotenv
from twilio import twiml
from Queue import Queue
from threading import Thread
from time import sleep
load_dotenv(find_dotenv())
directions = ['forward', 'backward']
task_q = Queue()
def send_rasp(task_q):
while True:
sleep(2)... | mit | Python |
9809d350f38eb1bd50a1b03a02d08df01fe4a88c | Add redis_client to app | oxyio/oxyio,oxyio/oxyio,oxyio/oxyio,oxyio/oxyio | app.py | app.py | # Oxypanel
# File: app/__init__.py
# Desc: the globals file (app, connections, maps)
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from flask_debugtoolbar import DebugToolbarExtension
from webassets import ... | # Oxypanel
# File: app/__init__.py
# Desc: the globals file (app, connections, maps)
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from flask_debugtoolbar import DebugToolbarExtension
from webassets import ... | mit | Python |
eae6ab808484897a4f94a56d1e467a72832dad6d | Update app.py | ssumanbiswas/personaldeals | app.py | app.py | #!/usr/bin/env python
import urllib
import json
import os
from flask import Flask
from flask import request
from flask import make_response
# Flask app should start in global layout
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook():
req = request.get_json(silent=True, force=True)
... | #!/usr/bin/env python
import urllib
import json
import os
from flask import Flask
from flask import request
from flask import make_response
# Flask app should start in global layout
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook():
req = request.get_json(silent=True, force=True)
... | apache-2.0 | Python |
29d7d4e2dd67893ea6460fbafbed8680cda308c2 | Fix Security Holes | ethanchewy/OnlinePythonLinterSyntaxChecker,ethanchewy/OnlinePythonLinterSyntaxChecker,ethanchewy/PythonBuddy,ethanchewy/PythonBuddy,ethanchewy/PythonBuddy | app.py | app.py | #Created by Ethan Chiu 10/25/16
from flask import Flask, render_template, request, jsonify
from pylint import lint
from astroid import MANAGER
from pylint.reporters.text import TextReporter
from subprocess import Popen, PIPE, STDOUT
import fileinput
app = Flask(__name__)
app.debug = True
@app.route('/')
def hello_wo... | #Created by Ethan Chiu 10/25/16
from flask import Flask, render_template, request, jsonify
from pylint import lint
from astroid import MANAGER
from pylint.reporters.text import TextReporter
from subprocess import Popen, PIPE, STDOUT
app = Flask(__name__)
app.debug = True
@app.route('/')
def hello_world():
retur... | bsd-3-clause | Python |
99d717e356ed2307a9acfdc053f3535065c63c03 | add __main__ sanity check / test | kergoth/oe-test-scripts | dot.py | dot.py | #!/usr/bin/env python
import re
import collections
header_regex = re.compile(r'"(?P<name>[^"]+)" \[label="(?P<label>[^"]+)"\]')
line_regex = re.compile(r'"(?P<src>[^"]+)" -> "(?P<dest>[^"]+)"( \[style=dashed\])?')
def parse_depends(dotfile):
depends = collections.defaultdict(set)
dotfile = open(dotfile, "rU"... | #!/usr/bin/env python
import re
import collections
header_regex = re.compile(r'"(?P<name>[^"]+)" \[label="(?P<label>[^"]+)"\]')
line_regex = re.compile(r'"(?P<src>[^"]+)" -> "(?P<dest>[^"]+)"( \[style=dashed\])?')
def parse_depends(dotfile):
depends = collections.defaultdict(set)
dotfile = open(dotfile, "rU"... | mit | Python |
1055342215ebca445fd13f4da99e9014b32f036b | Add HEAD | glenjarvis/explore_git_internals | log.py | log.py | #!/usr/bin/env python
"""
Supporting code for the "Explore Git internals using Python"
talk:
http://www.meetup.com/silicon-valley-python/events/228160092/
For simplicity in presentation of the code, we will keep these in a
single file.
"""
import os
class GitError(RuntimeError):
"""A Git Error Exception"""
... | #!/usr/bin/env python
"""
Supporting code for the "Explore Git internals using Python"
talk:
http://www.meetup.com/silicon-valley-python/events/228160092/
For simplicity in presentation of the code, we will keep these in a
single file.
"""
import os
class GitError(RuntimeError):
"""A Git Error Exception"""
... | bsd-3-clause | Python |
10a4a11252fe2dd38ef7a894bdeab6067569e56a | Remove some redundancy | arkon/cdf-scrapers | lpq.py | lpq.py | import json
import time
import datetime
import subprocess
def getData(printer):
"""Return the data from calling lpq with the specified printer as a list."""
cmd = 'lpq -P' + printer
data = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read()
return(data.decode('utf-8').split('\n')
d... | import json
import time
import datetime
import subprocess
def getData(printer):
"""Return the data from calling lpq with the specified printer."""
cmd = 'lpq -P' + printer
data = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read()
return(data.decode('utf-8'))
def parseData(list):
... | mit | Python |
59561efd4a3afe5686b2c057290c45a357296cb7 | Remove trailing slash default behavior | kimmobrunfeldt/nap | nap.py | nap.py | """
Easy REST API calling.
Useful information about dynamic attribute creation:
http://docs.python.org/reference/datamodel.html#customizing-attribute-access
"""
import requests
class Nap(object):
def __init__(self, api_url, **request_kwargs):
self._api_url = self._ensure_trailing_slash(api_url)
... | """
Easy REST API calling.
Useful information about dynamic attribute creation:
http://docs.python.org/reference/datamodel.html#customizing-attribute-access
"""
import requests
class Nap(object):
def __init__(self, api_url, **request_kwargs):
self._api_url = self._ensure_trailing_slash(api_url)
... | mit | Python |
e541bea03cca1c18dde189561b68fe71723b5f83 | Fix error when launching using 'python qos.py' | Anthony25/python_tc_qos | qos.py | qos.py | #!/usr/bin/python
# Author: Anthony Ruhier
# Set QoS rules
import os
import subprocess
import sys
try:
from config import INTERFACES
except ImportError:
print("No existing configuration. Please copy config.py.default as "
"config.py and optionaly configure it for your setup.")
exit(1)
import ru... | #!/usr/bin/python
# Author: Anthony Ruhier
# Set QoS rules
import os
import subprocess
import sys
try:
from config import INTERFACES
except ImportError:
print("No existing configuration. Please copy config.py.default as "
"config.py and optionaly configure it for your setup.")
exit(1)
import ru... | bsd-2-clause | Python |
64f523054a01fb94791df8314c87e7e6263bf057 | fix #5 and #4 | carbonblack/cb-2fa-login,carbonblack/cb-2fa-login,carbonblack/cb-2fa-login,carbonblack/cb-2fa-login | run.py | run.py | #!/usr/bin/env python
import argparse
import sys
import app
from app.models import User
import getpass
def initialize_database():
sys.stderr.write("Initializing the first user\n\n")
field_names = {
'email' : 'Email address',
'first_name' : 'First name',
'last_name' : 'Last name',
... | #!/usr/bin/env python
import argparse
import sys
import app
from app.models import User
import getpass
def initialize_database():
sys.stderr.write("Initializing the first user\n\n")
field_names = {
'email' : 'Email address',
'first_name' : 'First name',
'last_name' : 'Last name',
... | mit | Python |
0bbf4efcaec6b9c427c7ac6c474bf4f40f8bc75c | Access correct host value | buck06191/bcmd-web,buck06191/bcmd-web,buck06191/bcmd-web,buck06191/bcmd-web,buck06191/bcmd-web | run.py | run.py | from app import app
if __name__ == '__main__':
if app.config['HOST']:
app.run(host=app.config.HOST)
else:
app.run()
| from app import app
if __name__ == '__main__':
if app.config.HOST:
app.run(host=app.config.HOST)
else:
app.run()
| mit | Python |
951e17a41330b558e7e804ca354ca9a6d9b65b0b | set version to 1.7.0 final | emory-libraries/findingaids,mprefer/findingaids,emory-libraries/findingaids,mprefer/findingaids | findingaids/__init__.py | findingaids/__init__.py | # file findingaids/__init__.py
#
# Copyright 2012 Emory University Library
#
# 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
#
# U... | # file findingaids/__init__.py
#
# Copyright 2012 Emory University Library
#
# 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
#
# U... | apache-2.0 | Python |
cd0877cd586004e881303a3f9b4be2f9b3325c75 | Split up the refresh() function to provide other useful functions. | chadmv/plow,Br3nda/plow,Br3nda/plow,Br3nda/plow,chadmv/plow,chadmv/plow,chadmv/plow,chadmv/plow,chadmv/plow,Br3nda/plow,chadmv/plow,Br3nda/plow | lib/python/plow/gui/common/job.py | lib/python/plow/gui/common/job.py | """Commonly used Job widgets."""
from plow.gui.manifest import QtCore, QtGui
from plow.gui.constants import COLOR_TASK_STATE
class JobProgressBar(QtGui.QWidget):
# Left, top, right, bottom
Margins = [5, 2, 10, 4]
def __init__(self, totals, parent=None):
QtGui.QWidget.__init__(self, parent)
... | """Commonly used Job widgets."""
from plow.gui.manifest import QtCore, QtGui
from plow.gui.constants import COLOR_TASK_STATE
class JobProgressBar(QtGui.QWidget):
# Left, top, right, bottom
Margins = [5, 2, 10, 4]
LeftMargin = 5
RightMargin = 10;
def __init__(self, totals, parent=None):
Q... | apache-2.0 | Python |
7c94101e03de84ca780da4f0b48bd6f81eed47b4 | Add missing config import | Rfam/rfam-production,Rfam/rfam-production,Rfam/rfam-production | config/rfam_config.py | config/rfam_config.py | '''
Created on 2 Mar 2016
@author: ikalvari
Description: This is a configuration file with all the paths on the cluster
'''
from config import rfam_local as cfl
# ------------------------------DATABASES--------------------------------------
# Dictionaries
RFAMLIVEPUB = cfl.RFAMLIVEPUB
RFAMLIVE = cfl.RFAMLIVE
RFA... | '''
Created on 2 Mar 2016
@author: ikalvari
Description: This is a configuration file with all the paths on the cluster
'''
from config import rfam_local as cfl
# ------------------------------DATABASES--------------------------------------
# Dictionaries
RFAMLIVEPUB = cfl.RFAMLIVEPUB
RFAMLIVE = cfl.RFAMLIVE
RFA... | apache-2.0 | Python |
e93e80d07b2bb697994177ecdec02283c9758bce | Simplify PageDetail docstring | Ian-Foote/django-conman,meshy/django-conman,meshy/django-conman | conman/pages/views.py | conman/pages/views.py | from django.views.generic import DetailView
class PageDetail(DetailView):
"""Show a Page in all its glory."""
def get_object(self):
"""Return the Page Route passed in kwargs for rendering."""
return self.kwargs['route']
| from django.views.generic import DetailView
class PageDetail(DetailView):
"""
Show a Page in all its glory.
Requires `handler` in the kwargs in order to get the Page instance.
"""
def get_object(self):
"""Return the Page Route passed in kwargs for rendering."""
return self.kwargs[... | bsd-2-clause | Python |
09f7910901d8c740fc187080c7d761b9f32704f8 | Update for attachment structure naming change in CouchDB trunk. | oliora/couchdb-python,jur9526/couchdb-python,ssaavedra/couchdb-python,gcarranza/couchdb-python,erikdejonge/rabshakeh-couchdb-python-progress-attachments,hdmessaging/couchbase-mapping-python | couchdb/tools/dump.py | couchdb/tools/dump.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
from base64 import b64decode
from email.MIMEBase import MIMEBase
from email.MIMEMul... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
from base64 import b64decode
from email.MIMEBase import MIMEBase
from email.MIMEMul... | bsd-3-clause | Python |
172f7d90fe6ceddd603a3f243df38b98cff01d51 | Tweak test. | maxalbert/colormap-selector | cross_section_test.py | cross_section_test.py | import numpy as np
from cross_section import *
def test_normal_vector_of_plane_has_unit_length():
plane = Plane([0, 0, 0], [-3, 4, 12])
np.testing.assert_almost_equal(np.linalg.norm(plane.n), 1.0)
def test_init_cross_section():
plane = Plane([50, 0, 0], n=[1, 0, 0])
cs = CrossSection(plane)
asse... | import numpy as np
from cross_section import *
def test_normal_vector_of_plane_has_unit_length():
plane = Plane([0, 0, 0], [-3, 4, 12])
np.testing.assert_almost_equal(np.linalg.norm(plane.n), 1.0)
def test_init_cross_section():
plane = Plane([50, 0, 0], n=[1, 0, 0])
cs = CrossSection(plane)
asse... | mit | Python |
2a8a50528a36525f37ea26dbccefd153d4cdcc8c | Fix name of command sent by send_dialogue action. | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | go/apps/dialogue/definition.py | go/apps/dialogue/definition.py | from go.vumitools.conversation.definition import (
ConversationDefinitionBase, ConversationAction)
class SendDialogueAction(ConversationAction):
action_name = 'send_dialogue'
action_display_name = 'Send Dialogue'
needs_confirmation = True
needs_group = True
needs_running = True
def chec... | from go.vumitools.conversation.definition import (
ConversationDefinitionBase, ConversationAction)
class SendDialogueAction(ConversationAction):
action_name = 'send_dialogue'
action_display_name = 'Send Dialogue'
needs_confirmation = True
needs_group = True
needs_running = True
def chec... | bsd-3-clause | Python |
87051842c53b2c7dae12136b6df8254280e56d80 | Fix passing of job_id from create helper | frictionlessdata/goodtables.io,frictionlessdata/goodtables.io,frictionlessdata/goodtables.io,frictionlessdata/goodtables.io | goodtablesio/helpers/create.py | goodtablesio/helpers/create.py | import uuid
import logging
import datetime
from sqlalchemy.types import DateTime
from .validate import validate_validation_conf
from .. import tasks
from .. import services
logger = logging.getLogger(__name__)
# Module API
def create_job(validation_conf, job_id=None):
"""Create job.
Args:
validation... | import uuid
import logging
import datetime
from sqlalchemy.types import DateTime
from .validate import validate_validation_conf
from .. import tasks
from .. import services
logger = logging.getLogger(__name__)
# Module API
def create_job(validation_conf, job_id=None):
"""Create job.
Args:
validation... | agpl-3.0 | Python |
ee21a863afd873f3d780bf005241596445fd3b81 | Add new admin url | akshayaurora/junction,Rahul91/junction,ChillarAnand/junction,hTrap/junction,praba230890/junction,ChillarAnand/junction,praba230890/junction,akshayaurora/junction,akshayaurora/junction,ChillarAnand/junction,nava45/junction,NabeelValapra/junction,pythonindia/junction,Rahul91/junction,praba230890/junction,farhaanbukhsh/ju... | junction/urls.py | junction/urls.py | # -*- coding: utf-8 -*-
'''
Root url routering file.
You should put the url config in their respective app putting only a
reference to them here.
'''
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, patterns, url
from django.conf.urls.static import static
... | # -*- coding: utf-8 -*-
'''
Root url routering file.
You should put the url config in their respective app putting only a
reference to them here.
'''
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, patterns, url
from django.conf.urls.static import static
... | mit | Python |
c896c25abe215c879b72fc3ba29a67f958de5f23 | Fix test. | grow/pygrow,vitorio/pygrow,denmojo/pygrow,grow/grow,denmojo/pygrow,vitorio/pygrow,codedcolors/pygrow,grow/grow,codedcolors/pygrow,codedcolors/pygrow,grow/pygrow,denmojo/pygrow,grow/pygrow,denmojo/pygrow,vitorio/pygrow,grow/grow,grow/grow | grow/pods/translations_test.py | grow/pods/translations_test.py | from grow.pods import pods
from grow.pods import storage
import unittest
class TranslationsTest(unittest.TestCase):
def setUp(self):
self.pod = pods.Pod('grow/pods/testdata/pod/', storage=storage.FileStorage)
def test_list_locales(self):
self.assertItemsEqual(
['de', 'fr', 'en', 'it', 'ja'],
... | from grow.pods import pods
from grow.pods import storage
import unittest
class TranslationsTest(unittest.TestCase):
def setUp(self):
self.pod = pods.Pod('grow/pods/testdata/pod/', storage=storage.FileStorage)
def test_list_locales(self):
self.assertListEqual(
['fr', 'de', 'en', 'it', 'ja'],
... | mit | Python |
8d4528a140ef7d0250dc2b41225d735643cc64d6 | Fix test_dependency_parser | pombredanne/pyp2rpm,mcyprian/pyp2rpm,yuokada/pyp2rpm,MichaelMraka/pyp2rpm,fedora-python/pyp2rpm,henrysher/spec4pypi,joequant/pyp2rpm | tests/test_dependency_parser.py | tests/test_dependency_parser.py | import pytest
from pkg_resources import Requirement as R
from pyp2rpm.dependency_parser import DependencyParser as DP
class TestDependencyParser(object):
@pytest.mark.parametrize(('d', 'r', 'expected'), [
('docutils>=0.3,<1,!=0.5', True, [['Requires', 'docutils', '>=', '0.3'],
... | import pytest
from pkg_resources import Requirement as R
from pyp2rpmlib.dependency_parser import DependencyParser as DP
class TestDependencyParser(object):
@pytest.mark.parametrize(('d', 'r', 'expected'), [
('docutils>=0.3,<1,!=0.5', True, [['Requires', 'python-docutils', '>=', '0.3'],
... | mit | Python |
d1ccd3e93043d11a22e873e7ccdb76d749746151 | Refresh db connections on uwsgi fork | hexa4313/velov-companion-server,hexa4313/velov-companion-server | api/app/app.py | api/app/app.py | import os
import logging
from uwsgidecorators import postfork
from flask import Flask
from model.base import db
from route.base import blueprint
# Register models and routes
import model
import route
logging.basicConfig(level=logging.INFO)
app = Flask(__name__)
# app.config['PROPAGATE_EXCEPTIONS'] = True
app.config[... | import os
import logging
from flask import Flask
from model.base import db
from route.base import blueprint
# Register models and routes
import model
import route
logging.basicConfig(level=logging.INFO)
app = Flask(__name__)
# app.config['PROPAGATE_EXCEPTIONS'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgre... | mit | Python |
89e0b03726ce4f9ab23ed9c5f96a7df4d7569b35 | Remove junk | nickw444/crappy-snap,nickw444/crappy-snap,nickw444/crappy-snap | Application/__init__.py | Application/__init__.py | from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.security import Security, SQLAlchemyUserDatastore
from flask_mail import Mail
from flask_boilerplate_utils import Boilerplate
# from flask_boilerplate_utils.menu import Menu
from flask.ext.menu import Menu
# Initial App Setup
app = Flas... | from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.security import Security, SQLAlchemyUserDatastore
from flask_mail import Mail
from flask_boilerplate_utils import Boilerplate
# from flask_boilerplate_utils.menu import Menu
from flask.ext.menu import Menu
# Initial App Setup
app = Flas... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.