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 |
|---|---|---|---|---|---|---|---|---|
ccd3a50d5518d6fe4d45f31360ebf2c7849af62c | Add OCA as author of OCA addons | Domatix/l10n-spain,factorlibre/l10n-spain,factorlibre/l10n-spain,factorlibre/l10n-spain | l10n_es_account_asset/__openerp__.py | l10n_es_account_asset/__openerp__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | agpl-3.0 | Python |
edb52dcbd58e4f31dff26a6e60ae4d670619121e | correct settings for SMTP | altai/focus,altai/focus,altai/focus | C4GD_web/default_settings.py | C4GD_web/default_settings.py | # coding=utf-8
RELATIVE_TO_API_HOURS_SHIFT = 0 # our system has 13, keystone db 14 => 1
SECRET_KEY = 'g.U(\x8cQ\xbc\xdb\\\xc3\x9a\xb2\xb6,\xec\xad(\xf8"2*\xef\x0bd'
NEXT_TO_LOGIN_ARG = 'next' # GET/POST field name to store next after login URL
DEFAULT_NEXT_TO_LOGIN_VIEW = 'dashboard' # no next? redirect to this view
DE... | # coding=utf-8
RELATIVE_TO_API_HOURS_SHIFT = 0 # our system has 13, keystone db 14 => 1
SECRET_KEY = 'g.U(\x8cQ\xbc\xdb\\\xc3\x9a\xb2\xb6,\xec\xad(\xf8"2*\xef\x0bd'
NEXT_TO_LOGIN_ARG = 'next' # GET/POST field name to store next after login URL
DEFAULT_NEXT_TO_LOGIN_VIEW = 'dashboard' # no next? redirect to this view
DE... | lgpl-2.1 | Python |
68a49aa5ad009afd5e58b88f414be898d02b2b30 | add solution for permutation sequence | SwordYoung/cutprob,SwordYoung/cutprob | leetcode/permutation-sequence/sol.py | leetcode/permutation-sequence/sol.py | #!/usr/bin/env python
class Solution:
# @return a string
def getPermutation(self, n, k):
p = {0:1, 1:1}
for i in range(2,n+1):
p[i]=p[i-1]*i
sk = []
for i in range(n):
sk.append(True)
kl = k-1
res = ""
for i in ra... | #!/usr/bin/env python
class Solution:
# @return a string
def getPermutation(self, n, k):
p = {0:1, 1:1}
for i in range(2,n+1):
p[i]=p[i-1]*i
sk = []
for i in range(n):
sk.append(True)
kl = k-1
res = []
for i in ra... | artistic-2.0 | Python |
90abcfc316bcd3b998ea3d120adbe49a1b89d9ec | Update tests_globals.py | RonsenbergVI/trendpy,RonsenbergVI/trendpy | trendpy/tests/tests_globals.py | trendpy/tests/tests_globals.py | # -*- coding: utf-8 -*-
# tests_globals.py
# MIT License
# Copyright (c) 2017 Rene Jean Corneille
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without li... | # -*- coding: utf-8 -*-
# tests_globals.py
# MIT License
# Copyright (c) 2017 Rene Jean Corneille
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without li... | mit | Python |
ae78bd758c690e28abaae2c07e8a3890e76044e0 | Allow papers/maxout to be tested without MNIST data | KennethPierce/pylearnk,KennethPierce/pylearnk,Refefer/pylearn2,JesseLivezey/plankton,goodfeli/pylearn2,theoryno3/pylearn2,alexjc/pylearn2,pkainz/pylearn2,fulmicoton/pylearn2,alexjc/pylearn2,alexjc/pylearn2,kastnerkyle/pylearn2,ddboline/pylearn2,se4u/pylearn2,hantek/pylearn2,jeremyfix/pylearn2,nouiz/pylearn2,abergeron/p... | pylearn2/scripts/papers/maxout/tests/test_mnist.py | pylearn2/scripts/papers/maxout/tests/test_mnist.py | import os
import numpy as np
import pylearn2
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix
from pylearn2.termination_criteria import EpochCounter
from pylearn2.utils.serial import load_train_file
def test_mnist():
"""
Test the mnist.yaml file from the dropout
paper on random input
... | import os
import numpy as np
import pylearn2
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix
from pylearn2.termination_criteria import EpochCounter
from pylearn2.utils.serial import load_train_file
def test_mnist():
"""
Test the mnist.yaml file from the dropout
paper on random input
... | bsd-3-clause | Python |
fca5e3d1f1a2c9a2378c4aff7b3d14c37b4de6af | Fix update_api to work with 1.8 | SteveViss/readthedocs.org,techtonik/readthedocs.org,clarkperkins/readthedocs.org,tddv/readthedocs.org,istresearch/readthedocs.org,SteveViss/readthedocs.org,SteveViss/readthedocs.org,davidfischer/readthedocs.org,tddv/readthedocs.org,stevepiercy/readthedocs.org,stevepiercy/readthedocs.org,safwanrahman/readthedocs.org,pom... | readthedocs/core/management/commands/update_api.py | readthedocs/core/management/commands/update_api.py | import logging
from optparse import make_option
from django.core.management.base import BaseCommand
from readthedocs.projects import tasks
from readthedocs.api.client import api
log = logging.getLogger(__name__)
class Command(BaseCommand):
"""Custom management command to rebuild documentation for all projects ... | import logging
from optparse import make_option
from django.core.management.base import BaseCommand
from readthedocs.projects import tasks
from readthedocs.api.client import api
log = logging.getLogger(__name__)
class Command(BaseCommand):
"""Custom management command to rebuild documentation for all projects ... | mit | Python |
f51105e048d8f07ae5a1409b271246ae508c052a | Fix the iteration | crossbario/autobahn-testsuite,tavendo/AutobahnTestSuite,crossbario/autobahn-testsuite,mikelikespie/AutobahnTestSuite,mikelikespie/AutobahnTestSuite,mkauf/AutobahnTestSuite,mogui/AutobahnTestSuite,jgelens/AutobahnTestSuite,tavendo/AutobahnTestSuite,crossbario/autobahn-testsuite,crossbario/autobahn-testsuite,Brother-Simo... | lib/python/autobahn/case/case5_16.py | lib/python/autobahn/case/case5_16.py | ###############################################################################
##
## Copyright 2011 Tavendo GmbH
##
## 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
##
## ht... | ###############################################################################
##
## Copyright 2011 Tavendo GmbH
##
## 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
##
## ht... | apache-2.0 | Python |
05ecc1f721d4683c2412e28a82eabe607c3a9129 | allow additional args for installing package | yejianye/fabtask | fabtask/packages.py | fabtask/packages.py | from fabric.api import env, sudo, run
from fabtask.utils import program_exists, is_linux, is_macos
def find_package_management_program():
if env.get('install_package_command'):
return
if is_linux():
if program_exists('apt-get'):
env.install_package_command = 'sudo apt-get install -y'
elif program_exists('yu... | from fabric.api import env, sudo, run
from fabtask.utils import program_exists, is_linux, is_macos
def find_package_management_program():
if env.get('install_package_command'):
return
if is_linux():
if program_exists('apt-get'):
env.install_package_command = 'sudo apt-get install -y'
elif program_exists('yu... | mit | Python |
1670b9ae583ae151ea6aeb2ac09c468cfc30f266 | fix homebrew issues | yejianye/fabtask | fabtask/packages.py | fabtask/packages.py | from fabric.api import env, sudo, run, settings
from fabtask.utils import program_exists, is_linux, is_macos
class PackageError(Exception):
pass
def find_package_management_program():
if env.get('install_package_command'):
return
if is_linux():
if program_exists('apt-get'):
env... | from fabric.api import env, sudo, run
from fabtask.utils import program_exists, is_linux, is_macos
def find_package_management_program():
if env.get('install_package_command'):
return
if is_linux():
if program_exists('apt-get'):
env.install_package_command = 'sudo apt-get install -y'
elif program_exists('yu... | mit | Python |
b85307aed2a2f909674734a5f5b84e353701eaaf | update version to 0.7.7 | sahlinet/fastapp,sahlinet/fastapp,sahlinet/fastapp,sahlinet/fastapp | fastapp/__init__.py | fastapp/__init__.py | __version__ = "0.7.7"
import os
from django.core.exceptions import ImproperlyConfigured
# load plugins
from django.conf import settings
try:
plugins_config = getattr(settings, "FASTAPP_PLUGINS_CONFIG", {})
plugins = plugins_config.keys()
plugins = plugins + getattr(settings, "FASTAPP_PLUGINS", [])
fo... | __version__ = "0.7.6"
import os
from django.core.exceptions import ImproperlyConfigured
# load plugins
from django.conf import settings
try:
plugins_config = getattr(settings, "FASTAPP_PLUGINS_CONFIG", {})
plugins = plugins_config.keys()
plugins = plugins + getattr(settings, "FASTAPP_PLUGINS", [])
fo... | mit | Python |
67ea1674184bd71a88019575a2cc61388b6ac26d | Move an import statement | City-of-Helsinki/django-helusers,City-of-Helsinki/django-helusers | helusers/management/commands/sync_helusers.py | helusers/management/commands/sync_helusers.py | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand
from allauth.socialaccount.models import SocialApp
from helusers.providers.helsinki.provider import HelsinkiProvider
class Command(BaseCommand):
help = 'Create or update hel... | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand
from django.contrib.sites.models import Site
from allauth.socialaccount.models import SocialApp
from helusers.providers.helsinki.provider import HelsinkiProvider
class Command(B... | bsd-2-clause | Python |
45256880a063e99ea40944044b2acfabf4fc7af1 | change media list key to 'media_list' | Mobii/twilio-python,YeelerG/twilio-python,johannakate/twilio-python,Rosy-S/twilio-python,twilio/twilio-python,tysonholub/twilio-python,supermanheng21/twilio-python,bcorwin/twilio-python | twilio/rest/resources/media.py | twilio/rest/resources/media.py | from twilio.rest.resources import InstanceResource, ListResource
from twilio.rest.resources.util import normalize_dates, parse_date
class Media(InstanceResource):
""" Represents media associated with a :class:`Message`.
.. attribute:: sid
A 34 character string that uniquely identifies this resource.... | from twilio.rest.resources import InstanceResource, ListResource
from twilio.rest.resources.util import normalize_dates, parse_date
class Media(InstanceResource):
""" Represents media associated with a :class:`Message`.
.. attribute:: sid
A 34 character string that uniquely identifies this resource.... | mit | Python |
e3b457c141ee4258db4a1b71b8632cee4f1bc929 | Change frequency per server | UPOLSearch/UPOL-Search-Engine,UPOLSearch/UPOL-Search-Engine,UPOLSearch/UPOL-Search-Engine,UPOLSearch/UPOL-Search-Engine | upol_search_engine/__main__.py | upol_search_engine/__main__.py | from datetime import datetime
from time import sleep
from upol_search_engine.upol_crawler import tasks
def main():
blacklist = """portal.upol.cz
stag.upol.cz
library.upol.cz
adfs.upol.cz
portalbeta.upol.cz
idp.upol.cz
famaplus.upol.cz
es.upol.cz
smlouvy.upol.cz
menza.upol.cz
... | from datetime import datetime
from time import sleep
from upol_search_engine.upol_crawler import tasks
def main():
blacklist = """portal.upol.cz
stag.upol.cz
library.upol.cz
adfs.upol.cz
portalbeta.upol.cz
idp.upol.cz
famaplus.upol.cz
es.upol.cz
smlouvy.upol.cz
menza.upol.cz
... | mit | Python |
76abfd7914b5521cd3d59308adbb2a7049aaf50b | add comment that version is a required field | MyPureCloud/developercenter-tutorials,MyPureCloud/developercenter-tutorials,MyPureCloud/developercenter-tutorials,MyPureCloud/developercenter-tutorials,MyPureCloud/developercenter-tutorials,MyPureCloud/developercenter-tutorials,MyPureCloud/developercenter-tutorials,MyPureCloud/developercenter-tutorials | user-management/python/user.py | user-management/python/user.py | import time
import PureCloudPlatformClientV2, os
from PureCloudPlatformClientV2.rest import ApiException
from pprint import pprint
# Credentials
CLIENT_ID = os.environ['GENESYS_CLOUD_CLIENT_ID']
CLIENT_SECRET = os.environ['GENESYS_CLOUD_CLIENT_SECRET']
ORG_REGION = os.environ['GENESYS_CLOUD_REGION'] # eg. us_east_1
... | import time
import PureCloudPlatformClientV2, os
from PureCloudPlatformClientV2.rest import ApiException
from pprint import pprint
# Credentials
CLIENT_ID = os.environ['GENESYS_CLOUD_CLIENT_ID']
CLIENT_SECRET = os.environ['GENESYS_CLOUD_CLIENT_SECRET']
ORG_REGION = os.environ['GENESYS_CLOUD_REGION'] # eg. us_east_1
... | mit | Python |
fbabf15f1db758c732b5be3a485f039d7c2a82dd | Simplify connecting to rmake servers by defaulting in the correct port, not using the user + password when connecting to a unix socket (your unix user is used instead) and defaulting to the local connection. | sassoftware/rmake3,sassoftware/rmake3,sassoftware/rmake3,sassoftware/rmake,sassoftware/rmake,sassoftware/rmake | rmake_plugins/multinode_client/build/buildcfg.py | rmake_plugins/multinode_client/build/buildcfg.py | #
# Copyright (c) 2007 rPath, Inc. All Rights Reserved.
#
import urllib
from conary.lib import cfgtypes
from rmake.build import buildcfg
from rmake.lib import apiutils
class BuildContext(object):
rmakeUrl = (cfgtypes.CfgString, 'unix:///var/lib/rmake/socket')
rmakeUser = (buildcfg.CfgUser, None)
client... | #
# Copyright (c) 2007 rPath, Inc. All Rights Reserved.
#
import urllib
from conary.lib import cfgtypes
from rmake.build import buildcfg
from rmake.lib import apiutils
class BuildContext(object):
rmakeUrl = (cfgtypes.CfgString, 'https://localhost:9999')
rmakeUser = (buildcfg.CfgUser, None)
clientCert =... | apache-2.0 | Python |
4b9e86c1547f1513e42e443668d7998b8ae03b3c | Remove unneeded code | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline | rnacentral_pipeline/databases/ensembl/databases.py | rnacentral_pipeline/databases/ensembl/databases.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2018] EMBL-European Bioinformatics Institute
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... | # -*- coding: utf-8 -*-
"""
Copyright [2009-2018] EMBL-European Bioinformatics Institute
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... | apache-2.0 | Python |
d25a5f7d2f3916eb4c9f047309edb22c716ce346 | Fix invalid import issue | vv-p/jira-reports,vv-p/jira-reports | filters/__init__.py | filters/__init__.py | from .filters import cleanup, fix_emoji
| from filters import cleanup, fix_emoji
| mit | Python |
9312d59cdb1e2df0a4d6142a55dbd6dc046edea5 | split long line | googlearchive/cloud-playground,silverlinings/cloud-playground,googlearchive/cloud-playground,silverlinings/cloud-playground,silverlinings/cloud-playground,googlearchive/cloud-playground,googlearchive/cloud-playground | appengine_config.py | appengine_config.py | """App Engine configuration file."""
import os
import re
import sys
# append 'mimic' directory to sys.path
DIRNAME = os.path.dirname(os.path.abspath(__file__)
sys.path.append(os.path.join(DIRNAME, 'mimic'))
from __mimic import common
from __mimic import datastore_tree
from __mimic import mimic
import caching_urlfet... | """App Engine configuration file."""
import os
import re
import sys
# append 'mimic' directory to sys.path
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'mimic'))
from __mimic import common
from __mimic import datastore_tree
from __mimic import mimic
import caching_urlfetch_tree
import se... | apache-2.0 | Python |
03c0bc1c23e622afbe66c0ba166fe2baaddb5750 | Bump version | racker/fleece,racker/fleece | fleece/__about__.py | fleece/__about__.py | """Fleece package attributes and metadata."""
__all__ = (
'__title__',
'__summary__',
'__author__',
'__email__',
'__license__',
'__version__',
'__copyright__',
'__url__',
)
__title__ = 'fleece'
__summary__ = 'Wrap the lamb...da'
__author__ = 'Rackers'
__email__ = 'bruce.stringer@racksp... | """Fleece package attributes and metadata."""
__all__ = (
'__title__',
'__summary__',
'__author__',
'__email__',
'__license__',
'__version__',
'__copyright__',
'__url__',
)
__title__ = 'fleece'
__summary__ = 'Wrap the lamb...da'
__author__ = 'Rackers'
__email__ = 'bruce.stringer@racksp... | apache-2.0 | Python |
2c9c6ad9ee808fa27f1d52c280e6501f1d712921 | Prepare v1.2.234.dev | Flexget/Flexget,OmgOhnoes/Flexget,LynxyssCZ/Flexget,sean797/Flexget,Flexget/Flexget,Danfocus/Flexget,malkavi/Flexget,spencerjanssen/Flexget,OmgOhnoes/Flexget,Pretagonist/Flexget,ianstalk/Flexget,tobinjt/Flexget,tobinjt/Flexget,Danfocus/Flexget,oxc/Flexget,crawln45/Flexget,jawilson/Flexget,lildadou/Flexget,ratoaq2/Flexg... | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | mit | Python |
462cfe2f406deaafd320402bd8209e0261f9aa3e | Prepare v2.8.1.dev | OmgOhnoes/Flexget,LynxyssCZ/Flexget,JorisDeRieck/Flexget,LynxyssCZ/Flexget,sean797/Flexget,OmgOhnoes/Flexget,LynxyssCZ/Flexget,JorisDeRieck/Flexget,malkavi/Flexget,drwyrm/Flexget,jacobmetrick/Flexget,Flexget/Flexget,jacobmetrick/Flexget,JorisDeRieck/Flexget,Flexget/Flexget,malkavi/Flexget,Danfocus/Flexget,jawilson/Flex... | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | mit | Python |
ec918563683f8c4c1898f1c575cce2c817a38c52 | Prepare v3.2.12.dev | crawln45/Flexget,Flexget/Flexget,crawln45/Flexget,crawln45/Flexget,Flexget/Flexget,Flexget/Flexget,crawln45/Flexget,Flexget/Flexget | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | mit | Python |
500cd2b709599fbe33dd9d1df37cfaa862f4449e | Prepare v1.2.427.dev | cvium/Flexget,qk4l/Flexget,JorisDeRieck/Flexget,Flexget/Flexget,antivirtel/Flexget,OmgOhnoes/Flexget,qvazzler/Flexget,oxc/Flexget,Danfocus/Flexget,oxc/Flexget,Flexget/Flexget,tobinjt/Flexget,sean797/Flexget,qk4l/Flexget,jacobmetrick/Flexget,jawilson/Flexget,lildadou/Flexget,JorisDeRieck/Flexget,gazpachoking/Flexget,qva... | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | mit | Python |
649f496c937680a22cab63b8b327cf394610b590 | Prepare v1.2.423.dev | OmgOhnoes/Flexget,lildadou/Flexget,jawilson/Flexget,dsemi/Flexget,ianstalk/Flexget,tobinjt/Flexget,tsnoam/Flexget,Flexget/Flexget,qvazzler/Flexget,drwyrm/Flexget,drwyrm/Flexget,poulpito/Flexget,qk4l/Flexget,JorisDeRieck/Flexget,crawln45/Flexget,Danfocus/Flexget,JorisDeRieck/Flexget,Pretagonist/Flexget,qvazzler/Flexget,... | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | mit | Python |
f5cb6c46dc27390feef032b42ea5e23bc7925246 | Add random_alphanumeric fixture | igboyes/virtool,igboyes/virtool,virtool/virtool,virtool/virtool | virtool/tests/fixtures/core.py | virtool/tests/fixtures/core.py | import pytest
import datetime
import virtool.web.dispatcher
@pytest.fixture
def test_random_alphanumeric(monkeypatch):
class RandomAlphanumericTester:
def __init__(self):
self.choices = [
"aB67nm89jL56hj34AL90",
"fX1l90Rt45JK34bA7890",
"kl84Fg06... | import pytest
import datetime
import virtool.web.dispatcher
@pytest.fixture
def static_time(monkeypatch):
time = datetime.datetime(2017, 10, 6, 20, 0, 0, tzinfo=datetime.timezone.utc)
monkeypatch.setattr("virtool.utils.timestamp", lambda: time)
return time
@pytest.fixture
def test_dispatch(mocker, mon... | mit | Python |
75f46292a8dccb04e233986c18e415dbfffb9e68 | Fix calls to reverse | takeflight/wagtailvideos,takeflight/wagtailvideos,takeflight/wagtailvideos | wagtailvideos/wagtail_hooks.py | wagtailvideos/wagtail_hooks.py | from django.conf.urls import include, url
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.urls import reverse
from django.utils.html import format_html, format_html_join
from django.utils.translation import ugettext_lazy as _
from wagtail.admin.menu import MenuItem
from wagtail.core i... | from django.conf.urls import include, url
from django.contrib.staticfiles.templatetags.staticfiles import static
from django import urls
from django.utils.html import format_html, format_html_join
from django.utils.translation import ugettext_lazy as _
from wagtail.admin.menu import MenuItem
from wagtail.core import ho... | bsd-3-clause | Python |
5653403e04cfcb00ebecb93659cb6e0725fa5415 | drop unnecessary constants and rename quantum -> tacker | stackforge/tacker,openstack/tacker,openstack/tacker,priya-pp/Tacker,zeinsteinz/tacker,stackforge/tacker,SripriyaSeetharam/tacker,openstack/tacker,SripriyaSeetharam/tacker,trozet/tacker,zeinsteinz/tacker,priya-pp/Tacker,trozet/tacker | tacker/common/constants.py | tacker/common/constants.py | # Copyright (c) 2012 OpenStack Foundation.
#
# 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... | # Copyright (c) 2012 OpenStack Foundation.
#
# 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... | apache-2.0 | Python |
853a53c23b2320554c1491884c41700bbedb1214 | add explicit django_admin = False to context | henzk/django-productline,henzk/django-productline | django_productline/features/djpladmin/context_processors.py | django_productline/features/djpladmin/context_processors.py | from django.conf import settings
def django_admin(request):
'''
Adds additional information to the context:
``django_admin`` - boolean variable indicating whether the current
page is part of the django admin or not.
``ADMIN_URL`` - normalized version of settings.ADMIN_URL; starts with a slash, en... | from django.conf import settings
def django_admin(request):
'''
Adds additional information to the context:
``django_admin`` - boolean variable indicating whether the current
page is part of the django admin or not.
``ADMIN_URL`` - normalized version of settings.ADMIN_URL; starts with a slash, en... | mit | Python |
4e65ec43ecdd30495e1e9da41ddfa3374d6ba7ac | remove a stray semicolon | gkralik/lightspeed | util/create_database.py | util/create_database.py | #!/usr/bin/env python
import os
import sys
import sqlite3
base_dir = os.path.dirname(os.path.realpath(os.path.join(__file__, '..')))
db_path = os.path.join(base_dir, 'db/lightspeed.db')
if len(sys.argv) == 2:
db_path = os.path.realpath(sys.argv[1])
try:
conn = sqlite3.connect(db_path)
c = conn.cursor()
... | #!/usr/bin/env python
import os
import sys
import sqlite3
base_dir = os.path.dirname(os.path.realpath(os.path.join(__file__, '..')))
db_path = os.path.join(base_dir, 'db/lightspeed.db')
if len(sys.argv) == 2:
db_path = os.path.realpath(sys.argv[1])
try:
conn = sqlite3.connect(db_path)
c = conn.cursor();
... | mit | Python |
13bc65adf712841375d08bf717d7e56743a3c592 | fix error 500 plugin detail if user not authenticated | ava-project/ava-website,ava-project/ava-website,ava-project/ava-website | website/apps/plugins/models.py | website/apps/plugins/models.py | from django.contrib.auth.models import User
from django.db import models
from django.urls import reverse
from model_utils.models import TimeStampedModel
from core.behaviors import Expirationable
from main.utils import generate_token
class Plugin(TimeStampedModel, models.Model):
name = models.CharField(max_length... | from django.contrib.auth.models import User
from django.db import models
from django.urls import reverse
from model_utils.models import TimeStampedModel
from core.behaviors import Expirationable
from main.utils import generate_token
class Plugin(TimeStampedModel, models.Model):
name = models.CharField(max_length... | mit | Python |
6bf12c141bab4c698d0324d3ef006ae2d14e6f16 | FIX migration script | ingadhoc/product,ingadhoc/product | product_uom_prices_currency/migrations/8.0.0.5.0/post-migration.py | product_uom_prices_currency/migrations/8.0.0.5.0/post-migration.py | # -*- encoding: utf-8 -*-
from openerp import SUPERUSER_ID
from openerp.modules.registry import RegistryManager
def migrate(cr, version):
print 'Migrating product_uom_prices'
if not version:
return
create_product_sale_uom(cr)
def create_product_sale_uom(cr):
registry = RegistryManager.get(cr... | # -*- encoding: utf-8 -*-
from openerp import SUPERUSER_ID
from openerp.modules.registry import RegistryManager
def migrate(cr, version):
print 'Migrating product_uom_prices'
if not version:
return
create_product_sale_uom(cr)
def create_product_sale_uom(cr):
registry = RegistryManager.get(cr... | agpl-3.0 | Python |
7b656aa3d244628a26730658468e02781cf444e6 | Add FeaturedProject to admin | OpenHumans/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans | private_sharing/admin.py | private_sharing/admin.py | from django.contrib import admin
from . import models
class DataRequestProjectMemberAdmin(admin.ModelAdmin):
"""
Display and make the 'created' field read-only in the admin interface.
"""
readonly_fields = ('created',)
search_fields = ('member__user__username',
'project_memb... | from django.contrib import admin
from . import models
class DataRequestProjectMemberAdmin(admin.ModelAdmin):
"""
Display and make the 'created' field read-only in the admin interface.
"""
readonly_fields = ('created',)
search_fields = ('member__user__username',
'project_memb... | mit | Python |
2fac5416468269df246c1f676838797f8326b427 | Prepare 1.3.0 release | antechrestos/cf-python-client | main/cloudfoundry_client/__init__.py | main/cloudfoundry_client/__init__.py | """
This module provides a client library for cloudfoundry_client v2.
"""
__version__ = "1.3.0"
| """
This module provides a client library for cloudfoundry_client v2.
"""
__version__ = "1.2.0"
| apache-2.0 | Python |
ff2837c53d3f43256b9d22b130eb044ac0f56949 | Update common.py | frydaykg/Pell | common.py | common.py | def checkPellSolution(x,y,n):
return x*x - n*y*y == 1
def getContinuedFraction(val):
a = [ int(val) ]
x = [ val - a[0] ]
yield a[0]
while True:
a.append(int(1/x[-1]))
x.append(1/x[-1]-a[-1])
yield a[-1]
| def checkPellSolution(x,y,n):
return x*x - n*y*y == 1
def getContinuedFraction(val):
a = [ int(val) ]
x = [ val - a[0] ]
yield a[0]
while True:
a.append(int(1/x[-1]))
xx.append(1/x[-1]-a[-1])
yield a[-1]
| mit | Python |
2cf37282b2675c27b3c7b4f4702b2c3ad57e785c | convert dbus.Struct to tuple. | wistful/pympris | common.py | common.py | #!/usr/bin/env python
# coding=utf-8
from functools import wraps
import dbus
MPRIS_NAME_PREFIX = "org.mpris.MediaPlayer2"
MPRIS_OBJECT_PATH = "/org/mpris/MediaPlayer2"
IROOT = "org.mpris.MediaPlayer2"
IPLAYER = IROOT + ".Player"
ITRACKLIST = IROOT + ".TrackList"
IPLAYLISTS = IROOT + ".PlayLists"
IPROPERTIES = "org.fr... | #!/usr/bin/env python
# coding=utf-8
from functools import wraps
import dbus
MPRIS_NAME_PREFIX = "org.mpris.MediaPlayer2"
MPRIS_OBJECT_PATH = "/org/mpris/MediaPlayer2"
IROOT = "org.mpris.MediaPlayer2"
IPLAYER = IROOT + ".Player"
ITRACKLIST = IROOT + ".TrackList"
IPLAYLISTS = IROOT + ".PlayLists"
IPROPERTIES = "org.fr... | mit | Python |
fa9aea2e3f4301dd8bdb8bb4680c6c3c669a8efb | Update adapter_16mers.py | hackseq/2017_project_6,hackseq/2017_project_6,hackseq/2017_project_6,hackseq/2017_project_6 | select_random_subset/adapter_16mers.py | select_random_subset/adapter_16mers.py |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 21 14:15:18 2017
@author: nikka.keivanfar
"""
#to do: fasta as input
P5 = 'AATGATACGGCGACCACCGA'
P7 = 'CAAGCAGAAGACGGCATACGAGAT'
read1 = 'GATCTACACTCTTTCCCTACACGACGCTC'
read2 = 'GTGACTGGAGTTCAGACGTGT'
adapters = [P5, P7, read1, read2] #to do: s... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 21 14:15:18 2017
@author: nikka.keivanfar
"""
#see also: adapters.fa
P5 = 'AATGATACGGCGACCACCGA'
P7 = 'CAAGCAGAAGACGGCATACGAGAT'
read1 = 'GATCTACACTCTTTCCCTACACGACGCTC'
read2 = 'GTGACTGGAGTTCAGACGTGT'
adapters = [P5, P7, read1, read2] #to do: s... | mit | Python |
c4809f9f43129d092235738127b90dc62f593fb8 | Remove some commented out code | tswicegood/steinie,tswicegood/steinie | steinie/app.py | steinie/app.py | from werkzeug import routing
from werkzeug import serving
from werkzeug import wrappers
from . import routes
class Steinie(routes.Router):
def __init__(self, host="127.0.0.1", port=5151, debug=False):
self.host = host
self.port = port
self.debug = debug
super(Steinie, self).__init... | from werkzeug import routing
from werkzeug import serving
from werkzeug import wrappers
from . import routes
class Steinie(routes.Router):
def __init__(self, host="127.0.0.1", port=5151, debug=False):
self.host = host
self.port = port
self.debug = debug
super(Steinie, self).__init... | apache-2.0 | Python |
1e931e9aac18f393de786894d9e26ecccc251135 | Fix girder_work script bug: PEP 263 is not compatible with exec | ImageMarkup/isic-archive,ImageMarkup/isic-archive,ImageMarkup/isic-archive,ImageMarkup/isic-archive | server/models/_generate_superpixels.py | server/models/_generate_superpixels.py | ###############################################################################
# Copyright Kitware 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/lic... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | apache-2.0 | Python |
49cd6b9175ef529cbf0994117a25928f33a8b73e | Read simple_script | techtonik/pydotorg.pypi,techtonik/pydotorg.pypi | config.py | config.py | import ConfigParser
class Config:
''' Read in the config and set up the vars with the correct type.
'''
def __init__(self, configfile, name):
# "name" argument no longer used
c = ConfigParser.ConfigParser()
c.read(configfile)
self.database_name = c.get('database', 'name')
... | import ConfigParser
class Config:
''' Read in the config and set up the vars with the correct type.
'''
def __init__(self, configfile, name):
# "name" argument no longer used
c = ConfigParser.ConfigParser()
c.read(configfile)
self.database_name = c.get('database', 'name')
... | bsd-3-clause | Python |
9d0ffbe216296fac2bec6f28147431fec607d8b1 | Fix require_admin | JokerQyou/bot | config.py | config.py | # coding: utf-8
import json
from redis_wrap import get_hash, get_list
__config__ = 'config.json'
with open(__config__, 'r') as cfr:
config = json.loads(cfr.read())
PATH = '/%s' % '/'.join(config.get('server').replace('https://', '').replace('http://', '').split('/')[1:])
TOKEN = config.get('token')
SERVER = con... | # coding: utf-8
import json
from redis_wrap import get_hash, get_list
__config__ = 'config.json'
with open(__config__, 'r') as cfr:
config = json.loads(cfr.read())
PATH = '/%s' % '/'.join(config.get('server').replace('https://', '').replace('http://', '').split('/')[1:])
TOKEN = config.get('token')
SERVER = con... | bsd-2-clause | Python |
5db9297ced5dd310899fd3b5072c670339cffd37 | fix with syntax | fwilson42/dchacks2015,fwilson42/dchacks2015,fwilson42/dchacks2015 | config.py | config.py | import json
import utils.metro
with open("config.json") as f:
config = json.load(f)
redis_info = {"host": config["REDIS_HOST"], "password": config["REDIS_PASSWORD"]}
wmata = utils.metro.MetroApi(config["API_KEY"], **redis_info)
| import json
import utils.metro
with f as open("config.json"):
config = json.load(f)
redis_info = {"host": config["REDIS_HOST"], "password": config["REDIS_PASSWORD"]}
wmata = utils.metro.MetroApi(config["API_KEY"], **redis_info)
| mit | Python |
69ff6726b6a25b585f9f9631408bd2191d98d36f | add some docstrings | dude-pa/dude | config.py | config.py | import os.path
API_AI_TOKEN = 'caca38e8d99d4ea6bd9ffa9a8be15ff9'
API_AI_SESSION_ID = 'dd60fde7-c6ab-4f38-9487-7300c42b4916'
# this is where yoda's config will be stored
YODA_CONFIG_FILE_PATH = os.path.join(os.path.expanduser('~'), '.yodaconfig')
DEFAULT_CONFIG_PATH = os.path.join(os.path.expanduser('~'), '.yoda')
... | import os.path
API_AI_TOKEN = 'caca38e8d99d4ea6bd9ffa9a8be15ff9'
API_AI_SESSION_ID = 'dd60fde7-c6ab-4f38-9487-7300c42b4916'
# this is where yoda's config will be stored
YODA_CONFIG_FILE_PATH = os.path.join(os.path.expanduser('~'), '.yodaconfig')
DEFAULT_CONFIG_PATH = os.path.join(os.path.expanduser('~'), '.yoda')
... | mit | Python |
685f6e63062fcac3b7cefec40aa661c1c6fcb88a | set mongodb uri to env var | buck06191/bcmd-web,buck06191/bcmd-web,buck06191/bcmd-web,buck06191/bcmd-web,buck06191/bcmd-web | config.py | config.py | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
DEBUG = False
TESTING = False
CSRF_ENABLED = True
SECRET_KEY = os.environ['SECRET_KEY']
MONGOLAB_DB_URI = os.environ['MONGODB_URI']
class ProductionConfig(Config):
DEBUG = False
class StagingConfig(Config)... | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
DEBUG = False
TESTING = False
CSRF_ENABLED = True
SECRET_KEY = os.environ['SECRET_KEY']
class ProductionConfig(Config):
DEBUG = False
class StagingConfig(Config):
DEVELOPMENT = True
DEBUG = True
clas... | mit | Python |
dee622f86ec8184ad5cc00f9564eee34ee8626e6 | Add color, cursor hiding. Ugly! | erikrose/conway | conway.py | conway.py | #!/usr/bin/env python
import atexit
from itertools import chain
from sys import stdout
from time import sleep
from blessings import Terminal
def main():
"""Play Conway's Game of Life on the terminal."""
def die((x, y)):
if (x < 0 or x >= term.width or
y < 0 or y >= term.height):
... | #!/usr/bin/env python
from itertools import chain
from sys import stdout
from time import sleep
from blessings import Terminal
def main():
"""Play Conway's Game of Life on the terminal."""
def die((x, y)):
if (x < 0 or x >= term.width or
y < 0 or y >= term.height):
return None... | mit | Python |
caa575a8b564518e553d803b5dfeea0995a21d7a | Add lists property to Lists | joshua-stone/DerPyBooru | derpibooru/Lists.py | derpibooru/Lists.py |
class Lists(object)
def __init__(self, lists, page=1, last="", comments=False, fav=False, key=""):
self.__parameters = {}
@property
def hostname()
return("https://derpiboo.ru")
@property
def parameters(self):
return(self.__parameters)
@property
def lists():
lists = {
0: "index",... |
class Lists(object)
def __init__(self, page=1, last="", comments=False, fav=False, key=""):
self.__parameters = {}
@property
def hostname()
return("https://derpiboo.ru")
@property
def parameters(self):
return(self.__parameters)
@property
def page(self):
return(self.parameters["page"])... | bsd-2-clause | Python |
7c419c1e0b34169e02d47653655a00c74cedecf1 | add a comment to test_documentation.py | freeslugs/eventum,freeslugs/eventum,freeslugs/eventum,freeslugs/eventum | test/test_documentation.py | test/test_documentation.py | import os
import unittest
from fnmatch import fnmatch
from sys import path
path.append('../')
class TestDocumentation(unittest.TestCase):
APP_ROOT = os.path.abspath(os.path.join(os.getcwd(), os.pardir))
EXCLUDES = set(open('../.gitignore').read().split('\n') + ['.git'])
README = 'README.md'
def tes... | import os
import unittest
from fnmatch import fnmatch
from sys import path
path.append('../')
class TestDocumentation(unittest.TestCase):
APP_ROOT = os.path.abspath(os.path.join(os.getcwd(), os.pardir))
EXCLUDES = set(open('../.gitignore').read().split('\n') + ['.git'])
README = 'README.md'
def tes... | mit | Python |
d08c6b849d19549df9d1a179f187f44370c572a8 | bump version to 1.0.3 | uber/doubles | doubles/__init__.py | doubles/__init__.py | __version__ = '1.0.3'
from doubles.class_double import ClassDouble # noqa
from doubles.instance_double import InstanceDouble # noqa
from doubles.object_double import ObjectDouble # noqa
from doubles.targets.allowance_target import allow # noqa
from doubles.targets.expectation_target import expect # noqa
from doub... | __version__ = '1.0.2'
from doubles.class_double import ClassDouble # noqa
from doubles.instance_double import InstanceDouble # noqa
from doubles.object_double import ObjectDouble # noqa
from doubles.targets.allowance_target import allow # noqa
from doubles.targets.expectation_target import expect # noqa
from doub... | mit | Python |
a79a3f7c42c858ae42c618479654cd7589de05b9 | Remove unused tests for hash map | alexrudy/Zeeko,alexrudy/Zeeko | zeeko/utils/tests/test_hmap.py | zeeko/utils/tests/test_hmap.py | # -*- coding: utf-8 -*-
import pytest
from ..hmap import HashMap
@pytest.fixture(params=[0,1,5,9])
def n(request):
"""Number of items"""
return request.param
@pytest.fixture
def items(n):
"""A list of strings."""
return ["item{0:d}".format(i) for i in range(n)]
| # -*- coding: utf-8 -*-
import pytest
from ..hmap import HashMap
@pytest.fixture(params=[0,1,5,9])
def n(request):
"""Number of items"""
return request.param
@pytest.fixture
def items(n):
"""A list of strings."""
return ["item{0:d}".format(i) for i in range(n)]
@pytest.mark.skip
def test_hmap(items)... | bsd-3-clause | Python |
7b30a1036f67ef6bc41b1c65cd610346080aecff | Fix identation | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | nodeconductor/core/authentication.py | nodeconductor/core/authentication.py | from __future__ import unicode_literals
from django.conf import settings
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
import rest_framework.authentication
from rest_framework import exceptions
import nodeconductor.logging.middleware
TOKEN_KEY = settings.NODECONDUCTOR.get... | from __future__ import unicode_literals
from django.conf import settings
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
import rest_framework.authentication
from rest_framework import exceptions
import nodeconductor.logging.middleware
TOKEN_KEY = settings.NODECONDUCTOR.get... | mit | Python |
9d797a9a0ad6e3e552d4cdbb385b7521c38327fe | update the example | xsank/Pyeventbus,xsank/Pyeventbus | example/myeventbus.py | example/myeventbus.py | __author__ = 'Xsank'
import time
from eventbus.eventbus import EventBus
from myevent import GreetEvent
from myevent import ByeEvent
from mylistener import MyListener
if __name__=="__main__":
eventbus=EventBus()
eventbus.register(MyListener())
ge=GreetEvent('world')
be=ByeEvent('world')
eventbus.a... | __author__ = 'Xsank'
import time
from eventbus.eventbus import EventBus
from myevent import GreetEvent
from myevent import ByeEvent
from mylistener import MyListener
if __name__=="__main__":
eventbus=EventBus()
eventbus.register(MyListener())
ge=GreetEvent('world')
be=ByeEvent('world')
eventbus.a... | mit | Python |
ee954e6c221f4d78a2dcaf6607837fa62892ae37 | Add more tests | openfisca/openfisca-core,openfisca/openfisca-core | openfisca_core/tests/test_periods.py | openfisca_core/tests/test_periods.py | # -*- coding: utf-8 -*-
from nose.tools import assert_equal, raises
from openfisca_core.periods import Period, Instant, YEAR, MONTH, period
first_jan = Instant((2014, 1, 1))
first_march = Instant((2014, 3, 1))
# Test Period -> String
def test_year():
assert_equal(unicode(Period((YEAR, first_jan, 1))), u'2014'... | # -*- coding: utf-8 -*-
from nose.tools import assert_equal, raises
from openfisca_core.periods import Period, Instant, YEAR, MONTH, period
first_jan = Instant((2014, 1, 1))
first_march = Instant((2014, 3, 1))
# Test Period -> String
def test_year():
assert_equal(unicode(Period((YEAR, first_jan, 1))), u'2014'... | agpl-3.0 | Python |
8481002f71c3d51d4550841d49a02d85062aabc4 | Fix examples (#357) | arviz-devs/arviz,arviz-devs/arviz,arviz-devs/arviz,arviz-devs/arviz | examples/plot_pair.py | examples/plot_pair.py | """
Pair Plot
=========
_thumb: .2, .5
"""
import arviz as az
az.style.use('arviz-darkgrid')
centered = az.load_arviz_data('centered_eight')
coords = {'school': ['Choate', 'Deerfield']}
az.plot_pair(centered, var_names=['theta', 'mu', 'tau'], coords=coords, divergences=True, textsize=22)
| """
Pair Plot
=========
_thumb: .2, .5
"""
import arviz as az
az.style.use('arviz-darkgrid')
centered = az.load_arviz_data('centered_eight')
coords = {'school': ['Choate', 'Deerfield']}
az.plot_pair(data, var_names=['theta', 'mu', 'tau'], coords=coords, divergences=True, textsize=22)
| apache-2.0 | Python |
5f193bb791947fe1195e2aebf00eb3d127247d10 | Document why title tag is omitted | ento/elm-doc,ento/elm-doc | src/elm_doc/tasks/html.py | src/elm_doc/tasks/html.py | import json
import html
from pathlib import Path
from elm_doc.utils import Namespace
# Note: title tag is omitted, as the Elm app sets the title after
# it's initialized.
PAGE_TEMPLATE = '''
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" size="16x16, 32x32, 48x48, 64x64, 128... | import json
import html
from pathlib import Path
from elm_doc.utils import Namespace
PAGE_TEMPLATE = '''
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" size="16x16, 32x32, 48x48, 64x64, 128x128, 256x256" href="{mount_point}/assets/favicon.ico">
<link rel="stylesheet" hre... | bsd-3-clause | Python |
4951b6fdb9702d6b13ce58d91ebdfebe2d7f232f | Make tests pass | ibab/datapipe | tests/tests.py | tests/tests.py | import logging
logger = logging.getLogger('datapipe')
logger.setLevel(logging.WARN)
from datapipe import *
from datapipe.targets.mock import *
class TestTask(Task):
inp = Input()
def outputs(self):
outs = []
for i, elem in enumerate(self.inp):
outs.append(MockTarget('out_{}'.forma... | import logging
logger = logging.getLogger('datapipe')
logger.setLevel(logging.WARN)
from datapipe import *
from datapipe.targets.mock import *
class TestTask(Task):
inp = Input()
def outputs(self):
outs = []
for i, elem in enumerate(self.inp):
outs.append(MockTarget('out_{}'.forma... | mit | Python |
2af686c117ce4ced82809b08457122abf7626144 | Use resolution=None | guziy/basemap,matplotlib/basemap,matplotlib/basemap,guziy/basemap | examples/warpimage.py | examples/warpimage.py | import pylab as P
import Image as I
from matplotlib.toolkits.basemap import Basemap
# shows how to warp an image from one map projection to another.
# Uses PIL.
# Download image from
# http://www.space-graphics.com/earth_topo-bathy.htm,
# convert from jpg to png.
# read in png image to rgba array of normalized floats.... | import pylab as P
import Image as I
from matplotlib.toolkits.basemap import Basemap
# shows how to warp an image from one map projection to another.
# Uses PIL.
# Download image from
# http://www.space-graphics.com/earth_topo-bathy.htm,
# convert from jpg to png.
# read in png image to rgba array of normalized floats.... | mit | Python |
faeba554cc62b80687b4fd1a7c00fcee2933ecf4 | use logger instead of logging (#14) | cosven/feeluown-core | fuocore/dispatch.py | fuocore/dispatch.py | # -*- coding: utf-8 -*-
import weakref
import logging
from weakref import WeakMethod
logger = logging.getLogger(__name__)
class Signal(object):
def __init__(self, name='', *sig):
self.sig = sig
self.receivers = set()
def emit(self, *args):
for receiver in self.receivers:
... | # -*- coding: utf-8 -*-
import weakref
import logging
try:
from weakref import WeakMethod
except ImportError:
from fuocore.backports.weakref import WeakMethod
class Signal(object):
def __init__(self, name='', *sig):
self.sig = sig
self.receivers = set()
def emit(self, *args):
... | mit | Python |
311a858ecbe7d34f9f68a18a3735db9da8b0e692 | Fix global test driver initialization | alisaifee/holmium.core,alisaifee/holmium.core,alisaifee/holmium.core,alisaifee/holmium.core | tests/utils.py | tests/utils.py | import atexit
import tempfile
import sys
import mock
from selenium import webdriver
import os
def build_mock_mapping(name):
mock_driver = mock.Mock()
browser_mapping = {name: mock_driver}
mock_driver.return_value.name = name
return browser_mapping
test_driver = None
def get_driver():
global te... | import atexit
import tempfile
import sys
import mock
from selenium import webdriver
import os
def build_mock_mapping(name):
mock_driver = mock.Mock()
browser_mapping = {name: mock_driver}
mock_driver.return_value.name = name
return browser_mapping
test_driver = None
def get_driver():
global te... | mit | Python |
e83d8edc6c90fd91e68fc4251e7f0532b06ad6fb | Add docstring for ClusterAbstraction | studiawan/pygraphc | pygraphc/clustering/ClusterAbstraction.py | pygraphc/clustering/ClusterAbstraction.py |
class ClusterAbstraction(object):
"""Get cluster abstraction based on longest common substring.
References
----------
.. [1] jtjacques, Longest common substring from more than two strings - Python.
http://stackoverflow.com/questions/2892931/longest-common-substring-from-more-than-two-string... |
class ClusterAbstraction(object):
@staticmethod
def dp_lcs(graph, clusters):
abstraction = {}
for cluster_id, nodes in clusters.iteritems():
data = []
for node_id in nodes:
data.append(graph.node[node_id]['preprocessed_event'])
abstraction[clu... | mit | Python |
395c0a9cbeceb512972b71199dd46661af7fcce2 | Update pcl-reference-assemblies.py | mono/bockbuild,mono/bockbuild | packages/pcl-reference-assemblies.py | packages/pcl-reference-assemblies.py | import glob
import os
import shutil
class PCLReferenceAssembliesPackage(Package):
def __init__(self):
Package.__init__(self,
name='PortableReferenceAssemblies',
version='2013-09-10',
sources=['http://last-hope.baulig.net/misc/mono-... | import glob
import os
import shutil
class PCLReferenceAssembliesPackage(Package):
def __init__(self):
Package.__init__(self,
name='PortableReferenceAssemblies',
version='2013-09-10',
sources=['http://last-hope.baulig.net/misc/mono-... | mit | Python |
de0bb3543d68b65cc61f9449a3c44d48b3920e49 | add flagged and timestamp to admin view | sunlightlabs/django-gatekeeper | gatekeeper/admin.py | gatekeeper/admin.py | from django.contrib import admin
from gatekeeper.models import ModeratedObject
class ModeratedObjectAdmin(admin.ModelAdmin):
list_display = ('object_name', 'timestamp', 'moderation_status', 'flagged')
list_editable = ('moderation_status','flagged')
list_filter = ['moderation_status','flagged','content_type... | from django.contrib import admin
from gatekeeper.models import ModeratedObject
class ModeratedObjectAdmin(admin.ModelAdmin):
list_display = ('object_name', 'moderation_status',)
list_editable = ('moderation_status',)
list_filter = ['moderation_status','flagged','content_type']
def object_name(self, ob... | bsd-3-clause | Python |
b15a79e311c45cd25181b79d9657eedcf5ac3785 | Set version to v6.11.1 | explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc,spacy-io/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.11.1'
__summary__ = "Practical Machine Learning for NLP"
__uri__ = 'https://github.com/explosion/thinc'
__a... | # 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.11.1.dev20'
__summary__ = "Practical Machine Learning for NLP"
__uri__ = 'https://github.com/explosion/thin... | mit | Python |
692584f8cfeb5d75a6d38529ed1029286188a3a9 | Add features_masks array in mock model | rossant/phy,rossant/phy,kwikteam/phy,rossant/phy,kwikteam/phy,kwikteam/phy | phy/cluster/manual/tests/conftest.py | phy/cluster/manual/tests/conftest.py | # -*- coding: utf-8 -*-
"""Test fixtures."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import numpy as np
from pytest import yield_fixture
from phy.electrode.mea import staggered_positions... | # -*- coding: utf-8 -*-
"""Test fixtures."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
from pytest import yield_fixture
from phy.electrode.mea import staggered_positions
from phy.io.array ... | bsd-3-clause | Python |
c2054c2fb0e5af75ffa1ac1305b3fa805f73ae4a | enable persistent cache also on Windows | primiano/depot_tools,CoherentLabs/depot_tools,CoherentLabs/depot_tools,primiano/depot_tools,primiano/depot_tools | recipe_modules/infra_paths/path_config.py | recipe_modules/infra_paths/path_config.py | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import DEPS
CONFIG_CTX = DEPS['path'].CONFIG_CTX
@CONFIG_CTX()
def infra_common(c):
c.dynamic_paths['checkout'] = None
@CONFIG_CTX(includes=['infra_com... | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import DEPS
CONFIG_CTX = DEPS['path'].CONFIG_CTX
@CONFIG_CTX()
def infra_common(c):
c.dynamic_paths['checkout'] = None
@CONFIG_CTX(includes=['infra_com... | bsd-3-clause | Python |
525725fd1578479a4629677bee3eab20e6170839 | Remove documented code | ayushgoel/LongShot | github.py | github.py | import requests
import constants
QUERY = """
query($repository_owner:String!, $repository_name: String!, $count: Int!) {
repository(
owner: $repository_owner,
name: $repository_name) {
refs(last: $count,refPrefix:"refs/tags/") {
edges {
node{
name
}
}
}
... | import requests
import constants
# payload = "{\"query\": \"query($repository: String!) {repository(owner: \\\"talk-to\\\",name: $repository) " \
# "{refs(last: 10,refPrefix:\\\"refs/tags/\\\") {edges {node{name}}}}}\"," \
# "\"variables\": \"{\\\"repository\\\": \\\"Knock\\\"}\"\n\t\n}\n\n"
#
# re... | mit | Python |
ffe55eca7cc58a13f8dd1b9c2da9e8fa05c9f9e5 | add comment | pzankov/hydroctrl | google.py | google.py | #!/usr/bin/env python3
import gspread
from oauth2client.service_account import ServiceAccountCredentials
from datetime import datetime
from os import path
import settings
class GoogleSheet:
"""
Use Google Sheet as online database.
Connection is recreated for each sheet access to avoid timeout issues.
... | #!/usr/bin/env python3
import gspread
from oauth2client.service_account import ServiceAccountCredentials
from datetime import datetime
from os import path
import settings
class GoogleSheet:
"""
Use Google Sheet as online database.
Connection is recreated for each sheet access to avoid timeout issues.
... | mit | Python |
7e4dfdae04af881408ce623c330b7b30f9a63498 | make flake8 happy | liveblog/liveblog,superdesk/liveblog,liveblog/liveblog,superdesk/liveblog,superdesk/liveblog,hlmnrmr/liveblog,liveblog/liveblog,hlmnrmr/liveblog,liveblog/liveblog,hlmnrmr/liveblog,superdesk/liveblog,liveblog/liveblog,hlmnrmr/liveblog | server/liveblog/syndication/exceptions.py | server/liveblog/syndication/exceptions.py | class APIConnectionError(Exception):
pass
class ProducerAPIError(APIConnectionError):
pass
class ConsumerAPIError(APIConnectionError):
pass
| class APIConnectionError(Exception):
pass
class ProducerAPIError(APIConnectionError):
pass
class ConsumerAPIError(APIConnectionError):
pass | agpl-3.0 | Python |
c22ae8b38b2843f9a8c3504c9b89593908a343aa | Fix #267 (#269) | salopensource/sal,sheagcraig/sal,salopensource/sal,sheagcraig/sal,sheagcraig/sal,salopensource/sal,sheagcraig/sal,salopensource/sal | server/plugins/cryptstatus/cryptstatus.py | server/plugins/cryptstatus/cryptstatus.py | import requests
from collections import defaultdict
from requests.exceptions import RequestException
from django.conf import settings
from django.utils.dateparse import parse_datetime
import sal.plugin
import server.utils as utils
class CryptStatus(sal.plugin.DetailPlugin):
description = 'FileVault Escrow Stat... | import requests
from collections import defaultdict
from requests.exceptions import RequestException
from django.conf import settings
from django.utils.dateparse import parse_datetime
import sal.plugin
import server.utils as utils
class CryptStatus(sal.plugin.DetailPlugin):
description = 'FileVault Escrow Stat... | apache-2.0 | Python |
e8da41193238a7c677ec7ff8339095ec3e71be3b | Fix formatting, show total and sort | tracymiranda/pc-scripts,tracymiranda/pc-scripts | track_count.py | track_count.py | from report import *
def show_track_count(S):
print "Track Count".ljust(40) + "\t\tSubmission Count"
items = S.track_count().items()
total = sum([count for (track, count) in items])
for (track, count) in sorted(items, cmp=lambda (a_track, a_count), (b_track, b_count): cmp(b_count, a_count)):
... | from report import *
def show_track_count(S):
print "Track Count\t\tSubmission Count"
for (track, count) in S.track_count().items():
if track:
print "%s\t\t%s" % (track.ljust(20), count)
if __name__ == "__main__":
# S = ALL.standard().vote_cutoff(4.0)
S = ALL.standard().filter(... | epl-1.0 | Python |
0f9f8dfe459ca98f4ea75d4358724cab3c0559bf | add minimal python version for naoth package to setup.py | BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH | Utils/py/naoth/setup.py | Utils/py/naoth/setup.py | #!/usr/bin/python
from setuptools import setup, find_packages
setup(name='naoth',
version='0.3',
author='NaoTH Berlin United',
author_email='nao-team@informatik.hu-berlin.de',
description='Python utils for the NaoTH toolchain',
packages=find_packages(),
zip_safe=False,
setup_... | #!/usr/bin/python
from setuptools import setup, find_packages
setup(name='naoth',
version='0.3',
author='NaoTH Berlin United',
author_email='nao-team@informatik.hu-berlin.de',
description='Python utils for the NaoTH toolchain',
packages=find_packages(),
zip_safe=False,
setup_... | apache-2.0 | Python |
e9cdd0a05a6ea144b029cb893d00aa4caf055c4b | Remove unused imports. | nex3/pygments,nex3/pygments,nex3/pygments,nex3/pygments,nex3/pygments,nex3/pygments,nex3/pygments,nex3/pygments,nex3/pygments,nex3/pygments,nex3/pygments | tests/test_examplefiles.py | tests/test_examplefiles.py | # -*- coding: utf-8 -*-
"""
Pygments tests with example files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
from pygments.lexers import get_lexer_for_filename, get_lexer_by_name
from pygments.... | # -*- coding: utf-8 -*-
"""
Pygments tests with example files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import unittest
from pygments import highlight
from pygments.lexers import get_lexer... | bsd-2-clause | Python |
49feeac25b33ebf79cc103e12d0ed4623c96ec71 | Add transaction.to_hex() test | thibault/btctools | tests/test_transactions.py | tests/test_transactions.py | from __future__ import unicode_literals
import unittest
from transactions import Transaction
class TransactionTests(unittest.TestCase):
def setUp(self):
inputs = [
('b0ff74bb0dd894797153ccb862c9f9a488e657452647ada440fe1006ece95c78', 0),
('683d180645632d45f23baf2fb2897241321c1af7... | from __future__ import unicode_literals
import unittest
from transactions import Transaction
class TransactionTests(unittest.TestCase):
def setUp(self):
inputs = [
('b0ff74bb0dd894797153ccb862c9f9a488e657452647ada440fe1006ece95c78', 0),
('683d180645632d45f23baf2fb2897241321c1af7... | mit | Python |
540498265c706232d645c96c04c774c0b04ccc84 | remove test_featurewise_anomaly_score_notfitted method temporarily | Y-oHr-N/kenchi,Y-oHr-N/kenchi | kenchi/outlier_detection/tests/test_reconstruction_based.py | kenchi/outlier_detection/tests/test_reconstruction_based.py | import unittest
import matplotlib
import matplotlib.axes
import numpy as np
from sklearn.exceptions import NotFittedError
from sklearn.utils.estimator_checks import check_estimator
from kenchi.datasets import make_blobs
from kenchi.outlier_detection import PCA
matplotlib.use('Agg')
import matplotlib.pyplot as plt
... | import unittest
import matplotlib
import matplotlib.axes
import numpy as np
from sklearn.exceptions import NotFittedError
from sklearn.utils.estimator_checks import check_estimator
from kenchi.datasets import make_blobs
from kenchi.outlier_detection import PCA
matplotlib.use('Agg')
import matplotlib.pyplot as plt
... | bsd-3-clause | Python |
09ed01974e5fd921d367a6e48e6cc7e382badfe7 | bump version to 0.5.0 | ivelum/graphql-py | graphql/__init__.py | graphql/__init__.py | __version__ = '0.5.0'
| __version__ = '0.4.0'
| mit | Python |
588e1474c0ee4e3f7fc02c5dc4785f70fefa371f | Update AvailableMachinesModel to account for Resources.getLocation returning a list | onitake/Uranium,onitake/Uranium | UM/Qt/Bindings/AvailableMachinesModel.py | UM/Qt/Bindings/AvailableMachinesModel.py | from PyQt5.QtCore import Qt, pyqtSlot, pyqtProperty, pyqtSignal
from UM.Qt.ListModel import ListModel
from UM.Resources import Resources
from UM.Application import Application
from UM.Logger import Logger
from UM.Settings.MachineSettings import MachineSettings
import os
import os.path
import json
class AvailableMach... | from PyQt5.QtCore import Qt, pyqtSlot, pyqtProperty, pyqtSignal
from UM.Qt.ListModel import ListModel
from UM.Resources import Resources
from UM.Application import Application
from UM.Logger import Logger
from UM.Settings.MachineSettings import MachineSettings
import os
import os.path
import json
class AvailableMach... | agpl-3.0 | Python |
89701f002f8831ca2133aab0cc56319e33d18eed | Fix import | explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc | thinc/layers/with_debug.py | thinc/layers/with_debug.py | from typing import Optional, Callable, Any, Tuple
from ..model import Model
do_nothing = lambda *args, **kwargs: None
def with_debug(
layer: Model,
name: Optional[str] = None,
*,
on_init: Callable[[Model, Any, Any], None] = do_nothing,
on_forward: Callable[[Model, Any, bool], None] = do_nothing... | from typing import Optional, Callable, Any, Tuple
from thinc.api import Model
do_nothing = lambda *args, **kwargs: None
def with_debug(
layer: Model,
name: Optional[str] = None,
*,
on_init: Callable[[Model, Any, Any], None] = do_nothing,
on_forward: Callable[[Model, Any, bool], None] = do_nothin... | mit | Python |
77132e94789cc1b2f7765c34545d39f4770e3aa2 | Use the local logger.info instead of logging.info. This can cause issues with the line with other loggers. | vertexproject/synapse,vertexproject/synapse,vertexproject/synapse,vivisect/synapse | synapse/lib/modules.py | synapse/lib/modules.py | '''
Module which implements the synapse module API/convention.
'''
import logging
import synapse.dyndeps as s_dyndeps
logger = logging.getLogger(__name__)
synmods = {}
modlist = []
def call(name, *args, **kwargs):
'''
Call the given function on all loaded synapse modules.
Returns a list of name,ret,exc... | '''
Module which implements the synapse module API/convention.
'''
import logging
import synapse.dyndeps as s_dyndeps
logger = logging.getLogger(__name__)
synmods = {}
modlist = []
def call(name, *args, **kwargs):
'''
Call the given function on all loaded synapse modules.
Returns a list of name,ret,exc... | apache-2.0 | Python |
650b71c637b6bd09a757791b9f9d8483eb153d58 | Prepare release 0.6b1 | flux3dp/fluxghost,flux3dp/fluxghost,flux3dp/fluxghost,flux3dp/fluxghost | fluxghost/__init__.py | fluxghost/__init__.py |
__version__ = "0.6b1"
DEBUG = False
|
__version__ = "0.6a1"
DEBUG = False
| agpl-3.0 | Python |
98e2d36d4759e24eb5c03d369d1cd0ac8c3dfdcf | Add Project.queue_name to list_filter and list_display | frigg/frigg-hq,frigg/frigg-hq,frigg/frigg-hq | frigg/builds/admin.py | frigg/builds/admin.py | # -*- coding: utf8 -*-
from django.contrib import admin
from django.template.defaultfilters import pluralize
from .models import Build, BuildResult, Project
class BuildResultInline(admin.StackedInline):
model = BuildResult
readonly_fields = ('result_log', 'succeeded')
extra = 0
max_num = 0
class Bu... | # -*- coding: utf8 -*-
from django.contrib import admin
from django.template.defaultfilters import pluralize
from .models import Build, BuildResult, Project
class BuildResultInline(admin.StackedInline):
model = BuildResult
readonly_fields = ('result_log', 'succeeded')
extra = 0
max_num = 0
class Bu... | mit | Python |
4bd328d14f5997bb8cd605ace428f8f95d7f7ea5 | update public data in a loop | CIRCL/bgpranking-redis-api,CIRCL/bgpranking-redis-api,CIRCL/bgpranking-redis-api | example/website/scripts/generate_static_data.py | example/website/scripts/generate_static_data.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import time
from bgpranking import tools
csv_dir = os.path.join('..', 'data', 'csv')
agg_csv_dir = os.path.join('..', 'data', 'csv_agg')
js_dir = os.path.join('..', 'data', 'js')
while True:
tools.prepare_all_csv(csv_dir)
# cat LU-overall-allocv4-v6-asn.... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from bgpranking import tools
csv_dir = os.path.join('..', 'data', 'csv')
tools.prepare_all_csv(csv_dir)
agg_csv_dir = os.path.join('..', 'data', 'csv_agg')
# cat LU-overall-allocv4-v6-asn.txt | grep asn | cut -d "|" -f 4
lu_raw_asns = open('lu_asns_dump', 'r').rea... | bsd-2-clause | Python |
2eff140499c66562f8a87d32531d3ecbb78b57f2 | Fix import for py3k | geoalchemy/geoalchemy2 | geoalchemy2/compat.py | geoalchemy2/compat.py | """
Python 2 and 3 compatibility:
- Py3k `memoryview()` made an alias for Py2k `buffer()`
- Py3k `bytes()` made an alias for Py2k `str()`
"""
try:
import __builtin__ as builtins
except ImportError:
import builtins
import sys
if sys.version_info[0] == 2:
buffer = getattr(builtins, 'buffer')
by... | """
Python 2 and 3 compatibility:
- Py3k `memoryview()` made an alias for Py2k `buffer()`
- Py3k `bytes()` made an alias for Py2k `str()`
"""
import __builtin__
import sys
if sys.version_info[0] == 2:
buffer = getattr(__builtin__, 'buffer')
bytes = str
else:
# Python 2.6 flake8 workaround
buf... | mit | Python |
3c9e87e48ab65db36e503090af7cc244354e679f | Remove multiline handing attemp, Fix #5 | vors/jupyter-powershell | powershell_kernel/powershell_repl.py | powershell_kernel/powershell_repl.py | # -*- coding: utf-8 -*-
# Copyright (c) 2011, Wojciech Bederski (wuub.net)
# All rights reserved.
# See LICENSE.txt for details.
import os
import re
from . import subprocess_repl
class PowershellRepl(subprocess_repl.SubprocessRepl):
TYPE = "powershell"
def __init__(self, encoding, **kwds):
if not enco... | # -*- coding: utf-8 -*-
# Copyright (c) 2011, Wojciech Bederski (wuub.net)
# All rights reserved.
# See LICENSE.txt for details.
import os
import re
from . import subprocess_repl
# PowerShell in interactive mode shows no prompt, so we must hold it by hand.
# Every command prepended with other command, which will outpu... | mit | Python |
e4af11394bfc81d4476af2a8fe60f82f11e674d6 | Add staticfiles URLs to urls.development by default | armstrong/armstrong.templates.standard,armstrong/armstrong.templates.standard | project_template/urls/development.py | project_template/urls/development.py | """
Add any additional URLs that should only be available when using the the
settings.development configuration.
See ``urls.defaults`` for a list of all URLs available across both
configurations.
"""
from .defaults import *
urlpatterns += patterns('',
# Examples:
# url(r'^$', '{{ project_name }}.views.debug'... | """
Add any additional URLs that should only be available when using the the
settings.development configuration.
See ``urls.defaults`` for a list of all URLs available across both
configurations.
"""
from .defaults import *
urlpatterns += patterns('',
# Examples:
# url(r'^$', '{{ project_name }}.views.debug'... | apache-2.0 | Python |
5c45fbd31c61dc72ce1e620c2840f06334f1cc3c | improve 'Create' entry: use q; only if needed | dsanders11/django-autocomplete-light,luzfcb/django-autocomplete-light,luzfcb/django-autocomplete-light,dsanders11/django-autocomplete-light,yourlabs/django-autocomplete-light,shubhamdipt/django-autocomplete-light,Perkville/django-autocomplete-light,luzfcb/django-autocomplete-light,Eraldo/django-autocomplete-light,Perkv... | autocomplete_light/example_apps/create_choice_on_the_fly/autocomplete_light_registry.py | autocomplete_light/example_apps/create_choice_on_the_fly/autocomplete_light_registry.py | import autocomplete_light.shortcuts as autocomplete_light
from django import http
from .models import OnTheFly
class OnTheFlyAutocomplete(autocomplete_light.AutocompleteModelBase):
choices = OnTheFly.objects.all()
def autocomplete_html(self):
html = super(OnTheFlyAutocomplete, self).autocomplete_htm... | import autocomplete_light.shortcuts as autocomplete_light
from django import http
from .models import OnTheFly
class OnTheFlyAutocomplete(autocomplete_light.AutocompleteModelBase):
choices = OnTheFly.objects.all()
def autocomplete_html(self):
html = super(OnTheFlyAutocomplete, self).autocomplete_htm... | mit | Python |
85cfdc004c680213883f559f4fa9aafc58690698 | revert owlbot main branch templates (#35) | googleapis/python-life-sciences,googleapis/python-life-sciences | owlbot.py | owlbot.py | # Copyright 2021 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, s... | # Copyright 2021 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, s... | apache-2.0 | Python |
12a71f104e3693e73edf7f0bdfc56da19bae1bf1 | Change parser | nanalelfe/fofe-ner,nanalelfe/fofe-ner,nanalelfe/fofe-ner,nanalelfe/fofe-ner | parser.py | parser.py | import glob, os
def OntoNotes(directory):
"""
Parameters
----------
directory: str
directory in which the OntoNotes project is located
files : str
path to a file containing all of the paths to files containing NER-annotated
data
Yields
------
... | import glob, os
def OntoNotes(directory):
"""
Parameters
----------
directory: str
directory in which the OntoNotes project is located
files : str
path to a file containing all of the paths to files containing NER-annotated
data
Yields
------
... | mit | Python |
d754690afc2233dfe8fb84ea9cbb0bb820600529 | update tests | evansloan082/sports.py | tests/score_test.py | tests/score_test.py | import json
import unittest
import sports
class TestScores(unittest.TestCase):
match_data = {
'league': 'NHL',
'home_team': 'Pittsburgh Penguins',
'away_team': 'Nashville Predators',
'match_score': '2-0',
'match_date': 'Sat, 19 Aug 2017 02:12:05 GMT',
'match_time':... | import json
import unittest
import sports_py
class TestScores(unittest.TestCase):
match_data = {
'league': 'NHL',
'home_team': 'Pittsburgh Penguins',
'away_team': 'Nashville Predators',
'match_score': '2-0',
'match_date': 'Sat, 19 Aug 2017 02:12:05 GMT',
'match_tim... | mit | Python |
17015ecf48ec37909de6de2c299454fc89b592e9 | Add failing test for URL without zoom | bfontaine/jinja2_maps | tests/test_gmaps.py | tests/test_gmaps.py | # -*- coding: UTF-8 -*-
from base import TestCase
from jinja2_maps.gmaps import gmaps_url
class TestGmaps(TestCase):
def test_url_dict(self):
url = "https://www.google.com/maps/place/12.34,56.78/@12.34,56.78,42z"
self.assertEquals(url,
gmaps_url(dict(latitude=12.34, longitude=56.... | # -*- coding: UTF-8 -*-
from base import TestCase
from jinja2_maps.gmaps import gmaps_url
class TestGmaps(TestCase):
def test_url_dict(self):
url = "https://www.google.com/maps/place/12.34,56.78/@12.34,56.78,42z"
self.assertEquals(url,
gmaps_url(dict(latitude=12.34, longitude=56.... | mit | Python |
2a95db43b1294e8c7620687cd824364cc8618d22 | Fix typo | Heufneutje/txircd,DesertBus/txircd,ElementalAlchemist/txircd | txircd/modules/cmd_kill.py | txircd/modules/cmd_kill.py | from twisted.words.protocols import irc
from txircd.modbase import Command
class KillCommand(Command):
def onUse(self, user, data):
target = data["targetuser"]
reason = "Killed by {}: {}".format(user.nickname, data["reason"])
target.sendMessage("KILL", ":{} {}".format(user.nickname, data["reason"]))
quit_to =... | from twisted.words.protocols import irc
from txircd.modbase import command
class KillCommand(Command):
def onUse(self, user, data):
target = data["targetuser"]
reason = "Killed by {}: {}".format(user.nickname, data["reason"])
target.sendMessage("KILL", ":{} {}".format(user.nickname, data["reason"]))
quit_to =... | bsd-3-clause | Python |
47bdbeb445c52e846f20da214fa4086cac13de0d | 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 pref for nicks I usually ignore (i.e. chanserv)
i... | mit | Python |
8583e1fec3fb1da321687acd37f92bd9d988bb10 | Enable adding/removing boops with command during runtime | DesertBot/DesertBot | desertbot/modules/automatic/Boops.py | desertbot/modules/automatic/Boops.py | from twisted.plugin import IPlugin
from desertbot.moduleinterface import IModule, BotModule, ignore
from desertbot.modules.commandinterface import admin
from zope.interface import implementer
import random
import re
from desertbot.message import IRCMessage
from desertbot.response import IRCResponse, ResponseType
@i... | from twisted.plugin import IPlugin
from desertbot.moduleinterface import IModule, BotModule, ignore
from zope.interface import implementer
import random
import re
from desertbot.message import IRCMessage
from desertbot.response import IRCResponse, ResponseType
@implementer(IPlugin, IModule)
class Boops(BotModule):
... | mit | Python |
6adae0b495f93f00da7ae42e54c14eaaceed435e | Cut down on number of imports | ioam/svn-history,ioam/svn-history,ioam/svn-history,ioam/svn-history,ioam/svn-history | topo/tk/__init__.py | topo/tk/__init__.py | # Tk based GUI support files
#
# $Id$
# For importing the tk GUI files
import topo.tk.propertiesframe
import topo.tk.taggedslider
import topo.tk.topoconsole
import topo.tk.plotpanel
# For show_cmd_prompt() and start()
import Pmw, sys, Tkinter
import topo.simulator
import topo.base
def show_cmd_prompt():
"""
... | # Tk based GUI support files
#
# $Id$
import propertiesframe
import taggedslider
import topoconsole
import plotpanel
# Code block-copied over from topo/gui.py These imports should
# be cleaned up.
from Tkinter import *
import Pmw, sys
import topo.simulator as simulator
from topo.tk.topoconsole import *
def show_cm... | bsd-3-clause | Python |
8c9996ad4450de2f444bf9eb4db64136329055cc | fix auto DB finder | WilmerLab/HTSOHM-dev,WilmerLab/HTSOHM-dev | htsohm/db/__init__.py | htsohm/db/__init__.py | from datetime import datetime
from glob import glob
import os
from shutil import copy2
import sys
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import yaml
__engine__ = None
__session__ = None
def get_session():
return __sessi... | from datetime import datetime
from glob import glob
import os
from shutil import copy2
import sys
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import yaml
__engine__ = None
__session__ = None
def get_session():
return __sessi... | mit | Python |
f05dc9faf43598bed5ce37d721f67b31f3e8eccb | Index parse to int | uncovertruth/django-horizon | horizon/settings.py | horizon/settings.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.utils.lru_cache import lru_cache
CONFIG_DEFAULTS = {
'GROUPS': {},
'METADATA_MODEL': None,
}
@lru_cache()
def get_config():
USER_CONFIG = getattr(settings, 'HORIZONTAL_CONFIG',... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.utils.lru_cache import lru_cache
CONFIG_DEFAULTS = {
'GROUPS': {},
'METADATA_MODEL': None,
}
@lru_cache()
def get_config():
USER_CONFIG = getattr(settings, 'HORIZONTAL_CONFIG',... | mit | Python |
f5da38b312a730bf268ad0d8b49c5306f13081f2 | Fix leftover session query in services view | pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine | scoring_engine/web/views/services.py | scoring_engine/web/views/services.py | from flask import Blueprint, render_template, url_for, redirect
from flask_login import login_required, current_user
from scoring_engine.models.service import Service
from scoring_engine.db import session
mod = Blueprint('services', __name__)
@mod.route('/services')
@login_required
def home():
current_team = cu... | from flask import Blueprint, render_template, url_for, redirect
from flask_login import login_required, current_user
from scoring_engine.models.service import Service
mod = Blueprint('services', __name__)
@mod.route('/services')
@login_required
def home():
current_team = current_user.team
if not current_user... | mit | Python |
5a1a65dfba3adbbf0942b71bc71b5141adb2c4bf | use ranking helper | knifeofdreams/poker-player-thedeadparrot | player.py | player.py | import json
import logging
from random import randint
import sys
from ranking_helper import RankingHelper
logging.basicConfig(format='%(levelname)s %(lineno)d:%(funcName)s %(message)s')
log = logging.getLogger('player.Player')
log.addHandler(logging.StreamHandler(sys.stderr))
log.setLevel(logging.DEBUG)
class Play... | import json
import logging
from random import randint
import sys
logging.basicConfig(format='%(levelname)s %(lineno)d:%(funcName)s %(message)s')
log = logging.getLogger('player.Player')
log.addHandler(logging.StreamHandler(sys.stderr))
log.setLevel(logging.DEBUG)
class Player:
VERSION = "Cautios parrot"
de... | mit | Python |
91d7c4182de70ced147296cc47cd7be26dd48985 | speed up preload_sites.py maintenance script | wikimedia/pywikibot-core,wikimedia/pywikibot-core | scripts/maintenance/preload_sites.py | scripts/maintenance/preload_sites.py | #!/usr/bin/python
"""Script that preloads site and user info for all sites of given family.
The following parameters are supported:
-worker:<num> The number of parallel tasks to be run. Default is the
number of precessors on the machine
Usage:
python pwb.py preload_sites [{<family>}] [-wor... | #!/usr/bin/python
"""Script that preloads site and user info for all sites of given family.
The following parameters are supported:
-worker:<num> The number of parallel tasks to be run. Default is the
number of precessors on the machine
Usage:
python pwb.py preload_sites [{<family>}] [-wor... | mit | Python |
5977adef1c792c1f7afe137eff3809ef4d57dfb5 | Add live to excluded environments in migration | alphagov/notifications-api,alphagov/notifications-api | migrations/versions/0300_migrate_org_types.py | migrations/versions/0300_migrate_org_types.py | import os
"""
Revision ID: 0300_migrate_org_types
Revises: 0299_org_types_table
Create Date: 2019-07-24 16:18:27.467361
"""
from alembic import op
import sqlalchemy as sa
revision = '0300_migrate_org_types'
down_revision = '0299_org_types_table'
environment = os.environ['NOTIFY_ENVIRONMENT']
def upgrade():
... | import os
"""
Revision ID: 0300_migrate_org_types
Revises: 0299_org_types_table
Create Date: 2019-07-24 16:18:27.467361
"""
from alembic import op
import sqlalchemy as sa
revision = '0300_migrate_org_types'
down_revision = '0299_org_types_table'
environment = os.environ['NOTIFY_ENVIRONMENT']
def upgrade():
... | mit | Python |
2ca0aa4f29c20f21cce7337b851481bdfaea9a67 | Remove hubsbpot tracking URL params | dalf/searx,dalf/searx,dalf/searx,dalf/searx | searx/plugins/tracker_url_remover.py | searx/plugins/tracker_url_remover.py | '''
searx is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
searx is distributed in the hope that it will be useful,
but WITHOUT ANY WA... | '''
searx is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
searx is distributed in the hope that it will be useful,
but WITHOUT ANY WA... | agpl-3.0 | Python |
73673598e1998252b16b48d31b800ab0fb441392 | Add documentation for the control system | willrogers/pml,willrogers/pml | pml/cs.py | pml/cs.py | """
Template module to define control systems.
"""
class ControlSystem(object):
""" Define a control system to be used with a device.
It uses channel access to comunicate over the network with
the hardware.
"""
def __init__(self):
raise NotImplementedError()
def get(self, pv):
... | """
Template module to define control systems.
"""
class ControlSystem(object):
""" Define a control system to be used with a device
It uses channel access to comunicate over the network with
the hardware.
"""
def __init__(self):
raise NotImplementedError()
def get(self, pv):
... | apache-2.0 | Python |
6157be23dce8857963150d8f162978d967f22bd2 | Move imports in cloudflare integration(#27882) | titilambert/home-assistant,leppa/home-assistant,nkgilley/home-assistant,GenericStudent/home-assistant,tchellomello/home-assistant,FreekingDean/home-assistant,titilambert/home-assistant,tboyce021/home-assistant,soldag/home-assistant,postlund/home-assistant,FreekingDean/home-assistant,robbiet480/home-assistant,home-assis... | homeassistant/components/cloudflare/__init__.py | homeassistant/components/cloudflare/__init__.py | """Update the IP addresses of your Cloudflare DNS records."""
from datetime import timedelta
import logging
from pycfdns import CloudflareUpdater
import voluptuous as vol
from homeassistant.const import CONF_API_KEY, CONF_EMAIL, CONF_ZONE
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers... | """Update the IP addresses of your Cloudflare DNS records."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.const import CONF_API_KEY, CONF_EMAIL, CONF_ZONE
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.event import track_time_interval
_LO... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.