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 |
|---|---|---|---|---|---|---|---|---|
9a2362e20e5eedfd2a53c03adc1d83c13ccc65aa | Revert changes to __init__.py | wright-group/WrightTools,wright-group/WrightTools | WrightTools/__init__.py | WrightTools/__init__.py | import sys as _sys
import os as _os
import matplotlib as _matplotlib
# --- temp directory ------------------------------------------------------------------------------
_temp_dir = _os.path.join(_os.path.dirname(__file__), 'temp')
if not _os.path.isdir(_temp_dir):
_os.mkdir(_temp_dir)
# --- import ----------... | import sys as _sys
import os as _os
import matplotlib as _matplotlib
# --- import --------------------------------------------------------------------------------------
from . import artists
from . import calibration
from . import data
from . import diagrams
from . import fit
from . import google_drive
from . impo... | mit | Python |
2d4946a1ffd59c5d8b8443394c2f62ad675fc176 | fix flake8 error | mozilla-iam/cis,mozilla-iam/cis | python-modules/cis_profile_retrieval_service/cis_profile_retrieval_service/advanced.py | python-modules/cis_profile_retrieval_service/cis_profile_retrieval_service/advanced.py | """Support advanced search queries for inclusion in routes via DynamoDb."""
from flask_restful import Resource
from flask_restful import reqparse
from cis_profile_retrieval_service.idp import requires_auth
from cis_identity_vault.models import user
from cis_profile_retrieval_service.common import get_config
from cis_... | """Support advanced search queries for inclusion in routes via DynamoDb."""
from flask_restful import Resource
from flask_restful import reqparse
from cis_profile_retrieval_service.idp import requires_auth
from cis_identity_vault.models import user
from cis_profile_retrieval_service.common import get_config
from cis_... | mpl-2.0 | Python |
f9e11fbc39a05e54b99e3820fd1dd440265e38d6 | Add test for sync_many issue (issue 218). | ssaavedra/couchdb-python,oliora/couchdb-python | couchdb/tests/design.py | couchdb/tests/design.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import doctest
import unittest
from couchdb import design
from couchdb.tests import testutil
class Des... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import doctest
import unittest
from couchdb import design
from couchdb.tests import testutil
class Des... | bsd-3-clause | Python |
35c25828a429e7807a51981a39881506824411a6 | Bump version to 0.3.0 | racitup/django-currencies,mysociety/django-currencies,bashu/django-simple-currencies,panosl/django-currencies,bashu/django-simple-currencies,racitup/django-currencies,pathakamit88/django-currencies,marcosalcazar/django-currencies,ydaniv/django-currencies,marcosalcazar/django-currencies,pathakamit88/django-currencies,ba... | currencies/__init__.py | currencies/__init__.py | __version__ = '0.3.0'
| __version__ = '0.2.4'
| bsd-3-clause | Python |
a80b95f64a17c4bc5c506313fe94e66b4ad2e836 | Switch to Blueprints, custom 404 handler. | tsoporan/cyclonejet | cyclonejet/__init__.py | cyclonejet/__init__.py | # -*- encoding:utf-8 -*-
from flask import Flask, render_template
from cyclonejet.views.frontend import frontend
from cyclonejet.views.errors import errors
from flaskext.sqlalchemy import SQLAlchemy
import settings
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = settings.DB_URI
#Blueprint registration... | # -*- encoding:utf-8 -*-
from flask import Flask
from cyclonejet.views.frontend import frontend
from flaskext.sqlalchemy import SQLAlchemy
import settings
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = settings.DB_URI
app.register_module(frontend)
db = SQLAlchemy(app)
| agpl-3.0 | Python |
a41edbef7e5cf0f76a94330586af1b97d91cea38 | document script_common methods | catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult | devil/devil/android/tools/script_common.py | devil/devil/android/tools/script_common.py | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
from devil import devil_env
from devil.android import device_blacklist
from devil.android import device_errors
from devil.android import device_ut... | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
from devil import devil_env
from devil.android import device_blacklist
from devil.android import device_errors
from devil.android import device_ut... | bsd-3-clause | Python |
d75c1c9dcf806df5aa66e7b81666df6c5d22c25a | Test added for run HTML view ISSUE #850 | comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django | app/tests/algorithms_tests/test_views.py | app/tests/algorithms_tests/test_views.py | import pytest
from django.utils.text import slugify
from grandchallenge.subdomains.utils import reverse
from grandchallenge.algorithms.models import Algorithm
from tests.algorithms_tests.factories import AlgorithmFactory
from tests.factories import UserFactory, StagedFileFactory
from tests.utils import get_view_for_... | import pytest
from django.utils.text import slugify
from grandchallenge.subdomains.utils import reverse
from grandchallenge.algorithms.models import Algorithm
from tests.algorithms_tests.factories import AlgorithmFactory
from tests.factories import UserFactory, StagedFileFactory
from tests.utils import get_view_for_... | apache-2.0 | Python |
e21a2d3989d07839885a6e32277b6909920bd653 | bump version to 0.5.9 | briney/abstar | abstar/version.py | abstar/version.py | # Store the version here so:
# 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module module
__version__ = '0.5.9' | # Store the version here so:
# 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module module
__version__ = '0.5.8' | mit | Python |
3a07020b3381abc1d0c631ce063cec5ad5d57298 | Revert "Fix: tests again, put back old code, but I dont see the difference" | rledisez/shinken,ddurieux/alignak,rledisez/shinken,rledisez/shinken,claneys/shinken,lets-software/shinken,staute/shinken_package,staute/shinken_package,geektophe/shinken,naparuba/shinken,kaji-project/shinken,dfranco/shinken,lets-software/shinken,Alignak-monitoring/alignak,ddurieux/alignak,KerkhoffTechnologies/shinken,r... | test/__import_shinken.py | test/__import_shinken.py | # -*- coding: utf-8 ; mode: python -*-
#
# Copyright (C) 2012:
# Hartmut Goebel <h.goebel@crazy-compilers.com>
#
# This file is part of Shinken.
#
# Shinken 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 Software Founda... | # -*- coding: utf-8 ; mode: python -*-
#
# Copyright (C) 2012:
# Hartmut Goebel <h.goebel@crazy-compilers.com>
#
# This file is part of Shinken.
#
# Shinken 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 Software Founda... | agpl-3.0 | Python |
a215f2bc86d063e856f1600b71dd802ccf5eb534 | add protection against missing env.py, this file is not necessary | hrbonz/django-flexisettings | settings/__init__.py | settings/__init__.py | # Copyright (c) 2012, Heatwave fashion Ltd.
# All rights reserved.
# Licensed under a 3-clause BSD license, see LICENSE
# Django settings for fashionme_web project.
import sys
import os
# add project folder to path for generic loading
SETTINGSPATH = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
# detec... | # Copyright (c) 2012, Heatwave fashion Ltd.
# All rights reserved.
# Licensed under a 3-clause BSD license, see LICENSE
# Django settings for fashionme_web project.
import sys
import os
# add project folder to path for generic loading
SETTINGSPATH = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
# detec... | bsd-3-clause | Python |
0fa9458e876f8361ac79f66b4cb0a845e3eb740d | Change exception message to be same as stdlib. | Ayrx/python-fastpbkdf2,Ayrx/python-fastpbkdf2 | src/fastpbkdf2/__init__.py | src/fastpbkdf2/__init__.py | from __future__ import absolute_import, division, print_function
from fastpbkdf2._fastpbkdf2 import ffi, lib
def pbkdf2_hmac(name, password, salt, rounds, dklen=None):
if name not in ["sha1", "sha256", "sha512"]:
raise ValueError("unsupported hash type")
algorithm = {
"sha1": (lib.fastpbkdf2... | from __future__ import absolute_import, division, print_function
from fastpbkdf2._fastpbkdf2 import ffi, lib
def pbkdf2_hmac(name, password, salt, rounds, dklen=None):
if name not in ["sha1", "sha256", "sha512"]:
raise ValueError(
"Algorithm {} not supported. "
"Please use sha1, s... | apache-2.0 | Python |
d9383d114c093b0c6a2dbd68254ed59eeff14418 | bump version, release 2.2rc2 wheel | SunPower/PVMismatch | pvmismatch/__init__.py | pvmismatch/__init__.py | # -*- coding: utf-8 -*-
"""
This is the PVMismatch Package. It contains :mod:`~pvmismatch.pvmismatch_lib`
and :mod:`~pvmismatch.pvmismatch_tk`.
:mod:`~pvmismatch.pvmismatch_lib`
=================================
This package contains the basic library modules, methods, classes and
attributes to model PV system mismatc... | # -*- coding: utf-8 -*-
"""
This is the PVMismatch Package. It contains :mod:`~pvmismatch.pvmismatch_lib`
and :mod:`~pvmismatch.pvmismatch_tk`.
:mod:`~pvmismatch.pvmismatch_lib`
=================================
This package contains the basic library modules, methods, classes and
attributes to model PV system mismatc... | bsd-3-clause | Python |
3a7a69c203e39c87df0e040783c0cf10ca61d542 | throw exception if docker_project_name not set | zdw/xos,zdw/xos,cboling/xos,opencord/xos,opencord/xos,open-cloud/xos,zdw/xos,cboling/xos,cboling/xos,cboling/xos,zdw/xos,open-cloud/xos,open-cloud/xos,opencord/xos,cboling/xos | xos/synchronizers/onboarding/steps/sync_xos.py | xos/synchronizers/onboarding/steps/sync_xos.py | import os
import sys
import base64
from django.db.models import F, Q
from xos.config import Config
from synchronizers.base.syncstep import SyncStep, DeferredException
from core.models import XOS
from xos.logger import Logger, logging
from synchronizers.base.ansible import run_template
# xosbuilder will be in steps/..
... | import os
import sys
import base64
from django.db.models import F, Q
from xos.config import Config
from synchronizers.base.syncstep import SyncStep, DeferredException
from core.models import XOS
from xos.logger import Logger, logging
from synchronizers.base.ansible import run_template
# xosbuilder will be in steps/..
... | apache-2.0 | Python |
7a5e25cb095c0bbfb9276f1d5c3b241c0d54105f | Add the appropriate update behaviour for repo changes. | conda-forge/conda-forge.github.io,conda-forge/conda-forge.github.io,conda-forge/conda-forge.github.io,conda-forge/conda-forge.github.io | scripts/update_feedstocks_submodules.py | scripts/update_feedstocks_submodules.py | #!/usr/bin/env conda-execute
# conda execute
# env:
# - python
# - conda-smithy
# - gitpython
# channels:
# - conda-forge
# run_with: python
import os
import conda_smithy.feedstocks as feedstocks
from git import Repo
import argparse
parser = argparse.ArgumentParser(description='Process some integers.')
parser.... | #!/usr/bin/env conda-execute
# conda execute
# env:
# - python
# - conda-smithy
# - gitpython
# channels:
# - conda-forge
# run_with: python
import os
import conda_smithy.feedstocks as feedstocks
from git import Repo
import argparse
parser = argparse.ArgumentParser(description='Process some integers.')
parser.... | bsd-3-clause | Python |
01be58337cc709749d1ff2d7e6b0eb4d34851f5e | Fix rotomap-automask: use whole image for mask | aevri/mel,aevri/mel | py/mel/rotomap/mask.py | py/mel/rotomap/mask.py | """Manage image masks."""
import os
import cv2
import numpy
def path(mole_image_path):
return mole_image_path + '.mask.png'
def load(mole_image_path):
return cv2.imread(
path(mole_image_path),
cv2.IMREAD_UNCHANGED)
def load_or_none(mole_image_path):
if os.path.isfile(path(mole_image_... | """Manage image masks."""
import os
import cv2
import numpy
def path(mole_image_path):
return mole_image_path + '.mask.png'
def load(mole_image_path):
return cv2.imread(
path(mole_image_path),
cv2.IMREAD_UNCHANGED)
def load_or_none(mole_image_path):
if os.path.isfile(path(mole_image_... | apache-2.0 | Python |
fdec3c42ee1e61415902238d8d314d112428ad19 | rewrite arrayview avoiding factory functions | enthought/uchicago-pyanno | pyanno/ui/arrayview.py | pyanno/ui/arrayview.py | import numpy as np
from traits.api import HasTraits, Property, Array
from traits.trait_types import List, Int, Bool, Str
from traitsui.api import View, Item, TabularEditor
from traitsui.tabular_adapter import TabularAdapter
from traitsui.menu import NoButtons
class Array2DAdapter(TabularAdapter):
columns = List
... | import numpy as np
from traits.api import HasTraits, Property, Array
from traitsui.api import View, Item, TabularEditor
from traitsui.tabular_adapter import TabularAdapter
from traitsui.menu import NoButtons
def create_array2d_adapter(width, show_index=True, data_format='%f'):
_columns = [('%d' % (i+1), i) for i... | bsd-2-clause | Python |
7173b2132f28629f728a206b27b74ec1e251c441 | Refactor profile module | duboviy/pybenchmark | pybenchmark/profile.py | pybenchmark/profile.py | """ A benchmark utility used in speed/performance tests. """
from os import getpid
from test import pystone # native python-core "PYSTONE" Benchmark Program
from timeit import default_timer as timer
from psutil import Process
# The result is a number of pystones per second the computer is able to perform,... | """ A benchmark utility used in speed/performance tests. """
import os
import sys
import time
from test import pystone # native python-core "PYSTONE" Benchmark Program
import psutil
# The result is a number of pystones per second the computer is able to perform,
# and the time used to perform the benchmark, resul... | mit | Python |
e74d4bcf0ebe0915b65956660a89ca13766a4639 | Update ailos.py | thiagosm/pyboleto,thiagosm/pyboleto | pyboleto/bank/ailos.py | pyboleto/bank/ailos.py | # -*- coding: utf-8 -*-
from ..data import BoletoData, CustomProperty
class BoletoAilos(BoletoData):
nosso_numero = CustomProperty('nosso_numero', 10)
agencia_cedente = CustomProperty('agencia_cedente', 4)
conta_cedente = CustomProperty('conta_cedente', 10)
carteira = CustomProperty('carteira', 2)
... | # -*- coding: utf-8 -*-
from ..data import BoletoData, CustomProperty
class BoletoAilos(BoletoData):
nosso_numero = CustomProperty('nosso_numero', 10)
agencia_cedente = CustomProperty('agencia_cedente', 4)
conta_cedente = CustomProperty('conta_cedente', 10)
carteira = CustomProperty('carteira', 2)
... | bsd-3-clause | Python |
87b5abe5e75c64b3d77878570ef87312cbc8e1a5 | Improve error handling tests | bike-barn/red-green-refactor | tests/test_calculator.py | tests/test_calculator.py | import pytest
from calc import INTEGER, EOF, PLUS, Calc, CalcError
def test_calc_blank_expression():
"""This test just makes sure :class:`Interpreter` can be instantiated."""
input_text = ""
Calc(text=input_text)
def test_raises_error_on_invalid_tokens():
"""
Test that invalid tokens cause a ``... | import pytest
from calc import INTEGER, EOF, PLUS, Calc, CalcError
def test_calc_blank_expression():
"""This test just makes sure :class:`Interpreter` can be instantiated."""
input_text = ""
Calc(text=input_text)
def test_calc_error_type():
input_text = ""
calc = Calc(text=input_text)
with ... | isc | Python |
a14380f3a63288f83bdd5737db6a2b17c28fb101 | Bump version to 0.1.1 | jeffbuttars/django-email-user-model | src/django_email_user_model/__init__.py | src/django_email_user_model/__init__.py | # version is a human-readable version number.
# http://legacy.python.org/dev/peps/pep-0440/#version-scheme
# Use the pep-0440 as a versioning guidline
# There are always four parts, although trailing parts 'may' be empty.
# Idealy the first 3 parts will always have a value
__version__ = "0.1.1"
__version_info__ = ('0'... | # version is a human-readable version number.
# http://legacy.python.org/dev/peps/pep-0440/#version-scheme
# Use the pep-0440 as a versioning guidline
# There are always four parts, although trailing parts 'may' be empty.
# Idealy the first 3 parts will always have a value
__version__ = "0.1.0"
__version_info__ = ('0'... | mit | Python |
0678b3b3b4d4fcfcbfe0b10fa1aa84ae21b2b39f | Fix message payload serialization | osantana/ami-push | ami_push/messages.py | ami_push/messages.py | # coding: utf-8
import json
from panoramisk.message import Message
class MessageWrapper:
def __init__(self, message):
if isinstance(message, str):
message = Message.from_line(message)
self.message = message
def __getattr__(self, item):
return getattr(self.message, item)... | # coding: utf-8
import json
from panoramisk.message import Message
class MessageWrapper:
def __init__(self, message):
if isinstance(message, str):
message = Message.from_line(message)
self.message = message
def __getattr__(self, item):
return getattr(self.message, item)... | mit | Python |
f3e14236942038837dbcb7f2e8e8f899baa5ebc2 | Test all executors | Insoleet/quamash,graingert/quamash,aknuds1/quamash | tests/test_qeventloop.py | tests/test_qeventloop.py | import asyncio
import os.path
import logging
import sys
import locale
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
try:
from PyQt5.QtWidgets import QApplication
except ImportError:
from PySide.QtGui import QApplication
import pytest
sys.path.insert(0, os.path.abspath(os.path.join(os.path.d... | import asyncio
import os.path
import logging
import sys
import locale
try:
from PyQt5.QtWidgets import QApplication
except ImportError:
from PySide.QtGui import QApplication
import pytest
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import quamash
logging.basicConfig(
level=l... | bsd-2-clause | Python |
abcf8c534ca42ab4d87b8c0e4f4f5407c50f827c | update release to 2.1.54-dev | coryb/aminator,bmoyles/aminator,Netflix/aminator,kvick/aminator | aminator/__init__.py | aminator/__init__.py | # -*- coding: utf-8 -*-
#
#
# Copyright 2013 Netflix, Inc.
#
# 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 ... | # -*- coding: utf-8 -*-
#
#
# Copyright 2013 Netflix, Inc.
#
# 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 ... | apache-2.0 | Python |
ca703cb20365f49549d05d896d9f26c5ec60cfbc | prepare for release 2.0.171-dev | Netflix/aminator,coryb/aminator,kvick/aminator,bmoyles/aminator | aminator/__init__.py | aminator/__init__.py | # -*- coding: utf-8 -*-
#
#
# Copyright 2013 Netflix, Inc.
#
# 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 ... | # -*- coding: utf-8 -*-
#
#
# Copyright 2013 Netflix, Inc.
#
# 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 ... | apache-2.0 | Python |
158e0c76b1f8163a19b7f243afead78527bd77f9 | move lines from start_workers() to __init__() in CommunicationChannel | alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl | AlphaTwirl/Concurrently/CommunicationChannel.py | AlphaTwirl/Concurrently/CommunicationChannel.py | # Tai Sakuma <tai.sakuma@cern.ch>
from ..ProgressBar import NullProgressMonitor
import multiprocessing
##__________________________________________________________________||
class Worker(multiprocessing.Process):
def __init__(self, task_queue, result_queue, progressReporter, lock):
multiprocessing.Process.... | # Tai Sakuma <tai.sakuma@cern.ch>
from ..ProgressBar import NullProgressMonitor
import multiprocessing
##__________________________________________________________________||
class Worker(multiprocessing.Process):
def __init__(self, task_queue, result_queue, progressReporter, lock):
multiprocessing.Process.... | bsd-3-clause | Python |
32b51cb7d63d9d122c0d678a46d56a735a9bea3e | Add ``remove`` flag to DecoratorScope | mnieber/dodo_commands | dodo_commands/framework/decorator_scope.py | dodo_commands/framework/decorator_scope.py | from dodo_commands.framework.singleton import Dodo
# Resp: add the current command_name
# to the list of commands decorated by decorator_name.
class DecoratorScope:
def __init__(self, decorator_name, remove=False):
self.decorators = Dodo.get_config('/ROOT').setdefault(
'decorators', {}).setdef... | from dodo_commands.framework.singleton import Dodo
# Resp: add the current command_name
# to the list of commands decorated by decorator_name.
class DecoratorScope:
def __init__(self, decorator_name):
self.decorators = Dodo.get_config('/ROOT').setdefault(
'decorators', {}).setdefault(decorator... | mit | Python |
55a2ba646a6ffdcc025dd2d8e6fea4ae5de36b8d | Update PyCom_WiPy.py | vshymanskyy/blynk-library-python | examples/hardware/PyCom_WiPy.py | examples/hardware/PyCom_WiPy.py | """
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Downloads, docs, tutorials: http://www.blynk.cc
Sketch generator: http://examples.blyn... | """
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Downloads, docs, tutorials: http://www.blynk.cc
Sketch generator: http://examples.blyn... | mit | Python |
6a494fd7315511234b5ad4852033babf676bcc34 | Fix a syntax error | jpaugh/agithub,mozilla/agithub | agithub/GitHub.py | agithub/GitHub.py | # Copyright 2012-2016 Jonathan Paugh and contributors
# See COPYING for license details
from agithub.base import *
class GitHub(API):
'''
The agnostic GitHub API. It doesn't know, and you don't care.
>>> from agithub import GitHub
>>> g = GitHub('user', 'pass')
>>> status, data = g.issues.get(filte... | # Copyright 2012-2016 Jonathan Paugh and contributors
# See COPYING for license details
from agithub.base import *
class GitHub(API):
'''
The agnostic GitHub API. It doesn't know, and you don't care.
>>> from agithub import GitHub
>>> g = GitHub('user', 'pass')
>>> status, data = g.issues.get(filte... | mit | Python |
4637a7c99af8213afc207b193201cea8105a9ad5 | Resolve bug adding road reports to Reporter | DLance96/TrafficSim-Simulator | src/TrafficMap.py | src/TrafficMap.py | import random
from src.drivers.DriverTemplate import *
from src.vehicles.VehicleTemplate import *
from src.Reporter import Reporter
class TrafficMap:
"""
:type roadlist: list(Road)
"""
def __init__(self):
self.roadlist = []
self.intersectionlist = []
self.reporter = Reporter()
... | import random
from src.drivers.DriverTemplate import *
from src.vehicles.VehicleTemplate import *
from src.Reporter import Reporter
class TrafficMap:
"""
:type roadlist: list(Road)
"""
def __init__(self):
self.roadlist = []
self.intersectionlist = []
self.reporter = Reporter()
... | mit | Python |
930d49e5f354896ff885a636cbbd79c08537f5e7 | Fix bug introduced in previous commit, I think it was c04a | AlexSzatmary/bake | bake/cmdline.py | bake/cmdline.py | #!/usr/bin/env python
# encoding: utf-8
"""
This is the command line interface for bake. For people who want to take
bake.py and extend it for their own circumstances, modifying the main routine
in this module is probably the best place to start.
"""
# If you make your own bake frontend, just do
# import bake
import a... | #!/usr/bin/env python
# encoding: utf-8
"""
This is the command line interface for bake. For people who want to take
bake.py and extend it for their own circumstances, modifying the main routine
in this module is probably the best place to start.
"""
# If you make your own bake frontend, just do
# import bake
import a... | mit | Python |
2b823c8cf28425bdec2b574267f4fa3da5b7a89c | Add solution to tree_stars.py | bm5w/codeeval | tree_stars/tree_stars.py | tree_stars/tree_stars.py | """Output a tree of stars like so:
*
***
*
***
*****
*
***
*****
*******
Input argument is the number of levels to the tree (3 in this example)
"""
from sys import argv
def main(levels):
for level in xrange(levels):
for sub_level in xrange(level+2):
spaces = (levels... | mit | Python | |
a7a1f6385555201f996d77490c184d0264789193 | increment version | cggh/scikit-allel | allel/__init__.py | allel/__init__.py | # -*- coding: utf-8 -*-
# flake8: noqa
from allel import model
from allel.model import *
from allel import stats
from allel import plot
from allel import io
from allel import chunked
from allel import constants
from allel import util
__version__ = '0.20.0.dev0'
| # -*- coding: utf-8 -*-
# flake8: noqa
from allel import model
from allel.model import *
from allel import stats
from allel import plot
from allel import io
from allel import chunked
from allel import constants
from allel import util
__version__ = '0.19.0'
| mit | Python |
a8874713c5b34c19fe42a96ad495270fe3298841 | Make sure we auto-connect to the IDL server | CraigLoomis/ics_hxActor,CraigLoomis/ics_hxActor | python/hxActor/main.py | python/hxActor/main.py | #!/usr/bin/env python
import actorcore.ICC
class OurActor(actorcore.ICC.ICC):
def __init__(self, name,
productName=None, configFile=None,
modelNames=('charis', 'hx'),
debugLevel=30):
""" Setup an Actor instance. See help for actorcore.Actor for details. ... | #!/usr/bin/env python
import actorcore.ICC
class OurActor(actorcore.ICC.ICC):
def __init__(self, name,
productName=None, configFile=None,
modelNames=('charis', 'hx'),
debugLevel=30):
""" Setup an Actor instance. See help for actorcore.Actor for details. ... | mit | Python |
524f431ee297acd5cee54e413fb9dfdfb8828638 | Bump version to master | amcat/amcat,amcat/amcat,amcat/amcat,amcat/amcat,amcat/amcat,amcat/amcat | amcat/_version.py | amcat/_version.py | __version__ = 'master'
| __version__ = '3.4.01-split_codingactions'
| agpl-3.0 | Python |
7cd9cfa84ae0e0f212ad9bfbb56fd7c07db9d0f4 | fix mead settings instead by defaulting | dpressel/baseline,dpressel/baseline,dpressel/baseline,dpressel/baseline | python/mead/trainer.py | python/mead/trainer.py | import argparse
from copy import deepcopy
from itertools import chain
from baseline.utils import read_config_stream
import mead
from mead.utils import convert_path, parse_extra_args
def main():
parser = argparse.ArgumentParser(description='Train a text classifier')
parser.add_argument('--config', help='JSON C... | import argparse
from copy import deepcopy
from itertools import chain
from baseline.utils import read_config_stream
import mead
from mead.utils import convert_path, parse_extra_args
def main():
parser = argparse.ArgumentParser(description='Train a text classifier')
parser.add_argument('--config', help='JSON C... | apache-2.0 | Python |
6584cd8f70e206ea28e6b9818dcb0cb41f47dbd5 | Bump version to 0.5.2 | smarkets/smk_python_sdk | smarkets/__init__.py | smarkets/__init__.py | "Smarkets API package"
# Copyright (C) 2011 Smarkets Limited <support@smarkets.com>
#
# This module is released under the MIT License:
# http://www.opensource.org/licenses/mit-license.php
import inspect
import os
if 'READTHEDOCS' in os.environ:
from mock import Mock
import sys
eto = seto = \
sys.m... | "Smarkets API package"
# Copyright (C) 2011 Smarkets Limited <support@smarkets.com>
#
# This module is released under the MIT License:
# http://www.opensource.org/licenses/mit-license.php
import inspect
import os
if 'READTHEDOCS' in os.environ:
from mock import Mock
import sys
eto = seto = \
sys.m... | mit | Python |
feeb77cc54f01de4a350536733581a541139065f | bump version to 2.2.1 | nyaruka/smartmin,nyaruka/smartmin,nyaruka/smartmin | smartmin/__init__.py | smartmin/__init__.py | from __future__ import unicode_literals
__version__ = '2.2.1'
| from __future__ import unicode_literals
__version__ = '2.2.0'
| bsd-3-clause | Python |
1ddc8733a5f2bffa3ebbeb5808ec41f5f76d0b64 | Reduce size of label | ReactiveX/RxPY,ReactiveX/RxPY,dbrattli/RxPY | examples/timeflies/timeflies.py | examples/timeflies/timeflies.py | from rx.subjects import Subject
from rx.concurrency import TkinterScheduler
from tkinter import *
def main():
root = Tk()
root.title("Rx for Python rocks")
scheduler = TkinterScheduler(root)
mousemove = Subject()
frame = Frame(root, width=600, height=600)
def move(event):
mousemove.... | from rx.subjects import Subject
from rx.concurrency import TkinterScheduler
from tkinter import *
def main():
root = Tk()
root.title("Rx for Python rocks")
scheduler = TkinterScheduler(root)
mousemove = Subject()
frame = Frame(root, width=600, height=600)
def move(event):
mousemove.... | mit | Python |
abc0bd5095d7074c835922957169a8f5104c2651 | return futures | jpn--/pines,jpn--/pines | pines/tar.py | pines/tar.py | import os, io, tarfile
def directory_to_targz_string(directory):
"""
tar and gzip a directory into a bytes string
Parameters
----------
directory : str
Returns
-------
bytes
"""
with io.BytesIO() as bt:
with tarfile.open(fileobj=bt,mode='w:gz') as tf:
tf.add(directory,arcname=os.path.basename(director... | import os, io, tarfile
def directory_to_targz_string(directory):
"""
tar and gzip a directory into a bytes string
Parameters
----------
directory : str
Returns
-------
bytes
"""
with io.BytesIO() as bt:
with tarfile.open(fileobj=bt,mode='w:gz') as tf:
tf.add(directory,arcname=os.path.basename(director... | mit | Python |
e25fb61e6f67173a8f994d0bb40f169787428823 | Fix exception for use with python3 | falcon1kr/python-social-auth,jeyraof/python-social-auth,cjltsod/python-social-auth,contracode/python-social-auth,VishvajitP/python-social-auth,mchdks/python-social-auth,ononeor12/python-social-auth,contracode/python-social-auth,wildtetris/python-social-auth,duoduo369/python-social-auth,ByteInternet/python-social-auth,t... | social/exceptions.py | social/exceptions.py | class SocialAuthBaseException(ValueError):
"""Base class for pipeline exceptions."""
pass
class WrongBackend(SocialAuthBaseException):
def __init__(self, backend_name):
self.backend_name = backend_name
def __str__(self):
return 'Incorrect authentication service "%s"' % self.backend_na... | class SocialAuthBaseException(ValueError):
"""Base class for pipeline exceptions."""
pass
class WrongBackend(SocialAuthBaseException):
def __init__(self, backend_name):
self.backend_name = backend_name
def __str__(self):
return 'Incorrect authentication service "%s"' % self.backend_na... | bsd-3-clause | Python |
ca7506105e03392773426e346dd5e1b06881ccf2 | add rf to rm | ryanbressler/GraphSpectrometer,ryanbressler/GraphSpectrometer,ryanbressler/GraphSpectrometer | annotateLeaves.py | annotateLeaves.py |
import os
import sys
import json
import branchMatrix
import numpy as np
def main():
fn = sys.argv[1]
fm = sys.argv[2]
branches = sys.argv[3]
print "Annotating %s with header from %s" % (os.path.abspath(fn), os.path.abspath(fm))
fo = open(fn)
data = json.load(fo)
fo.close()
fo = ope... |
import os
import sys
import json
import branchMatrix
import numpy as np
def main():
fn = sys.argv[1]
fm = sys.argv[2]
branches = sys.argv[3]
print "Annotating %s with header from %s" % (os.path.abspath(fn), os.path.abspath(fm))
fo = open(fn)
data = json.load(fo)
fo.close()
fo = ope... | bsd-3-clause | Python |
956450dfe89557de759fe9b991f583987b1f0507 | add select arm method for softmax agent | okkhoy/minecraft-rl | agents/SoftmaxBandit.py | agents/SoftmaxBandit.py | """
Created on May 7, 2017
@author: Akshay Narayan
This code is shared under The MIT License
-----------------------------------------
The MIT License (MIT)
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated document... | """
Created on May 7, 2017
@author: Akshay Narayan
This code is shared under The MIT License
-----------------------------------------
The MIT License (MIT)
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated document... | mit | Python |
866b55d9160d274772aa796946492549eea6ca17 | Add a skiptest to support PY34 testing | kevinconway/pycc,kevinconway/pycc | tests/asttools/test_compiler.py | tests/asttools/test_compiler.py | """Test suite for asttools.compiler."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import pytest
from pycc import pycompat
from pycc.asttools import parse
from pycc.asttools import compiler
source = """
x = Tru... | """Test suite for asttools.compiler."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import pytest
from pycc.asttools import parse
from pycc.asttools import compiler
source = """
x = True
for y in range(10):
... | apache-2.0 | Python |
8ce6fd26a6af7f50243f119c340389ca64e71480 | add RubyLinter class; Mdl class inherits from RubyLinter | roadhump/SublimeLinter-contrib-mdl | linter.py | linter.py | from SublimeLinter.lint import Linter
class RubyLinter(Linter):
def context_sensitive_executable_path(self, cmd):
# The default implementation will look for a user defined `executable`
# setting.
success, executable = super().context_sensitive_executable_path(cmd)
if success:
... | from SublimeLinter.lint import Linter
class Mdl(Linter):
cmd = ['mdl', '${temp_file}']
regex = r'^.+?:(?P<line>\d+): (?P<warning>(?P<message>[^`]*))'
line_col_base = (1, 1)
tempfile_suffix = 'md'
defaults = {
'selector': 'text.html.markdown'
}
| mit | Python |
737154819b557c66ec5d71671028157a802b0644 | fix in derest.layers | heurezjusz/Athena,heurezjusz/Athenet | athenet/algorithm/derest/layers/layer.py | athenet/algorithm/derest/layers/layer.py | class DerestLayer(object):
def __init__(self, layer):
self.layer = layer
self.activations = None
self.derivatives = None
def count_activation(self, input):
raise NotImplementedError
def count_derivatives(self, output, input_shape):
#TODO - nice check if activations... | from athenet.algorithm.derest.activation import count_activation
from athenet.algorithm.derest.derivative import count_derivative
class DerestLayer(object):
def __init__(self, layer):
self.layer = layer
self.activations = None
self.derivatives = None
def count_activation(self, input)... | bsd-2-clause | Python |
92a36eca1979ac587d7f363deea8609e3a948a47 | Make AutocompleteModel break the query into words like the Django admin does. | luzfcb/django-autocomplete-light,blueyed/django-autocomplete-light,shubhamdipt/django-autocomplete-light,Perkville/django-autocomplete-light,Visgean/django-autocomplete-light,Eraldo/django-autocomplete-light,shubhamdipt/django-autocomplete-light,dsanders11/django-autocomplete-light,Perkville/django-autocomplete-light,E... | autocomplete_light/autocomplete/model.py | autocomplete_light/autocomplete/model.py | from django.db.models import Q
__all__ = ('AutocompleteModel', )
class AutocompleteModel(object):
limit_choices = 20
choices = None
search_fields = None
def choice_value(self, choice):
return choice.pk
def choice_label(self, choice):
return unicode(choice)
def order_choices... | from django.db.models import Q
__all__ = ('AutocompleteModel', )
class AutocompleteModel(object):
limit_choices = 20
choices = None
search_fields = None
def choice_value(self, choice):
return choice.pk
def choice_label(self, choice):
return unicode(choice)
def order_choices... | mit | Python |
11cd923e978cf5d0e035fcff74533fa5985af519 | fix posting messages with Orange (closes #614) | eirmag/weboob,Boussadia/weboob,nojhan/weboob-devel,yannrouillard/weboob,eirmag/weboob,Konubinix/weboob,franek/weboob,RouxRC/weboob,franek/weboob,yannrouillard/weboob,eirmag/weboob,willprice/weboob,Konubinix/weboob,sputnick-dev/weboob,laurent-george/weboob,frankrousseau/weboob,RouxRC/weboob,nojhan/weboob-devel,Boussadia... | weboob/backends/orange/pages/compose.py | weboob/backends/orange/pages/compose.py | # -*- coding: utf-8 -*-
# Copyright(C) 2010 Nicolas Duhamel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will... | # -*- coding: utf-8 -*-
# Copyright(C) 2010 Nicolas Duhamel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will... | agpl-3.0 | Python |
8d3668fc4588ba52aa78798385cc706e83eba1ff | Allow bypass of num files filter | RTSYork/bibtex,iangray001/bibtex,iangray001/bibtex,RTSYork/bibtex,RTSYork/bibtex,iangray001/bibtex | bibtex/admin.py | bibtex/admin.py | import os
from django.contrib import admin
from bibtex.models import Entry, Docfile
from django.forms import TextInput, Textarea
from django.db import models
from django.conf import settings
class DocInline(admin.TabularInline):
def link(self, instance):
l = settings.MEDIA_URL + instance.filename
return "<a href=... | import os
from django.contrib import admin
from bibtex.models import Entry, Docfile
from django.forms import TextInput, Textarea
from django.db import models
from django.conf import settings
class DocInline(admin.TabularInline):
def link(self, instance):
l = settings.MEDIA_URL + instance.filename
return "<a href=... | mit | Python |
c606c7dde959647d96deb9db6bf3b848eb412798 | add the copyright | akretion/openerp-server,akretion/openerp-server,akretion/openerp-server | bin/__init__.py | bin/__init__.py | ##############################################################################
#
# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
#
# $Id: account.py 1005 2005-07-25 08:41:42Z fp $
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsa... | agpl-3.0 | Python | |
95c80b8f60f4ac92ca664f7f136d61e6dbd6ffa8 | add reading order for logging (#18233) | Azure/azure-sdk-for-python,Azure/azure-sdk-for-python,Azure/azure-sdk-for-python,Azure/azure-sdk-for-python | sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_base_client.py | sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_base_client.py | # coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from typing import Any, Union, TYPE_CHECKING
from azure.core.pipeline.policies import HttpLoggingPolicy
from ._generated._form_recognizer_client import F... | # coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from typing import Any, Union, TYPE_CHECKING
from azure.core.pipeline.policies import HttpLoggingPolicy
from ._generated._form_recognizer_client import F... | mit | Python |
cd96f7f5555828c3b4da435b852a52828b4ac05b | Change default options, just run one SVT and one lowpass pass. | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment | analysis/smooth-data.py | analysis/smooth-data.py | #!/usr/bin/env python
import climate
import collections
import multiprocessing as mp
import database
def smooth(args):
args.trial.load()
args.trial.replace_dropouts(args.visibility)
#args.trial.drop_nonindex_fingers()
args.trial.reindex(args.frame_rate)
args.trial.svt(
threshold=args.thr... | #!/usr/bin/env python
import climate
import collections
import multiprocessing as mp
import database
def smooth(args):
args.trial.load()
args.trial.replace_dropouts(args.visibility)
args.trial.reindex(args.frame_rate)
args.trial.svt(args.threshold, 4 * args.accuracy, args.frames)
args.trial.lowp... | mit | Python |
887bd73263f4b9e5f8a274df187b1ba268029a8b | Test load_any with JSONPath | tkf/dictsdiff | src/dictsdiff/tests/test_loader.py | src/dictsdiff/tests/test_loader.py | import pickle
import pytest
from ..loader import load_any, to_info_dict, transforming_loader
def test_load_yaml(tmpdir):
paramfile = tmpdir.join('param.yaml')
paramfile.write('x: 1')
loaded = load_any(str(paramfile))
assert loaded == {'x': 1}
@pytest.mark.parametrize('filename', ['param.json', 'pa... | import pickle
import pytest
from ..loader import load_any, to_info_dict, transforming_loader
def test_load_yaml(tmpdir):
paramfile = tmpdir.join('param.yaml')
paramfile.write('x: 1')
loaded = load_any(str(paramfile))
assert loaded == {'x': 1}
@pytest.mark.parametrize('filename', ['param.json', 'pa... | bsd-2-clause | Python |
bf24db9502f59f2ea42e5c26bb0bfb0e421c1b90 | use app.config instead of importing | wuvt/wuvt-site,wuvt/wuvt-site,wuvt/wuvt-site,wuvt/wuvt-site | wuvt/celeryconfig.py | wuvt/celeryconfig.py | from celery import Celery
def make_celery(app):
celery = Celery(app.import_name, broker=app.config['CELERY_BROKER_URL'])
celery.conf.update(app.config)
TaskBase = celery.Task
class ContextTask(TaskBase):
abstract = True
def __call__(self, *args, **kwargs):
with app.app_conte... | from celery import Celery
from wuvt import config
def make_celery(app):
celery = Celery(app.import_name, broker=config.CELERY_BROKER_URL)
celery.conf.update(app.config)
TaskBase = celery.Task
class ContextTask(TaskBase):
abstract = True
def __call__(self, *args, **kwargs):
w... | agpl-3.0 | Python |
cc44aec119d75ffcf4d933a6eff6bdcb5b243967 | test push | davisk/gateway,davisk/gateway,beccannlittle/gateway,beccannlittle/gateway,beccannlittle/gateway,davisk/gateway,beccannlittle/gateway | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project316.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project316.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| mit | Python |
aea47188e8e3c089221ad298fc5ac4381ee891de | manage change | sotdjin/glibglab,sotdjin/glibglab,sotdjin/glibglab,sotdjin/glibglab,sotdjin/glibglab | manage.py | manage.py | import os
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from app import app, db
#app.config.from_object(os.environ['APP_SETTINGS'])
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
if __name__ == '__main__':
manager.run() | import os
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from app import app, db
#app.config.from_object(os.environ['APP_SETTINGS'])
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
if __name__ == '__main__':
manager.run() | mit | Python |
6569f132f0d8104debe279e1b9308397792e1c5d | add metric for pool size | guy-mograbi-at-gigaspaces/widget-dd-checks,guy-mograbi-at-gigaspaces/widget-dd-checks,guy-mograbi-at-gigaspaces/widget-dd-checks | build/vagrant/synced_folder/checks.d/pool_size.py | build/vagrant/synced_folder/checks.d/pool_size.py | import os
import json
import requests
import re
import unicodedata
from checks import AgentCheck
# http://code.activestate.com/recipes/577257-slugify-make-a-string-usable-in-a-url-or-filename/
_slugify_strip_re = re.compile(r'[^\w\s-]')
_slugify_hyphenate_re = re.compile(r'[-\s]+')
def _slugify(value):
if not is... | import os
import json
import requests
import re
import unicodedata
from checks import AgentCheck
# http://code.activestate.com/recipes/577257-slugify-make-a-string-usable-in-a-url-or-filename/
_slugify_strip_re = re.compile(r'[^\w\s-]')
_slugify_hyphenate_re = re.compile(r'[-\s]+')
def _slugify(value):
if not is... | mit | Python |
6ec7465b5ec96b44e82cae9db58d6529e60ff920 | Add doc comment to nwod lint tests | aurule/npc,aurule/npc | tests/linters/test_lint_nwod.py | tests/linters/test_lint_nwod.py | """Tests the helpers for linting generic nwod characters"""
import npc
import pytest
import os
from tests.util import fixture_dir
def test_has_virtue():
char_file = fixture_dir('linter', 'nwod', 'Has Virtue.nwod')
with open(char_file, 'r') as char_file:
problems = npc.linters.nwod.lint_vice_virtue(cha... | import npc
import pytest
import os
from tests.util import fixture_dir
def test_has_virtue():
char_file = fixture_dir('linter', 'nwod', 'Has Virtue.nwod')
with open(char_file, 'r') as char_file:
problems = npc.linters.nwod.lint_vice_virtue(char_file.read())
assert 'Missing virtue' not in problem... | mit | Python |
792a6e2255a62fb6777106839afdb9a12a681102 | Bump version | ckan/datapusher | datapusher/__init__.py | datapusher/__init__.py | __version__ = '0.0.18'
| __version__ = '0.0.17'
| agpl-3.0 | Python |
fd4451162414fe9c1b1aca30d34d37faacdd6dfa | update myrename script | jamesp9/dotfiles,jamesp9/dotfiles | bin/myrename.py | bin/myrename.py | #!/usr/bin/env python3
import glob
import os
import re
import sys
import shutil
def myrename(src_filename):
"""
"""
if os.path.isfile(src_filename):
filename, extension = os.path.splitext(src_filename)
elif os.path.isdir(src_filename):
filename, extension = src_filename, ''
chars... | #!/usr/bin/env python3
import glob
import os
import re
import sys
import shutil
def myrename(src_filename):
if os.path.isfile(src_filename):
filename, extension = os.path.splitext(src_filename)
elif os.path.isdir(src_filename):
filename, extension = src_filename, ''
chars_to_remove = [' ... | mit | Python |
2298e382e13323b338d7319e242ce94e2da39212 | Correct structure for checking for Tutor (#474) | openstax/openstax-cms,openstax/openstax-cms,openstax/openstax-cms,openstax/openstax-cms,Connexions/openstax-cms,Connexions/openstax-cms | accounts/pipelines.py | accounts/pipelines.py | from django.contrib.auth.models import Group
from social.apps.django_app.default.models import UserSocialAuth
def save_profile(user, *args, **kwargs):
# for now - setting email address to prevent issues, should update it
# eventually
if user:
user.email = '{}@openstax.org'.format(user.username)
... | from django.contrib.auth.models import Group
from social.apps.django_app.default.models import UserSocialAuth
def save_profile(user, *args, **kwargs):
# for now - setting email address to prevent issues, should update it
# eventually
if user:
user.email = '{}@openstax.org'.format(user.username)
... | agpl-3.0 | Python |
2a3eaffd4e4b1ca679657f982ff8fb9eeb5647d5 | add case exception | microstack/api_gateway | api_gateway/api/base.py | api_gateway/api/base.py | import requests
class BaseForAPIGW():
def __init__(self):
self.base_url = 'http://localhost:80'
self.api_key_query = ''
def response_text_from_request(self, resource):
request_url = self.base_url + resource + self.api_key_query
try:
response = requests.get(request_... | import requests
class BaseForAPIGW():
def __init__(self):
self.base_url = 'http://localhost:80'
self.api_key_query = ''
def response_text_from_request(self, resource):
request_url = self.base_url + resource + self.api_key_query
response = requests.get(request_url)
text... | mit | Python |
e839097a49dd95c394941440a0f24017a4e747f1 | Make tag template injector more readable | Encrylize/flask-blogger,Encrylize/flask-blogger,Encrylize/flask-blogger | app/main/views.py | app/main/views.py | from flask import Blueprint, render_template, redirect, url_for, current_app, g
from sqlalchemy import desc
from app import db
from app.main.forms import SearchForm
from app.models import Post, Tag, tags_posts
main = Blueprint('main', __name__)
@main.route('/')
@main.route('/index')
@main.route('/index/<int:page>')... | from flask import Blueprint, render_template, redirect, url_for, current_app, g
from sqlalchemy import desc
from app import db
from app.main.forms import SearchForm
from app.models import Post, Tag, tags_posts
main = Blueprint('main', __name__)
@main.route('/')
@main.route('/index')
@main.route('/index/<int:page>')... | mit | Python |
38fae89bbe7f0cdf9428ce8248e4cd91b00fce88 | Fix logic of "--parseable", "--verbose" flags | jrsmith3/refmanage | refmanage/refmanage.py | refmanage/refmanage.py | # -*- coding: utf-8 -*-
import os
import argparse
import fs_utils
from pybtex.database.input import bibtex
def main():
"""
Command-line interface
"""
parser = argparse.ArgumentParser(description="Manage BibTeX files")
parser.add_argument("-t", "--test",
action="store_true",
help="... | # -*- coding: utf-8 -*-
import os
import argparse
import fs_utils
from pybtex.database.input import bibtex
def main():
"""
Command-line interface
"""
parser = argparse.ArgumentParser(description="Manage BibTeX files")
parser.add_argument("-t", "--test",
action="store_true",
help="... | mit | Python |
075e5659a2a1c7659144ea8af4e9d5bfac88be84 | remove cloning repos to avoid tensorflow session errors | bethgelab/foolbox,bethgelab/foolbox | foolbox/tests/test_model_zoo.py | foolbox/tests/test_model_zoo.py | from foolbox import zoo
import numpy as np
import foolbox
import sys
import pytest
from foolbox.zoo.model_loader import ModelLoader
@pytest.fixture(autouse=True)
def unload_foolbox_model_module():
# reload foolbox_model from scratch for every run
# to ensure atomic tests without side effects
module_names ... | from foolbox import zoo
import numpy as np
import foolbox
import sys
import pytest
from foolbox.zoo.model_loader import ModelLoader
@pytest.fixture(autouse=True)
def unload_foolbox_model_module():
# reload foolbox_model from scratch for every run
# to ensure atomic tests without side effects
module_names ... | mit | Python |
9966b84842b2d375c77ce135cf37bde336b80b65 | Refactor for using less contexts and tell the story better | jaimegildesagredo/mamba,eferro/mamba,dex4er/mamba,nestorsalceda/mamba,angelsanz/mamba,alejandrodob/mamba,markng/mamba | spec/subject_spec.py | spec/subject_spec.py | # -*- coding: utf-8 -*-
from mamba import describe, context, before
from sure import expect
class Subject(object):
pass
class SubjectWithBeforeHook(object):
pass
class SubjectWithArguments(object):
def __init__(self, argument):
pass
class SubjectWithArgumentsAndBeforeEachHook(object):
... | # -*- coding: utf-8 -*-
from mamba import describe, context, before
from sure import expect
class Subject(object):
pass
with describe(Subject) as first_context:
def it_should_be_instantiated_automatically():
expect(first_context).to.have.property('subject').to.be.a(Subject)
first_context.... | mit | Python |
4bf7af66d6948d262d1115e460326fda720060de | Increment version for minor release | rhiever/datacleaner,rhiever/datacleaner | datacleaner/_version.py | datacleaner/_version.py | # -*- coding: utf-8 -*-
"""
Copyright (c) 2016 Randal S. Olson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, m... | # -*- coding: utf-8 -*-
"""
Copyright (c) 2016 Randal S. Olson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, m... | mit | Python |
6f0d11a2cc29894288b0b611903c6e5fe911ac02 | Update LoggerK.py | FabioChiodini/LoggerK | LoggerK.py | LoggerK.py | import logging
import logstash
import sys
if 'LOG_HOST' not in os.environ:
raise(Exception("LOG_HOST NOT DEFINED"))
host = os.environ['LOG_HOST']
test_logger = logging.getLogger('python-logstash-logger')
test_logger.setLevel(logging.INFO)
test_logger.addHandler(logstash.LogstashHandler(host, 5000, version=1))
... | import logging
import logstash
import sys
if 'LOG_HOST' not in os.environ:
raise(Exception("LOG_HOST NOT DEFINED"))
host = os.environ['LOG_HOST']
test_logger = logging.getLogger('python-logstash-logger')
test_logger.setLevel(logging.INFO)
test_logger.addHandler(logstash.LogstashHandler(host, 5000, version=1))
... | mit | Python |
106c8085c2dbe700a999002a70c213308057682e | Use OrderedDict for block helper | stefanw/froide,fin/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,fin/froide,fin/froide,stefanw/froide | froide/helper/templatetags/block_helper.py | froide/helper/templatetags/block_helper.py | from collections import defaultdict, OrderedDict
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
VAR_NAME = '_ASSET_CONTEXT'
def get_default_dict():
return defaultdict(OrderedDict)
@register.tag(name="addtoblock")
def do_addtoblock(parser, token):
n... | from collections import defaultdict, OrderedDict
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
VAR_NAME = '_ASSET_CONTEXT'
def get_default_dict():
return defaultdict(OrderedDict)
@register.tag(name="addtoblock")
def do_addtoblock(parser, token):
n... | mit | Python |
621e99accf3a359020282253ba88d55938ae378c | Add prompt override back into remove_resources command. | archesproject/arches,archesproject/arches,archesproject/arches,archesproject/arches | arches/management/commands/resources.py | arches/management/commands/resources.py | '''
ARCHES - a program developed to inventory and manage immovable cultural heritage.
Copyright (C) 2013 J. Paul Getty Trust and World Monuments Fund
This program 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 Software Founda... | '''
ARCHES - a program developed to inventory and manage immovable cultural heritage.
Copyright (C) 2013 J. Paul Getty Trust and World Monuments Fund
This program 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 Software Founda... | agpl-3.0 | Python |
1451b27d131bdfad215113c32ea5a411c7417f31 | change the receiver | elixirhub/events-portal-scraping-scripts | UpdateEmailNotification.py | UpdateEmailNotification.py | __author__ = 'chuqiao'
import smtplib
import base64
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
def viewlog(file):
file = open("Eventsportal.log")
file.seek(0,2)# Go to the end of the file
while True:
line = file.readline()
if "***Finished updatin... | __author__ = 'chuqiao'
import smtplib
import base64
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
def viewlog(file):
file = open("Eventsportal.log")
file.seek(0,2)# Go to the end of the file
while True:
line = file.readline()
if "***Finished updatin... | mit | Python |
d67201de4c715acabbafb8ad75a27bd6f2bb9379 | Update wsgi-intercept. | concordusapps/alchemist | alchemist/_version.py | alchemist/_version.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division
__version_info__ = (0, 3, 1)
__version__ = '.'.join(map(str, __version_info__))
| # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division
__version_info__ = (0, 3, 0)
__version__ = '.'.join(map(str, __version_info__))
| mit | Python |
9059db635b030cbbefea63930d155bab4ec803b3 | Revert "Access-Control-Allow-Origin comment out" | ExCiteS/geokey-webresources,ExCiteS/geokey-webresources | geokey_webresources/helpers/url_helpers.py | geokey_webresources/helpers/url_helpers.py | """All helpers for the URL."""
import urllib2
from mimetypes import MimeTypes
from ..base import FORMAT
from ..exceptions import URLError
def check_url(url):
"""
Check if URL is accessible and what data format it is.
Parameters
----------
url : str
URL to check.
Returns
------... | """All helpers for the URL."""
import urllib2
from mimetypes import MimeTypes
from ..base import FORMAT
from ..exceptions import URLError
def check_url(url):
"""
Check if URL is accessible and what data format it is.
Parameters
----------
url : str
URL to check.
Returns
------... | mit | Python |
5e5497e60925a7923eb2842299aeea8a5e1a96ff | Add names to subresnet blocks | explosion/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc | thinc/neural/_classes/resnet.py | thinc/neural/_classes/resnet.py | from .model import Model
from .batchnorm import BatchNormalization, ScaleShift
from ...api import layerize
from .affine import Affine
class ResBlock(Model):
name = 'resblock'
@property
def input_shape(self):
return (self.nr_out,)
@property
def output_shape(self):
return (self.nr_o... | from .model import Model
from .batchnorm import BatchNormalization, ScaleShift
from ...api import layerize
from .affine import Affine
class ResBlock(Model):
@property
def input_shape(self):
return (self.nr_out,)
@property
def output_shape(self):
return (self.nr_out,)
def __init__... | mit | Python |
78478d1f634efb94105a68997428ab7ea840c2d0 | improve log redo | parazyd/amprolla,parazyd/amprolla | lib/log.py | lib/log.py | # See LICENSE file for copyright and license details.
"""
Logging functions
"""
from time import time
from os import makedirs, remove
from os.path import join
import sys
from lib.config import logdir
def die(msg, tofile=True):
"""
Log error and exit with exitcode 1
"""
msg = "%d [ERR] %s\n" % (int(... | # See LICENSE file for copyright and license details.
"""
Logging functions
"""
from time import time
from os import makedirs, remove
from os.path import join
import sys
from lib.config import logdir
def die(msg, tofile=True):
"""
Log error and exit with exitcode 1
"""
msg = "%d [ERR] %s\n" % (int(... | agpl-3.0 | Python |
81e0ce9caa6ebc9a118f531e43f427aace04cd5c | verify token denemesi | itucsProject2/Proje2 | botair/views.py | botair/views.py | from django.views import generic
from django.http.response import HttpResponse
# Create your views here.
class BotairView(generic.View):
def get(self, request, *args, **kwargs):
if self.request.GET['hub.verify_token'] == '150120017150120021150130281':
return HttpResponse(self.request.GET['hub.c... | from django.views import generic
from django.http.response import HttpResponse
# Create your views here.
class BotairView(generic.View):
def get(self, request, *args, **kwargs):
if self.request.GET['hub.verify_token'] == 'EAAJPGyHraTUBAIiXMqZCZBtmZACxAmxQ9YZB9BZBCQao67vZADEfd2QMHiZBQDIHX621SFbEGRyIpdTxQIai... | unlicense | Python |
5290236eb7eb0936b38819589758eeb81fcf5dde | Update networkSegmentation.py | josedolz/LiviaNET | src/networkSegmentation.py | src/networkSegmentation.py | """
Copyright (c) 2016, Jose Dolz .All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the f... | """
Copyright (c) 2016, Jose Dolz .All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the f... | mit | Python |
b82f61e4cf8e9dc31d2716c6557ca5798ecbc9c2 | Update url_to_prefetch.py | jgstew/tools,jgstew/tools,jgstew/tools,jgstew/tools | Python/url_to_prefetch.py | Python/url_to_prefetch.py | from __future__ import with_statement
from hashlib import sha1, sha256
try:
from urllib.request import urlopen # Python 3
except ImportError:
from urllib2 import urlopen # Python 2
def url_to_prefetch(url)
hashes = sha1(), sha256()
chunksize = max(4096, max(h.block_size for h in hashes))
size = 0
filename... | from __future__ import with_statement
from hashlib import sha1, sha256
try:
from urllib.request import urlopen # Python 3
except ImportError:
from urllib2 import urlopen # Python 2
def url_to_prefetch(url)
hashes = sha1(), sha256()
chunksize = max(4096, max(h.block_size for h in hashes))
size = 0
respo... | mit | Python |
65c347af4bb75154390744b53d6f2e0c75948f6b | Make ProposalAdmin work when creating | pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016 | src/proposals/admin.py | src/proposals/admin.py | from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
from import_export.admin import ExportMixin
from .models import AdditionalSpeaker, TalkProposal, TutorialProposal
from .resources import TalkProposalResource
class AdditionalSpeakerInline(GenericTabularInline):
m... | from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
from import_export.admin import ExportMixin
from .models import AdditionalSpeaker, TalkProposal, TutorialProposal
from .resources import TalkProposalResource
class AdditionalSpeakerInline(GenericTabularInline):
m... | mit | Python |
4f1e3c900a33646c8912e03806ec286286aa4dac | Fix bug where block could crash on lots of clicks | 5225225/bar,5225225/bar | linelib.py | linelib.py | import socket
import json
import os
import signal
def getclick(ID):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("localhost", 1337))
s.send(bytes("GETCLICK {}".format(ID), "UTF-8"))
clickobj = s.recv(2048)
s.close()
return clickobj
def waitsig(seconds):
signal.alarm(i... | import socket
import json
import os
import signal
def getclick(ID):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("localhost", 1337))
s.send(bytes("GETCLICK {}".format(ID), "UTF-8"))
clickobj = s.recv(2048)
s.close()
return clickobj
def waitsig(seconds):
signal.alarm(i... | mit | Python |
c732d91d5d326f0c05c43ac6480a3bd4737a86c9 | add sanitize function entry point | googlefonts/ots-python,googlefonts/ots-python | src/python/ots/__init__.py | src/python/ots/__init__.py | import subprocess
import sys
import os
OTS_SANITIZE = os.path.join(os.path.dirname(__file__), "ots-sanitize")
def sanitize(args=None):
if args is None:
args = sys.argv[1:]
return subprocess.call([OTS_SANITIZE] + args)
| bsd-3-clause | Python | |
8f3a18cd6bb07952d724d8d28ef17d657611d6bd | Add multi-generation. | cranndarach/namegen | namegen.py | namegen.py | #!/usr/bin/env python3
import random as rd
import wordutils
namefile = "names.csv"
with open(namefile, "r") as f:
names = [name[:-1] for name in f.readlines()]
vowels = ['a', 'e', 'i', 'o', 'u', 'y']
clusters = wordutils.clusters(names, vowels)
def generate(clusters, vowels, max_len=12):
if rd.randrange(10)... | #!/usr/bin/env python3
import random as rd
import wordutils
namefile = "names.csv"
with open(namefile, "r") as f:
names = [name[:-1] for name in f.readlines()]
vowels = ['a', 'e', 'i', 'o', 'u', 'y']
clusters = wordutils.clusters(names, vowels)
def generate(clusters, vowels, max_len=12):
if rd.randrange(10)... | mit | Python |
ab18310927b4c5623257588f062e2f2d1046160a | Drop Py2 and six on tests/integration/modules/test_win_servermanager.py | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/integration/modules/test_win_servermanager.py | tests/integration/modules/test_win_servermanager.py | import pytest
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import slowTest
from tests.support.unit import skipIf
@skipIf(not salt.utils.platform.is_windows(), "windows test only")
@pytest.mark.windows_whitelisted
class WinServermanagerTest(ModuleCase):
"""
Te... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import pytest
import salt.utils.platform
from tests.support.case import ModuleCase
from tests.support.helpers import slowTest
from tests.support.unit import skipIf
@skipIf(not salt.utils.platform.is_windows(), "windows test only")
@pytest.mark.windows_w... | apache-2.0 | Python |
f9fbea259f3ac4437db0365dbfbceb0c0151ac84 | Handle keyboard interrupt | marten-cz/loco-cli | localise/localise.py | localise/localise.py | #!/usr/bin/env python
import argparse
from colorama import init, Fore, Back, Style
from commands import *
import signal
import sys
def signal_handler(signal, frame):
print("\nInterrupted!")
sys.exit(0)
def get_configuration(args):
from os.path import expanduser
home = expanduser("~")
config_file ... | #!/usr/bin/env python
import argparse
from colorama import init, Fore, Back, Style
from commands import *
def get_configuration(args):
from os.path import expanduser
home = expanduser("~")
config_file = home + '/.localise/config.yml'
if hasattr(args, config_file):
config_file = args.config_fil... | mit | Python |
295dbe2238717ad2ab7e2e0034295608827acd80 | Update stopwatch.pyw | ozyjay/stopwatch | stopwatch.pyw | stopwatch.pyw | from tkinter import *
class Time:
def __init__(self):
self.reset()
def reset(self):
self.hours = 0
self.mins = 0
self.secs = 0
def tick(self):
self.secs += 1
if self.secs == 60:
self.secs = 0
self.mins += 1
if self.mins == 60... | from tkinter import *
root = Tk()
state = "IDLE"
class Time:
def __init__(self):
self.reset()
def reset(self):
self.hours = 0
self.mins = 0
self.secs = 0
def tick(self):
self.secs += 1
if self.secs == 60:
self.secs = 0
self.mins +=... | mit | Python |
77179ef9375640eb300171e5bd38e68b999f9daf | Handle removal; keep track of devices and info | drkitty/arise | monitor.py | monitor.py | from __future__ import unicode_literals
import re
from subprocess import Popen, PIPE, STDOUT
from sys import stdout
from time import sleep
bit_bucket = open('/dev/null', 'w')
monitor_p = Popen(('stdbuf', '-oL', 'udevadm', 'monitor', '-k'), stdout=PIPE,
stderr=PIPE, bufsize=1)
block_add_pattern = re.com... | import re
from subprocess import Popen, PIPE, STDOUT
from sys import stdout
p = Popen(('stdbuf', '-oL', 'udevadm', 'monitor', '-k'), stdout=PIPE,
stderr=STDOUT, bufsize=1)
c = re.compile(r'KERNEL\[[^]]*\]\s*add\s*(?P<dev_path>\S*)\s*\(block\)')
for line in iter(p.stdout.readline, b''):
m = c.match(lin... | mit | Python |
da073324bcaee23c80c98f7d9f26fc9698d07bfa | Add pop() to UserDict. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/UserDict.py | Lib/UserDict.py | """A more or less complete user-defined wrapper around dictionary objects."""
class UserDict:
def __init__(self, dict=None):
self.data = {}
if dict is not None: self.update(dict)
def __repr__(self): return repr(self.data)
def __cmp__(self, dict):
if isinstance(dict, UserDict):
... | """A more or less complete user-defined wrapper around dictionary objects."""
class UserDict:
def __init__(self, dict=None):
self.data = {}
if dict is not None: self.update(dict)
def __repr__(self): return repr(self.data)
def __cmp__(self, dict):
if isinstance(dict, UserDict):
... | mit | Python |
4d99663ef91faee04bfdc1042d3d7796c7734f45 | Add latest version of py-cffi (#13322) | iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/py-cffi/package.py | var/spack/repos/builtin/packages/py-cffi/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import sys
class PyCffi(PythonPackage):
"""Foreign Function Interface for Python calling C code"... | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import sys
class PyCffi(PythonPackage):
"""Foreign Function Interface for Python calling C code"... | lgpl-2.1 | Python |
3b9144a4a49250ecd3bb77012bf32dda44907139 | add version 0.3.6 to r-vctrs (#20878) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/r-vctrs/package.py | var/spack/repos/builtin/packages/r-vctrs/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)
from spack import *
class RVctrs(RPackage):
"""Vector Helpers
Defines new notions of prototype and size that ar... | # 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)
from spack import *
class RVctrs(RPackage):
"""Defines new notions of prototype and size that are used to provide to... | lgpl-2.1 | Python |
91926d22a5eeea5c4ece96292e1eb37c96e03949 | Update letter-combinations-of-a-phone-number.py | kamyu104/LeetCode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,githubutilities/LeetCode,jaredkoontz/leetcode,kamyu104/LeetCode,yiwen-luo/LeetCode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,... | Python/letter-combinations-of-a-phone-number.py | Python/letter-combinations-of-a-phone-number.py | # Time: O(n * 4^n)
# Space: O(n)
#
# Given a digit string, return all possible letter combinations that the number could represent.
#
# A mapping of digit to letters (just like on the telephone buttons) is given below.
#
# lookup = ["", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"]
#
# Input:Digit s... | # Time: O(n * 4^n)
# Space: O(1)
#
# Given a digit string, return all possible letter combinations that the number could represent.
#
# A mapping of digit to letters (just like on the telephone buttons) is given below.
#
# lookup = ["", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"]
#
# Input:Digit s... | mit | Python |
fed4aeb076ee24a9b8666db25523c775b3fe0f86 | Make filter summary memory-efficient | raviqqe/tensorflow-extenteten,raviqqe/tensorflow-extenteten | nn/conv.py | nn/conv.py | import functools
import tensorflow as tf
from .util import funcname_scope, static_rank, static_shape
from .variable import variable
from .assertion import is_natural_num, is_natural_num_sequence
@funcname_scope
def multi_conv_and_pool(x,
*,
nums_of_channels,
... | import functools
import tensorflow as tf
from .util import funcname_scope, static_rank, static_shape
from .variable import variable
from .assertion import is_natural_num, is_natural_num_sequence
@funcname_scope
def multi_conv_and_pool(x,
*,
nums_of_channels,
... | unlicense | Python |
0997b71d1ab54700cac0505d00395a3c1de0f0c7 | change 3*PV to N*PV and add init changes | convexengineering/gplibrary,convexengineering/gplibrary | npv/npv.py | npv/npv.py | ### NPV MODEL ###
from gpkit import Model, Variable, units, VectorVariable
from gpkit.tools import te_exp_minus1
import gpkit
import numpy as np
class NPV(Model):
def __init__(self):
N = 3 # number of payments
NPV = Variable('NPV', 'USD', 'net present value')
PV = Variable('PV', 'USD', 'p... | ### NPV MODEL ###
from gpkit import Model, Variable, units, VectorVariable
from gpkit.tools import te_exp_minus1
import gpkit
import numpy as np
class NPV(Model):
def setup(self):
N = 20 # number of payments
NPV = Variable('NPV', 'USD', 'net present value')
PV = Variable('PV', 'USD', 'pre... | mit | Python |
d7c7a2f676b4aecb08988e649af6bf5dcbbdeb0c | change copyright for a file and fix bug comparing branch with upstream | DrXyzzy/smc,DrXyzzy/smc,DrXyzzy/smc,sagemathinc/smc,sagemathinc/smc,sagemathinc/smc,tscholl2/smc,tscholl2/smc,tscholl2/smc,sagemathinc/smc,DrXyzzy/smc,tscholl2/smc,tscholl2/smc | src/smc_pyutil/smc_pyutil/smc_git.py | src/smc_pyutil/smc_pyutil/smc_git.py | #!/usr/bin/python
"""
(c) Tim Clemans, 2016
"""
import json, os, subprocess, sys, uuid
def current_branch():
result = os.popen('git rev-parse --abbrev-ref HEAD 2> /dev/null || echo "master" ').read().strip('\n').split('\n')[-1]
return result.strip()
def changed_tracked_files():
results = os.popen('git ... | #!/usr/bin/python
"""
(c) William Stein, 2013
"""
import json, os, subprocess, sys, uuid
def current_branch():
result = os.popen('git rev-parse --abbrev-ref HEAD 2> /dev/null || echo "master" ').read().strip('\n').split('\n')[-1]
return result.strip()
def changed_tracked_files():
results = os.popen('gi... | agpl-3.0 | Python |
aa092529bb643eabae45ae051ecd99d6bebb88ea | Send methods need to return the result | smarr/RTruffleSOM,SOM-st/PySOM,SOM-st/RPySOM,smarr/PySOM,SOM-st/RTruffleSOM,SOM-st/RPySOM,SOM-st/RTruffleSOM,SOM-st/PySOM,smarr/RTruffleSOM,smarr/PySOM | src/som/vmobjects/abstract_object.py | src/som/vmobjects/abstract_object.py | class AbstractObject(object):
def __init__(self):
pass
def send(self, frame, selector_string, arguments, universe):
# Turn the selector string into a selector
selector = universe.symbol_for(selector_string)
invokable = self.get_class(universe).lookup_invokable(selec... | class AbstractObject(object):
def __init__(self):
pass
def send(self, frame, selector_string, arguments, universe):
# Turn the selector string into a selector
selector = universe.symbol_for(selector_string)
invokable = self.get_class(universe).lookup_invokable(selec... | mit | Python |
a086111c5b29808bc427cdbe812b8d816f927b74 | Improve unittests. | dpshelio/sunpy,dpshelio/sunpy,dpshelio/sunpy,Alex-Ian-Hamilton/sunpy,Alex-Ian-Hamilton/sunpy,Alex-Ian-Hamilton/sunpy,mjm159/sunpy,mjm159/sunpy | sunpy/tests/util/test_multimethod.py | sunpy/tests/util/test_multimethod.py | import pytest
from sunpy.util.multimethod import MultiMethod, FAIL, WARN, TypeWarning
def test_super():
class String(str):
pass
mm = MultiMethod(lambda *a: a)
@mm.add_dec(str, str)
def foo(foo, bar):
return 'String'
@mm.add_dec(String, str)
def foo(foo, bar):
... | import pytest
from sunpy.util.multimethod import MultiMethod, FAIL, WARN, TypeWarning
def test_super():
class String(str):
pass
mm = MultiMethod(lambda *a: a)
@mm.add_dec(str, str)
def foo(foo, bar):
return 'String'
@mm.add_dec(String, str)
def foo(foo, bar):
... | bsd-2-clause | Python |
8fd64fc9cc945f0e54b61cf82fa4ddedd2208ac8 | Maintain working directory in unit test. | cf-platform-eng/tile-generator,cf-platform-eng/tile-generator,cf-platform-eng/tile-generator,cf-platform-eng/tile-generator | tile_generator/tile_unittest.py | tile_generator/tile_unittest.py | # tile-generator
#
# Copyright (c) 2015-Present Pivotal Software, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | # tile-generator
#
# Copyright (c) 2015-Present Pivotal Software, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | apache-2.0 | Python |
4f1ddd9f5a39260293e8229f1acfe8d6705e3ec8 | fix tests for CUDA Python | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | tests/install_tests/test_cupy_builder/test_features.py | tests/install_tests/test_cupy_builder/test_features.py | from distutils import ccompiler
from distutils import sysconfig
from cupy_builder._context import Context
from cupy_builder._features import CUDA_cuda
from cupy_builder import install_build as build
import cupy
import pytest
def get_compiler_settings():
sysconfig.get_config_vars()
compiler = ccompiler.new_c... | from distutils import ccompiler
from distutils import sysconfig
from cupy_builder._context import Context
from cupy_builder._features import CUDA_cuda
from cupy_builder import install_build as build
import cupy
import pytest
def get_compiler_settings():
sysconfig.get_config_vars()
compiler = ccompiler.new_c... | mit | Python |
539f0c6626f4ec18a0995f90727425748a5eaee9 | Add sync trigger to latest migration | Encrylize/MyDictionary,Encrylize/MyDictionary,Encrylize/MyDictionary | migrations/versions/2f3192e76e5_.py | migrations/versions/2f3192e76e5_.py | """empty message
Revision ID: 2f3192e76e5
Revises: 3dbc20af3c9
Create Date: 2015-11-24 15:28:41.695124
"""
# revision identifiers, used by Alembic.
revision = '2f3192e76e5'
down_revision = '3dbc20af3c9'
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
from sqlalchemy_searchable import sync_tri... | """empty message
Revision ID: 2f3192e76e5
Revises: 3dbc20af3c9
Create Date: 2015-11-24 15:28:41.695124
"""
# revision identifiers, used by Alembic.
revision = '2f3192e76e5'
down_revision = '3dbc20af3c9'
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
def upgrade():
### commands auto gen... | mit | Python |
c57e3245a0d04a57d7cc3e08e046e2913fb06d7e | Support #process != 8 | toslunar/chainerrl,toslunar/chainerrl | nsq_ale.py | nsq_ale.py | import multiprocessing as mp
import os
import argparse
import random
import numpy as np
import chainer
from chainer import optimizers
import fc_tail_q_function
import dqn_head
import q_function
import nstep_q_learning
import ale
import random_seed
import async
import rmsprop_ones
def main():
parser = argparse.... | import multiprocessing as mp
import os
import argparse
import random
import numpy as np
import chainer
from chainer import optimizers
import fc_tail_q_function
import dqn_head
import q_function
import nstep_q_learning
import ale
import random_seed
import async
import rmsprop_ones
def main():
parser = argparse.... | mit | Python |
d664c1d1b964d38b7a76ada307d7eb23919b1806 | change default error tolerance to 5000 (whoa) | krdyke/OGP-metadata-py,krdyke/OGP-metadata-py | ogp-mdt.py | ogp-mdt.py | import argparse
import glob
import os.path
from src import mgmg2ogp,fgdc2ogp
parser = argparse.ArgumentParser()
parser.add_argument("workspace",help="indicate the path where the metadata to be converted is contained")
parser.add_argument("metadata_type",help="acceptable values are FGDC or MGMG", choices=['MGMG','FGDC']... | import argparse
import glob
import os.path
from src import mgmg2ogp,fgdc2ogp
parser = argparse.ArgumentParser()
parser.add_argument("workspace",help="indicate the path where the metadata to be converted is contained")
parser.add_argument("metadata_type",help="acceptable values are FGDC or MGMG", choices=['MGMG','FGDC']... | mit | Python |
5afa1e6131e296f74f1c63f7fe28dbfa0741bfa3 | update osCheck for Py 2 & 3 | marshki/pyWipe,marshki/pyWipe | osCheck.py | osCheck.py | #!/usr/bin/env python3
# Import Python module
import os
def osCheck():
""""Check if OS is UNIX-like."""
if os.name =='posix':
print('Let there be wipe!')
else:
print('NOT POSIX-compliant, can not proceed.')
osCheck()
| #!/usr/bin/env python
# Import Python module
import os
def osCheck():
""""Check if OS is UNIX-like."""
if os.name !='posix':
print "pyWipe will ONLY run on UNIX-like systems."
else:
print "Let there be wipe!"
osCheck()
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.