commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
2e3341c7e32182cc35f6a658d613c77a72b9b377 | Modify comments | src/marketdata/access/remote/google.py | src/marketdata/access/remote/google.py | import urllib2
import urllib
from marketdata.utils.transform.google.rawquote_intraday import TranformIntradayQuote
def _getUrl(url, urlconditions):
url_values = urllib.urlencode(urlconditions)
return url + '?' + url_values
def _pullQuote(url, urlconditions):
req = urllib2.Request(_getUrl(url, urlconditi... | import urllib2
import urllib
from marketdata.utils.transform.google.rawquote_intraday import TranformIntradayQuote
def _getUrl(url, urlconditions):
url_values = urllib.urlencode(urlconditions)
return url + '?' + url_values
def _pullQuote(url, urlconditions):
req = urllib2.Request(_getUrl(url, urlconditi... | Python | 0 |
3577de6383053e0f8e05d531c8a632be12e89ca6 | fix for route parser to handle when path=None | python/marvin/utils/general/decorators.py | python/marvin/utils/general/decorators.py |
from functools import wraps
# General Decorators
def parseRoutePath(f):
''' Decorator to parse generic route path '''
@wraps(f)
def decorated_function(inst, *args, **kwargs):
if 'path' in kwargs and kwargs['path']:
for kw in kwargs['path'].split('/'):
if len(kw) == 0:... |
from functools import wraps
# General Decorators
def parseRoutePath(f):
''' Decorator to parse generic route path '''
@wraps(f)
def decorated_function(inst, *args, **kwargs):
for kw in kwargs['path'].split('/'):
if len(kw) == 0:
continue
var, value = kw.sp... | Python | 0.000106 |
4c31e94752e635c0826dd6b223201fe7ce0d5220 | Fix cache_home to expand path | rplugin/python3/deoplete/sources/jedi.py | rplugin/python3/deoplete/sources/jedi.py | import os
import re
import sys
current_dir = os.path.dirname(os.path.abspath(__file__))
jedi_dir = os.path.join(os.path.dirname(current_dir), 'jedi')
sys.path.insert(0, jedi_dir)
import jedi
from .base import Base
class Source(Base):
def __init__(self, vim):
Base.__init__(self, vim)
self.name ... | import os
import re
import sys
current_dir = os.path.dirname(os.path.abspath(__file__))
jedi_dir = os.path.join(os.path.dirname(current_dir), 'jedi')
sys.path.insert(0, jedi_dir)
import jedi
from .base import Base
class Source(Base):
def __init__(self, vim):
Base.__init__(self, vim)
self.name ... | Python | 0 |
9044018db0a909884ada225af12c7252f85aece8 | Remove dead code | examples/tictactoe_td0.py | examples/tictactoe_td0.py | from capstone.environment import Environment
from capstone.game import TicTacToe
from capstone.mdp import GameMDP
from capstone.player import AlphaBeta, RandPlayer
from capstone.util import ZobristHashing
class TabularTD0(object):
def __init__(self, env, policy=RandPlayer(), alpha=0.01, gamma=0.99, n_episodes=10... | from capstone.environment import Environment
from capstone.game import TicTacToe
from capstone.mdp import GameMDP
from capstone.player import AlphaBeta, RandPlayer
from capstone.util import ZobristHashing
# class TabularTD0(object):
# def __init__(self, env, policy, alpha, gamma, n_episodes):
# self.env =... | Python | 0.001497 |
114793d6abce14ece5fbd537cce38230366db365 | Fix compilation | rsqueakvm/plugins/immutability_plugin.py | rsqueakvm/plugins/immutability_plugin.py | """
RSqueak/VM plugin which provides support for immutable objects.
Immutable objects can be created as copy of existing objects
or from a list of arguments. The package `ImmutableObjects`, located in
`/repository`, needs to be loaded in the image.
"""
from rsqueakvm.error import PrimitiveFailedError
from rsqueakvm.m... | """
RSqueak/VM plugin which provides support for immutable objects.
Immutable objects can be created as copy of existing objects
or from a list of arguments. The package `ImmutableObjects`, located in
`/repository`, needs to be loaded in the image.
"""
from rsqueakvm.error import PrimitiveFailedError
from rsqueakvm.m... | Python | 0.000001 |
66586d0fa74a7b109305d6330b2448c32a54bd1b | Fix lints | flask_fs/backends/__init__.py | flask_fs/backends/__init__.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import six
from flask_fs import files
__all__ = [i.encode('ascii') for i in ('BaseBackend', 'DEFAULT_BACKEND')]
DEFAULT_BACKEND = 'local'
class BaseBackend(object):
'''
Abstract class to implement backend.
'''
root = None
DEFAULT... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import six
from flask_fs import files
__all__ = [i.encode('ascii') for i in ('BaseBackend', 'DEFAULT_BACKEND')]
DEFAULT_BACKEND = 'local'
class BaseBackend(object):
'''
Abstract class to implement backend.
'''
root = None
DEFAULT... | Python | 0.000006 |
27acea8beae7876159f142add8d3e55b62d61f8f | Add read method to modulators | feder/questionaries/modulator.py | feder/questionaries/modulator.py | from django import forms
from django.utils.translation import ugettext as _
class BaseBlobFormModulator(object):
description = None
def __init__(self, blob=None):
self.blob = blob or {}
super(BaseBlobFormModulator, self).__init__()
def create(self, fields):
raise NotImplementedEr... | from django import forms
from django.utils.translation import ugettext as _
class BaseBlobFormModulator(object):
description = None
def __init__(self, blob=None):
self.blob = blob or {}
super(BaseBlobFormModulator, self).__init__()
def create(self):
raise NotImplementedError("")
... | Python | 0.000001 |
90e1b254266155abded62bc3155785961acc0ff0 | Split filepath and count in credential module | bin/Credential.py | bin/Credential.py | #!/usr/bin/env python2
# -*-coding:UTF-8 -*
import time
from packages import Paste
from pubsublogger import publisher
from Helper import Process
import re
if __name__ == "__main__":
publisher.port = 6380
publisher.channel = "Script"
config_section = "Credential"
p = Process(config_section)
publishe... | #!/usr/bin/env python2
# -*-coding:UTF-8 -*
import time
from packages import Paste
from pubsublogger import publisher
from Helper import Process
import re
if __name__ == "__main__":
publisher.port = 6380
publisher.channel = "Script"
config_section = "Credential"
p = Process(config_section)
publishe... | Python | 0 |
e18047a3cb3c8303bf64dc9ce5fc230e29b25b56 | Fix fac-gitall.py | bin/fac-gitall.py | bin/fac-gitall.py | #!/usr/bin/env python3
import sys
import os
import lnls
#import git
from termcolor import colored
import subprocess
git_functions = ('pull','push','status','diff','clone')
def run_git_clone():
if not os.path.exists(lnls.folder_code):
print('fac-gitall.py: please create ' + lnls.folder_code + ' folder ... | #!/usr/bin/env python3
import sys
import os
import lnls
#import git
from termcolor import colored
import subprocess
git_functions = ('pull','push','status','diff','clone')
def run_git_clone():
if not os.path.exists(lnls.folder_code):
print('gitall.py: please create ' + lnls.folder_code + ' folder with... | Python | 0 |
1b172c592bb5efc1a0dcf8f18d6ea6a1037ec9ff | Clean things up a bit | filebutler_upload/filehandler.py | filebutler_upload/filehandler.py | import requests
class Filemanager:
def __init__(self, url, username, password):
self.headers = {'Accept': 'application/json'}
self.username = username
self.password = password
self.url = url
def list(self):
'''
List all files uploaded by user
'''
... | import requests
#import os
#from ConfigParser import RawConfigParser
#from text_table import TextTable
class Filemanager:
def __init__(self, url, username, password):
self.headers = {'Accept': 'application/json'}
self.username = username
self.password = password
self.url = url
... | Python | 0.000008 |
3fea731e62653dfc847e82b8185feb029d844fd8 | Revert "minifiying doctype json's" | frappe/modules/export_file.py | frappe/modules/export_file.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, os, json
import frappe.model
from frappe.modules import scrub, get_module_path, lower_case_files_for, scrub_dt_dn
def export_doc(doc):
export_to_files([[doc.doct... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, os, json
import frappe.model
from frappe.modules import scrub, get_module_path, lower_case_files_for, scrub_dt_dn
def export_doc(doc):
export_to_files([[doc.doct... | Python | 0 |
f03ba99cd7c4db064b2ece3d226b30c8e9ca63bf | Add a test for scipy.integrate.newton_cotes. A more comprehensive set of tests would be better, but it's a start. | scipy/integrate/tests/test_quadrature.py | scipy/integrate/tests/test_quadrature.py |
import numpy
from numpy import cos, sin, pi
from numpy.testing import *
from scipy.integrate import quadrature, romberg, romb, newton_cotes
class TestQuadrature(TestCase):
def quad(self, x, a, b, args):
raise NotImplementedError
def test_quadrature(self):
# Typical function with two extra ar... |
import numpy
from numpy import cos, sin, pi
from numpy.testing import *
from scipy.integrate import quadrature, romberg, romb
class TestQuadrature(TestCase):
def quad(self, x, a, b, args):
raise NotImplementedError
def test_quadrature(self):
# Typical function with two extra arguments:
... | Python | 0.996962 |
3aa198bc49b32db49abe5653ed82f1ede7081df7 | make fix work for both versions of GeoSteiner | geonet/geosteiner.py | geonet/geosteiner.py | '''
Wrapper for GeoSteiner program
'''
from itertools import dropwhile, takewhile, ifilter
import os
from subprocess import Popen, PIPE
from geonet.network import SteinerTree
# TODO: check if GeoSteiner is available
def geosteiner(pos):
'''Call geosteiner to compute and return'''
def parse_ps(output):
... | '''
Wrapper for GeoSteiner program
'''
from itertools import dropwhile, takewhile, ifilter
import os
from subprocess import Popen, PIPE
from geonet.network import SteinerTree
# TODO: check if GeoSteiner is available
def geosteiner(pos):
'''Call geosteiner to compute and return'''
def parse_ps(output):
... | Python | 0 |
a9b2b6fe868ab564653f40e611ce6a788f396981 | Fix wrong variable replacement | backend/globaleaks/tests/jobs/test_pgp_check_sched.py | backend/globaleaks/tests/jobs/test_pgp_check_sched.py | # -*- coding: utf-8 -*-
from twisted.internet.defer import inlineCallbacks
from globaleaks.tests import helpers
from globaleaks.jobs import pgp_check_sched
class TestPGPCheckSchedule(helpers.TestGLWithPopulatedDB):
encryption_scenario = 'ONE_VALID_ONE_EXPIRED'
@inlineCallbacks
def test_pgp_check_schedul... | # -*- coding: utf-8 -*-
from twisted.internet.defer import inlineCallbacks
from globaleaks.tests import helpers
from globaleaks.jobs import secure_file_delete_sched
class TestPGPCheckSchedule(helpers.TestGLWithPopulatedDB):
encryption_scenario = 'ONE_VALID_ONE_EXPIRED'
@inlineCallbacks
def test_pgp_chec... | Python | 0.000019 |
6ef76159ab32e454241f7979a1cdf320c463dd9e | add config file option | planetstack/planetstack-backend.py | planetstack/planetstack-backend.py | #!/usr/bin/env python
import os
import argparse
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings")
from observer.backend import Backend
from planetstack.config import Config
config = Config()
# after http://www.erlenstar.demon.co.uk/unix/faq_2.html
def daemon():
"""Daemonize the current proc... | #!/usr/bin/env python
import os
import argparse
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings")
from observer.backend import Backend
from planetstack.config import Config
config = Config()
# after http://www.erlenstar.demon.co.uk/unix/faq_2.html
def daemon():
"""Daemonize the current proc... | Python | 0.000002 |
a5942402fdf8f8013dbe62636ea29582538e33c6 | fix argument name | bin/trait_mapping/create_table_for_manual_curation.py | bin/trait_mapping/create_table_for_manual_curation.py | #!/usr/bin/env python3
import argparse
from eva_cttv_pipeline.trait_mapping.ols import (
get_ontology_label_from_ols, is_current_and_in_efo, is_in_efo,
)
def find_previous_mapping(trait_name, previous_mappings):
if trait_name not in previous_mappings:
return ''
uri = previous_mappings[trait_name... | #!/usr/bin/env python3
import argparse
from eva_cttv_pipeline.trait_mapping.ols import (
get_ontology_label_from_ols, is_current_and_in_efo, is_in_efo,
)
def find_previous_mapping(trait_name, previous_mappings):
if trait_name not in previous_mappings:
return ''
uri = previous_mappings[trait_name... | Python | 0.005603 |
662608e6a183810072cb5e9dc7545145c866cf34 | Add missing import | byceps/services/shop/order/action_registry_service.py | byceps/services/shop/order/action_registry_service.py | """
byceps.services.shop.order.action_registry_service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from ...seating.models.category import CategoryID
from ...user_badge.models.badge import BadgeID
from ..article.mod... | """
byceps.services.shop.order.action_registry_service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from ...seating.models.category import CategoryID
from ...user_badge.models.badge import BadgeID
from ..article.mod... | Python | 0.000466 |
5cdf89e64ab9dabf277a867a774a88f12e1ece5e | Fix broken exception `BadHeader` | src/pyload/core/network/http/exceptions.py | src/pyload/core/network/http/exceptions.py | # -*- coding: utf-8 -*-
PROPRIETARY_RESPONSES = {
440: "Login Timeout - The client's session has expired and must log in again.",
449: "Retry With - The server cannot honour the request because the user has not provided the required information",
451: "Redirect - Unsupported Redirect Header",
509: "Ban... | # -*- coding: utf-8 -*-
PROPRIETARY_RESPONSES = {
440: "Login Timeout - The client's session has expired and must log in again.",
449: "Retry With - The server cannot honour the request because the user has not provided the required information",
451: "Redirect - Unsupported Redirect Header",
509: "Ban... | Python | 0.000001 |
a23c6132792bd6aff420791cf4b78a955cc0dfad | add headless | inscrawler/browser.py | inscrawler/browser.py | import os
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.chrome.options import Options
from time import sleep
class Browser:
def __init__(self):
dir_path = os.path.dirname(os.path.realpath(__f... | import os
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.chrome.options import Options
from time import sleep
class Browser:
def __init__(self):
dir_path = os.path.dirname(os.path.realpath(__f... | Python | 0.999995 |
b44a9dfbf26e07b9db6a31119044b8347907a5a5 | disable fid map | examples/fitsdiff2.py | examples/fitsdiff2.py | #! /usr/bin/env python
#
# This routine can diff images from its neighbors. For a series i=1,N
# this can loop over i=2,N to produce N-1 difference images
#
# B_i = A_i - A_i-1
#
from __future__ import print_function
import glob
import sys
import shutil
import os
from astropy.io import fits
import numpy as np
i... | #! /usr/bin/env python
#
# This routine can diff images from its neighbors. For a series i=1,N
# this can loop over i=2,N to produce N-1 difference images
#
# B_i = A_i - A_i-1
#
from __future__ import print_function
import glob
import sys
import shutil
import os
from astropy.io import fits
import numpy as np
i... | Python | 0.000001 |
2c2d2024abf0eaa34b25038d2eb4cd5d8aeb6323 | remove defunct test | fsspec/tests/test_registry.py | fsspec/tests/test_registry.py | import sys
from unittest.mock import create_autospec, patch
import pytest
from fsspec.registry import (
ReadOnlyError,
_registry,
get_filesystem_class,
known_implementations,
register_implementation,
registry,
)
from fsspec.spec import AbstractFileSystem
try:
from importlib.metadata impor... | import sys
from unittest.mock import create_autospec, patch
import pytest
from fsspec.registry import (
ReadOnlyError,
_registry,
get_filesystem_class,
known_implementations,
register_implementation,
registry,
)
from fsspec.spec import AbstractFileSystem
try:
from importlib.metadata impor... | Python | 0.998747 |
7a39c7a433e909b58ad0fdf8adaaa5c944e91e0e | Fix non-array samples in multinomial estimator. | src/python/cargo/statistics/multinomial.py | src/python/cargo/statistics/multinomial.py | """
@author: Bryan Silverthorn <bcs@cargo-cult.org>
"""
import numpy
from cargo.log import get_logger
from cargo.statistics.base import (
Estimator,
Distribution,
)
log = get_logger(__name__)
def smooth_multinomial_mixture(mixture, epsilon = 1e-3):
"""
Apply a smoothing term to the m... | """
@author: Bryan Silverthorn <bcs@cargo-cult.org>
"""
import numpy
from cargo.log import get_logger
from cargo.statistics.base import (
Estimator,
Distribution,
)
log = get_logger(__name__)
def smooth_multinomial_mixture(mixture, epsilon = 1e-3):
"""
Apply a smoothing term to the m... | Python | 0.000021 |
2319534cecf4ed475469a8ded468b348a21947ce | Fix shape of array returned from Arnoldi matrix exponential | src/WaveBlocksND/MatrixExponential.py | src/WaveBlocksND/MatrixExponential.py | """The WaveBlocks Project
This file contains several different algorithms to compute the
matrix exponential. Currently we have an exponential based on
Pade approximations and an Arnoldi iteration method.
@author: R. Bourquin
@copyright: Copyright (C) 2007 V. Gradinaru
@copyright: Copyright (C) 2010, 2011, 2012, 2015 ... | """The WaveBlocks Project
This file contains several different algorithms to compute the
matrix exponential. Currently we have an exponential based on
Pade approximations and an Arnoldi iteration method.
@author: R. Bourquin
@copyright: Copyright (C) 2007 V. Gradinaru
@copyright: Copyright (C) 2010, 2011, 2012, 2015 ... | Python | 0.000008 |
304760823382e72efb8f98ab3b5a98147f98c0e8 | Improve userlist liveness guarentees | geventirc/channel.py | geventirc/channel.py |
import gevent
from geventirc.message import Join, Part, Privmsg
from geventirc.replycodes import replies
from geventirc.userlist import UserList
class Channel(object):
"""Object representing an IRC channel.
This is the reccomended way to do operations like joins, or tracking user lists.
A channel may be join()e... |
import gevent
from geventirc.message import Join, Part, Privmsg
from geventirc.replycodes import replies
from geventirc.userlist import UserList
class Channel(object):
"""Object representing an IRC channel.
This is the reccomended way to do operations like joins, or tracking user lists.
A channel may be join()e... | Python | 0 |
cda111aecdd650d1f08b75e2c92774526bf9e06d | Change Misc to Miscellaneous Utilities | bipy/util/misc.py | bipy/util/misc.py | #!/usr/bin/env python
r"""
Miscellaneous Utilities (:mod:`bipy.util.misc`)
============================
.. currentmodule:: bipy.util.misc
This module provides miscellaneous useful utility classes and methods that do
not fit in any specific module.
Functions
---------
.. autosummary::
:toctree: generated/
saf... | #!/usr/bin/env python
r"""
Misc (:mod:`bipy.util.misc`)
============================
.. currentmodule:: bipy.util.misc
This module provides miscellaneous useful utility classes and methods that do
not fit in any specific module.
Functions
---------
.. autosummary::
:toctree: generated/
safe_md5
"""
from __f... | Python | 0 |
0a0d55a2a9aa07b0841b2a221e8b7bc9b844b976 | update version numbers and project details | butter/__init__.py | butter/__init__.py | #!/usr/bin/env python
"""Butter: library to give python access to linux's more lower level features"""
__author__ = "Da_Blitz"
__version__ = "0.2"
__email__ = "code@pocketnix.org"
__license__ = "BSD (3 Clause)"
__url__ = "http://code.pocketnix.org/butter"
| #!/usr/bin/env python
"""Butter: library to give python access to linux's more lower level features"""
__author__ = "Da_Blitz"
__version__ = "0.1"
__email__ = "code@pocketnix.org"
__license__ = "BSD (3 Clause)"
__url__ = "http://code.pocketnix.org/"
__testsuite__ = "tests.testall"
| Python | 0 |
39d4f9c0df535c13c6f37eaaccaaeabb0b92b8e0 | Bump version number | fabric_colors/_version.py | fabric_colors/_version.py | __version__ = "0.9.42"
| __version__ = "0.9.41"
| Python | 0.000002 |
4e09200b83f986ce333f5b1143e13a4b2d7df2ce | determine site activity on process_view | pykeg/src/pykeg/web/middleware.py | pykeg/src/pykeg/web/middleware.py | # Copyright 2011 Mike Wakerly <opensource@hoho.com>
#
# This file is part of the Pykeg package of the Kegbot project.
# For more information on Pykeg or Kegbot, see http://kegbot.org/
#
# Pykeg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by... | # Copyright 2011 Mike Wakerly <opensource@hoho.com>
#
# This file is part of the Pykeg package of the Kegbot project.
# For more information on Pykeg or Kegbot, see http://kegbot.org/
#
# Pykeg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by... | Python | 0.00001 |
7b21270ca893e90790a0a60c8417df12052ea9a0 | Add alternate MDP-ID aleph API if the first fails | falcom/api/reject_list.py | falcom/api/reject_list.py | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
from os import environ
from urllib.request import urlopen
from .uri import URI, APIQuerier
from .marc import get_marc_data_from_xml
from .wor... | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
from os import environ
from urllib.request import urlopen
from .uri import URI, APIQuerier
from .marc import get_marc_data_from_xml
from .wor... | Python | 0.000005 |
fae13bf07e3b336f52911cb23291c6db029922cb | fix timing issues with new test | selfdrive/controls/tests/test_startup.py | selfdrive/controls/tests/test_startup.py | #!/usr/bin/env python3
import time
import unittest
from parameterized import parameterized
from cereal import log, car
import cereal.messaging as messaging
from common.params import Params
from selfdrive.boardd.boardd_api_impl import can_list_to_can_capnp # pylint: disable=no-name-in-module,import-error
from selfdrive... | #!/usr/bin/env python3
import time
import unittest
from parameterized import parameterized
from cereal import log, car
import cereal.messaging as messaging
from common.params import Params
from selfdrive.boardd.boardd_api_impl import can_list_to_can_capnp # pylint: disable=no-name-in-module,import-error
from selfdrive... | Python | 0.000001 |
c4966e274c885da4e5d252143b9feb260c8f78f5 | Correct config path finding for Linux. | pokemon_go_hunter/watch_twitter.py | pokemon_go_hunter/watch_twitter.py | import logging
import os
import re
import time
import twitter
import yaml
from pushbullet import Pushbullet
def get_config():
config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../config.yaml')
with open(config_path) as f:
return yaml.load(f)
def get_twitter_api(config):
ap... | import logging
import os
import re
import time
import twitter
import yaml
from pushbullet import Pushbullet
def get_config():
config_path = os.path.join(os.path.abspath(__file__), '../../config.yaml')
with open(config_path) as f:
return yaml.load(f)
def get_twitter_api(config):
api_config = con... | Python | 0 |
8b78463ac8d8953dffb3c3ecd5e9e1e4396da106 | Make sure set_mpl_backend works if qtpy is not installed | glue/_mpl_backend.py | glue/_mpl_backend.py | class MatplotlibBackendSetter(object):
"""
Import hook to make sure the proper Qt backend is set when importing
Matplotlib.
"""
enabled = True
def find_module(self, mod_name, pth):
if self.enabled and 'matplotlib' in mod_name:
self.enabled = False
set_mpl_backen... | class MatplotlibBackendSetter(object):
"""
Import hook to make sure the proper Qt backend is set when importing
Matplotlib.
"""
enabled = True
def find_module(self, mod_name, pth):
if self.enabled and 'matplotlib' in mod_name:
self.enabled = False
set_mpl_backen... | Python | 0 |
1bbd84111b142daf9301842f1cb411983fccedef | Comment change. | gnuplot-py/gp_mac.py | gnuplot-py/gp_mac.py | # $Id$
# Copyright (C) 1999 Michael Haggerty <mhagger@alum.mit.edu>
# Thanks to Tony Ingraldi and Noboru Yamamoto for their contributions.
#
# This program 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; eith... | # $Id$
# Copyright (C) 1999 Michael Haggerty <mhagger@alum.mit.edu>
# Thanks to Tony Ingraldi and Noboru Yamamoto for their contributions.
#
# This program 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; eith... | Python | 0.000012 |
247fe732ad71d2db3e664b63636492782a804151 | Support old Selenium | capture/capture.py | capture/capture.py | #!/bin/python3
from __future__ import print_function
"""
Benchmark creator, for Cassius.
Uses Selenium Webdriver to download new benchmarks for Cassius.
Opens a page in Firefox, causes it to execute get_bench.js, and saves the result.
"""
from selenium import webdriver
import os, sys
import warnings
try:
import... | #!/bin/python3
from __future__ import print_function
"""
Benchmark creator, for Cassius.
Uses Selenium Webdriver to download new benchmarks for Cassius.
Opens a page in Firefox, causes it to execute get_bench.js, and saves the result.
"""
from selenium import webdriver
import os, sys
import warnings
try:
import... | Python | 0 |
eb1fdf3419bdfd1d5920d73a877f707162b783b0 | Drop unused and dangerous entrypoint `open_fileindex` | cfgrib/__init__.py | cfgrib/__init__.py | #
# Copyright 2017-2021 European Centre for Medium-Range Weather Forecasts (ECMWF).
#
# 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... | #
# Copyright 2017-2021 European Centre for Medium-Range Weather Forecasts (ECMWF).
#
# 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... | Python | 0 |
4b465ee4873d4a077fc1e37be038459555aacdec | Remove Python 3.5 compatibility from _compat module | cheroot/_compat.py | cheroot/_compat.py | # pylint: disable=unused-import
"""Compatibility code for using Cheroot with various versions of Python."""
import os
import platform
try:
import ssl
IS_ABOVE_OPENSSL10 = ssl.OPENSSL_VERSION_INFO >= (1, 1)
del ssl
except ImportError:
IS_ABOVE_OPENSSL10 = None
IS_CI = bool(os.getenv('CI'))
IS_GITHUB... | # pylint: disable=unused-import
"""Compatibility code for using Cheroot with various versions of Python."""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import os
import platform
import re
import six
try:
import selectors # lgtm [py/unused-import]
except ImportError:
... | Python | 0.000016 |
ad8036e5a21fd29885dc7ebf201e599a0ca79563 | add charliecloud 0.9.7 (#10661) | var/spack/repos/builtin/packages/charliecloud/package.py | var/spack/repos/builtin/packages/charliecloud/package.py | # Copyright 2013-2019 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 Charliecloud(MakefilePackage):
"""Lightweight user-defined software stacks for HPC."""
... | # Copyright 2013-2019 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 Charliecloud(MakefilePackage):
"""Lightweight user-defined software stacks for HPC."""
... | Python | 0.000001 |
a3a19ab3cad0999cc61fdebe9c6fb1ceca873ab6 | make it full screen | boothpy/widget.py | boothpy/widget.py | # Copyright 2017 Christian Menard
#
# 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 limitation the rights
# to use, copy, modify, merge, publish, distri... | # Copyright 2017 Christian Menard
#
# 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 limitation the rights
# to use, copy, modify, merge, publish, distri... | Python | 0.000233 |
c7322a1ff37c7f2d4c3dfb149c2e36daafae6043 | Bump to version 0.11.3 | ckanny/__init__.py | ckanny/__init__.py | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
ckanny
~~~~~~
Miscellaneous CKAN utility scripts
Examples:
literal blocks::
python example_google.py
Attributes:
module_level_variable1 (int): Module level variables may be documented in
"""
from __future__ import (
absolute_import, divisi... | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
ckanny
~~~~~~
Miscellaneous CKAN utility scripts
Examples:
literal blocks::
python example_google.py
Attributes:
module_level_variable1 (int): Module level variables may be documented in
"""
from __future__ import (
absolute_import, divisi... | Python | 0 |
07a74375fabddc9b6fa4de0c345949bfadb54504 | Revert silly change | examples/sync_test.py | examples/sync_test.py | """
=============
A-V sync test
=============
This example tests synchronization between the screen and the audio playback.
"""
# Author: Dan McCloy <drmccloy@uw.edu>
#
# License: BSD (3-clause)
print __doc__
import numpy as np
from expyfun import ExperimentController
rng = np.random.RandomState(0)
with Experiment... | """
=============
A-V sync test
=============
This example tests synchronization between the screen and the audio playback.
"""
# Author: Dan McCloy <drmccloy@uw.edu>
#
# License: BSD (3-clause)
print __doc__
import numpy as np
from expyfun import ExperimentController
rng = np.random.RandomState(0)
with Experiment... | Python | 0.000002 |
63ec2f241c219f9a5fea33de63b520d8b0da5fd8 | Fix initial display update. | classes/display.py | classes/display.py | """Display Class"""
import time
class Display:
"""Display progress of process.
Attributes:
start_time (float): Seconds since epoch to when progress starts.
elapsed_time (float): Seconds since progress started.
last_updated (float): Seconds since epoch to when progress was
l... | """Display Class"""
import time
class Display:
"""Display progress of process.
Attributes:
start_time (float): Seconds since epoch to when progress starts.
elapsed_time (float): Seconds since progress started.
last_updated (float): Seconds since epoch to when progress was
l... | Python | 0 |
d008b0cec67a1428a2761b32f8b9cd7fee6372ed | Fix hardcoded vsdk branch | generator/src/lib/managers.py | generator/src/lib/managers.py | # -*- coding: utf-8 -*-
import os
import shutil
import threading
from git import Repo, GitCommandError
from printer import Printer
class TaskManager(object):
""" Multi threading manager """
def __init__(self):
""" Initializes a TaskManager
"""
self.threads = list()
def wait_un... | # -*- coding: utf-8 -*-
import os
import shutil
import threading
from git import Repo, GitCommandError
from printer import Printer
class TaskManager(object):
""" Multi threading manager """
def __init__(self):
""" Initializes a TaskManager
"""
self.threads = list()
def wait_un... | Python | 0.000335 |
72e71235d0f5e4851b212e4c7fa583eeddce6252 | Fix QueueUtility to read request from view again | src/plone.server/plone/server/async.py | src/plone.server/plone/server/async.py | # -*- coding: utf-8 -*-
from datetime import datetime
from plone.server.browser import ErrorResponse
from plone.server.browser import UnauthorizedResponse
from plone.server.browser import View
from plone.server import _
from plone.server.transactions import sync
from plone.server.transactions import TransactionProxy
fr... | # -*- coding: utf-8 -*-
from datetime import datetime
from plone.server.browser import ErrorResponse
from plone.server.browser import UnauthorizedResponse
from plone.server.browser import View
from plone.server import _
from plone.server.transactions import sync
from plone.server.transactions import TransactionProxy
fr... | Python | 0 |
85880dbf68718737fa52535326163d9b40adf7f9 | Add tags to event serializer | src/sentry/api/serializers/models/event.py | src/sentry/api/serializers/models/event.py | from __future__ import absolute_import
from sentry.api.serializers import Serializer, register
from sentry.models import Event
@register(Event)
class EventSerializer(Serializer):
def _get_entries(self, event, user):
# XXX(dcramer): These are called entries for future-proofing
interface_list = []
... | from __future__ import absolute_import
from sentry.api.serializers import Serializer, register
from sentry.models import Event
@register(Event)
class EventSerializer(Serializer):
def _get_entries(self, event, user):
# XXX(dcramer): These are called entries for future-proofing
interface_list = []
... | Python | 0 |
71636292d089f16485691f242edf74fcbd72ff2b | Enforce PEP8 on readpdf.py | jarviscli/plugins/readpdf.py | jarviscli/plugins/readpdf.py | # importing the modules
import PyPDF2
import pyttsx3
from plugin import plugin
"""
A tool for reading out the pdf files using the jarvis.Uses PyPDF2 and pyttsx3 libraries
"""
@plugin('readpdf')
class readpdfjarvis():
def __init__(self):
self.path = None
def __call__(self, jarvis, s):
self.r... | # importing the modules
import PyPDF2
import pyttsx3
from plugin import plugin
"""
A tool for reading out the pdf files using the jarvis.Uses PyPDF2 and pyttsx3 libraries
"""
@plugin('readpdf')
class readpdfjarvis():
def __init__(self):
self.path = None
def __call__(self, jarvis, s):
... | Python | 0 |
bb7fa507a31901819dbc7712b13c4223fe6d3585 | Correct p tags on system message output | src/sentry/templatetags/sentry_activity.py | src/sentry/templatetags/sentry_activity.py | """
sentry.templatetags.sentry_activity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django import template
from django.utils.html import escape, linebreaks
from django.utils.safestring import mark_... | """
sentry.templatetags.sentry_activity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django import template
from django.utils.html import escape, linebreaks
from django.utils.safestring import mark_... | Python | 0.00002 |
736e1f7f4de56a57df3b51058c5b45455e577cf0 | Fix flake8 | busstops/management/commands/import_areas.py | busstops/management/commands/import_areas.py | """
Import administrative areas from the NPTG.
Usage:
import_areas < AdminAreas.csv
"""
from ..import_from_csv import ImportFromCSVCommand
from ...models import AdminArea
class Command(ImportFromCSVCommand):
def handle_row(self, row):
AdminArea.objects.update_or_create(
id=row['Adminis... | """
Import administrative areas from the NPTG.
Usage:
import_areas < AdminAreas.csv
"""
from ..import_from_csv import ImportFromCSVCommand
from ...models import AdminArea
class Command(ImportFromCSVCommand):
def handle_row(self, row):
AdminArea.objects.update_or_create(
id=row['Adminis... | Python | 0 |
8a870c6faf8aa50ad7f8c58458c4af9ddef7cfdc | Make authbind check graceful. | braid/authbind.py | braid/authbind.py | import os
from fabric.api import sudo, run, abort, quiet
from braid import package, hasSudoCapabilities
def install():
package.install('authbind')
def allow(user, port):
path = os.path.join('/etc/authbind/byport', str(port))
needsUpdate = True
with quiet():
state = run('stat -c %U:%a {}'.f... | import os
from fabric.api import sudo, run, abort
from braid import package, hasSudoCapabilities
def install():
package.install('authbind')
def allow(user, port):
path = os.path.join('/etc/authbind/byport', str(port))
state = run('stat -c %U:%a {}'.format(path))
if state.strip().split(':') != (use... | Python | 0 |
ad2087daae138d3897fc47f0713c8955352ed6ae | add SecretBallotUserIdMiddleware | secretballot/middleware.py | secretballot/middleware.py | # -*- coding: utf-8 -*-
from hashlib import md5
from django.utils.deprecation import MiddlewareMixin
class SecretBallotMiddleware(MiddlewareMixin):
def process_request(self, request):
request.secretballot_token = self.generate_token(request)
def generate_token(self, request):
raise NotImpleme... | # -*- coding: utf-8 -*-
from hashlib import md5
from django.utils.deprecation import MiddlewareMixin
class SecretBallotMiddleware(MiddlewareMixin):
def process_request(self, request):
request.secretballot_token = self.generate_token(request)
def generate_token(self, request):
raise NotImpleme... | Python | 0.000001 |
898e97a38ea0510b743ca79d97444458274426b2 | Add tests for queue predeclaration. | st2common/tests/unit/test_service_setup.py | st2common/tests/unit/test_service_setup.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | Python | 0 |
ea17679936442d8e5af90dcae72c003f708d7b0c | Fix check_user_support for custom user models | guardian/backends.py | guardian/backends.py | from __future__ import unicode_literals
from django.db import models
from guardian.compat import get_user_model
from guardian.conf import settings
from guardian.exceptions import WrongAppError
from guardian.core import ObjectPermissionChecker
def check_object_support(obj):
"""
Returns ``True`` if given ``ob... | from __future__ import unicode_literals
from django.db import models
from guardian.compat import get_user_model
from guardian.conf import settings
from guardian.exceptions import WrongAppError
from guardian.core import ObjectPermissionChecker
def check_object_support(obj):
"""
Returns ``True`` if given ``ob... | Python | 0.000001 |
112cb1eb06034f5afb24f9f1c20052a87d8a6374 | Update pir_test.py | sensor_testing/pir_test.py | sensor_testing/pir_test.py | # parallax_pir_reva.py - write to screen when movement detected
# (c) BotBook.com - Karvinen, Karvinen, Valtokari
# 22.9.2017 modified from original
import time
import botbook_gpio as gpio
learningPeriod = 30
def main():
pirPin = 7
gpio.mode(pirPin,"in")
#Learning period
print ("learning... " + str(learningPerio... | # parallax_pir_reva.py - write to screen when movement detected
# (c) BotBook.com - Karvinen, Karvinen, Valtokari
# 22.9.2017 modified by Vesa Valli
import time
import botbook_gpio as gpio
learningPeriod = 30
def main():
pirPin = 7
gpio.mode(pirPin,"in")
#Learning period
print ("learning... " + str(learningPeri... | Python | 0.000004 |
6c17a81685f4f1b24cefb4760b26e9a33298742c | Bump to v1.10.0 | client/__init__.py | client/__init__.py | __version__ = 'v1.10.0'
FILE_NAME = 'ok'
import os
import sys
sys.path.insert(0, '')
# Add directory in which the ok.zip is stored to sys.path.
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
| __version__ = 'v1.9.6'
FILE_NAME = 'ok'
import os
import sys
sys.path.insert(0, '')
# Add directory in which the ok.zip is stored to sys.path.
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
| Python | 0.000001 |
86d59bbcad5d33e9a4cbad473a36972d29ddbaf0 | missing comma | src/rwtypes/writers/activemq/ActivemqWriter.py | src/rwtypes/writers/activemq/ActivemqWriter.py | import datetime
import time
import json
from third.stomp import stomp_sender
from __writer import Writer
class ActivemqWriter(Writer):
def write(self, msg):
try:
headers = {'destination' : self.destination,
'eventtype' : self.eventtype,
'timestam... | import datetime
import time
import json
from third.stomp import stomp_sender
from __writer import Writer
class ActivemqWriter(Writer):
def write(self, msg):
try:
headers = {'destination' : self.destination,
'eventtype' : self.eventtype
'timestamp... | Python | 0.999885 |
4b54488dd2b40254f6217d98c37690dcb37cf783 | fix false origin on replies | halibot/halmodule.py | halibot/halmodule.py | from .halobject import HalObject
from .message import Message
class HalModule(HalObject):
def reply(self, msg0=None, **kwargs):
# Create the reply message
body = kwargs.get('body', msg0.body)
mtype = kwargs.get('type', msg0.type)
author = kwargs.get('author', msg0.author)
origin = kwargs.get('origin', self... | from .halobject import HalObject
from .message import Message
class HalModule(HalObject):
def reply(self, msg0=None, **kwargs):
# Create the reply message
body = kwargs.get('body', msg0.body)
mtype = kwargs.get('type', msg0.type)
author = kwargs.get('author', msg0.author)
origin = kwargs.get('origin', msg0... | Python | 0.000003 |
8dd9d4bf58e976ca40bcafa7249ed3140b77ea69 | fix cfg parsing | tf2director.py | tf2director.py | #!/usr/bin/env python3
import os
import sys
from argparse import ArgumentParser
from configparser import ConfigParser
import actions
from tf2server import Tf2Server
def main():
"""
Parse command line options, read config and run desired action.
"""
description = 'tf2director is a script that helps m... | #!/usr/bin/env python3
import os
import sys
from argparse import ArgumentParser
from configparser import ConfigParser
import actions
from tf2server import Tf2Server
def main():
"""
Parse command line options, read config and run desired action.
"""
description = 'tf2director is a script that helps m... | Python | 0.000007 |
c802426e1c7e45ed456ad92a8b88ab18fba59aa3 | 更新 modules ELOs 中的 management command 'clone_metadata', 新增函式功能宣告註解 | commonrepo/elos/management/commands/clone_metadata.py | commonrepo/elos/management/commands/clone_metadata.py | # -*- coding: utf-8 -*-
#
# Copyright 2016 edX PDR Lab, National Central University, Taiwan.
#
# http://edxpdrlab.ncu.cc/
#
# 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://w... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from commonrepo.elos.models import ELO, ELOMetadata
class Command(BaseCommand):
help = 'Clone Metadata of ELOs'
def add_argument... | Python | 0 |
c01c97583e11bfe1c41dd41e7b39d19be22fbb7c | use the real paths | tools/build.py | tools/build.py | #!/usr/bin/env python
import os
import subprocess
import sys
# TODO: release/debug
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
build_dir = os.path.join(root, 'out')
def build():
if sys.platform != "win32":
cmd = 'make -C %s' % build_dir
else:
cmd = 'tools\win_build.bat'
pri... | #!/usr/bin/env python
import os
import subprocess
import sys
# TODO: release/debug
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
build_dir = os.path.join(root, 'out')
def build():
if sys.platform != "win32":
cmd = 'make -C %s' % build_dir
else:
cmd = 'tools\win_build.bat'
pri... | Python | 0.000017 |
1edac6151b4a730039e0782a5cb9777fe7f4a21d | Implement basic teste | code/web/scisynergy_flask/tests/test_basic.py | code/web/scisynergy_flask/tests/test_basic.py | import os
import unittest
from scisynergy_flask import app
class BasicTests(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
self.app.testing = True
def test_main_page(self):
response = self.app.get('/', follow_redirects=True)
self.assertEqual(response.statu... | import os
import unittest
from scisynergy import app
class BasicTests(unittest.TestCase):
def test_main_page(self):
response = self.app.get('/', follow_redirects=True)
self.assertEqual(response.status_code, 200)
| Python | 0.02115 |
20d1ad27c85ecc7dcfbfb30abd7a68be10db2a33 | Change showIt=False to pass test on Travis | simpegEM/Tests/test_forward_EMproblem.py | simpegEM/Tests/test_forward_EMproblem.py | import unittest
from SimPEG import *
import simpegEM as EM
from scipy.constants import mu_0
from simpegEM.Utils.Ana import hzAnalyticDipoleT
import matplotlib.pyplot as plt
class TDEM_bTests(unittest.TestCase):
def setUp(self):
cs = 10.
ncx = 15
ncy = 10
npad = 20
hx = Uti... | import unittest
from SimPEG import *
import simpegEM as EM
from scipy.constants import mu_0
from simpegEM.Utils.Ana import hzAnalyticDipoleT
import matplotlib.pyplot as plt
class TDEM_bTests(unittest.TestCase):
def setUp(self):
cs = 10.
ncx = 15
ncy = 10
npad = 20
hx = Uti... | Python | 0.000004 |
1e5345a786b24d341cfd99c3334c3122e3e5a91b | Update simulate method in Framework | simulation/MappingSimulationFrameWork.py | simulation/MappingSimulationFrameWork.py | from ResourceGetter import ResouceGetter
from RequestGenerator import TestReqGen
from RequestGenerator import SimpleReqGen
from RequestGenerator import MultiReqGen
from AbstractOrchestrator import *
import sys
#sys.path.append(./RequestGenerator)
#from escape.mapping.simulation import ResourceGetter
#from escape.mappi... | from ResourceGetter import ResouceGetter
from RequestGenerator import TestReqGen
from RequestGenerator import SimpleReqGen
from RequestGenerator import MultiReqGen
from AbstractOrchestrator
import sys
#sys.path.append(./RequestGenerator)
#from escape.mapping.simulation import ResourceGetter
#from escape.mapping.simul... | Python | 0 |
492ab05637b92f2decbd8fe60e25783ce63f9733 | remove ignore from staging | server/settings/staging.py | server/settings/staging.py | """ Do not put secrets in this file. This file is public.
For staging environment (Using Dokku)
"""
import os
import sys
import binascii
from server.settings import RAVEN_IGNORE_EXCEPTIONS
default_secret = binascii.hexlify(os.urandom(24))
ENV = 'staging'
PREFERRED_URL_SCHEME = 'https'
SECRET_KEY = os.getenv('SE... | """ Do not put secrets in this file. This file is public.
For staging environment (Using Dokku)
"""
import os
import sys
import binascii
from server.settings import RAVEN_IGNORE_EXCEPTIONS
default_secret = binascii.hexlify(os.urandom(24))
ENV = 'staging'
PREFERRED_URL_SCHEME = 'https'
SECRET_KEY = os.getenv('SE... | Python | 0.000001 |
1569633e1e73bbfb11a2cc34a1ed5239fdc58b1f | load extent data as json from form | casework/forms.py | casework/forms.py | # -*- coding: utf-8 -*-
from flask_wtf import Form
from wtforms import StringField, RadioField, DecimalField, HiddenField, TextAreaField, FieldList, DateField, FormField
from wtforms.validators import DataRequired, Optional
from casework.validators import validate_postcode, validate_price_paid, validate_extent, forma... | # -*- coding: utf-8 -*-
from flask_wtf import Form
from wtforms import StringField, RadioField, DecimalField, HiddenField, TextAreaField, FieldList, DateField, FormField
from wtforms.validators import DataRequired, Optional
from casework.validators import validate_postcode, validate_price_paid, validate_extent, forma... | Python | 0 |
661fa0d89d66fe012165ee7553c65e1e73356763 | Fix pylint | batchflow/tests/filesindex_test.py | batchflow/tests/filesindex_test.py | """ Tests for FilesIndex class. """
# pylint: disable=missing-docstring
# pylint: disable=protected-access
# pylint: disable=redefined-outer-name
import os
import shutil
from contextlib import ExitStack as does_not_raise
import pytest
import numpy as np
from batchflow import FilesIndex, DatasetIndex
@pytest.fixtur... | """ Tests for FilesIndex class. """
# pylint: disable=missing-docstring
# pylint: disable=protected-access
# pylint: disable=redefined-outer-name
import os
import shutil
from contextlib import ExitStack as does_not_raise
import pytest
import numpy as np
from batchflow import FilesIndex, DatasetIndex
@pytest.fixtur... | Python | 0.000099 |
352583af500746b431d46d7efc3a0d3f931b43a0 | Fix context processors | skcodeonlinetester/context_processors.py | skcodeonlinetester/context_processors.py | """
Extra context processors for the SkCodeOnlineTester app.
"""
from django.utils.translation import ugettext_lazy as _
from django.contrib.sites.shortcuts import get_current_site
def app_constants(request):
"""
Constants context processor.
:param request: the current request.
:return: All constants... | """
Extra context processors for the SkCodeOnlineTester app.
"""
from django.utils.translation import ugettext_lazy as _
from django.contrib.sites.shortcuts import get_current_site
def app_constants(request):
"""
Constants context processor.
:param request: the current request.
:return: All constants... | Python | 0.024871 |
75926fe8be6f47287561200a0d6e47cad5c51082 | Update tokenizers.py | cobe/tokenizers.py | cobe/tokenizers.py | # Copyright (C) 2010 Peter Teichman
import re
import Stemmer
import types
class MegaHALTokenizer:
"""A traditional MegaHAL style tokenizer. This considers any of these
to be a token:
* one or more consecutive alpha characters (plus apostrophe)
* one or more consecutive numeric characters
* one or more cons... | # Copyright (C) 2010 Peter Teichman
import re
import Stemmer
import types
class MegaHALTokenizer:
"""A traditional MegaHAL style tokenizer. This considers any of these
to be a token:
* one or more consecutive alpha characters (plus apostrophe)
* one or more consecutive numeric characters
* one or more cons... | Python | 0.000001 |
447b0bb977f050b904d36cb44aabe34cb03b87af | fix notation | chainer/functions/array/reshape.py | chainer/functions/array/reshape.py | from chainer import function
from chainer.utils import type_check
def _count_unknown_dims(shape):
cnt = 0
for dim in shape:
cnt += dim < 0
return cnt
class Reshape(function.Function):
"""Reshapes an input array without copy."""
def __init__(self, shape):
cnt = _count_unknown_di... | from chainer import function
from chainer.utils import type_check
def _count_unknown_dims(shape):
cnt = 0
for dim in shape:
cnt += dim < 0
return cnt
class Reshape(function.Function):
"""Reshapes an input array without copy."""
def __init__(self, shape):
cnt = _count_unknown_di... | Python | 0.000026 |
f2edfbbf3a5c4e18a26b8b9479456b91311bd4ea | check that the datum has a module_id | corehq/apps/app_manager/app_schemas/session_schema.py | corehq/apps/app_manager/app_schemas/session_schema.py | from django.utils.text import slugify
from corehq import toggles
from corehq.apps.app_manager.const import USERCASE_TYPE
from corehq.apps.app_manager.templatetags.xforms_extras import clean_trans
from corehq.apps.app_manager.util import is_usercase_in_use
def get_session_schema(form):
"""Get form session schema ... | from django.utils.text import slugify
from corehq import toggles
from corehq.apps.app_manager.const import USERCASE_TYPE
from corehq.apps.app_manager.templatetags.xforms_extras import clean_trans
from corehq.apps.app_manager.util import is_usercase_in_use
def get_session_schema(form):
"""Get form session schema ... | Python | 0.000018 |
e3548d62aa67472f291f6d3c0c8beca9813d6032 | Make it possible to step() in a newly created env, rather than throwing AttributeError | gym/envs/toy_text/discrete.py | gym/envs/toy_text/discrete.py | from gym import Env
from gym import spaces
import numpy as np
def categorical_sample(prob_n):
"""
Sample from categorical distribution
Each row specifies class probabilities
"""
prob_n = np.asarray(prob_n)
csprob_n = np.cumsum(prob_n)
return (csprob_n > np.random.rand()).argmax()
class Di... | from gym import Env
from gym import spaces
import numpy as np
def categorical_sample(prob_n):
"""
Sample from categorical distribution
Each row specifies class probabilities
"""
prob_n = np.asarray(prob_n)
csprob_n = np.cumsum(prob_n)
return (csprob_n > np.random.rand()).argmax()
class Di... | Python | 0.000004 |
253a0f786339e90b1b5841b94a22d44e5db3b85c | Add small delay in TemporalInformationRetriever to avoid endless loop | server/src/weblab/user_processing/TemporalInformationRetriever.py | server/src/weblab/user_processing/TemporalInformationRetriever.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... | Python | 0 |
92737e3f95ff94129e52e1fab1f40a0f70550d46 | Update the ParticleFilterSetOperations | hoomd/filter/set_.py | hoomd/filter/set_.py | from hoomd.filter.filter_ import ParticleFilter
from hoomd import _hoomd
class ParticleFilterSetOperations(ParticleFilter):
def __init__(self, f, g):
if f == g:
raise ValueError("Cannot use same filter for {}"
"".format(self.__class__.__name__))
else:
... | from hoomd.filter.filter_ import ParticleFilter
from hoomd import _hoomd
class ParticleFilterSetOperations(ParticleFilter):
def __init__(self, f, g):
if f == g:
raise ValueError("Cannot use same filter for {}"
"".format(self.__class__.__name__))
else:
... | Python | 0 |
8d98fe5570ce37512128d46853000dc860f798b2 | Update jupyterhub_config.py | jupyterhub/jupyterhub_config.py | jupyterhub/jupyterhub_config.py | # Configuration file for jupyterhub.
from jupyter_client.localinterfaces import public_ips
c = get_config() # noqa
c.JupyterHub.ssl_key = 'test.key'
c.JupyterHub.ssl_cert = 'test.crt'
c.JupyterHub.hub_ip = public_ips()[0]
# Choose between system-user mode and virtual-user mode
setting_mode = ('system_user', 'virtu... | # Configuration file for jupyterhub.
from jupyter_client.localinterfaces import public_ips
c = get_config() # noqa
c.JupyterHub.ssl_key = 'test.key'
c.JupyterHub.ssl_cert = 'test.crt'
c.JupyterHub.hub_ip = public_ips()[0]
# Choose between system-user mode and virtual-user mode
setting_mode = ('system_user', 'virtu... | Python | 0.000001 |
fc6716854bc876730f1f3684945061fcf1d48072 | Fix default optional prefix | hashid_field/rest.py | hashid_field/rest.py | from django.apps import apps
from django.core import exceptions
from hashids import Hashids
from rest_framework import fields, serializers
from hashid_field.conf import settings
from hashid_field.hashid import Hashid
class UnconfiguredHashidSerialField(fields.Field):
def bind(self, field_name, parent):
... | from django.apps import apps
from django.core import exceptions
from hashids import Hashids
from rest_framework import fields, serializers
from hashid_field.conf import settings
from hashid_field.hashid import Hashid
class UnconfiguredHashidSerialField(fields.Field):
def bind(self, field_name, parent):
... | Python | 0.000002 |
bca7f7f6ae870a0a307566ee1735e899596d3f99 | Simplify the brightness calculation, in preparation for multi-LED drips | hardware/mote/mote_icicles.py | hardware/mote/mote_icicles.py | import time
from random import randint
from mote import Mote
mote = Mote()
mote.configure_channel(1, 16, False)
mote.configure_channel(2, 16, False)
mote.configure_channel(3, 16, False)
mote.configure_channel(4, 16, False)
full_brightness = 40
class Icicle:
def __init__(self, channel):
self.channel = ch... | import time
from random import randint
from mote import Mote
mote = Mote()
mote.configure_channel(1, 16, False)
mote.configure_channel(2, 16, False)
mote.configure_channel(3, 16, False)
mote.configure_channel(4, 16, False)
max_brightness = 40
class Icicle:
def __init__(self, channel):
self.channel = cha... | Python | 0 |
9718e6c216b8d5205a19f095593ec099004785a6 | add app | src/studio/launch/commands/app_commands.py | src/studio/launch/commands/app_commands.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
import os
import sys
import json
import importlib
from sh import pip
from termcolor import colored
from studio.frame.config import common as common_config
from studio.launch.base import manager
app_manager = manager.... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
import os
import sys
import importlib
from sh import pip
from termcolor import colored
from studio.frame.config import common as common_config
from studio.launch.base import manager
app_manager = manager.subcommand('... | Python | 0.000003 |
6380aabe25e38d198b6c4e10d126d6fd97860c85 | remove Simple.validate function | flask_pam/token/simple.py | flask_pam/token/simple.py | # -*- coding: utf-8 -*-
from hashlib import sha256
from token import Token
class Simple(Token):
"""Simple token implementation. It's not safe. Only for testing purposes!"""
def generate(self):
return sha256(self.username).hexdigest()
| # -*- coding: utf-8 -*-
from hashlib import sha256
from token import Token
class Simple(Token):
"""Simple token implementation. It's not safe. Only for testing purposes!"""
def generate(self):
return sha256(self.username).hexdigest()
def validate(self, token):
return sha256(self.username)... | Python | 0.000126 |
d37d99dedfb7cc2c86a9f01a75213fcc430af13d | fix inheritance for `SmAttr`s | hashstore/utils/file_types.py | hashstore/utils/file_types.py | import mimetypes
from typing import List
from os.path import join, dirname
from hashstore.utils import load_json_file
from hashstore.utils.smattr import SmAttr
class FileType(SmAttr):
mime:str
ext:List[str]
def read_file_types(json_file):
load_json = load_json_file(json_file)
return {n: FileType(v) ... | import mimetypes
from typing import List
from os.path import join, dirname
from hashstore.utils import load_json_file
from hashstore.utils.smattr import SmAttr
class FileType(SmAttr):
mime:str
ext:List[str]
def read_file_types(json_file):
load_json = load_json_file(json_file)
return {n: FileType(v) ... | Python | 0.000021 |
beccef4eccda11e32ba30022008de44450f69fa2 | Check if block exists before DAG edits. | src/api.py | src/api.py |
def check_blocks(dag, block_ids):
if set(block_ids) - set(dag.block_ids()):
return False
return True
def execute_blocks(dag_fpathname, block_ids, all=False):
import dag
import dagexecutor
d = dag.DAG.from_file(dag_fpathname)
if all: block_ids = d.block_ids()
nonexistent = set(blo... |
def execute_blocks(dag_fpathname, block_ids, all=False):
import dag
import dagexecutor
d = dag.DAG.from_file(dag_fpathname)
if all: block_ids = d.block_ids()
dex = dagexecutor.DAGExecutor(d, dag_fpathname)
dex.execute_blocks(block_ids)
def open_notebook(nbfile):
from utils import Consol... | Python | 0 |
eb57a07277f86fc90b7845dc48fb5cde1778c8d4 | Test cut_by_number with words and normal chunk numbers | test/unit_test/test_cut_number.py | test/unit_test/test_cut_number.py | from lexos.processors.prepare.cutter import split_keep_whitespace, \
count_words, cut_by_number
class TestCutByNumbers:
def test_split_keep_whitespace(self):
assert split_keep_whitespace("Test string") == ["Test", " ", "string"]
assert split_keep_whitespace("Test") == ["Test"]
assert s... | from lexos.processors.prepare.cutter import split_keep_whitespace, \
count_words, cut_by_number
class TestCutByNumbers:
def test_split_keep_whitespace(self):
assert split_keep_whitespace("Test string") == ["Test", " ", "string"]
assert split_keep_whitespace("Test") == ["Test"]
assert s... | Python | 0.000003 |
c05d0f2dd77678133af1bbf49915aeaf24efbedc | simplify line counting method | httplang/httplang.py | httplang/httplang.py | import parse
import sys
import utils
import repl
def main():
if len(sys.argv) < 2:
repl.enterREPL()
sys.exit()
inputFile = sys.argv[1]
run(inputFile)
def run(file_):
with open(file_, 'rb') as file:
#pass enumerated file so we can get line numbers starting at 1
parse.pre... | import parse
import sys
import utils
import repl
def main():
if len(sys.argv) < 2:
repl.enterREPL()
sys.exit()
inputFile = sys.argv[1]
run(inputFile)
def run(file_):
with open(file_, 'rb') as file:
#pass enumerated file so we can get line numbers
parse.preParse(enumerat... | Python | 0.03329 |
c806a3702c95812dd57aca4106a782a854268993 | Comment out configuration of real systems | server/systems/__init__.py | server/systems/__init__.py | import logging
from django.core.exceptions import ObjectDoesNotExist
from base import BaseEnvironment
from producers import CogenerationUnit, PeakLoadBoiler
from storages import HeatStorage, PowerMeter
from consumers import ThermalConsumer, ElectricalConsumer
from server.models import Device, Configuration, DeviceCon... | import logging
from base import BaseEnvironment
from producers import CogenerationUnit, PeakLoadBoiler
from storages import HeatStorage, PowerMeter
from consumers import ThermalConsumer, ElectricalConsumer
from server.models import Device, Configuration, DeviceConfiguration
from django.core.exceptions import ObjectDoe... | Python | 0 |
cf84dfda73032a276b2d6f63f2c70f69e61f89fe | Check validity of the config to avoid silent errors. | keras_retinanet/utils/config.py | keras_retinanet/utils/config.py | """
Copyright 2017-2018 Fizyr (https://fizyr.com)
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 w... | """
Copyright 2017-2018 Fizyr (https://fizyr.com)
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 w... | Python | 0 |
91e916cb67867db9ce835be28b31904e6efda832 | Add comment to new test | spacy/tests/regression/test_issue1727.py | spacy/tests/regression/test_issue1727.py | '''Test that models with no pretrained vectors can be deserialized correctly
after vectors are added.'''
from __future__ import unicode_literals
import numpy
from ...pipeline import Tagger
from ...vectors import Vectors
from ...vocab import Vocab
from ..util import make_tempdir
def test_issue1727():
data = numpy.... | from __future__ import unicode_literals
import numpy
from ...pipeline import Tagger
from ...vectors import Vectors
from ...vocab import Vocab
from ..util import make_tempdir
def test_issue1727():
data = numpy.ones((3, 300), dtype='f')
keys = [u'I', u'am', u'Matt']
vectors = Vectors(data=data, keys=keys)
... | Python | 0 |
3826140004b0686f9f262756da20c5163fc5b80d | update icinga_simple format string handling | py3status/modules/icinga_simple.py | py3status/modules/icinga_simple.py | # -*- coding: utf-8 -*-
"""
Display Icinga2 service status information
Configuration Parameters:
- cache_timeout: how often the data should be updated
- base_url: the base url to the icinga-web2 services list
- disable_acknowledge: enable or disable counting of acknowledged service problems
- user: use... | # -*- coding: utf-8 -*-
"""
Display Icinga2 service status information
Configuration Parameters:
- cache_timeout: how often the data should be updated
- base_url: the base url to the icinga-web2 services list
- disable_acknowledge: enable or disable counting of acknowledged service problems
- user: use... | Python | 0 |
30e984a0517e6443835f113c3a479aa8302ef14f | Update profile url on amazon tests | social_core/tests/backends/test_amazon.py | social_core/tests/backends/test_amazon.py | import json
from .oauth import OAuth2Test
class AmazonOAuth2Test(OAuth2Test):
backend_path = 'social_core.backends.amazon.AmazonOAuth2'
user_data_url = 'https://api.amazon.com/user/profile'
expected_username = 'FooBar'
access_token_body = json.dumps({
'access_token': 'foobar',
'token_... | import json
from .oauth import OAuth2Test
class AmazonOAuth2Test(OAuth2Test):
backend_path = 'social_core.backends.amazon.AmazonOAuth2'
user_data_url = 'https://www.amazon.com/ap/user/profile'
expected_username = 'FooBar'
access_token_body = json.dumps({
'access_token': 'foobar',
'tok... | Python | 0 |
08834335285b292fe0337525eb2052a38c35d881 | Test a random element. | OWR/oh/tests.py | OWR/oh/tests.py | from __future__ import absolute_import
import json
import random
from unittest import TestCase
from django.test.client import RequestFactory
from django.core.urlresolvers import reverse
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import SuspiciousOperation, PermissionDenied
from O... | from __future__ import absolute_import
import json
from unittest import TestCase
from django.test.client import RequestFactory
from django.core.urlresolvers import reverse
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import SuspiciousOperation, PermissionDenied
from OWR.users.factor... | Python | 0 |
a85019e7c5e117467d0ce3bf30b9a7589cd17958 | Update create_test_cutout | src/tasks/python/create_test_cutout.py | src/tasks/python/create_test_cutout.py | from cloudvolume import CloudVolume
image_in = 'gs://neuroglancer/pinky100_v0/image_single_slices'
image_out = 'gs://neuroglancer/pinky100_v0/test_image'
image_mip = 0
roi_in = 'gs://neuroglancer/pinky100_v0/image_single_slices/roicc'
roi_out = 'gs://neuroglancer/pinky100_v0/test_image/roicc'
roi_mip = 6
cfsplit_in = ... | from cloudvolume import CloudVolume
image_in = 'gs://neuroglancer/pinky100_v0/image_single_slices'
image_out = 'gs://neuroglancer/pinky100_v0/test_image'
image_mip = 0
roi_in = 'gs://neuroglancer/pinky100_v0/image_single_slices/roicc'
roi_out = 'gs://neuroglancer/pinky100_v0/test_image/roicc'
roi_mip = 6
cfsplit_in = ... | Python | 0.000001 |
20f14f6c86607d0f1d084ee35c8f2645fde2dacb | Replace 1s and 2s with Xs and Os | capstone/util/tic2pdf.py | capstone/util/tic2pdf.py | from __future__ import division, unicode_literals
import subprocess
import tempfile
BG_COLOR = '1.0 1.0 1.0'
COLORS = {
'X': '0.85 0.12 0.15',
'O': '0.21 0.60 0.83',
' ': '0.83 0.60 0.32'
}
X_OFFSET = 17.0
ROWS = 3
COLS = 3
CELL_SIZE = 20
OFFSET = 10
class Tic2PDF(object):
'''
Generates a PDF of... | from __future__ import division
import subprocess
import tempfile
BG_COLOR = '1.0 1.0 1.0'
COLORS = {
'1': '0.85 0.12 0.15',
'2': '0.00 0.00 1.00',
' ': '0.90 0.90 0.90'
}
X_OFFSET = 17.0
ROWS = 3
COLS = 3
CELL_SIZE = 20
OFFSET = 10
class Tic2PDF(object):
'''
Generates a PDF of the given Tic-Tac... | Python | 0.010829 |
6ae4f3a71a80d7fe5bb1abe6925a05c4fe811f3c | bump version | forms_builder/__init__.py | forms_builder/__init__.py | __version__ = "9.7.16"
| __version__ = "0.12.2"
| Python | 0 |
3fcd816255116273d6c94558777d82ae089428f0 | Refactor to add subject info | graph_char-path_orth_subjects.py | graph_char-path_orth_subjects.py | import bct
import numpy as np
import pandas as pd
from my_settings import (source_folder, results_path)
subjects = [
"0008", "0009", "0010", "0012", "0013", "0014", "0015", "0016",
"0019", "0020", "0021", "0022"
]
ge_data_all = pd.DataFrame()
lambda_data_all = pd.DataFrame()
dia_data_all = pd.DataFrame()
con... | import bct
import numpy as np
import pandas as pd
from my_settings import (source_folder, results_path)
subjects = [
"0008", "0009", "0010", "0012", "0013", "0014", "0015", "0016",
"0019", "0020", "0021", "0022"
]
ge_data_all = pd.DataFrame()
lambda_data_all = pd.DataFrame()
dia_data_all = pd.DataFrame()
con... | Python | 0 |
a58646ee72fc894a2f2b885b242cc283a0addd7c | remove args | src/app.py | src/app.py | import argparse
import os
from actions import server, client
# the main entry point for the application
# for simplicity, let's decide that the user decides at runtime to listen
# and the server decides to serve
# location from which files should be served
app_directory = '/home/chris/blaster'
def main():
# get ... | import argparse
import os
from actions import server, client
# the main entry point for the application
# for simplicity, let's decide that the user decides at runtime to listen
# and the server decides to serve
# location from which files should be served
app_directory = '/home/chris/blaster'
def main():
# get ... | Python | 0.999811 |
0f216b43f42ebabedda701fafefe271a223798cb | Fix mcscf example | examples/mcscf/41-mcscf_with_given_densityfit_ints.py | examples/mcscf/41-mcscf_with_given_densityfit_ints.py | #!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
import tempfile
import h5py
from pyscf import gto, df, scf, mcscf
'''
Input Cholesky decomposed integrals for CASSCF
'''
mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvdz')
#
# Integrals in memory. The size of the integral array is (M,N*(N+1)/2)... | #!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
import tempfile
import h5py
from pyscf import gto, df, scf, mcscf
'''
Input Cholesky decomposed integrals for CASSCF
'''
mol = gto.M(atom='H 0 0 0; F 0 0 1', basis='ccpvdz')
#
# Integrals in memory. The size of the integral array is (M,N*(N+1)/2)... | Python | 0.000001 |
d7b260005a30cfd848eefe62f021cb4bf7a59087 | Use tempfile for default upload directory | pyfarm/master/api/agent_updates.py | pyfarm/master/api/agent_updates.py | # No shebang line, this module is meant to be imported
#
# Copyright 2014 Ambient Entertainment Gmbh & Co. KG
#
# 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/lice... | # No shebang line, this module is meant to be imported
#
# Copyright 2014 Ambient Entertainment Gmbh & Co. KG
#
# 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/lice... | Python | 0 |
cd828f76511d439af3baa0d209d6e23a19776142 | Check if minValue/maxValue is not none before setting default uiMin/uiMax | Python/kraken/core/objects/attributes/number_attribute.py | Python/kraken/core/objects/attributes/number_attribute.py | """Kraken - objects.Attributes.NumberAttribute module.
Classes:
NumberAttribute - Base Attribute.
"""
from attribute import Attribute
class NumberAttribute(Attribute):
"""Number Attributee. Base class for number attribute types"""
def __init__(self, name, value=0, minValue=None, maxValue=None):
su... | """Kraken - objects.Attributes.NumberAttribute module.
Classes:
NumberAttribute - Base Attribute.
"""
from attribute import Attribute
class NumberAttribute(Attribute):
"""Number Attributee. Base class for number attribute types"""
def __init__(self, name, value=0, minValue=None, maxValue=None):
su... | Python | 0.000001 |
9a4f1da48e72627aa0ff358a3dafe8bb5639482a | refresh access token on each verification | componentsdb/ui.py | componentsdb/ui.py | """
Traditional Web UI.
"""
from functools import wraps
from flask import (
Blueprint, redirect, url_for, render_template, request, session, g
)
from werkzeug.exceptions import BadRequest, Unauthorized
from componentsdb.app import set_current_user_with_token
from componentsdb.auth import user_for_google_id_token... | """
Traditional Web UI.
"""
from functools import wraps
from flask import (
Blueprint, redirect, url_for, render_template, request, session
)
from werkzeug.exceptions import BadRequest, Unauthorized
from componentsdb.app import set_current_user_with_token
from componentsdb.auth import user_for_google_id_token
u... | Python | 0 |
becef09e0680786343c581d984e7de5dcb961d16 | Fix for handle failed html parse | frappe/utils/xlsxutils.py | frappe/utils/xlsxutils.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
import openpyxl
import re
from openpyxl.styles import Font
from openpyxl import load_workbook
from six import BytesIO, string_types
ILLEGAL_CHARACTERS_RE = re.comp... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
import openpyxl
import re
from openpyxl.styles import Font
from openpyxl import load_workbook
from six import BytesIO, string_types
ILLEGAL_CHARACTERS_RE = re.comp... | Python | 0.000002 |
49d8bd1dbec1fa5927a1e487e7f0799de2e2ee11 | Remove unused import | tests/unit/states/archive_test.py | tests/unit/states/archive_test.py | # -*- coding: utf-8 -*-
'''
unit tests for the archive state
'''
# Import Python Libs
import os
import tempfile
# Import Salt Libs
from salt.states import archive
# Import Salt Testing Libs
from salttesting import skipIf, TestCase
from salttesting.helpers import ensure_in_syspath
from salttesting.mock import (
N... | # -*- coding: utf-8 -*-
'''
unit tests for the archive state
'''
# Import Python Libs
import os
import tempfile
try:
import pwd
HAS_PWD = True
except ImportError:
HAS_PWD = False
# Import Salt Libs
from salt.states import archive
# Import Salt Testing Libs
from salttesting import skipIf, TestCase
from sa... | Python | 0.000001 |
f5a1e7f8e350a5f1b29c0e60caf178208946a2b1 | Add more samples. | learning-python/ch02/Looping.py | learning-python/ch02/Looping.py | for i in [1, 2, 3, 4]:
print(i)
for i in range(5):
print(i)
colors = ["red", "green", "blue"]
for i in range(len(colors)):
print(i, colors[i])
for color in colors:
print(color)
for idx, color in enumerate(colors):
print(idx, color)
people = ["Scott", "John", "Mike"]
ages = [50, 30, 25]
for pers... | for i in [1, 2, 3, 4]:
print(i)
for i in range(5):
print(i)
colors = ["red", "green", "blue"]
for i in range(len(colors)):
print(i, colors[i])
for color in colors:
print(color)
for idx, color in enumerate(colors):
print(idx, color)
people = ["Scott", "John", "Mike"]
ages = [50, 30, 25]
for pers... | Python | 0 |
8e35a5f5e7da38105961178478c33e92c81caf62 | Use new homely._ui.system() instead of subprocess | homely/pipinstall.py | homely/pipinstall.py | from homely._engine2 import Helper, Cleaner, getengine
from homely._utils import haveexecutable
from homely._ui import isinteractive, system
def pipinstall(packagename, which, user=True):
engine = getengine()
for version in which:
assert version in (2, 3)
helper = PIPInstall(packagename, versi... | from subprocess import check_output, check_call
from homely._engine2 import Helper, Cleaner, getengine
from homely._utils import haveexecutable
from homely._ui import isinteractive
def pipinstall(packagename, which, user=True):
engine = getengine()
for version in which:
assert version in (2, 3)
... | Python | 0.000001 |
52eebb215f52ae73a881e3d4e9a695139c260d3b | Empty names should be called @ | lexicon/providers/transip.py | lexicon/providers/transip.py | from __future__ import absolute_import
from .base import Provider as BaseProvider
from transip.client import DomainClient
def ProviderParser(subparser):
subparser.add_argument("--auth-username", help="specify username used to authenticate")
subparser.add_argument("--auth-api-key", help="specify API private ke... | from __future__ import absolute_import
from .base import Provider as BaseProvider
from transip.client import DomainClient
def ProviderParser(subparser):
subparser.add_argument("--auth-username", help="specify username used to authenticate")
subparser.add_argument("--auth-api-key", help="specify API private ke... | Python | 0.998725 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.