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 |
|---|---|---|---|---|---|---|---|---|
7c5ce8e80bd4cf6d70288039673e7e597b19dd66 | fix problem with python 3.x | kivio/pysllo,kivio/python-structured-logging | pysllo/loggers/tracking_logger.py | pysllo/loggers/tracking_logger.py | # coding:utf-8
import logging
from .propagation_logger import PropagationLogger
from ..utils.tracer import Tracer, TraceContext
class TrackingLogger(PropagationLogger):
_tracer = Tracer()
_is_tracking_enable = False
def __init__(self, name, level=logging.NOTSET, propagation=False):
... | # coding:utf-8
import logging
from .propagation_logger import PropagationLogger
from ..utils.tracer import Tracer, TraceContext
class TrackingLogger(PropagationLogger):
_tracer = Tracer()
_is_tracking_enable = False
def __init__(self, name, level=logging.NOTSET, propagation=False):
... | bsd-3-clause | Python |
c2e4f9055666043afee888f8feab69978da4bc07 | Add positional arg for specifying the emote name. | d6e/emotion | emote/emote.py | emote/emote.py | """ A simple CLI tool for quickly copying common emoticon/emoji to your
clipboard. """
import pyperclip
import json
import sys
import argparse
# TODO: Read from an env var and a harcoded .dotfile
with open("mapping.json") as f:
emotes = json.load(f)
def parse_arguments():
parser = argparse.ArgumentParser(desc... | """ A simple CLI tool for quickly copying common emoticon/emoji to your
clipboard. """
import pyperclip
import json
import sys
import argparse
with open("mapping.json") as f:
emotes = json.load(f)
def parse_arguments():
parser = argparse.ArgumentParser(
description=sys.modules[__name__].__doc__,
... | mit | Python |
2663ddc50405de8baf45fddab6ca414b124e758a | Create a BaseCustomException | Didero/DideRobot | CustomExceptions.py | CustomExceptions.py | class BaseCustomException(Exception):
"""
An abstract class that other custom exceptions should inherit from. Don't instantiate this directly
"""
def __init__(self, displayMessage):
"""
Create a new exception
:param displayMessage: An optional user-facing message, that will also be used as the exception's str... | class CommandException(Exception):
"""
This custom exception can be thrown by commands when something goes wrong during execution.
The parameter is a message sent to the source that called the command (a channel or a user)
"""
def __init__(self, displayMessage=None, shouldLogError=True):
"""
Create a new Comm... | mit | Python |
41492440dccd2458c88cf008249dd9b3ef2db25c | Fix skipping in test/test_issue200.py | RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib | test/test_issue200.py | test/test_issue200.py | #!/usr/bin/env python
import os
import rdflib
import unittest
import pytest
try:
from os import fork
from os import pipe
except ImportError:
pytestmark = pytest.mark.skip(
reason="No os.fork() and/or os.pipe() on this platform, skipping"
)
class TestRandomSeedInFork(unittest.TestCase):
... | #!/usr/bin/env python
import os
import rdflib
import unittest
import pytest
try:
from os import fork
from os import pipe
except ImportError:
pytest.skip("No os.fork() and/or os.pipe() on this platform, skipping")
class TestRandomSeedInFork(unittest.TestCase):
def test_bnode_id_differs_in_fork(self)... | bsd-3-clause | Python |
b0f5faa5d5ca18bbecbaa3ba16e629840fa63364 | Update template to have correct docstring format. | brenns10/social,brenns10/social | templates/template.py | templates/template.py | """
**ReplaceMe**
[Describe what your subclass does here.]
- In this bullet point, describe what your account matches.
- Here, describe what your account expands to.
- Demonstrate use on command line: ``key:value``.
"""
import re
#import requests
#from lxml import html
from . import Account
_URL_RE = re.compile(r'... | """ReplaceMe abstraction."""
import re
#import requests
#from lxml import html
from . import Account
_URL_RE = re.compile(r'https?://(www.)?ReplaceMe.com/(?P<username>\w+)/?')
class ReplaceMeAccount(Account):
def __init__(self, username=None, url=None, **_):
if username is not None:
self._... | bsd-3-clause | Python |
5825204f6a4abe8f22bf3d2c22e2d8ba78f3c340 | fix qibuild foreach | aldebaran/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,aldebaran/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild | python/qibuild/actions/foreach.py | python/qibuild/actions/foreach.py | ## Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
"""Run the same command on each buildable project.
Use -- to separate qibuild arguments from the arguments of the command.
For instance
qibuild --ign... | ## Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
"""Run the same command on each buildable project.
Use -- to separate qibuild arguments from the arguments of the command.
For instance
qibuild --ign... | bsd-3-clause | Python |
a4ee97af97ccbbe519941fef02638d46fea8a0ff | include the stream ERROR message on sys.exit | MSLNZ/msl-package-manager | conftest.py | conftest.py | import io
import sys
import logging
from msl.package_manager import (
pypi,
github,
utils,
)
stream = io.BytesIO()
handler = logging.StreamHandler(stream=stream)
orig_level = int(utils.log.level)
utils.set_log_level(logging.ERROR)
utils.log.addHandler(handler)
if not pypi():
pypi(update_cache=True)
... | import io
import sys
import logging
from msl.package_manager import (
pypi,
github,
utils,
)
stream = io.BytesIO()
handler = logging.StreamHandler(stream=stream)
orig_level = int(utils.log.level)
utils.set_log_level(logging.ERROR)
utils.log.addHandler(handler)
if not pypi():
pypi(update_cache=True)
... | mit | Python |
0ddecd41ddb569bb07ab07c1c474df605236d7b0 | Bump version to 2.7.dev | zwadar/pyqode.python,pyQode/pyqode.python,pyQode/pyqode.python | pyqode/python/__init__.py | pyqode/python/__init__.py | # -*- coding: utf-8 -*-
"""
pyqode.python is an extension of pyqode.core that brings support
for the python programming language. It provides a set of additional modes and
panels for the frontend and a series of worker for the backend (code
completion, documentation lookups, code linters, and so on...).
"""
__version... | # -*- coding: utf-8 -*-
"""
pyqode.python is an extension of pyqode.core that brings support
for the python programming language. It provides a set of additional modes and
panels for the frontend and a series of worker for the backend (code
completion, documentation lookups, code linters, and so on...).
"""
__version... | mit | Python |
9fa74daaace9c39ee6664526d89436d6918f4f79 | make return results consistent, test return results in other files | mitar/pychecker,mitar/pychecker | test_input/test17.py | test_input/test17.py | 'doc'
class X:
'should get a warning for returning value from __init__'
def __init__(self):
print 'howdy'
return 1
class Y:
'should get a warning for returning value from __init__'
def __init__(self, x):
if x == 0 :
return 0
if x == 1 :
return 53
return None
class Z:
... | 'doc'
class X:
'should get a warning for returning value from __init__'
def __init__(self):
print 'howdy'
return 1
class Y:
'should get a warning for returning value from __init__'
def __init__(self, x):
if x == 0 :
return 0
if x == 1 :
return []
return None
class Z:
... | bsd-3-clause | Python |
7203d989b2c126b23b44b61f9a2a980d4e7eacdd | Refactor build_update_query | AntoineToubhans/MongoTs | mongots/query.py | mongots/query.py | from datetime import datetime
AGGREGATION_KEYS = [
'',
'months.{month}.',
'months.{month}.days.{day}.',
'months.{month}.days.{day}.hours.{hour}.',
]
DATETIME_KEY = 'datetime'
def build_filter_query(timestamp, tags=None):
filters = tags or {}
filters[DATETIME_KEY] = datetime(timestamp.year, 1... | from datetime import datetime
AGGR_MONTH_KEY = 'months'
AGGR_DAY_KEY = 'days'
AGGR_HOUR_KEY = 'hours'
DATETIME_KEY = 'datetime'
def build_filter_query(timestamp, tags=None):
filters = tags or {}
filters[DATETIME_KEY] = datetime(timestamp.year, 1, 1)
return filters
def build_update_query(value, timest... | mit | Python |
503fdc12533eed77c49e9fdb0cc855b9bfaa1449 | Correct exit code check for existing db | wfxiang08/changes,bowlofstew/changes,dropbox/changes,dropbox/changes,wfxiang08/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes,bowlofstew/changes,dropbox/changes,wfxiang08/changes,bowlofstew/changes | conftest.py | conftest.py | import os
import sys
root = os.path.abspath(os.path.join(os.path.dirname(__file__)))
if root not in sys.path:
sys.path.insert(0, root)
from alembic.config import Config
from alembic import command
alembic_cfg = Config(os.path.join(root, 'alembic.ini'))
# force model registration
from changes.config import creat... | import os
import sys
root = os.path.abspath(os.path.join(os.path.dirname(__file__)))
if root not in sys.path:
sys.path.insert(0, root)
from alembic.config import Config
from alembic import command
alembic_cfg = Config(os.path.join(root, 'alembic.ini'))
# force model registration
from changes.config import creat... | apache-2.0 | Python |
dc79eff39cb97ea9a57be5eee8ac3ac225029d85 | Fix pam test. | kgiusti/gofer,credativ/gofer,jortel/gofer,jortel/gofer,kgiusti/gofer,credativ/gofer | test/unit/test_pam.py | test/unit/test_pam.py | # Copyright (c) 2014 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the impl... | # Copyright (c) 2014 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the impl... | lgpl-2.1 | Python |
a3ed049169fbd1f8cb4bab39b9aad5701d933dc4 | Correct documentation cross-reference | textbook/aslack | aslack/utils.py | aslack/utils.py | """Utility functionality."""
import os
from aiohttp import web_exceptions
API_TOKEN_ENV = 'SLACK_API_TOKEN'
"""The environment variable to store the user's API token in."""
class FriendlyError(Exception):
"""Exception with friendlier error messages.
Notes:
The ``err_msg`` is resolved in :py:data... | """Utility functionality."""
import os
from aiohttp import web_exceptions
API_TOKEN_ENV = 'SLACK_API_TOKEN'
"""The environment variable to store the user's API token in."""
class FriendlyError(Exception):
"""Exception with friendlier error messages.
Notes:
The ``err_msg`` is resolved in :py:attr... | isc | Python |
c74fa1fd7f99cf331a884a4a86f606b8dcfb0eb8 | Revert "Quit fix release". Back to normal versioning. | saltstack/pytest-logging | pytest_logging/version.py | pytest_logging/version.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2015 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
pytest_logging.version
~~~~~~~~~~~~~~~~~~~~~~
pytest logging plugin version informat... | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2015 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
pytest_logging.version
~~~~~~~~~~~~~~~~~~~~~~
pytest logging plugin version informat... | apache-2.0 | Python |
ddeffc09ce1eab426fe46129bead712059f93f45 | Remove DEBUG=False that's not needed anymore | rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org | docker/settings/web.py | docker/settings/web.py | from .docker_compose import DockerBaseSettings
class WebDevSettings(DockerBaseSettings):
pass
WebDevSettings.load_settings(__name__)
| from .docker_compose import DockerBaseSettings
class WebDevSettings(DockerBaseSettings):
# Needed to serve 404 pages properly
# NOTE: it may introduce some strange behavior
DEBUG = False
WebDevSettings.load_settings(__name__)
| mit | Python |
1e12b00a6ca73c5b2071d5ab9aa3e4d1bbea64a0 | Add custom WebRequestException | Didero/DideRobot | CustomExceptions.py | CustomExceptions.py | class BaseCustomException(Exception):
"""
An abstract class that other custom exceptions should inherit from. Don't instantiate this directly
"""
def __init__(self, displayMessage):
"""
Create a new exception
:param displayMessage: An optional user-facing message, that will also be used as the exception's str... | class BaseCustomException(Exception):
"""
An abstract class that other custom exceptions should inherit from. Don't instantiate this directly
"""
def __init__(self, displayMessage):
"""
Create a new exception
:param displayMessage: An optional user-facing message, that will also be used as the exception's str... | mit | Python |
01e1900a139d7525a0803d5a160a9d91210fe219 | Add logging output when called from command line | aguinane/csvtokmz | csv2kmz/csv2kmz.py | csv2kmz/csv2kmz.py | import os
import argparse
import logging
from buildkmz import create_kmz_from_csv
def main():
""" Build file as per user inputs
"""
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s', level=logging.INFO)
args = get_cmd_args()
iPath = args.input
sPath = args.s... | import os
import argparse
from buildkmz import create_kmz_from_csv
def main():
""" Build file as per user inputs
"""
args = get_cmd_args()
iPath = args.input
sPath = args.styles
oDir = args.output
create_kmz_from_csv(iPath,sPath,oDir)
def get_cmd_args():
"""Get, proc... | mit | Python |
a48151f5188484002e025c3861cb0bd770a17357 | FIX type policy back comp. | ingadhoc/sale,ingadhoc/sale,ingadhoc/sale,ingadhoc/sale | sale_order_type_invoice_policy/models/sale_order_line.py | sale_order_type_invoice_policy/models/sale_order_line.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import api, models, _
from openerp.ex... | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import api, models, _
from openerp.ex... | agpl-3.0 | Python |
ab6e0d5d51b781258a38dbf0e41d82b06a7005f4 | bump for testing tag | brentp/cyvcf2,brentp/cyvcf2,brentp/cyvcf2 | cyvcf2/__init__.py | cyvcf2/__init__.py | from .cyvcf2 import (VCF, Variant, Writer, r_ as r_unphased, par_relatedness,
par_het)
Reader = VCFReader = VCF
__version__ = "0.30.0"
| from .cyvcf2 import (VCF, Variant, Writer, r_ as r_unphased, par_relatedness,
par_het)
Reader = VCFReader = VCF
__version__ = "0.20.9"
| mit | Python |
c9484d0c07543c687820bbb2485ea202647ec232 | use self defined logging module instead of standlib logging | Andy-hpliu/AirtestX,NetEaseGame/AutomatorX,Andy-hpliu/AirtestX,Andy-hpliu/AirtestX,codeskyblue/AutomatorX,codeskyblue/AutomatorX,NetEaseGame/AutomatorX,NetEaseGame/AutomatorX,NetEaseGame/ATX,NetEaseGame/AutomatorX,Andy-hpliu/AirtestX,NetEaseGame/ATX,NetEaseGame/ATX,codeskyblue/AutomatorX,Andy-hpliu/AirtestX,codeskyblue... | atx/logutils.py | atx/logutils.py | #!/usr/bin/env python
# coding: utf-8
import inspect
import logging
import os
import sys
import time
import threading
import datetime
class Logger(object):
__alias = {
'WARNING': 'WARN',
'CRITICAL': 'FATAL'
}
def __init__(self, name=None, level=logging.INFO):
if name is None:
... | #!/usr/bin/env python
# coding: utf-8
import logging
def getLogger(name, init=True, level=logging.INFO):
logger = logging.getLogger(name)
ch = logging.StreamHandler()
fmt = "%(asctime)s %(levelname)-8.8s [%(name)s:%(lineno)4s] %(message)s"
ch.setFormatter(logging.Formatter(fmt))
ch.setLevel(level... | apache-2.0 | Python |
32710f1f28773b36df6788b236256c9f4fbb52a1 | add v2020.6.20 (#18060) | LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-certifi/package.py | var/spack/repos/builtin/packages/py-certifi/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyCertifi(PythonPackage):
"""Certifi: A carefully curated collection of Root Certificates ... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyCertifi(PythonPackage):
"""Certifi: A carefully curated collection of Root Certificates ... | lgpl-2.1 | Python |
2a1b63c66d7721940346ddead8330a6060cdcd2e | Fix several errors that cause script to end prematurely | aerovolts/python-scripts | redditscrape.py | redditscrape.py | #!/usr/bin/env python
__author__ = "Patrick Guelcher"
__copyright__ = "(C) 2016 Patrick Guelcher"
__license__ = "MIT"
__version__ = "3.0"
"""
Scrapes the list of provided subreddits for images and downloads them to a local directory
"""
import os, praw, wget, urllib.error
# Configuration
root_path = 'scrape' # Down... | #!/usr/bin/env python
__author__ = "Patrick Guelcher"
__copyright__ = "(C) 2016 Patrick Guelcher"
__license__ = "MIT"
__version__ = "2.1"
"""
Scrapes the list of provided subreddits for images and downloads them to a local directory
"""
import os
import praw
import wget
import urllib.error
# Configuration
root_path... | mit | Python |
984c395e3f43764a4d8125aea7556179bb4766dd | Remove the doc that describes the setup. Setup is automated now | moritzschaefer/luigi,kalaidin/luigi,riga/luigi,foursquare/luigi,dylanjbarth/luigi,Dawny33/luigi,harveyxia/luigi,graingert/luigi,slvnperron/luigi,harveyxia/luigi,sahitya-pavurala/luigi,hadesbox/luigi,rayrrr/luigi,humanlongevity/luigi,Tarrasch/luigi,Magnetic/luigi,percyfal/luigi,torypages/luigi,stroykova/luigi,theoryno3/... | test/_mysqldb_test.py | test/_mysqldb_test.py | import mysql.connector
from luigi.contrib.mysqldb import MySqlTarget
import unittest
host = 'localhost'
port = 3306
database = 'luigi_test'
username = None
password = None
table_updates = 'table_updates'
def _create_test_database():
con = mysql.connector.connect(user=username,
p... | '''
$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 211
Server version: 5.6.15 Homebrew
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks... | apache-2.0 | Python |
ec7605f522268fe008a1438433f986e9e5243d35 | Update TODO for periodogram. | cournape/talkbox,cournape/talkbox | scikits/talkbox/spectral/basic.py | scikits/talkbox/spectral/basic.py | import numpy as np
from scipy.fftpack import fft, ifft
def periodogram(x, nfft=None, fs=1):
"""Compute the periodogram of the given signal, with the given fft size.
Parameters
----------
x : array-like
input signal
nfft : int
size of the fft to compute the periodogram. If None (def... | import numpy as np
from scipy.fftpack import fft, ifft
def periodogram(x, nfft=None, fs=1):
"""Compute the periodogram of the given signal, with the given fft size.
Parameters
----------
x: array-like
input signal
nfft: int
size of the fft to compute the periodogram. If None (defau... | mit | Python |
5f4fdb23767f1cc04dc133497b866dfa9feeb7f9 | fix pep8 issue | raygomez/python-exercise-4 | exercise4-5.py | exercise4-5.py | from __future__ import print_function
__author__ = 'ragomez'
class MultiplesOf7(object):
def __init__(self, n):
self.n = n
self.num = 0
def next(self):
self.num += 7
if self.num < self.n:
return self.num
else:
raise StopIteration
def __ite... | from __future__ import print_function
__author__ = 'ragomez'
class MultiplesOf7(object):
def __init__(self, n):
self.n = n
self.num = 0
def next(self):
self.num += 7
if self.num < self.n:
return self.num
else:
raise StopIteration
def __ite... | mit | Python |
763f67c0a1099aacf0346ad8e7b9cd9be6cf4ccd | Update headers for Roboconf | aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygmen... | pygments/lexers/roboconf.py | pygments/lexers/roboconf.py | # -*- coding: utf-8 -*-
"""
pygments.lexers.roboconf
~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for Roboconf DSL.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, words, bygroups, re, include
from pygments.t... | from pygments.lexer import RegexLexer, words, bygroups, re, include
from pygments.token import *
__all__ = ['RoboconfGraphLexer', 'RoboconfInstancesLexer']
class RoboconfGraphLexer(RegexLexer):
name = 'Roboconf Graph'
aliases = ['roboconf-graph']
filenames = ['*.graph']
flags = re.IGNORECASE | re.MUL... | bsd-2-clause | Python |
905cd14dfa64f1a0aa0674fe064dd0cc6986692f | Update experiServe.py | ChristinaHammer/Client_Database | experiServe.py | experiServe.py | """experiServe.py
Developer: Noelle Todd
Last visit: July 15, 2014
This file tests the creation of a simple Python server,
printing to a web page, html forms, and basic I/O.
"""
import cgi
from wsgiref.simple_server import make_server
from io import
def get_form_values(post_str): pass
#This function retrieves... | """experiServe.py
This file tests the creation of a simple Python server,
printing to a web page, html forms, and basic I/O.
"""
import cgi
from wsgiref.simple_server import make_server
from io import
def get_form_values(post_str): pass
#This function retrieves the information submitted to the form.
#form_... | mit | Python |
8f80ac1f6331661932a552b38d0b4377b3cd3408 | add support for custom types | lnmds/jose | ext/playing.py | ext/playing.py | import logging
import json
import asyncio
import random
import discord
from discord.ext import commands
from .common import Cog
MINUTE = 60
PL_MIN = 3 * MINUTE
PL_MAX = 10 * MINUTE
log = logging.getLogger(__name__)
class PlayingStatus(Cog):
"""Playing status shit"""
def __init__(self, bot):
super(... | import logging
import json
import asyncio
import random
import discord
from discord.ext import commands
from .common import Cog
MINUTE = 60
PL_MIN = 3 * MINUTE
PL_MAX = 10 * MINUTE
log = logging.getLogger(__name__)
class PlayingStatus(Cog):
"""Playing status shit"""
def __init__(self, bot):
super(... | mit | Python |
bdc674762536eee22d2c8c01ebfc1d98f2d46013 | Add a test for SAM checker | jackstanek/BotBot,jackstanek/BotBot | tests/test_checker.py | tests/test_checker.py | import pytest
import os, stat
from botbot import checker, problems, checks
# Tests for Checker class methods
def test_checker_register_accept_single_function():
c = checker.Checker()
c.register(lambda: print("Hello world!"))
assert len(c.checks) == 1
def test_checker_register_accept_function_list():
... | import pytest
import os, stat
from botbot import checker, problems, checks
# Tests for Checker class methods
def test_checker_register_accept_single_function():
c = checker.Checker()
c.register(lambda: print("Hello world!"))
assert len(c.checks) == 1
def test_checker_register_accept_function_list():
... | mit | Python |
ca1489e1fca85f52a53fc1bd1f69938879752598 | test incorrrect data file intput | chfw/moban,chfw/moban | tests/test_context.py | tests/test_context.py | import os
from nose.tools import eq_
from moban.plugins import Context
def test_context():
context = Context(os.path.join("tests", "fixtures"))
data = context.get_data("simple.yaml")
eq_(data["simple"], "yaml")
def test_environ_variables():
test_var = "TEST_ENVIRONMENT_VARIABLE"
test_value = "... | import os
from nose.tools import eq_
from moban.plugins import Context
def test_context():
context = Context(os.path.join("tests", "fixtures"))
data = context.get_data("simple.yaml")
eq_(data["simple"], "yaml")
def test_environ_variables():
test_var = "TEST_ENVIRONMENT_VARIABLE"
test_value = "... | mit | Python |
04310fb40af60a18ba3a9f15e26fae34c96b0fda | improve devices tests | TheGhouls/oct,TheGhouls/oct,karec/oct,TheGhouls/oct,karec/oct | tests/test_devices.py | tests/test_devices.py | import unittest
from multiprocessing import Process
from oct.core.devices import forwarder, streamer
from oct.utilities.run_device import start_device, run_device
class DummyArgs:
device = 'forwarder'
frontend = 0
backend = 0
class DevicesTest(unittest.TestCase):
def test_forwarder(self):
... | import unittest
from multiprocessing import Process
from oct.core.devices import forwarder, streamer
class DevicesTest(unittest.TestCase):
def test_forwarder(self):
"""Should be able to start forwarder correctly
"""
p = Process(target=forwarder, args=(0, 0))
p.start()
p.j... | mit | Python |
ceea1a28dc1b4d753c691cdb1884be4c5c992572 | Test file erros fixed | Parkayun/wsgit,acuros/wsgit | tests/test_environ.py | tests/test_environ.py | #-*-coding:utf8-*-
'''Tests for Environ object'''
import unittest
from wsgit.request import Environ
def environ(request_parameters={}, meta={}):
return Environ({'parameters':request_parameters, 'meta':meta}).get_dict()
class TestEnviron(unittest.TestCase):
def test_request_method(self):
self.assertEq... | #-*-coding:utf8-*-
'''Tests for Environ object'''
import unittest
from wsgit.request import Environ
def environ(request_parameters, meta={}):
return Environ({'parameters':request_parameters, 'meta':meta}).get_dict()
class TestEnviron(unittest.TestCase):
def test_request_method(self):
self.assertEqual... | mit | Python |
7e8e39290276bd6530e3e379bb3f47eaaf059b63 | Add loop to database connection. It blocks until mysql is up | p4u/projecte_frigos,p4u/projecte_frigos,p4u/projecte_frigos,p4u/projecte_frigos | database.py | database.py | import MySQLdb
CONFIG_FILE="/var/www/monitor/config.py"
class database(object):
def __init__(self):
config = {}
execfile(CONFIG_FILE,config)
while not self._connect(config): print("Retrying database connection")
def _connect(self,config):
try:
self.db = MySQLdb.connect(config["host"],config... | import MySQLdb
CONFIG_FILE="/var/www/monitor/config.py"
class database(object):
def __init__(self):
config = {}
execfile(CONFIG_FILE,config)
self.db = MySQLdb.connect(config["host"],config["user"],config["password"],config["database"])
self.db.autocommit(True)
def insert(self,txt):
dbc = self... | agpl-3.0 | Python |
27fc8b4bcc65a5d1fb63b1032a9a81de540daf88 | Update tests using examples from SVG spec | nvictus/svgpath2mpl | tests/test_parser.py | tests/test_parser.py | import matplotlib as mpl
import matplotlib.pyplot as plt
from svgpath2mpl import parse_path
PATH_DATA = {
'triangle01': {
'd': "M 100 100 L 300 100 L 200 300 z",
'fill': "red",
'stroke': "blue",
'stroke-width': 3,
},
'cubic01': {
'd': "M100,200 C100,100 250,100 250... | import matplotlib as mpl
import matplotlib.pyplot as plt
from svgpath2mpl import parse_path
d = "M300,200 h-150 a150,150 0 1,0 150,-150 z"
fill = "red"
stroke = "blue"
stroke_width = 5
def test_parse_path():
path = parse_path(d)
patch = mpl.patches.PathPatch(path, facecolor=fill, edgecolor=stroke, linewidth=s... | bsd-3-clause | Python |
cc486de5b7d705f31f05e34e77e698fbec953d4f | change port | kevinburke/local-servers,kevinburke/local-servers | plist.py | plist.py | import argparse
import os
import subprocess
from jinja2 import Template
GODOC_DEFAULT_PORT = 6061
parser = argparse.ArgumentParser(description='Produce configurable plist files')
parser.add_argument('template', help='The location of the plist template')
parser.add_argument('--port', help='Which port the service shou... | import argparse
import os
import subprocess
from jinja2 import Template
GODOC_DEFAULT_PORT = 6060
parser = argparse.ArgumentParser(description='Produce configurable plist files')
parser.add_argument('template', help='The location of the plist template')
parser.add_argument('--port', help='Which port the service shou... | mit | Python |
bb3009a2f5ced069ffa8d3dec967d69bd7254483 | fix test_data_plugin to be more reliable | 20c/vodka,20c/vodka | tests/test_plugin.py | tests/test_plugin.py | import unittest
import time
import vodka.plugins
import vodka.data
import vodka.storage
import vodka
@vodka.plugin.register("test")
class PluginA(vodka.plugins.PluginBase):
pass
@vodka.plugin.register("timed_test")
class TimedPlugin(vodka.plugins.TimedPlugin):
def init(self):
self.counter = 0
... | import unittest
import time
import vodka.plugins
import vodka.data
import vodka.storage
import vodka
@vodka.plugin.register("test")
class PluginA(vodka.plugins.PluginBase):
pass
@vodka.plugin.register("timed_test")
class TimedPlugin(vodka.plugins.TimedPlugin):
def init(self):
self.counter = 0
... | apache-2.0 | Python |
66b1c6ff5acde60fd40c7832786abb38ff40a6fe | use more idiomatic IDAPython APIs for enum Segments | williballenthin/python-idb | tests/test_issue29.py | tests/test_issue29.py | import os.path
import idb
def test_issue29():
'''
demonstrate GetManyBytes can retrieve the entire .text section
see github issue #29 for the backstory.
'''
cd = os.path.dirname(__file__)
idbpath = os.path.join(cd, 'data', 'issue29', 'issue29.i64')
with idb.from_file(idbpath... | import os.path
import idb
def test_issue29():
'''
demonstrate GetManyBytes can retrieve the entire .text section
see github issue #29 for the backstory.
'''
cd = os.path.dirname(__file__)
idbpath = os.path.join(cd, 'data', 'issue29', 'issue29.i64')
with idb.from_file(idbpath... | apache-2.0 | Python |
a48f651435d212907cb34164470a9028ba161300 | Add a test for vasp_raman.T | raman-sc/VASP,raman-sc/VASP | test/test_vasp_raman.py | test/test_vasp_raman.py | # -*- coding: utf-8 -*-
import os
import time
import unittest
import vasp_raman
class VaspRamanTester(unittest.TestCase):
def testT(self):
m = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
mref = [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
mres = vasp_raman.T(m)
for i in range(len(m)):
self.... | # -*- coding: utf-8 -*-
import os
import time
import unittest
import vasp_raman
class VaspRamanTester(unittest.TestCase):
def testMAT_m_VEC(self):
self.assertTrue(False)
| mit | Python |
2866efdfffe802755a9acc624af1610349359cb3 | Enable a loop test | chrivers/pyjaco,chrivers/pyjaco,buchuki/pyjaco,mattpap/py2js,chrivers/pyjaco,qsnake/py2js,mattpap/py2js,buchuki/pyjaco,qsnake/py2js,buchuki/pyjaco | tests/test_run_js.py | tests/test_run_js.py | import os
from test_compile_js import (f1, f2, f3, f3b, f3c, f3d, f3e, f4, f5, ifs1,
ifs2, ifs3, ifs4, loop1, tuple1)
def test(func, run):
run_file = "/tmp/run.js"
defs = open("defs.js").read()
with open(run_file, "w") as f:
f.write(defs)
f.write("\n")
f.write(str(func))
... | import os
from test_compile_js import (f1, f2, f3, f3b, f3c, f3d, f3e, f4, f5, ifs1,
ifs2, ifs3, ifs4, loop1, tuple1)
def test(func, run):
run_file = "/tmp/run.js"
defs = open("defs.js").read()
with open(run_file, "w") as f:
f.write(defs)
f.write("\n")
f.write(str(func))
... | mit | Python |
dc0c56445a40161484e30985e8baf43086088b48 | add import test and author check | yoon-gu/Mozart | tests/test_sample.py | tests/test_sample.py | import unittest
class TestStocMethods(unittest.TestCase):
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_isupper(self):
self.assertTrue('FOO'.isupper())
self.assertFalse('Foo'.isupper())
def test_test(self):
self.assertTrue(True)
def test_import(self):
import mozart as mz
sel... | import unittest
import mozart as mz
import numpy as np
class TestStocMethods(unittest.TestCase):
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_isupper(self):
self.assertTrue('FOO'.isupper())
self.assertFalse('Foo'.isupper())
def test_test(self):
self.assertTrue(True) | mit | Python |
927e42b9230008b700a1cf63ee518c4217668f38 | Update test_get_music, includig test for one dimensional array. | DataSounds/DataSounds | tests/test_sounds.py | tests/test_sounds.py | #!/usr/bin/env python
import numpy as np
from DataSounds.sounds import build_scale, note_number, note_name, get_music
def test_build_scale_major():
scale = build_scale('C', 'major', 1)
assert scale == 'c d e f g a b'.split()
def test_build_scale_minor():
scale = build_scale('A', 'minor', 1)
asser... | #!/usr/bin/env python
import numpy as np
from DataSounds.sounds import build_scale, note_number, note_name, get_music
def test_build_scale_major():
scale = build_scale('C', 'major', 1)
assert scale == 'c d e f g a b'.split()
def test_build_scale_minor():
scale = build_scale('A', 'minor', 1)
asser... | bsd-3-clause | Python |
e082a8ba7509d4bb1988c0d1a5778cbd74211b15 | Add log | liupeirong/azure-quickstart-templates,pateixei/azure-quickstart-templates,hlmstone/stone-china-azure-quickstart-templates,sidkri/azure-quickstart-templates,cr0550ver/azure-quickstart-templates,philon-msft/azure-quickstart-templates,cerdmann-pivotal/azure-quickstart-templates,hrboyceiii/azure-quickstart-templates,matheu... | microbosh-setup/setup_devbox.py | microbosh-setup/setup_devbox.py | from Utils.WAAgentUtil import waagent
import Utils.HandlerUtil as Util
import commands
import os
import re
import json
waagent.LoggerInit('/var/log/waagent.log','/dev/stdout')
hutil = Util.HandlerUtility(waagent.Log, waagent.Error, "bosh-deploy-script")
hutil.do_parse_context("enable")
settings= hutil.get_public_setti... | from Utils.WAAgentUtil import waagent
import Utils.HandlerUtil as Util
import commands
import os
import re
import json
waagent.LoggerInit('/var/log/waagent.log','/dev/stdout')
hutil = Util.HandlerUtility(waagent.Log, waagent.Error, "bosh-deploy-script")
hutil.do_parse_context("enable")
settings= hutil.get_public_setti... | mit | Python |
68ac2d95f339a7a1daf644170fab1c15ed0406c4 | Update main module file | bow/pytest-pipeline | pytest_pipeline/__init__.py | pytest_pipeline/__init__.py | # -*- coding: utf-8 -*-
"""
pytest_pipeline
~~~~~~~~~~~~~~~
Pytest plugin for functional testing of data analysis pipelines.
:copyright: (c) 2014 Wibowo Arindrarto <bow@bow.web.id>
:license: BSD
"""
RELEASE = False
__version_info__ = ("0", "2", "0")
__version__ = ".".join(__version_info__)
__ve... | # -*- coding: utf-8 -*-
"""
pytest_pipeline
~~~~~~~~~~~~~~~
Pytest plugin for functional testing of data analysis pipelines.
:copyright: (c) 2014 Wibowo Arindrarto <bow@bow.web.id>
:license: BSD
"""
RELEASE = False
__version_info__ = ("0", "2", "0")
__version__ = ".".join(__version_info__)
__ve... | bsd-3-clause | Python |
0c863aaabee5350396184f0cd8636feaeeb21552 | Refactor velocity constraint calculations in Ex 3.10. | jcrist/pydy,oliverlee/pydy,jcrist/pydy,Shekharrajak/pydy,Shekharrajak/pydy,oliverlee/pydy,skidzo/pydy,jcrist/pydy,jcrist/pydy,skidzo/pydy,jcrist/pydy,Shekharrajak/pydy,jcrist/pydy,Shekharrajak/pydy,jcrist/pydy,skidzo/pydy,oliverlee/pydy,skidzo/pydy | Kane1985/Chapter2/Ex3.10.py | Kane1985/Chapter2/Ex3.10.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 3.10 from Kane 1985."""
from __future__ import division
from sympy import cancel, collect, expand_trig, solve, symbols, trigsimp
from sympy import sin, cos
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy.physics.mechanics import dot, dynami... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 3.10 from Kane 1985."""
from __future__ import division
from sympy import cancel, collect, expand_trig, solve, symbols, trigsimp
from sympy import sin, cos
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy.physics.mechanics import dot, dynami... | bsd-3-clause | Python |
e26ae2fc4baac83856158f4e41149ab3a8bb86a7 | return config if factory default is restored | twhtanghk/docker.esp8266,twhtanghk/docker.esp8266,twhtanghk/docker.esp8266,twhtanghk/docker.esp8266 | python/config/controller.py | python/config/controller.py | import picoweb
from config import model
from util import notFound
import logging
logger = logging.getLogger(__name__)
def get(req, res):
yield from picoweb.jsonify(res, model.load())
def set(req, res):
yield from req.read_form_data()
cfg = model.load()
for key, value in req.form.items():
cfg[key] = value
... | import picoweb
from config import model
from util import notFound
import logging
logger = logging.getLogger(__name__)
def get(req, res):
yield from picoweb.jsonify(res, model.load())
def set(req, res):
yield from req.read_form_data()
cfg = model.load()
for key, value in req.form.items():
cfg[key] = value
... | mit | Python |
0355e131b3afd1cd59baf78d3457f3268c297259 | Use typecheck in command | weblabdeusto/weblabdeusto,morelab/weblabdeusto,porduna/weblabdeusto,weblabdeusto/weblabdeusto,zstars/weblabdeusto,zstars/weblabdeusto,zstars/weblabdeusto,porduna/weblabdeusto,zstars/weblabdeusto,morelab/weblabdeusto,porduna/weblabdeusto,porduna/weblabdeusto,morelab/weblabdeusto,porduna/weblabdeusto,morelab/weblabdeusto... | server/src/weblab/data/command.py | server/src/weblab/data/command.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2009 University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# listed... | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2009 University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# listed... | bsd-2-clause | Python |
56c42a359eb9e1e765b3ea610a4c6a37fbc2c812 | fix failed unittests in travis CI | yunstanford/sanic-transmute | tests/test_parsing.py | tests/test_parsing.py | import json
def test_parsing_path_parameters(app):
request, response = app.test_client.get(
'/api/v1/user/yun',
)
assert response.status == 200
user = response.text
assert json.loads(user) == "yun"
def test_parsing_parameters_optional(app):
request, response = app.test_client... | import pytest
@pytest.mark.asyncio
async def test_parsing_path_parameters(app):
request, response = app.test_client.get(
'/api/v1/user/yun',
)
assert response.status == 200
user = await response.json()
assert user == "yun"
@pytest.mark.asyncio
async def test_parsing_parameters_op... | mit | Python |
ab464dfc6db6736bb116408c1978546cc9d8c93d | update test to respect update of batch2 | jepegit/cellpy,jepegit/cellpy | tests/test_batch2.py | tests/test_batch2.py | import pytest
import tempfile
import logging
from cellpy import log
from cellpy import prms
import cellpy.utils.batch_engines as batch_engines
from . import fdv
log.setup_logging(default_level=logging.DEBUG)
@pytest.fixture()
def clean_dir():
new_path = tempfile.mkdtemp()
return new_path
def test_initial()... | import pytest
import tempfile
import logging
from cellpy import log
from cellpy import prms
import cellpy.utils.batch_engines as batch_engines
from . import fdv
log.setup_logging(default_level=logging.DEBUG)
@pytest.fixture()
def clean_dir():
new_path = tempfile.mkdtemp()
return new_path
def test_initial()... | mit | Python |
d2ab5077e78f58fbe4c059c561553f4b40514bbc | Fix test | dylanaraps/pywal,dylanaraps/pywal,dylanaraps/pywal | tests/test_colors.py | tests/test_colors.py | """Test imagemagick functions."""
import unittest
from pywal import colors
class TestGenColors(unittest.TestCase):
"""Test the gen_colors functions."""
def test_gen_colors(self):
"""> Generate a colorscheme."""
result = colors.get("tests/test_files/test.jpg")
self.assertEqual(result[... | """Test imagemagick functions."""
import unittest
from pywal import colors
class TestGenColors(unittest.TestCase):
"""Test the gen_colors functions."""
def test_gen_colors(self):
"""> Generate a colorscheme."""
result = colors.get("tests/test_files/test.jpg")
self.assertEqual(result[... | mit | Python |
c99bbc0a30dca8aaa72a4c79543400d9fbf97ebb | Fix failing bash completion function test signature. | pallets/click,mitsuhiko/click | tests/test_compat.py | tests/test_compat.py | import click
import pytest
if click.__version__ >= '3.0':
def test_legacy_callbacks(runner):
def legacy_callback(ctx, value):
return value.upper()
@click.command()
@click.option('--foo', callback=legacy_callback)
def cli(foo):
click.echo(foo)
with ... | import click
import pytest
if click.__version__ >= '3.0':
def test_legacy_callbacks(runner):
def legacy_callback(ctx, value):
return value.upper()
@click.command()
@click.option('--foo', callback=legacy_callback)
def cli(foo):
click.echo(foo)
with ... | bsd-3-clause | Python |
5d1e84609daf0a149b725b78e35b7e92b67c2627 | Improve the documentation for command line string parsing. | google/fiddle | fiddle/absl_flags/example/example.py | fiddle/absl_flags/example/example.py | # coding=utf-8
# Copyright 2022 The Fiddle-Config Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | # coding=utf-8
# Copyright 2022 The Fiddle-Config Authors.
#
# 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... | apache-2.0 | Python |
23022049c06efa5cc82a317df55d5d4b5d78b9ce | add some test | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | test/test_bedtools.py | test/test_bedtools.py | import os
from sequana import bedtools, sequana_data
from easydev import TempFile
def test_genomecov():
filename = sequana_data("test_bedcov.bed", "testing")
mydata = bedtools.GenomeCov(filename)
# This requires to call other method before
for chrom in mydata:
chrom.moving_average(n=501)... | import os
from sequana import bedtools, sequana_data
from easydev import TempFile
def test_genomecov():
filename = sequana_data("test_bedcov.bed", "testing")
mydata = bedtools.GenomeCov(filename)
# This requires to call other method before
for chrom in mydata:
chrom.moving_average(n=501)... | bsd-3-clause | Python |
a33139252622492426a35169fdd5139a76b93d10 | Check that binarry files are skipped | dmerejkowsky/replacer | test/test_replacer.py | test/test_replacer.py | import replacer
import path
import pytest
@pytest.fixture
def test_path(tmpdir, monkeypatch):
tmp_path = path.Path(tmpdir)
this_path = path.Path(__file__).parent
src = this_path.joinpath("test_path")
dest = tmp_path.joinpath("test_path")
src.copytree(dest)
monkeypatch.chdir(dest)
return ... | import replacer
import path
import pytest
@pytest.fixture
def test_path(tmpdir, monkeypatch):
tmp_path = path.Path(tmpdir)
this_path = path.Path(__file__).parent
src = this_path.joinpath("test_path")
dest = tmp_path.joinpath("test_path")
src.copytree(dest)
monkeypatch.chdir(dest)
return ... | bsd-3-clause | Python |
24929f857d865ab9a2251545b5fc7d26634394ec | update init | dariusbakunas/rawdisk | rawdisk/plugins/__init__.py | rawdisk/plugins/__init__.py | # -*- coding: utf-8 -*-
__all__ = ['categories', 'plugin_manager', 'filesystems']
from . import categories
from . import plugin_manager
from . import filesystems
| # -*- coding: utf-8 -*-
__all__ = ['categories', 'manager', 'filesystems']
from . import categories
from . import manager
from . import filesystems
| bsd-3-clause | Python |
cca0f026188da9906666d0fbdc2658fb8277e2d3 | Update openssl to version 1.0.2h | rnixx/kivy-ios,kivy/kivy-ios,rnixx/kivy-ios,tonibagur/kivy-ios,cbenhagen/kivy-ios,cbenhagen/kivy-ios,kivy/kivy-ios,kivy/kivy-ios,tonibagur/kivy-ios | recipes/openssl/__init__.py | recipes/openssl/__init__.py | from toolchain import Recipe, shprint
from os.path import join
import sh
arch_mapper = {'i386': 'darwin-i386-cc',
'x86_64': 'darwin64-x86_64-cc',
'armv7': 'iphoneos-cross',
'arm64': 'iphoneos-cross'}
class OpensslRecipe(Recipe):
version = "1.0.2h"
url = "http://w... | from toolchain import Recipe, shprint
from os.path import join
import sh
arch_mapper = {'i386': 'darwin-i386-cc',
'x86_64': 'darwin64-x86_64-cc',
'armv7': 'iphoneos-cross',
'arm64': 'iphoneos-cross'}
class OpensslRecipe(Recipe):
version = "1.0.2g"
url = "http://w... | mit | Python |
1fbbf29a49a6ac0482b28038e07fb2d90048c8fb | fix typo, add missing "g" | sjh/python | debug_decorator.py | debug_decorator.py | #!/usr/bin/env python
#_*_ coding:utf8 _*_
import subprocess
def debug_decorator(func, *args, **kwargs):
def inner_debug_decorator(*args, **kwargs):
try:
import ipdb
except ImportError as e_:
print e_
subprocess.call(["pip", "install", "ipdb"])
print '... | #!/usr/bin/env python
#_*_ coding:utf8 _*_
import subprocess
def debug_decorator(func, *args, **kwargs):
def inner_debug_decorator(*args, **kwargs):
try:
import ipdb
except ImportError as e_:
print e_
subprocess.call(["pip", "install", "ipdb"])
print '... | apache-2.0 | Python |
86ac763b95e6d0742a434a273d598d64e437c75a | add debug_mode | andersbll/deeppy | deeppy/__init__.py | deeppy/__init__.py | __version__ = '0.1.dev'
import os
import logging
debug_mode = os.getenv('DEEPPY_DEBUG', '')
debug_mode = None if debug_mode == '' else debug_mode.lower()
from . import dataset
from . import expr
from . import misc
from . import model
from .autoencoder.autoencoder import Autoencoder, DenoisingAutoencoder
from .autoen... | from . import dataset
from . import expr
from . import misc
from . import model
from .autoencoder.autoencoder import Autoencoder, DenoisingAutoencoder
from .autoencoder.stacked_autoencoder import StackedAutoencoder
from .base import bool_, int_, float_
from .feedforward.activation_layers import (
Activation, LeakyR... | mit | Python |
c9b639e5d77916a91d2d74de041f16bab73fd9e3 | Use github project url | hbrunn/l10n-netherlands | l10n_nl_postcodeapi/__openerp__.py | l10n_nl_postcodeapi/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013-2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the term... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013-2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the term... | agpl-3.0 | Python |
d1332ced773a62396b5d6bd3d49aae1122901629 | test code.. | rabitt/mir_eval,urinieto/mir_eval,mrgloom/mir_eval,rabitt/mir_eval,bmcfee/mir_eval,faroit/mir_eval,bmcfee/mir_eval,craffel/mir_eval,mrgloom/mir_eval,craffel/mir_eval,urinieto/mir_eval,faroit/mir_eval | tests/test_melody.py | tests/test_melody.py | # CREATED: 4/15/14 9:42 AM by Justin Salamon <justin.salamon@nyu.edu>
'''
Unit tests for mir_eval.melody
'''
import numpy as np
import os, sys
sys.path.append('../evaluators')
import melody_eval
def test_melody_functions():
songs = ['daisy1','daisy2','daisy3','daisy4','jazz1','jazz2','jazz3','jazz4','midi1','mid... | # CREATED: 4/15/14 9:42 AM by Justin Salamon <justin.salamon@nyu.edu>
'''
Unit tests for mir_eval.melody
'''
import numpy as np
import mir_eval
def test_melody_functions():
songs = ['daisy1','daisy2','daisy3','daisy4','jazz1','jazz2','jazz3','jazz4','midi1','midi2','midi3','midi4','opera_fem2','opera_fem4','oper... | mit | Python |
515f81994fae8bc455d67e5faeb8fe4c5598156b | fix licensing in depend_filter.py | philippedeswert/dsme,philippedeswert/dsme,philippedeswert/dsme,spiiroin/dsme,spiiroin/dsme | libiphb/depend_filter.py | libiphb/depend_filter.py | #! /usr/bin/env python
# =============================================================================
# File: depend_filter.py
#
# Copyright (C) 2007-2010 Nokia. All rights reserved.
#
# Author: Simo Piiroinen <simo.piiroinen@nokia.com>
#
# This file is part of Dsme.
#
# Dsme is free software; you can redistribute it... | #! /usr/bin/env python
# =============================================================================
# File: depend_filter.py
#
# Copyright (C) 2007 Nokia. All rights reserved.
#
# Author: Simo Piiroinen <simo.piiroinen@nokia.com>
#
# -----------------------------------------------------------------------------
#
# ... | lgpl-2.1 | Python |
3fa1ea04bff36b03633008df8bfdacb083700a2b | add app.warn to init_values to make tests pass | sloria/sphinx-issues | test_sphinx_issues.py | test_sphinx_issues.py | # -*- coding: utf-8 -*-
from tempfile import mkdtemp
from shutil import rmtree
try:
from unittest.mock import Mock
except ImportError:
from mock import Mock
from sphinx.application import Sphinx
from sphinx_issues import (
issue_role,
user_role,
setup as issues_setup
)
import pytest
@pytest.yield... | # -*- coding: utf-8 -*-
from tempfile import mkdtemp
from shutil import rmtree
try:
from unittest.mock import Mock
except ImportError:
from mock import Mock
from sphinx.application import Sphinx
from sphinx_issues import (
issue_role,
user_role,
setup as issues_setup
)
import pytest
@pytest.yield... | mit | Python |
18e95204eb7feef40cd4d61c6fbe3ca021b96129 | Add identify_regions step to image_problem. | PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge | src/puzzle/problems/image/image_problem.py | src/puzzle/problems/image/image_problem.py | """
Steps:
2. For each color band
1. Compute components
2. Identify components
3. Erase identified components from parent
"""
import numpy as np
from data.image import image
from puzzle.constraints.image import decompose_constraints, \
identify_regions_constraints, prepare_image_constraints
from puzzle.proble... | """
Steps:
2. For each color band
1. Compute components
2. Identify components
3. Erase identified components from parent
"""
import numpy as np
from data.image import image
from puzzle.constraints.image import decompose_constraints, \
prepare_image_constraints
from puzzle.problems import problem
from puzzle.... | mit | Python |
efdbbc0cf6e3cab2d7073615b831d2421e97c2c3 | add sympy_theanify function | MBALearnsToCode/Helpy,MBALearnsToCode/Helpy | HelpyFuncs/SymPy.py | HelpyFuncs/SymPy.py | from copy import copy
from numpy import allclose, array, float32
from sympy import Atom, Expr, Float, Integer, sympify
from sympy.core.numbers import NegativeOne, One, Zero
from sympy.matrices import Matrix
from sympy.printing.theanocode import theano_function
FLOAT_TYPES = float, Float, float32, Integer, NegativeOne... | from copy import copy
from numpy import allclose, array, atleast_2d, float32
from sympy import Atom, Float, Integer
from sympy.core.numbers import NegativeOne, One, Zero
from sympy.matrices import Matrix
from sympy.printing.theanocode import theano_function
FLOAT_TYPES = float, Float, float32, Integer, NegativeOne, O... | mit | Python |
22a1e02efae195ef8f93a34eedfc28a8d9bb40ba | Add many tests for prompt.query_yes_no(). | kkujawinski/cookiecutter,utek/cookiecutter,foodszhang/cookiecutter,audreyr/cookiecutter,alex/cookiecutter,letolab/cookiecutter,venumech/cookiecutter,dajose/cookiecutter,venumech/cookiecutter,michaeljoseph/cookiecutter,atlassian/cookiecutter,willingc/cookiecutter,pjbull/cookiecutter,vincentbernat/cookiecutter,sp1rs/cook... | tests/test_prompt.py | tests/test_prompt.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_prompt
--------------
Tests for `cookiecutter.prompt` module.
"""
import unittest
from unittest.mock import patch
from cookiecutter import prompt
# class TestPrompt(unittest.TestCase):
# def test_prompt_for_config(self):
# context = {"cookiecutter... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_prompt
--------------
Tests for `cookiecutter.prompt` module.
"""
import unittest
from cookiecutter import prompt
class TestPrompt(unittest.TestCase):
def test_prompt_for_config(self):
context = {"cookiecutter": {"full_name": "Your Name",
... | bsd-3-clause | Python |
2df00cb8d570ce4994ab1a1acfa5b307ae824f5b | Remove empty folder | savex/spectra | Janitor/__init__.py | Janitor/__init__.py | import utils
utils = utils
logger, logger_api = utils.logger.setup_loggers(
"janitor"
)
| apache-2.0 | Python | |
b851f7ed12abaad2c583a2f5397e38006cf6f5a9 | Add first unit test | pshchelo/ironic-python-heartbeater | ironic_python_heartbeater/tests/unit/test_ironic_python_heartbeater.py | ironic_python_heartbeater/tests/unit/test_ironic_python_heartbeater.py | import unittest
import mock
from ironic_python_heartbeater import ironic_python_heartbeater as iph
class IronicPythonHeartbeaterTestCase(unittest.TestCase):
def test__parse_kernel_cmdline(self):
fake_kernel_opts = "spam=ham foo=bar"
expected_opts = {'spam': 'ham', 'foo': 'bar'}
with moc... | import unittest
class IronicPythonHeartbeaterTestCase(unittest.TestCase):
def test_dummy(self):
self.assertTrue(True)
| apache-2.0 | Python |
4db72e1b4f81132079554dab1ce464363522df02 | Make TIME_ZONE the same as myuw production. | fanglinfang/myuw,uw-it-aca/myuw,fanglinfang/myuw,uw-it-aca/myuw,uw-it-aca/myuw,fanglinfang/myuw,uw-it-aca/myuw | travis-ci/settings.py | travis-ci/settings.py | """
Django settings for project project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | """
Django settings for project project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | apache-2.0 | Python |
eed78d3a671aee0fcc0760f15087085f2918da6c | Add "localhost" in the allowed hosts for testing purposes | ExCiteS/geokey-epicollect,ExCiteS/geokey-epicollect | travis_ci/settings.py | travis_ci/settings.py | """GeoKey settings."""
from geokey.core.settings.dev import *
DEFAULT_FROM_EMAIL = 'no-reply@travis-ci.org'
ACCOUNT_EMAIL_VERIFICATION = 'optional'
SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxx'
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'geokey',
'... | """GeoKey settings."""
from geokey.core.settings.dev import *
DEFAULT_FROM_EMAIL = 'no-reply@travis-ci.org'
ACCOUNT_EMAIL_VERIFICATION = 'optional'
SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxx'
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'geokey',
'... | mit | Python |
a62032bdcfbbf129535ce92a3f0659cfecfbee37 | Update main.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | device/src/main.py | device/src/main.py | #This is the file executing while STM32 MCU bootup, and in this file,
#it will call other functions to fullfill the project.
import pyb
from pyb import Pin
from pyb import Timer
import micropython
#Import light intensity needed module
import LightIntensity
import time
micropython.alloc_emergency_exception_buf(100)... | #This is the file executing while STM32 MCU bootup, and in this file,
#it will call other functions to fullfill the project.
import pyb
from pyb import Pin
from pyb import Timer
import micropython
#Import light intensity needed module
import LightIntensity
import time
micropython.alloc_emergency_exception_buf(100)... | mit | Python |
0a3566d764815af2512104b248024d53ecbbc890 | Fix merge conflicts | galxy25/safeDriver | distance.py | distance.py | #http://www.pyimagesearch.com/2014/08/04/opencv-python-color-detection/
import numpy as np
import cv2
#import os
#Function to compute the ratio of black pixels to non black pixels
def countBlackPixels(grayImg):
height=grayImg.shape[0]
width=grayImg.shape[1]
size = width * height
return (size - cv2.countNonZero(... | #http://www.pyimagesearch.com/2014/08/04/opencv-python-color-detection/
import numpy as np
import cv2
#import os
#Function to compute the ratio of black pixels to non black pixels
def countBlackPixels(grayImg):
height=grayImg.shape[0]
width=grayImg.shape[1]
size = width * height
return (size - cv2.countNonZero(... | mit | Python |
54980f619dd055b5797db131f47a3805f4fe4050 | Test images.data_uri directly | mwilliamson/python-mammoth | tests/images_tests.py | tests/images_tests.py | import io
from hamcrest import assert_that, contains, has_properties
from nose.tools import istest
import mammoth
@istest
def inline_is_available_as_alias_of_img_element():
assert mammoth.images.inline is mammoth.images.img_element
@istest
def data_uri_encodes_images_in_base64():
image_bytes = b"abc"
... | from nose.tools import istest
import mammoth
@istest
def inline_is_available_as_alias_of_img_element():
assert mammoth.images.inline is mammoth.images.img_element
| bsd-2-clause | Python |
0018919168315e8a893e10c56a58f45ec797c750 | Update style formatting. | dgilland/flask-alchy | flask_alchy.py | flask_alchy.py | """Integrate alchy with Flask SQLAlchemy
"""
__version__ = '0.4.0'
__author__ = 'Derrick Gilland <dgilland@gmail.com>'
from flask_sqlalchemy import SQLAlchemy
from alchy import make_declarative_base, QueryModel, ManagerMixin
class Alchy(SQLAlchemy, ManagerMixin):
"""Flask extension that integrates alchy with ... | """Integrate alchy with Flask SQLAlchemy
"""
__version__ = '0.4.0'
__author__ = 'Derrick Gilland <dgilland@gmail.com>'
from flask_sqlalchemy import SQLAlchemy
from alchy import make_declarative_base, QueryModel, ManagerMixin
class Alchy(SQLAlchemy, ManagerMixin):
"""Flask extension that integrates alchy with ... | mit | Python |
460d6184d432f2786c24d7526811cb4d245fa7e9 | add require python-dateutil | moodpulse/l2,moodpulse/l2,moodpulse/l2,moodpulse/l2,moodpulse/l2 | directory/admin.py | directory/admin.py | from django.contrib import admin
import directory.models as models
class ResAdmin(admin.ModelAdmin):
list_filter = ('podrazdeleniye', 'groups', 'hide')
list_display = ('title', 'podrazdeleniye',)
list_display_links = ('title',)
class RefAdmin(admin.ModelAdmin):
list_filter = ('fraction',)
list_d... | from django.contrib import admin
import directory.models as models
class ResAdmin(admin.ModelAdmin):
list_filter = ('podrazdeleniye', 'groups', 'hide')
list_display = ('title', 'podrazdeleniye',)
list_display_links = ('title',)
class RefAdmin(admin.ModelAdmin):
list_filter = ('fraction',)
list_d... | mit | Python |
c9d55abceb4b2dd7189e29a8a9d6cecb9094ad91 | add admin prefix to forum data handling | hacklabr/django-discussion,hacklabr/django-discussion,hacklabr/django-discussion | discussion/urls.py | discussion/urls.py | # -*- coding: utf-8 -*-
from django.conf.urls import url, include
from django.views.generic import TemplateView
from django.views.generic.base import RedirectView
from discussion.views import (CategoryViewSet, ForumViewSet, ForumSearchViewSet, TopicTypeaheadViewSet, TopicViewSet, CommentViewSet, TagViewSet, TopicPageV... | # -*- coding: utf-8 -*-
from django.conf.urls import url, include
from django.views.generic import TemplateView
from django.views.generic.base import RedirectView
from discussion.views import (CategoryViewSet, ForumViewSet, ForumSearchViewSet, TopicTypeaheadViewSet, TopicViewSet, CommentViewSet, TagViewSet, TopicPageV... | agpl-3.0 | Python |
51eab09eefe5d187b904b31f17a573960ae909d0 | Store oauth token for later usage | zen4ever/django-linked-accounts,zen4ever/django-linked-accounts | linked_accounts/views.py | linked_accounts/views.py | from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.views.generic.simple import direct_to_template
import django.contrib.auth as auth
from linked_accounts.models import LinkedAccount
from linked_accounts.utils import get_profile
from l... | from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.views.generic.simple import direct_to_template
import django.contrib.auth as auth
from linked_accounts.models import LinkedAccount
from linked_accounts.utils import get_profile
from l... | mit | Python |
d28bf14c672dd0a4aef1d76523f76670af561486 | Fix checkpoint access rule facts example (#50870) | thaim/ansible,thaim/ansible | lib/ansible/modules/network/checkpoint/checkpoint_access_rule_facts.py | lib/ansible/modules/network/checkpoint/checkpoint_access_rule_facts.py | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | mit | Python |
9e0291475f955bd7d5a35e9bcfdb8a39f3514313 | add persons to admin | Colorless-Green-Ideas/tinylibrary,Colorless-Green-Ideas/tinylibrary,Colorless-Green-Ideas/tinylibrary | tinylibrary/admin.py | tinylibrary/admin.py | from django.contrib import admin
# Register your models here.
from tinylibrary.models import Book, Person
admin.site.register((Book, Person)) | from django.contrib import admin
# Register your models here.
from tinylibrary.models import Book
admin.site.register((Book)) | agpl-3.0 | Python |
a98a20fd089563b6551bc4f2a08d0ff3d2c60083 | test for existance | peterorum/functal,peterorum/functal,peterorum/functal,peterorum/functal,peterorum/functal | titles/get-tweets.py | titles/get-tweets.py | #!/usr/bin/python3
import os
import random
import time
# import re
import sys
# import json
import pprint
import twitter
# import pudb
# pu.db
import pymongo
client = pymongo.MongoClient(os.getenv('mongo_functal'))
# --- get_tweets
def get_tweets(topic):
print('topic : ' + topic)
db = client['topics']
... | #!/usr/bin/python3
import os
import random
import time
# import re
import sys
# import json
import pprint
import twitter
# import pudb
# pu.db
import pymongo
client = pymongo.MongoClient(os.getenv('mongo_functal'))
# --- get_tweets
def get_tweets(topic):
print('topic : ' + topic)
try:
search_re... | mit | Python |
d3b7dc39f0be8d62a9c996f64ef49fd062fbe507 | Fix pep8 in anpy-cli | regardscitoyens/anpy,regardscitoyens/anpy | bin/anpy-cli.py | bin/anpy-cli.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import json
import click
import requests
import attr
from pathlib import Path
from anpy.service import AmendementSearchService
from anpy.parsing.question_parser import parse_question
from anpy.parsing.amendement_parser import parse_amendement
from anpy.parsing... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import json
import click
import requests
import attr
from pathlib import Path
from anpy.service import AmendementSearchService
from anpy.parsing.question_parser import parse_question
from anpy.parsing.amendement_parser import parse_amendement
from anpy.parsing... | mit | Python |
9866fc27d6dd56f0493a22fcddd53b25cfe8da2d | fix db dict | amboycharlie/Child-Friendly-LCMS,amboycharlie/Child-Friendly-LCMS,django-leonardo/django-leonardo,amboycharlie/Child-Friendly-LCMS,django-leonardo/django-leonardo,django-leonardo/django-leonardo,amboycharlie/Child-Friendly-LCMS,django-leonardo/django-leonardo | tests/local_settings.py | tests/local_settings.py | from __future__ import absolute_import, unicode_literals
import sys
import os
SITE_ID = 1
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'memory:',
'TEST_NAME': 'test_db:',
}
}
try:
import mysql # noqa
except Exception:
pass
else:
DATABASES = ... | from __future__ import absolute_import, unicode_literals
import sys
import os
SITE_ID = 1
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'memory:',
'TEST_NAME': 'test_db:',
}
}
try:
import mysql # noqa
except Exception:
pass
else:
DATABASES = ... | apache-2.0 | Python |
b2841940dd1d5b891eed3817552447bb60a930af | Add a return of success flag | abhisheksugam/Climate_Police | Climate_Police/tests/pollution_map.py | Climate_Police/tests/pollution_map.py | import plotly.offline as py
py.init_notebook_mode()
from pre_process import pre_process
def pollution_map(df, source, year, option='Mean'):
# Pre-processes the pollution data so that it can be plotted by plotly.
df2 = pre_process(df, source, year, option)
#scl = [[0.0, 'rgb(242,240,247)'],[0.2, 'rgb(218,218,235... | import plotly.offline as py
py.init_notebook_mode()
from pre_process import pre_process
def pollution_map(df, source, year, option='Mean'):
# Pre-processes the pollution data so that it can be plotted by plotly.
df2 = pre_process(df, source, year, option)
#scl = [[0.0, 'rgb(242,240,247)'],[0.2, 'rgb(218,218,235... | mit | Python |
a0702eb488ffd1eff12d0ffd0a83823cba020214 | Add quick todo so i don't forget | spotify/napalm,napalm-automation/napalm-ios,napalm-automation/napalm,spotify/napalm | utils/__init__.py | utils/__init__.py | # TODO move utils folder inside napalm | apache-2.0 | Python | |
8e478aa4407389cb01752cc59a3e52882ae20261 | order by checked_at | kkamkou/gitmostwanted.com,kkamkou/gitmostwanted.com,kkamkou/gitmostwanted.com,kkamkou/gitmostwanted.com | gitmostwanted/tasks/repo_stars.py | gitmostwanted/tasks/repo_stars.py | from datetime import datetime, timedelta
from gitmostwanted.app import app, db, celery
from gitmostwanted.lib.bigquery.job import Job
from gitmostwanted.models.repo import Repo, RepoStars
from gitmostwanted.services import bigquery
from time import sleep
def results_of(j: Job): # @todo #0:15m copy-paste code in mult... | from datetime import datetime, timedelta
from gitmostwanted.app import app, db, celery
from gitmostwanted.lib.bigquery.job import Job
from gitmostwanted.models.repo import Repo, RepoStars
from gitmostwanted.services import bigquery
from time import sleep
def results_of(j: Job): # @todo #0:15m copy-paste code in mult... | mit | Python |
25f1a03dd494075924133a9e86b6796c5ad7a026 | Use unicode constant. | tv42/fs,nailor/filesystem | fs/_localfs.py | fs/_localfs.py | import os
class InsecurePathError(Exception):
"""
The path operation is unsafe to perform.
An insecure operation was requested, for example:
* a join is performed with an absolute path as input parameter
* '..' is passed as a parameter to child method
* Symlinks not passing security valida... | import os
class InsecurePathError(Exception):
"""
The path operation is unsafe to perform.
An insecure operation was requested, for example:
* a join is performed with an absolute path as input parameter
* '..' is passed as a parameter to child method
* Symlinks not passing security valida... | mit | Python |
8ce8b5f6d016188a8485b7daac30e842ff49ba25 | Bump version to 3.2.3 | JukeboxPipeline/jukeboxmaya,JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/__init__.py | src/jukeboxmaya/__init__.py | __author__ = 'David Zuber'
__email__ = 'zuber.david@gmx.de'
__version__ = '3.2.3'
STANDALONE_INITIALIZED = None
"""After calling :func:`init` this is True, if maya standalone
has been initialized or False, if you are running
from within maya.
It is None, if initialized has not been called yet.
"""
| __author__ = 'David Zuber'
__email__ = 'zuber.david@gmx.de'
__version__ = '3.2.2'
STANDALONE_INITIALIZED = None
"""After calling :func:`init` this is True, if maya standalone
has been initialized or False, if you are running
from within maya.
It is None, if initialized has not been called yet.
"""
| bsd-3-clause | Python |
2cf3fe6e0e700f5e96b68a5acf6574a7f596eb79 | Disable caching discovery for the Sheets API | ppavlidis/rnaseq-pipeline,ppavlidis/rnaseq-pipeline,ppavlidis/rnaseq-pipeline | rnaseq_pipeline/gsheet.py | rnaseq_pipeline/gsheet.py | import argparse
import logging
import os
import os.path
import pickle
import sys
from os.path import dirname, expanduser, join
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
import luigi
import pandas as pd
import xd... | import argparse
import logging
import os
import os.path
import pickle
import sys
from os.path import dirname, expanduser, join
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
import luigi
import pandas as pd
import xd... | unlicense | Python |
6e2124c2d7016618a52c5b858b6149f3f5770fa6 | Add support for SQLite | kennethreitz/dj-database-url,julianwachholz/dj-config-url,f0r4y312/django-connection-url,avorio/dj-database-url | dj_database_url.py | dj_database_url.py | # -*- coding: utf-8 -*-
import os
import urlparse
# Register database schemes in URLs.
urlparse.uses_netloc.append('postgres')
urlparse.uses_netloc.append('mysql')
urlparse.uses_netloc.append('sqlite')
DEFAULT_ENV = 'DATABASE_URL'
def config(env=DEFAULT_ENV):
"""Returns configured DATABASE dictionary from DATAB... | # -*- coding: utf-8 -*-
import os
import urlparse
# Register database schemes in URLs.
urlparse.uses_netloc.append('postgres')
urlparse.uses_netloc.append('mysql')
DEFAULT_ENV = 'DATABASE_URL'
def config(env=DEFAULT_ENV):
"""Returns configured DATABASE dictionary from DATABASE_URL."""
config = {}
if e... | bsd-2-clause | Python |
8ea423173cba143f68a94d65ad5f3b5ce650d434 | Check the container, not the leaf :p | tonioo/modoboa,bearstech/modoboa,RavenB/modoboa,RavenB/modoboa,carragom/modoboa,modoboa/modoboa,tonioo/modoboa,mehulsbhatt/modoboa,carragom/modoboa,modoboa/modoboa,mehulsbhatt/modoboa,modoboa/modoboa,modoboa/modoboa,mehulsbhatt/modoboa,bearstech/modoboa,RavenB/modoboa,bearstech/modoboa,tonioo/modoboa,carragom/modoboa,b... | modoboa/admin/management/commands/handle_mailbox_operations.py | modoboa/admin/management/commands/handle_mailbox_operations.py | import os
import logging
from optparse import make_option
from django.core.management.base import BaseCommand
from modoboa.lib import parameters
from modoboa.lib.sysutils import exec_cmd
from modoboa.admin import AdminConsole
from modoboa.admin.exceptions import AdminError
from modoboa.admin.models import MailboxOperat... | import os
import logging
from optparse import make_option
from django.core.management.base import BaseCommand
from modoboa.lib import parameters
from modoboa.lib.sysutils import exec_cmd
from modoboa.admin import AdminConsole
from modoboa.admin.exceptions import AdminError
from modoboa.admin.models import MailboxOperat... | isc | Python |
532df9f29506fe949488b449721ee22a322dfb8a | fix flake8 violation | rackerlabs/django-DefectDojo,rackerlabs/django-DefectDojo,rackerlabs/django-DefectDojo,rackerlabs/django-DefectDojo | dojo/tools/__init__.py | dojo/tools/__init__.py | __author__ = 'jay7958'
SCAN_GENERIC_FINDING = 'Generic Findings Import'
SCAN_SONARQUBE_API = 'SonarQube API Import'
SCAN_QUALYS_REPORT = 'Qualys Scan'
def requires_file(scan_type):
return (
scan_type and scan_type != SCAN_SONARQUBE_API
)
def handles_active_verified_statuses(scan_type):
return s... | __author__ = 'jay7958'
SCAN_GENERIC_FINDING = 'Generic Findings Import'
SCAN_SONARQUBE_API = 'SonarQube API Import'
SCAN_QUALYS_REPORT = 'Qualys Scan'
def requires_file(scan_type):
return (
scan_type and scan_type != SCAN_SONARQUBE_API
)
def handles_active_verified_statuses(scan_type):
return sc... | bsd-3-clause | Python |
4c6fb23dd40216604f914d4f869b40d23b13bf73 | Bump version to no longer claim to be 1.4.5 final. | riklaunim/django-custom-multisite,riklaunim/django-custom-multisite,riklaunim/django-custom-multisite | django/__init__.py | django/__init__.py | VERSION = (1, 4, 6, 'alpha', 0)
def get_version(version=None):
"""Derives a PEP386-compliant version number from VERSION."""
if version is None:
version = VERSION
assert len(version) == 5
assert version[3] in ('alpha', 'beta', 'rc', 'final')
# Now build the two parts of the version number:... | VERSION = (1, 4, 5, 'final', 0)
def get_version(version=None):
"""Derives a PEP386-compliant version number from VERSION."""
if version is None:
version = VERSION
assert len(version) == 5
assert version[3] in ('alpha', 'beta', 'rc', 'final')
# Now build the two parts of the version number:... | bsd-3-clause | Python |
bb0c8d2830b749b1f0255afab9c7a04b8a6e2256 | fix asyncio test | snower/TorMySQL,snower/TorMySQL | tests/test_asyncio.py | tests/test_asyncio.py | # -*- coding: utf-8 -*-
# 17/12/11
# create by: snower
import os
try:
import asyncio
from tormysql.platform import use_asyncio
use_asyncio()
except:
pass
from tormysql.cursor import SSCursor
from tormysql.helpers import ConnectionPool
from tornado.testing import AsyncTestCase
from tornado.testing impor... | # -*- coding: utf-8 -*-
# 17/12/11
# create by: snower
import os
try:
import asyncio
from tormysql.platform import use_asyncio
use_asyncio()
except:
pass
from tormysql.helpers import ConnectionPool
from tornado.testing import AsyncTestCase
from tornado.testing import gen_test
from tormysql.util import ... | mit | Python |
d81aa08030bb3430a9d69083cb40429f3f89a80d | Fix for unicode names | MilesCranmer/research_match,MilesCranmer/research_match | download.py | download.py | #!/usr/bin/python
import sys, os
import ads
reload(sys)
sys.setdefaultencoding('utf8')
names_file = open(sys.argv[1])
#Default abstract storage
abstract_directory = "abstracts"
if len(sys.argv) > 2:
abstract_directory = sys.argv[2]
if not os.path.exists(abstract_directory):
os.makedirs(abstract_directory)
numbe... | #!/usr/bin/python
import sys, os
import ads as ads
names_file = open(sys.argv[1])
#Default abstract storage
abstract_directory = "abstracts"
if len(sys.argv) > 2:
abstract_directory = sys.argv[2]
if not os.path.exists(abstract_directory):
os.makedirs(abstract_directory)
number_abstracts = 4
if len(sys.argv) > 3:... | unlicense | Python |
9edef653ad07614a3cc553c837797eda8373fe18 | Add schema test | gotling/mopidy-auto,gotling/mopidy-auto,gotling/mopidy-auto | tests/test_extension.py | tests/test_extension.py | from __future__ import unicode_literals
import unittest
from mopidy import core
from mopidy_auto import Extension, frontend as frontend_lib
def test_get_default_config():
ext = Extension()
config = ext.get_default_config()
assert '[auto]' in config
assert 'enabled = true' in config
def test_get... | from __future__ import unicode_literals
from mopidy_auto import Extension, frontend as frontend_lib
def test_get_default_config():
ext = Extension()
config = ext.get_default_config()
assert '[auto]' in config
assert 'enabled = true' in config
def test_get_config_schema():
ext = Extension()
... | mit | Python |
c3e04e47c54eed8058751dbc86f7b364fc57a05b | fix tests for Django 4.0 | ivelum/djangoql,ivelum/djangoql,ivelum/djangoql | test_project/test_project/urls.py | test_project/test_project/urls.py | """test_project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cla... | """test_project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cla... | mit | Python |
1e6a45f0b5c73ddedf0dfc1146ea7d48c6e10ea5 | print message to screen in debug mode | icve/liv-Ard,icve/liv-Ard,icve/liv-Ard,icve/liv-Ard,icve/liv-Ard | hostscripts/current_hostscript.py | hostscripts/current_hostscript.py | #!/mnt/usb/wk/jpt/py/bin/python
import time
from serial import Serial
from animations import Led_clock_pointer, Led_clock_flasher
from lib import lcdControl
from lib import SevSeg
from lib import Motion_sensor
from lib.get_data import get_temp, get_netstat
from animations import Seven_segment_clock, Rainfall
from sys ... | #!/mnt/usb/wk/jpt/py/bin/python
import time
from serial import Serial
from animations import Led_clock_pointer, Led_clock_flasher
from lib import lcdControl
from lib import SevSeg
from lib import Motion_sensor
from lib.get_data import get_temp, get_netstat
from animations import Seven_segment_clock, Rainfall
from sys ... | mit | Python |
179d39cb47ba60714ac9498097cb93721978faf7 | add minor enhancement to the queue | total-impact/total-impact-core,total-impact/total-impact-core,Impactstory/total-impact-core,total-impact/total-impact-core,Impactstory/total-impact-core,Impactstory/total-impact-core,Impactstory/total-impact-core,total-impact/total-impact-core | totalimpact/queue.py | totalimpact/queue.py | from totalimpact.models import Item
import totalimpact.dao as dao
import datetime
# some data useful for testing
# d = {"DOI" : ["10.1371/journal.pcbi.1000361", "10.1016/j.meegid.2011.02.004"], "URL" : ["http://cottagelabs.com"]}
class Queue(dao.Dao):
__type__ = None
@property
def queue(self):
... | from totalimpact.models import Item
import totalimpact.dao as dao
import datetime
# some data useful for testing
# d = {"DOI" : ["10.1371/journal.pcbi.1000361", "10.1016/j.meegid.2011.02.004"], "URL" : ["http://cottagelabs.com"]}
class Queue(dao.Dao):
__type__ = None
@property
def queue(self):
... | mit | Python |
fd456eb86bc5fa46f216d3d84aa19b8a1b6ae025 | Use the pythonish "... is not None" instead of "... != None". | CoryMcCartan/chapel,CoryMcCartan/chapel,CoryMcCartan/chapel,hildeth/chapel,chizarlicious/chapel,chizarlicious/chapel,CoryMcCartan/chapel,chizarlicious/chapel,chizarlicious/chapel,hildeth/chapel,CoryMcCartan/chapel,chizarlicious/chapel,chizarlicious/chapel,hildeth/chapel,hildeth/chapel,CoryMcCartan/chapel,hildeth/chapel... | util/chplenv/utils.py | util/chplenv/utils.py | import os, re, subprocess
from distutils.spawn import find_executable
from collections import namedtuple
def memoize(func):
cache = func.cache = {}
def memoize_wrapper(*args, **kwargs):
if kwargs:
return func(*args, **kwargs)
if args not in cache:
cache[args] = func(*ar... | import os, re, subprocess
from distutils.spawn import find_executable
from collections import namedtuple
def memoize(func):
cache = func.cache = {}
def memoize_wrapper(*args, **kwargs):
if kwargs:
return func(*args, **kwargs)
if args not in cache:
cache[args] = func(*ar... | apache-2.0 | Python |
cecd3fbd5a977f366ce5adad56c01b02a145b038 | Remove dud test | funkybob/knights-templater,funkybob/knights-templater | tests/test_comment.py | tests/test_comment.py | from .utils import TemplateTestCase, Mock
class CommentTagText(TemplateTestCase):
def test_comment(self):
self.assertRendered('{# test #}', '')
| from .utils import TemplateTestCase, Mock
from knights import Template
class LoadTagTest(TemplateTestCase):
def test_load_default(self):
t = Template('{! knights.defaultfilters !}')
self.assertIn('escape', t.parser.filters)
class CommentTagText(TemplateTestCase):
def test_comment(self):
... | mit | Python |
3118ab8122f03b95666d8980004583fe73ab7860 | Add new test | nhshd-slot/SLOT,nhshd-slot/SLOT,nhshd-slot/SLOT | tests/test_messaging.py | tests/test_messaging.py | from context import slot
class TestMessaging:
def test_converts_mobile_string_to_int(self):
result = slot.messaging.mobile_number_string_to_int("441234567890")
assert isinstance(result, int)
assert (result == 441234567890)
def test_converts_mobile_string_with_plus_prefix_to_int(self)... | from context import slot
class TestMessaging:
def test_converts_mobile_string_to_int(self):
result = slot.messaging.mobile_number_string_to_int("441234567890")
assert isinstance(result, int)
assert (result == 441234567890)
def test_converts_mobile_int_to_int(self):
result = s... | mit | Python |
68a3d1486d14c5184ee3e70197cb0e0926b15e11 | Rename request fixture to comply with new pytest restrictions. | wichert/pyramid_jwt | tests/test_cookies.py | tests/test_cookies.py | import uuid
import pytest
from pyramid.interfaces import IAuthenticationPolicy
from webob import Request
from zope.interface.verify import verifyObject
from pyramid_jwt.policy import JWTTokenAuthenticationPolicy
@pytest.fixture(scope='module')
def principal():
return str(uuid.uuid4())
@pytest.fixture(scope='... | import uuid
import pytest
from pyramid.interfaces import IAuthenticationPolicy
from webob import Request
from zope.interface.verify import verifyObject
from pyramid_jwt.policy import JWTTokenAuthenticationPolicy
@pytest.fixture(scope='module')
def principal():
return str(uuid.uuid4())
@pytest.fixture(scope='... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.