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 |
|---|---|---|---|---|---|---|---|---|
d27bb7984a42bd0476b2dbcc556c146b15ddddbf | add 0.7.0 (#26504) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-ptyprocess/package.py | var/spack/repos/builtin/packages/py-ptyprocess/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 PyPtyprocess(PythonPackage):
"""Run a subprocess in a pseudo terminal"""
pypi = "ptyp... | # 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 PyPtyprocess(PythonPackage):
"""Run a subprocess in a pseudo terminal"""
pypi = "ptyp... | lgpl-2.1 | Python |
60a6cd11facf34594400b74a9dbe8ec20deec01b | Update downloads_id offset | berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud | tools/db/move_nonpartitioned_downloads_to_partitions.py | tools/db/move_nonpartitioned_downloads_to_partitions.py | #!/usr/bin/env python3
import time
from mediawords.db import connect_to_db
from mediawords.util.log import create_logger
from mediawords.util.process import run_alone
log = create_logger(__name__)
def move_nonpartitioned_downloads_to_partitions():
"""Gradually move downloads from "downloads_np" to "downloads_p... | #!/usr/bin/env python3
import time
from mediawords.db import connect_to_db
from mediawords.util.log import create_logger
from mediawords.util.process import run_alone
log = create_logger(__name__)
def move_nonpartitioned_downloads_to_partitions():
"""Gradually move downloads from "downloads_np" to "downloads_p... | agpl-3.0 | Python |
4dff580a4927bd749aa3daae7522a2cf044dd076 | add log | hiroyuki-kasuga/street-movie,hiroyuki-kasuga/street-movie,hiroyuki-kasuga/street-movie | src/main/street_movie/web/views.py | src/main/street_movie/web/views.py | # coding: utf-8
import logging
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponse, Http404
from django.template import RequestContext
from django.template import loader
from django.views.decorators.csrf import csrf_exempt
from api.models import Movie
from... | # coding: utf-8
import logging
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponse, Http404
from django.template import RequestContext
from django.template import loader
from django.views.decorators.csrf import csrf_exempt
from api.models import Movie
from... | mit | Python |
609d23a9a2c03bfc7479f4dade5c40a403b722e8 | Refactor register function | scolby33/OCSPdash,scolby33/OCSPdash,scolby33/OCSPdash | src/ocspdash/web/blueprints/api.py | src/ocspdash/web/blueprints/api.py | import base64
from hmac import compare_digest
from flask import Blueprint, jsonify, current_app, request, abort
from ...models import Authority, Responder
api = Blueprint('api', __name__)
@api.route('/status')
def get_payload():
"""Spits back the current payload"""
payload = current_app.manager.make_payloa... | import base64
from hmac import compare_digest
from flask import Blueprint, jsonify, current_app, request
from ...models import Authority, Responder
api = Blueprint('api', __name__)
@api.route('/status')
def get_payload():
"""Spits back the current payload"""
payload = current_app.manager.make_payload()
... | mit | Python |
9a9d2e2389cd7b7cf07b49b90c255e9c15805bfc | Fix tabs count check while decoding explanations | hatbot-team/hatbot_resources | hb_res/explanations/Explanation.py | hb_res/explanations/Explanation.py | from hb_res.explanations import ExplanationKey
__author__ = 'moskupols'
SEPARATOR = '\t'
class Explanation:
"""
This class is representation of explanation in resource modules.
Explanation is defined as tuple of (title, text, key, prior_rating).
It's essential for both title and text not to contain ... | from hb_res.explanations import ExplanationKey
__author__ = 'moskupols'
SEPARATOR = '\t'
class Explanation:
"""
This class is representation of explanation in resource modules.
Explanation is defined as tuple of (title, text, key, prior_rating).
It's essential for both title and text not to contain ... | mit | Python |
c0574f53b634383b2d317789e89e510666ca37da | Add original job ID to error emails | antismash/dispatcher | dispatcher/messages.py | dispatcher/messages.py | """Message templates for antiSMASH notifications."""
message_template = """Dear {c.tool} user,
The {c.tool} job {j.job_id} you submitted on {j.added} with the filename
'{j.filename}' has finished with status {j.state}.
{action_string}
If you found {c.tool} useful, please check out
{c.base_url}/#!/about
for informat... | """Message templates for antiSMASH notifications."""
message_template = """Dear {c.tool} user,
The {c.tool} job {j.job_id} you submitted on {j.added} with the filename
'{j.filename}' has finished with status {j.state}.
{action_string}
If you found {c.tool} useful, please check out
{c.base_url}/#!/about
for informat... | agpl-3.0 | Python |
26ad33a61745c0d41ba7a2146c15f6f64d289539 | Fix import of py2help | cpcloud/datashape,aterrel/datashape,quantopian/datashape,markflorisson/datashape,quantopian/datashape,FrancescAlted/datashape,ContinuumIO/datashape,cowlicks/datashape,FrancescAlted/datashape,blaze/datashape,cpcloud/datashape,cowlicks/datashape,blaze/datashape,llllllllll/datashape,ContinuumIO/datashape,aterrel/datashape... | datashape/tests/test_overloading.py | datashape/tests/test_overloading.py | from __future__ import print_function, division, absolute_import
import unittest
from datashape import dshape, unify_simple
from datashape.overloading import best_match, overload
from datashape import py2help
#f
@overload('X, Y, float32 -> X, Y, float32 -> X, Y, float32')
def f(a, b):
return a
@overload('X, ... | from __future__ import print_function, division, absolute_import
import unittest
from datashape import dshape, unify_simple
from datashape.overloading import best_match, overload
from blaze import py2help
#f
@overload('X, Y, float32 -> X, Y, float32 -> X, Y, float32')
def f(a, b):
return a
@overload('X, Y, c... | bsd-2-clause | Python |
4858a26400e634b62e137e738be663aa3fa4e26d | add 3.12.0 (#27688) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-humanize/package.py | var/spack/repos/builtin/packages/py-humanize/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 PyHumanize(PythonPackage):
"""This modest package contains various common humanization uti... | # 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 PyHumanize(PythonPackage):
"""This modest package contains various common humanization uti... | lgpl-2.1 | Python |
cdace8cbcbc4bee9ac0e2a2583511c6877529a71 | Update twitch.py | TingPing/plugins,TingPing/plugins | HexChat/twitch.py | HexChat/twitch.py | import hexchat
__module_name__ = 'Twitch'
__module_author__ = 'TingPing'
__module_version__ = '4'
__module_description__ = 'Better integration with Twitch.tv'
# Very much a work in progress...
# Commands from http://help.twitch.tv/customer/portal/articles/659095-chat-moderation-commands
# /ban may conflict with other... | import hexchat
__module_name__ = 'Twitch'
__module_author__ = 'TingPing'
__module_version__ = '4'
__module_description__ = 'Better integration with Twitch.tv'
# Very much a work in progress...
# Commands from http://help.twitch.tv/customer/portal/articles/659095-chat-moderation-commands
# /ban may conflict with other... | mit | Python |
9e9f60928519ba8d38c585fa2e1ba5fe16bb3edf | Fix check for Flask request context when enqueuing tasks | DanielSBrown/osf.io,felliott/osf.io,alexschiller/osf.io,HalcyonChimera/osf.io,pattisdr/osf.io,chennan47/osf.io,zamattiac/osf.io,sloria/osf.io,cslzchen/osf.io,brianjgeiger/osf.io,acshi/osf.io,alexschiller/osf.io,wearpants/osf.io,monikagrabowska/osf.io,cwisecarver/osf.io,icereval/osf.io,Johnetordoff/osf.io,chrisseto/osf.... | framework/celery_tasks/handlers.py | framework/celery_tasks/handlers.py | # -*- coding: utf-8 -*-
import logging
import threading
import functools
from celery import group
from flask import _app_ctx_stack as context_stack
from website import settings
_local = threading.local()
logger = logging.getLogger(__name__)
def queue():
if not hasattr(_local, 'queue'):
_local.queue = ... | # -*- coding: utf-8 -*-
import logging
import threading
import functools
from celery import group
from website import settings
_local = threading.local()
logger = logging.getLogger(__name__)
def queue():
if not hasattr(_local, 'queue'):
_local.queue = []
return _local.queue
def celery_before_re... | apache-2.0 | Python |
2c4b96bcc36649fad92d72d45ff8d86cf69beac0 | disable running of test_tahoefs by default | ctismer/pyfilesystem,ctismer/pyfilesystem | fs/contrib/tahoefs/test_tahoefs.py | fs/contrib/tahoefs/test_tahoefs.py | #!/usr/bin/python
"""
Test the TahoeFS
@author: Marek Palatinus <marek@palatinus.cz>
"""
import sys
import logging
import unittest
from fs.base import FS
import fs.errors as errors
from fs.tests import FSTestCases, ThreadingTestCases
from fs.contrib.tahoefs import TahoeFS, Connection
log... | #!/usr/bin/python
"""
Test the TahoeFS
@author: Marek Palatinus <marek@palatinus.cz>
"""
import sys
import logging
import unittest
from fs.base import FS
import fs.errors as errors
from fs.tests import FSTestCases, ThreadingTestCases
from fs.contrib.tahoefs import TahoeFS, Connection
log... | bsd-3-clause | Python |
b614e75b76d477c78f211179ecdc355b6de171db | fix issue #70 | regosen/gallery_get | gallery_plugins/plugin_xHamster.py | gallery_plugins/plugin_xHamster.py | # Plugin for gallery_get.
import re
from gallery_utils import urlopen_text
# Each definition can be one of the following:
# - a string
# - a regex string
# - a function that takes source as a parameter and returns an array or a string. (You may assume that re and urllib are already imported.)
# If you comment out a p... | # Plugin for gallery_get.
import re
from gallery_utils import urlopen_text
# Each definition can be one of the following:
# - a string
# - a regex string
# - a function that takes source as a parameter and returns an array or a string. (You may assume that re and urllib are already imported.)
# If you comment out a p... | mit | Python |
2d0bbf610eeeebf3e54685e64b1e3d6f717f9ecb | Rename resources to plural to follow REST best practices. | grundic/yagocd,grundic/yagocd | yagocd/client.py | yagocd/client.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# The MIT License
#
# Copyright (c) 2016 Grigory Chernyshev
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation file... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# The MIT License
#
# Copyright (c) 2016 Grigory Chernyshev
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation file... | isc | Python |
6764aa515e42f9344d66700c7e756c6f36560422 | update version of YATSM to v0.3.0 | ceholden/yatsm,valpasq/yatsm,c11/yatsm,ceholden/yatsm,jmorton/yatsm,jmorton/yatsm,jmorton/yatsm,c11/yatsm,valpasq/yatsm | yatsm/version.py | yatsm/version.py | __version__ = '0.3.0'
| __version__ = '0.2.0'
| mit | Python |
da8070684c521e1f3f7d349b418e7015fc8518d4 | fix lint warning | xgds/xgds_plot,xgds/xgds_plot,xgds/xgds_plot,xgds/xgds_plot | xgds_plot/management/templates/ipython_notebook_config.py | xgds_plot/management/templates/ipython_notebook_config.py | # __BEGIN_LICENSE__
# Copyright (C) 2008-2010 United States Government as represented by
# the Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# __END_LICENSE__
"""
ipython_notebook_config.py is a place for you to put site-specific
settings for the IPython Notebook. Settings ... | # __BEGIN_LICENSE__
# Copyright (C) 2008-2010 United States Government as represented by
# the Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# __END_LICENSE__
"""
ipython_notebook_config.py is a place for you to put site-specific
settings for the IPython Notebook. Settings ... | apache-2.0 | Python |
ce5084888f35d9cd3782ca81d705298a3f16de20 | create _get_store | zahariesergiu/scrapy-gridfsfilespipeline | scrapy_gridfsfilespipeline/files.py | scrapy_gridfsfilespipeline/files.py | import datetime
import gridfs
import pymongo
from scrapy.pipelines.files import FilesPipeline
from scrapy.utils.misc import md5sum
class GridFSFilesStorage(object):
"""MongoDB GridFS storage.
Store files in GridFS and returns their ObjectId.
Check if file exists based on file guid generated by pipeline"... | import datetime
import gridfs
import pymongo
from scrapy.pipelines.files import FilesPipeline
from scrapy.utils.misc import md5sum
class GridFSFilesStorage(object):
"""MongoDB GridFS storage.
Store files in GridFS and returns their ObjectId.
Check if file exists based on file guid generated by pipeline"... | bsd-2-clause | Python |
376cd8c9c6e4431214970de1db3594bcd7c393aa | Add comments to the instability script | Vaishal-shah/Envision,dimitar-asenov/Envision,lukedirtwalker/Envision,dimitar-asenov/Envision,dimitar-asenov/Envision,mgalbier/Envision,Vaishal-shah/Envision,Vaishal-shah/Envision,Vaishal-shah/Envision,mgalbier/Envision,dimitar-asenov/Envision,Vaishal-shah/Envision,mgalbier/Envision,dimitar-asenov/Envision,Vaishal-shah... | InformationScripting/scripts/case-studies/instability.py | InformationScripting/scripts/case-studies/instability.py | # Returns the fully qualified package of a node
def packageOf(node):
package = ''
node = node.parent
while node:
if type(node) is Module:
package = node.symbolName() + '.' + package
node = node.parent
return package
# Returns a list of all packages a class imports
def dependsOnPackages(aClass):
result = []... | def packageOf(node):
package = ''
node = node.parent
while node:
if type(node) is Module:
package = node.symbolName() + '.' + package
node = node.parent
return package
def dependsOnPackages(aClass):
result = []
for decl in aClass.subDeclarations:
if type(decl) is NameImport:
package = ''
name = de... | bsd-3-clause | Python |
d22ab94f881440788885685eb8c442d7c3a1b6ee | fix iso639 to iso639-lang manifest | CompassionCH/compassion-modules,CompassionCH/compassion-modules,CompassionCH/compassion-modules,CompassionCH/compassion-modules | advanced_translation/__manifest__.py | advanced_translation/__manifest__.py | ##############################################################################
#
# ______ Releasing children from poverty _
# / ____/___ ____ ___ ____ ____ ___________(_)___ ____
# / / / __ \/ __ `__ \/ __ \/ __ `/ ___/ ___/ / __ \/ __ \
# / /___/ /_/ / / / / / / /_/ / /_/ (__ |__ ) / /_/... | ##############################################################################
#
# ______ Releasing children from poverty _
# / ____/___ ____ ___ ____ ____ ___________(_)___ ____
# / / / __ \/ __ `__ \/ __ \/ __ `/ ___/ ___/ / __ \/ __ \
# / /___/ /_/ / / / / / / /_/ / /_/ (__ |__ ) / /_/... | agpl-3.0 | Python |
18dc446b64ce8ef6db2ddf197e4c9f19204d2c1c | fix init OperationIdMapping | aamalev/aiohttp_apiset | aiohttp_apiset/swagger/operations.py | aiohttp_apiset/swagger/operations.py | from collections.abc import Mapping
from importlib import import_module
from ..utils import import_obj
class OperationIdMapping(Mapping):
def __init__(self, *args, **kwargs):
super().__init__()
self._operations = []
self.add_operations(*args, **kwargs)
def __getitem__(self, key):
... | from collections.abc import Mapping
from importlib import import_module
from ..utils import import_obj
class OperationIdMapping(Mapping):
def __init__(self, *args, **kwargs):
super().__init__()
self._operations = []
self.add_operations(*args, *kwargs)
def __getitem__(self, key):
... | apache-2.0 | Python |
68f137c3c8af6d085a8d6cd6718a5e575a515b72 | Update storage_get_metadata.py (#4615) | GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples,GoogleCloudPlatform/python-docs-samples | storage/cloud-client/storage_get_metadata.py | storage/cloud-client/storage_get_metadata.py | #!/usr/bin/env python
# Copyright 2019 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | #!/usr/bin/env python
# Copyright 2019 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | apache-2.0 | Python |
4113f6bcda1296b1708cb78c5c22620507b60428 | Update rtconfig.py for module in QEMU. | FlyLu/rt-thread,yongli3/rt-thread,RT-Thread/rt-thread,hezlog/rt-thread,igou/rt-thread,geniusgogo/rt-thread,AubrCool/rt-thread,gbcwbz/rt-thread,AubrCool/rt-thread,FlyLu/rt-thread,gbcwbz/rt-thread,FlyLu/rt-thread,gbcwbz/rt-thread,FlyLu/rt-thread,nongxiaoming/rt-thread,weety/rt-thread,zhaojuntao/rt-thread,AubrCool/rt-thre... | bsp/qemu-vexpress-a9/rtconfig.py | bsp/qemu-vexpress-a9/rtconfig.py | import os
# toolchains options
ARCH='arm'
CPU='vexpress-a9'
CROSS_TOOL='gcc'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
PLATFORM = 'gcc'
EXEC_PATH = '/opt/gcc-arm-none-eabi-4_8-2014q1_gri/bin'
if os.getenv('RTT_EXEC_PATH'):
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
BUILD = 'debug'
if PLATF... | import os
# toolchains options
ARCH='arm'
CPU='vexpress-a9'
CROSS_TOOL='gcc'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
PLATFORM = 'gcc'
EXEC_PATH = '/opt/gcc-arm-none-eabi-4_8-2014q1_gri/bin'
if os.getenv('RTT_EXEC_PATH'):
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
BUILD = 'debug'
if PLATF... | apache-2.0 | Python |
a131c01593ec53f46e4a64242991f9691b037cce | Correct runbot task_args order | CenterForOpenScience/SHARE,aaxelb/SHARE,laurenbarker/SHARE,aaxelb/SHARE,laurenbarker/SHARE,aaxelb/SHARE,CenterForOpenScience/SHARE,CenterForOpenScience/SHARE,laurenbarker/SHARE | share/management/commands/runbot.py | share/management/commands/runbot.py | from django.apps import apps
from django.conf import settings
from django.core.management.base import BaseCommand
from share.tasks import BotTask
from share.models import ShareUser
from share.bot import BotAppConfig
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('--all'... | from django.apps import apps
from django.conf import settings
from django.core.management.base import BaseCommand
from share.tasks import BotTask
from share.models import ShareUser
from share.bot import BotAppConfig
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('--all'... | apache-2.0 | Python |
7fa4540fb44a63ef25728f02954d35a8bfbda4b2 | Change time zone to America/Los_Angeles | mfcovington/django-lab-members,mfcovington/django-lab-members,mfcovington/django-lab-members | django_lab_members_site/settings.py | django_lab_members_site/settings.py | """
Django settings for django_lab_members_site project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(B... | """
Django settings for django_lab_members_site project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(B... | bsd-3-clause | Python |
6e0b95ddc7ac3e59e51a4c2005b50cbad7343540 | Fix flake8 errors | ericdill/scikit-xray,yugangzhang/scikit-beam,scikit-xray/scikit-xray,CJ-Wright/scikit-beam,tacaswell/scikit-beam,scikit-xray/scikit-xray,licode/scikit-beam,tacaswell/scikit-beam,Nikea/scikit-xray,Nikea/scikit-xray,licode/scikit-xray,CJ-Wright/scikit-beam,CJ-Wright/scikit-beam,ericdill/scikit-xray,licode/scikit-beam,lic... | skbeam/core/accumulators/timings.py | skbeam/core/accumulators/timings.py |
if __name__ == "__main__":
import timeit
import numpy as np
from skbeam.core.accumulators.histogram import Histogram
h = Histogram((10, 0, 10.1), (7, 0, 7.1))
x = np.random.random(1000000)*40
y = np.random.random(1000000)*10
w = np.ones_like(x)
xi = x.astype(int)
xi = xi.astype(floa... | import timeit
import time
import numpy as np
from skbeam.core.accumulators.histogram import Histogram
h = Histogram((10, 0, 10.1), (7, 0, 7.1));
x = np.random.random(1000000)*40
y = np.random.random(1000000)*10
w = np.ones_like(x)
xi = x.astype(int)
xi = xi.astype(float)
wi = np.ones_like(xi)
gg = globals()
def timet... | bsd-3-clause | Python |
07fabcc0fa08d95ec5f17f5cbfcd0c14b645f31c | Add migration for assigning security groups | CompassionCH/compassion-modules,CompassionCH/compassion-modules,CompassionCH/compassion-modules,CompassionCH/compassion-modules | child_compassion/migrations/11.0.1.0.0/post-migration.py | child_compassion/migrations/11.0.1.0.0/post-migration.py | ##############################################################################
#
# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
# @author: Nathan Flückiger <nathan.fluckiger@hotmail.ch>
#
# The licence is in the file __manifest__.py
#
#############################################################... | ##############################################################################
#
# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
# @author: Nathan Flückiger <nathan.fluckiger@hotmail.ch>
#
# The licence is in the file __manifest__.py
#
#############################################################... | agpl-3.0 | Python |
e95b45b1bd8c8824974e35634f9b7a9ab1e50ac5 | fix migration | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/sql_accessors/migrations/0052_save_ledgers_fix.py | corehq/sql_accessors/migrations/0052_save_ledgers_fix.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-24 12:55
from __future__ import unicode_literals
from django.db import migrations
from corehq.sql_db.operations import noop_migration
class Migration(migrations.Migration):
dependencies = [
('sql_accessors', '0051_merge_20170724_1255'),
... | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-24 12:55
from __future__ import unicode_literals
from django.db import migrations
from corehq.sql_db.operations import RawSQLMigration
migrator = RawSQLMigration(('corehq', 'sql_accessors', 'sql_templates'), {})
class Migration(migrations.Migration):
... | bsd-3-clause | Python |
a125a976531650681856fac2a976ae57b3aaf2ed | Test registers/admin custom view reponses. | parksandwildlife/oim-cms,rockychen-dpaw/oim-cms,scottp-dpaw/oim-cms,rockychen-dpaw/oim-cms,parksandwildlife/oim-cms,scottp-dpaw/oim-cms,scottp-dpaw/oim-cms,parksandwildlife/oim-cms,rockychen-dpaw/oim-cms | registers/test_admin.py | registers/test_admin.py | from __future__ import absolute_import, print_function, unicode_literals
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.test import Client
from mixer.backend.django import mixer
from oim_cms.test_api import ApiTestCase
from registers.models import ITSystemHardwa... | from django.test import TestCase
from django.contrib.auth.models import User, Group, Permission
from django.apps import apps
from django.contrib.contenttypes.models import ContentType
class PermissionsTestCase(TestCase):
group = None
def setUp(self):
User.objects.create(username="test-user1", password =... | apache-2.0 | Python |
487c49315a72a754c5a57ed210670efe5fb12f80 | Fix remove_old_ads command | openmaraude/APITaxi,openmaraude/APITaxi | APITaxi/commands/remove_old_ads.py | APITaxi/commands/remove_old_ads.py | from . import manager
from APITaxi_models import db
@manager.command
def remove_old_ads():
if not db.session.execute("SELECT EXISTS (SELECT 1 FROM pg_tables WHERE tablename = 'ADS_old')").fetchone()[0]:
db.session.execute("""
CREATE TABLE "ADS_old" AS TABLE "ADS" WITH NO DATA;
""")
d... | from . import manager
from APITaxi_models import db
@manager.command
def remove_old_ads():
db.session.execute("""
CREATE TABLE IF NOT EXISTS "ADS_old" AS "ADS" WITH NO DATA;
""")
db.session.execute("""
SELECT * INTO "ADS_old" FROM "ADS"
WHERE "ADS".id NOT IN (SELECT ads_id FROM taxi... | agpl-3.0 | Python |
db9a720aaa38b312d943c482eae6e1b1def767c2 | Update __init__.py | pajlada/tyggbot,pajlada/pajbot,pajlada/tyggbot,pajlada/tyggbot,pajlada/pajbot,pajlada/pajbot,pajlada/tyggbot,pajlada/pajbot | pajbot/modules/__init__.py | pajbot/modules/__init__.py | from pajbot.modules.base import BaseModule, ModuleSetting
from pajbot.modules.dummy import DummyModule
from pajbot.modules.duel import DuelModule
from pajbot.modules.predict import PredictModule
from pajbot.modules.deck import DeckModule
from pajbot.modules.followage import FollowAgeModule
from pajbot.modules.math impo... | from pajbot.modules.base import BaseModule, ModuleSetting
from pajbot.modules.dummy import DummyModule
from pajbot.modules.duel import DuelModule
from pajbot.modules.predict import PredictModule
from pajbot.modules.deck import DeckModule
from pajbot.modules.followage import FollowAgeModule
from pajbot.modules.math impo... | mit | Python |
92764616507d931ea1f1e2c38d3b5339ebf2df8e | Update task_3_7.py | Mariaanisimova/pythonintask,swer13/pythonintask,Akakiis/pythonintask | BITs/2014/VoroshinStas/task_3_7.py | BITs/2014/VoroshinStas/task_3_7.py | #Задача №3, Вариант 7
#Компьютер напишет имя "Мэри Анн Эванс" и запросит псевдоним, который пользователь напишет сам
#Ворошин С.И.
#29.02.2016
print("Герой нашей сегодняшней программы - Мэри Анн Эванс")
psev=input("Под каким же именем мы знаем этого человека? Ваш ответ:")
if (psev)==("Джордж Элиот"):
print ... | #Задача №3, Вариант 7
#Компьютер напишет имя "Мэри Анн Эванс" и запросит псевдоним, который пользователь напишет сам
#Ворошин С.И.
#29.02.2016
print("Герой нашей сегоднящей программы - Мэри Анн Эванс")
psev=input("Под каким же именем мы знаем этого человека? Ваш ответ:")
if (psev)==("Джордж Элиот"):
print (... | apache-2.0 | Python |
ee2fc831eb189d4bf01bdc97083f0501a465265b | fix bug | staugur/EauDouce,staugur/EauDouce,staugur/EauDouce,staugur/EauDouce | src/plugins/CrawlHuaban/Cleanup.py | src/plugins/CrawlHuaban/Cleanup.py | # -*- coding: utf-8 -*-
"""
EauDouce.plugins.CrawlHuaban.Cleanup
~~~~~~~~~~~~~~
定时清理抓取花瓣网画板的图片
:copyright: (c) 2018 by taochengwei.
:license: MIT, see LICENSE for more details.
"""
import os
import time
import datetime
basedir = os.path.dirname(os.path.abspath(__file__))
def ... | # -*- coding: utf-8 -*-
"""
EauDouce.plugins.CrawlHuaban.Cleanup
~~~~~~~~~~~~~~
定时清理抓取花瓣网画板的图片
:copyright: (c) 2018 by taochengwei.
:license: MIT, see LICENSE for more details.
"""
import os
import time
import datetime
basedir = os.path.dirname(os.path.abspath(__file__))
def ... | bsd-3-clause | Python |
971218b462b888ea045ab78edae7d36f35dcbaf9 | Add regression for #627. | gmcastil/numpy,larsmans/numpy,kiwifb/numpy,grlee77/numpy,endolith/numpy,tacaswell/numpy,dimasad/numpy,pbrod/numpy,kiwifb/numpy,NextThought/pypy-numpy,jakirkham/numpy,ChristopherHogan/numpy,hainm/numpy,NextThought/pypy-numpy,gmcastil/numpy,numpy/numpy,MaPePeR/numpy,jschueller/numpy,numpy/numpy-refactor,ESSS/numpy,mattip... | numpy/linalg/tests/test_regression.py | numpy/linalg/tests/test_regression.py | """ Test functions for linalg module
"""
from numpy.testing import *
set_package_path()
import numpy as np
from numpy import linalg, arange, float64, array, dot, transpose
restore_path()
rlevel = 1
class TestRegression(NumpyTestCase):
def test_eig_build(self, level = rlevel):
"""Ticket #652"""
rv... | """ Test functions for linalg module
"""
from numpy.testing import *
set_package_path()
from numpy import linalg, arange, float64, array
restore_path()
rlevel = 1
class TestRegression(NumpyTestCase):
def test_eig_build(self, level = rlevel):
"""Ticket #652"""
rva = [1.03221168e+02 +0.j,
... | bsd-3-clause | Python |
1c2907273b4752df5f1693449cdbca6274e54b9b | Remove check for a variable not set | pombredanne/mirrormanager2,pombredanne/mirrormanager2,pombredanne/mirrormanager2,Devyani-Divs/mirrormanager2,pombredanne/mirrormanager2,Devyani-Divs/mirrormanager2,Devyani-Divs/mirrormanager2,Devyani-Divs/mirrormanager2 | mirrormanager2/lib/notifications.py | mirrormanager2/lib/notifications.py | # -*- coding: utf-8 -*-
#
# Copyright © 2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2, or (at your option) any later
# version. This program is distributed in t... | # -*- coding: utf-8 -*-
#
# Copyright © 2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2, or (at your option) any later
# version. This program is distributed in t... | mit | Python |
a5a9ea00e8e272a38f9737dc4be96beed57f3bbc | bump version | fuziontech/svb | svb/version.py | svb/version.py | VERSION = '0.0.3'
| VERSION = '0.0.2'
| mit | Python |
28c06a7a8716c63d54dd62245aa15a116e41b406 | Add "botosh -c CMD", which works a lot like "python -c CMD". | tv42/botosh,tv42/botosh | botosh.py | botosh.py | import argparse
import boto.s3.connection
import code
import os
import readline
import rlcompleter
import sys
import yaml
# silence pyflakes
rlcompleter.__name__
def main():
parser = argparse.ArgumentParser(
usage='%(prog)s',
)
parser.add_argument(
'--config',
default=os.path... | import argparse
import boto.s3.connection
import code
import os
import readline
import rlcompleter
import yaml
# silence pyflakes
rlcompleter.__name__
def main():
parser = argparse.ArgumentParser(
usage='%(prog)s',
)
parser.add_argument(
'--config',
default=os.path.expanduser... | mit | Python |
6b4a78ddbb81374359f6fb868c52919f25b9af73 | Add tests for Inf/Nan values in FreesoundExtractor | carthach/essentia,carthach/essentia,MTG/essentia,MTG/essentia,MTG/essentia,carthach/essentia,carthach/essentia,carthach/essentia,MTG/essentia,MTG/essentia | test/src/unittest/extractor/test_freesoundextractor.py | test/src/unittest/extractor/test_freesoundextractor.py | #!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 Foundation (FSF), e... | #!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 Foundation (FSF), e... | agpl-3.0 | Python |
feb2d66606a3f9487b77af7fef2f53e409ef7d9f | Update tests/cupy_tests/core_tests/test_ndarray_conversion.py | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | tests/cupy_tests/core_tests/test_ndarray_conversion.py | tests/cupy_tests/core_tests/test_ndarray_conversion.py | import unittest
from cupy import testing
@testing.parameterize(
{'shape': ()},
{'shape': (1,)},
{'shape': (1, 1, 1)},
)
class TestNdarrayItem(unittest.TestCase):
@testing.for_all_dtypes()
@testing.numpy_cupy_equal()
def test_item(self, xp, dtype):
a = xp.full(self.shape, 3, dtype)
... | import unittest
from cupy import testing
@testing.parameterize(
{'shape': ()},
{'shape': (1,)},
{'shape': (1, 1, 1)},
)
class TestNdarrayItem(unittest.TestCase):
@testing.for_all_dtypes()
@testing.numpy_cupy_equal()
def test_item(self, xp, dtype):
a = xp.full(self.shape, 3, dtype)
... | mit | Python |
0efce74027a08646c5a6c5a747ada7d3821b789b | add version 7.1.1 to r-roxygen2 (#21020) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/r-roxygen2/package.py | var/spack/repos/builtin/packages/r-roxygen2/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 RRoxygen2(RPackage):
"""In-Line Documentation for R
Generate your Rd documentation, '... | # 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 RRoxygen2(RPackage):
"""A 'Doxygen'-like in-source documentation system for Rd, collation,... | lgpl-2.1 | Python |
f3c09f8920b2e1d2fac19e5f910cc47b6c461063 | Put the forecasts in forecasts/city/pname | BCCN-Prog/webscraping | ws/plugins_master.py | ws/plugins_master.py | from .plugins import *
import urllib.request
import time
import pickle
import os
def download_from_url(url):
r = urllib.request.urlopen(url)
data = str(r.read())
return data
def generate_forecast_filepath(pname, city):
"""
forecasts/city/pname
"""
posix_time = time.time()
utc_posix_... | from .plugins import *
import urllib.request
import time
import pickle
import os
def download_from_url(url):
r = urllib.request.urlopen(url)
data = str(r.read())
return data
def generate_forecast_filepath(pname, city):
"""
forecasts/pname/city/
"""
posix_time = time.time()
utc_posix... | bsd-3-clause | Python |
99d813a377e43b319534cfbaf527ea9ffbdcd2ad | Test hidden variable in class | zzz0072/Python_Exercises,zzz0072/Python_Exercises | 05_class/class.py | 05_class/class.py | #/usr/bin/env python
#------------------------------------------------------------------------------
# Test Doc
class foo:
"This is a example:"
i = foo()
print(i.__doc__)
#------------------------------------------------------------------------------
# Test data member
class bar:
x = 10
y = 20
__hidde... | #/usr/bin/env python
#------------------------------------------------------------------------------
# Test Doc
class foo:
"This is a example:"
i = foo()
print(i.__doc__)
#------------------------------------------------------------------------------
# Test data member
class bar:
x = 10
y = 20
__hidde... | bsd-2-clause | Python |
ffc7c2a576c216af97dee349062cb17f7422d5d0 | add some tests | tocodeil/python-course-examples | 06_modules_lab/spec.py | 06_modules_lab/spec.py | import unittest
import subprocess
import sys
class TestEx1(unittest.TestCase):
def test_print_hello_python(self):
proc = subprocess.Popen([sys.executable, '01.py', '5'],
stdout=subprocess.PIPE)
for i in range(5):
line = proc.stdout.readline()
... | import unittest
import subprocess
import sys
class TestEx1(unittest.TestCase):
def test_print_hello_python(self):
proc = subprocess.Popen([sys.executable, '01.py', '5'],
stdout=subprocess.PIPE)
for i in range(5):
line = proc.stdout.readline()
... | mit | Python |
ffd8bb1e85fe7ed80d85062e4d5932f28065b84c | Apply default_auto_field to app config. | jjkester/django-auditlog | auditlog/apps.py | auditlog/apps.py | from django.apps import AppConfig
class AuditlogConfig(AppConfig):
name = "auditlog"
verbose_name = "Audit log"
default_auto_field = 'django.db.models.AutoField'
| from django.apps import AppConfig
class AuditlogConfig(AppConfig):
name = "auditlog"
verbose_name = "Audit log"
| mit | Python |
895043387f8f57e7ca0449dc2be80d095a5f98d5 | add handshake events handling | nodakai/watchman,wez/watchman,facebook/watchman,facebook/watchman,facebook/watchman,nodakai/watchman,facebook/watchman,nodakai/watchman,wez/watchman,wez/watchman,nodakai/watchman,nodakai/watchman,nodakai/watchman,facebook/watchman,nodakai/watchman,nodakai/watchman,wez/watchman,nodakai/watchman,wez/watchman,facebook/wat... | build/fbcode_builder/specs/fbzmq.py | build/fbcode_builder/specs/fbzmq.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import specs.fbthrift as fbthrift
import specs.folly as folly
import specs.gmock as gmock
import ... | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import specs.fbthrift as fbthrift
import specs.folly as folly
import specs.gmock as gmock
import ... | mit | Python |
11e1d05d5267ee63d5a6a16a0e527ad4c16fc7e6 | Fix gradient check example for TF2 | pymanopt/pymanopt,pymanopt/pymanopt | examples/advanced/check_gradient.py | examples/advanced/check_gradient.py | import os
import autograd.numpy as np
import tensorflow as tf
import theano.tensor as T
import torch
from examples._tools import ExampleRunner
import pymanopt
from pymanopt import Problem
from pymanopt.manifolds import Sphere
from pymanopt.tools.diagnostics import check_gradient
os.environ["TF_CPP_MIN_LOG_LEVEL"] =... | import os
import autograd.numpy as np
import tensorflow as tf
import theano.tensor as T
import torch
from examples._tools import ExampleRunner
import pymanopt
from pymanopt import Problem
from pymanopt.manifolds import Sphere
from pymanopt.tools.diagnostics import check_gradient
os.environ["TF_CPP_MIN_LOG_LEVEL"] =... | bsd-3-clause | Python |
be64ed34631f5a162d95d8ce0f8a70c1982a77d3 | Fix test classes name of test_tokens.py | LIS/lis-tempest,tudorvio/tempest,eggmaster/tempest,Vaidyanath/tempest,queria/my-tempest,rzarzynski/tempest,openstack/tempest,masayukig/tempest,JioCloud/tempest,danielmellado/tempest,neerja28/Tempest,manasi24/jiocloud-tempest-qatempest,FujitsuEnablingSoftwareTechnologyGmbH/tempest,xbezdick/tempest,bigswitch/tempest,dkal... | tempest/api/identity/admin/v3/test_tokens.py | tempest/api/identity/admin/v3/test_tokens.py | # Copyright 2012 OpenStack Foundation
# 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 requ... | # Copyright 2012 OpenStack Foundation
# 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 requ... | apache-2.0 | Python |
aa3adb224e1d7cfbb8ac7e41cfb9dd36565d3bf8 | Update device_id_auth_tropies example. | praw-dev/prawcore | examples/device_id_auth_trophies.py | examples/device_id_auth_trophies.py | #!/usr/bin/env python
"""This example outputs a user's list of trophies.
This program demonstrates the use of ``prawcore.DeviceIDAuthorizer``.
"""
import os
import prawcore
import sys
def main():
"""Provide the program's entry point when directly executed."""
if len(sys.argv) != 2:
print('Usage: {}... | #!/usr/bin/env python
"""This example outputs a user's list of trophies.
This program demonstrates the use of ``prawcore.DeviceIDAuthorizer``.
"""
import os
import prawcore
import sys
def main():
"""Provide the program's entry point when directly executed."""
if len(sys.argv) != 2:
print('Usage: {}... | bsd-2-clause | Python |
e9f54e36a6aeea6c3f385f6ffff6effc3e8e8812 | fix renamed tool but still broken | ahmadia/bokeh,almarklein/bokeh,muku42/bokeh,abele/bokeh,jakirkham/bokeh,laurent-george/bokeh,bsipocz/bokeh,azjps/bokeh,htygithub/bokeh,josherick/bokeh,abele/bokeh,ChristosChristofidis/bokeh,ericdill/bokeh,lukebarnard1/bokeh,laurent-george/bokeh,PythonCharmers/bokeh,rothnic/bokeh,carlvlewis/bokeh,justacec/bokeh,justacec... | examples/glyphs/data_select_tool.py | examples/glyphs/data_select_tool.py | # The plot server must be running
import numpy as np
from bokeh.plotting import *
import bokeh.plotting as plotting
from bokeh.objects import (ColumnDataSource, DataRangeBoxSelectTool,
BoxSelectionOverlay)
x = np.linspace(-7, 7, 100)
y = np.sin(x)
# Go to http://localhost:5006/bokeh to vie... | # The plot server must be running
import numpy as np
from bokeh.plotting import *
import bokeh.plotting as plotting
from bokeh.objects import (ColumnDataSource, DataRangeBoxSelectionTool,
BoxSelectionOverlay)
x = np.linspace(-7, 7, 100)
y = np.sin(x)
# Go to http://localhost:5006/bokeh to ... | bsd-3-clause | Python |
184494b528ca761f56a7d45eb7c7b525c828bbe0 | set fixture to fix a test. | ecolell/pfamserver,ecolell/pfamserver,ecolell/pfamserver | backend/tests/api/v0/test_uniprot.py | backend/tests/api/v0/test_uniprot.py | import json
def test_get_uniprot_pfams(db, client, uniprot_reg_full_egfr_human):
headers = [("Accept", "application/json"), ("Content-Type", "application/json")]
res = client.get("/api/v0/uniprots/egfr_human/pfams", headers=headers)
assert res.status_code == 200
data = json.loads(res.get_data(as_text=... | from __future__ import unicode_literals
import json
def test_get_uniprot_pfams(db, client):
headers = [('Accept', 'application/json'),
('Content-Type', 'application/json')]
res = client.get('/api/v0/uniprots/egfr_human/pfams', headers=headers)
assert res.status_code == 200
data = json.l... | agpl-3.0 | Python |
755f43aea49c5bda50e7d7bb4329db3f50ef42ae | Update config.py | Alcheri/Plugins | Titlerz/config.py | Titlerz/config.py | ###
# Copyright (c) 2016, Barry Suridge
# All rights reserved.
#
###
import supybot.conf as conf
import supybot.registry as registry
try:
from supybot.i18n import PluginInternationalization
_ = PluginInternationalization('Titlerz')
except:
# Placeholder that allows to run the plugin on a bot
# without ... | ###
# Copyright (c) 2016, Barry Suridge
# All rights reserved.
#
###
import supybot.conf as conf
import supybot.registry as registry
try:
from supybot.i18n import PluginInternationalization
_ = PluginInternationalization('Titlerz')
except:
# Placeholder that allows to run the plugin on a bot
# without ... | bsd-3-clause | Python |
e72f2ec325756eb2a3914e5ef247568a74f44dc3 | Add iOS ARM64 and XCode 6.1 to default trybots. | fate-extra/libyuv,skufog/libyuv,RockySteveJobs/libyuv,OrenHg/libyuv,ganzhijie/libyuv,gigakuma/libyuv,bingerZhang/libyuv,uditkumawat/libyuv,mosterta/libyuv,KerwinMa/libyuv,yzhikan/libyuv,yzhikan/libyuv,Vairn/libyuv,uraran/libyuv,dexcz/libyuv,wl-chuang/libyuv,StopProducing/libyuv,mosterta/libyuv,StopProducing/libyuv,sath... | PRESUBMIT.py | PRESUBMIT.py | # Copyright 2014 The LibYuv Project Authors. All rights reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors... | # Copyright 2014 The LibYuv Project Authors. All rights reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors... | bsd-3-clause | Python |
388223877a26694e7c39f42760c47d1d5119eee7 | Update __init__.py | AdamIsrael/PerfKitBenchmarker,AdamIsrael/PerfKitBenchmarker,mateusz-blaszkowski/PerfKitBenchmarker,kivio/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,mateusz-blaszkowski/PerfKitBenchmarker,kivio/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlat... | perfkitbenchmarker/alicloud/__init__.py | perfkitbenchmarker/alicloud/__init__.py | # Copyright 2015 Alibaba Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | # Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | apache-2.0 | Python |
3bb2a6ad0c2f22bacf0670548f10271256957ac8 | fix the name of the class in the super() call | crateio/crate.io | crate_project/apps/favorites/views.py | crate_project/apps/favorites/views.py | import json
from django.core.cache import cache
from django.http import HttpResponse
from django.views.generic.base import View
from django.views.generic.list import ListView
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from favorites.models import Fa... | import json
from django.core.cache import cache
from django.http import HttpResponse
from django.views.generic.base import View
from django.views.generic.list import ListView
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from favorites.models import Fa... | bsd-2-clause | Python |
ee9bc351caa2b52519485fb1093a0d37a610c975 | Update minimum-window-substring.py | yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,jaredkoontz/leetcode,githubutilities/LeetCode,jaredkoontz/leetcode,githubutilities/LeetCode,yiwen-luo/LeetCode,githubutilities/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoon... | Python/minimum-window-substring.py | Python/minimum-window-substring.py | # Time: O(n)
# Space: O(k), k is
#
# Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).
#
# For example,
# S = "ADOBECODEBANC"
# T = "ABC"
# Minimum window is "BANC".
#
# Note:
# If there is no such window in S that covers all characters in T... | # Time: O(n)
# Space: O(1)
#
# Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).
#
# For example,
# S = "ADOBECODEBANC"
# T = "ABC"
# Minimum window is "BANC".
#
# Note:
# If there is no such window in S that covers all characters in T, retur... | mit | Python |
f6072411bf097ae3d493f5c95d05f4711fdc5195 | Handle package not found in pypi command | Harmon758/Harmonbot,Harmon758/Harmonbot | Discord/cogs/python.py | Discord/cogs/python.py |
from discord.ext import commands
from utilities import checks
def setup(bot):
bot.add_cog(Python())
class Python(commands.Cog):
async def cog_check(self, ctx):
return await checks.not_forbidden().predicate(ctx)
@commands.command()
async def pep(self, ctx, number: int):
'''Generate Python Enhancement Pro... |
from discord.ext import commands
from utilities import checks
def setup(bot):
bot.add_cog(Python())
class Python(commands.Cog):
async def cog_check(self, ctx):
return await checks.not_forbidden().predicate(ctx)
@commands.command()
async def pep(self, ctx, number: int):
'''Generate Python Enhancement Pro... | mit | Python |
41669b836e46ef3d4789c59668f2302d86d46e2f | Fix 'Unknown Command' message. | Jake0720/XChat-Scripts | Sexymeter.py | Sexymeter.py | __module_name__ = 'Sexymeter Plugin'
__module_version__ = '0.3'
__module_description__ = 'Detects your sexiness on a scale from 0 to 100.'
__module_author__ = 'Jake0720 with help from Liam Stanley'
import xchat
from random import randint as rand
c = '\x02\x0303'
help = '%sType /sm to see your sexiness on a scale from... | __module_name__ = 'Sexymeter Plugin'
__module_version__ = '0.3'
__module_description__ = 'Detects your sexiness on a scale from 0 to 100.'
__module_author__ = 'Jake0720 with help from Liam Stanley'
import xchat
from random import randint as rand
c = '\x02\x0303'
help = '%sType /sm to see your sexiness on a scale from... | mit | Python |
2032de8bcf6ae6ed84a09ce3e294bae8fd86962a | Fix gateway lag being negative in d?ping | sliceofcode/dogbot,slice/dogbot,slice/dogbot,slice/dogbot,sliceofcode/dogbot | dog/core/ext/health.py | dog/core/ext/health.py | """
Commands used to check the health of the bot.
"""
import datetime
from time import monotonic
from dog import Cog
from discord.ext import commands
class Health(Cog):
@commands.command()
async def ping(self, ctx):
""" Pong! """
# measure gateway delay
before = monotonic()
... | """
Commands used to check the health of the bot.
"""
import datetime
from time import monotonic
from dog import Cog
from discord.ext import commands
class Health(Cog):
@commands.command()
async def ping(self, ctx):
""" Pong! """
# measure gateway delay
before = monotonic()
... | mit | Python |
7bd7d72e5adce335609f016a5833039d5bbb5c48 | sort result | legnaleurc/acddl,legnaleurc/acddl,legnaleurc/acddl | acddl/api.py | acddl/api.py | import json
from tornado import web
class NodesHandler(web.RequestHandler):
async def get(self):
pattern = self.get_argument('pattern', None)
if not pattern:
self.set_status(400)
return
controller = self.settings['controller']
nodes = await controller.sea... | import json
from tornado import web
class NodesHandler(web.RequestHandler):
async def get(self):
pattern = self.get_argument('pattern', None)
if not pattern:
self.set_status(400)
return
controller = self.settings['controller']
nodes = await controller.sea... | mit | Python |
fc317a27b6ed19b8e0e59b6f0d3dee3a7b426250 | remove deprecated keys, ReSTructure the description | dvitme/account-financial-tools,ClearCorp-dev/account-financial-tools,syci/account-financial-tools,VitalPet/account-financial-tools,luc-demeyer/account-financial-tools,lepistone/account-financial-tools,alhashash/account-financial-tools,Pexego/account-financial-tools,credativUK/account-financial-tools,Domatix/account-fin... | account_constraints/__openerp__.py | account_constraints/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author Joel Grand-Guillaume. Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author Joel Grand-Guillaume. Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | agpl-3.0 | Python |
8203005d483a925fcf1ab41670eacd7c2788f81c | Allow arbitrary data to be attached to commands (round 2) | wylee/runcommands,wylee/runcommands | runcommands/util/data.py | runcommands/util/data.py | class Data:
"""A bucket for arbitrary data.
Data can be added and retrieved as attributes (dot notation) or
items (bracket notation).
When a ``dict`` is added, it will be converted to an instance of
:class:`Data`.
"""
def __init__(self, **data):
super().__setattr__('__data', {})... | class Data:
"""A bucket for arbitrary data.
Data can be added and retrieved as attributes (dot notation) or
items (bracket notation).
"""
def __init__(self, **data):
super().__setattr__('__data', {})
for name, value in data.items():
self[name] = value
def __getat... | mit | Python |
ddcbd9f5c672ba65aa3358f99415aa1db34ae842 | Update add_3d_output.py | Rfam/rfam-production,Rfam/rfam-production,Rfam/rfam-production | pdb_mapping/add_3d_output.py | pdb_mapping/add_3d_output.py | import datetime
from pdb_config import add_3d_git_output, pdb_files
def write_3d_output():
"""
Extract relevant info from the rfam-3d-seed-alignments script
and write to a file to send to the Slack channel
"""
modified = "The following families have been updated with 3D information: \n"
added... | import datetime
from pdb_config import add_3d_git_output, pdb_files
def write_3d_output():
"""
Extract relevant info from the rfam-3d-seed-alignments script
and write to a file to send to the Slack channel
"""
modified = "The following families have been updated with 3D information: "
added =... | apache-2.0 | Python |
b907728153f5f6f0437ab9536f74d548b320bf77 | change codec | shnizzedy/SM_openSMILE,shnizzedy/SM_openSMILE,shnizzedy/SM_openSMILE,shnizzedy/SM_openSMILE,shnizzedy/SM_openSMILE | openSMILE_preprocessing/mxf_to_wav.py | openSMILE_preprocessing/mxf_to_wav.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
mxf_to_wav.py
Script to quickly convert an mp3 file to a waveform file.
Author:
– Jon Clucas, 2016 (jon.clucas@childmind.org)
© 2016, Child Mind Institute, Apache v2.0 License
Created on Fri Dec 23 12:43:40 2016
@author: jon.clucas
"""
import argparse, sub... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
mxf_to_wav.py
Script to quickly convert an mp3 file to a waveform file.
Author:
– Jon Clucas, 2016 (jon.clucas@childmind.org)
© 2016, Child Mind Institute, Apache v2.0 License
Created on Fri Dec 23 12:43:40 2016
@author: jon.clucas
"""
import argparse, sub... | apache-2.0 | Python |
87ba660d813be17a51f3f7b0ee8b6b623b383966 | Update build script. | qiuwch/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv | client/scripts/build-plugin.py | client/scripts/build-plugin.py | import os, sys
import ue4config
import ue4util, gitutil, shutil, uploadutil
plugin_version = gitutil.get_short_version('.')
plugin_output_folder = os.path.abspath('./unrealcv-%s' % plugin_version)
def build_plugin():
UAT_script = ue4config.conf['UATScript']
if not os.path.isfile(UAT_script):
print('Ca... | import os, sys
import ue4config
import ue4util, gitutil, shutil
def build_plugin():
UAT_script = conf['UATScript']
if not os.path.isfile(UAT_script):
print('Can not find Automation Script of UE4 %s' % UAT_script)
print('Please set UnrealEnginePath in ue4config.py correctly first')
else:
... | mit | Python |
a0585269f05189fb9ae4f5abe98cd36731ad8a53 | Support for multiple subjects and filtering out non-wos ids | jevinw/rec_utilities,jevinw/rec_utilities | babel_util/scripts/json_to_pajek.py | babel_util/scripts/json_to_pajek.py | #!/usr/bin/env python3
from util.misc import open_file, Benchmark
from util.PajekFactory import PajekFactory
import ujson
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description="Creates Pajek (.net) files from JSON")
parser.add_argument('outfile')
parser.add_argument('... | #!/usr/bin/env python3
from util.misc import open_file, Benchmark
from util.PajekFactory import PajekFactory
import ujson
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description="Creates Pajek (.net) files from JSON")
parser.add_argument('outfile')
parser.add_argument('... | agpl-3.0 | Python |
0709cd2be052006c3700fd3a89855712e8c517bb | Use Agg for matplotlib | aidiary/keras_examples,aidiary/keras_examples | vgg16/dogs_vs_cats/plot_results.py | vgg16/dogs_vs_cats/plot_results.py | import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
result_file1 = os.path.join('results', 'history_smallcnn.txt')
result_file2 = os.path.join('results', 'history_extractor.txt')
result_file3 = os.path.join('results', 'history_finetuning.txt')
def load_results(filename):
epoch_list =... | import os
import matplotlib.pyplot as plt
result_file1 = os.path.join('results', 'history_smallcnn.txt')
result_file2 = os.path.join('results', 'history_extractor.txt')
result_file3 = os.path.join('results', 'history_finetuning.txt')
def load_results(filename):
epoch_list = []
val_loss_list = []
val_acc_l... | mit | Python |
5f001d818459a2bd5e9f6a89e8ed097d379a26d2 | Use importlib.import_module instead of __import__. | pyos/dg | runtime/__init__.py | runtime/__init__.py | import builtins
import operator
import functools
import importlib
from ..compile import varary
builtins.__dict__.update({
# Runtime counterparts of some stuff in `Compiler.builtins`.
'$': lambda f, *xs: f(*xs)
, ':': lambda f, *xs: f(*xs)
, ',': lambda a, *xs: (a,) + xs
, '<': operator.lt
, '<=': o... | import builtins
import operator
import functools
from ..compile import varary
builtins.__dict__.update({
# Runtime counterparts of some stuff in `Compiler.builtins`.
'$': lambda f, *xs: f(*xs)
, ':': lambda f, *xs: f(*xs)
, ',': lambda a, *xs: (a,) + xs
, '<': operator.lt
, '<=': operator.le
, '=... | mit | Python |
595540a6ec47b4aef7ad3a8eda1981f38abc4336 | remove warning in logging. the logger logs to an undefined location at that point | analogbyte/saltobserver,analogbyte/saltobserver,analogbyte/saltobserver | saltobserver/__init__.py | saltobserver/__init__.py | from flask import Flask
app = Flask(__name__)
app.config.from_object('saltobserver.config')
try:
app.config.from_envvar('SALTOBSERVER_SETTINGS')
except RuntimeError:
print "No custom settings found! Point $SALTOBSERVER_SETTINGS to your configuration file."
print "You might want to base them on the defaults... | from flask import Flask
app = Flask(__name__)
app.config.from_object('saltobserver.config')
try:
app.config.from_envvar('SALTOBSERVER_SETTINGS')
except RuntimeError:
app.logger.warning("No custom settings available. Point $SALTOBSERVER_SETTINGS to your configuration file.")
print "No custom settings found!... | mit | Python |
9a0ababb3b8b4b23184ab7005d995c17edef2a2b | Remove saved file in TestImageSaveBlock test case | anton-golubkov/Garland,anton-golubkov/Garland | src/test/test_imagesaveblock.py | src/test/test_imagesaveblock.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
import cv
import os, sys
cmd_folder, f = os.path.split(os.path.dirname(os.path.abspath(__file__)))
if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)
import ipf.ipfblock.imagesave
class TestImageSaveBlock(unittest.TestCase):
def setUp(sel... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
import cv
import os, sys
cmd_folder, f = os.path.split(os.path.dirname(os.path.abspath(__file__)))
if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)
import ipf.ipfblock.imagesave
class TestImageSaveBlock(unittest.TestCase):
def setUp(sel... | lgpl-2.1 | Python |
ddb87c682d4e8605bc97a30f29caacc19a97fca0 | document directions API | 20tab/python-gmaps,swistakm/python-gmaps | src/gmaps/directions.py | src/gmaps/directions.py | # -*- coding: utf-8 -*-
from gmaps.client import Client
class Directions(Client):
DIRECTIONS_URL = 'directions/'
@staticmethod
def latlon_or_address(place):
if isinstance(place, basestring):
output = place
elif isinstance(place, dict):
try:
output =... | # -*- coding: utf-8 -*-
from gmaps.client import Client
class Directions(Client):
DIRECTIONS_URL = 'directions/'
@staticmethod
def latlon_or_address(place):
if isinstance(place, basestring):
output = place
elif isinstance(place, dict):
try:
output =... | bsd-2-clause | Python |
a8da01bedbdd4c666408393ea27ac7144c3eebf0 | update expand to include abstract from top google result | StephanieMak/CS3245PatentSearchEngine,weikengary/CS3245PatentSearchEngine | QueryExpansion.py | QueryExpansion.py | '''
This module expands the given patent query with the terms collected from
the top 10 of Google patent search.
'''
import nltk
import json
import urllib
import urllib2
import HTMLParser
import string
import re
def expand(query, google_result_count = 3):
# Maximum value for google_result_count allowed is only 8
... | '''
This module expands the given patent query with the terms collected from
the top 10 of Google patent search.
'''
import nltk
import json
import urllib
import urllib2
import HTMLParser
import string
import re
def expand(query, google_result_count = 3):
# Maximum value for google_result_count allowed is only 8
... | apache-2.0 | Python |
25476366296aafb6f44ee51c8410eb08a7a965bb | Move import to top | geographika/mappyfile,geographika/mappyfile | mappyfile/__init__.py | mappyfile/__init__.py | import logging
import pkg_resources
import sys
from types import ModuleType
# allow high-level functions to be accessed directly from the mappyfile module
from mappyfile.utils import load, loads, find, findall, dumps, write
__version__ = "0.6.3"
__all__ = ['load', 'loads', 'find', 'findall', 'dumps', 'write']
plugi... | import logging
import pkg_resources
import sys
from types import ModuleType
plugins = ModuleType('mappyfile.plugins')
sys.modules['mappyfile.plugins'] = plugins
for ep in pkg_resources.iter_entry_points(group='mappyfile.plugins'):
setattr(plugins, ep.name, ep.load())
# allow high-level functions to be accessed d... | mit | Python |
b3b0e3351255cd9210facfade4827641055321ad | add init file to diagnostics module | blaze/distributed,dask/distributed,amosonn/distributed,dask/distributed,mrocklin/distributed,amosonn/distributed,mrocklin/distributed,blaze/distributed,amosonn/distributed,broxtronix/distributed,dask/distributed,broxtronix/distributed,broxtronix/distributed,mrocklin/distributed,dask/distributed | distributed/diagnostics/__init__.py | distributed/diagnostics/__init__.py | from ..utils import ignoring
with ignoring(ImportError):
from .progress import progress
with ignoring(ImportError):
from .resource_monitor import ResourceMonitor, Occupancy
| from .progress import progress
| bsd-3-clause | Python |
3d1af8a7fb5b7c3bba52e3d91d4fe93944015277 | add add_permission_to_group and add_user_to_group functions^ | heracek/djangotoolbox,adieu/djangotoolbox | djangotoolbox/contrib/auth/utils.py | djangotoolbox/contrib/auth/utils.py | from django.contrib.auth.models import User, Permission
from djangotoolbox.contrib.auth.models import UserPermissionList, GroupPermissionList, GroupList
def add_permission_to_user(perm, user):
try:
perm_list = UserPermissionList.objects.get(user=user)
except UserPermissionList.DoesNotExist:
per... | from django.contrib.auth.models import User, Permission
from djangotoolbox.contrib.auth.models import UserPermissionList, GroupPermissionList
def add_permission_to_user(user, perm):
try:
perm_list = UserPermissionList.objects.get(user=user)
except UserPermissionList.DoesNotExist:
perm_list = Us... | bsd-3-clause | Python |
052e7d068101a8d634bbd3b701bf97e2a6a05cc0 | Update citation counts for plot. | roystgnr/libmesh,giorgiobornia/libmesh,capitalaslash/libmesh,roystgnr/libmesh,dschwen/libmesh,libMesh/libmesh,capitalaslash/libmesh,benkirk/libmesh,giorgiobornia/libmesh,roystgnr/libmesh,pbauman/libmesh,90jrong/libmesh,balborian/libmesh,jwpeterson/libmesh,libMesh/libmesh,giorgiobornia/libmesh,hrittich/libmesh,capitalas... | doc/statistics/libmesh_citations.py | doc/statistics/libmesh_citations.py | #!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
# Number of "papers using libmesh" by year.
#
# Note 1: this does not count citations "only," the authors must have actually
# used libmesh in part of their work. Therefore, these counts do not include
# things like Wolfgang citing us in his pap... | #!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
# Number of "papers using libmesh" by year.
#
# Note 1: this does not count citations "only," the authors must have actually
# used libmesh in part of their work. Therefore, these counts do not include
# things like Wolfgang citing us in his pap... | lgpl-2.1 | Python |
4f5b0426dc868c016b48433c9a6200c2965f652f | Use os.path.join(...) instead of string formatting | dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,qedsoft... | corehq/apps/style/management/commands/resource_compress.py | corehq/apps/style/management/commands/resource_compress.py | import os
from django.core.management.base import LabelCommand
from django.conf import settings
from dimagi.utils import gitinfo
from django.core import cache
rcache = cache.get_cache('redis')
COMPRESS_PREFIX = '#compress_%s'
CACHE_DIR = os.path.join(settings.STATIC_ROOT, 'CACHE')
MANIFEST_FILE = os.path.join(CACHE_D... | import os
from django.core.management.base import LabelCommand
from django.conf import settings
from dimagi.utils import gitinfo
from django.core import cache
rcache = cache.get_cache('redis')
COMPRESS_PREFIX = '#compress_%s'
CACHE_DIR = '%s/CACHE' % settings.STATIC_ROOT
MANIFEST_FILE = '%s/manifest.json' % CACHE_DIR... | bsd-3-clause | Python |
67a20401caaa63852e95fcaf8bafb6ed85ecd1f2 | Add a sort of hierarchy of modules for package | AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core | test/selenium/src/lib/page/modal/__init__.py | test/selenium/src/lib/page/modal/__init__.py | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from lib.page.modal import (
create_new_object, # flake8: noqa
edit_object, # flake8: noqa
delete_object, # flake8: noqa
update_object # flake8: noqa
)
| # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from lib.page.modal import (
create_new_object, # flake8: noqa
edit_object, # flake8: noqa
delete_object # flake8: noqa
)
| apache-2.0 | Python |
29d895b23e8a4656a82a9a39489c354b67b2b067 | Handle webservice problems in ChEBI client | bgyori/bioagents,sorgerlab/bioagents | bioagents/databases/chebi_client.py | bioagents/databases/chebi_client.py | import suds
import re
import logging
logger = logging.getLogger('suds')
logger.setLevel(logging.ERROR)
chebi_wsdl = 'http://www.ebi.ac.uk/webservices/chebi/2.0/webservice?wsdl'
try:
chebi_client = suds.client.Client(chebi_wsdl)
except Exception as e:
logger.error('ChEBI web service is unavailable.')
chebi... | import suds
import re
import logging
logger = logging.getLogger('suds')
logger.setLevel(logging.ERROR)
chebi_wsdl = 'http://www.ebi.ac.uk/webservices/chebi/2.0/webservice?wsdl'
chebi_client = suds.client.Client(chebi_wsdl)
def get_id(name, max_results=1):
# TODO: reimplement to get result from actual returned ob... | bsd-2-clause | Python |
be0a9da80d46630d8958aa95838c5c7c67dda375 | Fix the list view for podcast files, and allow custom per page number in settings | blancltd/blanc-basic-podcast | blanc_basic_podcast/podcast/views.py | blanc_basic_podcast/podcast/views.py | from django.views.generic import ListView, DateDetailView
from django.utils import timezone
from django.conf import settings
from .models import PodcastFile
class PodcastFileListView(ListView):
paginate_by = getattr(settings, 'PODCAST_PER_PAGE', 10)
def get_queryset(self):
return PodcastFile.objects.... | from django.views.generic import ListView, DateDetailView
from .models import PodcastFile
class PodcastFileListView(ListView):
queryset = PodcastFile.objects.filter(published=True)
class PodcastFileDetailView(DateDetailView):
queryset = PodcastFile.objects.filter(published=True)
month_format = '%m'
... | bsd-2-clause | Python |
b2a230cb4c2a2cb2b0adcef77844b7bd0ff6afeb | Update __init__.py | axel-events/axel | axel/__init__.py | axel/__init__.py | # __init__.py
#
# Copyright (C) 2016 Adrian Cristea adrian dot cristea at gmail dotcom
#
# This module is part of axel and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import inspect
from .axel import *
__all__ = sorted(name for name, obj in locals().items()
... | # __init__.py
#
# Copyright (C) 2010 Adrian Cristea adrian dot cristea at gmail dotcom
#
# This module is part of Axel and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import inspect
from .axel import *
__all__ = sorted(name for name, obj in locals().items()
... | mit | Python |
ca6e9dd170d317cb1e2871f2de111300645be346 | Bump version for fixed build | ucdrascal/hcibench,ucdrascal/axopy | axopy/version.py | axopy/version.py | __version__ = "0.2.2"
| __version__ = "0.2.1"
| mit | Python |
ac49d59d616555af742d4eedf1dbd7b5d6925d4c | remove deprecated services from init | ehdsouza/python-sdk,ehdsouza/python-sdk,ehdsouza/python-sdk | watson_developer_cloud/__init__.py | watson_developer_cloud/__init__.py | # Copyright 2016 IBM All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | # Copyright 2016 IBM All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | apache-2.0 | Python |
c55f74191acb94eea767ee16440eb1dc10b163f2 | Comment edit | opendatapress/open_data_press,opendatapress/open_data_press,opendatapress/open_data_press | controllers/session.py | controllers/session.py | # -*- coding: utf-8 -*-
#
# Session route handlers
#
import logging
from webapp2 import RequestHandler
from helpers import google_api
from oauth2client.client import FlowExchangeError
# Build oAuth2 request and redirect to Google authentication endpoint
class LoginRoute(RequestHandler):
def get(self):
flo... | # -*- coding: utf-8 -*-
#
# Session route handlers
#
import logging
from webapp2 import RequestHandler
from helpers import google_api
from oauth2client.client import FlowExchangeError
class LoginRoute(RequestHandler):
def get(self):
flow = google_api.oauth2_flow()
self.redirect(flow.step1_get_autho... | mit | Python |
88772ffe095afa16834a316e1abdb51b95789b04 | increment version | cggh/scikit-allel | allel/__init__.py | allel/__init__.py | # -*- coding: utf-8 -*-
# flake8: noqa
from allel import model
from allel import stats
from allel import plot
from allel import io
from allel import chunked
from allel import constants
from allel import util
# convenient shortcuts
from allel.model.ndarray import *
from allel.model.chunked import *
# experimental
tr... | # -*- coding: utf-8 -*-
# flake8: noqa
from allel import model
from allel import stats
from allel import plot
from allel import io
from allel import chunked
from allel import constants
from allel import util
# convenient shortcuts
from allel.model.ndarray import *
from allel.model.chunked import *
# experimental
tr... | mit | Python |
b00cf6be030a30fbf5ee02d2e8d055deb8f05c82 | Fix URL for 'intelsinsides' | datagutten/comics,klette/comics,klette/comics,datagutten/comics,jodal/comics,jodal/comics,datagutten/comics,jodal/comics,klette/comics,datagutten/comics,jodal/comics | comics/comics/intelsinsides.py | comics/comics/intelsinsides.py | from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.meta.base import MetaBase
class Meta(MetaBase):
name = "Intel's Insides"
language = 'en'
url = 'http://www.intelsinsides.com/'
start_date = '2009-09-21'
rights = 'Steve Lait'
class Crawler(CrawlerBase):
history_capable... | from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.meta.base import MetaBase
class Meta(MetaBase):
name = "Intel's Insides"
language = 'en'
url = 'http://intelsinsides.com/'
start_date = '2009-09-21'
rights = 'Steve Lait'
class Crawler(CrawlerBase):
history_capable_dat... | agpl-3.0 | Python |
92162a68a881aa0ac729a6005b742e042f9f3ba5 | print command line help if run without parameters | xia2/xia2,xia2/xia2 | command_line/small_molecule.py | command_line/small_molecule.py | from __future__ import absolute_import, division
if __name__ == '__main__':
import sys
if 'small_molecule=true' not in sys.argv and len(sys.argv) > 1:
sys.argv.insert(1, 'small_molecule=true')
# clean up command-line so we know what was happening i.e. xia2.small_molecule
# becomes xia2 small_molecule=true ... | from __future__ import absolute_import, division
if __name__ == '__main__':
import sys
if 'small_molecule=true' not in sys.argv:
sys.argv.insert(1, 'small_molecule=true')
# clean up command-line so we know what was happening i.e. xia2.small_molecule
# becomes xia2 small_molecule=true (and other things) but... | bsd-3-clause | Python |
f76af0fae919ef2aee8f766cc37586dfef87138b | add time stamp and command to rms_exec log | hdm-dt-fb/rvt_model_services,hdm-dt-fb/rvt_model_services | commands/rps_audit/__init__.py | commands/rps_audit/__init__.py | import datetime
import rjm
from pathlib import Path
def cmd_journal(project_code, model_path, jrn_path, com_dir, log_dir):
command_path = Path(__file__).parent
command_name = command_path.name
time_stamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
rvt_jrn = rjm.JournalMaker()
com_data = {
... | import rjm
import os.path as op
def cmd_journal(project_code, model_path, jrn_path, com_dir, log_dir):
op.basename(op.dirname(__file__))
coo_qc_dir = op.join(com_dir, op.basename(op.dirname(__file__)))
rvt_jrn = rjm.JournalMaker()
com_data = {"SearchPaths": coo_qc_dir,
"ModelName": op.... | mit | Python |
51c80af2fa439cc3df1d7580b1d5f1fa0575f3bd | Fix tests of wifi80211 to take in account the full results | veeresht/CommPy | commpy/tests/test_wifi80211.py | commpy/tests/test_wifi80211.py | # Authors: CommPy contributors
# License: BSD 3-Clause
from __future__ import division # Python 2 compatibility
from numpy import arange, log10
from numpy.random import seed
from numpy.testing import run_module_suite, dec, assert_allclose
from commpy.channels import MIMOFlatChannel, SISOFlatChannel
from commpy.modu... | # Authors: CommPy contributors
# License: BSD 3-Clause
from __future__ import division # Python 2 compatibility
from numpy import arange, log10
from numpy.random import seed
from numpy.testing import run_module_suite, dec, assert_allclose
from commpy.channels import MIMOFlatChannel, SISOFlatChannel
from commpy.modu... | bsd-3-clause | Python |
0c84bd7e2396bfbac67d9b9e1479c1c6a00b1d7c | 修改urls.py中匹配的方式。 | wmh-demos/django-first-demo,wmh-demos/django-first-demo | first_django/urls.py | first_django/urls.py | """first_django URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | """first_django URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | apache-2.0 | Python |
9334e8059cd74086278133345566c4b4591c81a4 | Add DB connection to amgut init module | biocore/american-gut-web,ElDeveloper/american-gut-web,PersonalGenomesOrg/american-gut-web,josenavas/american-gut-web,josenavas/american-gut-web,wasade/american-gut-web,mortonjt/american-gut-web,adamrp/american-gut-web,biocore/american-gut-web,adamrp/american-gut-web,mortonjt/american-gut-web,mortonjt/american-gut-web,s... | amgut/__init__.py | amgut/__init__.py | #!/usr/bin/env python
from __future__ import division
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The American Gut Project Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed ... | #!/usr/bin/env python
from __future__ import division
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The American Gut Project Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed ... | bsd-3-clause | Python |
e28a218be25689ab5464e13b62673a287bd85365 | fix Autoclass -> autoclass | TangibleDisplay/twiz | androidhelpers.py | androidhelpers.py | from jnius import PythonJavaClass, java_method, autoclass
# SERVICE = Autoclass('org.renpy.PythonService').mService
SERVICE = autoclass('org.renpy.PythonActivity').mActivity
Intent = autoclass('android.content.Intent')
BluetoothManager = SERVICE.getSystemService(SERVICE.BLUETOOTH_SERVICE)
ADAPTER = BluetoothManager... | from jnius import PythonJavaClass, java_method, Autoclass
# SERVICE = Autoclass('org.renpy.PythonService').mService
SERVICE = Autoclass('org.renpy.PythonActivity').mActivity
Intent = Autoclass('android.content.Intent')
BluetoothManager = SERVICE.getSystemService(SERVICE.BLUETOOTH_SERVICE)
ADAPTER = BluetoothManager... | mit | Python |
7e52e8b51166ab4b5189f0494e3acd2aef26ee5b | update docs | chainer/chainercv,yuyu2172/chainercv,pfnet/chainercv,yuyu2172/chainercv,chainer/chainercv | chainercv/transforms/image/resize.py | chainercv/transforms/image/resize.py | import warnings
try:
import cv2
def _resize(img, size):
return cv2.resize(img, dsize=size)
except ImportError:
import numpy
import PIL
warnings.warn(
'cv2 is not installed on your environment. '
'ChainerCV will fallback on Pillow. ',
RuntimeWarning)
def _resi... | import warnings
try:
import cv2
def _resize(img, size):
return cv2.resize(img, dsize=size)
except ImportError:
import numpy
import PIL
warnings.warn(
'cv2 is not installed on your environment. '
'ChainerCV will fallback on Pillow. ',
RuntimeWarning)
def _resi... | mit | Python |
7751d953409232b264826dd570b57b81a02f69fd | make BaseRenderer available at mistletoe.BaseRenderer | miyuchina/mistletoe,miyuchina/mistletoe | mistletoe/__init__.py | mistletoe/__init__.py | """
Make mistletoe easier to import.
"""
__version__ = "0.5.5"
__all__ = ['html_renderer', 'ast_renderer', 'block_token', 'block_tokenizer',
'span_token', 'span_tokenizer']
from mistletoe.block_token import Document
from mistletoe.base_renderer import BaseRenderer
from mistletoe.html_renderer import HTMLRe... | """
Make mistletoe easier to import.
"""
__version__ = "0.5.5"
__all__ = ['html_renderer', 'ast_renderer', 'block_token', 'block_tokenizer',
'span_token', 'span_tokenizer']
from mistletoe.block_token import Document
from mistletoe.html_renderer import HTMLRenderer
def markdown(iterable, renderer=HTMLRende... | mit | Python |
7295871f2f6b4b579004330b7ea147184003657c | Add Fem(%) column | vivekiitkgp/WIGI-website,hargup/WIGI-website | plots/gender_by_culture.py | plots/gender_by_culture.py | from __future__ import print_function
import pandas as pd
from bokeh._legacy_charts import Bar
from bokeh.models import NumeralTickFormatter
from numpy import round
from .utils import write_plot, read_data
@write_plot('culture')
def plot(newest_changes):
df, date_range = read_data(newest_changes, 'culture')
... | from __future__ import print_function
import pandas as pd
from bokeh._legacy_charts import Bar
from bokeh.models import NumeralTickFormatter
from .utils import write_plot, read_data
@write_plot('culture')
def plot(newest_changes):
df, date_range = read_data(newest_changes, 'culture')
# remove nan genders a... | mit | Python |
10aca9f5788fb61c3d22e7840d04200c8f44f6ec | support South for custom fields | coagulant/django-model-utils,emilkjer/django-model-utils | model_utils/fields.py | model_utils/fields.py | from datetime import datetime
from django.db import models
class AutoCreatedField (models.DateTimeField):
"""
A DateTimeField that automatically populates itself at
object creation.
By default, sets editable=False, default=datetime.now.
"""
def __init__ (self, *args, **kwargs):
kwarg... | from datetime import datetime
from django.db import models
class AutoCreatedField (models.DateTimeField):
"""
A DateTimeField that automatically populates itself at
object creation.
By default, sets editable=False, default=datetime.now.
"""
def __init__ (self, *args, **kwargs):
kwarg... | bsd-3-clause | Python |
d28e884d832b63bef1434476a378de9b7e333264 | Add a main function with command line arguments | parrisha/raspi-visualizer | samples/WavGenerator.py | samples/WavGenerator.py | #############
# ECE 612 Spring 2017
# Joe Parrish
#
# Use the same logic from SpectrumTester.py to generate multiple sine waves
# but write that output to a .wav file for file based testing of the project code
#############
import wave
import argparse
import numpy as np
def generate_sample_file(test_freqs, test_amps... | #############
# ECE 612 Spring 2017
# Joe Parrish
#
# Use the same logic from SpectrumTester.py to generate multiple sine waves
# but write that output to a .wav file for file based testing of the project code
#############
import wave
import numpy as np
def generate_sample_file(test_freqs, test_amps, chunk=4096, sa... | mit | Python |
7a704540e9b712278b99e7beee53ff6d829b35e6 | Bump to version 0.3.1 with lxml dependency change. | elifesciences/elife-tools,elifesciences/elife-tools | elifetools/__init__.py | elifetools/__init__.py |
__version__ = '0.3.1'
|
__version__ = '0.3.0'
| mit | Python |
3d2d15fe505e625c9341a826e8462809c61b4281 | Fix the imports. | irap-omp/deconv3d,irap-omp/deconv3d | __init__.py | __init__.py | # Read the version number from the VERSION file
from os.path import abspath, dirname, join
with open(join(dirname(abspath(__file__)), 'VERSION'), 'r') as version_file:
__version__ = version_file.read().strip()
# Import internal files here so that user may skip the `lib`, eg. :
# from deconv3d import Instrument... | # Read the version number from the VERSION file
from os.path import abspath, dirname, join
with open(join(dirname(abspath(__file__)), 'VERSION'), 'r') as version_file:
__version__ = version_file.read().strip()
# Import internal files here so that user may skip the `lib`, eg. :
# from deconv3d import Instrument... | mit | Python |
51dcac6ceec1a0d45c76ef31baf888c4924ff28d | Document this too | typepad/python-typepad-api | __init__.py | __init__.py | from typepad.dataobject import DataObject
from typepad import fields
from typepad.remote import RemoteObject
from typepad.asset import *
import httplib2
from oauth import oauth
class OAuthConsumer(oauth.OAuthConsumer):
# refuse to be used as a username for another auth scheme
def __str__(self):
return... | from typepad.dataobject import DataObject
from typepad import fields
from typepad.remote import RemoteObject
from typepad.asset import *
import httplib2
from oauth import oauth
class OAuthConsumer(oauth.OAuthConsumer):
# refuse to be used as a username for another auth scheme
def __str__(self):
return... | bsd-3-clause | Python |
9c925df0618a7ae0eccfea65da04faab89b32fc7 | Bump to 3.3.5 final. | pypa/setuptools,pypa/setuptools,pypa/setuptools | __init__.py | __init__.py | """distutils
The main package for the Python Module Distribution Utilities. Normally
used from a setup script as
from distutils.core import setup
setup (...)
"""
# Distutils version
#
# Updated automatically by the Python release process.
#
#--start constants--
__version__ = "3.3.5"
#--end constants--
| """distutils
The main package for the Python Module Distribution Utilities. Normally
used from a setup script as
from distutils.core import setup
setup (...)
"""
# Distutils version
#
# Updated automatically by the Python release process.
#
#--start constants--
__version__ = "3.3.5rc2"
#--end constants--
| mit | Python |
7529d7454696be4eacdbd13fa9682d0fb6f703f8 | Implement header parsing for bsdiff data | jleclanche/python-ptch | __init__.py | __init__.py | # -*- coding: utf-8 -*-
"""
PTCH files are a container format for Blizzard patch files.
They begin with a 72 byte header containing some metadata, immediately
followed by a RLE-packed BSDIFF40.
The original BSDIFF40 format is compressed with bzip2 instead of RLE.
"""
#from hashlib import md5
from struct import unpack
... | # -*- coding: utf-8 -*-
"""
PTCH files are a container format for Blizzard patch files.
They begin with a 72 byte header containing some metadata, immediately
followed by a RLE-packed BSDIFF40.
The original BSDIFF40 format is compressed with bzip2 instead of RLE.
"""
#from hashlib import md5
from struct import unpack
... | mit | Python |
ce29975afbfa4c3157759857df120a2c4c152cae | fix document links in local version | codeforamerica/rva-screening,codeforamerica/rva-screening,codeforamerica/rva-screening | app/utils.py | app/utils.py | # -*- coding: utf-8 -*-
import boto.s3, os
from app.models import DocumentImage
from boto.s3.connection import S3Connection
from werkzeug import secure_filename
from flask import current_app, send_file, send_from_directory, redirect
def send_document_image(file_name):
if current_app.config['SCREENER_ENVIRONMENT']... | # -*- coding: utf-8 -*-
import boto.s3, os
from app.models import DocumentImage
from boto.s3.connection import S3Connection
from werkzeug import secure_filename
from flask import current_app, send_file, send_from_directory, redirect
def send_document_image(file_name):
if current_app.config['SCREENER_ENVIRONMENT']... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.