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 |
|---|---|---|---|---|---|---|---|---|
fcfc8f92654b07196635002d9c4a9549232a3496 | Fix test error | kbytesys/django-recaptcha2,kbytesys/django-recaptcha2 | snowpenguin/django/recaptcha2/tests.py | snowpenguin/django/recaptcha2/tests.py | import os
from django.forms import Form
from django.test import TestCase
from snowpenguin.django.recaptcha2.fields import ReCaptchaField
from snowpenguin.django.recaptcha2.widgets import ReCaptchaWidget
class RecaptchaTestForm(Form):
recaptcha = ReCaptchaField(widget=ReCaptchaWidget())
class TestRecaptchaForm... | import os
from django.forms import Form
from django.test import TestCase
from snowpenguin.django.recaptcha2.fields import ReCaptchaField
from snowpenguin.django.recaptcha2.widgets import ReCaptchaWidget
class RecaptchaTestForm(Form):
recaptcha = ReCaptchaField(widget=ReCaptchaWidget())
class TestRecaptchaForm... | lgpl-2.1 | Python |
b498e47343efe82a4a795d07d80fa8418d18f11a | Update avatar command | r-robles/rd-bot | cogs/server.py | cogs/server.py | import discord
from discord.ext import commands
from utils.converters import InsensitiveMemberConverter
from utils.messages import ColoredEmbed
class Server:
"""Server related commands."""
def __init__(self, bot):
self.bot = bot
@commands.command()
@commands.guild_only()
async def server... | import discord
from discord.ext import commands
from utils.converters import InsensitiveMemberConverter
from utils.messages import ColoredEmbed
class Server:
"""Server related commands."""
def __init__(self, bot):
self.bot = bot
@commands.command()
@commands.guild_only()
async def server... | mit | Python |
dfa16172647d583faaaff9c8228dacf9cc11d88f | Check python version | analysiscenter/dataset | dataset/__init__.py | dataset/__init__.py | """ Dataset module implements Dataset, DatasetIndex, Preprocess and Batch classes"""
import sys
if sys.version_info < (3, 4):
raise ImportError("Dataset module requires Python 3.4 or higher")
from .base import Baseset
from .batch import Batch, ArrayBatch, DataFrameBatch
from .dataset import Dataset
from .jointdataset... | """ Dataset module implements Dataset, DatasetIndex, Preprocess and Batch classes"""
from .base import Baseset
from .batch import Batch, ArrayBatch, DataFrameBatch
from .dataset import Dataset
from .jointdataset import JointDataset, FullDataset
from .dsindex import DatasetIndex, FilesIndex
from .preprocess import Prep... | apache-2.0 | Python |
941181de8ba72f0b212e565070980601d7f29aa9 | Bump version number | Hamuko/cum | cum/version.py | cum/version.py | __version__ = '0.8'
__version_name__ = 'Miyamo Chio'
def version_string():
return '%(prog)s version %(version)s "{}"'.format(__version_name__)
| __version__ = '0.7'
__version_name__ = 'Yagami Ko'
def version_string():
return '%(prog)s version %(version)s "{}"'.format(__version_name__)
| apache-2.0 | Python |
c9613d84042c7e42aaaedfe1d7501ed72fd332c3 | add __str__ | rsutton/multidict | multidict/__init__.py | multidict/__init__.py | """
MultiDict - multi-level dictionary object
Implementation of nested dictionary which can be initialized by a
dict object or json string loaded from a file.
"""
import json
import logging
import os
class MultiDict(object):
def __init__(self, data=None, filename=None):
self.logger = logging.getLogger(_... | """
MultiDict - multi-level dictionary object
Implementation of nested dictionary which can be initialized by a
dict object or json string loaded from a file.
"""
import json
import logging
import os
class MultiDict(object):
def __init__(self, data=None, filename=None):
self.logger = logging.getLogger(_... | mit | Python |
739eba6a284ac3a5b4c38163dd564c19ca5cab1f | Add kafka client interface | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/change_feed/connection.py | corehq/apps/change_feed/connection.py | from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from django.conf import settings
from kafka.client import SimpleClient
from kafka.client import KafkaClient
from kafka.common import KafkaUnavailableError
GENERIC_KAFKA_CLIENT_ID = 'cchq-kafka-client'
def get_simple_kafk... | from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from django.conf import settings
from kafka.client import SimpleClient
from kafka.common import KafkaUnavailableError
GENERIC_KAFKA_CLIENT_ID = 'cchq-kafka-client'
def get_simple_kafka_client(client_id=GENERIC_KAFKA_CLIE... | bsd-3-clause | Python |
4fc21707fc41a2deec5280759ba30bc05c74cd4f | Fix SyntaxError: invalid syntax for python 3.2 | Alir3z4/django-cuser | cuser/tests.py | cuser/tests.py | from django.conf.urls import patterns
from django.db import models
from django.http import HttpResponse
from django.test import TestCase
import sys
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except ImportError:
from django.contrib.auth.models import User
from cuser.fields ... | from django.conf.urls import patterns
from django.db import models
from django.http import HttpResponse
from django.test import TestCase
import sys
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except ImportError:
from django.contrib.auth.models import User
from cuser.fields ... | bsd-3-clause | Python |
f51f1fb7d9dfe583c2f994be866fc7540d02a667 | Fix coords precision for realistic paths (ref #30) | Anaethelion/Geotrek,camillemonchicourt/Geotrek,mabhub/Geotrek,Anaethelion/Geotrek,camillemonchicourt/Geotrek,mabhub/Geotrek,mabhub/Geotrek,johan--/Geotrek,johan--/Geotrek,GeotrekCE/Geotrek-admin,Anaethelion/Geotrek,GeotrekCE/Geotrek-admin,camillemonchicourt/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,mabhub/Ge... | caminae/core/views.py | caminae/core/views.py | from django.contrib.auth.decorators import login_required
from django.views.generic.simple import direct_to_template
from djgeojson.views import GeoJSONLayerView
from caminae.maintenance.models import Contractor
from .models import Path
class PathList(GeoJSONLayerView):
model = Path
fields = ('name', 'valid... | from django.contrib.auth.decorators import login_required
from django.views.generic.simple import direct_to_template
from djgeojson.views import GeoJSONLayerView
from caminae.maintenance.models import Contractor
from .models import Path
class PathList(GeoJSONLayerView):
model = Path
fields = ('name', 'valid... | bsd-2-clause | Python |
080e8bed5f10115566c2308480cd78a5c67231d2 | allow "Test Current Package" to itself | randy3k/UnitTesting,randy3k/UnitTesting,randy3k/UnitTesting,randy3k/UnitTesting | unittesting/test_current.py | unittesting/test_current.py | import sublime
import sys
from .test_package import UnitTestingCommand
from .test_coverage import UnitTestingCoverageCommand
version = sublime.version()
platform = sublime.platform()
class UnitTestingCurrentPackageCommand(UnitTestingCommand):
def run(self):
project_name = self.current_package_name
... | import sublime
import sys
from .test_package import UnitTestingCommand
from .test_coverage import UnitTestingCoverageCommand
version = sublime.version()
platform = sublime.platform()
class UnitTestingCurrentPackageCommand(UnitTestingCommand):
def run(self):
project_name = self.current_package_name
... | mit | Python |
5e80cf9e1ea6628c1c4acbea46e59b5e10b4a217 | Fix #63: Replace namespace `:` to `_` with <Camera> token | BigRoy/maya-capture-gui,Colorbleed/maya-capture-gui | capture_gui/tokens.py | capture_gui/tokens.py | """Token system
The capture gui application will format tokens in the filename.
The tokens can be registered using `register_token`
"""
from . import lib
_registered_tokens = dict()
def format_tokens(string, options):
"""
Replace the tokens with the correlated strings
:param string: the filename of th... | """Token system
The capture gui application will format tokens in the filename.
The tokens can be registered using `register_token`
"""
from . import lib
_registered_tokens = dict()
def format_tokens(string, options):
"""
Replace the tokens with the correlated strings
:param string: the filename of th... | mit | Python |
3765d2fe97ebfaf9d051cce13f2816dab41ca52c | add updated date for Haystack search | manfredmacx/django-convo | convo/models.py | convo/models.py | from django.db import models
from django.contrib.auth.models import User
class EntryManager(models.Manager):
def get_convo(self, entry):
""" return this object and all children """
return self.filter(models.Q(original=entry) | models.Q(pk=entry.id))
class Entry(models.Model):
original = models.ForeignKey('self'... | from django.db import models
from django.contrib.auth.models import User
class EntryManager(models.Manager):
def get_convo(self, entry):
""" return this object and all children """
return self.filter(models.Q(original=entry) | models.Q(pk=entry.id))
class Entry(models.Model):
original = models.ForeignKey('self'... | mit | Python |
53c40692037a4dd94316932077949d7910f0af58 | Update date_range function to remove leap day | architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst | cea/utilities/date.py | cea/utilities/date.py | import pandas as pd
from cea.constants import HOURS_IN_YEAR
from calendar import isleap
def get_date_range_hours_from_year(year):
"""
creates date range in hours for the year excluding leap day
:param year: year of date range
:type year: int
:return: pd.date_range with 8760 values
:rtype: pan... | import pandas as pd
from cea.constants import HOURS_IN_YEAR
def get_dates_from_year(year):
"""
creates date range for the year of the calculation
:param year: year of first row in weather file
:type year: int
:return: pd.date_range with 8760 values
:rtype: pandas.data_range
"""
return... | mit | Python |
42998fe41a18edc683518fdd054a25c8a2c93b1a | Bump PyYAML version constraint (#2718) | mitdbg/modeldb,mitdbg/modeldb,mitdbg/modeldb,mitdbg/modeldb,mitdbg/modeldb | client/verta/setup.py | client/verta/setup.py | import os
from setuptools import find_packages, setup
HERE = os.path.abspath(os.path.dirname(__file__))
about = {}
with open(os.path.join(HERE, "verta", "__about__.py"), "r") as f:
exec(f.read(), about)
with open("README.md", "r") as f:
readme = f.read()
setup(
name=about["__title__"],
version=abo... | import os
from setuptools import find_packages, setup
HERE = os.path.abspath(os.path.dirname(__file__))
about = {}
with open(os.path.join(HERE, "verta", "__about__.py"), "r") as f:
exec(f.read(), about)
with open("README.md", "r") as f:
readme = f.read()
setup(
name=about["__title__"],
version=abo... | mit | Python |
527a95bc7d8398a4cf5a185637b38cc2e61234de | Install fluentd collectd-nest and viaq_data_model plugins | oVirt/ovirt-host-deploy,oVirt/ovirt-host-deploy,oVirt/ovirt-host-deploy | src/plugins/ovirt-host-deploy/fluentd/packages.py | src/plugins/ovirt-host-deploy/fluentd/packages.py | #
# ovirt-host-deploy -- ovirt host deployer
# Copyright (C) 2016 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.1 of the License, or (at your option) ... | #
# ovirt-host-deploy -- ovirt host deployer
# Copyright (C) 2016 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.1 of the License, or (at your option) ... | lgpl-2.1 | Python |
a26f3ee3df1f70302bc524e3a8decb1a1266aadd | Add static value to LEFT, CENTER, RIGHT | opesci/devito,opesci/devito | devito/data/meta.py | devito/data/meta.py | from devito.tools import Tag
__all__ = ['DOMAIN', 'OWNED', 'HALO', 'NOPAD', 'FULL',
'LEFT', 'RIGHT', 'CENTER']
class DataRegion(Tag):
pass
DOMAIN = DataRegion('domain')
OWNED = DataRegion('owned') # within DOMAIN
HALO = DataRegion('halo')
NOPAD = DataRegion('nopad') # == DOMAIN+HALO
FULL = DataReg... | from devito.tools import Tag
__all__ = ['DOMAIN', 'OWNED', 'HALO', 'NOPAD', 'FULL',
'LEFT', 'RIGHT', 'CENTER']
class DataRegion(Tag):
pass
DOMAIN = DataRegion('domain')
OWNED = DataRegion('owned') # within DOMAIN
HALO = DataRegion('halo')
NOPAD = DataRegion('nopad') # == DOMAIN+HALO
FULL = DataReg... | mit | Python |
fffe66094c74b68503a72c88cb7fb4017b7bb2a5 | Refactor JSON management | seguri/json-beautifier,seguri/json-beautifier,seguri/json-beautifier | json-beautifier.py | json-beautifier.py | from google.appengine.api import memcache
from webapp2_extras.security import generate_random_string
import jinja2
import json
import os
import webapp2
MEMCACHE_EXPIRE = 24 * 60 * 60 # seconds
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
)
class MainPage(web... | from google.appengine.api import memcache
from webapp2_extras.security import generate_random_string
import jinja2
import json
import os
import webapp2
MEMCACHE_EXPIRE = 24 * 60 * 60 # seconds
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
)
def is_json(s):
... | mit | Python |
8bc011ee2af9a07fd5018632e813a0aa1e7228d3 | reduce index for strong matching | opencivicdata/scrapers-ca,opencivicdata/scrapers-ca | ca_ab_edmonton/people.py | ca_ab_edmonton/people.py | from pupa.scrape import Scraper, Legislator
from pupa.models import Organization
from utils import lxmlize
import re
COUNCIL_PAGE = 'http://www.edmonton.ca/city_government/city_organization/city-councillors.aspx'
MAYOR_PAGE = 'http://www.edmonton.ca/city_government/city_organization/the-mayor.aspx'
class EdmontonPe... | from pupa.scrape import Scraper, Legislator
from pupa.models import Organization
from utils import lxmlize
import re
COUNCIL_PAGE = 'http://www.edmonton.ca/city_government/city_organization/city-councillors.aspx'
MAYOR_PAGE = 'http://www.edmonton.ca/city_government/city_organization/the-mayor.aspx'
class EdmontonPe... | mit | Python |
220748a5cc481b8df76af6a1301af94def603ee2 | Fix how tables are printed on smaller screens | tradebyte/paci,tradebyte/paci | paci/helpers/display_helper.py | paci/helpers/display_helper.py | """Helper to output stuff"""
from tabulate import tabulate
import os
def print_list(header, entries):
"""Prints out a list"""
print(tabulate(fix_descriptions(entries), header, tablefmt="presto"))
def print_table(entries):
"""Prints out a table"""
print(tabulate(cleanup_entries(entries), tablefmt="p... | """Helper to output stuff"""
from tabulate import tabulate
def print_list(header, entries):
"""Prints out a list"""
print(tabulate(entries, header, tablefmt="grid"))
def print_table(entries):
"""Prints out a table"""
print(tabulate(entries, tablefmt="plain"))
def std_input(text, default):
"""... | mit | Python |
bbae1f9ea6c399ffae2340b3b91f54f0d8b1ef8b | fix nationality | Fresnoy/kart,Fresnoy/kart | people/api.py | people/api.py | from django.contrib.auth.models import User
from tastypie import fields
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
from common.api import WebsiteResource
from .models import Artist, Staff, Organization
class UserResource(ModelResource):
class Meta:
queryset = User.objects.exclud... | from django.contrib.auth.models import User
from django_countries import countries
from tastypie import fields
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
from common.api import WebsiteResource
from .models import Artist, Staff, Organization
class UserResource(ModelResource):
class Meta:... | agpl-3.0 | Python |
8d94a17548977a24eeffceb870cfd43a5f901b29 | Update script.py | JohnLi2012/LitigationSupport,JohnLi2012/LitigationSupport | Scripts/moving_text_to_image_folder/script.py | Scripts/moving_text_to_image_folder/script.py | ##Move text files into corresponding image folders
## 1) Add GUI 2) for loop inside another for loop might have performance issue with either two directories having large amount of files
## possibly better approach is to sort and once a text file is moved, chop corresponding image from target_path
source_path = r"pat... | ##Move text files into corresponding image folders
source_path = r"path\to\TEXT"
target_path = r"path\to\IMAGES"
import glob
import ntpath
import os
import shutil
source_text_list = glob.glob(source_path+r"\**\*.TXT")
target_image_list = glob.glob(target_path+ r"\**\*")
for file in source_text_list:
text_file_n... | mit | Python |
27f29854b52d0e23f42f8620c43ed5332260ea41 | Add comment to FILESHACK_EMAIL_FROM. | peterkuma/fileshackproject,peterkuma/fileshackproject,peterkuma/fileshackproject | fileshackproject/settings_local-example.py | fileshackproject/settings_local-example.py | #DEBUG = False
#ADMINS = (
# # ('Your Name', 'your_email@example.com'),
#)
#DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
# 'NAME': '/var/www/fileshackproject/fileshack.sqlite', # Or path to database file if usin... | #DEBUG = False
#ADMINS = (
# # ('Your Name', 'your_email@example.com'),
#)
#DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
# 'NAME': '/var/www/fileshackproject/fileshack.sqlite', # Or path to database file if usin... | mit | Python |
07395f741fa059a35011c8fbee10154da6bb8c58 | drop -dev from 1.2.0 | tonycpsu/urwid,urwid/urwid,wardi/urwid,douglas-larocca/urwid,foreni-packages/urwid,ivanov/urwid,hkoof/urwid,rndusr/urwid,rndusr/urwid,rndusr/urwid,urwid/urwid,foreni-packages/urwid,douglas-larocca/urwid,harlowja/urwid,ivanov/urwid,hkoof/urwid,douglas-larocca/urwid,wardi/urwid,harlowja/urwid,harlowja/urwid,hkoof/urwid,d... | urwid/version.py | urwid/version.py |
VERSION = (1, 2, 0)
__version__ = ''.join(['-.'[type(x) == int]+str(x) for x in VERSION])[1:]
|
VERSION = (1, 2, 0, 'dev')
__version__ = ''.join(['-.'[type(x) == int]+str(x) for x in VERSION])[1:]
| lgpl-2.1 | Python |
343add502129ba8c92e678d6ebf7831a933190c0 | Bump to 0.5.13 | ulule/django-courriers,ulule/django-courriers | courriers/__init__.py | courriers/__init__.py | version = (0, 5, 13)
__version__ = '.'.join(map(str, version))
| version = (0, 5, 12)
__version__ = '.'.join(map(str, version))
| mit | Python |
a2013342253df43075b1164556a8b2704cd41bf0 | Bump version to 13.0.0a3 | genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio | resolwe_bio/__about__.py | resolwe_bio/__about__.py | """Central place for package metadata."""
# NOTE: We use __title__ instead of simply __name__ since the latter would
# interfere with a global variable __name__ denoting object's name.
__title__ = 'resolwe-bio'
__summary__ = 'Bioinformatics pipelines for the Resolwe platform'
__url__ = 'https://github.com/genial... | """Central place for package metadata."""
# NOTE: We use __title__ instead of simply __name__ since the latter would
# interfere with a global variable __name__ denoting object's name.
__title__ = 'resolwe-bio'
__summary__ = 'Bioinformatics pipelines for the Resolwe platform'
__url__ = 'https://github.com/genial... | apache-2.0 | Python |
ed63ef1070b779a7cb20a778756c458430dfc42e | Bump patch version | conan-io/conan-package-tools | cpt/__init__.py | cpt/__init__.py |
__version__ = '0.33.1'
NEWEST_CONAN_SUPPORTED = "1.26.000"
def get_client_version():
from conans.model.version import Version
from conans import __version__ as client_version
# It is a mess comparing dev versions, lets assume that the -dev is the further release
return Version(client_version.replace(... |
__version__ = '0.33.0'
NEWEST_CONAN_SUPPORTED = "1.26.000"
def get_client_version():
from conans.model.version import Version
from conans import __version__ as client_version
# It is a mess comparing dev versions, lets assume that the -dev is the further release
return Version(client_version.replace(... | mit | Python |
e42f77d374bab66fb1a90322c3b36c8f75f2499c | Add database rollback to error handler | gregcowell/PFT,gregcowell/BAM,gregcowell/BAM,gregcowell/PFT | pft/errors.py | pft/errors.py | """Module that contains error handlers."""
from flask import render_template, Blueprint
from .database import db
error = Blueprint('error', __name__)
@error.app_errorhandler(404)
def page_not_found(e):
"""Return page not found HTML page."""
return render_template('404.html'), 404
@error.app_errorhandler(50... | """Module that contains error handlers."""
from flask import render_template, Blueprint
error = Blueprint('error', __name__)
@error.app_errorhandler(404)
def page_not_found(e):
"""Return page not found HTML page."""
return render_template('404.html'), 404
@error.app_errorhandler(500)
def internal_server_er... | unknown | Python |
4fe72def959b30175398d60eda4d95b5e69bb61b | Add a --version argument | mathcamp/dql,mathcamp/dql | dql/__init__.py | dql/__init__.py | """ Simple SQL-like query language for dynamo. """
import os
import argparse
import logging.config
import six
from .cli import DQLClient
from .engine import Engine, FragmentEngine
__version__ = '0.5.19'
LOG_CONFIG = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'brief': {
... | """ Simple SQL-like query language for dynamo. """
import os
import argparse
import logging.config
from .cli import DQLClient
from .engine import Engine, FragmentEngine
__version__ = '0.5.19'
LOG_CONFIG = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'brief': {
... | mit | Python |
a74777711602aef6942a9a6a1114fe4f37a16152 | Fix for ill-shaped arrays | niboshi/chainer,chainer/chainer,ktnyt/chainer,aonotas/chainer,jnishi/chainer,hvy/chainer,rezoo/chainer,keisuke-umezawa/chainer,anaruse/chainer,wkentaro/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,niboshi/chainer,hvy/chainer,jnishi/chainer,okuta/chainer,wkentaro/chainer,okuta/chainer,ronekko/chainer,pfnet/ch... | chainer/testing/array.py | chainer/testing/array.py | import numpy
import sys
from chainer import cuda
from chainer import utils
def assert_allclose(x, y, atol=1e-5, rtol=1e-4, verbose=True):
"""Asserts if some corresponding element of x and y differs too much.
This function can handle both CPU and GPU arrays simultaneously.
Args:
x: Left-hand-sid... | import numpy
import sys
from chainer import cuda
from chainer import utils
def assert_allclose(x, y, atol=1e-5, rtol=1e-4, verbose=True):
"""Asserts if some corresponding element of x and y differs too much.
This function can handle both CPU and GPU arrays simultaneously.
Args:
x: Left-hand-sid... | mit | Python |
5db412f6536699a9f1794b78862542f1bce7d295 | Bump to 1.5.0 beta 2 dev. | Khan/reviewboard,brennie/reviewboard,bkochendorfer/reviewboard,atagar/ReviewBoard,atagar/ReviewBoard,reviewboard/reviewboard,Khan/reviewboard,Khan/reviewboard,bkochendorfer/reviewboard,1tush/reviewboard,1tush/reviewboard,chipx86/reviewboard,custode/reviewboard,sgallagher/reviewboard,bkochendorfer/reviewboard,1tush/revi... | reviewboard/__init__.py | reviewboard/__init__.py | # The version of Review Board.
#
# This is in the format of:
#
# (Major, Minor, Micro, Patch, alpha/beta/rc/final, Release Number, Released)
#
VERSION = (1, 5, 0, 0, 'beta', 2, False)
def get_version_string():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version += ".%s" % VERSION[2]... | # The version of Review Board.
#
# This is in the format of:
#
# (Major, Minor, Micro, Patch, alpha/beta/rc/final, Release Number, Released)
#
VERSION = (1, 5, 0, 0, 'beta', 1, True)
def get_version_string():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version += ".%s" % VERSION[2]
... | mit | Python |
00b44e03c11aa4eb324f951f284e695fd3f40081 | Add keepalive to make_package_npdrm calls. | dontnod/nimp | nimp/utilities/ps3.py | nimp/utilities/ps3.py | # -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
import socket
import random
import string
import time
import contextlib
import shutil
from nimp.utilities.build import *
from nimp.utilities.deployment import *
from nimp.utilities.system import *
#-------------... | # -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
import socket
import random
import string
import time
import contextlib
import shutil
from nimp.utilities.build import *
from nimp.utilities.deployment import *
from nimp.utilities.system import *
#-------------... | mit | Python |
b728253a668c7ff2fba12678d77344bfc645e40b | Make this easier to test, which we'll get to a bit later | gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty | dusty/daemon.py | dusty/daemon.py | import os
import atexit
import logging
import socket
from .preflight import preflight_check
from .log import configure_logging
from .notifier import notify
from .constants import SOCKET_PATH, SOCKET_TERMINATOR
def _clean_up_existing_socket(socket_path):
try:
os.unlink(socket_path)
except OSError:
... | import os
import atexit
import logging
import socket
from .preflight import preflight_check
from .log import configure_logging
from .notifier import notify
from .constants import SOCKET_PATH, SOCKET_TERMINATOR
def _clean_up_existing_socket():
try:
os.unlink(SOCKET_PATH)
except OSError:
if os.p... | mit | Python |
06c0196b8efd474aa10633728eb592b38659872d | Update common.py | blabla1337/skf-flask,blabla1337/skf-flask,blabla1337/skf-flask,blabla1337/skf-flask,blabla1337/skf-flask | skf/rabbit_mq_workers/common.py | skf/rabbit_mq_workers/common.py | from sys import stderr
from kubernetes import client, config
def delete_all(instance_name, user_id):
delete_ingress(instance_name, user_id)
delete_service(instance_name, user_id)
delete_deployment(instance_name, user_id)
delete_namespace(user_id)
def delete_deployment(instance_name, user_id):
try:... | from sys import stderr
from kubernetes import client, config
def delete_all(instance_name, user_id):
delete_ingress(instance_name, user_id)
delete_service(instance_name, user_id)
delete_deployment(instance_name, user_id)
def delete_deployment(instance_name, user_id):
try:
config.load_kube_conf... | agpl-3.0 | Python |
ab4494e4b4f9225f1990cfc26a60c37d30fd4f0c | change path_list to netloc_list | ghickman/django-cache-url | django_cache_url.py | django_cache_url.py | # -*- coding: utf-8 -*-
import os
try:
import urlparse
except ImportError:
import urllib.parse as urlparse
# Register cache schemes in URLs.
urlparse.uses_netloc.append('db')
urlparse.uses_netloc.append('dummy')
urlparse.uses_netloc.append('file')
urlparse.uses_netloc.append('locmem')
urlparse.uses_netloc.a... | # -*- coding: utf-8 -*-
import os
try:
import urlparse
except ImportError:
import urllib.parse as urlparse
# Register cache schemes in URLs.
urlparse.uses_netloc.append('db')
urlparse.uses_netloc.append('dummy')
urlparse.uses_netloc.append('file')
urlparse.uses_netloc.append('locmem')
urlparse.uses_netloc.a... | mit | Python |
38f3dfb0926f81a70231a7826f9c207170eb5e83 | add option for efustats.py to generate output which can be used as input for verifymetrics.py | ess-dmsc/event-formation-unit,ess-dmsc/event-formation-unit,ess-dmsc/event-formation-unit,ess-dmsc/event-formation-unit | utils/efushell/efustats.py | utils/efushell/efustats.py | #!/usr/bin/python
from EFUMetrics import Metrics
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-i", metavar='ipaddr', help = "server ip address (default 127.0.0.1)", type = str, default = "127.0.0.1")
parser.add_argument("-p", metavar='port', help = "server tcp port (default 8888)", type = i... | #!/usr/bin/python
from EFUMetrics import Metrics
import argparse
svr_ip_addr = "127.0.0.1"
svr_tcp_port = 8888
parser = argparse.ArgumentParser()
parser.add_argument("-i", metavar='ipaddr', help = "server ip address (default 127.0.0.1)", type = str)
parser.add_argument("-p", metavar='port', help = "server tcp port (... | bsd-2-clause | Python |
1b1086b35f3e47c582230bb82573ef6d9a2e290a | Remove unused import | makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek | geotrek/diving/tests/test_models.py | geotrek/diving/tests/test_models.py | from django.test import TestCase
from geotrek.common.tests import TranslationResetMixin
from geotrek.diving.factories import DiveFactory, LevelFactory
class DiveTest(TranslationResetMixin, TestCase):
def test_levels_display(self):
"""Test if levels_display works"""
l1 = LevelFactory.create()
... | from django.test import TestCase
from geotrek.common.tests import TranslationResetMixin
from geotrek.diving.models import Dive
from geotrek.diving.factories import DiveFactory, DivingManagerFactory, PracticeFactory, LevelFactory
from mapentity.factories import SuperUserFactory
class DiveTest(TranslationResetMixin, ... | bsd-2-clause | Python |
b6b3f2990f1abc091abf85127c21409da67526df | Update __init__.py | OpenTire/OpenTire | code/opentire/__init__.py | code/opentire/__init__.py | __author__ = 'henningo'
from opentire.opentire import OpenTire
| __author__ = 'henningo'
from opentire import OpenTire
| mit | Python |
e8e07f1f8e8b6b477d6b0fdd5a29994589f17a26 | Refactor the provider | business-factory/gold-digger | gold_digger/data_providers/fixer.py | gold_digger/data_providers/fixer.py | # -*- coding: utf-8 -*-
from datetime import date, timedelta
from ._provider import Provider
class Fixer(Provider):
BASE_CURRENCY = "USD"
BASE_URL = "https://api.fixer.io/{date}?base=" + BASE_CURRENCY
name = "fixer.io"
def get_by_date(self, date_of_exchange, currency):
"""
:type dat... | import json
import requests
from ._provider import Provider
class Fixer(Provider):
BASE_URL = "http://api.fixer.io"
BASE_CURRENCY = "USD"
name = "fixer.io"
def get_by_date(self, date_of_exchange, currency):
date_str = date_of_exchange.strftime(format="%Y-%m-%d")
self.logger.debug("Req... | apache-2.0 | Python |
fbd7e7aa89078667a0153fc8439b5ec9ab3b0945 | solve word count in basic | haozai309/hello_python | google-python-exercises/basic/wordcount.py | google-python-exercises/basic/wordcount.py | #!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Wordcount exercise
Google's Python class
The main() below is already defined and comp... | #!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Wordcount exercise
Google's Python class
The main() below is already defined and comp... | apache-2.0 | Python |
2cc2bd0626f2adf5b1916d39f8de839934acc8f8 | Update redis_sample.py | chocopy-telco/EmptyRoomCheck,chocopy-telco/EmptyRoomCheck | sample_code/redis_sample.py | sample_code/redis_sample.py | import redis
import sys
def main():
try:
r = redis.StrictRedis(host='localhost', port=6379, db=0)
######################
# 1. module id
# 2. status from sensor
# 3. current time (disconnect check)
######################
r.hmset('1', {'status': '1', 'curr': ... | #!/usr/bin/env python3
import redis
import sys
def main():
try:
r = redis.StrictRedis(host='localhost', port=6379, db=0)
######################
# 1. module id
# 2. value from sensor
# 3. current time (disconnect check)
######################
r.hmset('1', {'... | mit | Python |
d0b5e0a4d299ec5cd2dc402f70e157bf794d39f6 | Delete cmdJOIN command - this command is in the channels plugins. | prologic/kdb,prologic/kdb,prologic/kdb | kdb/plugins/irc.py | kdb/plugins/irc.py | # Filename: irc.py
# Module: irc
# Date: 30th June 2006
# Author: James Mills, prologic at shortcircuit dot net dot au
"""IRC
This plugin provides various commands to control the
IRC specific features of kdb. eg: Changing it's nickname.
"""
__ver__ = "0.0.8"
__author__ = "James Mills, prologic at shortcircuit dot n... | # Filename: irc.py
# Module: irc
# Date: 30th June 2006
# Author: James Mills, prologic at shortcircuit dot net dot au
"""IRC
This plugin provides various commands to control the
IRC specific features of kdb. eg: Changing it's nickname.
"""
__ver__ = "0.0.7"
__author__ = "James Mills, prologic at shortcircuit dot n... | mit | Python |
562a1e4ef88837af6aec8c397e8df0c29ff2d0de | update __init__.py | Y-oHr-N/kenchi,Y-oHr-N/kenchi | kenchi/__init__.py | kenchi/__init__.py | from .base import DetectorMixin
from .gaussian_distribution import GaussianDetector
from .empirical_distribution import EmpiricalDetector
from .vmf_distribution import VMFDetector
__version__ = '0.0.4'
| from .base import DetectorMixin
from .gaussian_distribution import GaussianDetector
from .empirical_distribution import EmpiricalDetector
from .vmf_distribution import VMFDetector
__version__ = '0.0.3'
| bsd-3-clause | Python |
9660985b13ebf44e8965da5cbd2c405e811aa8ee | Update __init__.py | theislab/scanpy,theislab/scanpy | scanpy/external/__init__.py | scanpy/external/__init__.py | from . import tl
from . import pl
from . import pp
from .. import _exporting as exporting
import sys
from .. import utils
utils.annotate_doc_types(sys.modules[__name__], 'scanpy')
del sys, utils
__doc__ = """\
External API
============
Import Scanpy's wrappers to external tools as::
import scanpy.external as ... | from . import tl
from . import pl
from . import pp
from .. import _exporting as exporting
import sys
from .. import utils
utils.annotate_doc_types(sys.modules[__name__], 'scanpy')
del sys, utils
__doc__ = """\
External API
============
Import Scanpy's wrappers to external tools as::
import scanpy.external as ... | bsd-3-clause | Python |
df7b4753bc700eb85c0ae17150370448cef900e3 | Drop filter from library | funkybob/knights-templater,funkybob/knights-templater | knights/library.py | knights/library.py | from functools import partial
class Library:
'''
Container for registering tags and filters
'''
def __init__(self):
self.tags = {}
self.filters = {}
self.helpers = {}
def tag(self, func=None, name=None):
if func is None:
return partial(self.tag, name=na... | from functools import partial
class Library:
'''
Container for registering tags and filters
'''
def __init__(self):
self.tags = {}
self.filters = {}
self.helpers = {}
def filter(self, filt=None, name=None):
if filt is None:
return partial(self.filter, n... | mit | Python |
6b849c49e701ce9636b5cc5e315b0e900f793564 | Update test_upload.py script with up-to-date URL | fedora-infra/fedimg,fedora-infra/fedimg | test/scripts/test_upload.py | test/scripts/test_upload.py | #!/bin/env python
# -*- coding: utf8 -*-
import fedmsg
import fedimg
import fedimg.services
from fedimg.services.ec2 import EC2Service, EC2ServiceException
ec2 = EC2Service()
ec2.upload('https://kojipkgs.fedoraproject.org//work/tasks/9442/7049442/fedora-cloud-base-20140616-rawhide.x86_64.raw.xz')
| #!/bin/env python
# -*- coding: utf8 -*-
import fedmsg
import fedimg
import fedimg.services
from fedimg.services.ec2 import EC2Service, EC2ServiceException
ec2 = EC2Service()
ec2.upload('https://kojipkgs.fedoraproject.org//work/tasks/5144/6925144/fedora-cloud-base-rawhide-20140604.x86_64.raw.xz')
| agpl-3.0 | Python |
224995ee5882dfc6ab2b489183e65424c434f8c3 | Add chatops pack to sandboxing constants | nzlosh/st2,armab/st2,armab/st2,punalpatel/st2,pixelrebel/st2,StackStorm/st2,nzlosh/st2,punalpatel/st2,armab/st2,peak6/st2,StackStorm/st2,pixelrebel/st2,nzlosh/st2,nzlosh/st2,emedvedev/st2,tonybaloney/st2,emedvedev/st2,StackStorm/st2,Plexxi/st2,Plexxi/st2,dennybaa/st2,tonybaloney/st2,Plexxi/st2,lakshmi-kannan/st2,peak6/... | st2common/st2common/constants/pack.py | st2common/st2common/constants/pack.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | apache-2.0 | Python |
dbc65d65304711eb63b766498e33d8dfe33c65a6 | modify fatal error | hashimotodaisuke/pimouse_ros,hashimotodaisuke/pimouse_ros | test/travis_test_motors1.py | test/travis_test_motors1.py | #!/usr/bin/env python
#encoding: utf8
import unittest, rostest
import rosnode, rospy
import time
from pimouse_ros.msg import MotorFreqs #use MotorFreqs structure
from geometry_msgs.msg import Twist #use Twist structure
class MotorTest(unittest.TestCase): #inheritant unittest.TestCase to use assertXXX functions
def... | #!/usr/bin/env python
#encoding: utf8
import unittest, rostest
import rosnode, rospy
import time
from pimouse_ros.msg import MotorFreqs #use MotorFreqs structure
from geometry_msgs.msg import Twist #use Twist structure
class MotorTest(unittest.TestCase): #inheritant unittest.TestCase to use assertXXX functions
def... | bsd-3-clause | Python |
29838151e446273c7f944bd35a4de042f7c98270 | Add version functions | petervanderdoes/wger,wger-project/wger,rolandgeider/wger,petervanderdoes/wger,wger-project/wger,kjagoo/wger_stark,wger-project/wger,kjagoo/wger_stark,DeveloperMal/wger,DeveloperMal/wger,rolandgeider/wger,DeveloperMal/wger,wger-project/wger,DeveloperMal/wger,petervanderdoes/wger,petervanderdoes/wger,rolandgeider/wger,ro... | workout_manager/__init__.py | workout_manager/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
VERSION = (1, 0, 0, 'beta', 1)
def get_version(version=None):
"""Derives a PEP386-compliant version number from VERSION."""
if version is ... | agpl-3.0 | Python | |
2f680e42e3b829c045751f69fd229f968a802855 | FIX test; lower bounds | hmendozap/auto-sklearn,automl/auto-sklearn,automl/auto-sklearn,hmendozap/auto-sklearn | test/util/test_StopWatch.py | test/util/test_StopWatch.py | # -*- encoding: utf-8 -*-
"""Created on Dec 16, 2014.
@author: Katharina Eggensperger
@projekt: AutoML2015
"""
from __future__ import print_function
import time
import unittest
from autosklearn.util import StopWatch
class Test(unittest.TestCase):
_multiprocess_can_split_ = True
def test_stopwatch_overhea... | # -*- encoding: utf-8 -*-
"""Created on Dec 16, 2014.
@author: Katharina Eggensperger
@projekt: AutoML2015
"""
from __future__ import print_function
import time
import unittest
from autosklearn.util import StopWatch
class Test(unittest.TestCase):
_multiprocess_can_split_ = True
def test_stopwatch_overhea... | bsd-3-clause | Python |
5eef8abce4905c1c3e85179ef4777a645c758d2d | stop gzip handling | MultiRRomero/manhattan-map,MultiRRomero/manhattan-map,MultiRRomero/manhattan-map,MultiRRomero/manhattan-map | la-data/browser.py | la-data/browser.py | import mechanize
def get_browser():
br = mechanize.Browser()
br.set_cookiejar(mechanize.CookieJar())
br.set_handle_equiv(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
br.addheade... | import mechanize
def get_browser():
br = mechanize.Browser()
br.set_cookiejar(mechanize.CookieJar())
br.set_handle_equiv(True)
br.set_handle_gzip(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor()... | mit | Python |
fca363dec1ff73e34e25084322d5a31dd6fbc1ee | Add sample param to CV function | tmcw/simple-statistics-py,sheriferson/simplestatistics,sheriferson/simple-statistics-py | simplestatistics/statistics/coefficient_of_variation.py | simplestatistics/statistics/coefficient_of_variation.py | from .standard_deviation import standard_deviation
from .mean import mean
def coefficient_of_variation(data, sample = True):
"""
The `coefficient of variation`_ is the ratio of the standard deviation to the mean.
.. _`coefficient of variation`: https://en.wikipedia.org/wiki/Coefficient_of_variation
A... | from .standard_deviation import standard_deviation
from .mean import mean
def coefficient_of_variation(data):
"""
The `coefficient_of_variation`_ is the ratio of the standard deviation to the mean
.. _`coefficient of variation`: https://en.wikipedia.org/wiki/Coefficient_of_variation
Args:
data... | unknown | Python |
0c697c4c9024babfdde52f4247342ac605f74225 | Update to latest openmv API | openmv/openmv,iabdalkader/openmv,kwagyeman/openmv,kwagyeman/openmv,openmv/openmv,openmv/openmv,kwagyeman/openmv,iabdalkader/openmv,openmv/openmv,kwagyeman/openmv,iabdalkader/openmv,iabdalkader/openmv | usr/openmv-fb.py | usr/openmv-fb.py | #!/usr/bin/env python
import sys
# import usb.core
# import usb.util
import numpy as np
import pygame
import openmv
from time import sleep
script = """
# Hello World Example
#
# Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script!
import sensor, image, time
sensor.reset() ... | #!/usr/bin/env python
import sys
import usb.core
import usb.util
import numpy as np
import pygame
import openmv
from time import sleep
# init pygame
pygame.init()
# init openmv
openmv.init()
# init screen
running = True
Clock = pygame.time.Clock()
font = pygame.font.SysFont("monospace", 15)
while running:
Clock.... | mit | Python |
3fec02b70e50f25af1ca28fb5bf3fca32b77b037 | Update at 2017-07-20 16-37-27 | amoshyc/tthl-code | download.py | download.py | import json
from pathlib import Path
from subprocess import run
dataset = Path('~/tthl-dataset/').expanduser()
video_dirs = sorted(dataset.glob('video*/'))
for i, video_dir in enumerate(video_dirs):
print('{} ({} / {})'.format(video_dir, i, len(video_dirs)))
url = json.load((video_dir / 'info.json').open())['v... | import json
from pathlib import Path
from subprocess import run
dataset = Path('~/tthl-dataset/').expanduser()
video_dirs = sorted(dataset.glob('video*/'))
for video_dir in video_dirs:
url = json.load((video_dir / 'info.json').open())['video_src']
run(['youtube-dl', '-f', '18', '-o', str(video_dir / 'video.mp4... | apache-2.0 | Python |
1a55b862f17b3a9055c18f2e0b37287448050207 | remove dead code | nathants/s,nathants/py-util | s/bin/tests/__init__.py | s/bin/tests/__init__.py | from __future__ import print_function, absolute_import
from s.bin.tests import auto
from s.bin.tests import cover
import argh
import s
import s.bin.tests.lib
def main():
argh.dispatch_commands([auto.auto,
cover.cover,
s.bin.tests.lib.light_auto,
... | from __future__ import print_function, absolute_import
from s.bin.tests import auto
from s.bin.tests import cover
import argh
import s
import s.bin.tests.lib
def main():
argh.dispatch_commands([auto.auto,
cover.cover,
s.bin.tests.lib.one,
... | mit | Python |
cfa3af5db9d1ee27482bec073c7d97288ad23972 | fix import | adrn/StreamMorphology,adrn/StreamMorphology,adrn/StreamMorphology | streammorphology/ensemble/__init__.py | streammorphology/ensemble/__init__.py | from .core import *
from .mmap_util import *
from .mpi_util import *
| from .core import *
from .mpi_util import *
| mit | Python |
9aef83dfee3d3c5b2cb321593c75bf02343bd014 | fix format_datetime import | wuvt/wuvt-site,wuvt/wuvt-site,wuvt/wuvt-site,wuvt/wuvt-site | wuvt/admin/charts/views.py | wuvt/admin/charts/views.py | from flask import render_template, request, send_file
import dateutil.parser
import io
from wuvt import app
from wuvt import format_datetime
from wuvt.admin import bp
from wuvt.auth import check_access
from wuvt.trackman.models import TrackLog
@bp.route('/charts')
@check_access('library')
def charts_index():
ret... | from flask import render_template, request, url_for, send_file
import dateutil.parser
import io
from wuvt import app
from wuvt import db
from wuvt.admin import bp
from wuvt.auth import check_access
from wuvt.trackman.models import TrackLog
@bp.route('/charts')
@check_access('library')
def charts_index():
return ... | agpl-3.0 | Python |
c787746f248b8e18fb99ad4340d9519fd51bb407 | Update apps.py | macarthur-lab/seqr,macarthur-lab/seqr,macarthur-lab/seqr,macarthur-lab/xbrowse,macarthur-lab/xbrowse,ssadedin/seqr,macarthur-lab/seqr,macarthur-lab/xbrowse,ssadedin/seqr,macarthur-lab/xbrowse,ssadedin/seqr,macarthur-lab/xbrowse,ssadedin/seqr,ssadedin/seqr,macarthur-lab/xbrowse,macarthur-lab/seqr | xbrowse_server/base/apps.py | xbrowse_server/base/apps.py | from django.apps import AppConfig
from xbrowse_server import mall
class XBrowseBaseConfig(AppConfig):
name = 'xbrowse_server.base'
def ready(self):
"""
This is an additional initialization step after all of the django models are instantiated.
Some of the Stores in the Mall depend on ... | from django.apps import AppConfig
from xbrowse_server import mall
class XBrowseBaseConfig(AppConfig):
name = 'xbrowse_server.base'
def ready(self):
"""
This is an additional initialization step after all of the django models are instantiated.
Some of the Stores in the Mall depend on ... | agpl-3.0 | Python |
b62415c19459d9e5819b82f464731b166157811d | Fix exception message formatting in Python3 | d1hotpep/openai_gym,machinaut/gym,machinaut/gym,d1hotpep/openai_gym,dianchen96/gym,Farama-Foundation/Gymnasium,dianchen96/gym,Farama-Foundation/Gymnasium | gym/envs/tests/test_registration.py | gym/envs/tests/test_registration.py | # -*- coding: utf-8 -*-
from gym import error, envs
from gym.envs import registration
from gym.envs.classic_control import cartpole
def test_make():
env = envs.make('CartPole-v0')
assert env.spec.id == 'CartPole-v0'
assert isinstance(env, cartpole.CartPoleEnv)
def test_spec():
spec = envs.spec('CartPo... | # -*- coding: utf-8 -*-
from gym import error, envs
from gym.envs import registration
from gym.envs.classic_control import cartpole
def test_make():
env = envs.make('CartPole-v0')
assert env.spec.id == 'CartPole-v0'
assert isinstance(env, cartpole.CartPoleEnv)
def test_spec():
spec = envs.spec('CartPo... | mit | Python |
455964b629d24390c2e85c017a9ac722c685f017 | change url varaible | yw-fang/readingnotes | matsci/project2018/thermal-togo-abel/source-db/database-spider.py | matsci/project2018/thermal-togo-abel/source-db/database-spider.py | import urllib2 # needed for functions,classed for opening urls.
#url = raw_input("enter the url needed for downloading file(pdf,mp3,zip...etc)\n");
url = 'http://phonondb.mtl.kyoto-u.ac.jp/raw_data/'
usock = urllib2.urlopen(url) # function for opening desired url
file_name = url.split('/')[
-1] # Example : for... | import urllib2 # needed for functions,classed for opening urls.
url = raw_input("enter the url needed for downloading file(pdf,mp3,zip...etc)\n");
usock = urllib2.urlopen(url) # function for opening desired url
file_name = url.split('/')[
-1] # Example : for given url "www.cs.berkeley.edu/~vazirani/algorithms/... | apache-2.0 | Python |
d6780386a465837badc38dfa0c8f8fb3f343dc85 | use "proto_class" instead of "type" to not shadow builtin | PRIArobotics/HedgehogUtils | hedgehog/utils/protobuf/__init__.py | hedgehog/utils/protobuf/__init__.py | from collections import namedtuple
MessageMeta = namedtuple('MessageMeta', ('discriminator', 'proto_class', 'name', 'fields'))
class MessageType:
def __init__(self, proto_class):
self.registry = {}
self.proto_class = proto_class
def register(self, proto_class, discriminator):
def de... | from collections import namedtuple
MessageMeta = namedtuple('MessageMeta', ('discriminator', 'type', 'name', 'fields'))
class MessageType:
def __init__(self, type):
self.registry = {}
self.type = type
def register(self, proto_message_class, discriminator):
def decorator(message_clas... | agpl-3.0 | Python |
83f03fbd55c97dfad281a30a5f599f3675b6a099 | Add argument parsing to helpers | Wikidata/WikidataClassBrowser,Wikidata/SQID,Wikidata/SQID,Wikidata/SQID,Wikidata/SQID,Wikidata/SQID,Wikidata/WikidataClassBrowser,Wikidata/SQID,Wikidata/WikidataClassBrowser,Wikidata/SQID | helpers/python/update-statistics.py | helpers/python/update-statistics.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# This script retrieves data about the use of classes and properties
# on Wikidata from SPARQL. The results are processed and stored in the
# files properties.json and classes.json. The script must be run in a
# directory that already contains these files (possibly with no con... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# This script retrieves data about the use of classes and properties
# on Wikidata from SPARQL. The results are processed and stored in the
# files properties.json and classes.json. The script must be run in a
# directory that already contains these files (possibly with no con... | apache-2.0 | Python |
6d90dc14af364e98e4bd51df59f08f24742911e8 | set service to tag | open-cloud/xos,cboling/xos,zdw/xos,zdw/xos,cboling/xos,cboling/xos,cboling/xos,opencord/xos,opencord/xos,zdw/xos,open-cloud/xos,opencord/xos,cboling/xos,zdw/xos,open-cloud/xos | xos/tosca/resources/tag.py | xos/tosca/resources/tag.py | import importlib
import os
import sys
import tempfile
sys.path.append("/opt/tosca")
from translator.toscalib.tosca_template import ToscaTemplate
from django.contrib.contenttypes.models import ContentType
from core.models import Tag, Service
from xosresource import XOSResource
class XOSTag(XOSResource):
provides ... | import importlib
import os
import sys
import tempfile
sys.path.append("/opt/tosca")
from translator.toscalib.tosca_template import ToscaTemplate
from django.contrib.contenttypes.models import ContentType
from core.models import Tag
from xosresource import XOSResource
class XOSTag(XOSResource):
provides = "tosca.... | apache-2.0 | Python |
6cff4c35f4f1ef7192504ae1ca1354c0b95502eb | Fix of artifactory delete | bjuvensjo/scripts | vang/artifactory/delete.py | vang/artifactory/delete.py | #!/usr/bin/env python3
from argparse import ArgumentParser
from sys import argv
from vang.artifactory import utils
from vang.artifactory import api
from vang.maven.pom import get_pom_info
def delete_maven_artifact(repository, pom_dirs):
for pom_dir in pom_dirs:
pom_info = get_pom_info(utils.get_pom_path(... | #!/usr/bin/env python3
from argparse import ArgumentParser
from sys import argv
from vang.artifactory import utils
from vang.artifactory import api
from vang.maven.pom import get_pom_info
def delete_maven_artifact(repository, pom_dirs):
for pom_dir in pom_dirs:
pom_info = get_pom_info(utils.get_pom_path(... | apache-2.0 | Python |
024b91aa16e6e0f95c27279244521756b7c90203 | Fix urls details articles | YACOWS/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,opps/opps,williamroot/opps,williamroot/opps,jeanmask/opps,jeanmask/opps,opps/opps,opps/opps,opps/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,YACOWS/opps | opps/articles/urls.py | opps/articles/urls.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.views.decorators.cache import cache_page
from .views import PostDetail, PostList, Search
urlpatterns = patterns(
'',
url(r'^$', cache_page(60 * 2)(PostList.as_view()), name='home'),
url(r'^search/', Searc... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.views.decorators.cache import cache_page
from .views import OppsDetail, PostList, Search
urlpatterns = patterns(
'',
url(r'^$', cache_page(60 * 2)(PostList.as_view()), name='home'),
url(r'^search/', Searc... | mit | Python |
96d7a3febf7c2bbab184c6471692376344f1e03e | Add toggle_edit_mode method to base blender class | josuemontano/blender_wrapper | api/base.py | api/base.py | from .variables import LAYER_1
class BlenderObject:
"""Base blender object"""
def __init__(self, location, rotation, view_align=False, layers=LAYER_1):
self.location = location
self.rotation = rotation
self.view_align = view_align
self.layers = layers
def add_to_scene(self... | from .variables import LAYER_1
class BlenderObject:
"""Base blender object"""
def __init__(self, location, rotation, view_align=False, layers=LAYER_1):
self.location = location
self.rotation = rotation
self.view_align = view_align
self.layers = layers
def add_to_scene(self... | mit | Python |
557c3e00f98761d4cae1ec09aadf5962aa57cb01 | Revert (#463) | b12io/orchestra,unlimitedlabs/orchestra,b12io/orchestra,b12io/orchestra,unlimitedlabs/orchestra,unlimitedlabs/orchestra,b12io/orchestra,b12io/orchestra | orchestra/__init__.py | orchestra/__init__.py | # The current Orchestra version.
__version__ = '0.2.47'
default_app_config = 'orchestra.apps.OrchestraAppConfig'
| # The current Orchestra version.
__version__ = '0.2.48'
default_app_config = 'orchestra.apps.OrchestraAppConfig'
| apache-2.0 | Python |
7b1087a693ba33d0cb511068d328d49a5882b3d3 | Fix typo | Kromey/roglick | roglick/systems/input.py | roglick/systems/input.py | import roglick.lib.libtcodpy as libtcod
from roglick.engine.ecs import System
from roglick.components import PositionComponent
from roglick.events import MoveEvent
from roglick.engine import event
class InputSystem(System):
def execute(self):
key = self.get_keypress()
if key == libtcod.KEY_ENTER a... | import roglick.lib.libtcodpy as libtcod
from roglick.engine.ecs import System
from roglick.components import PositionComponent
from roglick.events import MoveEvent
from roglick.engine import event
class InputSystem(System):
def execute(self):
key = self.get_keypress()
if key == libtcod.KEY_ENTER a... | mit | Python |
c0ed918e09bcb0c0eb1aec20e375c7da8c7466ef | Add grammar for test of recursive grammar | PatrikValkovic/grammpy | tests/NongeneratingSymbolsRemove/RecursiveTest.py | tests/NongeneratingSymbolsRemove/RecursiveTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy-transforms
"""
from unittest import TestCase, main
from grammpy import *
from grammpy_transforms import *
class A(Nonterminal):
pass
class B(Nonterminal):
pass
class C(Nonterminal):
pass
clas... | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy-transforms
"""
from unittest import TestCase, main
from grammpy import *
from grammpy_transforms import *
class RecursiveTest(TestCase):
pass
if __name__ == '__main__':
main()
| mit | Python |
42435e7ed4b27f63b58ce3f1f083a04c9cf828a0 | Fix preprocessing routine | rampage644/wavenet | preprocess.py | preprocess.py | '''Dataset preprocessing.'''
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import argparse
import concurrent.futures
import os
import numpy as np
import wavenet.utils as utils
BATCH = 10240
RATE = 8000
CHUNK = 1024
def split_into(data, n):
res = [... | '''Dataset preprocessing.'''
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import argparse
import concurrent.futures
import os
import numpy as np
import wavenet.utils as utils
BATCH = 10240
RATE = 8000
CHUNK = 1024
def split_into(data, n):
res = [... | apache-2.0 | Python |
739484f1d13c07294813089665c336ebcdc69cc5 | Fix pylint warning. | shockone/electron,mjaniszew/electron,jlhbaseball15/electron,yalexx/electron,fireball-x/atom-shell,yan-foto/electron,christian-bromann/electron,synaptek/electron,ervinb/electron,IonicaBizauKitchen/electron,bwiggs/electron,zhakui/electron,tomashanacek/electron,bwiggs/electron,oiledCode/electron,dkfiresky/electron,joaomor... | script/update-frameworks.py | script/update-frameworks.py | #!/usr/bin/env python
import sys
import os
from lib.util import safe_mkdir, extract_zip, tempdir, download
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
FRAMEWORKS_URL = 'https://github.com/atom/atom-shell-frameworks/releases' \
'/download/v0.0.1'
def main():
os.chdir... | #!/usr/bin/env python
import sys
import os
from lib.util import safe_mkdir, extract_zip, tempdir, download
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
FRAMEWORKS_URL = 'https://github.com/atom/atom-shell-frameworks/releases/download/v0.0.1'
def main():
os.chdir(SOURCE_ROOT)
safe_m... | mit | Python |
5adf703414c9f11328fd61acedfd71633ecc5166 | Add new version (#16445) | LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/py-palettable/package.py | var/spack/repos/builtin/packages/py-palettable/package.py | # Copyright 2013-2020 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 PyPalettable(PythonPackage):
"""Color palettes for Python."""
homepage = "https://jif... | # Copyright 2013-2020 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 PyPalettable(PythonPackage):
"""Color palettes for Python."""
homepage = "https://jif... | lgpl-2.1 | Python |
f17687ce9f1e12659d83a1803016a64131ea7b25 | add iostat | lenxeon/graph-index,douban/graph-index,douban/graph-index,lenxeon/graph-index | examples.py | examples.py | examples = [
'dba1.mysql.*\.select group by 3',
'thorin.beansdb group by 4',
'thorin.doubanmemcache.*11211 group by 3',
'thorin.doubanmemcache.*11212 group by 3',
'thorin.doubanmemcache.*11213 group by 3',
'thorin.doubanmemcache.*11214 group by 3',
'thorin.beansmq group by 3',
'thorin.io... | examples = [
'dba1.mysql.*\.select group by 3',
'thorin.beansdb group by 4',
'thorin.doubanmemcache.*11211 group by 3',
'thorin.doubanmemcache.*11212 group by 3',
'thorin.doubanmemcache.*11213 group by 3',
'thorin.doubanmemcache.*11214 group by 3',
'thorin.beansmq group by 3'
]
| mit | Python |
8bd8525da7f73165cf35e8e0ee87554f3a7e8355 | Remove obsolete __version__ variable from __init__.py file. | akx/django-jinja,akx/django-jinja,niwinz/django-jinja,glogiotatidis/django-jinja,glogiotatidis/django-jinja,niwinz/django-jinja,akx/django-jinja,glogiotatidis/django-jinja,niwinz/django-jinja,glogiotatidis/django-jinja,akx/django-jinja | django_jinja/__init__.py | django_jinja/__init__.py | # -*- coding: utf-8 -*-
__version__ = (0, 5, 0, 'final', 0)
| bsd-3-clause | Python | |
a799454ff54108d21617f53064f390a6417d4ab1 | Increase coverage of telemetry's user_agent_unittest | SummerLW/Perf-Insight-Report,benschmaus/catapult,catapult-project/catapult,benschmaus/catapult,catapult-project/catapult,catapult-project/catapult-csm,catapult-project/catapult,catapult-project/catapult,sahiljain/catapult,sahiljain/catapult,catapult-project/catapult-csm,catapult-project/catapult,sahiljain/catapult,sahi... | telemetry/telemetry/core/user_agent_unittest.py | telemetry/telemetry/core/user_agent_unittest.py | # Copyright 2012 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.
from telemetry.core import user_agent
from telemetry.unittest import tab_test_case
class MobileUserAgentTest(tab_test_case.TabTestCase):
@classmethod
d... | # Copyright 2012 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.
from telemetry.core import user_agent
from telemetry.unittest import tab_test_case
class UserAgentTest(tab_test_case.TabTestCase):
@classmethod
def Cus... | bsd-3-clause | Python |
25259a66ce68cde773f85e8d7ea89831f43e10e0 | Make linter happy | WarrenWeckesser/scipy,andyfaff/scipy,scipy/scipy,WarrenWeckesser/scipy,Stefan-Endres/scipy,ilayn/scipy,andyfaff/scipy,anntzer/scipy,Stefan-Endres/scipy,mdhaber/scipy,scipy/scipy,perimosocordiae/scipy,anntzer/scipy,mdhaber/scipy,Stefan-Endres/scipy,Stefan-Endres/scipy,tylerjereddy/scipy,WarrenWeckesser/scipy,zerothi/sci... | scipy/sparse/_arrays.py | scipy/sparse/_arrays.py | from ._bsr import bsr_matrix
from ._coo import coo_matrix
from ._csc import csc_matrix
from ._csr import csr_matrix
from ._dia import dia_matrix
from ._dok import dok_matrix
from ._lil import lil_matrix
class _sparray:
"""This class provides a base class for all sparse arrays.
It cannot be instantiated. Mos... | from ._bsr import bsr_matrix
from ._coo import coo_matrix
from ._csc import csc_matrix
from ._csr import csr_matrix
from ._dia import dia_matrix
from ._dok import dok_matrix
from ._lil import lil_matrix
class _sparray:
"""This class provides a base class for all sparse arrays.
It cannot be instantiated. Mos... | bsd-3-clause | Python |
9bf7fa3632fe8e5d1aa79597508df3c50c39e2bc | Update documentation root | chadmv/cmt,chadmv/cmt,chadmv/cmt | scripts/cmt/settings.py | scripts/cmt/settings.py | DOCUMENTATION_ROOT = 'https://chadmv.github.io/cmt/html'
| DOCUMENTATION_ROOT = 'https://chadmv.github.io/cmt'
| mit | Python |
a58ef7f543c840ddf9fa38ce3b54d7fb2147e61e | Fix 某个 models 导入失败后被忽略的问题。 | gwind/YWeb,gwind/YWeb,gwind/YWeb,gwind/YWeb | yweb/yweb/management/db.py | yweb/yweb/management/db.py | #! /usr/bin/env python
# coding: UTF-8
from yweb.conf import settings
from yweb.utils.findapps import get_app_submodule
def syncdb():
# 保证 import models 一定成功!
for app_name in settings.INSTALLED_APPS:
models = get_app_submodule(app_name, 'models')
if models:
exec "from %s.models im... | #! /usr/bin/env python
# coding: utf-8
from yweb.conf import settings
def syncdb():
for m in settings.INSTALLED_APPS:
try:
exec "from %s.models import *" % m
except ImportError, e:
print 'import error: %s' % e
pass
from yweb.orm import create_all
crea... | mit | Python |
785f9481c27b3bfd03421b128d31c183a8e05e6a | remove todo | adrn/StreamMorphology,adrn/StreamMorphology,adrn/StreamMorphology | streammorphology/tests/test_initialconditions.py | streammorphology/tests/test_initialconditions.py | # coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Third-party
import numpy as np
from astropy import log as logger
import astropy.units as u
import matplotlib.pyplot as plt
# Project
import gary.dynamics as gd
import gary.integrate as gi
import gary.pote... | # coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Third-party
import numpy as np
from astropy import log as logger
import astropy.units as u
import matplotlib.pyplot as plt
# Project
import gary.dynamics as gd
import gary.integrate as gi
import gary.pote... | mit | Python |
1103fda5db534212c8cda268a65c4ee1d67741f5 | update for power calcs | cbyn/bitmicro,cbyn/bitpredict,cbyn/bitpredict,cbyn/bitmicro,cbyn/bitmicro,cbyn/bitpredict | app/app.py | app/app.py | from bitmicro.model import features as f
import pymongo
import time
import sys
client = pymongo.MongoClient()
db = client['bitmicro']
symbol = sys.argv[1]
duration = int(sys.argv[2])
predictions = db[symbol+'_predictions']
# Need to import a pickled model
while True:
start = time.time()
data = f.make_features... | from bitmicro.model import features as f
import pymongo
import time
import sys
client = pymongo.MongoClient()
db = client['bitmicro']
symbol = sys.argv[1]
duration = int(sys.argv[2])
predictions = db[symbol+'_predictions']
# Need to import a pickled model
while True:
start = time.time()
data = f.make_features... | mit | Python |
e65ba8e21f8ee9fe569890861fd481717a791c55 | return a list of SGs instead of a dict | HackerEarth/brahma,HackerEarth/brahma,DESHRAJ/brahma,DESHRAJ/brahma,DESHRAJ/brahma,HackerEarth/brahma | aws/sgs.py | aws/sgs.py | """Amazon EC2 Security Groups related utilities.
"""
import boto3
from django.conf import settings
def get_all_sgs():
"""Returns all Security groups in the default region as
a mapping between security group id vs boto SecurityGroup object.
"""
ec2 = boto3.resource('ec2')
security_groups = list(... | """Amazon EC2 Security Groups related utilities.
"""
import boto3
from django.conf import settings
def get_all_sgs():
"""Returns all Security groups in the default region as
a mapping between security group id vs boto SecurityGroup object.
"""
ec2 = boto3.resource('ec2')
security_groups = list(... | mit | Python |
3c29c4db6ca107bb4bf7fb0ffcd2ebbb4f9330b9 | Fix unicode error when showing voucher error message | car3oon/saleor,car3oon/saleor,itbabu/saleor,itbabu/saleor,itbabu/saleor,mociepka/saleor,UITools/saleor,UITools/saleor,KenMutemi/saleor,KenMutemi/saleor,HyperManTT/ECommerceSaleor,tfroehlich82/saleor,car3oon/saleor,HyperManTT/ECommerceSaleor,maferelo/saleor,maferelo/saleor,tfroehlich82/saleor,KenMutemi/saleor,HyperManTT... | saleor/discount/forms.py | saleor/discount/forms.py | from django import forms
from django.utils.translation import pgettext_lazy
from .models import Voucher, NotApplicable
class VoucherField(forms.ModelChoiceField):
default_error_messages = {
'invalid_choice': pgettext_lazy(
'voucher', pgettext_lazy(
'voucher', 'Discount code i... | from django import forms
from django.utils.translation import pgettext_lazy
from .models import Voucher, NotApplicable
class VoucherField(forms.ModelChoiceField):
default_error_messages = {
'invalid_choice': pgettext_lazy(
'voucher', pgettext_lazy(
'voucher', 'Discount code i... | bsd-3-clause | Python |
d1513fd55fc2586c57c506156b5dac80f758cd1c | bump version to 0.22.0 | ivelum/cub-python | cub/version.py | cub/version.py | version = '0.22.0'
| version = '0.21.0'
| mit | Python |
9e6f462eeff0af799ba488ff745d90ce3e566a9d | Disable trainer_model_based_dqn_test since recent Dopamine changes break it. | tensorflow/tensor2tensor,tensorflow/tensor2tensor,tensorflow/tensor2tensor,tensorflow/tensor2tensor,tensorflow/tensor2tensor | tensor2tensor/rl/trainer_model_based_dqn_test.py | tensor2tensor/rl/trainer_model_based_dqn_test.py | # coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | # coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | apache-2.0 | Python |
c62ff15fc3f4824b85e6b39c5d6a485099385b53 | Fix compat_util to properly import the fallback module, and include a helper that can emulate `nonlocal`. | tensorflow/tensorflow,jhseu/tensorflow,Intel-tensorflow/tensorflow,xzturn/tensorflow,aam-at/tensorflow,davidzchen/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-experimental_link_static_libraries_once,davidzchen/tensorflow,tensorflow/tensorflow-pywrap_saved_model,yongtang/tensorflow,jhseu/tensorflow,davidzche... | tensorflow/python/autograph/utils/compat_util.py | tensorflow/python/autograph/utils/compat_util.py | # Copyright 2017 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 2017 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 |
b6cc6e8739855e545167a1654481ca62850fa8c1 | Declare video-layout more leniently (apparently it might have all sorts of values) | ZeitOnline/zeit.content.article,ZeitOnline/zeit.content.article,ZeitOnline/zeit.content.article | src/zeit/content/article/edit/video.py | src/zeit/content/article/edit/video.py | # Copyright (c) 2010 gocept gmbh & co. kg
# See also LICENSE.txt
from zeit.cms.i18n import MessageFactory as _
import grokcore.component
import zeit.content.video.asset
import zeit.content.video.interfaces
import zeit.cms.interfaces
import zeit.content.article.edit.block
import zeit.content.article.edit.interfaces
imp... | # Copyright (c) 2010 gocept gmbh & co. kg
# See also LICENSE.txt
from zeit.cms.i18n import MessageFactory as _
import grokcore.component
import zeit.content.video.asset
import zeit.content.video.interfaces
import zeit.cms.interfaces
import zeit.content.article.edit.block
import zeit.content.article.edit.interfaces
imp... | bsd-3-clause | Python |
d57caaa13a649dbbce72e4451286d9ec2ed49268 | Fix class, reinsert undo | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/workflow/steps/create_zabbix.py | dbaas/workflow/steps/create_zabbix.py | # -*- coding: utf-8 -*-
import logging
from base import BaseStep
from dbaas_zabbix.provider import ZabbixProvider
from ..exceptions.error_codes import DBAAS_0012
from util import full_stack
LOG = logging.getLogger(__name__)
class CreateZabbix(BaseStep):
def __unicode__(self):
return "Registering zabbix monitorin... | # -*- coding: utf-8 -*-
import logging
from base import BaseStep
from dbaas_zabbix.provider import ZabbixProvider
from ..exceptions.error_codes import DBAAS_0012
from util import full_stack
LOG = logging.getLogger(__name__)
class CreateZabbix(BaseStep):
def __unicode__(self):
return "Registering zabbix monitorin... | bsd-3-clause | Python |
8de725e878f4559898fcc7012852cbfbb4da5403 | Change to pytest fixtures PlotUtilitiesTest.py | SasView/sasview,SasView/sasview,SasView/sasview,SasView/sasview,SasView/sasview,SasView/sasview | src/sas/qtgui/Plotting/UnitTesting/PlotUtilitiesTest.py | src/sas/qtgui/Plotting/UnitTesting/PlotUtilitiesTest.py | import sys
from collections import OrderedDict
from sas.qtgui.UnitTesting.TestUtils import WarningTestNotImplemented
# Tested module
import sas.qtgui.Plotting.PlotUtilities as PlotUtilities
class PlotUtilitiesTest:
def testDefaults(self):
""" default method variables values """
assert isinstance... | import sys
import unittest
from collections import OrderedDict
from sas.qtgui.UnitTesting.TestUtils import WarningTestNotImplemented
# Tested module
import sas.qtgui.Plotting.PlotUtilities as PlotUtilities
class PlotUtilitiesTest(unittest.TestCase):
'''Test the Plot Utilities functions'''
def setUp(self):
... | bsd-3-clause | Python |
cbaf94aa1ff80ab41ab26a0cf2a8312d6c6c691c | Change tests to asserts in SetGraphRangeTest.py | SasView/sasview,SasView/sasview,SasView/sasview,SasView/sasview,SasView/sasview,SasView/sasview | src/sas/qtgui/Plotting/UnitTesting/SetGraphRangeTest.py | src/sas/qtgui/Plotting/UnitTesting/SetGraphRangeTest.py | import sys
import unittest
import pytest
from PyQt5 import QtGui, QtWidgets
# set up import paths
import sas.qtgui.path_prepare
# Local
from sas.qtgui.Plotting.SetGraphRange import SetGraphRange
if not QtWidgets.QApplication.instance():
app = QtWidgets.QApplication(sys.argv)
class SetGraphRangeTest(unittest.T... | import sys
import unittest
from PyQt5 import QtGui, QtWidgets
# set up import paths
import sas.qtgui.path_prepare
# Local
from sas.qtgui.Plotting.SetGraphRange import SetGraphRange
if not QtWidgets.QApplication.instance():
app = QtWidgets.QApplication(sys.argv)
class SetGraphRangeTest(unittest.TestCase):
'... | bsd-3-clause | Python |
463b581cc7808ea032b7c5cceb46a6c81831ce5f | prepare for heroku | Joneyviana/todolist-django-angular,Joneyviana/todolist-django-angular,Joneyviana/todolist-django-angular,Joneyviana/todolist-django-angular | config/wsgi.py | config/wsgi.py | """
WSGI config for todoList project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | """
WSGI config for todoList project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | mit | Python |
1172c654f668fa608822b29e1fa052aff6f5a70b | Remove unnecessary test | jdgillespie91/trackerSpend,jdgillespie91/trackerSpend | tests/utils/publish_message_integration_tests.py | tests/utils/publish_message_integration_tests.py | import unittest
from utils import publish_message
class PublishMessageIntegrationTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
message = 'test_message'
exchange = 'test_exchange'
type = 'direct'
routing_key = 'test_routing_key'
publish_message(message, exc... | import unittest
from utils import publish_message
class PublishMessageIntegrationTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
message = 'test_message'
exchange = 'test_exchange'
type = 'direct'
routing_key = 'test_routing_key'
publish_message(message, exc... | mit | Python |
1e078b88b4eecaa5a9d0a2ada9a64237fe3c4f09 | Implement app secret printing to social_auth migration tool | mikkokeskinen/tunnistamo,mikkokeskinen/tunnistamo | users/management/commands/social_auth_migrate.py | users/management/commands/social_auth_migrate.py | from allauth.socialaccount.models import SocialAccount, SocialApp
from django.core.management.base import BaseCommand
from django.db import IntegrityError
from social_django.models import UserSocialAuth
class Command(BaseCommand):
help = 'Migrate allauth social logins to social auth'
def add_arguments(self, ... | from allauth.socialaccount.models import SocialAccount
from django.core.management.base import BaseCommand
from django.db import IntegrityError
from social_django.models import UserSocialAuth
class Command(BaseCommand):
help = 'Migrate allauth social logins to social auth'
def handle(self, *args, **options):... | mit | Python |
4038e8c8af649cfdf60880a2f2e57dfff558760f | Change place of pickle.save | barbagroup/pygbe,barbagroup/pygbe,barbagroup/pygbe | tests/convergence_tests/sphere_lspr.py | tests/convergence_tests/sphere_lspr.py | from pygbe.util import an_solution
from convergence_lspr import (mesh_ratio, run_convergence, picklesave, pickleload,
report_results, mesh)
def main():
print('{:-^60}'.format('Running sphere_lspr test'))
try:
test_outputs = pickleload()
except FileNotFoundError:
... | from pygbe.util import an_solution
from convergence_lspr import (mesh_ratio, run_convergence, picklesave, pickleload,
report_results, mesh)
def main():
print('{:-^60}'.format('Running sphere_lspr test'))
try:
test_outputs = pickleload()
except FileNotFoundError:
... | bsd-3-clause | Python |
4e1176ca40c742144a7f1373bbea97adb8d1b99f | add invoice line numbers | snowch/bluemix_retail_demo,snowch/bluemix_retail_demo,snowch/bluemix_retail_demo | data/prepare.py | data/prepare.py | #!/usr/bin/env python
ONLINE_RETAIL_XLSX = 'OnlineRetail.xlsx'
ONLINE_RETAIL_CSV = 'OnlineRetail.csv'
ONLINE_RETAIL_JSON = 'OnlineRetail.json'
def download_spreadsheet():
print('Starting download_spreadsheet() ...')
# support python 2 and 3
try:
# python 3
import urllib.request as url... | #!/usr/bin/env python
ONLINE_RETAIL_XLSX = 'OnlineRetail.xlsx'
ONLINE_RETAIL_CSV = 'OnlineRetail.csv'
ONLINE_RETAIL_JSON = 'OnlineRetail.json'
def download_spreadsheet():
print('Starting download_spreadsheet() ...')
# support python 2 and 3
try:
# python 3
import urllib.request as url... | apache-2.0 | Python |
5ab6a9ecf96db37c97dfab9986cb28f79ac75566 | Use REDIS is optional | tic-ull/portal-del-investigador,tic-ull/portal-del-investigador,tic-ull/portal-del-investigador,tic-ull/portal-del-investigador | core/redis_utils.py | core/redis_utils.py | # -*- encoding: UTF-8 -*-
from django.conf import settings as st
import json
import redis
import urllib
POOL = redis.ConnectionPool(host=st.REDIS_HOST, port=st.REDIS_PORT,
db=st.REDIS_DB, password=st.REDIS_PASSWORD)
def wsget(ws, use_redis=True, timeout=st.REDIS_TIMEOUT):
try:
... | # -*- encoding: UTF-8 -*-
from django.conf import settings as st
import json
import redis
import urllib
POOL = redis.ConnectionPool(host=st.REDIS_HOST, port=st.REDIS_PORT,
db=st.REDIS_DB, password=st.REDIS_PASSWORD)
def wsget(ws):
try:
ws_json = json.loads(urllib.urlopen(ws).... | agpl-3.0 | Python |
26b8846d6c6bd876939532e744a55a649488b0b6 | remove repetitive code | RockefellerArchiveCenter/DACSspace | dacsspace/client.py | dacsspace/client.py | from configparser import ConfigParser
from asnake.aspace import ASpace
class ASnakeConfigError(Exception):
pass
class ArchivesSpaceClient:
"""Handles communication with ArchivesSpace."""
def __init__(self):
config = ConfigParser()
config.read("dacsspace/local_settings.cfg")
sel... | from configparser import ConfigParser
from asnake.aspace import ASpace
class ASnakeConfigError(Exception):
pass
class ArchivesSpaceClient:
"""Handles communication with ArchivesSpace."""
def __init__(self):
config = ConfigParser()
config.read("dacsspace/local_settings.cfg")
sel... | mit | Python |
5dc710ed0b9f8d24e53f1462ef4a4e93d11b6723 | Add date joined to the user admin list | CoderBounty/coderbounty,atuljain/coderbounty,CoderBounty/coderbounty,atuljain/coderbounty,CoderBounty/coderbounty,CoderBounty/coderbounty,atuljain/coderbounty,atuljain/coderbounty | website/admin.py | website/admin.py | from django.contrib import admin
from website.models import Issue, Watcher, Service, UserProfile, Bounty, UserService, XP, Delta
class ServiceAdmin(admin.ModelAdmin):
list_display=[]
for x in Service._meta.get_all_field_names():
list_display.append(str(x))
class BountyAdmin(admin.ModelAdmin):
... | from django.contrib import admin
from website.models import Issue, Watcher, Service, UserProfile, Bounty, UserService, XP, Delta
class ServiceAdmin(admin.ModelAdmin):
list_display=[]
for x in Service._meta.get_all_field_names():
list_display.append(str(x))
class BountyAdmin(admin.ModelAdmin):
... | agpl-3.0 | Python |
0c0bae4ab83914b1b7b3ee925589e1b1db2c8c74 | implement bucket creation and garbage collection | dimitri-yatsenko/datajoint-python,fabiansinz/datajoint-python,datajoint/datajoint-python,eywalker/datajoint-python | datajoint/s3.py | datajoint/s3.py | """
AWS S3 operations
"""
from io import BytesIO
import minio # https://docs.minio.io/docs/python-client-api-reference
import warnings
class Folder:
"""
An S3 instance manipulates a folder of objects in AWS S3
"""
def __init__(self, endpoint, bucket, access_key, secret_key, location, database, **_):
... | """
AWS S3 operations
"""
from io import BytesIO
from minio import Minio # https://docs.minio.io/docs/python-client-api-reference
class Folder:
"""
An S3 instance manipulates a folder of objects in AWS S3
"""
def __init__(self, endpoint, bucket, access_key, secret_key, location, database, **_):
... | lgpl-2.1 | Python |
d0415fb881e8ef0a150cf4cc9e2b3908b7f571b5 | make rcS files read from the m5 source directory, not /dist. | LingxiaoJIA/gem5,LingxiaoJIA/gem5,LingxiaoJIA/gem5,haowu4682/gem5,haowu4682/gem5,andrewfu0325/gem5-aladdin,haowu4682/gem5,LingxiaoJIA/gem5,LingxiaoJIA/gem5,haowu4682/gem5,andrewfu0325/gem5-aladdin,haowu4682/gem5,LingxiaoJIA/gem5,andrewfu0325/gem5-aladdin,LingxiaoJIA/gem5,andrewfu0325/gem5-aladdin,haowu4682/gem5,andrewf... | configs/common/SysPaths.py | configs/common/SysPaths.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 |
536dccaf18056996b763022495b9a481600c7950 | Update qt_translations.py | avacoin2017/avacoin,avacoin2017/avacoin,avacoin2017/avacoin,avacoin2017/avacoin,avacoin2017/avacoin | contrib/qt_translations.py | contrib/qt_translations.py | #!/usr/bin/env python
# Helpful little script that spits out a comma-separated list of
# language codes for Qt icons that should be included
# in binary bitcoin distributions
import glob
import os
import re
import sys
if len(sys.argv) != 3:
sys.exit("Usage: %s $QTDIR/translations $BITCOINDIR/src/qt/locale"%sys.arg... | #!/usr/bin/env python
# Helpful little script that spits out a comma-separated list of
# language codes for Qt icons that should be included
# in binary bitcoin distributions
import glob
import os
import re
import sys
if len(sys.argv) != 3:
sys.exit("Usage: %s $QTDIR/translations $BITCOINDIR/src/qt/locale"%sys.arg... | mit | Python |
1c612b274b1587c43ee6e6a486aed653b9ca5f70 | Update signet getcoins.py for custom network | domob1812/namecore,dscotese/bitcoin,domob1812/bitcoin,bitcoinsSG/bitcoin,yenliangl/bitcoin,Xekyo/bitcoin,lateminer/bitcoin,sipsorcery/bitcoin,jlopp/statoshi,GroestlCoin/bitcoin,bitcoinknots/bitcoin,bitcoinsSG/bitcoin,jambolo/bitcoin,prusnak/bitcoin,fujicoin/fujicoin,sipsorcery/bitcoin,achow101/bitcoin,pataquets/namecoi... | contrib/signet/getcoins.py | contrib/signet/getcoins.py | #!/usr/bin/env python3
# Copyright (c) 2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import argparse
import subprocess
import sys
import requests
DEFAULT_GLOBAL_FAUCET = 'https://signetfaucet.co... | #!/usr/bin/env python3
# Copyright (c) 2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import argparse
import subprocess
import requests
import sys
parser = argparse.ArgumentParser(description='Sc... | mit | Python |
948341621b51bf78d2556e5d5c2c320f9eab1a9d | update shell tests for windows | tfeldmann/organize | tests/actions/test_shell.py | tests/actions/test_shell.py | from unittest.mock import patch
from organize.actions import Shell
from pathlib import Path
def test_shell_basic():
shell = Shell("echo 'Hello World'")
result = shell.run(simulate=True)
assert not result
result = shell.run(simulate=False)
assert result["shell"] == {"output": "Hello World\n", "re... | from unittest.mock import patch
from organize.actions import Shell
from pathlib import Path
def test_shell_basic():
shell = Shell("echo 'Hello World'")
result = shell.run(simulate=True)
assert not result
result = shell.run(simulate=False)
assert result["shell"] == {"output": "Hello World\n", "re... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.