commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
1ed7d695eff134557990d8b1a5dffa51b6d1d2f6
distarray/run_tests.py
distarray/run_tests.py
# encoding: utf-8 # --------------------------------------------------------------------------- # Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc. # Distributed under the terms of the BSD License. See COPYING.rst. # --------------------------------------------------------------------------- """...
# encoding: utf-8 # --------------------------------------------------------------------------- # Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc. # Distributed under the terms of the BSD License. See COPYING.rst. # --------------------------------------------------------------------------- """...
Return returncode from shell command.
Return returncode from shell command.
Python
bsd-3-clause
enthought/distarray,RaoUmer/distarray,RaoUmer/distarray,enthought/distarray
9cbfed00905fb8b360b60cce1afc293b71a2aced
check_access.py
check_access.py
#!/usr/bin/env python import os import sys from parse_docker_args import parse_mount def can_access(path, perm): mode = None if perm == 'r': mode = os.R_OK elif perm == 'w': mode = os.W_OK else: return False return os.access(path, mode) if __name__ == '__main__': if len(sys.argv) < 2: exi...
#!/usr/bin/env python import os import sys from parse_docker_args import parse_mount def can_access(path, perm): mode = None if perm == 'r': mode = os.R_OK elif perm == 'w': mode = os.W_OK else: return False return os.access(path, mode) if __name__ == '__main__': if len(sys.argv) < 2: pri...
Print usage if not enough args
Print usage if not enough args
Python
mit
Duke-GCB/docker-wrapper,Duke-GCB/docker-wrapper
f4dfcf91c11fd06b5b71135f888b6979548a5147
conveyor/__main__.py
conveyor/__main__.py
from __future__ import absolute_import from .core import Conveyor def main(): Conveyor().run() if __name__ == "__main__": main()
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals from .core import Conveyor def main(): Conveyor().run() if __name__ == "__main__": main()
Bring the standard __future__ imports over
Bring the standard __future__ imports over
Python
bsd-2-clause
crateio/carrier
fca88336777b9c47404e7b397d39ef8d3676b7b5
src/zone_iterator/__main__.py
src/zone_iterator/__main__.py
import gzip import sys from . import zone_iterator, zone_dict_to_str, ZONE_FMT_STR try: from colorama import Fore, init as colorama_init except ImportError: HAS_COLOR = False else: HAS_COLOR = True def main(): if HAS_COLOR: colors = [Fore.GREEN, Fore.MAGENTA, Fore.BLUE, Fore.CYAN, Fore.YELLO...
import argparse import gzip import sys from . import zone_iterator, zone_dict_to_str, ZONE_FMT_STR try: from colorama import Fore, init as colorama_init except ImportError: HAS_COLOR = False else: HAS_COLOR = True def maybe_compressed_file(filename): if filename[-2:] == 'gz': our_open = gzip...
Switch to using argparse for the main script.
Switch to using argparse for the main script.
Python
agpl-3.0
maxrp/zone_normalize
c1756ab481f3bf72ab33465c8eb1d5a3e729ce4e
model_logging/migrations/0003_data_migration.py
model_logging/migrations/0003_data_migration.py
# -*- coding: utf-8 -*- from django.db import migrations app = 'model_logging' model = 'LogEntry' def move_data(apps, schema_editor): LogEntry = apps.get_model(app, model) for entry in LogEntry.objects.all(): entry.data_temp = entry.data entry.save() class Migration(migrations.Migration): ...
# -*- coding: utf-8 -*- from django.db import migrations app = 'model_logging' model = 'LogEntry' def move_data(apps, schema_editor): try: from pgcrypto.fields import TextPGPPublicKeyField except ImportError: raise ImportError('Please install django-pgcrypto-fields to perform migration') ...
Add try, catch statement to ensure data migration can be performed.
Add try, catch statement to ensure data migration can be performed.
Python
bsd-2-clause
incuna/django-model-logging
ba57b3c016ed3bc3c8db9ccc3c637c2c58de1e1d
reddit/admin.py
reddit/admin.py
from django.contrib import admin from reddit.models import RedditUser,Submission,Comment,Vote # Register your models here. class SubmissionInline(admin.TabularInline): model = Submission max_num = 10 class CommentsInline(admin.StackedInline): model = Comment max_num = 10 class SubmissionAdmin(admin.M...
from django.contrib import admin from reddit.models import RedditUser,Submission,Comment,Vote # Register your models here. class SubmissionInline(admin.TabularInline): model = Submission max_num = 10 class CommentsInline(admin.StackedInline): model = Comment max_num = 10 class SubmissionAdmin(admin.M...
Remove commentsInLine for RedditUser because there is no longer foreignKey from Comment to RedditUser
Remove commentsInLine for RedditUser because there is no longer foreignKey from Comment to RedditUser
Python
apache-2.0
Nikola-K/django_reddit,Nikola-K/django_reddit,Nikola-K/django_reddit
dd75314f203b907f25a7b7e158c7e5d988a5b6ae
neo/test/rawiotest/test_openephysbinaryrawio.py
neo/test/rawiotest/test_openephysbinaryrawio.py
import unittest from neo.rawio.openephysbinaryrawio import OpenEphysBinaryRawIO from neo.test.rawiotest.common_rawio_test import BaseTestRawIO class TestOpenEphysBinaryRawIO(BaseTestRawIO, unittest.TestCase): rawioclass = OpenEphysBinaryRawIO entities_to_download = [ 'openephysbinary' ] entit...
import unittest from neo.rawio.openephysbinaryrawio import OpenEphysBinaryRawIO from neo.test.rawiotest.common_rawio_test import BaseTestRawIO class TestOpenEphysBinaryRawIO(BaseTestRawIO, unittest.TestCase): rawioclass = OpenEphysBinaryRawIO entities_to_download = [ 'openephysbinary' ] entit...
Add new OE test folder
Add new OE test folder
Python
bsd-3-clause
apdavison/python-neo,JuliaSprenger/python-neo,NeuralEnsemble/python-neo,INM-6/python-neo
7c9d2ace7de2727c43b0ee00f8f2280d8a465301
Python/brewcaskupgrade.py
Python/brewcaskupgrade.py
#! /usr/bin/env python # -*- coding: utf8 -*- import argparse import shutil from subprocess import check_output, run parser = argparse.ArgumentParser(description='Update every entries found in cask folder.') parser.add_argument('--pretend', dest='pretend', action='store_true', help='Pretend to ta...
#! /usr/bin/env python # -*- coding: utf8 -*- import argparse import shutil from subprocess import check_output, run parser = argparse.ArgumentParser(description='Update every entries found in cask folder.') parser.add_argument('--pretend', dest='pretend', action='store_true', help='Pretend to ta...
Check version for latest cask behaviour changed
Check version for latest cask behaviour changed
Python
cc0-1.0
boltomli/MyMacScripts,boltomli/MyMacScripts
9504529dd4b9140be0026d0b30a0e88e5dea5e25
rtrss/config.py
rtrss/config.py
import os import logging import importlib # All configuration defaults are set in this module TRACKER_HOST = 'rutracker.org' # Timeone for the tracker times TZNAME = 'Europe/Moscow' LOGLEVEL = logging.INFO LOG_FORMAT_LOGENTRIES = '%(levelname)s %(name)s %(message)s' LOG_FORMAT_BRIEF = '%(asctime)s %(levelname)s %(...
import os import logging import importlib # All configuration defaults are set in this module TRACKER_HOST = 'rutracker.org' # Timeone for the tracker times TZNAME = 'Europe/Moscow' LOGLEVEL = logging.INFO LOG_FORMAT_LOGENTRIES = '%(levelname)s %(name)s %(message)s' LOG_FORMAT_BRIEF = '%(asctime)s %(levelname)s %(...
Add default IP and PORT
Add default IP and PORT
Python
apache-2.0
notapresent/rtrss,notapresent/rtrss,notapresent/rtrss,notapresent/rtrss
87df9686444c46796475da06c67eeca01c4a46cc
scikits/audiolab/pysndfile/__init__.py
scikits/audiolab/pysndfile/__init__.py
from pysndfile import formatinfo, sndfile from pysndfile import supported_format, supported_endianness, \ supported_encoding from pysndfile import PyaudioException, PyaudioIOError from _sndfile import Sndfile, Format, available_file_formats, available_encodings
from _sndfile import Sndfile, Format, available_file_formats, available_encodings from compat import formatinfo, sndfile, PyaudioException, PyaudioIOError from pysndfile import supported_format, supported_endianness, \ supported_encoding
Use compat module instead of ctypes-based implementation.
Use compat module instead of ctypes-based implementation.
Python
lgpl-2.1
cournape/audiolab,cournape/audiolab,cournape/audiolab
c767ee0b4392c519335a6055f64bbbb5a500e997
api_tests/base/test_pagination.py
api_tests/base/test_pagination.py
# -*- coding: utf-8 -*- from nose.tools import * # flake8: noqa from tests.base import ApiTestCase from api.base.pagination import MaxSizePagination class TestMaxPagination(ApiTestCase): def test_no_query_param_alters_page_size(self): assert_is_none(MaxSizePagination.page_size_query_param)
# -*- coding: utf-8 -*- from nose.tools import * # flake8: noqa from tests.base import ApiTestCase from api.base.pagination import MaxSizePagination class TestMaxPagination(ApiTestCase): def test_no_query_param_alters_page_size(self): assert MaxSizePagination.page_size_query_param is None, 'Adding varia...
Add error message for future breakers-of-tests
Add error message for future breakers-of-tests
Python
apache-2.0
HalcyonChimera/osf.io,DanielSBrown/osf.io,HalcyonChimera/osf.io,TomBaxter/osf.io,crcresearch/osf.io,crcresearch/osf.io,alexschiller/osf.io,hmoco/osf.io,rdhyee/osf.io,caneruguz/osf.io,SSJohns/osf.io,laurenrevere/osf.io,icereval/osf.io,sloria/osf.io,emetsger/osf.io,felliott/osf.io,HalcyonChimera/osf.io,mattclark/osf.io,l...
d531ea281b546d31724c021011a7145d3095dbf8
SoftLayer/tests/CLI/modules/import_test.py
SoftLayer/tests/CLI/modules/import_test.py
""" SoftLayer.tests.CLI.modules.import_test ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :license: MIT, see LICENSE for more details. """ from SoftLayer.tests import unittest from SoftLayer.CLI.modules import get_module_list from importlib import import_module class TestImportCLIModules(unittest.TestCase): ...
""" SoftLayer.tests.CLI.modules.import_test ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :license: MIT, see LICENSE for more details. """ from SoftLayer.tests import unittest from SoftLayer.CLI.modules import get_module_list from importlib import import_module class TestImportCLIModules(unittest.TestCase): ...
Print modules being imported (for easier debugging)
Print modules being imported (for easier debugging)
Python
mit
allmightyspiff/softlayer-python,underscorephil/softlayer-python,cloudify-cosmo/softlayer-python,iftekeriba/softlayer-python,skraghu/softlayer-python,kyubifire/softlayer-python,nanjj/softlayer-python,Neetuj/softlayer-python,softlayer/softlayer-python,briancline/softlayer-python
39a743463f55c3cfbbea05b4d471d01f66dd93f8
permamodel/tests/test_perma_base.py
permamodel/tests/test_perma_base.py
""" test_perma_base.py tests of the perma_base component of permamodel """ from permamodel.components import frost_number import os import numpy as np from .. import permamodel_directory, data_directory, examples_directory def test_directory_names_are_set(): assert(permamodel_directory is not None)
""" test_perma_base.py tests of the perma_base component of permamodel """ import os from nose.tools import assert_true from .. import (permamodel_directory, data_directory, examples_directory, tests_directory) def test_permamodel_directory_is_set(): assert(permamodel_directory is not None) d...
Add unit tests for all package directories
Add unit tests for all package directories
Python
mit
permamodel/permamodel,permamodel/permamodel
82217bab5263984c3507a68c1b94f9d315bafc63
src/masterfile/__init__.py
src/masterfile/__init__.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from ._metadata import version as __version__, author as __author__, email as __email__
# -*- coding: utf-8 -*- from __future__ import absolute_import from ._metadata import version as __version__, author as __author__, email as __email__ __package_version__ = 'masterfile {}'.format(__version__)
Add __package_version__ for version description
Add __package_version__ for version description Example: "masterfile 0.1.0dev"
Python
mit
njvack/masterfile
8525465c4f428cc0df02df7eb4fca165a9af6bdc
knowledge_repo/utils/registry.py
knowledge_repo/utils/registry.py
from abc import ABCMeta import logging logger = logging.getLogger(__name__) class SubclassRegisteringABCMeta(ABCMeta): def __init__(cls, name, bases, dct): super(SubclassRegisteringABCMeta, cls).__init__(name, bases, dct) if not hasattr(cls, '_registry'): cls._registry = {} ...
from abc import ABCMeta import logging logger = logging.getLogger(__name__) class SubclassRegisteringABCMeta(ABCMeta): def __init__(cls, name, bases, dct): super(SubclassRegisteringABCMeta, cls).__init__(name, bases, dct) if not hasattr(cls, '_registry'): cls._registry = {} ...
Update a string with the latest formatting approach
Update a string with the latest formatting approach
Python
apache-2.0
airbnb/knowledge-repo,airbnb/knowledge-repo,airbnb/knowledge-repo,airbnb/knowledge-repo,airbnb/knowledge-repo
b3b216a95c4254302776fdbb67bab948ba12d3d3
ddsc_worker/tasks.py
ddsc_worker/tasks.py
from __future__ import absolute_import from ddsc_worker.celery import celery @celery.task def add(x, y): return x + y @celery.task def mul(x, y): return x + y
from __future__ import absolute_import from ddsc_worker.celery import celery import time @celery.task def add(x, y): time.sleep(10) return x + y @celery.task def mul(x, y): time.sleep(2) return x * y
Add sleep to simulate work
Add sleep to simulate work
Python
mit
ddsc/ddsc-worker
2dc56ab04ea17bea05654eaec12bb27b48b0b225
robotd/cvcapture.py
robotd/cvcapture.py
import threading from robotd.native import _cvcapture class CaptureDevice(object): def __init__(self, path=None): if path is not None: argument_c = _cvcapture.ffi.new( 'char[]', path.encode('utf-8'), ) else: argument_c = _cvcaptur...
import threading from robotd.native import _cvcapture class CaptureDevice(object): def __init__(self, path=None): if path is not None: argument_c = _cvcapture.ffi.new( 'char[]', path.encode('utf-8'), ) else: argument_c = _cvcaptur...
Raise a `RuntimeError` if the device cannot be opened
Raise a `RuntimeError` if the device cannot be opened
Python
mit
sourcebots/robotd,sourcebots/robotd
5b88a7068a6b245d99ef5998bbf659480fb85199
cbc/environment.py
cbc/environment.py
import os from .exceptions import IncompleteEnv from tempfile import TemporaryDirectory import time class Environment(object): def __init__(self, *args, **kwargs): self.environ = os.environ.copy() self.config = {} self.cbchome = None if 'CBC_HOME' in kwargs: ...
import os from .exceptions import IncompleteEnv from tempfile import TemporaryDirectory import time class Environment(object): def __init__(self, *args, **kwargs): self.environ = os.environ.copy() self.config = {} self.cbchome = None if 'CBC_HOME' in kwargs: ...
Remove temp directory creation... not worth it
Remove temp directory creation... not worth it
Python
bsd-3-clause
jhunkeler/cbc,jhunkeler/cbc,jhunkeler/cbc
c05ec7f6a869712ec49c2366016b325cf18f7433
tests/test_no_broken_links.py
tests/test_no_broken_links.py
# -*- encoding: utf-8 """ This test checks that all the internal links in the site (links that point to other pages on the site) are pointing at working pages. """ from http_crawler import crawl def test_no_links_are_broken(): responses = [] for rsp in crawl('http://0.0.0.0:5757/', follow_external_links=Fals...
# -*- encoding: utf-8 """ This test checks that all the internal links in the site (links that point to other pages on the site) are pointing at working pages. """ from http_crawler import crawl def test_no_links_are_broken(baseurl): responses = [] for rsp in crawl(baseurl, follow_external_links=False): ...
Use the pytest fixture for the URL
Use the pytest fixture for the URL
Python
mit
alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net
8f188022d3e1ede210cfac2177dd924c9afe8f23
tests/runalldoctests.py
tests/runalldoctests.py
import doctest import glob import pkg_resources try: pkg_resources.require('OWSLib') except (ImportError, pkg_resources.DistributionNotFound): pass testfiles = glob.glob('*.txt') for file in testfiles: doctest.testfile(file)
import doctest import getopt import glob import sys import pkg_resources try: pkg_resources.require('OWSLib') except (ImportError, pkg_resources.DistributionNotFound): pass def run(pattern): if pattern is None: testfiles = glob.glob('*.txt') else: testfiles = glob.glob(pattern) fo...
Add option to pick single test file from the runner
Add option to pick single test file from the runner git-svn-id: 150a648d6f30c8fc6b9d405c0558dface314bbdd@620 b426a367-1105-0410-b9ff-cdf4ab011145
Python
bsd-3-clause
kwilcox/OWSLib,bird-house/OWSLib,ocefpaf/OWSLib,b-cube/OWSLib,geographika/OWSLib,jaygoldfinch/OWSLib,tomkralidis/OWSLib,datagovuk/OWSLib,mbertrand/OWSLib,gfusca/OWSLib,KeyproOy/OWSLib,daf/OWSLib,dblodgett-usgs/OWSLib,geopython/OWSLib,jaygoldfinch/OWSLib,daf/OWSLib,kalxas/OWSLib,Jenselme/OWSLib,jachym/OWSLib,QuLogic/OWS...
7b5896700a6c7408d0b25bb4dde4942eaa9032bb
solum/tests/base.py
solum/tests/base.py
# -*- coding: utf-8 -*- # # Copyright 2013 - Noorul Islam K M # # 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 applic...
# -*- coding: utf-8 -*- # # Copyright 2013 - Noorul Islam K M # # 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 applic...
Support testscenarios by default in BaseTestCase
Support testscenarios by default in BaseTestCase This allows one to use the scenario framework easily from any test class. Change-Id: Ie736138fe2d1e1d38f225547dde54df3f4b21032
Python
apache-2.0
devdattakulkarni/test-solum,gilbertpilz/solum,gilbertpilz/solum,stackforge/solum,openstack/solum,ed-/solum,ed-/solum,gilbertpilz/solum,openstack/solum,stackforge/solum,ed-/solum,ed-/solum,devdattakulkarni/test-solum,gilbertpilz/solum
8c10646768818a56ee89ff857318463da838f813
connect_ffi.py
connect_ffi.py
from cffi import FFI ffi = FFI() #Header generated with cpp spotify.h > spotify.processed.h && sed -i 's/__extension__//g' spotify.processed.h with open("spotify.processed.h") as file: header = file.read() ffi.cdef(header) ffi.cdef(""" void *malloc(size_t size); void exit(int status); """) C = ffi.dlopen(None) l...
import os from cffi import FFI ffi = FFI() library_name = "spotify.processed.h" library_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), libraryName) #Header generated with cpp spotify.h > spotify.processed.h && sed -i 's/__extension__//g' spotify.processed.h with open(library_path) as file: heade...
Add complete path of spotify.processed.h
Add complete path of spotify.processed.h Add complete path of spotify.processed.h so it points to the same directory where is the file
Python
apache-2.0
chukysoria/spotify-connect-web,chukysoria/spotify-connect-web,chukysoria/spotify-connect-web,chukysoria/spotify-connect-web
ede7158c611bf618ee03989d33c5fe6a091b7d66
tests/testapp/models.py
tests/testapp/models.py
from __future__ import absolute_import import sys from django.conf import settings from django.db import models from django.utils.encoding import python_2_unicode_compatible import rules @python_2_unicode_compatible class Book(models.Model): isbn = models.CharField(max_length=50, unique=True) title = model...
from __future__ import absolute_import import sys from django.conf import settings from django.db import models try: from django.utils.encoding import python_2_unicode_compatible except ImportError: def python_2_unicode_compatible(c): return c import rules @python_2_unicode_compatible class Book(m...
Add shim for python_2_unicode_compatible in tests
Add shim for python_2_unicode_compatible in tests
Python
mit
dfunckt/django-rules,dfunckt/django-rules,ticosax/django-rules,ticosax/django-rules,dfunckt/django-rules,ticosax/django-rules
0f546ce883bffa52d81ebfdc6eba005d6f2eca22
build.py
build.py
#!/usr/bin/env python import os import subprocess import sys def build(pkgpath): os.chdir(pkgpath) targets = [ 'build', 'package', 'install', 'clean', 'clean-depends', ] for target in targets: p = subprocess.Popen( ['bmake', target], ...
#!/usr/bin/env python import os import subprocess import sys def build(pkgpath): os.chdir(pkgpath) targets = [ 'build', 'package', 'install', 'clean', 'clean-depends', ] for target in targets: p = subprocess.Popen( ['bmake', target], ...
Use more explicit variable names.
Use more explicit variable names.
Python
isc
eliteraspberries/minipkg,eliteraspberries/minipkg
fa85cbfe499599e8a0d667f25acae7fedcc13fb2
invocations/testing.py
invocations/testing.py
from invoke import ctask as task @task(help={ 'module': "Just runs tests/STRING.py.", 'runner': "Use STRING to run tests instead of 'spec'." }) def test(ctx, module=None, runner='spec'): """ Run a Spec or Nose-powered internal test suite. """ # Allow selecting specific submodule specific_m...
from invoke import ctask as task @task(help={ 'module': "Just runs tests/STRING.py.", 'runner': "Use STRING to run tests instead of 'spec'.", 'opts': "Extra flags for the test runner", }) def test(ctx, module=None, runner='spec', opts=None): """ Run a Spec or Nose-powered internal test suite. ...
Add flag passthrough for 'test'
Add flag passthrough for 'test'
Python
bsd-2-clause
singingwolfboy/invocations,pyinvoke/invocations,mrjmad/invocations,alex/invocations
7f711f7da0003cf6f0335f33fb358e91d4e91cf7
simpleadmindoc/management/commands/docgenapp.py
simpleadmindoc/management/commands/docgenapp.py
from django.core.management.base import AppCommand class Command(AppCommand): help = "Generate sphinx documentation skeleton for given apps." def handle_app(self, app, **options): # check if simpleadmindoc directory is setup from django.db import models from simpleadmindoc.generat...
from optparse import make_option from django.core.management.base import AppCommand class Command(AppCommand): help = "Generate sphinx documentation skeleton for given apps." option_list = AppCommand.option_list + ( make_option('--locale', '-l', default=None, dest='locale', help='...
Add option to set locale for created documentation
Add option to set locale for created documentation
Python
bsd-3-clause
bmihelac/django-simpleadmindoc,bmihelac/django-simpleadmindoc
e858be9072b175545e17631ccd838f9f7d8a7e21
tensorflow_datasets/dataset_collections/longt5/longt5.py
tensorflow_datasets/dataset_collections/longt5/longt5.py
# coding=utf-8 # Copyright 2022 The TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
# coding=utf-8 # Copyright 2022 The TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
Add homepage to LongT5 dataset collection
Add homepage to LongT5 dataset collection PiperOrigin-RevId: 479013251
Python
apache-2.0
tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets
af10508437be2001e9e12a369c4e8a973fd50ee8
astral/api/handlers/node.py
astral/api/handlers/node.py
from astral.api.handlers.base import BaseHandler from astral.models.node import Node from astral.api.client import NodesAPI import sys import logging log = logging.getLogger(__name__) class NodeHandler(BaseHandler): def delete(self, node_uuid=None): """Remove the requesting node from the list of known n...
from astral.api.handlers.base import BaseHandler from astral.models.node import Node from astral.api.client import NodesAPI import logging log = logging.getLogger(__name__) class NodeHandler(BaseHandler): def delete(self, node_uuid=None): """Remove the requesting node from the list of known nodes, ...
Clean up Node delete handler.
Clean up Node delete handler.
Python
mit
peplin/astral
75536b58ab934b3870236f2124dfb505e0a9299f
dvox/models/types.py
dvox/models/types.py
from bloop import String class Position(String): """ stores [2, 3, 4] as '2:3:4' """ def dynamo_load(self, value): values = value.split(":") return list(map(int, values)) def dynamo_dump(self, value): return ":".join(map(str, value))
from bloop import String class Position(String): """ stores [2, 3, 4] as '2:3:4' """ def dynamo_load(self, value): values = value.split(":") return list(map(int, values)) def dynamo_dump(self, value): return ":".join(map(str, value)) class StringEnum(String): """Store an enu...
Add type for storing enums
Add type for storing enums
Python
mit
numberoverzero/dvox
46259730666b967675336e7bda5014b17419614d
test/parse_dive.py
test/parse_dive.py
#! /usr/bin/python import argparse from xml.dom import minidom parser = argparse.ArgumentParser(description='Parse a dive in xml formt.') parser.add_argument('-f', '--file', required=True, dest='path', help='path to xml file') args = parser.parse_args() path = args.path doc = minidom.parse(path) nodes = doc.get...
#! /usr/bin/python import argparse from xml.dom import minidom O2=21 H2=0 parser = argparse.ArgumentParser(description='Parse a dive in xml formt.') parser.add_argument('-f', '--file', required=True, dest='path', help='path to xml file') args = parser.parse_args() path = args.path doc = minidom.parse(path) ga...
Change the xml parser to output gas mixture content
Change the xml parser to output gas mixture content
Python
isc
AquaBSD/libbuhlmann,AquaBSD/libbuhlmann,AquaBSD/libbuhlmann
091b543fd8668d6f53bf126492aaaf47251d0672
src/ggrc_basic_permissions/roles/ProgramEditor.py
src/ggrc_basic_permissions/roles/ProgramEditor.py
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> scope = "Private Program" description = """ A user with authorization to edit mapping objects related to an access controlled program.<br/><br/>When a person has this role they can map and unmap object...
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> scope = "Private Program" description = """ A user with authorization to edit mapping objects related to an access controlled program.<br/><br/>When a person has this role they can map and unmap object...
Add support for program editor to create and update snapshots
Add support for program editor to create and update snapshots
Python
apache-2.0
selahssea/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,selahssea/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core
6876b6584cd90cca60fc21a53967dc1dfee6f2b4
testing/models/test_epic.py
testing/models/test_epic.py
import pytest from k2catalogue import models @pytest.fixture def epic(): return models.EPIC(epic_id=12345, ra=12.345, dec=67.894, mag=None, campaign_id=1) def test_repr(epic): assert repr(epic) == '<EPIC: 12345>'
import pytest try: from unittest import mock except ImportError: import mock from k2catalogue import models @pytest.fixture def epic(): return models.EPIC(epic_id=12345, ra=12.345, dec=67.894, mag=None, campaign_id=1) def test_repr(epic): assert repr(epic) == '<EPIC: 12345>' ...
Add test for simbad query
Add test for simbad query
Python
mit
mindriot101/k2catalogue
94eecbd714e82ce179ca9985f9dd89dc72995070
seleniumbase/fixtures/page_utils.py
seleniumbase/fixtures/page_utils.py
""" This module contains useful utility methods. """ def jq_format(code): """ Use before throwing raw code such as 'div[tab="advanced"]' into jQuery. Selectors with quotes inside of quotes would otherwise break jQuery. This is similar to "json.dumps(value)", but with one less layer of quotes. """ ...
""" This module contains useful utility methods. """ def jq_format(code): """ Use before throwing raw code such as 'div[tab="advanced"]' into jQuery. Selectors with quotes inside of quotes would otherwise break jQuery. This is similar to "json.dumps(value)", but with one less layer of quotes. """ ...
Add a method to extract the domain url from a full url
Add a method to extract the domain url from a full url
Python
mit
ktp420/SeleniumBase,mdmintz/SeleniumBase,possoumous/Watchers,seleniumbase/SeleniumBase,mdmintz/seleniumspot,possoumous/Watchers,mdmintz/SeleniumBase,possoumous/Watchers,ktp420/SeleniumBase,ktp420/SeleniumBase,mdmintz/SeleniumBase,ktp420/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/Selen...
3492ae03c9cfc8322ba60522779c7c0eeb642dd3
server/models/event_subscription.py
server/models/event_subscription.py
"""This module contains the SQLAlchemy EventSubscription class definition.""" from server.models.db import db class EventSubscription(db.Model): """SQLAlchemy EventSubscription class definition.""" __tablename__ = 'event_subscriptions' user_id = db.Column( 'user_id', db.Integer, db.ForeignKey('u...
"""This module contains the SQLAlchemy EventSubscription class definition.""" from server.models.db import db class EventSubscription(db.Model): """SQLAlchemy EventSubscription class definition.""" __tablename__ = 'event_subscriptions' user_id = db.Column( 'user_id', db.Integer, db.ForeignKey('u...
Fix issue with deleting event subscriptions
Fix issue with deleting event subscriptions
Python
mit
bnotified/api,bnotified/api
a1d8a81bbd25404b1109688bded9bea923ba6771
formly/tests/urls.py
formly/tests/urls.py
from django.conf.urls import include, url urlpatterns = [ url(r"^", include("formly.urls", namespace="formly")), ]
from django.conf.urls import include, url from django.views.generic import TemplateView urlpatterns = [ url(r"^home/", TemplateView.as_view(template_name="no-ie.html"), name="home"), url(r"^", include("formly.urls", namespace="formly")), ]
Add "home" url for testing
Add "home" url for testing
Python
bsd-3-clause
eldarion/formly,eldarion/formly
765864250faba841a2ee8f2fa669f57a25661737
testapp/testapp/urls.py
testapp/testapp/urls.py
"""testapp URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-bas...
"""testapp URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-bas...
Add PDFDisplay view to the test app
Add PDFDisplay view to the test app
Python
isc
hobarrera/django-afip,hobarrera/django-afip
e3d3893bf4cb8aa782efb05771339a0d59451fe9
xbrowse_server/base/management/commands/list_projects.py
xbrowse_server/base/management/commands/list_projects.py
from django.core.management.base import BaseCommand from xbrowse_server.base.models import Project class Command(BaseCommand): """Command to generate a ped file for a given project""" def handle(self, *args, **options): projects = Project.objects.all() for project in projects: ind...
from django.core.management.base import BaseCommand from xbrowse_server.base.models import Project class Command(BaseCommand): """Command to print out basic stats on some or all projects. Optionally takes a list of project_ids. """ def handle(self, *args, **options): if args: projects = [...
Print additional stats for each projects
Print additional stats for each projects
Python
agpl-3.0
ssadedin/seqr,macarthur-lab/seqr,macarthur-lab/seqr,ssadedin/seqr,ssadedin/seqr,macarthur-lab/seqr,macarthur-lab/xbrowse,macarthur-lab/xbrowse,macarthur-lab/xbrowse,ssadedin/seqr,ssadedin/seqr,macarthur-lab/seqr,macarthur-lab/xbrowse,macarthur-lab/seqr,macarthur-lab/xbrowse,macarthur-lab/xbrowse
d5820bef80ea4bdb871380dbfe41db12290fc5f8
functest/opnfv_tests/features/odl_sfc.py
functest/opnfv_tests/features/odl_sfc.py
#!/usr/bin/python # # Copyright (c) 2016 All rights reserved # This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # # http://www.apache.org/licenses/LICENSE-2.0 # import functest.core.feature_base...
#!/usr/bin/python # # Copyright (c) 2016 All rights reserved # This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # # http://www.apache.org/licenses/LICENSE-2.0 # import functest.core.feature_base...
Make SFC test a python call to main()
Make SFC test a python call to main() Instead of python -> bash -> python, call the SFC test using the execute() method that is inherited from FeatureBase and it's a bash call by default. With this change, we call the SFC test using main() of run_tests.py of SFC repo and will have real time output. Change-Id: I6d5982...
Python
apache-2.0
mywulin/functest,opnfv/functest,mywulin/functest,opnfv/functest
6fa0db63d12f11f0d11a77c2d0799cd506196b5b
chatterbot/utils/clean.py
chatterbot/utils/clean.py
import re def clean_whitespace(text): """ Remove any extra whitespace and line breaks as needed. """ # Replace linebreaks with spaces text = text.replace("\n", " ").replace("\r", " ").replace("\t", " ") # Remove any leeding or trailing whitespace text = text.strip() # Remove consecut...
import re def clean_whitespace(text): """ Remove any extra whitespace and line breaks as needed. """ # Replace linebreaks with spaces text = text.replace("\n", " ").replace("\r", " ").replace("\t", " ") # Remove any leeding or trailing whitespace text = text.strip() # Remove consecut...
Update python3 html parser depricated method.
Update python3 html parser depricated method.
Python
bsd-3-clause
Reinaesaya/OUIRL-ChatBot,gunthercox/ChatterBot,Gustavo6046/ChatterBot,Reinaesaya/OUIRL-ChatBot,maclogan/VirtualPenPal,davizucon/ChatterBot,vkosuri/ChatterBot
a36e63037ce279d07a04074baf8c9f756dd8128a
wmtexe/cmi/make.py
wmtexe/cmi/make.py
import argparse import yaml from .bocca import make_project, ProjectExistsError def main(): parser = argparse.ArgumentParser() parser.add_argument('file', help='Project description file') args = parser.parse_args() try: with open(args.file, 'r') as fp: make_project(yaml.load(fp...
import argparse import yaml from .bocca import make_project, ProjectExistsError def main(): parser = argparse.ArgumentParser() parser.add_argument('file', type=argparse.FileType('r'), help='Project description file') args = parser.parse_args() try: make_project(yaml...
Read input file from stdin.
Read input file from stdin.
Python
mit
csdms/wmt-exe,csdms/wmt-exe,csdms/wmt-exe,csdms/wmt-exe
24a6519b7d6a9e961adff1b23a3d64231fc9d233
frappe/integrations/doctype/social_login_key/test_social_login_key.py
frappe/integrations/doctype/social_login_key/test_social_login_key.py
# -*- coding: utf-8 -*- # Copyright (c) 2017, Frappe Technologies and Contributors # See license.txt from __future__ import unicode_literals import frappe from frappe.integrations.doctype.social_login_key.social_login_key import BaseUrlNotSetError import unittest class TestSocialLoginKey(unittest.TestCase): def test...
# -*- coding: utf-8 -*- # Copyright (c) 2017, Frappe Technologies and Contributors # See license.txt from __future__ import unicode_literals import frappe from frappe.integrations.doctype.social_login_key.social_login_key import BaseUrlNotSetError import unittest class TestSocialLoginKey(unittest.TestCase): def test...
Add missing method required for test
test: Add missing method required for test - backported create_or_update_social_login_key from v13
Python
mit
vjFaLk/frappe,vjFaLk/frappe,vjFaLk/frappe,vjFaLk/frappe
2363cf9733006f08f2dc1061562bc29788206f21
fabfile.py
fabfile.py
from fabric.api import cd, env, run, task try: import fabfile_local _pyflakes = fabfile_local except ImportError: pass @task def update(): with cd("~/vagrant-installers"): run("git pull") @task def all(): "Run the task against all hosts." for _, value in env.roledefs.iteritems(): ...
from fabric.api import cd, env, run, task try: import fabfile_local _pyflakes = fabfile_local except ImportError: pass @task def update(): "Updates the installer generate code on the host." with cd("~/vagrant-installers"): run("git pull") @task def build(): "Builds the installer." ...
Add fab task to build
Add fab task to build
Python
mit
redhat-developer-tooling/vagrant-installers,mitchellh/vagrant-installers,chrisroberts/vagrant-installers,redhat-developer-tooling/vagrant-installers,chrisroberts/vagrant-installers,chrisroberts/vagrant-installers,mitchellh/vagrant-installers,redhat-developer-tooling/vagrant-installers,chrisroberts/vagrant-installers,ch...
6c74b18372d3945f909ad63f6f58e11e7658282a
openacademy/model/openacademy_session.py
openacademy/model/openacademy_session.py
# -*- coding: utf-8 -*- from openerp import fields, models class Session(models.Model): _name = 'openacademy.session' name = fields.Char(required=True) start_date = fields.Date() duration = fields.Float(digits=(6, 2), help="Duration in days") seats = fields.Integer(string="Number of seats") instruct...
# -*- coding: utf-8 -*- from openerp import fields, models class Session(models.Model): _name = 'openacademy.session' name = fields.Char(required=True) start_date = fields.Date() duration = fields.Float(digits=(6, 2), help="Duration in days") seats = fields.Integer(string="Number of seats") instruct...
Add domain or and ilike
[REF] openacademy: Add domain or and ilike
Python
apache-2.0
deivislaya/openacademy-project
ddbce972db10ce92a79982161355ed978fb0c554
web/extras/contentment/components/event/model.py
web/extras/contentment/components/event/model.py
# encoding: utf-8 """Event model.""" import mongoengine as db from web.extras.contentment.components.page.model import Page from widgets import fields log = __import__('logging').getLogger(__name__) __all__ = ['EventContact', 'Event'] class EventContact(db.EmbeddedDocument): name = db.StringField(max_length...
# encoding: utf-8 """Event model.""" import mongoengine as db from web.extras.contentment.components.page.model import Page from widgets import fields log = __import__('logging').getLogger(__name__) __all__ = ['EventContact', 'Event'] class EventContact(db.EmbeddedDocument): name = db.StringField(max_length...
Fix for inability to define contact information.
Fix for inability to define contact information.
Python
mit
marrow/contentment,marrow/contentment
0ea9fedf3eac7d8b6a7a85bd0b08fb30f35e4f4d
tests/test_analysis.py
tests/test_analysis.py
from sharepa.analysis import merge_dataframes import pandas as pd def test_merge_dataframes(): dream = pd.DataFrame({'Rhodes': 'Dusty'}, index=['Rhodes']) stardust = pd.DataFrame({'Rhodes': 'Cody'}, index=['Rhodes']) family = merge_dataframes(dream, stardust) assert isinstance(family, pd.core.frame...
from sharepa.analysis import merge_dataframes import pandas as pd def test_merge_dataframes(): dream = pd.DataFrame({'Rhodes': 'Dusty'}, index=['Rhodes']) stardust = pd.DataFrame({'Rhodes': 'Cody'}, index=['Rhodes']) family = merge_dataframes(dream, stardust) assert isinstance(family, pd.core.frame...
Check index on merge datadrame test
Check index on merge datadrame test
Python
mit
CenterForOpenScience/sharepa,samanehsan/sharepa,erinspace/sharepa,fabianvf/sharepa
1d0da246b5340b4822d2c47c79519edd7b9ed7e4
turbo_hipster/task_plugins/shell_script/task.py
turbo_hipster/task_plugins/shell_script/task.py
# Copyright 2013 Rackspace Australia # # 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 writi...
# Copyright 2013 Rackspace Australia # # 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 writi...
Fix docstring on shell_script plugin
Fix docstring on shell_script plugin Change-Id: I6e92a00c72d5ee054186f93cf344df98930cdd13
Python
apache-2.0
stackforge/turbo-hipster,matthewoliver/turbo-hipster,matthewoliver/turbo-hipster,stackforge/turbo-hipster
62f842d91b5819e24b0be71743953d7607cf99c1
test_algebra_initialisation.py
test_algebra_initialisation.py
from __future__ import absolute_import, division from __future__ import print_function, unicode_literals from past.builtins import range from clifford import Cl, randomMV, Frame, get_mult_function, conformalize, grade_obj from clifford.tools import orthoFrames2Verser as of2v import numpy as np from numpy import exp, ...
from __future__ import absolute_import, division from __future__ import print_function, unicode_literals from past.builtins import range from clifford import Cl, randomMV, Frame, get_mult_function, conformalize, grade_obj from clifford.tools import orthoFrames2Verser as of2v import numpy as np from numpy import exp, ...
Move start-time calculation so it measures each initialization
Move start-time calculation so it measures each initialization
Python
bsd-3-clause
arsenovic/clifford,arsenovic/clifford
1db07b9a534e533200f83de4f86d854d0bcda087
examples/exotica_examples/tests/runtest.py
examples/exotica_examples/tests/runtest.py
#!/usr/bin/env python # This is a workaround for liburdf.so throwing an exception and killing # the process on exit in ROS Indigo. import subprocess import os import sys cpptests = ['test_initializers', 'test_maps' ] pytests = ['core.py', 'valkyrie_com.py', 'valkyrie_collision_chec...
#!/usr/bin/env python # This is a workaround for liburdf.so throwing an exception and killing # the process on exit in ROS Indigo. import subprocess import os import sys cpptests = ['test_initializers', 'test_maps' ] pytests = ['core.py', 'valkyrie_com.py', 'valkyrie_collision_chec...
Add collision_scene_distances to set of tests to run
Add collision_scene_distances to set of tests to run
Python
bsd-3-clause
openhumanoids/exotica,openhumanoids/exotica,openhumanoids/exotica,openhumanoids/exotica
66db08483faa1ca2b32a7349dafa94acb89b059c
locations/pipelines.py
locations/pipelines.py
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy.exceptions import DropItem class DuplicatesPipeline(object): def __init__(self): self.ids_seen = set(...
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy.exceptions import DropItem class DuplicatesPipeline(object): def __init__(self): self.ids_seen = set(...
Add pipeline step that adds spider name to properties
Add pipeline step that adds spider name to properties
Python
mit
iandees/all-the-places,iandees/all-the-places,iandees/all-the-places
74506160831ec44f29b82ca02ff131b00ce91847
masters/master.chromiumos.tryserver/master_site_config.py
masters/master.chromiumos.tryserver/master_site_config.py
# Copyright 2014 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. """ActiveMaster definition.""" from config_bootstrap import Master class ChromiumOSTryServer(Master.ChromiumOSBase): project_name = 'ChromiumOS Try Serve...
# Copyright 2014 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. """ActiveMaster definition.""" from config_bootstrap import Master class ChromiumOSTryServer(Master.ChromiumOSBase): project_name = 'ChromiumOS Try Serve...
Use UberProxy URL for 'tryserver.chromiumos'
Use UberProxy URL for 'tryserver.chromiumos' BUG=352897 TEST=None Review URL: https://codereview.chromium.org/554383002 git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@291886 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
eunchong/build,eunchong/build,eunchong/build,eunchong/build
7c9ed9fbdc1b16ae1d59c1099e7190e6297bf584
util/chplenv/chpl_tasks.py
util/chplenv/chpl_tasks.py
#!/usr/bin/env python import sys, os import chpl_arch, chpl_platform, chpl_compiler from utils import memoize import utils @memoize def get(): tasks_val = os.environ.get('CHPL_TASKS') if not tasks_val: arch_val = chpl_arch.get('target', get_lcd=True) platform_val = chpl_platform.get() ...
#!/usr/bin/env python import sys, os import chpl_arch, chpl_platform, chpl_compiler, chpl_comm from utils import memoize import utils @memoize def get(): tasks_val = os.environ.get('CHPL_TASKS') if not tasks_val: arch_val = chpl_arch.get('target', get_lcd=True) platform_val = chpl_platform.get...
Update chpl_task to only default to muxed when ugni comm is used.
Update chpl_task to only default to muxed when ugni comm is used. This expands upon (and fixes) #1640 and #1635. * [ ] Run printchplenv on mac and confirm it still works. * [ ] Emulate cray-x* with module and confirm comm, tasks are ugni, muxed. ```bash ( export CHPL_MODULE_HOME=$CHPL_HOME export CHPL_HOST_PLATF...
Python
apache-2.0
CoryMcCartan/chapel,chizarlicious/chapel,chizarlicious/chapel,hildeth/chapel,CoryMcCartan/chapel,chizarlicious/chapel,CoryMcCartan/chapel,chizarlicious/chapel,chizarlicious/chapel,CoryMcCartan/chapel,hildeth/chapel,CoryMcCartan/chapel,chizarlicious/chapel,hildeth/chapel,hildeth/chapel,hildeth/chapel,hildeth/chapel,hild...
31eb2bd7dee5a28f181d3eb8f923a9cdda198a47
flocker/__init__.py
flocker/__init__.py
# Copyright Hybrid Logic Ltd. See LICENSE file for details. # -*- test-case-name: flocker.test -*- """ Flocker is a hypervisor that provides ZFS-based replication and fail-over functionality to a Linux-based user-space operating system. """ import sys import os def _logEliotMessage(data): """ Route a seria...
# Copyright Hybrid Logic Ltd. See LICENSE file for details. # -*- test-case-name: flocker.test -*- """ Flocker is a hypervisor that provides ZFS-based replication and fail-over functionality to a Linux-based user-space operating system. """ import sys import os def _logEliotMessage(data): """ Route a seria...
Address review comment: Add link to upstream ticket.
Address review comment: Add link to upstream ticket.
Python
apache-2.0
hackday-profilers/flocker,LaynePeng/flocker,wallnerryan/flocker-profiles,runcom/flocker,AndyHuu/flocker,achanda/flocker,wallnerryan/flocker-profiles,hackday-profilers/flocker,lukemarsden/flocker,runcom/flocker,moypray/flocker,moypray/flocker,moypray/flocker,LaynePeng/flocker,agonzalezro/flocker,adamtheturtle/flocker,lu...
ae3a61b88c032c9188324bb17128fd060ac1ac2a
magazine/utils.py
magazine/utils.py
import bleach from lxml.html.clean import Cleaner allowed_tags = bleach.ALLOWED_TAGS + ['p', 'h1', 'h2', 'h3', 'h4', 'h5',] allowed_attributes = bleach.ALLOWED_ATTRIBUTES.copy() allowed_attributes['a'] = bleach.ALLOWED_ATTRIBUTES['a'] + ['name'] def clean_word_text(text): # The only thing I need Cleaner for is to...
import bleach try: from lxml.html.clean import Cleaner HAS_LXML = True except ImportError: HAS_LXML = False allowed_tags = bleach.ALLOWED_TAGS + ['p', 'h1', 'h2', 'h3', 'h4', 'h5',] allowed_attributes = bleach.ALLOWED_ATTRIBUTES.copy() allowed_attributes['a'] = bleach.ALLOWED_ATTRIBUTES['a'] + ['name'] de...
Make the dependency on lxml optional.
Make the dependency on lxml optional.
Python
mit
dominicrodger/django-magazine,dominicrodger/django-magazine
66cda3c9248c04850e89a2937a2f1457ac538bd4
vumi/middleware/__init__.py
vumi/middleware/__init__.py
"""Middleware classes to process messages on their way in and out of workers. """ from vumi.middleware.base import ( BaseMiddleware, TransportMiddleware, ApplicationMiddleware, MiddlewareStack, create_middlewares_from_config, setup_middlewares_from_config) from vumi.middleware.logging import LoggingMiddle...
"""Middleware classes to process messages on their way in and out of workers. """ from vumi.middleware.base import ( BaseMiddleware, TransportMiddleware, ApplicationMiddleware, MiddlewareStack, create_middlewares_from_config, setup_middlewares_from_config) __all__ = [ 'BaseMiddleware', 'TransportMiddl...
Remove package-level imports of middleware classes. This will break some configs, but they should never have been there in the first place.
Remove package-level imports of middleware classes. This will break some configs, but they should never have been there in the first place.
Python
bsd-3-clause
harrissoerja/vumi,TouK/vumi,harrissoerja/vumi,TouK/vumi,vishwaprakashmishra/xmatrix,harrissoerja/vumi,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix,TouK/vumi
19a698c9440e36e8cac80d16b295d41eb4cb05f3
wdbc/structures/__init__.py
wdbc/structures/__init__.py
# -*- coding: utf-8 -*- from pywow.structures import Structure, Skeleton from .fields import * from .main import * from .custom import * from .generated import GeneratedStructure class StructureNotFound(Exception): pass class StructureLoader(): wowfiles = None @classmethod def setup(cls): if cls.wowfiles is ...
# -*- coding: utf-8 -*- from pywow.structures import Structure, Skeleton from .fields import * from .main import * from .custom import * from .generated import GeneratedStructure class StructureNotFound(Exception): pass class StructureLoader(): wowfiles = None @classmethod def setup(cls): if cls.wowfiles is ...
Add a hacky update_cataclysm_locales method to Skeleton
structures: Add a hacky update_cataclysm_locales method to Skeleton
Python
cc0-1.0
jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow
e7b853c667b5785355214380954c83b843c46f05
tests/modules/contrib/test_publicip.py
tests/modules/contrib/test_publicip.py
import pytest from unittest import TestCase, mock import core.config import core.widget import modules.contrib.publicip def build_module(): config = core.config.Config([]) return modules.contrib.publicip.Module(config=config, theme=None) def widget(module): return module.widgets()[0] class PublicIPTest...
import pytest from unittest import TestCase, mock import core.config import core.widget import modules.contrib.publicip def build_module(): config = core.config.Config([]) return modules.contrib.publicip.Module(config=config, theme=None) def widget(module): return module.widgets()[0] class PublicIPTest...
Remove useless mock side effect
Remove useless mock side effect
Python
mit
tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status
9f598b0163a7ef6392b1ea67bde43f84fd9efbb8
myflaskapp/tests/functional_tests.py
myflaskapp/tests/functional_tests.py
from selenium import webdriver browser = webdriver.Chrome() browser.get('http://localhost:5000') assert 'tdd_with_python' in browser.title
from selenium import webdriver browser = webdriver.Chrome() # Edith has heard about a cool new online to-do app. She goes # to check out #its homepage browser.get('http://localhost:5000') # She notices the page title and header mention to-do lists assert 'To-Do' in browser.title # She is invited to enter a to-do i...
Change title test, add comments of To-do user story
Change title test, add comments of To-do user story
Python
mit
terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python,terryjbates/test-driven-development-with-python
6dc0300a35b46ba649ff655e6cb62aa57c843cff
navigation/templatetags/paginator.py
navigation/templatetags/paginator.py
from django import template register = template.Library() def paginator(context, adjacent_pages=4): """ To be used in conjunction with the object_list generic view. Adds pagination context variables for use in displaying first, adjacent and last page links in addition to those created by the object_l...
from django import template register = template.Library() def paginator(context, adjacent_pages=4): """ To be used in conjunction with the object_list generic view. Adds pagination context variables for use in displaying first, adjacent and last page links in addition to those created by the object_l...
Update after forum views now is class based
Update after forum views now is class based
Python
agpl-3.0
sigurdga/nidarholm,sigurdga/nidarholm,sigurdga/nidarholm
6823b063444dc6853ed524d2aad913fc0ba6c965
towel/templatetags/towel_batch_tags.py
towel/templatetags/towel_batch_tags.py
from django import template register = template.Library() @register.simple_tag def batch_checkbox(form, id): """ Checkbox which allows selecting objects for batch processing:: {% for object in object_list %} {% batch_checkbox batch_form object.id %} {{ object }} etc... ...
from django import template register = template.Library() @register.simple_tag def batch_checkbox(form, id): """ Checkbox which allows selecting objects for batch processing:: {% for object in object_list %} {% batch_checkbox batch_form object.id %} {{ object }} etc... ...
Make batch_checkbox a bit more resilient against problems with context variables
Make batch_checkbox a bit more resilient against problems with context variables
Python
bsd-3-clause
matthiask/towel,matthiask/towel,matthiask/towel,matthiask/towel
a7e7320967e52f532b684ec4cb488f0d28f29038
citrination_client/views/model_report.py
citrination_client/views/model_report.py
from copy import deepcopy class ModelReport(object): """ An abstraction of a model report that wraps access to various sections of the report. """ """ :param raw_report: the dict representation of model report JSON :type: dict """ def __init__(self, raw_report): self._raw_r...
from copy import deepcopy class ModelReport(object): """ An abstraction of a model report that wraps access to various sections of the report. """ """ :param raw_report: the dict representation of model report JSON :type: dict """ def __init__(self, raw_report): self._raw_r...
Add basic documentation to ModelReport
Add basic documentation to ModelReport
Python
apache-2.0
CitrineInformatics/python-citrination-client
7302cb5ca42a75ed7830327f175dba3abb75ab74
tests/runner.py
tests/runner.py
import sys import pstats import cProfile import unittest from django.test.simple import DjangoTestSuiteRunner class ProfilingTestRunner(DjangoTestSuiteRunner): def run_suite(self, suite, **kwargs): stream = open('profiled_tests.txt', 'w') # failfast keyword was added in Python 2.7 so we n...
import sys import pstats import cProfile import unittest from django.test.simple import DjangoTestSuiteRunner class ProfilingTestRunner(DjangoTestSuiteRunner): def run_suite(self, suite, **kwargs): stream = open('profiled_tests.txt', 'w') # failfast keyword was added in Python 2.7 so we n...
Use more readable version comparision
Use more readable version comparision
Python
bsd-2-clause
murphyke/avocado,murphyke/avocado,murphyke/avocado,murphyke/avocado
fc5e34aca23d219dd55ee4cfa0776ac47a4252db
dynamic_forms/__init__.py
dynamic_forms/__init__.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals __author__ = 'Markus Holtermann' __email__ = 'info@sinnwerkstatt.com' __version__ = '0.3.2' default_app_config = 'dynamic_forms.apps.DynamicFormsConfig'
# -*- coding: utf-8 -*- from __future__ import unicode_literals __author__ = 'Markus Holtermann' __email__ = 'info@markusholtermann.eu' __version__ = '0.3.2' default_app_config = 'dynamic_forms.apps.DynamicFormsConfig'
Fix email in package init
Fix email in package init
Python
bsd-3-clause
MotherNatureNetwork/django-dynamic-forms,MotherNatureNetwork/django-dynamic-forms,wangjiaxi/django-dynamic-forms,wangjiaxi/django-dynamic-forms,MotherNatureNetwork/django-dynamic-forms,uhuramedia/django-dynamic-forms,uhuramedia/django-dynamic-forms,uhuramedia/django-dynamic-forms,wangjiaxi/django-dynamic-forms
7c2a75906338e0670d0f75b4e06fc9ae775f3142
custom/opm/migrations/0001_drop_old_fluff_tables.py
custom/opm/migrations/0001_drop_old_fluff_tables.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import logging from sqlalchemy import Table, MetaData from corehq.db import connection_manager from django.db import migrations def drop_tables(apps, schema_editor): # show SQL commands logging.getLogger('sqlalchemy.engine').setLevel(logging.IN...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import logging from sqlalchemy import Table, MetaData from corehq.db import connection_manager from corehq.util.decorators import change_log_level from django.db import migrations @change_log_level('sqlalchemy.engine', logging.INFO) # show SQL command...
Make sure log level gets reset afterwards
Make sure log level gets reset afterwards
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq
38a2f6999ae0fb956303599ca8cf860c759c1ea8
xml_json_import/__init__.py
xml_json_import/__init__.py
from django.conf import settings from os import path, listdir from lxml import etree class XmlJsonImportModuleException(Exception): pass if not hasattr(settings, 'XSLT_FILES_DIR'): raise XmlJsonImportModuleException('Settings must contain XSLT_FILES_DIR parameter') if not path.exists(settings.XSLT_...
from django.conf import settings from os import path, listdir from lxml import etree class XmlJsonImportModuleException(Exception): pass if not hasattr(settings, 'XSLT_FILES_DIR'): raise XmlJsonImportModuleException('Settings must contain XSLT_FILES_DIR parameter') if not path.exists(settings.XSLT_FILES_DIR)...
Change line end characters to UNIX (\r\n -> \n)
Change line end characters to UNIX (\r\n -> \n)
Python
mit
lev-veshnyakov/django-import-data,lev-veshnyakov/django-import-data
cdee49a0ed600a72955d844abf5e4b5b2f9970cc
cookielaw/templatetags/cookielaw_tags.py
cookielaw/templatetags/cookielaw_tags.py
# -*- coding: utf-8 -*- from django import template from django.template.loader import render_to_string register = template.Library() @register.simple_tag(takes_context=True) def cookielaw_banner(context): if context['request'].COOKIES.get('cookielaw_accepted', False): return '' return render_to_st...
# -*- coding: utf-8 -*- from django import template from django.template.loader import render_to_string register = template.Library() @register.simple_tag(takes_context=True) def cookielaw_banner(context): if context['request'].COOKIES.get('cookielaw_accepted', False): return '' request =...
Fix required for Django 1.11
Fix required for Django 1.11 Update to fix "context must be a dict rather than RequestContext" error in Django 1.11
Python
bsd-2-clause
juan-cb/django-cookie-law,juan-cb/django-cookie-law,juan-cb/django-cookie-law
1e0d3c0d0b20f92fd901163a4f2b41627f9e931e
oonib/handlers.py
oonib/handlers.py
from cyclone import web class OONIBHandler(web.RequestHandler): pass class OONIBError(web.HTTPError): pass
import types from cyclone import escape from cyclone import web class OONIBHandler(web.RequestHandler): def write(self, chunk): """ This is a monkey patch to RequestHandler to allow us to serialize also json list objects. """ if isinstance(chunk, types.ListType): ...
Add support for serializing lists to json via self.write()
Add support for serializing lists to json via self.write()
Python
bsd-2-clause
DoNotUseThisCodeJUSTFORKS/ooni-backend,dstufft/ooni-backend,DoNotUseThisCodeJUSTFORKS/ooni-backend,dstufft/ooni-backend
b24aca6da2513aff7e07ce97715a36eb8e9eff2c
var/spack/packages/ravel/package.py
var/spack/packages/ravel/package.py
from spack import * class Ravel(Package): """Ravel is a parallel communication trace visualization tool that orders events according to logical time.""" homepage = "https://github.com/scalability-llnl/ravel" version('1.0', git="ssh://git@cz-stash.llnl.gov:7999/pave/ravel.git", branch=...
from spack import * class Ravel(Package): """Ravel is a parallel communication trace visualization tool that orders events according to logical time.""" homepage = "https://github.com/scalability-llnl/ravel" version('1.0.0', git="https://github.com/scalability-llnl/ravel.git", branch='...
Add -Wno-dev to avoid cmake policy warnings.
Add -Wno-dev to avoid cmake policy warnings.
Python
lgpl-2.1
lgarren/spack,krafczyk/spack,LLNL/spack,mfherbst/spack,tmerrick1/spack,mfherbst/spack,EmreAtes/spack,TheTimmy/spack,mfherbst/spack,EmreAtes/spack,tmerrick1/spack,krafczyk/spack,krafczyk/spack,iulian787/spack,TheTimmy/spack,krafczyk/spack,EmreAtes/spack,EmreAtes/spack,EmreAtes/spack,TheTimmy/spack,iulian787/spack,matthi...
67aa75b51249c8557f4fd4fd98b4dc6901b9cf49
great_expectations/datasource/generator/__init__.py
great_expectations/datasource/generator/__init__.py
from .databricks_generator import DatabricksTableGenerator from .glob_reader_generator import GlobReaderGenerator from .subdir_reader_generator import SubdirReaderGenerator from .in_memory_generator import InMemoryGenerator from .query_generator import QueryGenerator from .table_generator import TableGenerator
from .databricks_generator import DatabricksTableGenerator from .glob_reader_generator import GlobReaderGenerator from .subdir_reader_generator import SubdirReaderGenerator from .in_memory_generator import InMemoryGenerator from .query_generator import QueryGenerator from .table_generator import TableGenerator from .s3...
Add S3 Generator to generators module
Add S3 Generator to generators module
Python
apache-2.0
great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations
0aa757955d631df9fb8e6cbe3e372dcae56e2255
django_mailbox/transports/imap.py
django_mailbox/transports/imap.py
from imaplib import IMAP4, IMAP4_SSL from .base import EmailTransport, MessageParseError class ImapTransport(EmailTransport): def __init__(self, hostname, port=None, ssl=False, archive=''): self.hostname = hostname self.port = port self.archive = archive if ssl: self.t...
from imaplib import IMAP4, IMAP4_SSL from .base import EmailTransport, MessageParseError class ImapTransport(EmailTransport): def __init__(self, hostname, port=None, ssl=False, archive=''): self.hostname = hostname self.port = port self.archive = archive if ssl: self.t...
Create archive folder if it does not exist.
Create archive folder if it does not exist.
Python
mit
coddingtonbear/django-mailbox,ad-m/django-mailbox,Shekharrajak/django-mailbox,leifurhauks/django-mailbox
d2d4f127a797ad6e82d41de10edd0e70f1626df8
virtualfish/__main__.py
virtualfish/__main__.py
from __future__ import print_function import os import sys import pkg_resources if __name__ == "__main__": version = pkg_resources.get_distribution('virtualfish').version base_path = os.path.dirname(os.path.abspath(__file__)) commands = [ 'set -g VIRTUALFISH_VERSION {}'.format(version), 's...
from __future__ import print_function import os import sys import pkg_resources if __name__ == "__main__": version = pkg_resources.get_distribution('virtualfish').version base_path = os.path.dirname(os.path.abspath(__file__)) commands = [ 'set -g VIRTUALFISH_VERSION {}'.format(version), 's...
Use 'source' command instead of deprecated '.' alias
Use 'source' command instead of deprecated '.' alias Closes #125
Python
mit
adambrenecki/virtualfish,adambrenecki/virtualfish
2ab4cd4bbc01f3625708b725f1465cb9fb0cdf1b
scripts/showbb.py
scripts/showbb.py
''' Pretty prints a bitboard to the console given its hex or decimal value. ''' import sys, textwrap if len(sys.argv) == 1: print 'Syntax: showbb.py <bitboard>' sys.exit(1) # Handle hex/decimal bitboards if sys.argv[1].startswith('0x'): bb = bin(int(sys.argv[1], 16)) else: bb = bin(int(sys.argv[1], 10...
''' Pretty prints a bitboard to the console given its hex or decimal value.b ''' import sys, textwrap if len(sys.argv) == 1: print 'Syntax: showbb.py <bitboard>' sys.exit(1) # Handle hex/decimal bitboards if sys.argv[1].startswith('0x'): bb = bin(int(sys.argv[1], 16)) else: bb = bin(int(sys.argv[1], 1...
Make bitboard script output easier to read
Make bitboard script output easier to read
Python
mit
GunshipPenguin/shallow-blue,GunshipPenguin/shallow-blue,GunshipPenguin/shallow-blue,GunshipPenguin/shallow-blue
a34fac317c9b09c3d516238cabda5e99a8cec907
sciunit/unit_test/validator_tests.py
sciunit/unit_test/validator_tests.py
import unittest import quantities as pq class ValidatorTestCase(unittest.TestCase): def register_test(self): class TestClass(): intValue = 0 def getIntValue(self): return self.intValue from sciunit.validators import register_quantity, register_type reg...
import unittest import quantities as pq class ValidatorTestCase(unittest.TestCase): def test1(self): self.assertEqual(1, 1) def register_test(self): class TestClass(): intValue = 0 def getIntValue(self): return self.intValue from sciunit.valid...
Add assert to validator test cases
Add assert to validator test cases
Python
mit
scidash/sciunit,scidash/sciunit
c94e3cb0f82430811f7e8cc53d29433448395f70
favicon/urls.py
favicon/urls.py
from django.conf.urls import patterns, url from django.views.generic import TemplateView, RedirectView import conf urlpatterns = patterns('', url(r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': conf.FAVICON_PATH}, name='favicon'), )
from django.conf.urls import patterns, url from django.views.generic import TemplateView, RedirectView import conf urlpatterns = patterns('', url(r'^favicon\.ico$', RedirectView.as_view(url=conf.FAVICON_PATH}), name='favicon'), )
Use RedirectView in urlpatterns (needed for Django 1.5)
Use RedirectView in urlpatterns (needed for Django 1.5) 'django.views.generic.simple.redirect_to' is not supported in Django 1.5 Use RedirectView.as_view instead. The existing code was already importing RedirectView but still using the old 'django.views.generic.simple.redirect_to' in the url patterns. 
Python
bsd-3-clause
littlepea/django-favicon
917cd9330f572bc2ec601a7555122b59507f6429
payments/management/commands/init_plans.py
payments/management/commands/init_plans.py
from django.conf import settings from django.core.management.base import BaseCommand import stripe class Command(BaseCommand): help = "Make sure your Stripe account has the plans" def handle(self, *args, **options): stripe.api_key = settings.STRIPE_SECRET_KEY for plan in settings.PA...
from django.conf import settings from django.core.management.base import BaseCommand import stripe class Command(BaseCommand): help = "Make sure your Stripe account has the plans" def handle(self, *args, **options): stripe.api_key = settings.STRIPE_SECRET_KEY for plan in settings.PA...
Use plan name instead of description
Use plan name instead of description
Python
mit
aibon/django-stripe-payments,crehana/django-stripe-payments,crehana/django-stripe-payments,jamespacileo/django-stripe-payments,alexhayes/django-stripe-payments,ZeevG/django-stripe-payments,jamespacileo/django-stripe-payments,grue/django-stripe-payments,wahuneke/django-stripe-payments,adi-li/django-stripe-payments,alexh...
b2018bcf9274e0e641e132fe866ef630f99d98a3
profiles/modules/codes/extensions/codes.py
profiles/modules/codes/extensions/codes.py
from django.db import models from django.utils.translation import ugettext_lazy as _ def register(cls, admin_cls): cls.add_to_class('code', models.ForeignKey('profiles.Code', verbose_name=_('Registration code'), null=True, blank=True)) if admin_cls: admin_cls.list_display_filter += ['code', ] ...
from django.db import models from django.utils.translation import ugettext_lazy as _ def register(cls, admin_cls): cls.add_to_class('code', models.ForeignKey('profiles.Code', verbose_name=_('Registration code'), null=True, blank=True)) if admin_cls: admin_cls.list_display_filter += ['code', ] ...
Fix terrible error when filter_horizontal of admin class has not existed.
Fix terrible error when filter_horizontal of admin class has not existed.
Python
bsd-2-clause
incuna/django-extensible-profiles
7fa83928d0dae14fca556ef91a9c3c544aac24d6
apps/package/templatetags/package_tags.py
apps/package/templatetags/package_tags.py
from datetime import timedelta from datetime import datetime from django import template from github2.client import Github from package.models import Package, Commit register = template.Library() github = Github() @register.filter def commits_over_52(package): current = datetime.now() weeks = [] comm...
from datetime import timedelta from datetime import datetime from django import template from github2.client import Github from package.models import Package, Commit register = template.Library() github = Github() @register.filter def commits_over_52(package): current = datetime.now() weeks = [] comm...
Update the commit_over_52 template tag to be more efficient.
Update the commit_over_52 template tag to be more efficient. Replaced several list comprehensions with in-database operations and map calls for significantly improved performance.
Python
mit
QLGu/djangopackages,cartwheelweb/packaginator,cartwheelweb/packaginator,nanuxbe/djangopackages,pydanny/djangopackages,QLGu/djangopackages,QLGu/djangopackages,pydanny/djangopackages,audreyr/opencomparison,nanuxbe/djangopackages,miketheman/opencomparison,benracine/opencomparison,miketheman/opencomparison,benracine/openco...
e90cc08b755b96ef892e4fb25d43f3b25d89fae8
_tests/python_check_version.py
_tests/python_check_version.py
import os import sys current_version = list(sys.version_info[:3]) print("current_version: %s" % str(current_version)) expected_version = map(int, os.environ["EXPECTED_PYTHON_VERSION"].split(".")) print("expected_version: %s" % str(expected_version)) assert current_version == expected_version
import os import sys current_version = list(sys.version_info[:3]) print("current_version: %s" % str(current_version)) expected_version = list( map(int, os.environ["EXPECTED_PYTHON_VERSION"].split("."))) print("expected_version: %s" % str(expected_version)) assert current_version == expected_version
Fix python_version_check on python 3
tests: Fix python_version_check on python 3
Python
apache-2.0
scikit-build/scikit-ci-addons,scikit-build/scikit-ci-addons
fba24207cc48aee53e023992be67ced518dc3e9d
utils.py
utils.py
import os import boto import boto.s3 from boto.s3.key import Key import requests import uuid # http://stackoverflow.com/a/42493144 def upload_url_to_s3(image_url): image_res = requests.get(image_url, stream=True) image = image_res.raw image_data = image.read() fname = '{}.jpg'.format(str(uuid.uuid4()...
import os import boto import boto.s3 from boto.s3.key import Key import requests import uuid # http://stackoverflow.com/a/42493144 def upload_url_to_s3(image_url): image_res = requests.get(image_url, stream=True) image = image_res.raw image_data = image.read() fname = str(uuid.uuid4()) conn = bo...
Use uuid as file name
Use uuid as file name
Python
mit
reneepadgham/diverseui,reneepadgham/diverseui,reneepadgham/diverseui
d5f02b13db9b6d23e15bc07a985b8c67644ffb44
pyclibrary/__init__.py
pyclibrary/__init__.py
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright 2015 by PyCLibrary Authors, see AUTHORS for more details. # # Distributed under the terms of the MIT/X11 license. # # The full license is in the file LICENCE, distributed with this software. # -----------...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright 2015 by PyCLibrary Authors, see AUTHORS for more details. # # Distributed under the terms of the MIT/X11 license. # # The full license is in the file LICENCE, distributed with this software. # -----------...
Add NullHandler to avoid logging complaining for nothing.
Add NullHandler to avoid logging complaining for nothing.
Python
mit
MatthieuDartiailh/pyclibrary,mrh1997/pyclibrary,mrh1997/pyclibrary,MatthieuDartiailh/pyclibrary,mrh1997/pyclibrary,duguxy/pyclibrary,duguxy/pyclibrary,duguxy/pyclibrary
b0c217acb04d377bdd0d37ce8fc61a88bd97ae77
pyelevator/elevator.py
pyelevator/elevator.py
from .base import Client class RangeIter(object): def __init__(self, range_datas): self._container = range_datas if self._valid_range(range_datas) else None def _valid_range(self, range_datas): if (not isinstance(range_datas, tuple) or any(not isinstance(pair, tuple) for pair in r...
from .base import Client class RangeIter(object): def __init__(self, range_datas): self._container = range_datas if self._valid_range(range_datas) else None def _valid_range(self, range_datas): if (not isinstance(range_datas, tuple) or any(not isinstance(pair, tuple) for pair in r...
Update : RangeIter args name changed
Update : RangeIter args name changed
Python
mit
oleiade/py-elevator
8f87749e5c7373015290306677fe9651cc5e54c1
ibmcnx/doc/DataSources.py
ibmcnx/doc/DataSources.py
###### # Check ExId (GUID) by Email through JDBC # # Author: Christoph Stoettner # Mail: christoph.stoettner@stoeps.de # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-06-04 # # License: Apache 2.0 # # Check ExId of a User in all Connections Appli...
###### # Check ExId (GUID) by Email through JDBC # # Author: Christoph Stoettner # Mail: christoph.stoettner@stoeps.de # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-06-04 # # License: Apache 2.0 # # Check ExId of a User in all Connections Appli...
Create documentation of DataSource Settings
8: Create documentation of DataSource Settings Task-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/8
Python
apache-2.0
stoeps13/ibmcnx2,stoeps13/ibmcnx2
9c12bcb4a5b5b2fee28476e047855dca50b3867c
mwbase/attr_dict.py
mwbase/attr_dict.py
from collections import OrderedDict class AttrDict(OrderedDict): def __init__(self, *args, **kwargs): super(AttrDict, self).__init__(*args, **kwargs) def __getattr__(self, attr): if attr not in self: raise AttributeError(attr) else: return self[attr] def _...
from collections import OrderedDict class AttrDict(OrderedDict): def __init__(self, *args, **kwargs): super(OrderedDict, self).__init__(*args, **kwargs) def __getattribute__(self, attr): if attr in self: return self[attr] else: return super(OrderedDict, self)._...
Switch use of getattr to getattribute.
Switch use of getattr to getattribute.
Python
mit
mediawiki-utilities/python-mwbase
bcc1048a11345545013c6ea93b92fc52e639cd98
tests/unit/models/reddit/test_widgets.py
tests/unit/models/reddit/test_widgets.py
from praw.models import (SubredditWidgets, SubredditWidgetsModeration, Widget, WidgetModeration) from ... import UnitTest class TestWidgets(UnitTest): def test_subredditwidgets_mod(self): sw = SubredditWidgets(self.reddit.subreddit('fake_subreddit')) assert isinstance(sw....
from json import dumps from praw.models import (SubredditWidgets, SubredditWidgetsModeration, Widget, WidgetModeration) from praw.models.reddit.widgets import WidgetEncoder from praw.models.base import PRAWBase from ... import UnitTest class TestWidgetEncoder(UnitTest): def test_bad_enc...
Test WidgetEncoder to get coverage to 100%
Test WidgetEncoder to get coverage to 100%
Python
bsd-2-clause
leviroth/praw,gschizas/praw,gschizas/praw,praw-dev/praw,13steinj/praw,praw-dev/praw,leviroth/praw,13steinj/praw
45381a1ce6e271cc06ce130cb35a93f14eceba90
troposphere/utils.py
troposphere/utils.py
import time def _tail_print(e): print("%s %s %s" % (e.resource_status, e.resource_type, e.event_id)) def get_events(conn, stackname): """Get the events in batches and return in chronological order""" next = None event_list = [] while 1: events = conn.describe_stack_events(stackname, next...
import time def _tail_print(e): print("%s %s %s" % (e.resource_status, e.resource_type, e.event_id)) def get_events(conn, stackname): """Get the events in batches and return in chronological order""" next = None event_list = [] while 1: events = conn.describe_stack_events(stackname, next...
Add "include_initial" kwarg to support tailing stack updates
Add "include_initial" kwarg to support tailing stack updates `get_events` will return all events that have occurred for a stack. This is useless if we're tailing an update to a stack.
Python
bsd-2-clause
mhahn/troposphere
783af65a5e417a1828105d390f7096066929a4b7
ipywidgets/widgets/widget_core.py
ipywidgets/widgets/widget_core.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. """Base widget class for widgets provided in Core""" from .widget import Widget from .._version import __jupyter_widget_version__ from traitlets import Unicode class CoreWidget(Widget): _model_module_version = ...
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. """Base widget class for widgets provided in Core""" from .widget import Widget from .._version import __jupyter_widget_version__ from traitlets import Unicode class CoreWidget(Widget): _model_module_version = ...
Revert the versioning back until the versioning discussion is settled.
Revert the versioning back until the versioning discussion is settled.
Python
bsd-3-clause
ipython/ipywidgets,SylvainCorlay/ipywidgets,ipython/ipywidgets,ipython/ipywidgets,jupyter-widgets/ipywidgets,jupyter-widgets/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,SylvainCorlay/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets
e72107f53e4519f16d556b15405b7f7223e0bfae
setup.py
setup.py
import distutils.core # Uploading to PyPI # ================= # $ python setup.py register -r pypi # $ python setup.py sdist upload -r pypi version = '0.0' distutils.core.setup( name='kxg', version=version, author='Kale Kundert and Alex Mitchell', url='https://github.com/kxgames/GameEn...
import distutils.core # Uploading to PyPI # ================= # $ python setup.py register -r pypi # $ python setup.py sdist upload -r pypi version = '0.0' distutils.core.setup( name='kxg', version=version, author='Kale Kundert and Alex Mitchell', url='https://github.com/kxgames/GameEn...
Add docopt as a dependency.
Add docopt as a dependency.
Python
mit
kxgames/kxg
28b261e1f9af635fd2355085303d67991856584f
mathdeck/settings.py
mathdeck/settings.py
# -*- coding: utf-8 -*- """ mathdeck.settings ~~~~~~~~~~~~~~~~~ This module accesses the settings file located at /etc/mathdeck/mathdeckconf.json :copyright: (c) 2015 by Patrick Spencer. :license: Apache 2.0, see ../LICENSE for more details. """ import json import os # Make this a class so we can pass conf_dir va...
# -*- coding: utf-8 -*- """ mathdeck.settings ~~~~~~~~~~~~~~~~~ This module accesses the settings file located at /etc/mathdeck/mathdeckconf.json :copyright: (c) 2014-2016 by Patrick Spencer. :license: Apache 2.0, see ../LICENSE for more details. """ import json import os # Make this a class so we can pass conf_d...
Fix problem file importing bug
Fix problem file importing bug
Python
apache-2.0
patrickspencer/mathdeck,patrickspencer/mathdeck
c07013887a105a3adf0a6f1aa9d09357450cba46
tools/fontbakery-build-metadata.py
tools/fontbakery-build-metadata.py
import sys from bakery_cli.scripts import genmetadata def main(argv=None): if argv is None: argv = sys.argv if len(argv) != 2: genmetadata.usage() return 1 genmetadata.run(argv[1]) return 0 if __name__ == '__main__': sys.exit(main())
#!/usr/bin/env python # coding: utf-8 # Copyright 2013 The Font Bakery Authors. 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/LIC...
Add license and shebang to build-metadata.py
Add license and shebang to build-metadata.py
Python
apache-2.0
googlefonts/fontbakery,googlefonts/fontbakery,graphicore/fontbakery,moyogo/fontbakery,graphicore/fontbakery,graphicore/fontbakery,davelab6/fontbakery,moyogo/fontbakery,moyogo/fontbakery,googlefonts/fontbakery,jessamynsmith/fontbakery
27e67076d4a2cfe68ab3a9113bb37344b35b3c90
scipy_base/__init__.py
scipy_base/__init__.py
from info_scipy_base import __doc__ from scipy_base_version import scipy_base_version as __version__ from ppimport import ppimport, ppimport_attr # The following statement is equivalent to # # from Matrix import Matrix as mat # # but avoids expensive LinearAlgebra import when # Matrix is not used. mat = ppimport_a...
from info_scipy_base import __doc__ from scipy_base_version import scipy_base_version as __version__ from ppimport import ppimport, ppimport_attr # The following statement is equivalent to # # from Matrix import Matrix as mat # # but avoids expensive LinearAlgebra import when # Matrix is not used. mat = ppimport_a...
Fix for matrixmultiply != dot on Numeric < 23.4
Fix for matrixmultiply != dot on Numeric < 23.4 git-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@857 94b884b6-d6fd-0310-90d3-974f1d3f35e1
Python
bsd-3-clause
illume/numpy3k,chadnetzer/numpy-gaurdro,jasonmccampbell/numpy-refactor-sprint,efiring/numpy-work,Ademan/NumPy-GSoC,illume/numpy3k,Ademan/NumPy-GSoC,teoliphant/numpy-refactor,teoliphant/numpy-refactor,illume/numpy3k,Ademan/NumPy-GSoC,jasonmccampbell/numpy-refactor-sprint,Ademan/NumPy-GSoC,chadnetzer/numpy-gaurdro,chadne...
c889ffd1f86a445f2e5ba157fc81cbb64e92dc12
voctocore/lib/sources/videoloopsource.py
voctocore/lib/sources/videoloopsource.py
#!/usr/bin/env python3 import logging import re from gi.repository import Gst from lib.config import Config from lib.sources.avsource import AVSource class VideoLoopSource(AVSource): def __init__(self, name): super().__init__('VideoLoopSource', name, False, True) self.location = Config.getLocati...
#!/usr/bin/env python3 import logging import re from gi.repository import Gst from lib.config import Config from lib.sources.avsource import AVSource class VideoLoopSource(AVSource): timer_resolution = 0.5 def __init__(self, name, has_audio=True, has_video=True, force_num_streams=None): ...
Modify videoloop to allow for audio
Modify videoloop to allow for audio
Python
mit
voc/voctomix,voc/voctomix
acab1af0e9bebeea011de1be472f298ddedd862b
src/pretix/control/views/global_settings.py
src/pretix/control/views/global_settings.py
from django.shortcuts import reverse from django.views.generic import FormView from pretix.control.forms.global_settings import GlobalSettingsForm from pretix.control.permissions import AdministratorPermissionRequiredMixin class GlobalSettingsView(AdministratorPermissionRequiredMixin, FormView): template_name = ...
from django.contrib import messages from django.shortcuts import reverse from django.utils.translation import ugettext_lazy as _ from django.views.generic import FormView from pretix.control.forms.global_settings import GlobalSettingsForm from pretix.control.permissions import AdministratorPermissionRequiredMixin cl...
Add feedback to global settings
Add feedback to global settings
Python
apache-2.0
Flamacue/pretix,Flamacue/pretix,Flamacue/pretix,Flamacue/pretix
7da7789a6508a60d0ad7662ac69bcee9c478c239
numpy/typing/tests/data/fail/array_constructors.py
numpy/typing/tests/data/fail/array_constructors.py
import numpy as np a: np.ndarray generator = (i for i in range(10)) np.require(a, requirements=1) # E: No overload variant np.require(a, requirements="TEST") # E: incompatible type np.zeros("test") # E: incompatible type np.zeros() # E: Too few arguments np.ones("test") # E: incompatible type np.ones() # E: T...
import numpy as np a: np.ndarray generator = (i for i in range(10)) np.require(a, requirements=1) # E: No overload variant np.require(a, requirements="TEST") # E: incompatible type np.zeros("test") # E: incompatible type np.zeros() # E: Missing positional argument np.ones("test") # E: incompatible type np.ones...
Fix two failing typing tests
TST: Fix two failing typing tests Mypy 0.800 changed one of its error messages; the `fail` tests have now been altered to reflect this change
Python
bsd-3-clause
seberg/numpy,jakirkham/numpy,endolith/numpy,pdebuyl/numpy,seberg/numpy,seberg/numpy,mhvk/numpy,pbrod/numpy,pbrod/numpy,pbrod/numpy,endolith/numpy,pbrod/numpy,seberg/numpy,madphysicist/numpy,pbrod/numpy,mattip/numpy,jakirkham/numpy,numpy/numpy,madphysicist/numpy,rgommers/numpy,mhvk/numpy,mhvk/numpy,rgommers/numpy,anntze...
0dc833919af095470f1324d9e59647c2f6f851f5
genshi/__init__.py
genshi/__init__.py
# -*- coding: utf-8 -*- # # Copyright (C) 2006-2008 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://genshi.edgewall.org/wiki/License. # # This software consist...
# -*- coding: utf-8 -*- # # Copyright (C) 2006-2008 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://genshi.edgewall.org/wiki/License. # # This software consist...
Remove pkg_resources import from top-level package, will just need to remember updating the version in two places.
Remove pkg_resources import from top-level package, will just need to remember updating the version in two places.
Python
bsd-3-clause
mitchellrj/genshi,mitchellrj/genshi,mitchellrj/genshi,mitchellrj/genshi
7cb4734a837ad9d43ef979085d0f6d474f45178c
test_project/select2_outside_admin/views.py
test_project/select2_outside_admin/views.py
try: from django.urls import reverse_lazy except ImportError: from django.core.urlresolvers import reverse_lazy from django.forms import inlineformset_factory from django.views import generic from select2_many_to_many.forms import TForm from select2_many_to_many.models import TModel class UpdateView(generic....
try: from django.urls import reverse_lazy except ImportError: from django.core.urlresolvers import reverse_lazy from django.forms import inlineformset_factory from django.views import generic from select2_many_to_many.forms import TForm from select2_many_to_many.models import TModel class UpdateView(generic....
Fix example outside the admin
Fix example outside the admin
Python
mit
yourlabs/django-autocomplete-light,yourlabs/django-autocomplete-light,yourlabs/django-autocomplete-light,yourlabs/django-autocomplete-light
d7b92a15756dbbad1d66cbe7b2ef25f680e59b10
postmarker/pytest.py
postmarker/pytest.py
from unittest.mock import patch import pytest from .core import PostmarkClient, requests @pytest.yield_fixture def postmark_request(): """Mocks network requests to Postmark API.""" if patch is None: raise AssertionError('To use pytest fixtures on Python 2, please, install postmarker["tests"]') w...
from unittest.mock import patch import pytest from .core import PostmarkClient, requests @pytest.yield_fixture def postmark_request(): """Mocks network requests to Postmark API.""" with patch("postmarker.core.requests.Session.request", wraps=requests.Session().request) as patched: with patch("postma...
Drop another Python 2 shim
chore: Drop another Python 2 shim
Python
mit
Stranger6667/postmarker
4716df0c5cf96f5a3869bbae60844afbe2aaca4a
kolibri/tasks/management/commands/base.py
kolibri/tasks/management/commands/base.py
from collections import namedtuple from django.core.management.base import BaseCommand Progress = namedtuple('Progress', ['progress', 'overall']) class AsyncCommand(BaseCommand): CELERY_PROGRESS_STATE_NAME = "PROGRESS" def handle(self, *args, **options): self.update_state = options.pop("update_sta...
from collections import namedtuple from django.core.management.base import BaseCommand Progress = namedtuple('Progress', ['progress', 'overall']) class AsyncCommand(BaseCommand): """A management command with added convenience functions for displaying progress to the user. Rather than implementing handl...
Add a bit of documentation on what AsyncCommand is.
Add a bit of documentation on what AsyncCommand is.
Python
mit
aronasorman/kolibri,DXCanas/kolibri,DXCanas/kolibri,lyw07/kolibri,jtamiace/kolibri,christianmemije/kolibri,aronasorman/kolibri,aronasorman/kolibri,learningequality/kolibri,rtibbles/kolibri,lyw07/kolibri,mrpau/kolibri,mrpau/kolibri,66eli77/kolibri,jamalex/kolibri,ralphiee22/kolibri,lyw07/kolibri,jamalex/kolibri,indirect...
eb7993ce52e6f8ba7298b6ba9bc68356e99c339b
troposphere/codestarconnections.py
troposphere/codestarconnections.py
# Copyright (c) 2012-2020, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject VALID_CONNECTION_PROVIDERTYPE = ('Bitbucket') def validate_connection_providertype(connection_providertype): """Validate ProviderType for Connection""" if connection_...
# Copyright (c) 2012-2020, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from . import AWSObject, Tags VALID_CONNECTION_PROVIDERTYPE = ('Bitbucket') def validate_connection_providertype(connection_providertype): """Validate ProviderType for Connection""" if conne...
Add AWS::CodeStarConnections::Connection props, per May 14, 2020 update
Add AWS::CodeStarConnections::Connection props, per May 14, 2020 update
Python
bsd-2-clause
cloudtools/troposphere,cloudtools/troposphere
2733408a9e24c30214831c46ac748aa4884a18fb
haddock/haddock.py
haddock/haddock.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #import sys #reload(sys) #sys.setdefaultencoding("utf-8") import os import random from io import open curses_en = os.path.join(os.path.dirname(__file__), "curses_en.txt") curses_de = os.path.join(os.path.dirname(__file__), "curses_de.txt") curses_fr = os.path.join(os.pat...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import random from io import open def curse(lang="en"): if lang not in curses: try: filename = os.path.join(os.path.dirname(__file__), 'curses_%s.txt' % lang) with open(filename, encoding='utf-8') as f: curses[...
Refactor code to eliminate O(n) hard-coding.
Refactor code to eliminate O(n) hard-coding.
Python
mit
asmaier/haddock,asmaier/haddock
6af31da53a43bcd2e45ea4242892a4831b2fb2f8
asyncio_irc/listeners.py
asyncio_irc/listeners.py
class Listener: """Always invokes the handler.""" def __init__(self, handler): self.handler = handler def handle(self, connection, message): self.handler(connection, message=message) class CommandListener(Listener): """Only invokes the handler on one particular command.""" def __i...
class Listener: """Always invokes the handler.""" def __init__(self, handler): self.handler = handler def handle(self, connection, message): self.handler(connection, message=message) class CommandListener(Listener): """Only invokes the handler on one particular command.""" def __i...
Remove commented code for the mo
Remove commented code for the mo
Python
bsd-2-clause
meshy/framewirc
b6927cadb72e0a73700416d0218a569c15ec8818
generative/tests/compare_test/concat_first/run.py
generative/tests/compare_test/concat_first/run.py
from __future__ import division from __future__ import print_function from __future__ import absolute_import import subprocess if __name__ == "__main__": import argparse parser = argparse.ArgumentParser() parser.add_argument('layer', type=str, help='fc6|conv42|pool1') parser.add_argument('--cuda-devic...
from __future__ import division from __future__ import print_function from __future__ import absolute_import import subprocess if __name__ == "__main__": import argparse parser = argparse.ArgumentParser() parser.add_argument('layer', type=str, help='fc6|conv42|pool1') parser.add_argument('--cuda-devic...
Update path to save to mnt dir
Update path to save to mnt dir
Python
mit
judithfan/pix2svg