commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
366316b0ea20ae178670581b61c52c481682d2b0 | Change exception name to CosmicRayTestingException | sixty-north/cosmic-ray | cosmic_ray/operators/exception_replacer.py | cosmic_ray/operators/exception_replacer.py | import ast
import builtins
from .operator import Operator
class CosmicRayTestingException(Exception):
pass
setattr(builtins, CosmicRayTestingException.__name__, CosmicRayTestingException)
class ExceptionReplacer(Operator):
"""An operator that modifies exception handlers."""
def visit_ExceptHandler(s... | import ast
import builtins
from .operator import Operator
class OutOfNoWhereException(Exception):
pass
setattr(builtins, OutOfNoWhereException.__name__, OutOfNoWhereException)
class ExceptionReplacer(Operator):
"""An operator that modifies exception handlers."""
def visit_ExceptHandler(self, node): ... | mit | Python |
8e5021e7808beca42e384f5b100a844159b03cab | Undo rearranged imports | nkoech/csacompendium,nkoech/csacompendium,nkoech/csacompendium | csacompendium/countries/api/serializers.py | csacompendium/countries/api/serializers.py | from rest_framework.serializers import ModelSerializer
from csacompendium.countries.models import Country
class CountryListSerializer(ModelSerializer):
"""
Serialize all records in given fields into an API
"""
class Meta:
model = Country
fields = [
'id',
'user',... | from csacompendium.countries.models import Country
from rest_framework.serializers import ModelSerializer
class CountryListSerializer(ModelSerializer):
"""
Serialize all records in given fields into an API
"""
class Meta:
model = Country
fields = [
'id',
'user',... | mit | Python |
bf5785a8ecc1f417b860d7f76298d916d1c4ea21 | Fix an API view name | murrown/cyder,drkitty/cyder,drkitty/cyder,OSU-Net/cyder,zeeman/cyder,OSU-Net/cyder,akeym/cyder,akeym/cyder,OSU-Net/cyder,drkitty/cyder,zeeman/cyder,murrown/cyder,murrown/cyder,murrown/cyder,zeeman/cyder,akeym/cyder,OSU-Net/cyder,drkitty/cyder,akeym/cyder,zeeman/cyder | cyder/api/v1/endpoints/dhcp/network/api.py | cyder/api/v1/endpoints/dhcp/network/api.py | from rest_framework import serializers
from cyder.api.v1.endpoints.api import CommonAPINestedAVSerializer
from cyder.api.v1.endpoints.dhcp import api
from cyder.cydhcp.network.models import Network, NetworkAV
class NetworkAVSerializer(serializers.ModelSerializer):
id = serializers.Field(source='id')
network ... | from rest_framework import serializers
from cyder.api.v1.endpoints.api import CommonAPINestedAVSerializer
from cyder.api.v1.endpoints.dhcp import api
from cyder.cydhcp.network.models import Network, NetworkAV
class NetworkAVSerializer(serializers.ModelSerializer):
id = serializers.Field(source='id')
network ... | bsd-3-clause | Python |
186586e0ba1fa1efbdc175ce6f2a2833920f2d3b | Attach widgets before other scripts | reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome... | website/assets.py | website/assets.py | from flask_assets import Bundle
def css_bundle(name, *args):
return Bundle(
*args,
filters='cssutils',
output='min/' + name + '.css'
)
bundles = {
'js_search': Bundle(
'search.js',
filters='rjsmin',
output='min/search.js'
),
'js_protein_view': Bund... | from flask_assets import Bundle
def css_bundle(name, *args):
return Bundle(
*args,
filters='cssutils',
output='min/' + name + '.css'
)
bundles = {
'js_search': Bundle(
'search.js',
filters='rjsmin',
output='min/search.js'
),
'js_protein_view': Bund... | lgpl-2.1 | Python |
3ff406048377101d1b2de2a96594e1fd202b63ac | split project views into files | caseyrollins/osf.io,bdyetton/prettychart,himanshuo/osf.io,danielneis/osf.io,leb2dg/osf.io,asanfilippo7/osf.io,jmcarp/osf.io,njantrania/osf.io,kch8qx/osf.io,ticklemepierce/osf.io,jnayak1/osf.io,jolene-esposito/osf.io,abought/osf.io,caseyrollins/osf.io,monikagrabowska/osf.io,danielneis/osf.io,KAsante95/osf.io,monikagrabo... | website/routes.py | website/routes.py | from framework.auth import routes
from website import views
# from website.profile import views
# from website.project import views
from website.search import routes
from website.discovery import routes | from framework.auth import routes
from website import views
from website.profile import routes
from website.project import routes
from website.search import routes
from website.discovery import routes | apache-2.0 | Python |
c284d4e64086867a1036f071d9d1f9e9c6b3797d | Remove incorrect docstring | yaybu/touchdown,mitchellrj/touchdown | touchdown/aws/vpc/vpc.py | touchdown/aws/vpc/vpc.py | # Copyright 2014 Isotoma Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | # Copyright 2014 Isotoma Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | apache-2.0 | Python |
d90b4d1291a668e50e8aba78ac1242afccc5e00a | use getattr to get settings | gocsp/django-compressor-autoprefixer,dizballanze/django-compressor-autoprefixer | django_compressor_autoprefixer/__init__.py | django_compressor_autoprefixer/__init__.py | from django.conf import settings
from compressor.filters import CompilerFilter
COMPRESS_AUTOPREFIXER_BINARY = "autoprefixer"
COMPRESS_AUTOPREFIXER_ARGS = ""
class AutoprefixerFilter(CompilerFilter):
command = "{binary} {args}"
options = (
("binary", getattr(settings, "COMPRESS_AUTOPREFIXER_BINARY", ... | from django.conf import settings
from compressor.filters import CompilerFilter
COMPRESS_AUTOPREFIXER_BINARY = "autoprefixer"
COMPRESS_AUTOPREFIXER_ARGS = ""
class AutoprefixerFilter(CompilerFilter):
command = "{binary} {args}"
options = (
("binary", settings.COMPRESS_AUTOPREFIXER_BINARY or COMPRESS_... | mit | Python |
cd0823a3f71b2924cc7ce5f58d954fbf37623a41 | Set the clock for twosys-tsunami CPUs | pombredanne/http-repo.gem5.org-gem5-,pombredanne/http-repo.gem5.org-gem5-,pombredanne/http-repo.gem5.org-gem5-,hoangt/tpzsimul.gem5,vovojh/gem5,hoangt/tpzsimul.gem5,vovojh/gem5,hoangt/tpzsimul.gem5,vovojh/gem5,pombredanne/http-repo.gem5.org-gem5-,pombredanne/http-repo.gem5.org-gem5-,hoangt/tpzsimul.gem5,hoangt/tpzsimul... | tests/configs/twosys-tsunami-simple-atomic.py | tests/configs/twosys-tsunami-simple-atomic.py | # Copyright (c) 2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list ... | # Copyright (c) 2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list ... | bsd-3-clause | Python |
132309e91cc7e951d4a7f326d9e374dc8943f2f3 | Resolve pytest warning about TestRPCProvider | pipermerriam/web3.py | tests/core/providers/test_testrpc_provider.py | tests/core/providers/test_testrpc_provider.py | import pytest
from web3.manager import (
RequestManager,
)
from web3.providers.tester import (
TestRPCProvider as TheTestRPCProvider,
is_testrpc_available,
)
from web3.utils.compat import socket
def get_open_port():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("", 0))
s.liste... | import pytest
from web3.manager import (
RequestManager,
)
from web3.providers.tester import (
TestRPCProvider,
is_testrpc_available,
)
from web3.utils.compat import socket
def get_open_port():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("", 0))
s.listen(1)
port = s.gets... | mit | Python |
6810a4c1e5748787b2635d6e807e163b21f436b2 | make test swift_library testonly | envoyproxy/envoy-mobile,envoyproxy/envoy-mobile,envoyproxy/envoy-mobile,envoyproxy/envoy-mobile,envoyproxy/envoy-mobile,envoyproxy/envoy-mobile,envoyproxy/envoy-mobile,envoyproxy/envoy-mobile,envoyproxy/envoy-mobile | bazel/apple_test.bzl | bazel/apple_test.bzl | load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test")
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
load("@rules_cc//cc:defs.bzl", "objc_library")
load("//bazel:config.bzl", "MINIMUM_IOS_VERSION")
# Macro providing a way to easily/consistently define Swift unit test targets.
#
# - Preve... | load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test")
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
load("@rules_cc//cc:defs.bzl", "objc_library")
load("//bazel:config.bzl", "MINIMUM_IOS_VERSION")
# Macro providing a way to easily/consistently define Swift unit test targets.
#
# - Preve... | apache-2.0 | Python |
c236acb0f785e1e9f4d7ab4d09a279e6e6ac6b6c | fix MockPG setting results | CanopyTax/asyncpgsa | asyncpgsa/testing/mockpgsingleton.py | asyncpgsa/testing/mockpgsingleton.py | from asyncio import Queue
from asyncpgsa.connection import compile_query
from asyncpgsa.pgsingleton import CursorInterface
from asyncpgsa.connection import SAConnection
from .mockpool import MockSAPool
from .mockconnection import MockConnection
class MockPG:
def __init__(self):
self.connection = SAConn... | from asyncio import Queue
from asyncpgsa.connection import compile_query
from asyncpgsa.pgsingleton import CursorInterface
from asyncpgsa.connection import SAConnection
from .mockpool import MockSAPool
from .mockconnection import MockConnection
class MockPG:
def __init__(self):
self.connection = SAConn... | apache-2.0 | Python |
dba9dee4de67b343875d98ba910775daaf5ad727 | remove sentry url | praekelt/ummeli,praekelt/ummeli,praekelt/ummeli | ummeli/providers/urls.py | ummeli/providers/urls.py | from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
from ummeli.providers import views
from ummeli.opportunities.models import Campaign, MicroTask
from ummeli.providers.views import *
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admi... | from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
from ummeli.providers import views
from ummeli.opportunities.models import Campaign, MicroTask
from ummeli.providers.views import *
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admi... | bsd-3-clause | Python |
031fab97ddd0041d8d789ca03577cc2f1d31f201 | Add default 404 handler | afh/yabab | yabab/__init__.py | yabab/__init__.py | # -*- coding: utf-8 -*-
"""
yabab
~~~~~
A backend bankding API for the fictional YaBaB Savings Bank.
:copyright: (c) 2016 Alexis Hildebrandt
:license: MIT, see LICENSE for more details.
"""
__author__ = "Alexis Hildebrandt"
__version__ = "0.0.1"
__license__ = "MIT"
__copyright__ = "Copyright 201... | # -*- coding: utf-8 -*-
"""
yabab
~~~~~
A backend bankding API for the fictional YaBaB Savings Bank.
:copyright: (c) 2016 Alexis Hildebrandt
:license: MIT, see LICENSE for more details.
"""
__author__ = "Alexis Hildebrandt"
__version__ = "0.0.1"
__license__ = "MIT"
__copyright__ = "Copyright 201... | mit | Python |
0c131399b0b736f4b556504d73d02e34eff1efd3 | Set version to 0.1.0b4 | gnotaras/django-taggit-autocomplete-modified,onepercentclub/django-taggit-autocomplete-modified,gnotaras/django-taggit-autocomplete-modified | src/taggit_autocomplete_modified/__init__.py | src/taggit_autocomplete_modified/__init__.py | # -*- coding: utf-8 -*-
#
# This file is part of django-taggit-autocomplete-modified.
#
# django-taggit-autocomplete-modified provides autocomplete functionality
# to the tags form field of django-taggit.
#
# Development Web Site:
# - http://www.codetrax.org/projects/django-taggit-autocomplete-modified
# Public... | # -*- coding: utf-8 -*-
#
# This file is part of django-taggit-autocomplete-modified.
#
# django-taggit-autocomplete-modified provides autocomplete functionality
# to the tags form field of django-taggit.
#
# Development Web Site:
# - http://www.codetrax.org/projects/django-taggit-autocomplete-modified
# Public... | apache-2.0 | Python |
5abbe08cf4a4bf104365770b16e43e5c0a3ecee2 | Fix broken root URL | afh/yabab | yabab/__init__.py | yabab/__init__.py | # -*- coding: utf-8 -*-
"""
yabab
~~~~~
A backend bankding API for the fictional YaBaB Savings Bank.
:copyright: (c) 2016 Alexis Hildebrandt
:license: MIT, see LICENSE for more details.
"""
__author__ = "Alexis Hildebrandt"
__version__ = "0.0.1"
__license__ = "MIT"
__copyright__ = "Copyright 201... | # -*- coding: utf-8 -*-
"""
yabab
~~~~~
A backend bankding API for the fictional YaBaB Savings Bank.
:copyright: (c) 2016 Alexis Hildebrandt
:license: MIT, see LICENSE for more details.
"""
__author__ = "Alexis Hildebrandt"
__version__ = "0.0.1"
__license__ = "MIT"
__copyright__ = "Copyright 201... | mit | Python |
56d9de7309c8febd90416cf8017862684a0272af | Bump version | mishbahr/django-usersettings2,mishbahr/django-usersettings2 | usersettings/__init__.py | usersettings/__init__.py | __version__ = '0.1.5'
default_app_config = 'usersettings.apps.UserSettingsConfig'
| __version__ = '0.1.4'
default_app_config = 'usersettings.apps.UserSettingsConfig'
| bsd-3-clause | Python |
f6ae073b449d3639d2e5b29bbd45dcfb60511e38 | clean unused imports [nfc] | simbuerg/benchbuild,simbuerg/benchbuild | benchbuild/driver.py | benchbuild/driver.py | #!/usr/bin/env python3
import logging
from benchbuild import settings
from benchbuild.utils import log
from plumbum import cli
class PollyProfiling(cli.Application):
""" Frontend for running/building the benchbuild study framework """
VERSION = settings.CFG["version"].value()
_list_env = False
verbo... | #!/usr/bin/env python3
import logging
import os
import sys
from benchbuild import settings
from benchbuild.utils import log
from plumbum.machines.local import LocalEnv
from plumbum import cli, local
class PollyProfiling(cli.Application):
""" Frontend for running/building the benchbuild study framework """
VE... | mit | Python |
b3f4ecfebeec127e4404f9b54794ee45264a0c5e | Remove old code. | pkulev/xoinvader,pankshok/xoinvader | xoinvader/game.py | xoinvader/game.py | #! /usr/bin/env python3
"""Main XOInvader module, that is entry point to game.
Prepare environment for starting game and start it."""
import curses
from xoinvader.menu import MainMenuState
from xoinvader.ingame import InGameState
from xoinvader.render import Renderer
from xoinvader.common import Settings
from xoin... | #! /usr/bin/env python3
"""Main XOInvader module, that is entry point to game.
Prepare environment for starting game and start it."""
import curses
from xoinvader.menu import MainMenuState
from xoinvader.ingame import InGameState
from xoinvader.render import Renderer
from xoinvader.common import Settings
from xoin... | mit | Python |
17e26fa55e70de657d52e340cb6b66691310a663 | Fix checkboxes inform and involved | citizenline/citizenline,citizenline/citizenline,citizenline/citizenline,citizenline/citizenline | bettertexts/forms.py | bettertexts/forms.py | from django_comments.forms import CommentForm
from django import forms
from django.utils.translation import ugettext_lazy as _
from bettertexts.models import TextComment
class TextCommentForm(CommentForm):
def __init__(self, *args, **kwargs):
super(TextCommentForm, self).__init__(*args, **kwargs)
... | from django_comments.forms import CommentForm
from django import forms
from django.utils.translation import ugettext_lazy as _
from bettertexts.models import TextComment
class TextCommentForm(CommentForm):
def __init__(self, *args, **kwargs):
super(TextCommentForm, self).__init__(*args, **kwargs)
... | mit | Python |
f61305213f185a8f259b920f0ea894c6da21d285 | Edit errors.py | techbureau/zaifbot,techbureau/zaifbot | zaifbot/errors.py | zaifbot/errors.py | class ZaifBotError(Exception):
def __init__(self, message):
self.message = message
def __str__(self):
return str(self.message)
class InvalidRequest(ZaifBotError):
status_code = 400
def __init__(self, message, status_code=None, payload=None):
super().__init__(message)
... | class ZaifBotError(Exception):
def __init__(self, message):
self._message = message
def __str__(self):
return str(self._message)
# fixme: inherit from zaifboterror
class InvalidRequest(Exception):
status_code = 400
def __init__(self, message, status_code=None, payload=None):
... | mit | Python |
a473e54f5643483efc490f6362f0fca6fcf0c5bd | Check Python version upon import | scoates/Zappa,pjz/Zappa,mathom/Zappa,Miserlou/Zappa,anush0247/Zappa,Miserlou/Zappa,mathom/Zappa,scoates/Zappa,pjz/Zappa,anush0247/Zappa | zappa/__init__.py | zappa/__init__.py |
import sys
SUPPORTED_VERSIONS = [(2, 7), (3, 6)]
python_major_version = sys.version_info[0]
python_minor_version = sys.version_info[1]
if (python_major_version, python_minor_version) not in SUPPORTED_VERSIONS:
formatted_supported_versions = ['{}.{}'.format(mav, miv) for mav, miv in SUPPORTED_VERSIONS]
err_m... | mit | Python | |
0daa8ad9e7ce31e61dd00ac81c809a5968dd555b | update version code | 7sDream/zhihu-py3 | zhihu/__init__.py | zhihu/__init__.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = '7sDream'
__version__ = '0.3.9'
from .client import ZhihuClient
from .question import Question
from .author import Author
from .activity import Activity
from .acttype import ActType
from .answer import Answer
from .collection import Collection
from .column i... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = '7sDream'
__version__ = '0.3.8'
from .client import ZhihuClient
from .question import Question
from .author import Author
from .activity import Activity
from .acttype import ActType
from .answer import Answer
from .collection import Collection
from .column i... | mit | Python |
935ca2ddce3efc3ca378159b5337466f59bf0371 | remove test server and add updateCloundFrontWellKnown to all command | sethryder/certman | certman.py | certman.py | #!/usr/bin/python -W ignore::DeprecationWarning
import getopt, sys
from helpers import *
from cloudfront import *
from certbot import *
config_file = "/etc/certman.conf"
config = loadConfig(config_file)
domain_objects = loadDomainConfigs(config['domain_config_directory'])
def certbot():
ran = False
try:
... | #!/usr/bin/python -W ignore::DeprecationWarning
import getopt, sys
from helpers import *
from cloudfront import *
from certbot import *
config_file = "/etc/certman.conf"
config = loadConfig(config_file)
domain_objects = loadDomainConfigs(config['domain_config_directory'])
def certbot():
ran = False
try:
... | mit | Python |
91b74ade3f2cf99e6e82bb4bf9cd39af7ac36747 | Add Bindings.__getitem__ | mwilliamson/zuice | zuice/__init__.py | zuice/__init__.py | class Bindings(object):
def __init__(self):
self._bindings = {}
def bind(self, key):
if isinstance(key, basestring):
return self.bind_name(key)
if isinstance(key, type):
return self.bind_type(key)
raise InvalidBindingException
def bind_type(s... | class Bindings(object):
def __init__(self):
self.bindings = {}
def bind(self, key):
if isinstance(key, basestring):
return self.bind_name(key)
if isinstance(key, type):
return self.bind_type(key)
raise InvalidBindingException
def bind_type(se... | bsd-2-clause | Python |
64ce45728c19c1058196dd64b19b2d10b7af42a3 | Fix error in record_input_test due python2 vs 3 difference in writing strings. Change: 144786198 | benoitsteiner/tensorflow-xsmm,Xeralux/tensorflow,seanli9jan/tensorflow,aldian/tensorflow,jhaux/tensorflow,dongjoon-hyun/tensorflow,sandeepgupta2k4/tensorflow,sandeepgupta2k4/tensorflow,lukeiwanski/tensorflow,kchodorow/tensorflow,zasdfgbnm/tensorflow,xzturn/tensorflow,av8ramit/tensorflow,meteorcloudy/tensorflow,Bismarrc... | tensorflow/python/kernel_tests/record_input_test.py | tensorflow/python/kernel_tests/record_input_test.py | # Copyright 2016 The TensorFlow 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/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2016 The TensorFlow 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/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 | Python |
97c1311144e802560a39d4ef92826548f28666e5 | Fix expected results of get_colour tests | thetestpeople/Geist,kebarr/Geist | geist_tests/test_viewer.py | geist_tests/test_viewer.py | import unittest
import numpy as np
from geist import GUI, BinaryRegionFinder, Location, DirectoryRepo
from geist.backends.fake import GeistFakeBackend
from geist.pyplot import Viewer
class TestViewer(unittest.TestCase):
def setUp(self):
self.repo = DirectoryRepo('test_repo')
self.gui = GUI(GeistFa... | import unittest
import numpy as np
from geist import GUI, BinaryRegionFinder, Location, DirectoryRepo
from geist.backends.fake import GeistFakeBackend
from geist.pyplot import Viewer
class TestViewer(unittest.TestCase):
def setUp(self):
self.repo = DirectoryRepo('test_repo')
self.gui = GUI(GeistFak... | mit | Python |
ab548bbf96265377327398656480dce3bf1fb2f6 | Fix merge conflict | vortexntnu/rov-control,vortexntnu/rov-control,vortexntnu/rov-control | bluetooth/scripts/hc-05_interface.py | bluetooth/scripts/hc-05_interface.py | #!/usr/bin/env python
import rospy
import serial
import Adafruit_BBIO.UART as UART
from vortex_msgs.msg import ContainerID
SPIN_RATE = 10
class Hc05InterfaceNode(object):
def __init__(self):
rospy.init_node('bluetooth_node')
self.port = "/dev/ttyO4"
self.init_serial()
self.init_pub... | #!/usr/bin/env python
import rospy
import serial
import Adafruit_BBIO.UART as UART
from vortex_msgs.msg import ContainerID
SPIN_RATE = 10
class Hc05InterfaceNode(object):
def __init__(self):
rospy.init_node('bluetooth_node')
self.port = "/dev/ttyO4"
self.init_serial()
self.init_pub... | mit | Python |
1f864e0407825f03fb247c3f8a0a1579e1e06580 | Remove conflicts with account_payment_extension; it is deprecated. | abstract-open-solutions/account-payment,Endika/account-payment,VitalPet/account-payment,jesusVMayor/account-payment,jbq/account-payment,alanljj/account-payment,Antiun/account-payment,open-synergy/account-payment,Eficent/account-payment,incaser/account-payment,Vauxoo/account-payment | account_due_list/__openerp__.py | account_due_list/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
# Copyright (C) 2011-2013 Agile Business Group sagl
# (<http://www.agilebg.com>)
# @author Jordi Esteve <jesteve@zikzakmedia.com>
# @autho... | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
# Copyright (C) 2011-2013 Agile Business Group sagl
# (<http://www.agilebg.com>)
# @author Jordi Esteve <jesteve@zikzakmedia.com>
# @autho... | agpl-3.0 | Python |
c60ed521a2aac029114ce8ca385590325d38c6db | increase max number of fundraisers to 10 CLUB-1348 | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle | bluebottle/bb_fundraisers/views.py | bluebottle/bb_fundraisers/views.py | from django.db.models.aggregates import Max
from django.http import Http404
from django.utils.translation import ugettext_lazy as _
from bluebottle.bluebottle_drf2.views import RetrieveUpdateDeleteAPIView, ListCreateAPIView
from rest_framework import permissions, exceptions
from bluebottle.utils.serializer_dispatcher... | from django.db.models.aggregates import Max
from django.http import Http404
from django.utils.translation import ugettext_lazy as _
from bluebottle.bluebottle_drf2.views import RetrieveUpdateDeleteAPIView, ListCreateAPIView
from rest_framework import permissions, exceptions
from bluebottle.utils.serializer_dispatcher... | bsd-3-clause | Python |
b554a6731dea1093167d142774ff9be4eb87baef | Fix regular expression | nuagenetworks/monolithe,little-dude/monolithe,nuagenetworks/monolithe,nuagenetworks/monolithe,little-dude/monolithe,little-dude/monolithe | generator/src/lib/utils.py | generator/src/lib/utils.py | # -*- coding: utf-8 -*-
import re
from printer import Printer
class Utils(object):
""" utils """
@classmethod
def get_python_name(cls, name):
""" Transform a given name to python name """
first_cap_re = re.compile('(.)([A-Z](?!s[A-Z])[a-z]+)')
all_cap_re = re.compile('([a-z0-9])... | # -*- coding: utf-8 -*-
import re
from printer import Printer
class Utils(object):
""" utils """
@classmethod
def get_python_name(cls, name):
""" Transform a given name to python name """
first_cap_re = re.compile('([a-zA-Z0-9]{2,})([A-Z](?!s[A-Z])[a-z]+)')
all_cap_re = re.compi... | bsd-3-clause | Python |
b73dbdb10ed4b2a7e14c4a798512ab664c219d02 | Disable SeLoger backend | Phyks/Flatisfy,Phyks/Flatisfy,Phyks/Flatisfy,Phyks/Flatisfy | flatisfy/constants.py | flatisfy/constants.py | # coding: utf-8
"""
Constants used across the app.
"""
from __future__ import absolute_import, print_function, unicode_literals
from enum import Enum
# Some backends give more infos than others. Here is the precedence we want to
# use. First is most important one, last is the one that will always be
# considered as l... | # coding: utf-8
"""
Constants used across the app.
"""
from __future__ import absolute_import, print_function, unicode_literals
from enum import Enum
# Some backends give more infos than others. Here is the precedence we want to
# use. First is most important one, last is the one that will always be
# considered as l... | mit | Python |
3964fe92e2a7ee35639a404215c2fabd13918106 | Add test for monotone_fn_inverter | huongttlan/statsmodels,phobson/statsmodels,bsipocz/statsmodels,jstoxrocky/statsmodels,bashtage/statsmodels,edhuckle/statsmodels,detrout/debian-statsmodels,astocko/statsmodels,wdurhamh/statsmodels,wwf5067/statsmodels,wkfwkf/statsmodels,bert9bert/statsmodels,gef756/statsmodels,alekz112/statsmodels,yarikoptic/pystatsmodel... | statsmodels/distributions/tests/test_ecdf.py | statsmodels/distributions/tests/test_ecdf.py | import numpy as np
import numpy.testing as npt
from statsmodels.distributions import StepFunction, monotone_fn_inverter
class TestDistributions(npt.TestCase):
def test_StepFunction(self):
x = np.arange(20)
y = np.arange(20)
f = StepFunction(x, y)
npt.assert_almost_equal(f( np.array... | import numpy as np
import numpy.testing as npt
from statsmodels.distributions import StepFunction
class TestDistributions(npt.TestCase):
def test_StepFunction(self):
x = np.arange(20)
y = np.arange(20)
f = StepFunction(x, y)
npt.assert_almost_equal(f( np.array([[3.2,4.5],[24,-3.1],... | bsd-3-clause | Python |
879da270aa7a628012b7e2e7fe1839bec728cc1c | update version v2.0.0alpha | cdr-stats/cdr-stats,cdr-stats/cdr-stats,cdr-stats/cdr-stats,Star2Billing/cdr-stats,Star2Billing/cdr-stats,cdr-stats/cdr-stats,Star2Billing/cdr-stats,areski/cdr-stats,Star2Billing/cdr-stats,areski/cdr-stats,areski/cdr-stats,areski/cdr-stats | cdr_stats/__init__.py | cdr_stats/__init__.py | # -*- coding: utf-8 -*-
#
# CDR-Stats License
# http://www.cdr-stats.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2012 Star2Billing S.L.... | # -*- coding: utf-8 -*-
#
# CDR-Stats License
# http://www.cdr-stats.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2012 Star2Billing S.L.... | mpl-2.0 | Python |
df788e5ef35bbb85a704a9340d94f52bfcaa7982 | Fix pep8 | cloudcomputinghust/CAL | cal/tests/unit/test_client.py | cal/tests/unit/test_client.py | import mock
from cal import client
from cal import exceptions
from cal.tests.base import TestCase
# from cal.v1.network import client as network_client
class TestClient(TestCase):
@mock.patch.object(client, 'Client')
def setUp(self, mock_client):
super(TestClient, self).setUp()
self.mock_cli... | import mock
from cal import client
from cal import exceptions
from cal.tests.base import TestCase
from cal.v1.network import client as network_client
class TestClient(TestCase):
@mock.patch.object(client, 'Client')
def setUp(self, mock_client):
super(TestClient, self).setUp()
self.mock_clien... | apache-2.0 | Python |
3fdb73fa39c22f96bfd46a0b1a48caa9edcfa91c | Make callback an optional argument. If callback not specified, events will be queued and can be read by calling read_events(). | shaurz/fsmonitor | fsmonitor/__init__.py | fsmonitor/__init__.py | import sys
import threading
from .common import *
# set to None when unloaded
module_loaded = True
if sys.platform == "linux2":
from .linux import FSMonitor
elif sys.platform == "win32":
from .win32 import FSMonitor
else:
raise ImportError("Unsupported platform: %s" % sys.platform)
class FSMonitorThread(... | import sys
from threading import Thread
from .common import *
# set to None when unloaded
module_loaded = True
if sys.platform == "linux2":
from .linux import FSMonitor
elif sys.platform == "win32":
from .win32 import FSMonitor
else:
raise ImportError("Unsupported platform: %s" % sys.platform)
class FSMo... | mit | Python |
6de4f45b36fc149dd0223e4b2b2cae927bf4b5f2 | bump the version to 0.0.2 | ceph/chacractl,alfredodeza/chacractl | chacractl/__init__.py | chacractl/__init__.py | config = {'verbosity': 'info'}
__version__ = '0.0.2'
| config = {'verbosity': 'info'}
__version__ = '0.0.1'
| mit | Python |
455ad9958033e5fb42478213a8eee1508cb59c38 | Fix variable naming | OmniLayer/omniwallet,VukDukic/omniwallet,habibmasuro/omniwallet,achamely/omniwallet,achamely/omniwallet,Nevtep/omniwallet,OmniLayer/omniwallet,habibmasuro/omniwallet,OmniLayer/omniwallet,VukDukic/omniwallet,achamely/omniwallet,habibmasuro/omniwallet,Nevtep/omniwallet,OmniLayer/omniwallet,habibmasuro/omniwallet,achamely... | api/armory_service.py | api/armory_service.py | import urlparse
import os, sys, re, random,pybitcointools, bitcoinrpc, math
from decimal import Decimal
from flask import Flask, request, jsonify, abort, json, make_response
from msc_apps import *
tools_dir = os.environ.get('TOOLSDIR')
lib_path = os.path.abspath(tools_dir)
sys.path.append(lib_path)
data_dir_root = os.e... | import urlparse
import os, sys, re, random,pybitcointools, bitcoinrpc, math
from decimal import Decimal
from flask import Flask, request, jsonify, abort, json, make_response
from msc_apps import *
tools_dir = os.environ.get('TOOLSDIR')
lib_path = os.path.abspath(tools_dir)
sys.path.append(lib_path)
data_dir_root = os.e... | agpl-3.0 | Python |
f66b1e12bc0be01f2c5e7a5e15e39305371707a9 | Make passthrough.py doctests pass under Python 3 | nmbooker/python-funbox,nmbooker/python-funbox | funbox/passthrough.py | funbox/passthrough.py | #! /usr/bin/env python
"""Provides ways of applying certain values through a function, while leaving others unchanged.
Say you want to convert a list of strings to uppercase, but some entries might
be None for whatever reason, but you want to keep those None values.
Here's a function that converts a string to upperc... | #! /usr/bin/env python
"""Provides ways of applying certain values through a function, while leaving others unchanged.
Say you want to convert a list of strings to uppercase, but some entries might
be None for whatever reason, but you want to keep those None values.
Here's a function that converts a string to upperc... | mit | Python |
adfbe71b1bb5a91279888bb68d9f05c0beeef074 | Add python bindings to libxslt (#10149) | iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/libxslt/package.py | var/spack/repos/builtin/packages/libxslt/package.py | # Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libxslt(AutotoolsPackage):
"""Libxslt is the XSLT C library developed for the GNOME projec... | # Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libxslt(AutotoolsPackage):
"""Libxslt is the XSLT C library developed for the GNOME projec... | lgpl-2.1 | Python |
47d74f3bca4e6f8d77a71832f896d2885662dd69 | Add 1.5.4 (#9737) | LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/pkgconf/package.py | var/spack/repos/builtin/packages/pkgconf/package.py | # Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Pkgconf(AutotoolsPackage):
"""pkgconf is a program which helps to configure compiler and l... | # Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Pkgconf(AutotoolsPackage):
"""pkgconf is a program which helps to configure compiler and l... | lgpl-2.1 | Python |
1d8d975721127693e4d639a3b800a165e1aef6a5 | Apply requested fix from #27643 (#27672) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-yarl/package.py | var/spack/repos/builtin/packages/py-yarl/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyYarl(PythonPackage):
"""The module provides handy URL class for URL parsing and changing."""
homepage = ... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyYarl(PythonPackage):
"""The module provides handy URL class for URL parsing and changing."""
homepage = ... | lgpl-2.1 | Python |
7759c424f05c8eda9b43625828e12f43db07df35 | Add num_items to tags api endpoint. | tom-henderson/bookmarks,tom-henderson/bookmarks,tom-henderson/bookmarks | bookmarks/api/api.py | bookmarks/api/api.py | from rest_framework import serializers
from rest_framework.generics import ListAPIView
from taggit_serializer.serializers import (TagListSerializerField,
TaggitSerializer)
from django.db.models import Count
from core.models import Bookmark
from taggit.models import Tag
class... | from rest_framework import serializers
from rest_framework.generics import ListAPIView
from taggit_serializer.serializers import (TagListSerializerField,
TaggitSerializer)
from core.models import Bookmark
from taggit.models import Tag
class BookmarkSerializer(TaggitSerializ... | mit | Python |
175f753f0009d5846a1d3a71b8fffe5faa985157 | add --verbose option | GhostLyrics/collection | boot-into-windows.py | boot-into-windows.py | #!/usr/bin/env python
"""
Boot into your Windows partition on next reboot.
Requires `GRUB_DEFAULT=saved` to be present in `/etc/default/grub`.
After changes to said file `(sudo) update-grub` must be run once.
"""
import argparse
import subprocess
def main():
"""Boot into your Windows partition on next reboot."... | #!/usr/bin/env python
"""
Boot into your Windows partition on next reboot.
Requires `GRUB_DEFAULT=saved` to be present in `/etc/default/grub`.
After changes to said file `(sudo) update-grub` must be run once.
"""
import subprocess
def main():
"""Boot into your Windows partition on next reboot."""
entries ... | mit | Python |
ff6515b5a33d9b0fdf74140e5e9b8bdf406f05ea | Remove `requests` from blacklist of minimal install test (#20584) | ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray | ci/travis/check_minimal_install.py | ci/travis/check_minimal_install.py | """
This script ensures that some dependencies are _not_ installed in the
current python environment.
This is to ensure that tests with minimal dependencies are not tainted
by too many installed packages.
"""
from typing import List
# These are taken from `setup.py` for ray[default]
DEFAULT_BLACKLIST = [
"aiohtt... | """
This script ensures that some dependencies are _not_ installed in the
current python environment.
This is to ensure that tests with minimal dependencies are not tainted
by too many installed packages.
"""
from typing import List
# These are taken from `setup.py` for ray[default]
DEFAULT_BLACKLIST = [
"aiohtt... | apache-2.0 | Python |
57cdd9cf57c8541fe8bd7b95def11a63a73bd14b | Refactor field_value to be a bit clearer | masschallenge/impact-api,masschallenge/impact-api,masschallenge/impact-api,masschallenge/impact-api | web/impact/impact/v1/helpers/organization_helper.py | web/impact/impact/v1/helpers/organization_helper.py | from impact.models import Organization
from impact.v1.helpers.model_helper import ModelHelper
class OrganizationHelper(ModelHelper):
MODEL = Organization
REQUIRED_KEYS = [
"name",
"url_slug",
]
OPTIONAL_KEYS = [
"additional_industry_ids",
"date_founded",
"f... | from impact.models import Organization
from impact.v1.helpers.model_helper import ModelHelper
class OrganizationHelper(ModelHelper):
MODEL = Organization
REQUIRED_KEYS = [
"name",
"url_slug",
]
OPTIONAL_KEYS = [
"additional_industry_ids",
"date_founded",
"f... | mit | Python |
bc044a035c3883d407188288d943909202fd721a | Update version.py | SciLifeLab/genologics | genologics/version.py | genologics/version.py | __version__="0.4.6"
| __version__="0.4.5"
| mit | Python |
70073edf20c31e23130cbdf1d51cb21bc762e98a | Change NetProtections timeout value to 20 | mociepka/saleor,mociepka/saleor,mociepka/saleor | saleor/payment/gateways/np_atobarai/const.py | saleor/payment/gateways/np_atobarai/const.py | # This integration is currently supporting the settlement type 02 - NP Atobarai
NP_ATOBARAI = "02"
NP_ATOBARAI_WIZ = "03"
REQUEST_TIMEOUT = 20
NP_PLUGIN_ID = "saleor.payments.np-atobarai"
NP_TEST_URL = "https://ctcp.np-payment-gateway.com/v1"
NP_URL = "https://cp.np-payment-gateway.com/v1"
MERCHANT_CODE = "merchant... | # This integration is currently supporting the settlement type 02 - NP Atobarai
NP_ATOBARAI = "02"
NP_ATOBARAI_WIZ = "03"
REQUEST_TIMEOUT = 30
NP_PLUGIN_ID = "saleor.payments.np-atobarai"
NP_TEST_URL = "https://ctcp.np-payment-gateway.com/v1"
NP_URL = "https://cp.np-payment-gateway.com/v1"
MERCHANT_CODE = "merchant... | bsd-3-clause | Python |
3ae44e3b9a96fb8eed87fdca23a0e447f3a2a1a9 | fix py-dcm2nii thread timeout | gakarak/BTBDB_ImageAnalysisSubPortal,gakarak/BTBDB_ImageAnalysisSubPortal,gakarak/BTBDB_ImageAnalysisSubPortal,gakarak/BTBDB_ImageAnalysisSubPortal | app/core/utils/cmd.py | app/core/utils/cmd.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ar'
import os
import glob
import shutil
import tempfile
import subprocess
import threading
from . import checkDirContainsDicom, checkExeInPath, checkFileOrDir
#####################################
class CommandRunner(object):
def __init__(self, cmd):
... | #!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ar'
import os
import glob
import shutil
import tempfile
import subprocess
import threading
from . import checkDirContainsDicom, checkExeInPath, checkFileOrDir
#####################################
class CommandRunner(object):
def __init__(self, cmd):
... | apache-2.0 | Python |
d62156faf0789f4c8b745b138dc24a063d3d04a9 | use server cert in additional_trust_anchors | nwjs/nw.js,nwjs/nw.js,nwjs/nw.js,nwjs/nw.js,nwjs/nw.js,nwjs/nw.js | test/sanity/additional_trust_anchors/test.py | test/sanity/additional_trust_anchors/test.py | import time
import os
import subprocess
import platform
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common import utils
chrome_options = Options()
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__)))
chrome_options.add_expe... | import time
import os
import subprocess
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common import utils
chrome_options = Options()
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__)))
chrome_options.add_experimental_option(... | mit | Python |
aaaa0fc7060dbdf1522e48011902edb15b3a4965 | add the statement indicating the code is not right in this moment | Celthi/Algorithm,Celthi/MY-_CLRS | hihocoder/danCiFanZhuan.py | hihocoder/danCiFanZhuan.py | __author__ = 'celhipc'
## The code is wrong, I update it inoder to test some function and corret it in the future
def reverseStr(string):
string = '[::-1]'
return string
def reWords(s):
i = 0
j = 0
state = False
while i < len(s):
j = i
while i < (len(s) - 1) and s[... | __author__ = 'celhipc'
def reverseStr(string):
string = '[::-1]'
return string
def reWords(s):
i = 0
j = 0
state = False
while i < len(s):
j = i
while i < (len(s) - 1) and s[i].isspace():
i += 1
j = i
while j < (len(s) - 1) and s... | apache-2.0 | Python |
3964632da10bf63ba2e34fca2dc36fbba3c00f9c | Bump version | vmalloc/gossip | gossip/__version__.py | gossip/__version__.py | __version__ = '2.1.1'
| __version__ = "2.1.0"
| bsd-3-clause | Python |
e364376ff4a7e3d43134996865f27a2852af2e56 | fix mode display for auto | pannal/Subliminal.bundle,pannal/Subliminal.bundle,pannal/Subliminal.bundle | Contents/Libraries/Shared/subzero/history_storage.py | Contents/Libraries/Shared/subzero/history_storage.py | # coding=utf-8
import datetime
from subzero.lib.dict import DictProxy
mode_map = {
"a": "auto",
"m": "manual",
"b": "auto-better"
}
class SubtitleHistoryItem(object):
item_title = None
section_title = None
rating_key = None
subtitle = None
time = None
mode = "a"
def __init... | # coding=utf-8
import datetime
from subzero.lib.dict import DictProxy
mode_map = {
"a": "auto",
"m": "manual",
"b": "auto-better"
}
class SubtitleHistoryItem(object):
item_title = None
section_title = None
rating_key = None
subtitle = None
time = None
mode = "a"
def __init... | mit | Python |
ee66811628ea81e0540816e012c71d90457cc933 | Add explicit example filtering based on the byte length of the content | Stvad/CrowdAnki,Stvad/CrowdAnki,Stvad/CrowdAnki | test/utils/filesystem/name_sanitizer_spec.py | test/utils/filesystem/name_sanitizer_spec.py | from tempfile import TemporaryDirectory
from expects import expect
from hypothesis import given, assume, example
from hypothesis.strategies import text, characters
from mamba import description, it
from pathlib import Path
from crowd_anki.utils.filesystem.name_sanitizer import sanitize_anki_deck_name, \
invalid_f... | from tempfile import TemporaryDirectory
from expects import expect
from hypothesis import given, assume, example
from hypothesis.strategies import text, characters
from mamba import description, it
from pathlib import Path
from crowd_anki.utils.filesystem.name_sanitizer import sanitize_anki_deck_name, \
invalid_f... | mit | Python |
6917bbc4abd1c7444052d218e6bf9c5f8308e028 | add date | statsmodels/statsmodels,kiyoto/statsmodels,wwf5067/statsmodels,bzero/statsmodels,yarikoptic/pystatsmodels,gef756/statsmodels,musically-ut/statsmodels,ChadFulton/statsmodels,DonBeo/statsmodels,YihaoLu/statsmodels,bsipocz/statsmodels,yarikoptic/pystatsmodels,DonBeo/statsmodels,wzbozon/statsmodels,wdurhamh/statsmodels,bav... | statsmodels/datasets/engel/data.py | statsmodels/datasets/engel/data.py | #! /usr/bin/env python
"""Name of dataset."""
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain."""
TITLE = """Engel (1857) food expenditure data"""
SOURCE = """
This dataset was used in Koenker and Bassett (1982) and distributed alongside
the ``quantreg`` package for R.
Koenker, ... | #! /usr/bin/env python
"""Name of dataset."""
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain."""
TITLE = """Engel food expenditure data"""
SOURCE = """
This dataset was used in Koenker and Bassett (1982) and distributed alongside
the ``quantreg`` package for R.
Koenker, R. and ... | bsd-3-clause | Python |
c10be759ad2ddbd076a1fe0a887d3cf9325aba3d | Switch to a new command-line interface | prophile/match-scheduler,prophile/match-scheduler | src/scheduler.py | src/scheduler.py | """Match scheduler.
Usage:
scheduler.py full <teams> <matches> [options]
scheduler.py partial <teams> <previous> <matches> [options]
Options:
-w --weight Try to balance out between starting zones.
--zones=<z> Number of start zones [default: 4].
--empty Leave empty spaces to balance out th... | from collections import namedtuple
import sched_utils
import check
ScheduleConfiguration = namedtuple('ScheduleConfiguration',
['zones', 'teams', 'weight_zones',
'round_length', 'imbalance_action',
'match_count']... | mit | Python |
626a8d5efd1cce67189d5e688f8ce4bb3848d8ef | improve conan support | SuperV1234/scelta,SuperV1234/scelta,SuperV1234/scelta | conanfile.py | conanfile.py | from conans import ConanFile, tools, CMake
import os
class SceltaConan(ConanFile):
name = "scelta"
version = "0.1"
url = "https://github.com/SuperV1234/scelta.git"
build_policy = "missing"
settings = "os", "compiler", "build_type", "arch"
def source(self):
self.run("git clone https://g... | from conans import ConanFile, tools, CMake
import os
class SceltaConan(ConanFile):
name = "scelta"
version = "0.1"
url = "https://github.com/SuperV1234/scelta.git"
build_policy = "missing"
settings = "os", "compiler", "build_type", "arch"
def source(self):
self.run("git clone https://g... | mit | Python |
6414c5c113ce103e8eaa39ac00234fb31c204cfc | Bump to v1.9.0 | gisce/sii | sii/__init__.py | sii/__init__.py | # -*- coding: utf-8 -*-
__LIBRARY_VERSION__ = '1.9.0'
__SII_VERSION__ = '1.1'
| # -*- coding: utf-8 -*-
__LIBRARY_VERSION__ = '1.8.8'
__SII_VERSION__ = '1.1'
| mit | Python |
0fd57af7ec09460b64ff1ea0002a53f00cb892d9 | add wiring for the console | uoe-sdp-3b/sdp-project | console.py | console.py | #!/usr/bin/env python
from communication.communications import RobotComms
from ncurses.cursesUI import NcursesUI
class Console():
def __init__(self, port):
self.robot = RobotComms(port)
self.ui = NcursesUI(self.read, self.write)
def start(self):
self.robot.connect()
self.ui.start()
def read(sel... | #!/usr/bin/env python
from communication.communications import RobotComms
from ncurses.cursesUI import NcursesUI
class Console():
def __init__(self, port):
self.robot = RobotComms(port)
self.ui = NcursesUI(self.read, self.write)
def start():
robot.connect()
ui.start()
def read():
return "He... | mit | Python |
7001fba956da695faba96df6d26c77f9bae55e8a | Remove unused import | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | tests/cupy_tests/core_tests/test_function.py | tests/cupy_tests/core_tests/test_function.py | import unittest
import numpy
import cupy
from cupy.cuda import compiler
from cupy import testing
def _compile_func(kernel_name, code):
mod = compiler.compile_with_cache(code)
return mod.get_function(kernel_name)
@testing.gpu
class TestFunction(unittest.TestCase):
def test_python_scalar(self):
... | import unittest
import numpy
import cupy
from cupy.cuda import compiler
from cupy.cuda import function
from cupy import testing
def _compile_func(kernel_name, code):
mod = compiler.compile_with_cache(code)
return mod.get_function(kernel_name)
@testing.gpu
class TestFunction(unittest.TestCase):
def te... | mit | Python |
e04c0af114f394cf489e658335054dfebd5bd39e | Fix #2935: bad method name | sugarlabs/sugar-toolkit,ceibal-tatu/sugar-toolkit-gtk3,tchx84/debian-pkg-sugar-toolkit-gtk3,ceibal-tatu/sugar-toolkit,sugarlabs/sugar-toolkit-gtk3,gusDuarte/sugar-toolkit-gtk3,tchx84/debian-pkg-sugar-toolkit,manuq/sugar-toolkit-gtk3,ceibal-tatu/sugar-toolkit-gtk3,samdroid-apps/sugar-toolkit-gtk3,gusDuarte/sugar-toolkit... | sugar/graphics/toggletoolbutton.py | sugar/graphics/toggletoolbutton.py | # Copyright (C) 2007, Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distrib... | # Copyright (C) 2007, Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distrib... | lgpl-2.1 | Python |
23cc5ec6f48aa93c3d864376c1dbda3de1f7c1d1 | clean up unused import | mattikl/tackle | tackle/reader/formats/csvreader.py | tackle/reader/formats/csvreader.py | import csv
TACKLE_READER_FORMAT = 'csv'
def reader(f):
csv_reader = csv.reader(f)
headers = next(csv_reader)
return [dict(zip(headers, r)) for r in csv_reader]
| import csv
from collections import namedtuple
TACKLE_READER_FORMAT = 'csv'
def reader(f):
csv_reader = csv.reader(f)
headers = next(csv_reader)
return [dict(zip(headers, r)) for r in csv_reader]
| mit | Python |
2d0baf9d1eb5decf8c18193961d99be6398b489a | Fix posts_per_page type conversion | Encrylize/flask-blogger,Encrylize/flask-blogger,Encrylize/flask-blogger | app/utils/settings.py | app/utils/settings.py | from app.models import Setting
class AppSettings(dict):
def __init__(self):
super().__init__()
self.update({setting.name: setting.value for setting in Setting.query.all()})
self.__setitem__('posts_per_page', int(self.__getitem__('posts_per_page')))
def __setitem__(self, key, value):
... | from app.models import Setting
class AppSettings(dict):
def __init__(self):
super().__init__()
self.update({setting.name: setting.value for setting in Setting.query.all()})
def __setitem__(self, key, value):
super().__setitem__(key, value)
setting = Setting.query.filter_by(na... | mit | Python |
2fd1b2a0a1eb45f73e826b06bac06d4d5838c629 | Remove duplicated JS file include | indico/indico,ThiefMaster/indico,indico/indico,mvidalgarcia/indico,OmeGak/indico,pferreir/indico,ThiefMaster/indico,mvidalgarcia/indico,DirkHoffmann/indico,DirkHoffmann/indico,OmeGak/indico,ThiefMaster/indico,DirkHoffmann/indico,OmeGak/indico,indico/indico,DirkHoffmann/indico,pferreir/indico,indico/indico,mic4ael/indic... | indico/modules/vc/views.py | indico/modules/vc/views.py | # This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | # This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | mit | Python |
358e7cfdcb698b51abb410669887f93507f3e8b0 | Update hash_utils.py | Tendrl/commons,r0h4n/commons,rishubhjain/commons | tendrl/commons/utils/hash_utils.py | tendrl/commons/utils/hash_utils.py | import hashlib
import json
def generate_obj_hash(etcd_obj):
try:
etcd_obj.hash = None
except AttributeError:
pass
try:
etcd_obj.updated_at = None
except AttributeError:
pass
# Above items cant be part of hash
_obj_str = "".join(sorted(etcd_obj.json))
ret... | import hashlib
import json
def generate_obj_hash(etcd_obj):
try:
etcd_obj.hash = None
etcd_obj.updated_at = None
except AttributeError:
pass
# Above items cant be part of hash
_obj_str = "".join(sorted(etcd_obj.json))
return hashlib.md5(_obj_str).hexdigest()
| lgpl-2.1 | Python |
63acfcc27fa42ace3c02a41703150b83c8a5b68d | Handle qualified type when getting function signature. | cournape/cython-codegen,cournape/cython-codegen | cytypes.py | cytypes.py | from ctypeslib.codegen import typedesc
def typedef_def(tp):
if not isinstance(tp.typ, typedesc.PointerType):
return "typedef %s %s" % (tp.typ.name, tp.name)
else:
return "typedef %s" % (pointer_decl(tp.typ) % tp.name)
def pointer_decl(tp):
if isinstance(tp.typ, typedesc.FunctionType):
... | from ctypeslib.codegen import typedesc
def typedef_def(tp):
if not isinstance(tp.typ, typedesc.PointerType):
return "typedef %s %s" % (tp.typ.name, tp.name)
else:
return "typedef %s" % (pointer_decl(tp.typ) % tp.name)
def pointer_decl(tp):
if isinstance(tp.typ, typedesc.FunctionType):
... | mit | Python |
da1ca4f6ff418baf11e8754d81d9bc32e000f4be | Handle base36 token | dapeng0802/django-blog-zinnia,aorzh/django-blog-zinnia,petecummings/django-blog-zinnia,petecummings/django-blog-zinnia,bywbilly/django-blog-zinnia,extertioner/django-blog-zinnia,1844144/django-blog-zinnia,1844144/django-blog-zinnia,dapeng0802/django-blog-zinnia,ZuluPro/django-blog-zinnia,Maplecroft/django-blog-zinnia,m... | zinnia/urls/shortlink.py | zinnia/urls/shortlink.py | """Urls for the Zinnia entries short link"""
from django.conf.urls import url
from django.conf.urls import patterns
from zinnia.views.shortlink import EntryShortLink
urlpatterns = patterns(
'',
url(r'^(?P<token>[\da-z]+)/$',
EntryShortLink.as_view(),
name='entry_shortlink'),
)
| """Urls for the Zinnia entries short link"""
from django.conf.urls import url
from django.conf.urls import patterns
from zinnia.views.shortlink import EntryShortLink
urlpatterns = patterns(
'',
url(r'^(?P<pk>\d+)/$',
EntryShortLink.as_view(),
name='entry_shortlink'),
)
| bsd-3-clause | Python |
04872cafb5c2145db4e43a38be6d3f0c7385e480 | Add batch encrypt/decrypt methods (untested) | ehartsuyker/securedrop,heartsucker/securedrop,ageis/securedrop,ageis/securedrop,pwplus/securedrop,chadmiller/securedrop,micahflee/securedrop,micahflee/securedrop,pwplus/securedrop,jeann2013/securedrop,jrosco/securedrop,ehartsuyker/securedrop,jeann2013/securedrop,pwplus/securedrop,micahflee/securedrop,chadmiller/secured... | svs_interface.py | svs_interface.py | #!/usr/bin/env python
import subprocess
from Tkinter import *
from tkFileDialog import *
import os
import datetime
GPG = 'gpg2'
SERVER_KEY = '' # replace with gpg key ID of server key
DECRYPTED_PREFIX = 'decrypted'
class GpgApp(object):
def __init__(self, master):
frame = Frame(master)
frame.pac... | #!/usr/bin/env python
import subprocess
from Tkinter import *
from tkFileDialog import *
import os
GPG = 'gpg2'
SERVER_KEY = '' # replace with gpg key ID of server key
class GpgApp(object):
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.text = Text()
self.tex... | agpl-3.0 | Python |
d8083b3b9bd38e17f6b98847de9177a419efcc78 | Remove print_error | lynxis/testWrt | testWrt/tests/test_generic_node.py | testWrt/tests/test_generic_node.py | #!/usr/bin/env python
from testWrt import testsetup
from testWrt.lib.openwrt_ssh import SSHOpenWrt
KEYFILE = "/home/robin/Documents/42reports/firmware-tools/build/id_42r"
if __name__ == "__main__":
ts = testsetup.create_generic()
device = SSHOpenWrt(hostname="192.168.1.1", password="test")
if device.pin... | #!/usr/bin/env python
from testWrt import testsetup
from testWrt.lib.openwrt_ssh import SSHOpenWrt
KEYFILE = "/home/robin/Documents/42reports/firmware-tools/build/id_42r"
def print_error(msg):
print msg
exit(1)
if __name__ == "__main__":
ts = testsetup.create_generic()
device = SSHOpenWrt(hostname="... | bsd-3-clause | Python |
20ab5bdef07f157f887e931b18c9c3d1dd5283b5 | Add better hypothesis diagnostics | olipratt/swagger-conformance | swaggertester.py | swaggertester.py | import logging
import hypothesis
from client import SwaggerClient
from templates import APITemplate
from strategies import hypothesize_parameters
log = logging.getLogger(__name__)
def validate_schema(schema_path):
"""Fully validate the API defined by the given schema."""
client = SwaggerClient(schema_path... | import logging
import hypothesis
from client import SwaggerClient
from templates import APITemplate
from strategies import hypothesize_parameters
log = logging.getLogger(__name__)
def validate_schema(schema_path):
"""Fully validate the API defined by the given schema."""
client = SwaggerClient(schema_path... | mit | Python |
b10f811217d9f06b60f6c921b04fc7ce0760239c | Handle weakrefs when introspecting apps | sangoma/switchy | switchy/marks.py | switchy/marks.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
Marks for annotating callback functions
"""
from functools import partial
def marker(event_type, cb_type='callback'... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
Marks for annotating callback functions
"""
from functools import partial
def marker(event_type, cb_type='callback'... | mpl-2.0 | Python |
ecd06f371fb83823494b17e341d7c4cf8bf117d0 | Refactor adding subparsers given that all subparsers have a common swift_build_dir arg. | uasys/swift,JaSpa/swift,milseman/swift,harlanhaskins/swift,gregomni/swift,sschiau/swift,austinzheng/swift,xedin/swift,xwu/swift,codestergit/swift,harlanhaskins/swift,huonw/swift,shahmishal/swift,lorentey/swift,deyton/swift,gmilos/swift,sschiau/swift,gregomni/swift,harlanhaskins/swift,shajrawi/swift,stephentyrone/swift,... | utils/bug_reducer/bug_reducer/bug_reducer.py | utils/bug_reducer/bug_reducer/bug_reducer.py | #!/usr/bin/env python
import argparse
import opt_bug_reducer
import random_bug_finder
def add_subparser(subparsers, module, name):
sparser = subparsers.add_parser(name)
sparser.add_argument('swift_build_dir',
help='Path to the swift build directory '
'conta... | #!/usr/bin/env python
import argparse
import opt_bug_reducer
import random_bug_finder
def main():
parser = argparse.ArgumentParser(description="""\
A program for reducing sib/sil crashers""")
subparsers = parser.add_subparsers()
opt_subparser = subparsers.add_parser("opt")
opt_subparser.add_argume... | apache-2.0 | Python |
cbfd59ed77a8da203aa75c54e2f6881ceeec123c | Remove useless shebang | Konubinix/weboob,nojhan/weboob-devel,RouxRC/weboob,franek/weboob,Konubinix/weboob,Konubinix/weboob,sputnick-dev/weboob,RouxRC/weboob,laurent-george/weboob,Boussadia/weboob,frankrousseau/weboob,willprice/weboob,yannrouillard/weboob,Boussadia/weboob,franek/weboob,eirmag/weboob,eirmag/weboob,Boussadia/weboob,franek/weboob... | weboob/applications/qweboobcfg/qweboobcfg.py | weboob/applications/qweboobcfg/qweboobcfg.py | # -*- coding: utf-8 -*-
# vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai
# Copyright(C) 2010-2011 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai
# Copyright(C) 2010-2011 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as p... | agpl-3.0 | Python |
e9726988c5aa7ed93073034665931ede332c1b12 | install in editable mode | rr-/dotfiles,rr-/dotfiles,rr-/dotfiles | cfg/panel/install.py | cfg/panel/install.py | import os
from dotinstall import packages
from dotinstall import util
def run():
packages.try_install('libxkbcommon-x11')
packages.try_install('python-pyqt5')
packages.try_install('qt5-svg')
util.copy_file('./start', '~/.config/x/start-panel.sh')
os.chdir(util.root_dir / 'opt' / 'panel')
uti... | import os
from dotinstall import packages
from dotinstall import util
def run():
packages.try_install('libxkbcommon-x11')
packages.try_install('python-pyqt5')
packages.try_install('qt5-svg')
util.copy_file('./start', '~/.config/x/start-panel.sh')
os.chdir(util.root_dir / 'opt' / 'panel')
uti... | mit | Python |
09d5db535576415794694d2ef48da6e87c0c9bd1 | add empty help text to django commands so they get loaded too | armstrong/armstrong.cli,armstrong/armstrong.cli | armstrong/cli/main.py | armstrong/cli/main.py | from __future__ import with_statement
import os
import sys
import argparse
from .commands.init import init
from .commands.import_wordpress import import_wordpress
from django.core.management import execute_manager, get_commands
# TODO: use logging throughout for output
CWD = os.getcwd()
ENTRY_POINT = 'armstrong.comma... | from __future__ import with_statement
import os
import sys
import argparse
from .commands.init import init
from .commands.import_wordpress import import_wordpress
from django.core.management import execute_manager, get_commands
# TODO: use logging throughout for output
CWD = os.getcwd()
ENTRY_POINT = 'armstrong.comma... | apache-2.0 | Python |
b97a0be7a45ca977442f195b3be1dbc42c12621d | format this file | luispedro/BuildingMachineLearningSystemsWithPython,luispedro/BuildingMachineLearningSystemsWithPython | ch01/gen_webstats.py | ch01/gen_webstats.py | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
# This script generates web traffic data for our hypothetical
# web startup "MLASS" in chapter 01
impo... | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
# This script generates web traffic data for our hypothetical
# web startup "MLASS" in chapter 01
impo... | mit | Python |
f13821b1fdead73d9e2345179b7cc3219372b0cc | Add weight_decay | hvy/chainer,wavelets/chainer,ktnyt/chainer,muupan/chainer,wkentaro/chainer,pfnet/chainer,elviswf/chainer,cupy/cupy,AlpacaDB/chainer,ikasumi/chainer,hvy/chainer,nushio3/chainer,keisuke-umezawa/chainer,jnishi/chainer,ktnyt/chainer,kiyukuta/chainer,truongdq/chainer,sou81821/chainer,cupy/cupy,chainer/chainer,tkerola/chaine... | chainer/optimizer.py | chainer/optimizer.py | import math
import numpy
from pycuda import gpuarray
def _sqnorm(x):
if type(x) == gpuarray.GPUArray:
return float(gpuarray.dot(x, x).get())
x = x.ravel()
return float(x.dot(x))
class Optimizer(object):
"""Optimizers' base class."""
def setup(self, params_grads):
self.tuples = [(p... | import math
import numpy
from pycuda import gpuarray
def _sqnorm(x):
if type(x) == gpuarray.GPUArray:
return float(gpuarray.dot(x, x).get())
x = x.ravel()
return float(x.dot(x))
class Optimizer(object):
"""Optimizers' base class."""
def setup(self, params_grads):
self.tuples = [(p... | mit | Python |
a76427f49865bca184b4995bb1dab7f34a2a0ff4 | add documentation | minlexx/whdbx_web,minlexx/whdbx_web,minlexx/whdbx_web,minlexx/whdbx_web,minlexx/whdbx_web | classes/tr_support.py | classes/tr_support.py | import gettext
import pathlib
from typing import Optional, List
class MultiLangTranslator:
def __init__(self, localesdir: str, domain=None):
self.domain = 'whdbx' # translation domain, for gettext
if domain is not None:
self.domain = domain
self.localesdir = localesdir
... | import gettext
import pathlib
from typing import Optional
class MultiLangTranslator:
def __init__(self, localesdir: str, domain=None):
self.domain = 'whdbx' # translation domain, for gettext
if domain is not None:
self.domain = domain
self.localesdir = localesdir
self.... | mit | Python |
5878e28efab5c5f5446e6a79cfe9b44f99004dcd | Update the version | chargebee/chargebee-python | chargebee/version.py | chargebee/version.py | VERSION = '1.2.6a'
| VERSION = '1.2.6'
| mit | Python |
6769f434646082665b9b06ab8f4b4b61c8a26b45 | Remove unused import from docs config | celery/cell,celery/cell | docs/conf.py | docs/conf.py | # -*- coding: utf-8 -*-
import sys
import os
this = os.path.dirname(os.path.abspath(__file__))
# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
sys.path.append(os.path.join(os.pardir, "tes... | # -*- coding: utf-8 -*-
import sys
import os
this = os.path.dirname(os.path.abspath(__file__))
# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
sys.path.append(os.path.join(os.pardir, "tes... | bsd-3-clause | Python |
6913061b358c11685b6aab4b4c8ef3ee23e81feb | Fix for integration test | jupyter/jupyter-js-services,blink1073/jupyter-js-services,minrk/jupyter-js-services,jupyterlab/services,blink1073/services,blink1073/jupyter-js-services,minrk/jupyter-js-services,jupyter/jupyter-js-services,blink1073/services,jupyterlab/services,blink1073/services,jupyter/jupyter-js-services,minrk/jupyter-js-services,b... | test/run_test.py | test/run_test.py | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import subprocess
import sys
import argparse
import threading
KARMA_PORT = 9876
argparser = argparse.ArgumentParser(
description='Run Jupyter JS Sevices integration tests'
)
argparser.add_argument('-b', '... | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import subprocess
import sys
import argparse
import threading
KARMA_PORT = 9876
argparser = argparse.ArgumentParser(
description='Run Jupyter JS Sevices integration tests'
)
argparser.add_argument('-b', '... | bsd-3-clause | Python |
2d01301e9154045f4b15d1523089ad36fdd7f6f4 | Remove leftover imports from testing | StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit | cs251tk/toolkit/process_student.py | cs251tk/toolkit/process_student.py | import os
from cs251tk.student import remove
from cs251tk.student import clone_student
from cs251tk.student import stash
from cs251tk.student import pull
from cs251tk.student import checkout_date
from cs251tk.student import record
from cs251tk.student import reset
from cs251tk.student import analyze
def process_stud... | import os
from cs251tk.student import remove
from cs251tk.student import clone_student
from cs251tk.student import stash
from cs251tk.student import pull
from cs251tk.student import checkout_date
from cs251tk.student import record
from cs251tk.student import reset
from cs251tk.student import analyze
from cs251tk.commo... | mit | Python |
5c6dcdeda69ceb4e1bc203ba6d7322058d44e2f8 | Fix unrelated PEP error | rapidpro/dash,rapidpro/dash | dash/orgs/templatetags/dashorgs.py | dash/orgs/templatetags/dashorgs.py | from __future__ import unicode_literals
import phonenumbers
import pytz
from datetime import datetime
from django import template
register = template.Library()
@register.simple_tag()
def display_time(text_timestamp, org, time_format=None):
if not time_format:
time_format = '%b %d, %Y %H:%M'
utc_... | from __future__ import unicode_literals
import phonenumbers
import pytz
from datetime import datetime
from django import template
register = template.Library()
@register.simple_tag()
def display_time(text_timestamp, org, time_format=None):
if not time_format:
time_format = '%b %d, %Y %H:%M'
utc_... | bsd-3-clause | Python |
729d3160f974c521ab6605c02cf64861be0fb6ab | Revert removal of necessary function | lpfann/fri | fri/utils.py | fri/utils.py | import numpy as np
def distance(u, v):
"""
Distance measure custom made for feature comparison.
Parameters
----------
u: first feature
v: second feature
Returns
-------
"""
u = np.asarray(u)
v = np.asarray(v)
# Euclidean differences
diff = (u - v) ** 2
# Null... | import numpy as np
def distance(u, v):
"""
Distance measure custom made for feature comparison.
Parameters
----------
u: first feature
v: second feature
Returns
-------
"""
u = np.asarray(u)
v = np.asarray(v)
# Euclidean differences
diff = (u - v) ** 2
# Null... | mit | Python |
079b8ebb572372c1061728609094de4be4a44189 | Replace 'in' check with 'None' check | marcoacierno/django-schedulermanager | django_schedulermanager/manager.py | django_schedulermanager/manager.py | import django_rq
class JobDescriptor(object):
def __init__(self, is_schedulable, interval,
scheduled_time, repeat,
queue, func, id):
self.is_schedulable = is_schedulable
self.interval = interval
self.scheduled_time = scheduled_time
self.repeat = re... | import django_rq
class JobDescriptor(object):
def __init__(self, is_schedulable, interval,
scheduled_time, repeat,
queue, func, id):
self.is_schedulable = is_schedulable
self.interval = interval
self.scheduled_time = scheduled_time
self.repeat = re... | mit | Python |
8b0074a27f85b4fc45311ad93b29f9f78463c084 | adjust plot script to work on old python version used on taurus | PrometheusPi/hpcUNIXtools,PrometheusPi/hpcUNIXtools | bins/plotStarttime.py | bins/plotStarttime.py | #! /usr/bin/env python
import os
import re
import argparse
import numpy as np
import datetime as dt
import matplotlib.pyplot as plt
from matplotlib.dates import date2num, DateFormatter
parser = argparse.ArgumentParser(
description="Shows start time for slurm jobs over time.",
epilog="For furthe... | #! /usr/bin/env python
import os
import re
import argparse
import numpy as np
import datetime as dt
import matplotlib.pyplot as plt
from matplotlib.dates import date2num, DateFormatter
parser = argparse.ArgumentParser(
description="Shows start time for slurm jobs over time.",
epilog="For furthe... | agpl-3.0 | Python |
2a0dd0ffcd0b5e1b61adda6fdb2b42b3b6ffa812 | reorder for edge cases | blockcypher/explorer,ychaim/explorer,blockcypher/explorer,ychaim/explorer,blockcypher/explorer,ychaim/explorer | blockexplorer/urls.py | blockexplorer/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Logging Test
url(r'^fail500/$', 'homepage.views.fail500', name='fail500'),
url(r'^admin/', include(admin.site.urls)),
# App pages
url(r'^$', 'homepage.views.home', name='home'),
... | from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# App pages
url(r'^$', 'homepage.views.home', name='home'),
url(r'(?P<coin_symbol>[-\w]+)/latest-block/$', 'blocks.views.latest_block', name='latest_block'),
url(r'(?P<coin_symbol>[-\w]+)/ad... | apache-2.0 | Python |
02522262692554a499d7c0fbc8f2efe4361023f1 | Add Configuration to package definition | permamodel/bmi-ilamb | bmi_ilamb/__init__.py | bmi_ilamb/__init__.py | import os
from .bmi_ilamb import BmiIlamb
from .config import Configuration
__all__ = ['BmiIlamb', 'Configuration']
__version__ = 0.1
package_dir = os.path.dirname(__file__)
data_dir = os.path.join(package_dir, 'data')
| import os
from .bmi_ilamb import BmiIlamb
__all__ = ['BmiIlamb']
__version__ = 0.1
package_dir = os.path.dirname(__file__)
data_dir = os.path.join(package_dir, 'data')
| mit | Python |
48c374b423ca14d942f495166782aa17c98bcaec | Improve docstrings | jonathanstallings/data-structures | hashtable.py | hashtable.py |
class HashTable(object):
"""A class for a hash table."""
entries_count = 0
alphabet_size = 52
def __init__(self, size=8192):
self.table_size = size
self.hashtable = [[] for i in range(size)]
def __repr__(self):
return "<HashTable: {}>".format(self.hashtable)
def __le... |
class HashTable(object):
"""docstring for HashTable"""
entries_count = 0
alphabet_size = 52
def __init__(self, size=8192):
self.table_size = size
self.hashtable = [[] for i in range(size)]
def __repr__(self):
return "<HashTable: {}>".format(self.hashtable)
def __len_... | mit | Python |
f68f7f6b0f09a6e27ca714bf277239a2ec331fdf | improve ticket detail view to redirect after successful ticket comment creation | Christophe31/django-tickets,byteweaver/django-tickets,Christophe31/django-tickets,byteweaver/django-tickets | tickets/views.py | tickets/views.py | from django.views.generic import ListView, DetailView, CreateView
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.http import HttpResponseRedirect
from forms import TicketCreateForm, TicketCommentCreateForm
from models import Ticket
class MyTicketListView(ListView):
m... | from django.views.generic import ListView, DetailView, CreateView
from django.core.urlresolvers import reverse
from django.contrib import messages
from forms import TicketCreateForm, TicketCommentCreateForm
from models import Ticket
class MyTicketListView(ListView):
model = Ticket
template_name = 'tickets/ti... | bsd-3-clause | Python |
028efdedc089ab054f2a03b61bed241587861dbf | modify config for heroku create_app | justinwp/croplands,justinwp/croplands | herokuapp.py | herokuapp.py | #!flask/bin/python
from gfsad import create_app
app = create_app(config='gfsad.config.production')
| #!flask/bin/python
from gfsad import create_app
app = create_app(config='production')
| mit | Python |
6b89f9c99560618f7ccf3c85b00f0a31e003dce2 | Update restful api | gaoce/TimeVis,gaoce/TimeVis,gaoce/TimeVis | timevis/views.py | timevis/views.py | from . import app
from flask import render_template
from flask.ext import restful
api = restful.Api(app)
@app.route('/')
@app.route('/index')
def index():
return render_template('index.html')
@app.route('/test')
def test():
return render_template('control.html')
class Experiment(restful.Resource):
pa... | from . import app
from flask import render_template
from flask.ext import restful
api = restful.Api(app)
@app.route('/')
@app.route('/index')
def index():
return render_template('index.html')
@app.route('/test')
def test():
return render_template('control.html')
class Experiment(restful.Resource):
pa... | mit | Python |
af2687703bc13eeabfe715e35988ad8c54ce9117 | Tweak the JSON we export | wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api | builds/format_json.py | builds/format_json.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
import json
import os
import subprocess
import sys
def find_json_files():
for root, _, filenames in os.walk('.'):
if any(
d in root
for d in ['/WIP', '/.terraform', '/target']
):
continue
for f in filenam... | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
import json
import os
import subprocess
import sys
def find_json_files():
for root, _, filenames in os.walk('.'):
if any(
d in root
for d in ['/WIP', '/.terraform', '/target']
):
continue
for f in filenam... | mit | Python |
5d583b721e09b70a9a071f159b524fb59ac878f2 | modify hashing | danche354/Sequence-Labeling | tools/hashing.py | tools/hashing.py | '''
letter-3-gram hashing
convert word or sentence to letter-3-gram representation matrix
'''
import numpy as np
from scipy.sparse import csc_matrix
import conf
feature_length = conf.feature_length
l3g_dict = conf.l3g_dict
def pre_process(word_list):
word_list = ['#'+word.strip()+'#' for word in word_list]
... | '''
letter-3-gram hashing
convert word or sentence to letter-3-gram representation matrix
'''
import numpy as np
from scipy.sparse import csc_matrix
import conf
feature_length = conf.feature_length
l3g_dict = conf.l3g_dict
def pre_process(word_list):
word_list = ['#'+word.strip()+'#' for word in word_list]
... | mit | Python |
08f7fc9d32b3fd829a3cb38a617dfb22896a3b9c | test with 502 | dstlmrk/catcher,dstlmrk/catcher,dstlmrk/catcher | catcher/api/errors.py | catcher/api/errors.py | #!/usr/bin/python
# coding=utf-8
import falcon
import traceback
import logging
def cutQuotationMark(ex):
return ex.replace("\"","")
def NotFound(ex, req, resp, params):
raise falcon.HTTPNotFound(
title = "Not Found",
description = "Instance matching query does not exist"
)
def BadRequest(ex, req, resp... | #!/usr/bin/python
# coding=utf-8
import falcon
import traceback
import logging
def cutQuotationMark(ex):
return ex.replace("\"","")
def NotFound(ex, req, resp, params):
raise falcon.HTTPNotFound(
title = "Not Found",
description = "Instance matching query does not exist"
)
def BadRequest(ex, req, resp... | mit | Python |
0fce72c25bddcec9906892304a7d3a7452b5acbe | fix type | Aaron-Zhao123/nn_library | transfer_ckpt.py | transfer_ckpt.py | """
unzip the following datafile
tar
ref:
1. https://stackoverflow.com/questions/40118062/how-to-read-weights-saved-in-tensorflow-checkpoint-file
2. https://www.tensorflow.org/s/results/?q=freezegraph&p=%2F
Loading meta only might not work.
If the checkpoint contains:
model.ckpt.meta
model.ckpt.index
model.ckpt.data... | """
unzip the following datafile
tar
ref:
1. https://stackoverflow.com/questions/40118062/how-to-read-weights-saved-in-tensorflow-checkpoint-file
2. https://www.tensorflow.org/s/results/?q=freezegraph&p=%2F
Loading meta only might not work.
If the checkpoint contains:
model.ckpt.meta
model.ckpt.index
model.ckpt.data... | mit | Python |
2dd980e6716a1a11962ce00687c2e77a94cc3e7d | Update urls.py | orionblastar/K666,orionblastar/K666,orionblastar/K666,orionblastar/K666 | k666/urls.py | k666/urls.py | """k666 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-based ... | """k666 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-based ... | mit | Python |
b788eab83872962e93c9f7877c3569b6fba9f58b | Bump version | HighMileage/lacrm | lacrm/_version.py | lacrm/_version.py | __version_info__ = (0, 1, 2)
__version__ = '.'.join(map(str, __version_info__))
| __version_info__ = (0, 1, 1)
__version__ = '.'.join(map(str, __version_info__))
| mit | Python |
0b5cc3f4702081eb565ef83c3175efc4e8b30e75 | Fix channel definition in add method | eriol/circuits,eriol/circuits,treemo/circuits,nizox/circuits,eriol/circuits,treemo/circuits,treemo/circuits | circuits/node/node.py | circuits/node/node.py | # Module: node
# Date: ...
# Author: ...
"""Node
...
"""
from .client import Client
from .server import Server
from circuits import handler, BaseComponent
class Node(BaseComponent):
"""Node
...
"""
channel = "node"
def __init__(self, bind=None, channel=channel, **kwargs):
su... | # Module: node
# Date: ...
# Author: ...
"""Node
...
"""
from .client import Client
from .server import Server
from circuits import handler, BaseComponent
class Node(BaseComponent):
"""Node
...
"""
channel = "node"
def __init__(self, bind=None, channel=channel, **kwargs):
su... | mit | Python |
2fc58016f618912ff6b7f8d11f49b2944ada788e | Make sure that the main window does not fall off-screen on Windows on first run. | berendkleinhaneveld/Registrationshop,berendkleinhaneveld/Registrationshop | ui/MainWindow.py | ui/MainWindow.py | """
MainWindow.py
"""
from PySide.QtGui import QMainWindow
from PySide import QtCore
class MainWindow(QMainWindow):
"""
Simple base class to start of other applications or tools.
Has some methods that keep track of size and location of
window.
"""
# Singletons
settings = QtCore.QSettings()
def __init__(sel... | """
MainWindow.py
"""
from PySide.QtGui import QMainWindow
from PySide import QtCore
class MainWindow(QMainWindow):
"""
Simple base class to start of other applications or tools.
Has some methods that keep track of size and location of
window.
"""
# Singletons
settings = QtCore.QSettings()
def __init__(sel... | mit | Python |
1bd418d5d7935c54670a27f761d4949d25814ce7 | add a big ole uncharacteristic block-o-docs about error handling. support for default exceptions. | kezabelle/clastic,kezabelle/clastic | clastic/exceptions.py | clastic/exceptions.py | from __future__ import unicode_literals
from werkzeug.exceptions import *
'''
Most sites, especially production sites, need to tightly control which
errors are exposed to users, for both security and usability purposes.
Error handlers provide this functionality for Clastic. They're like a
fallback endpoint for when ... | from __future__ import unicode_literals
from werkzeug.exceptions import *
def make_error_handler_map(handler_map=None,
default_400=None,
default_500=None):
handler_map = dict(handler_map or {})
ret = {}
if default_400:
if not callable(default_... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.