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 |
|---|---|---|---|---|---|---|---|---|
7e76ced5a75a1d89be384fb4d748c3c0599bfaea | Create _deleted field in ParsedBug | openhatch/oh-bugimporters,openhatch/oh-bugimporters,openhatch/oh-bugimporters | bugimporters/items.py | bugimporters/items.py | import scrapy.item
class ParsedBug(scrapy.item.Item):
# Fields beginning with an underscore are not really part of a
# bug, but extra information that can be exported.
_project_name = scrapy.item.Field()
_tracker_name = scrapy.item.Field()
_deleted = scrapy.item.Field()
# These fields correspo... | import scrapy.item
class ParsedBug(scrapy.item.Item):
# Fields beginning with an underscore are not really part of a
# bug, but extra information that can be exported.
_project_name = scrapy.item.Field()
_tracker_name = scrapy.item.Field()
# These fields correspond to bug data
title = scrapy.i... | agpl-3.0 | Python |
8f9797b287977551cb1114f32a4500d66c9f8014 | add the anlog logic to update the price unit when run the stock planner an exist a purchase order in draft (#58) | ingadhoc/purchase | purchase_ux/models/procurement_rule.py | purchase_ux/models/procurement_rule.py | ##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, api
class ProcurementRule(models.Model):
_... | ##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, api
class ProcurementRule(models.Model):
_... | agpl-3.0 | Python |
98fb0c903ddfb4bc4cd173bce652cbaa88248a8a | solve it once and for all | spencerpomme/coconuts-on-fire,spencerpomme/coconuts-on-fire,spencerpomme/coconuts-on-fire,spencerpomme/coconuts-on-fire,spencerpomme/coconuts-on-fire,spencerpomme/coconuts-on-fire | auto_upgrade.py | auto_upgrade.py | #! /usr/local/bin/python3
# can not be used on windows due to line end difference.
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip3 install --upgrade --no-cache-dir" + dist.project_name, shell=True)
| #! /usr/local/bin/python3
# can not be used on windows due to line end difference.
import pip
import re
from subprocess import check_output, call
output = check_output(['pip3', 'list', '--outdated']) # Now this line fails, why?
outdated = re.findall('^(?=b)\S+(?= \(\w+)|(?<=\\\\n)\S+(?= \(\w+)', str(output))
print('hh... | apache-2.0 | Python |
2d3eca28e2482ba2b607f6ee7a88cb6a1d30e2e3 | update repair_antennas1.py for ant API change | QuantamHD/OpenROAD,The-OpenROAD-Project/OpenROAD,The-OpenROAD-Project/OpenROAD,The-OpenROAD-Project/OpenROAD,QuantamHD/OpenROAD,QuantamHD/OpenROAD,QuantamHD/OpenROAD,QuantamHD/OpenROAD,The-OpenROAD-Project/OpenROAD,The-OpenROAD-Project/OpenROAD | src/grt/test/repair_antennas1.py | src/grt/test/repair_antennas1.py | from openroad import Tech, Design
import helpers
import grt_aux
tech = Tech()
tech.readLiberty("sky130hs/sky130hs_tt.lib")
tech.readLef("sky130hs/sky130hs.tlef")
tech.readLef("sky130hs/sky130hs_std_cell.lef")
design = Design(tech)
design.readDef("gcd_sky130.def")
gr = design.getGlobalRouter()
design.evalTclString("s... | from openroad import Tech, Design
import helpers
import grt_aux
tech = Tech()
tech.readLiberty("sky130hs/sky130hs_tt.lib")
tech.readLef("sky130hs/sky130hs.tlef")
tech.readLef("sky130hs/sky130hs_std_cell.lef")
design = Design(tech)
design.readDef("gcd_sky130.def")
gr = design.getGlobalRouter()
design.evalTclString("s... | bsd-3-clause | Python |
63020e6defcce97c9d6837bd54b55ebced64a1e9 | Fix config path checks | Motiejus/tictactoe,Motiejus/tictactoe | tictactoe/config.py | tictactoe/config.py | import logging
import os
import configparser
config = configparser.RawConfigParser()
HERE = os.path.dirname(__file__)
configfiles = [
os.path.join(HERE, 'tictactoe.default.cfg'), # default config
os.path.join(HERE, 'tictactoe.cfg'), # per-environment config
'/etc/tictactoe.cfg', ... | import logging
import os
import configparser
config = configparser.RawConfigParser()
HERE = os.path.dirname(__file__)
configfiles = [
'/etc/tictactoe.cfg', # staging/live
os.path.join(HERE, 'tictactoe.default.cfg'), # default config
os.path.join(HERE, 'tictactoe.cfg'), ... | mit | Python |
33d620036c831307a8091a440d80597a06267678 | Change local config prio | Motiejus/tictactoe,Motiejus/tictactoe | tictactoe/config.py | tictactoe/config.py | import logging
import os
import configparser
config = configparser.RawConfigParser()
HERE = os.path.dirname(__file__)
configfiles = [
os.path.join(HERE, 'tictactoe.default.cfg'), # default config
'/etc/tictactoe.cfg', # staging/live
os.path.join(HERE, 'tictactoe.cfg'), ... | import logging
import os
import configparser
config = configparser.RawConfigParser()
HERE = os.path.dirname(__file__)
configfiles = [
os.path.join(HERE, 'tictactoe.default.cfg'), # default config
os.path.join(HERE, 'tictactoe.cfg'), # per-environment config
'/etc/tictactoe.cfg', ... | mit | Python |
8fb4af35d6059a55d5ad4a07a656ca352afec060 | Make `helpers.facilities` type check #559 | agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft | pycroft/helpers/facilities.py | pycroft/helpers/facilities.py | # Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
"""
pycroft.helpers.facilities
~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import re
import typing as t
from pycroft.model.f... | # Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
"""
pycroft.helpers.facilities
~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import re
import typing as t
from pycroft.model.f... | apache-2.0 | Python |
0b920122ef619a40c4ad49f5fb2c18994374c1d1 | allow for missing altobridge package | jalanb/dotjab,jalanb/jab,jalanb/jab,jalanb/dotjab | python/testing/try_plugins.py | python/testing/try_plugins.py | """This module holds plugins for try.py"""
def pre_test(_path_to_test_file):
"""This method is called before each test has been run
If this method returns a false value then that file is not tested
"""
return True
def post_test(_path_to_test_file, _failures, _tests_run):
"""This method is called after each te... | """This module holds plugins for try.py"""
def pre_test(path_to_test_file):
"""This method is called before each test has been run
If this method returns a false value then that file is not tested
"""
return True
def post_test(path_to_test_file, failures, tests_run):
"""This method is called after each test h... | mit | Python |
93367756a4d761f19dd60ff710386b95520226c5 | Use the backtesting clock | jmelett/pyfx,jmelett/pyfx,jmelett/pyFxTrader | trader/cli.py | trader/cli.py | import decimal
from datetime import datetime
import click
from .controller import Controller, SimulatedClock
from .broker import OandaBacktestBroker
from .instruments import InstrumentParamType
from .strategy import TestStrategy
@click.command()
@click.option('--instrument', '-i', 'instruments', multiple=True,
... | import decimal
import click
from .controller import Controller, IntervalClock
from .broker import OandaBacktestBroker
from .instruments import InstrumentParamType
from .strategy import TestStrategy
@click.command()
@click.option('--instrument', '-i', 'instruments', multiple=True,
type=InstrumentParamT... | mit | Python |
e62f5662d5882ba71a20b44edb9083af1eb26a84 | add header to output csv files | m4rx9/rna-pdb-tools,m4rx9/rna-pdb-tools | rna_pdb_tools/utils/misc/rna_mq_exp.py | rna_pdb_tools/utils/misc/rna_mq_exp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from __future__ import print_function
import pandas as pd
import argparse
import os
def get_parser():
parser = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('csv', help="",... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from __future__ import print_function
import pandas as pd
import argparse
import os
def get_parser():
parser = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('csv', help="",... | mit | Python |
43588a584a4729ac78dae525d0d14405fe5eac51 | fix test setup | ClericPy/torequests,ClericPy/torequests | setup_full.py | setup_full.py | # python
#! coding:utf-8
import codecs
import os
import re
import sys
from setuptools import find_packages, setup
"""
linux:
rm -rf "dist/*";rm -rf "build/*";python3 setup.py bdist_wheel;python2 setup.py bdist_wheel;twine upload "dist/*;rm -rf "dist/*";rm -rf "build/*""
win32:
rm -rf dist;rm -rf build;python3 setup.py... | # python
#! coding:utf-8
import codecs
import os
import sys
from setuptools import find_packages, setup
"""
linux:
rm -rf "dist/*";rm -rf "build/*";python3 setup.py bdist_wheel;python2 setup.py bdist_wheel;twine upload "dist/*;rm -rf "dist/*";rm -rf "build/*""
win32:
rm -rf dist;rm -rf build;python3 setup.py bdist_whe... | mit | Python |
eff0d806a344e023cefa5589cfa32b21773aaab7 | Fix formatting | vlad-lifliand/babymon,vlad-lifliand/babymon,vlad-lifliand/babymon | backend/main.py | backend/main.py | import os
import urllib
import datetime
from google.appengine.api import users
from google.appengine.ext import ndb
import jinja2
import webapp2
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
clas... | import os
import urllib
import datetime
from google.appengine.api import users
from google.appengine.ext import ndb
import jinja2
import webapp2
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
clas... | apache-2.0 | Python |
8eca0cffb288c8cb03dc118e65f7c501e548a2bc | Fix incorrect comment in tools/cmake/python_packagecheck.py | mbedmicro/mbed,mbedmicro/mbed,mbedmicro/mbed,mbedmicro/mbed,mbedmicro/mbed | tools/cmake/python_packagecheck.py | tools/cmake/python_packagecheck.py | # Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""Script to check if a Python module/package is installed."""
import sys
try:
__import__(sys.argv[1])
except ImportError:
exit(1)
exit(0)
| # Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#file which is invoked by the cmake build system to check if all necessary python packages are installed.
import sys
try:
__import__(sys.argv[1])
except ImportError:
exit(1)
exit(0) | apache-2.0 | Python |
be3cf010cffca70a1b5407594f588648ae87e1bd | Add get_usage test (#8376) | DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core | btrfs/tests/test_btrfs.py | btrfs/tests/test_btrfs.py | # (C) Datadog, Inc. 2010-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import collections
import mock
# project
import datadog_checks.btrfs
btrfs_check = datadog_checks.btrfs.BTRFS('btrfs', {}, [{}])
def mock_get_usage():
return [
(1, 9672065024, 9093722112),
... | # (C) Datadog, Inc. 2010-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import collections
import mock
# project
from datadog_checks.btrfs import BTRFS
btrfs_check = BTRFS('btrfs', {}, [{}])
def mock_get_usage():
return [
(1, 9672065024, 9093722112),
(34, ... | bsd-3-clause | Python |
9a5d2a6f9efefb5b1647de5e467a9dfb74b86c9b | Migrate link tests to pytest | vtemian/buffpy | buffpy/tests/test_link.py | buffpy/tests/test_link.py | from unittest.mock import MagicMock
from buffpy.models.link import Link
def test_links_shares():
""" Test link"s shares retrieving from constructor. """
mocked_api = MagicMock()
mocked_api.get.return_value = {"shares": 123}
link = Link(api=mocked_api, url="www.google.com")
assert link["shares"... | from nose.tools import eq_
from mock import MagicMock
from buffpy.models.link import Link
def test_links_shares():
'''
Test link's shares retrieving from constructor
'''
mocked_api = MagicMock()
mocked_api.get.return_value = {'shares': 123}
link = Link(api=mocked_api, url='www.google.com')
eq_(link... | mit | Python |
58008400c1b25effebdab9dd2072adc082d01dcc | Remove party from uniq constraint for party_channel_listing | fulfilio/trytond-sale-channel,prakashpp/trytond-sale-channel,tarunbhardwaj/trytond-sale-channel | party.py | party.py | # -*- coding: utf-8 -*-
"""
party
"""
from trytond.pool import PoolMeta
from trytond.model import ModelView, fields, ModelSQL, Unique
__metaclass__ = PoolMeta
__all__ = [
'Party', 'PartySaleChannelListing'
]
class Party:
"Party"
__name__ = 'party.party'
channel_listings = fields.One2Many(
... | # -*- coding: utf-8 -*-
"""
party
"""
from trytond.pool import PoolMeta
from trytond.model import ModelView, fields, ModelSQL, Unique
__metaclass__ = PoolMeta
__all__ = [
'Party', 'PartySaleChannelListing'
]
class Party:
"Party"
__name__ = 'party.party'
channel_listings = fields.One2Many(
... | bsd-3-clause | Python |
83578a1ae3a8c6def9434dff2c78792bf933a1a5 | Fix filter for SyntaxErrors | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_global.py | Lib/test/test_global.py | """Verify that warnings are issued for global statements following use"""
from test_support import check_syntax
import warnings
warnings.filterwarnings("error", module="<test code>")
def compile_and_catch_warning(text):
try:
compile(text, "<test code>", "exec")
except SyntaxError, msg:
print... | """Verify that warnings are issued for global statements following use"""
from test_support import check_syntax
import warnings
warnings.filterwarnings("error", category=SyntaxWarning, module=__name__)
def compile_and_catch_warning(text):
try:
compile(text, "<test code>", "exec")
except SyntaxWarnin... | mit | Python |
9cd71286ecd6b2f0fc3417d7e163990871ba62d4 | fix merge issue | dbrainnet/kmstool | kmstool/__init__.py | kmstool/__init__.py | #!/usr/bin/env python
import argparse
from kmstool import kmstool
__version__ = '1.3.0'
def main():
# Help file and options
parser = argparse.ArgumentParser(description='Envelope encryption with AWS KMS')
parser.add_argument('-e','--encrypt', help='This encrypts the file', action='store_true', dest='encry... | #!/usr/bin/env python
import argparse
from kmstool import kmstool
__version__ = '1.3.0'
def main():
# Help file and options
usage = "usage: %prog [options] \nYou must specify to encrypt or decrypt.\nOutput will always output a tar file."
parser = OptionParser(usage=usage)
parser.add_option('-e','--enc... | apache-2.0 | Python |
5975c27a6a685db8274645106a670850c37b6ec8 | Remove trailing slash from public index | pirate/bookmark-archiver,pirate/bookmark-archiver,pirate/bookmark-archiver | archivebox/core/utils.py | archivebox/core/utils.py | from pathlib import Path
from django.utils.html import format_html
from core.models import Snapshot
def get_icons(snapshot: Snapshot) -> str:
link = snapshot.as_link()
canon = link.canonical_outputs()
out_dir = Path(link.link_dir)
link_tuple = lambda link, method: (link.archive_path, canon[method] ... | from pathlib import Path
from django.utils.html import format_html
from core.models import Snapshot
def get_icons(snapshot: Snapshot) -> str:
link = snapshot.as_link()
canon = link.canonical_outputs()
out_dir = Path(link.link_dir)
link_tuple = lambda link, method: (link.archive_path, canon[method] ... | mit | Python |
969247cff938f3cc4d6916573746ebf088d256f2 | Add an argument for tee-ing cuts to a file | xfxf/voctomix-outcasts,CarlFK/voctomix-outcasts,xfxf/voctomix-outcasts,CarlFK/voctomix-outcasts | generate-cut-list.py | generate-cut-list.py | #!/usr/bin/env python3
#
# Copyright: 2015,2016 Carl F. Karsten <carl@nextdayvideo.com>
#
# 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 ... | #!/usr/bin/env python3
#
# Copyright: 2015,2016 Carl F. Karsten <carl@nextdayvideo.com>
#
# 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 ... | mit | Python |
ddc240ae998088759d7569f3d3cf592061842c47 | Update version | thomasyu888/Genie,thomasyu888/Genie,thomasyu888/Genie,thomasyu888/Genie | genie/__version__.py | genie/__version__.py | __version__ = "9.0.0"
| __version__ = "9.0.0-dev"
| mit | Python |
63babbae8f048385267e0e4074c5223daa77be29 | add additional imports | diogo149/treeano,nsauder/treeano,diogo149/treeano,jagill/treeano,jagill/treeano,nsauder/treeano,diogo149/treeano,jagill/treeano,nsauder/treeano | treeano/__init__.py | treeano/__init__.py | __all__ = """
lasagne
""".split()
import core
import nodes
from core import (UpdateDeltas,
SharedInitialization,
WeightInitialization,
VariableWrapper,
register_node,
NodeImpl,
WrapperNodeImpl,
... | __all__ = """
lasagne
""".split()
import core
import nodes
# ############################# FIXME DEPRECATED #############################
from initialization import (SharedInitialization,
WeightInitialization)
from node import Node, WrapperNode
from update_deltas import UpdateDeltas
imp... | apache-2.0 | Python |
74836e8f864dcdaf75835292abf2637a6a3f8c95 | add raw property to HttpResponse | ivanprjcts/sdklib,ivanprjcts/sdklib | sdklib/http/response.py | sdklib/http/response.py | import io
import json
from xml.etree import ElementTree
from sdklib.http.session import Cookie
from sdklib.util.structures import xml_string_to_dict
class HttpResponse(io.IOBase):
def __init__(self, resp):
self.urllib3_response = resp
self._cookie = None
self.file = None
@property
... | import io
import json
from xml.etree import ElementTree
from sdklib.http.session import Cookie
from sdklib.util.structures import xml_string_to_dict
class HttpResponse(io.IOBase):
def __init__(self, resp):
self.urllib3_response = resp
self._cookie = None
self.file = None
@property
... | bsd-2-clause | Python |
5d821fd7a340df04625ef28347c0c046a9a18bcc | remove another pickle | selective-inference/selective-inference,selective-inference/selective-inference,selective-inference/selective-inference,selective-inference/selective-inference | plots.py | plots.py | import statsmodels.api as sm
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
U = np.linspace(0, 1, 101)
file_labels = ['kk_probit2.csv', 'kk_logit2.csv']
dfs = {}
for label in zip(file_labels, ['logit', 'probit']):
print(label)
dfs[label[1]] = pd.read_csv(label[0])
(coverage,
... | import statsmodels.api as sm
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
U = np.linspace(0, 1, 101)
file_labels = ['kk_probit2.csv', 'kk_logit2.csv']
for label in file_labels:
print(label)
df = pd.read_csv(label)
(coverage,
P,
L,
naive_coverage,
naive_P,... | bsd-3-clause | Python |
4eea44955c49cda8973176daa08769c5f1315e49 | Remove chrome://net-internals from special tabs test | hgl888/chromium-crosswalk,Jonekee/chromium.src,patrickm/chromium.src,M4sse/chromium.src,junmin-zhu/chromium-rivertrail,jaruba/chromium.src,hgl888/chromium-crosswalk,mogoweb/chromium-crosswalk,littlstar/chromium.src,mogoweb/chromium-crosswalk,Jonekee/chromium.src,jaruba/chromium.src,ChromiumWebApps/chromium,hujiajie/pa-... | chrome/test/functional/special_tabs.py | chrome/test/functional/special_tabs.py | #!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import pyauto_functional # Must be imported before pyauto
import pyauto
class SpecialTabsTest(pyauto.PyUITest):
"""TestCase for Sp... | #!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import pyauto_functional # Must be imported before pyauto
import pyauto
class SpecialTabsTest(pyauto.PyUITest):
"""TestCase for Sp... | bsd-3-clause | Python |
0f4192f960fc977374dd04ea9fcc4cf5d85feab4 | Make the redirection field configurable | danfairs/django-lazysignup,danfairs/django-lazysignup,stefanklug/django-lazysignup,rwillmer/django-lazysignup,rwillmer/django-lazysignup,stefanklug/django-lazysignup | lazysignup/views.py | lazysignup/views.py | from django.shortcuts import redirect
from django.http import HttpResponse
from django.http import HttpResponseBadRequest
from django.template import RequestContext
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.http import require_POST
from django.views.generic.simple import direc... | from django.shortcuts import redirect
from django.http import HttpResponse
from django.http import HttpResponseBadRequest
from django.template import RequestContext
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.http import require_POST
from django.views.generic.simple import direc... | bsd-3-clause | Python |
5503b0f29025cec27d3e3613cf3f9410e399a7a5 | Bump version 0.16.1 --> 0.17.0rc1 | lbryio/lbry,lbryio/lbry,lbryio/lbry | lbrynet/__init__.py | lbrynet/__init__.py | import logging
__version__ = "0.17.0rc1"
version = tuple(__version__.split('.'))
logging.getLogger(__name__).addHandler(logging.NullHandler())
| import logging
__version__ = "0.16.1"
version = tuple(__version__.split('.'))
logging.getLogger(__name__).addHandler(logging.NullHandler())
| mit | Python |
4584ddb7222596027c3a05b5940e20a76e619cc4 | Check input arrays | rtavenar/tslearn | tslearn/nn.py | tslearn/nn.py | from sklearn.neural_network import MLPClassifier, MLPRegressor
from sklearn.utils import check_array
__author__ = 'Romain Tavenard romain.tavenard[at]univ-rennes2.fr'
class TimeSeriesMLPClassifier(MLPClassifier):
def fit(self, X, y):
X_ = check_array(X, force_all_finite=True, allow_nd=True)
X_ = ... | from sklearn.neural_network import MLPClassifier, MLPRegressor
__author__ = 'Romain Tavenard romain.tavenard[at]univ-rennes2.fr'
class TimeSeriesMLPClassifier(MLPClassifier):
def fit(self, X, y):
n_ts = X.shape[0]
X_ = X.reshape((n_ts, -1))
return super(TimeSeriesMLPClassifier, self).fit(... | bsd-2-clause | Python |
07ad57f7bc95c418db0ad035eaf95cb5b8daa7fb | Fix network collector unit test | krbaker/Diamond,hamelg/Diamond,actmd/Diamond,skbkontur/Diamond,acquia/Diamond,Netuitive/Diamond,MichaelDoyle/Diamond,sebbrandt87/Diamond,tuenti/Diamond,TAKEALOT/Diamond,jumping/Diamond,anandbhoraskar/Diamond,Ssawa/Diamond,TinLe/Diamond,anandbhoraskar/Diamond,TAKEALOT/Diamond,Netuitive/netuitive-diamond,saucelabs/Diamon... | src/collectors/network/test/testnetwork.py | src/collectors/network/test/testnetwork.py | #!/usr/bin/python
################################################################################
from test import *
from diamond.collector import Collector
from network import NetworkCollector
################################################################################
class TestNetworkCollector(CollectorTest... | #!/usr/bin/python
################################################################################
from test import *
from diamond.collector import Collector
from network import NetworkCollector
################################################################################
class TestNetworkCollector(CollectorTest... | mit | Python |
5036380f31a5887ddefdfcbed21983f791ab8555 | Update __init__.py | devartis/django-carrousel,devartis/django-carrousel | carrousel/__init__.py | carrousel/__init__.py | __version__ = '2.0'
def get_version():
return __version__
| __version__ = '1.1rc2'
def get_version():
return __version__
| apache-2.0 | Python |
efb545c1fdb8e962e49da6ab1614d2f5ce8c30a3 | Update mmhandler.py | python-technopark/MoneyMoney | src/mmhandler.py | src/mmhandler.py | from sql import SQL
"""
MoneyMoney handler for all calculating functions.
List of functions:
add_fixed_income(name, amount, date)
add_income(amount, name)
add_expense(amount, category)
show_categories()
show_incomes()
show_daily_operations(category = None)
add_category(name)
del_category(name)
view_report(period, cate... | from sql import SQL
"""
MoneyMoney handler for all calculating functions.
List of functions:
add_fixed_income(name, amount, date)
add_income(amount, name)
add_expense(amount, category)
show_categories()
show_incomes()
show_daily_operations(category = None)
add_category(name)
del_category(name)
view_report(period, ca... | mit | Python |
9692252ad82c8c187f79dca06fff01484ec6291f | remove test parts of record that have become obsolete | klieret/inspiderweb | inspiderweb/test_record.py | inspiderweb/test_record.py | import unittest
from . import record
# fixme: still throws errors
class RecordTest(unittest.TestCase):
def setUp(self):
self.r = record.Record("1471118")
def test_recid(self):
assert self.r.recid == "1471118"
def test_inspireurl(self):
assert self.r.inspire_url == \
... | import unittest
from . import record
# fixme: still throws errors
class RecordTest(unittest.TestCase):
def setUp(self):
self.r = record.Record("1471118")
def test_recid(self):
assert self.r.recid == "1471118"
def test_inspireurl(self):
assert self.r.inspire_url == \
... | mit | Python |
9cdae9b19eb73cfeffb8a7671c9dd29cf28a2c13 | Test for daily sales | JamesRamm/longclaw,JamesRamm/longclaw,JamesRamm/longclaw,JamesRamm/longclaw | longclaw/longclawstats/tests.py | longclaw/longclawstats/tests.py | from django.test import TestCase
from datetime import datetime
from datetime import timedelta
from longclaw.longclawstats import stats
from longclaw.tests.utils import OrderFactory
class StatsTest(TestCase):
def setUp(self):
order = OrderFactory()
order.payment_date = datetime.now()
order... | from django.test import TestCase
from datetime import datetime
from datetime import timedelta
from longclaw.longclawstats import stats
from longclaw.tests.utils import OrderFactory
class StatsTest(TestCase):
def setUp(self):
order = OrderFactory()
order.payment_date = datetime.now()
order... | mit | Python |
11efd7c5d5f43a3965c19151fae2b65285dd2802 | use whatismyip.com | cf-platform-eng/bosh-azure-template,cf-platform-eng/bosh-azure-template | install_steps/setup_dns.py | install_steps/setup_dns.py | import os
import traceback
import re
import urllib2
from subprocess import call
def do_step(context):
settings = context.meta['settings']
username = settings["username"]
home_dir = os.path.join("/home", username)
install_log = os.path.join(home_dir, "install.log")
# Setup the devbox as a DNS
... | import os
import traceback
import re
import urllib2
from subprocess import call
def do_step(context):
settings = context.meta['settings']
username = settings["username"]
home_dir = os.path.join("/home", username)
install_log = os.path.join(home_dir, "install.log")
# Setup the devbox as a DNS
... | apache-2.0 | Python |
d5a2c362147b7a82b3713121aadd572b2e70690c | Improve tests | allisson/django-rest-framework-rapidjson | testproject/tests/testapp/test_views.py | testproject/tests/testapp/test_views.py | import pytest
from rest_framework.reverse import reverse
from rest_framework import status
from testapp.models import MyTestModel
pytestmark = pytest.mark.django_db
@pytest.fixture
def my_test_model_data():
return {
'charfield': 'charfield',
'datefield': '2017-01-01',
'datetimefield': '2... | from decimal import Decimal
from uuid import uuid4
import pytest
from django.utils.timezone import now
from rest_framework.reverse import reverse
from rest_framework import status
from testapp.models import MyTestModel
pytestmark = pytest.mark.django_db
@pytest.fixture
def my_test_model_data():
return {
... | mit | Python |
7989252dd687dfaa1fd12ed8900c947190bfe4f7 | Set redis connection info on the right class (the pool). | therewillbecode/ichnaea,mozilla/ichnaea,mozilla/ichnaea,therewillbecode/ichnaea,mozilla/ichnaea,therewillbecode/ichnaea,mozilla/ichnaea | ichnaea/cache.py | ichnaea/cache.py | import redis
import urlparse
def redis_client(redis_url):
r_url = urlparse.urlparse(redis_url)
r_host = r_url.netloc.split(":")[0]
r_port = int(r_url.netloc.split(":")[1])
r_db = int(r_url.path[1:])
pool = redis.ConnectionPool(
max_connections=100,
host=r_host,
port=r_port,... | import redis
import urlparse
def redis_client(redis_url):
r_url = urlparse.urlparse(redis_url)
r_host = r_url.netloc.split(":")[0]
r_port = int(r_url.netloc.split(":")[1])
r_db = int(r_url.path[1:])
pool = redis.ConnectionPool(
max_connections=100,
socket_timeout=10.0,
sock... | apache-2.0 | Python |
a29d712b69f64ec248fb7f6829da9996dc5b217a | Test ActiveMQ under SSL connection | rafaduran/python-mcollective,rafaduran/python-mcollective,rafaduran/python-mcollective,rafaduran/python-mcollective | tests/integration/test_with_activemq.py | tests/integration/test_with_activemq.py | import os
from pymco.test import ctxt
from . import base
class ActiveMQTestCase(base.IntegrationTestCase):
'''RabbitMQ integration test case.'''
CTXT = {
'plugin.activemq.pool.1.port': 61614,
'plugin.activemq.pool.1.password': 'marionette',
}
class TestWithActiveMQMCo20x(base.MCollecti... | from . import base
class ActiveMQTestCase(base.IntegrationTestCase):
'''RabbitMQ integration test case.'''
CTXT = {
'plugin.activemq.pool.1.port': 61614,
'plugin.activemq.pool.1.password': 'marionette',
}
class TestWithActiveMQMCo20x(base.MCollective20x, ActiveMQTestCase):
'''MCollec... | bsd-3-clause | Python |
c12aeb11279b9deecdd43e3259d6e52d66fe3661 | add case select by name mark " before case name | empoweredhomes/esp-idf,jaracil/esp-idf,jaracil/esp-idf,CliffsDover/esp-idf,tidyjiang8/esp-idf-zh,tidyjiang8/esp-idf-zh,dschaefer/esp-idf,CliffsDover/esp-idf,ajs124/esp-idf,espressif/esp-idf,CliffsDover/esp-idf,mashaoze/esp-idf,dantonets/Pingzee-ESP32,tidyjiang8/esp-idf-zh,empoweredhomes/esp-idf,empoweredhomes/esp-idf,M... | components/idf_test/unit_test/TestCaseScript/IDFUnitTest/UnitTest.py | components/idf_test/unit_test/TestCaseScript/IDFUnitTest/UnitTest.py | import re
import time
from TCAction import PerformanceTCBase
from TCAction import TCActionBase
from NativeLog import NativeLog
class UnitTest(PerformanceTCBase.PerformanceTCBase):
def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH):
PerformanceTCBase.PerformanceTCBase._... | import re
import time
from TCAction import PerformanceTCBase
from TCAction import TCActionBase
from NativeLog import NativeLog
class UnitTest(PerformanceTCBase.PerformanceTCBase):
def __init__(self, name, test_env, cmd_set, timeout=30, log_path=TCActionBase.LOG_PATH):
PerformanceTCBase.PerformanceTCBase._... | apache-2.0 | Python |
f3f54d9a6cc7ab71b3465f03a9d9de30989b6324 | Test for builtins. | retoo/pystructure,retoo/pystructure,retoo/pystructure,retoo/pystructure | tests/python/typeinference/built-ins.py | tests/python/typeinference/built-ins.py | a = list()
a.append(1)
a.pop() ## type int
b = list()
b.append(3.14)
b.pop() ## type float
|
x = []
x.append("hallo") # FIXME: how to handle/test internal/unreachable clases & methods # type | lgpl-2.1 | Python |
c97c2ae6a1b5e19c76661023c964505cc85e31d8 | Fix argparse | pirsquare/chequeconvert-python | chequeconvert/main.py | chequeconvert/main.py | import sys
import argparse
from .base import generate_word
def main():
parser = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("amt", type=str,
help="Amount to convert in string... | import sys
import argparse
from .base import generate_word
def main():
parser = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
subparser = parser.add_subparsers(dest='chequeconvert')
args = parser.parse_args(sys.argv... | mit | Python |
e4c72b3f8fc1c45a6cba9f064776650c6a959ed3 | Add forgotten global variable declaration | Ekleog/nmgr,Ekleog/nmgr | src/nmgr/udev.py | src/nmgr/udev.py | #
# This file is part of nmgr.
# Copyright (C) 2015 Leo Gaspard
#
# nmgr 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.
#
# nmgr is di... | #
# This file is part of nmgr.
# Copyright (C) 2015 Leo Gaspard
#
# nmgr 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.
#
# nmgr is di... | agpl-3.0 | Python |
8c0af29e7b6ec3a5e76fdb1efc56068bf276ad39 | Add babel plugin for Flask | Relrin/Helenae,Relrin/Helenae,Relrin/Helenae | helenae/flask_app.py | helenae/flask_app.py | from flask import Flask, request, session
from flask_sqlalchemy import SQLAlchemy
from flask.ext.babelex import Babel
from db import tables as dbTables
app = Flask(__name__, template_folder='./web/templates/', static_folder='./web/static/', static_url_path='')
app.config['SECRET_KEY'] = 'some_secret_key'
app.config['S... | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from db import tables as dbTables
app = Flask(__name__, template_folder='./web/templates/')
app.config['SECRET_KEY'] = 'some_secret_key'
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://user:password@localhost/csan'
db_connection = SQLAlchemy(app)
i... | mit | Python |
353e29073d1cdb667311b354322f901d8ef14d04 | move admin to sysadmin | educloudalliance/eca-auth-data,educloudalliance/eca-auth-data | authdata/urls.py | authdata/urls.py | # -*- encoding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014-2015 Haltu Oy, http://haltu.fi
#
# 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 witho... | # -*- encoding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014-2015 Haltu Oy, http://haltu.fi
#
# 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 witho... | mit | Python |
d01068084fa7e4f0be67f3a8118b875628bdfc8c | add ability to create lockfiles | hawkrives/stolaf-ubersicht-widgets,hawkrives/stolaf-ubersicht-widgets,hawkrives/stolaf-ubersicht-widgets | lib/data_helpers.py | lib/data_helpers.py | from datetime import datetime
import json
import sys
import os
def check_pid(pid):
'''Check for the existence of a unix pid.'''
try:
os.kill(pid, 0)
except OSError:
return False
else:
return True
def make_lock_filename(filename):
return 'data/' + filename + '.lock'
def ... | import json
import os
from datetime import datetime
def now():
return datetime.now().isoformat()
def ensure_dir_exists(folder):
# Make sure that a folder exists.
d = os.path.dirname(folder)
if not os.path.exists(d):
os.makedirs(d)
def ensure_file_exists(path):
ensure_dir_exists(path)
... | mit | Python |
ecdcfa898430045acf36b9d1542f44c7f4be35cd | Remove downloading functions | andrewlrogers/srvy | maintenance/questions_update.py | maintenance/questions_update.py | #!/usr/bin/python
""" Downloads questions from dropbox to be integrated into srvy """
import dropbox
import pathlib
from datetime import datetime, timedelta
from configparser import ConfigParser
# Dropbox Configuration
parser = ConfigParser()
parser.read('../configuration/srvy.config')
dropbox_token = parser.get('dr... | #!/usr/bin/python
""" Downloads questions from dropbox to be integrated into srvy """
import dropbox
import pathlib
from datetime import datetime, timedelta
from configparser import ConfigParser
# Dropbox Configuration
parser = ConfigParser()
parser.read('../configuration/srvy.config')
dropbox_token = parser.get('dr... | mit | Python |
42865fd13697b1b6cf7e72527fb7a8066f8e0981 | Add module level doc-string | GuyAllard/markov_clustering | markov_clustering/modularity.py | markov_clustering/modularity.py | """
Computation of the modularity of a clustering
"""
import numpy as np
from fractions import Fraction
from itertools import permutations
from scipy.sparse import isspmatrix, dok_matrix, find
from .mcl import sparse_allclose
def is_undirected(matrix):
"""
Determine if the matrix reprensents a directed graph... | import numpy as np
from fractions import Fraction
from itertools import permutations
from scipy.sparse import isspmatrix, dok_matrix, find
from .mcl import sparse_allclose
def is_undirected(matrix):
"""
Determine if the matrix reprensents a directed graph
:param matrix: The matrix to tested
:returns:... | mit | Python |
58cb4103c8949229d6dd73a1ef0ef7e6991a4f40 | Remove url params from S3 img url. | glogiotatidis/masterfirefoxos,enng0227/masterfirefoxos,mozilla/masterfirefoxos,mozilla/masterfirefoxos,liu21st/masterfirefoxos,craigcook/masterfirefoxos,glogiotatidis/masterfirefoxos,enng0227/masterfirefoxos,craigcook/masterfirefoxos,mozilla/masterfirefoxos,liu21st/masterfirefoxos,liu21st/masterfirefoxos,mozilla/master... | masterfirefoxos/base/helpers.py | masterfirefoxos/base/helpers.py | import os
from datetime import datetime
from django.conf import settings
from django.contrib.staticfiles.templatetags.staticfiles import static as static_helper
from django.utils.translation import activate as dj_activate, get_language
from feincms.module.medialibrary.models import MediaFile
from feincms.templatetags... | import os
from datetime import datetime
from django.conf import settings
from django.contrib.staticfiles.templatetags.staticfiles import static as static_helper
from django.utils.translation import activate as dj_activate, get_language
from feincms.module.medialibrary.models import MediaFile
from feincms.templatetags... | mpl-2.0 | Python |
17ea89228d253f21d18c2f1e36bd6b91e495f90b | Raise an exception if the view has title == "" | Inboxen/website,Inboxen/Inboxen,Inboxen/Inboxen,Inboxen/Inboxen,Inboxen/Inboxen | views/base.py | views/base.py | ##
# This file is part of Inboxen.
#
# Inboxen 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.
#
# Inboxen is distrib... | ##
# This file is part of Inboxen.
#
# Inboxen 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.
#
# Inboxen is distrib... | agpl-3.0 | Python |
ed94e5ee0cd93658595854630881ad7079ca5905 | fix error on unregistered hdl ids in repr of hdl objects | Nic30/HWToolkit | hwt/hdl/hdlObject.py | hwt/hdl/hdlObject.py | from io import StringIO
from hdlConvertorAst.translate.common.name_scope import NameScope
class HdlObject():
"""
Base Hdl object class for object which can be directly serialized
to target HDL language
"""
def __repr__(self):
from hwt.serializer.hwt import HwtSerializer
name_scope... | from io import StringIO
from hdlConvertorAst.translate.common.name_scope import NameScope
class HdlObject():
"""
Base Hdl object class for object which can be directly serialized
to target HDL language
"""
def __repr__(self):
from hwt.serializer.hwt import HwtSerializer
name_scope... | mit | Python |
944b4bf490fbdd206cd32c20cd7cc56911722a66 | change the color of default style | Woile/commitizen,Woile/commitizen | commitizen/cz/base.py | commitizen/cz/base.py | from typing import Optional, List, Tuple
from abc import ABCMeta, abstractmethod
from prompt_toolkit.styles import merge_styles, Style
class BaseCommitizen(metaclass=ABCMeta):
bump_pattern: Optional[str] = None
bump_map: Optional[dict] = None
default_style_config: List[Tuple[str, str]] = [
("qmar... | from typing import Optional, List, Tuple
from abc import ABCMeta, abstractmethod
from prompt_toolkit.styles import merge_styles, Style
class BaseCommitizen(metaclass=ABCMeta):
bump_pattern: Optional[str] = None
bump_map: Optional[dict] = None
default_style_config: List[Tuple[str, str]] = [
("qmar... | mit | Python |
bb3884f163d865699d63164aae4aa41f62f31ba0 | Remove project folder if you clone from git for second call to work | saltukalakus/xuser,saltukalakus/xuser,saltukalakus/xuser,saltukalakus/xuser | infra/duo/fabfile.py | infra/duo/fabfile.py | from fabric.api import *
master_ip = '52.28.150.155'
slave_ip = '52.28.154.136'
local_ip_list =[]
env.hosts = [master_ip, slave_ip]
env.user = 'ubuntu'
env.key_filename = '/home/keys/key.pem'
@with_settings(warn_only=True)
def git_checkout():
sudo('rm -Rf xuser')
run('git clone https://github.com/saltukalakus... | from fabric.api import *
master_ip = '52.28.150.155'
slave_ip = '52.28.154.136'
local_ip_list =[]
env.hosts = [master_ip, slave_ip]
env.user = 'ubuntu'
env.key_filename = '/home/keys/key.pem'
@with_settings(warn_only=True)
def git_checkout():
run('git clone https://github.com/saltukalakus/xuser')
@with_settings(... | mit | Python |
747af88d56dc274638f515825405f58b0e59b8d7 | Make sure user in logged in for showing invoice | Chris7/django-invoice,Chris7/django-invoice,simonluijk/django-invoice | invoice/views.py | invoice/views.py | from django.shortcuts import get_object_or_404
from django.contrib.auth.decorators import login_required
from invoice.models import Invoice
from invoice.pdf import draw_pdf
from invoice.utils import pdf_response
def pdf_view(request, pk):
invoice = get_object_or_404(Invoice, pk=pk)
return pdf_response(draw_pd... | from django.shortcuts import get_object_or_404
from invoice.models import Invoice
from invoice.pdf import draw_pdf
from invoice.utils import pdf_response
def pdf_view(request, pk):
invoice = get_object_or_404(Invoice, pk=pk)
return pdf_response(draw_pdf, invoice.file_name(), invoice)
def pdf_user_view(reque... | bsd-3-clause | Python |
98591c5388c2ac2b89fea7d790f3637c5e6c4640 | Bump version to 0.2020.07.08.1411 | oduwsdl/ipwb,oduwsdl/ipwb,oduwsdl/ipwb,oduwsdl/ipwb | ipwb/__init__.py | ipwb/__init__.py | __version__ = '0.2020.07.08.1411'
| __version__ = '0.2020.07.01.1419'
| mit | Python |
ac7c186ddd5caaf329e71d844f8f31298109b365 | use frontend rounding (done!) | CollectQT/qapc,CollectQT/qapc | lib/worker_utils.py | lib/worker_utils.py | ############################################################
# worker data transforms
############################################################
def make_worker_video_list(workers, table):
for video in table.values():
for worker in video['Workers'].keys():
workers[worker]['videos'].append( ... | ############################################################
# worker data transforms
############################################################
def make_worker_video_list(workers, table):
for video in table.values():
for worker in video['Workers'].keys():
workers[worker]['videos'].append( ... | agpl-3.0 | Python |
c9cb664bbfef58f9cb2318e77402f7e63a9ca6d8 | Bump version to .post2 | Yelp/kafka-python,Yelp/kafka-python | kafka/version.py | kafka/version.py | __version__ = '0.9.4.post2'
| __version__ = '0.9.4.post1'
| apache-2.0 | Python |
3de08c60fd4e02da28603f0b4e4f082bd9b058ff | add version info to the run_trace helper | hugovk/coveragepy,nedbat/coveragepy,hugovk/coveragepy,nedbat/coveragepy,nedbat/coveragepy,hugovk/coveragepy,nedbat/coveragepy,hugovk/coveragepy,nedbat/coveragepy,hugovk/coveragepy | lab/run_trace.py | lab/run_trace.py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Run a simple trace function on a file of Python code."""
import os, sys
nest = 0
def trace(frame, event, arg):
global nest
if nest is None:
#... | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Run a simple trace function on a file of Python code."""
import os, sys
nest = 0
def trace(frame, event, arg):
global nest
if nest is None:
#... | apache-2.0 | Python |
8b720995bb084257164843f4022cd0f44436cead | Split command into console and web subcommands | Fanarim/github_labelbot,Fanarim/github_labelbot | labelbot/main.py | labelbot/main.py | #!/usr/bin/env python3
import click
from labelbot import LabelBot, UrlParam
@click.group()
@click.option('--token-file',
'-t',
type=click.Path(exists=True,
file_okay=True,
readable=True),
default='token.cfg',
... | #!/usr/bin/env python3
import click
from labelbot import LabelBot, UrlParam
@click.command()
@click.option('--token-file',
'-t',
type=click.Path(exists=True,
file_okay=True,
readable=True),
default='token.cfg',
... | mit | Python |
6f6df231085b1a99c4a1d4d84a096b9533d64c4f | Add back removed TODO | mkoistinen/aldryn-newsblog,czpython/aldryn-newsblog,mkoistinen/aldryn-newsblog,czpython/aldryn-newsblog,czpython/aldryn-newsblog,czpython/aldryn-newsblog,mkoistinen/aldryn-newsblog | aldryn_newsblog/admin.py | aldryn_newsblog/admin.py | from django.contrib import admin
from cms.admin.placeholderadmin import FrontendEditableAdmin
from parler.admin import TranslatableAdmin
from aldryn_apphooks_config.admin import BaseAppHookConfig
from aldryn_people.models import Person
from .versioning import VersionedPlaceholderAdminMixin
from . import models
clas... | from django.contrib import admin
from cms.admin.placeholderadmin import FrontendEditableAdmin
from parler.admin import TranslatableAdmin
from aldryn_apphooks_config.admin import BaseAppHookConfig
from aldryn_people.models import Person
from .versioning import VersionedPlaceholderAdminMixin
from . import models
clas... | bsd-3-clause | Python |
e882f5949bdd1618d97b0cade18a7e8af8670b41 | Remove unused __version__ constant (Fixes #262) | miguelgrinberg/python-engineio,miguelgrinberg/python-engineio,miguelgrinberg/python-engineio | src/engineio/__init__.py | src/engineio/__init__.py | import sys
from .client import Client
from .middleware import WSGIApp, Middleware
from .server import Server
if sys.version_info >= (3, 5): # pragma: no cover
from .asyncio_server import AsyncServer
from .asyncio_client import AsyncClient
from .async_drivers.asgi import ASGIApp
try:
from .asyn... | import sys
from .client import Client
from .middleware import WSGIApp, Middleware
from .server import Server
if sys.version_info >= (3, 5): # pragma: no cover
from .asyncio_server import AsyncServer
from .asyncio_client import AsyncClient
from .async_drivers.asgi import ASGIApp
try:
from .asyn... | mit | Python |
cbecc12687a2f8e9853336cde143a7734699583c | Add docstrings | seansisson/ImageFudge,seansisson/ImageFudge,willpatterson/ImageFudge,willpatterson/ImageFudge | imagefudge/utils.py | imagefudge/utils.py | import math
import ntpath
import os
from random import random, randrange
from PIL import Image
from PIL import ImageDraw
from collections import namedtuple
class FudgeUtils(object):
""" Image Fudge helper class """
Point = namedtuple('Point', ['x', 'y'])
def __init__(self, image, scale=2):
""" ... | import math
import ntpath
import os
from random import random, randrange
from PIL import Image
from PIL import ImageDraw
from collections import namedtuple
class FudgeUtils(object):
Point = namedtuple('Point', ['x', 'y'])
def __init__(self, image, scale=2):
try:
self.image = Image.open... | mit | Python |
cfdb3362db4a051e316fd850f12350053d672b76 | add newline at end of file | empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core | services/post_slack_message.py | services/post_slack_message.py | import os
import slack
client = slack.WebClient(token=os.environ['SLACK_API_TOKEN'])
username = os.environ['USER']
project_name = os.environ['PROJECT_NAME']
response = client.chat_postMessage(
channel='#quill-developer',
text=username + " deployed " + project_name + " to production")
| import os
import slack
client = slack.WebClient(token=os.environ['SLACK_API_TOKEN'])
username = os.environ['USER']
project_name = os.environ['PROJECT_NAME']
response = client.chat_postMessage(
channel='#quill-developer',
text=username + " deployed " + project_name + " to production") | agpl-3.0 | Python |
027d6a29fd8bf7df82f758347c63ca162aa3f3e8 | Correct test class name | mysociety/popit-django,ciudadanointeligente/popit-django,ciudadanointeligente/popit-django,ciudadanointeligente/popit-django,mysociety/popit-django,mysociety/popit-django | popit/tests/popit_instance.py | popit/tests/popit_instance.py | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
from django.core.exceptions import ValidationError
from django.db import IntegrityError
from popit.mod... | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
from django.core.exceptions import ValidationError
from django.db import IntegrityError
from popit.mod... | agpl-3.0 | Python |
4e40575147fd9af02c0e0a380e4d35f6c5d8f67a | Discard dodgy points in Breckland | chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_breckland.py | polling_stations/apps/data_collection/management/commands/import_breckland.py | from data_collection.management.commands import BaseXpressWebLookupCsvImporter
class Command(BaseXpressWebLookupCsvImporter):
council_id = 'E07000143'
addresses_name = 'May 2017/BrecklandPropertyPostCodePollingStationWebLookup-2017-02-20.TSV'
stations_name = 'May 2017/BrecklandPropertyPostCodePolli... | from data_collection.management.commands import BaseXpressWebLookupCsvImporter
class Command(BaseXpressWebLookupCsvImporter):
council_id = 'E07000143'
addresses_name = 'May 2017/BrecklandPropertyPostCodePollingStationWebLookup-2017-02-20.TSV'
stations_name = 'May 2017/BrecklandPropertyPostCodePolli... | bsd-3-clause | Python |
7f642f07644805535e95624bf2bf3e17dfbbcc54 | Increase package version to next release candidate | MGHComputationalPathology/highdicom | src/highdicom/version.py | src/highdicom/version.py | __version__ = '0.3.0rc'
| __version__ = '0.2.0'
| mit | Python |
0a635ec0d384e8f5fb280c5b925c13c2d2fc6190 | Increase version for release | MGHComputationalPathology/highdicom | src/highdicom/version.py | src/highdicom/version.py | __version__ = '0.12.0'
| __version__ = '0.11.0'
| mit | Python |
31168c729ac486e6a0705e9c5117586dfb964cf7 | Move sheet_by_name after expected interfaces. | monokrome/django-drift | importer/loaders.py | importer/loaders.py | from django.conf import settings
import xlrd
import os
base_loader_error = 'The Loader class can only be used by extending it.'
extensions = getattr(
settings,
'IMPORTER_EXTENSIONS',
{
'excel': ('.xls', '.xlsx'),
}
)
class Loader(object):
def __init__(self, file_info, autoload=True):
... | from django.conf import settings
import xlrd
import os
base_loader_error = 'The Loader class can only be used by extending it.'
extensions = getattr(
settings,
'IMPORTER_EXTENSIONS',
{
'excel': ('.xls', '.xlsx'),
}
)
class Loader(object):
def __init__(self, file_info, autoload=True):
... | mit | Python |
0db317fe044784c35a001bbdabdec7db9de4c764 | Update version to 1.0.1 | climapulse/dj-labeler | labeler/__init__.py | labeler/__init__.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, division, absolute_import
from .base import resolve_dict_value, Translations
from .forms import FormTranslations, apply_to_form
from .models import ModelTranslations, apply_to_model
VERSION = (1, 0, 1)
__version__ = '.'.join(['%s' % s fo... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, division, absolute_import
from .base import resolve_dict_value, Translations
from .forms import FormTranslations, apply_to_form
from .models import ModelTranslations, apply_to_model
VERSION = (1, 0, 0)
__version__ = '.'.join(['%s' % s fo... | bsd-3-clause | Python |
79a6720e6017940d48e4539798ecb816788bd40f | Fix typo in urls for /licenses/available/<key>/ | sheagcraig/sal,salopensource/sal,sheagcraig/sal,salopensource/sal,sheagcraig/sal,salopensource/sal,sheagcraig/sal,salopensource/sal | licenses/urls.py | licenses/urls.py | from django.urls import path
from licenses.views import *
urlpatterns = [
path('', license_index, name='license_index'),
path('available/<key>/', available),
path('available/<key>/<item_name>/', available),
path('usage/<key>/', usage),
path('usage/<key>/<item_name>/', usage),
path('edit/<lice... | from django.urls import path
from licenses.views import *
urlpatterns = [
path('', license_index, name='license_index'),
path('available/<key>)/', available),
path('available/<key>/<item_name>/', available),
path('usage/<key>/', usage),
path('usage/<key>/<item_name>/', usage),
path('edit/<lic... | apache-2.0 | Python |
38b79013af480382e64e34a363df99be9f9de779 | Fix import sorting | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | meinberlin/config/whitenoise.py | meinberlin/config/whitenoise.py | """WSGI WhiteNoise config for meinberlin project."""
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "meinberlin.config.settings")
application = get_wsgi_application()
application = DjangoWhiteNoise(applicat... | """WSGI WhiteNoise config for meinberlin project."""
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "meinberlin.config.settings")
application = get_wsgi_application()
application = DjangoWhiteNoise(applicati... | agpl-3.0 | Python |
607474cf3e29835255fdeb8bbbd5247bd8ca6ae3 | update initialize the geolang toolkit package | Lh4cKg/simple-geolang-toolkit | geolang/__init__.py | geolang/__init__.py | from geolang.geolang import (
__author__,
__version__,
_KA_ALPHABET,
_LAT_ALHPABET,
KA2LAT,
LAT2KA,
UNI2LAT,
_2KA,
_2LAT,
encode_slugify,
GeoLangToolKit,
)
# from geolang.geolang import *
from .unicode import unicode | from geolang.geolang import (
__author__,
__version__,
KA2LAT,
LAT2KA,
UNI2LAT,
_2KA,
_2LAT,
encode_slugify,
GeoLangToolKit,
)
# from geolang.geolang import *
from .unicode import unicode | mit | Python |
376b6a8840783da8d24a7296d95a1a6ab4086d95 | bump version | jazzband/django-axes,django-pci/django-axes | axes/__init__.py | axes/__init__.py | from __future__ import unicode_literals
__version__ = '4.4.2'
default_app_config = 'axes.apps.AppConfig'
def get_version():
return __version__
| from __future__ import unicode_literals
__version__ = '4.4.1'
default_app_config = 'axes.apps.AppConfig'
def get_version():
return __version__
| mit | Python |
e7895f1a0d798c3f931d096f711d40d7185bc440 | Make flake8 happy | dahlia/libsass-python,dahlia/libsass-python | build_manylinux_wheels.py | build_manylinux_wheels.py | #!/usr/bin/env python3.5
"""Script for building 'manylinux' wheels for libsass.
Run me after putting the source distribution on pypi.
See: https://www.python.org/dev/peps/pep-0513/
"""
import os
import pipes
import subprocess
import tempfile
from twine.commands import upload
def check_call(*cmd):
print(
... | #!/usr/bin/env python3.5
"""Script for building 'manylinux' wheels for libsass.
Run me after putting the source distribution on pypi.
See: https://www.python.org/dev/peps/pep-0513/
"""
import os
import pipes
import subprocess
import tempfile
from twine.commands import upload
def check_call(*cmd):
print(
... | mit | Python |
9dc8238ec1506408af1e1635aee542b1e22c5926 | make this work with the .norm() method | harpolea/pyro2,zingale/pyro2,zingale/pyro2,harpolea/pyro2 | analysis/smooth_error.py | analysis/smooth_error.py | #!/usr/bin/env python
import numpy as np
import mesh.patch as patch
import sys
import advection.problems.smooth as smooth
usage = """
compare the output in file from the smooth advection problem to
the analytic solution.
usage: ./smooth_error.py file
"""
if not len(sys.argv) == 2:
print usage
... | #!/usr/bin/env python
import numpy as np
import mesh.patch as patch
import sys
import advection.problems.smooth as smooth
usage = """
compare the output in file from the smooth advection problem to
the analytic solution.
usage: ./smooth_error.py file
"""
def abort(string):
print string
sys... | bsd-3-clause | Python |
4a20a36aa920a6450eb526a9913d8fb0ab08fa8c | Tweak SimpleRunner.run: make it close to the parallel one | tkf/buildlet | buildlet/runner/simple.py | buildlet/runner/simple.py | from .base import BaseRunner
class SimpleRunner(BaseRunner):
"""
Simple blocking task runner.
"""
@classmethod
def run(cls, task):
"""
Simple blocking task runner.
Run `task` and its unfinished ancestors.
"""
for parent in task.get_parents():
... | from .base import BaseRunner
class SimpleRunner(BaseRunner):
"""
Simple blocking task runner.
"""
@classmethod
def run(cls, task):
"""
Simple blocking task runner.
Run `task` and its unfinished ancestors.
"""
task.pre_run()
try:
for p... | bsd-3-clause | Python |
aaebae4e7482abc3980a08141219ce2133dd2f69 | remove useless import and clean code | kevindelord/kevindelord.github.io,kevindelord/kevindelord.github.io,kevindelord/kevindelord.github.io,kevindelord/kevindelord.github.io | create_new_post.py | create_new_post.py | #!/usr/bin/python
import argparse
import os
import re
import time
from datetime import datetime
parser = argparse.ArgumentParser(description='Create a new post')
parser.add_argument('-n','--name', help='Name for the markdown file', required=False, default=None)
parser.add_argument('-d','--date', help='Date of the post... | #!/usr/bin/python
import sys
import argparse
import os
import subprocess
import re
import time
from datetime import datetime
parser = argparse.ArgumentParser(description='Create a new post')
parser.add_argument('-n','--name', help='Name for the markdown file', required=False, default=None)
parser.add_argument('-d','--... | mit | Python |
403fdb2dbe1f75955245ddc68b68072f0301897c | allow array input instead of file | braindead/logmmse | logmmse/index.py | logmmse/index.py | from __future__ import division
import numpy as np
from scipy.io.wavfile import read, write
from logmmse import logmmse as _logmmse
from utils import to_float, from_float
np.seterr('raise')
def mono_logmmse(m_input, fs, dtype, initial_noise=6, window_size=0, noise_threshold=0.15):
num_frames = len(m_input)
ch... | from __future__ import division
import numpy as np
from scipy.io.wavfile import read, write
from logmmse import logmmse
from utils import to_float, from_float
np.seterr('raise')
def mono_logmmse(m_input, fs, dtype, initial_noise=6, window_size=0, noise_threshold=0.15):
num_frames = len(m_input)
chunk_size = i... | mit | Python |
d4c32e34993e054645ee068f1577e6918c375843 | add class and method create_category to handle creation of categories | kaguna/Yummy-Recipes,kaguna/Yummy-Recipes,kaguna/Yummy-Recipes | categories.py | categories.py | import re
import random
categories = {}
rangenumbers = range(1,100)
category_id= random.choice(rangenumbers)
class Categories(object):
"""
this class will handle all the functions related to the users
"""
def __init__(self, category_id=None, category_name=None, category_owner=None):
"""constru... | mit | Python | |
18d24504b3ed4fc1fc449585aa1f2a095c194a91 | adjust sync time | transtats/transtats,sundeep-co-in/transtats,transtats/transtats,transtats/transtats,sundeep-co-in/transtats,sundeep-co-in/transtats,transtats/transtats,sundeep-co-in/transtats | dashboard/tasks.py | dashboard/tasks.py | # Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# 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 a... | # Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# 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 a... | apache-2.0 | Python |
e2f52e4eccc92d1ea8a8d741e3388f2023d4d43a | Change context middleware so that whoami request is first in list | microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb | microcosm/middleware/context.py | microcosm/middleware/context.py | import logging
from django.conf import settings
import grequests
import pylibmc as memcache
from microcosm.api.resources import Site
from microcosm.api.resources import WhoAmI
logger = logging.getLogger('microcosm.middleware')
class ContextMiddleware():
"""
Provides request context such as the current site... | import logging
from django.conf import settings
import grequests
import pylibmc as memcache
from microcosm.api.resources import Site
from microcosm.api.resources import WhoAmI
logger = logging.getLogger('microcosm.middleware')
class ContextMiddleware():
"""
Provides request context such as the current site... | agpl-3.0 | Python |
7c9f8af17129f35635bf53091438652520fb0e08 | change regularization!! | daStrauss/subsurface | src/threeWay.py | src/threeWay.py | '''
Created on Nov 7, 2012
@author: dstrauss
'''
import numpy as np
D = {'solverType':'middleMan', 'flavor':'TE', 'numRuns':4, 'expt':'testThree'}
def getMyVars(parseNumber, D):
'''routine to return the parameters to test at the current iteration.'''
if (parseNumber == 0):
D['freqs'] = np.array... | '''
Created on Nov 7, 2012
@author: dstrauss
'''
import numpy as np
D = {'solverType':'middleMan', 'flavor':'TE', 'numRuns':4, 'expt':'testThree'}
def getMyVars(parseNumber, D):
'''routine to return the parameters to test at the current iteration.'''
if (parseNumber == 0):
D['freqs'] = np.array... | apache-2.0 | Python |
e458af44ac4b184d5ae045da9a59587b71fbf7e7 | Remove or change old comments. | phipsgabler/mhs | mhs/mhs.py | mhs/mhs.py | #!/usr/bin/env python3
__doc__ = """Yes, it is slow. But sufficient for small sets.
Usage from python:
> import mhs
> mhs.mhs({9,1}, {2,3,6,9,0})
{frozenset({0, 1}),
frozenset({1, 2}),
frozenset({1, 3}),
frozenset({1, 6}),
frozenset({9})}
Or, as script (interpreting parameter strings as sets of c... | #!/usr/bin/env python3
__doc__ = """Yes, it is slow. But sufficient for small sets.
Usage from python:
> import mhs
> list(mhs.mhs({9,1}, {2,3,6,9,0}))
[frozenset({9}),
frozenset({2, 1}),
frozenset({3, 1}),
frozenset({6, 1}),
frozenset({0, 1})]
Or, as script (interpreting parameter strings as sets... | unlicense | Python |
a69e1690c5271c2c3c81a1aa15415b9ba9dc5ee1 | add ping/pong view to check to see if server is alive. | geodelic/clio,geodelic/clio | clio/store.py | clio/store.py |
from datetime import datetime
import json
import os.path
from bson import json_util
import pymongo
from flask import Flask, request
app = Flask(__name__)
app.config.from_object('clio.settings')
try:
app.config.from_envvar('CLIO_SETTINGS')
except RuntimeError:
if os.path.exists('/etc/clio/app.conf'):
a... |
from datetime import datetime
import json
import os.path
from bson import json_util
import pymongo
from flask import Flask, request
app = Flask(__name__)
app.config.from_object('clio.settings')
try:
app.config.from_envvar('CLIO_SETTINGS')
except RuntimeError:
if os.path.exists('/etc/clio/app.conf'):
a... | apache-2.0 | Python |
e2705e4a0593135f5e8114ee0661685b2c3d4edd | Add DB and RPC method doc strings to hook.py | ramineni/myironic,debayanray/ironic_backup,varunarya10/ironic,pshchelo/ironic,SauloAislan/ironic,JioCloud/ironic,froyobin/ironic,naototty/vagrant-lxc-ironic,rdo-management/ironic,pshchelo/ironic,bacaldwell/ironic,citrix-openstack-build/ironic,openstack/ironic,ionutbalutoiu/ironic,NaohiroTamura/ironic,rackerlabs/ironic,... | ironic/api/hooks.py | ironic/api/hooks.py | # -*- encoding: utf-8 -*-
#
# Copyright © 2012 New Dream Network, LLC (DreamHost)
#
# Author: Doug Hellmann <doug.hellmann@dreamhost.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
#
# ... | # -*- encoding: utf-8 -*-
#
# Copyright © 2012 New Dream Network, LLC (DreamHost)
#
# Author: Doug Hellmann <doug.hellmann@dreamhost.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
#
# ... | apache-2.0 | Python |
564748ea0569b11589c183b2a4cd415fa0f7f793 | Update pymon.py | FinlayDaG33k/raspberry-pi-scripts,FinlayDaG33k/raspberry-pi-scripts | pymon.py | pymon.py | import os
import RPi.GPIO as gpio
import time
import socket
## set variables for the machine to ping and pin for the LED
hostname = ['kandicraft.finlaydag33k.nl:25565','kandicraft.finlaydag33k.nl:80','www.finlaydag33k.nl']
led_pin = 37
## prepare the GPIO
led_status = gpio.LOW
gpio.setmode(gpio.BOARD)
gp... | ## Script By FinlayDaG33k under the MIT License ##
import os
import RPi.GPIO as gpio
import time
import socket
## set variables for the machine to ping and pin for the LED
hostname = "kandicraft.finlaydag33k.nl"
port = 25565
led_pin = 37
## prepare
led_status = gpio.LOW
gpio.setmode(gpio.BOARD)
gpio.se... | mit | Python |
82d53aaf1b2ceb25f62025148b8531071b27eb3e | Remove unused DB setting | carlcarl/lazyhub,carlcarl/lazyhub,carlcarl/lazyhub | lazyhub/settings.py | lazyhub/settings.py | """
Django settings for lazyhub project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | """
Django settings for lazyhub project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | mit | Python |
3b1b91fb56a52fbf3f1e2f1a3ab05a3c809698e6 | Test both ways | mociepka/saleor,laosunhust/saleor,HyperManTT/ECommerceSaleor,jreigel/saleor,mociepka/saleor,laosunhust/saleor,laosunhust/saleor,maferelo/saleor,itbabu/saleor,maferelo/saleor,UITools/saleor,UITools/saleor,KenMutemi/saleor,rodrigozn/CW-Shop,tfroehlich82/saleor,itbabu/saleor,rodrigozn/CW-Shop,tfroehlich82/saleor,laosunhus... | saleor/userprofile/test_userprofile.py | saleor/userprofile/test_userprofile.py | import i18naddress
import pytest
from . import forms
@pytest.mark.parametrize('country', ['CN', 'PL', 'US'])
def test_address_form_for_country(country):
data = {
'first_name': 'John',
'last_name': 'Doe',
'country': country}
form = forms.AddressForm(data)
errors = form.errors
r... | import i18naddress
import pytest
from . import forms
@pytest.mark.parametrize('country', ['CN', 'PL', 'US'])
def test_address_form_for_country(country):
data = {
'first_name': 'John',
'last_name': 'Doe',
'country': country}
form = forms.AddressForm(data)
errors = form.errors
r... | bsd-3-clause | Python |
7ec747464bf1b8a6a18e261b0b6b5b30d2cd63de | Add decode function | amalshehu/exercism-python | simple-cipher/simple_cipher.py | simple-cipher/simple_cipher.py | # File: simple_cipher.py
# Purpose: Implement a simple shift cipher like Caesar and a more secure substitution cipher
# Programmer: Amal Shehu
# Course: Exercism
# Date: Monday 26 September 2016, 02:00 AM
import random
from string import ascii_lowercase
class Cipher():
"""Generate a key f... | # File: simple_cipher.py
# Purpose: Compute the prime factors of a given natural number.
# Programmer: Amal Shehu
# Course: Exercism
# Date: Monday 26 September 2016, 02:00 AM
import random
from string import ascii_lowercase
class Cipher():
"""Generate a key for Cipher if not provided."""... | mit | Python |
4bd9f9f9a8563ff8ea3c5c23a7f905cb20e0e51d | Use the CRAM cache in test_coefficients | ergs/transmutagen,ergs/transmutagen | transmutagen/tests/test_coefficients.py | transmutagen/tests/test_coefficients.py | import pytest
slow = pytest.mark.skipif(
not pytest.config.getoption("--runslow"),
reason="need --runslow option to run"
)
TOTAL_DEGREES = 27
from .crv_coeffs import coeffs as correct_coeffs
from ..cram import get_CRAM_from_cache, CRAM_coeffs
@slow
@pytest.mark.parametrize('degree', range(1, TOTAL_DEGREES+1... | import pytest
slow = pytest.mark.skipif(
not pytest.config.getoption("--runslow"),
reason="need --runslow option to run"
)
TOTAL_DEGREES = 27
from .crv_coeffs import coeffs as correct_coeffs
# TODO: Should we use the CRAM cache here?
from ..cram import CRAM_exp, CRAM_coeffs
@slow
@pytest.mark.parametrize('d... | bsd-3-clause | Python |
4a7a0eda9f2aecd969c1145ba334b6441d5d2ec8 | Correct ignores. | devilry/devilry-django,devilry/devilry-django,devilry/devilry-django,devilry/devilry-django | src/devilry_nodeadmin/devilry_nodeadmin/fabfile.py | src/devilry_nodeadmin/devilry_nodeadmin/fabfile.py | from fabric.api import local, task
@task
def makemessages(langcode):
local(('../../../devenv/bin/django_dev.py makemessages -d djangojs -l {0} '
'-i "static/devilry_nodeadmin/app-all.js" '
'-i "static/devilry_nodeadmin/all-classes.js"'
).format(langcode))
#local(('../../../deven... | from fabric.api import local, task
@task
def makemessages(langcode):
local(('../../../devenv/bin/django_dev.py makemessages -d djangojs -l {0} '
'-i "static/devilry_subjectadmin/app-all.js" '
'-i "static/devilry_subjectadmin/all-classes.js"'
).format(langcode))
#local(('../../..... | bsd-3-clause | Python |
ef4c4f19582b9addfe7a30dda4413f3e4dd3b67a | fix to pep8 | lucasjoao/exercism_python | meetup/meetup.py | meetup/meetup.py | from datetime import date
import sys
sys.path.insert(0, '/home/lucas/Workspace/python/exercism/python/leap')
from leap import is_leap_year
day_as_int = {'Monday': 0,
'Tuesday': 1,
'Wednesday': 2,
'Thursday': 3,
'Friday': 4,
'Saturday': 5,
... | import sys
sys.path.insert(0, '/home/lucas/Workspace/python/exercism/python/leap')
from datetime import date
from leap import is_leap_year
day_as_int = {'Monday': 0,
'Tuesday': 1,
'Wednesday': 2,
'Thursday': 3,
'Friday': 4,
'Saturday': 5,
... | unlicense | Python |
4482e54367fb9ef2cb4b2d68f4093e5297f8f412 | Add statuses to installed apps | matthewlane/mesa,matthewlane/mesa,matthewlane/mesa,matthewlane/mesa | mesa/settings.py | mesa/settings.py | """
Django settings for mesa 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, ...)
impor... | """
Django settings for mesa 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, ...)
impor... | mit | Python |
7a1a90cbaba73da44efeaf385865519cfa078a6c | Fix isolation of SAMP hub script test. | StuartLittlefair/astropy,dhomeier/astropy,saimn/astropy,funbaker/astropy,larrybradley/astropy,MSeifert04/astropy,kelle/astropy,lpsinger/astropy,bsipocz/astropy,aleksandr-bakanov/astropy,DougBurke/astropy,lpsinger/astropy,lpsinger/astropy,astropy/astropy,funbaker/astropy,AustereCuriosity/astropy,StuartLittlefair/astropy... | astropy/vo/samp/tests/test_hub_script.py | astropy/vo/samp/tests/test_hub_script.py | import sys
from ..hub_script import hub_script
from ..utils import ALLOW_INTERNET
def setup_module(module):
ALLOW_INTERNET.set(False)
def setup_function(function):
function.sys_argv_orig = sys.argv
sys.argv = ["samp_hub"]
def teardown_function(function):
sys.argv = function.sys_argv_orig
def t... | import sys
from ..hub_script import hub_script
from ..utils import ALLOW_INTERNET
def setup_module(module):
ALLOW_INTERNET.set(False)
def test_hub_script():
sys.argv.append('-m') # run in multiple mode
sys.argv.append('-w') # disable web profile
hub_script(timeout=3)
| bsd-3-clause | Python |
4101f9be6c8e4bd5213f08bba4461f8cade1e820 | fix the test (#430) | mozilla/relman-auto-nag,mozilla/relman-auto-nag,mozilla/bztools,mozilla/relman-auto-nag | auto_nag/tests/test_email_no_assignee.py | auto_nag/tests/test_email_no_assignee.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import unittest
from auto_nag.scripts.no_assignee import NoAssignee
class TestEmailNoAssignee(unittest.TestCase):
... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import unittest
from auto_nag.scripts.no_assignee import NoAssignee
class TestEmailNoAssignee(unittest.TestCase):
... | bsd-3-clause | Python |
6df04d010382096cfbc5a1c415bb7298b4b1438d | add stub DB information | novastorm/udacity-item-catalog,novastorm/udacity-item-catalog,novastorm/udacity-item-catalog,novastorm/udacity-item-catalog | vagrant/catalog/routes/category.py | vagrant/catalog/routes/category.py | import flask
import httplib2
import json
import requests
import string
from database_setup import Base
from database_setup import Category
from database_setup import Item
from flask import abort
from flask import flash
from flask import jsonify
from flask import make_response
from flask import redirect
from flask imp... | import flask
import httplib2
import json
import requests
import string
from database_setup import Base
from database_setup import Category
from database_setup import Item
from flask import abort
from flask import flash
from flask import jsonify
from flask import make_response
from flask import redirect
from flask imp... | bsd-2-clause | Python |
157626fd73071debf5fced1dd059fa1dad1f0235 | fix syntax error | kaczmarj/neurodocker,kaczmarj/neurodocker | neurodocker/tests/test_utils.py | neurodocker/tests/test_utils.py | """Tests for neurodocker.utils"""
# Author: Jakub Kaczmarzyk <jakubk@mit.edu>
from __future__ import absolute_import
import pytest
from requests.exceptions import RequestException
from neurodocker import utils
def test_manage_pkgs():
assert 'yum' in utils.manage_pkgs.keys(), "yum not found"
assert 'apt' in ... | """Tests for neurodocker.utils"""
# Author: Jakub Kaczmarzyk <jakubk@mit.edu>
from __future__ import absolute_import
import pytest
from requests.exceptions import RequestException
from neurodocker import utils
def test_manage_pkgs():
assert 'yum' in utils.manage_pkgs.keys(), "yum not found"
assert 'apt' in ... | apache-2.0 | Python |
fa2756a3d2d4ad3bb6328cd5d6de84ae6c87eba1 | fix mail tester | countable-web/satchel,countable-web/satchel,countable-web/satchel,countable-web/satchel,countable-web/satchel,countable-web/satchel | bin/mailtest.py | bin/mailtest.py | import sys
def send_email():
import smtplib
gmail_user = sys.argv[1]
gmail_pwd = sys.argv[2]
FROM = "clark@countableclient.local"
TO = ["clark@countable.ca"]
SUBJECT = "hello"
TEXT = "hi"
# Prepare actual message
message = """From: %s\nTo: %s\nSubject: %s\n\n%s
""" % (FROM, ", ... | def send_email():
import smtplib
gmail_user = sys.argv[1]
gmail_pwd = sys.argv[2]
FROM = "clark@countableclient.local"
TO = ["clark@countable.ca"]
SUBJECT = "hello"
TEXT = "hi"
# Prepare actual message
message = """From: %s\nTo: %s\nSubject: %s\n\n%s
""" % (FROM, ", ".join(TO),... | mit | Python |
5c56f6090ec22207e3b6706f72f186c3b1e852c9 | replace tabs with spaces (#105) | torchbox/wagtaildemo,torchbox/wagtaildemo,torchbox/wagtaildemo,torchbox/wagtaildemo | wagtaildemo/settings/production.py | wagtaildemo/settings/production.py | from .base import *
DEBUG = False
WAGTAILSEARCH_BACKENDS = {
'default': {
'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch',
'INDEX': 'wagtaildemo'
}
}
CACHES = {
'default': {
'BACKEND': 'redis_cache.cache.RedisCache',
'LOCATION': '127.0.0.1:6379',
... | from .base import *
DEBUG = False
WAGTAILSEARCH_BACKENDS = {
'default': {
'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch',
'INDEX': 'wagtaildemo'
}
}
CACHES = {
'default': {
'BACKEND': 'redis_cache.cache.RedisCache',
'LOCATION': '127.0.0.1:6379',
... | bsd-3-clause | Python |
c0e8f2d47f50b32e420515ea90be9bb4de70a5e5 | remove redundant code. | jonhadfield/acli,jonhadfield/acli | lib/acli/config.py | lib/acli/config.py | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, print_function, unicode_literals)
try:
import configparser
except ImportError:
from six.moves import configparser
import os
class Config(object):
def __init__(self, cli_args):
self.access_key_id = None
self.secret_access_key ... | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, print_function, unicode_literals)
try:
import configparser
except ImportError:
from six.moves import configparser
import os
class Config(object):
def __init__(self, cli_args):
self.access_key_id = None
self.secret_access_key ... | mit | Python |
5232aeba7bd156c8a438751acc3da900e9b2ca4a | Remove unused skip_unless and skip_test decorators | miguelgrinberg/heat,JioCloud/heat,rh-s/heat,cryptickp/heat,ntt-sic/heat,jasondunsmore/heat,miguelgrinberg/heat,takeshineshiro/heat,openstack/heat,rdo-management/heat,gonzolino/heat,dims/heat,steveb/heat,pshchelo/heat,maestro-hybrid-cloud/heat,cwolferh/heat-scratch,pratikmallya/heat,openstack/heat,rickerc/heat_audit,gon... | heat/tests/utils.py | heat/tests/utils.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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 |
5f47b309006de5abab8349641e86b7248d7c49d8 | Update version to reflect 2.x branch | murphyke/avocado,murphyke/avocado,murphyke/avocado,murphyke/avocado | avocado/__init__.py | avocado/__init__.py | __version_info__ = {
'major': 2,
'minor': 0,
'micro': 0,
'releaselevel': 'beta',
'serial': 1
}
def get_version(short=False):
assert __version_info__['releaselevel'] in ('alpha', 'beta', 'final')
vers = ["%(major)i.%(minor)i" % __version_info__, ]
if __version_info__['micro']:
ve... | __version_info__ = {
'major': 0,
'minor': 9,
'micro': 1,
'releaselevel': 'beta',
'serial': 1
}
def get_version(short=False):
assert __version_info__['releaselevel'] in ('alpha', 'beta', 'final')
vers = ["%(major)i.%(minor)i" % __version_info__, ]
if __version_info__['micro']:
ve... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.