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 |
|---|---|---|---|---|---|---|---|---|
2fdb9d17b2c033370d663b4e72d71c1c7e105a84 | fix test for python 3 | zhihu/redis-shard,keakon/redis-shard | tests/test_pipeline.py | tests/test_pipeline.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
from nose.tools import eq_
from redis_shard.shard import RedisShardAPI
from redis_shard._compat import b
from .config import settings
class TestShard(unittest.TestCase):
def setUp(self):
self.client = RedisShardAPI(**settings)
self.clear_d... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
from nose.tools import eq_
from redis_shard.shard import RedisShardAPI
from redis_shard._compat import b
from .config import settings
class TestShard(unittest.TestCase):
def setUp(self):
self.client = RedisShardAPI(**settings)
self.clear_d... | bsd-2-clause | Python |
ab4c02c1f5f5cf3ba46b4924c48693d028dc23db | Split pipeline tests | valohai/valohai-yaml | tests/test_pipeline.py | tests/test_pipeline.py | from valohai_yaml.objs import Config, DeploymentNode
def test_pipeline_valid(pipeline_config: Config):
assert pipeline_config.lint().is_valid()
def test_little_pipeline(pipeline_config: Config):
assert any(
(
edge.source_node == "batch1"
and edge.source_type == "parameter"
... | from valohai_yaml.objs import Config, DeploymentNode
def test_pipeline(pipeline_config: Config):
lr = pipeline_config.lint()
assert lr.is_valid()
assert any(
(
edge.source_node == "batch1"
and edge.source_type == "parameter"
and edge.source_key == "aspect-ratio"... | mit | Python |
9e57e467ab508cd0e5fab2862a2c9b651eaa7838 | rename tag basisofRecords to BASISOFRECORDS | Datafable/gbif-dataset-metrics,Datafable/gbif-dataset-metrics,Datafable/gbif-dataset-metrics | bin/aggregate_metrics.py | bin/aggregate_metrics.py | import sys
import os
import json
SRC_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + '/src'
sys.path.append(SRC_DIR)
from aggregator import ReportAggregator, CartoDBWriter
def check_arguments():
if len(sys.argv) != 3:
print 'usage: aggregate_metrics.py <data directory> <settings.json>\... | import sys
import os
import json
SRC_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + '/src'
sys.path.append(SRC_DIR)
from aggregator import ReportAggregator, CartoDBWriter
def check_arguments():
if len(sys.argv) != 3:
print 'usage: aggregate_metrics.py <data directory> <settings.json>\... | mit | Python |
77c0ad615c7f0270c0425866f06edde8856892b9 | Add Augur Unit Tests For parseIntelXML() | magneticstain/Inquisition,magneticstain/Inquisition,magneticstain/Inquisition,magneticstain/Inquisition | build/tests/test_augur.py | build/tests/test_augur.py | #!/usr/bin/python3
"""
test_augur.py
APP: Inquisition
DESC: Unit test for Augur library
CREATION_DATE: 2017-11-25
"""
# MODULES
# | Native
import configparser
import unittest
# | Third-Party
from bs4 import BeautifulSoup as BSoup
# | Custom
from lib.destiny.Augur import Augur
# METADATA
__author__ = 'Joshua Carl... | #!/usr/bin/python3
"""
test_augur.py
APP: Inquisition
DESC: Unit test for Augur library
CREATION_DATE: 2017-11-25
"""
# MODULES
# | Native
import configparser
import unittest
# | Third-Party
from bs4 import BeautifulSoup as BSoup
# | Custom
from lib.destiny.Augur import Augur
# METADATA
__author__ = 'Joshua Carl... | mit | Python |
b6572ec32295365862947845a8c916eae428700f | Clean up temporary files on 'nt'. | stpettersens/makemodule,stpettersens/makemodule | makemodule.py | makemodule.py | #!/bin/env python
"""
makemodule
Module generation tool
Copyright (c) 2015 Sam Saint-Pettersen.
Released under the MIT/X11 License.
"""
import sys
import os
import xml.dom.minidom as xml
class makemodule:
def __init__(self, args):
if len(args) == 1:
self.displayUsage()
else:
... | #!/bin/env python
"""
makemodule
Module generation tool
Copyright (c) 2015 Sam Saint-Pettersen.
Released under the MIT/X11 License.
"""
import sys
import os
import xml.dom.minidom as xml
class makemodule:
def __init__(self, args):
if len(args) == 1:
self.displayUsage()
else:
... | mit | Python |
9aae92fb0e22c97f559b6e3ee895d9959e010e05 | Add missing import | cleverhans-lab/cleverhans,carlini/cleverhans,openai/cleverhans,cihangxie/cleverhans,carlini/cleverhans,fartashf/cleverhans,cleverhans-lab/cleverhans,cleverhans-lab/cleverhans | tests_tf/test_model.py | tests_tf/test_model.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
from cleverhans.model import Model, CallableModelWrapper
class TestModelClass(unittest.TestCase):
def test_get_layer(self):
# Define empty ... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
from cleverhans.model import Model
class TestModelClass(unittest.TestCase):
def test_get_layer(self):
# Define empty model
model = ... | mit | Python |
4646e7c682ba9a0291815a5d0de98674a9de3410 | Fix RemoteCapture definition | Adamshick012/pyshark,eaufavor/pyshark-ssl,KimiNewt/pyshark | src/pyshark/capture/remote_capture.py | src/pyshark/capture/remote_capture.py | from pyshark import LiveCapture
class RemoteCapture(LiveCapture):
"""
A capture which is performed on a remote machine which has an rpcapd service running.
"""
def __init__(self, remote_host, remote_interface, remote_port=2002, bpf_filter=None):
"""
Creates a new remote capture which ... | from pyshark import LiveCapture
class RemoteCapture(LiveCapture):
"""
A capture which is performed on a remote machine which has an rpcapd service running.
"""
def __init__(self, remote_host, remote_interface, remote_port=2002, bpf_filter=None):
"""
Creates a new remote capture which ... | mit | Python |
1a9f0320b3a8aecc50cfee6335c3b6e8dc81c233 | Make this tool less hacky. | HIPERFIT/futhark,diku-dk/futhark,diku-dk/futhark,diku-dk/futhark,HIPERFIT/futhark,diku-dk/futhark,diku-dk/futhark,HIPERFIT/futhark | tools/commit-impact.py | tools/commit-impact.py | #!/usr/bin/env python
#
# See the impact of a Futhark commit compared to the previous one we
# have benchmarking for.
import sys
import subprocess
from urllib.request import urlopen
from urllib.error import HTTPError
import json
import tempfile
import os
def url_for(backend, system, commit):
return 'https://futha... | #!/usr/bin/env python
#
# See the impact of a Futhark commit compared to the previous one we
# have benchmarking for.
import sys
import subprocess
from urllib.request import urlopen
from urllib.error import HTTPError
import json
def url_for(backend, system, commit):
return 'https://futhark-lang.org/benchmark-resu... | isc | Python |
0fa1e147fc7d2522a4352c0bbc60e4da67380257 | add a missing statement | amandersillinois/landlab,cmshobe/landlab,landlab/landlab,amandersillinois/landlab,cmshobe/landlab,cmshobe/landlab,landlab/landlab,landlab/landlab | landlab/utils/tests/test_stream_length.py | landlab/utils/tests/test_stream_length.py | from landlab import RasterModelGrid, FieldError
from landlab.components import FlowAccumulator, FastscapeEroder, FlowDirectorSteepest
import numpy as np
from landlab.utils.stream_length import calculate_stream_length
from nose.tools import assert_equal, assert_true, assert_false, assert_raises
def test_no_flow_reciev... | from landlab import RasterModelGrid, FieldError
from landlab.components import FlowAccumulator, FastscapeEroder, FlowDirectorSteepest
import numpy as np
from landlab.utils.stream_length import calculate_stream_length
from nose.tools import assert_equal, assert_true, assert_false, assert_raises
def test_no_flow_reciev... | mit | Python |
85ee5f5e6d7a5937b67c9d11ae127709749f7490 | Bump to version 0.4.1 | rfleschenberg/djangocms-cascade,Julien-Blanc/djangocms-cascade,Julien-Blanc/djangocms-cascade,aldryn/djangocms-cascade,aldryn/djangocms-cascade,datafyit/djangocms-cascade,zhangguiyu/djangocms-cascade,jrief/djangocms-cascade,datafyit/djangocms-cascade,jrief/djangocms-cascade,schacki/djangocms-cascade,aldryn/djangocms-ca... | cmsplugin_cascade/__init__.py | cmsplugin_cascade/__init__.py | __version__ = "0.4.1"
| __version__ = "0.4.0"
| mit | Python |
59b8ae5f17e556c09ef8592723f9c684843c7dcc | update function and comment | berkeley-stat159/project-theta | code/utils/outlierfunction.py | code/utils/outlierfunction.py |
# find outliers based on DVARS and FD
def outlier(data, bound):
'''
Input:
data: array of values
bound: threshold for outliers
Output:
indices of outliers
'''
outlier = []
# set nonoutlier values to 0, outliers to nonzero
for i in data:
if i <= bound:
... |
# find outliers based on DVARS and FD
def outlier(data, bound):
'''
Input:
data: array of values
bound: threshold for outliers
Output:
indices of outliers
'''
outlier = []
# set outlier values to 0
for i in data:
if i <= bound:
outlier.appen... | bsd-3-clause | Python |
270c8ca68357f92999474fbf110fed7b01cdfdf2 | Use proper way to access package resources. | bbirand/python-driver,mike-tr-adamson/python-driver,HackerEarth/cassandra-python-driver,vipjml/python-driver,coldeasy/python-driver,jregovic/python-driver,jregovic/python-driver,datastax/python-driver,thobbs/python-driver,stef1927/python-driver,markflorisson/python-driver,coldeasy/python-driver,bbirand/python-driver,jf... | cqlengine/__init__.py | cqlengine/__init__.py | import os
import pkg_resources
from cqlengine.columns import *
from cqlengine.functions import *
from cqlengine.models import Model
from cqlengine.query import BatchQuery
__cqlengine_version_path__ = pkg_resources.resource_filename('cqlengine',
'VERSION')
... | import os
from cqlengine.columns import *
from cqlengine.functions import *
from cqlengine.models import Model
from cqlengine.query import BatchQuery
__cqlengine_version_path__ = os.path.realpath(__file__ + '/../VERSION')
__version__ = open(__cqlengine_version_path__, 'r').readline().strip()
# compaction
SizeTieredC... | apache-2.0 | Python |
5584ec8c6aa8e6567b3ddd286c1c7305fad070a3 | fix init | peerchemist/cryptotik | cryptotik/__init__.py | cryptotik/__init__.py |
from cryptotik.poloniex import Poloniex
from cryptotik.bittrex import Bittrex
from cryptotik.btce import Btce
from cryptotik.therock import TheRock
from cryptotik.livecoin import Livecoin
from cryptotik.okcoin import OKcoin
from cryptotik.hitbtc import Hitbtc
|
from cryptotik.poloniex import Poloniex
from cryptotik.bittrex import Bittrex
from cryptotik.btce import Btce
from cryptotik.therock import TheRock
from cryptotik.livecoin import Livecoin
<<<<<<< HEAD
from cryptotik.okcoin import OKcoin
=======
from cryptotik.hitbtc import Hitbtc
>>>>>>> 7e948ea7ab42a9ad57d9ec12595399... | bsd-3-clause | Python |
35cc2bce4e5fb62083ec1a44bda85c2da064d119 | Remove debug print statements | StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit | cs251tk/specs/load.py | cs251tk/specs/load.py | from logging import warning
from glob import iglob
import json
import os
import shutil
from .cache import cache_specs
from .dirs import get_specs_dir
def load_all_specs(*, basedir=get_specs_dir()):
os.makedirs(basedir, exist_ok=True)
# the repo has a /specs folder
basedir = os.path.join(basedir, 'specs'... | from logging import warning
from glob import iglob
import json
import os
import shutil
import sys
from .cache import cache_specs
from .dirs import get_specs_dir
def load_all_specs(*, basedir=get_specs_dir()):
os.makedirs(basedir, exist_ok=True)
# the repo has a /specs folder
basedir = os.path.join(based... | mit | Python |
096d3c44a60c83820410a85cd6a56f20b13b9ccd | 更新 API Infor, 使用新格式改寫 users_total_count API 的回應 | yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo | commonrepo/infor_api/views.py | commonrepo/infor_api/views.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from rest_framework import permissions
from rest_framework import renderers
from rest_framework import status
from rest_framework import viewsets
f... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from rest_framework import permissions
from rest_framework import renderers
from rest_framework import status
from rest_framework import viewsets
f... | apache-2.0 | Python |
6a5729d566a6e75c97b67a544dd7aed9c857e6de | update attachment attributes | leVirve/NTHU_Course,henryyang42/NTHU_Course,henryyang42/NTHU_Course,leVirve/NTHU_Course,leVirve/NTHU_Course,leVirve/NTHU_Course,henryyang42/NTHU_Course,henryyang42/NTHU_Course | data_center/models.py | data_center/models.py | # -*- coding: utf-8 -*-
from datetime import datetime
from django.db import models
from django.utils.http import urlquote
attachment_url_format = 'https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE/JH/output/6_6.1_6.1.12/%s.pdf' # noqa
class Course(models.Model):
"""Course database schema"""
no = models.CharField(m... | # -*- coding: utf-8 -*-
from datetime import datetime
from django.db import models
class Course(models.Model):
"""Course database schema"""
no = models.CharField(max_length=20, blank=True)
code = models.CharField(max_length=20, blank=True)
eng_title = models.CharField(max_length=200, blank=True)
... | mit | Python |
00dec661c39437e2fd031328431ab59ca428aaf3 | Fix deprecation warning regarding BaseException.message | ozgur/python-linkedin,alisterion/python-linkedin,marshallhumble/python-linkedin,DEKHTIARJonathan/python3-linkedin,narrowcast/python-linkedin,ViralLeadership/python-linkedin,stephanieleevillanueva/python-linkedin,bpartridge/python-linkedin,fivejjs/python-linkedin,Reachpodofficial/python-linkedin | linkedin/utils.py | linkedin/utils.py | # -*- coding: utf-8 -*-
import requests
from .exceptions import LinkedInError, get_exception_for_error_code
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
try:
import simplejson as json
except ImportError:
try:
from django.utils import simplejson as json
... | # -*- coding: utf-8 -*-
import requests
from .exceptions import LinkedInError, get_exception_for_error_code
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
try:
import simplejson as json
except ImportError:
try:
from django.utils import simplejson as json
... | mit | Python |
36e8335bc146e4eda6801b2c148410c3ea620ae5 | Update scipy.py | vadimkantorov/wigwam | wigs/scipy.py | wigs/scipy.py | class scipy(PythonWig):
tarball_uri = 'https://github.com/scipy/scipy/releases/download/v$RELEASE_VERSION$/scipy-$RELEASE_VERSION$.tar.gz'
last_release_version = 'v0.18.1'
git_uri = 'https://github.com/scipy/scipy'
dependencies = ['numpy']
optional_dependencies = ['openblas']
supported_features = ['openblas']
d... | class scipy(PythonWig):
tarball_uri = 'https://github.com/scipy/scipy/releases/download/v$RELEASE_VERSION$/scipy-$RELEASE_VERSION$.tar.gz'
last_release_version = 'v0.18.1'
git_uri = 'https://github.com/scipy/scipy'
dependencies = ['numpy']
| mit | Python |
374c386a6b2dd1ad1ba75ba70009de6c7ee3c3fc | Add process_request method to Application | phantomii/restalchemy | restalchemy/api/applications.py | restalchemy/api/applications.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2014 Eugene Frolov <eugene@frolov.net.ru>
#
# 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
#
# ... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2014 Eugene Frolov <eugene@frolov.net.ru>
#
# 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
#
# ... | apache-2.0 | Python |
b7e8af6ef92c0244bd5121c528e3e85441b0d835 | Disable test/mac/gyptest-objc-gc.py when using Xcode 5.1 | geekboxzone/lollipop_external_chromium_org_tools_gyp,pandaxcl/gyp,android-ia/platform_external_chromium_org_tools_gyp,azunite/gyp,bulldy80/gyp_unofficial,mapbox/gyp,amoikevin/gyp,bnq4ever/gypgoogle,LazyCodingCat/gyp,Danath/gyp,carlTLR/gyp,openpeer/webrtc-gyp,erikge/watch_gyp,dougbeal/gyp,Omegaphora/external_chromium_or... | test/mac/gyptest-objc-gc.py | test/mac/gyptest-objc-gc.py | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies that GC objc settings are handled correctly.
"""
import TestGyp
import TestMac
import sys
if sys.platform == 'darwin':
# s... | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies that GC objc settings are handled correctly.
"""
import TestGyp
import sys
if sys.platform == 'darwin':
# set |match| to i... | bsd-3-clause | Python |
da557b0b26d144095988a8809a97b83791077f20 | fix number | ErickMurillo/plataforma_fadcanic,CARocha/plataforma_fadcanic,ErickMurillo/plataforma_fadcanic,CARocha/plataforma_fadcanic,CARocha/plataforma_fadcanic,ErickMurillo/plataforma_fadcanic | biblioteca/views.py | biblioteca/views.py | from django.shortcuts import render
from .models import Temas, Biblioteca
from django.shortcuts import get_object_or_404
from django.db.models import Q
# Create your views here.
def index(request,template='biblioteca/index.html',slug=None):
temas = Temas.objects.all()
ultimas_guias = Biblioteca.objects.filter(tipo_d... | from django.shortcuts import render
from .models import Temas, Biblioteca
from django.shortcuts import get_object_or_404
from django.db.models import Q
# Create your views here.
def index(request,template='biblioteca/index.html',slug=None):
temas = Temas.objects.all()
ultimas_guias = Biblioteca.objects.filter(tipo_d... | mit | Python |
1412c1a15f4b8b09beb4b7eb4b3245eaeb343a14 | Bump sleep time for Github API reader | ndm25/notifyable | src/api_readers/github_daemon.py | src/api_readers/github_daemon.py | from api_reader_daemon import APIReaderDaemon
import datetime
import time
from models import GithubRepo
from models import GithubRepoEvent
from github import Github
class GithubReaderDaemon(APIReaderDaemon):
def __init__(self, **kwargs):
# neh. don't need it.
pass
def start(self):
whi... | from api_reader_daemon import APIReaderDaemon
import datetime
import time
from models import GithubRepo
from models import GithubRepoEvent
from github import Github
class GithubReaderDaemon(APIReaderDaemon):
def __init__(self, **kwargs):
# neh. don't need it.
pass
def start(self):
whi... | mit | Python |
d01430e40d923fdced0d753822a1f62fe69a916e | add analytics folder to path | datactive/bigbang,datactive/bigbang,datactive/bigbang | bigbang/__init__.py | bigbang/__init__.py | from . import analysis
| mit | Python | |
17147f02abdb50f6df6398c8c3c750d858c1c758 | fix docs | n0ano/gantt,n0ano/gantt | doc/ext/nova_autodoc.py | doc/ext/nova_autodoc.py | import gettext
import os
gettext.install('nova')
from nova import utils
def setup(app):
rootdir = os.path.abspath(app.srcdir + '/..')
print "**Autodocumenting from %s" % rootdir
os.chdir(rootdir)
rv = utils.execute('./generate_autodoc_index.sh')
print rv[0]
| import gettext
import os
gettext.install('nova')
from nova import utils
def setup(app):
rootdir = os.path.abspath(app.srcdir + '/..')
print "**Autodocumenting from %s" % rootdir
rv = utils.execute('cd %s && ./generate_autodoc_index.sh' % rootdir)
print rv[0]
| apache-2.0 | Python |
dabbf0b5796a4d16bdd588e9d8c541c1f3c8559b | Support for building multiple images at once | johscheuer/portainer,duedil-ltd/portainer,duedil-ltd/portainer,johscheuer/portainer | src/ddocker/app/build.py | src/ddocker/app/build.py | """
"""
import logging
import pesos.scheduler
import os
import threading
import time
from pesos.vendor.mesos import mesos_pb2
from ddocker.app import subcommand
from ddocker.app.scheduler import Scheduler
from Queue import Queue
logger = logging.getLogger("ddocker.build")
def args(parser):
parser.add_argument(... | """
"""
import logging
import pesos.scheduler
import os
import threading
import time
from pesos.vendor.mesos import mesos_pb2
from ddocker.app import subcommand
from ddocker.app.scheduler import Scheduler
from Queue import Queue
logger = logging.getLogger("ddocker.build")
def args(parser):
parser.add_argument(... | mit | Python |
4fe36d96d3810b39fcd15dee87318763d0d277a9 | remove time | adrn/gala,adrn/gala,adrn/gary,adrn/gala,adrn/gary,adrn/gary | streamteam/io/nbody6.py | streamteam/io/nbody6.py | # coding: utf-8
""" Class for reading data from NBODY6 simulations """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
import logging
import re
# Third-party
import numpy as np
import astropy.units as u
from astropy.constants import G
... | # coding: utf-8
""" Class for reading data from NBODY6 simulations """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
import logging
import re
# Third-party
import numpy as np
import astropy.units as u
from astropy.constants import G
... | mit | Python |
73fbfd435c849c0690121b0a3fc8545057247c8a | Fix command options issues | int32bit/mistral-actions,int32bit/mistral-actions | mistral_actions/client/shell.py | mistral_actions/client/shell.py | import sys
from mistral_actions.client import actions as actions_cli
import mistral_actions.utils as utils
def do_clear(args):
"""Unregister all actions from Mistral."""
actions_cli.unregister_all()
print("All actions are removed from Mistral successfully.")
@utils.arg(
'--override',
dest='over... | import sys
from mistral_actions.client import actions as actions_cli
import mistral_actions.utils as utils
def do_clear(args):
"""Unregister all actions from Mistral."""
actions_cli.unregister_all()
print("All actions are removed from Mistral successfully.")
@utils.arg(
'--override',
dest='over... | mit | Python |
f846f58891e1389941f008e3f53c95ffd1b6558d | Update to add email functionality based on threshold checking. | pault2k14/dbtracker | dbtracker/__init__.py | dbtracker/__init__.py | import logging
from dbtracker.cli import Cli
import argparse
def main(argv=None):
parser = argparse.ArgumentParser(
description="Queries MySQL and PostgreSQL for stats")
parser.add_argument(
"-S", "--save",
action="store_true",
help="generate and save database stats")
parse... | import logging
from dbtracker.cli import Cli
import argparse
def main(argv=None):
parser = argparse.ArgumentParser(
description="Queries MySQL and PostgreSQL for stats")
parser.add_argument(
"-S", "--save",
action="store_true",
help="generate and save database stats")
parse... | mit | Python |
838d8c8952f63464dfafaaeba3b16b681317c15e | add plot | nschloe/matplotlib2tikz | tests/test_annotate.py | tests/test_annotate.py | import matplotlib.pyplot as plt
import numpy as np
def plot():
fig = plt.figure(1, figsize=(8, 5))
ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-4, 3))
t = np.arange(0.0, 5.0, 0.2)
s = np.cos(2 * np.pi * t)
ax.plot(t, s, color="blue")
ax.annotate(
"text",
x... | import matplotlib.pyplot as plt
import numpy as np
def plot():
fig = plt.figure(1, figsize=(8, 5))
ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-4, 3))
t = np.arange(0.0, 5.0, 0.2)
s = np.cos(2 * np.pi * t)
ax.plot(t, s, color="blue")
ax.annotate(
"text",
x... | mit | Python |
8e10a62052f252c21c3898f70fc10d23c7261af0 | Update urls.py | TarunISCO/Dnet,TarunISCO/Dnet,TarunISCO/Dnet | submify/submify/urls.py | submify/submify/urls.py | """submify URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples::
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | """submify URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | mit | Python |
cfb68d7e1146241b9783d82d09f7f813e658d4aa | fix doctests | KenKundert/quantiphy,KenKundert/quantiphy | tests/test_doctests.py | tests/test_doctests.py | # encoding: utf8
from quantiphy import Quantity
import pytest
import doctest
import glob
import sys
def test_README():
if sys.version_info < (3, 6):
# code used in doctests assumes python3.6
return
Quantity.reset_prefs()
rv = doctest.testfile('../README.rst', optionflags=doctest.ELLIPSIS)... | # encoding: utf8
from quantiphy import Quantity
import pytest
import doctest
import glob
import sys
def test_README():
if sys.version_info < (3, 6):
# code used in doctests assumes python3.6
return
Quantity.reset_prefs()
rv = doctest.testfile('../README.rst', optionflags=doctest.ELLIPSIS)... | mit | Python |
72f7162b2a307297798dbeb866d54de5acfdeffb | correct input dimension comment | ksu-mechatronics-research/deep-visual-odometry | models/alexnet_14/alexNet_14.py | models/alexnet_14/alexNet_14.py | # The Model of DeepVO
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten, Reshape
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.layers.normalization import BatchNormalization
from keras import backend as K #enable tensorflow functions
... | # The Model of DeepVO
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten, Reshape
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.layers.normalization import BatchNormalization
from keras import backend as K #enable tensorflow functions
... | mit | Python |
198d4944e961fd998d6e896b3e75ca2e815ffaa5 | Add log to file function for vimapt package | howl-anderson/vimapt,howl-anderson/vimapt | src/vimapt/library/vimapt/__init__.py | src/vimapt/library/vimapt/__init__.py | import logging
logging.basicConfig(filename='/var/log/vimapt.log', level=logging.INFO)
logger = logging.getLogger(__name__)
| mit | Python | |
a84dde598297495fe6f0f8b233b3a3761b0df7d4 | Update test to check newer logic | pypa/pip,pfmoore/pip,pypa/pip,pradyunsg/pip,rouge8/pip,xavfernandez/pip,pradyunsg/pip,rouge8/pip,xavfernandez/pip,xavfernandez/pip,rouge8/pip,sbidoul/pip,sbidoul/pip,techtonik/pip,techtonik/pip,techtonik/pip,pfmoore/pip | tests/functional/test_warning.py | tests/functional/test_warning.py | import textwrap
def test_environ(script, tmpdir):
"""$PYTHONWARNINGS was added in python2.7"""
demo = tmpdir.join('warnings_demo.py')
demo.write(textwrap.dedent('''
from logging import basicConfig
from pip._internal.utils import deprecation
deprecation.install_warning_logger()
... |
def test_environ(script, tmpdir):
"""$PYTHONWARNINGS was added in python2.7"""
demo = tmpdir.join('warnings_demo.py')
demo.write('''
from pip._internal.utils import deprecation
deprecation.install_warning_logger()
from logging import basicConfig
basicConfig()
from warnings import warn
warn("deprecated!",... | mit | Python |
9c92cf39a69bbc6a078a8ffd7fcd8ea8f95b2678 | fix tests | devops-s17-payments/payments,devops-s17-payments/payments,devops-s17-payments/payments | tests/test_payments.py | tests/test_payments.py | # Test cases can be run with either of the following:
# python -m unittest discover
# nosetests -v --rednose --nologcapture
import unittest
from app import payments
from db import app_db, models
class TestModels(unittest.TestCase):
def setUp(self):
payments.app.debug = True
payments.app.config[... | # Test cases can be run with either of the following:
# python -m unittest discover
# nosetests -v --rednose --nologcapture
import unittest
import db
from app import payments
from db import db, models
class TestModels(unittest.TestCase):
def setUp(self):
payments.app.debug = True
payments.app.c... | apache-2.0 | Python |
ee0f31857028a68116f2912054877f37bd64683a | fix vdsClient connections | oVirt/ovirt-hosted-engine-ha,oVirt/ovirt-hosted-engine-ha,oVirt/ovirt-hosted-engine-ha,oVirt/ovirt-hosted-engine-ha | ovirt_hosted_engine_ha/broker/submonitor_util.py | ovirt_hosted_engine_ha/broker/submonitor_util.py | #
# ovirt-hosted-engine-ha -- ovirt hosted engine high availability
# Copyright (C) 2013 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 Licens... | #
# ovirt-hosted-engine-ha -- ovirt hosted engine high availability
# Copyright (C) 2013 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 Licens... | lgpl-2.1 | Python |
727b42a1cdec461d715b845872c321326ce18554 | Load aliases on module load | HubbeKing/Hubbot_Twisted | Modules/Alias.py | Modules/Alias.py | from ModuleInterface import ModuleInterface
from IRCResponse import IRCResponse, ResponseType
import GlobalVars
class Alias(ModuleInterface):
triggers = ["alias"]
help = 'alias <alias> <command> <params> - aliases <alias> to the specified command and parameters\n' \
'you can specify where parameter... | from ModuleInterface import ModuleInterface
from IRCResponse import IRCResponse, ResponseType
import GlobalVars
class Alias(ModuleInterface):
triggers = ["alias"]
help = 'alias <alias> <command> <params> - aliases <alias> to the specified command and parameters\n' \
'you can specify where parameter... | mit | Python |
a69a346e2fd35e531c72b06a2c895d928340c110 | Fix `includes_today` trait fo `MembershipFactory` | agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft | tests/factories/property.py | tests/factories/property.py | from datetime import datetime, timedelta, timezone
from functools import partial
from itertools import chain
import factory
from pycroft.model.user import Membership, PropertyGroup
from pycroft.helpers import interval
from .base import BaseFactory
from .user import UserFactory
class MembershipFactory(BaseFactory):... | from datetime import datetime, timedelta, timezone
from functools import partial
from itertools import chain
import factory
from pycroft.model.user import Membership, PropertyGroup
from pycroft.helpers import interval
from .base import BaseFactory
from .user import UserFactory
class MembershipFactory(BaseFactory):... | apache-2.0 | Python |
24439d318668897d8d1aff99df1606e80d45b875 | add watchdog test | kontron/python-ipmi | tests/test_bmc.py | tests/test_bmc.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
from nose.tools import eq_, raises
from pyipmi.bmc import *
import pyipmi.msgs.bmc
from pyipmi.msgs import encode_message
from pyipmi.msgs import decode_message
def test_watchdog_object():
m = pyipmi.msgs.bmc.GetWatchdogTimerRsp()
decode_message(m, '\x00\x41\x42\x... | #!/usr/bin/env python
#-*- coding: utf-8 -*-
from nose.tools import eq_, raises
from pyipmi.bmc import *
import pyipmi.msgs.bmc
from pyipmi.msgs import encode_message
from pyipmi.msgs import decode_message
def test_deviceid_object():
m = pyipmi.msgs.bmc.GetDeviceIdRsp()
decode_message(m, '\x00\x12\x84\x05\x6... | lgpl-2.1 | Python |
e6519d121ab80467fafdab6a2183964d97ef60e8 | Add test for set_meta command. | xouillet/sigal,xouillet/sigal,saimn/sigal,saimn/sigal,xouillet/sigal,jasuarez/sigal,jasuarez/sigal,t-animal/sigal,saimn/sigal,t-animal/sigal,t-animal/sigal,jasuarez/sigal | tests/test_cli.py | tests/test_cli.py | # -*- coding: utf-8 -*-
import os
from click.testing import CliRunner
from sigal import init
from sigal import serve
from sigal import set_meta
def test_init(tmpdir):
config_file = str(tmpdir.join('sigal.conf.py'))
runner = CliRunner()
result = runner.invoke(init, [config_file])
assert result.exit_c... | # -*- coding: utf-8 -*-
import os
from click.testing import CliRunner
from sigal import init
from sigal import serve
def test_init(tmpdir):
config_file = str(tmpdir.join('sigal.conf.py'))
runner = CliRunner()
result = runner.invoke(init, [config_file])
assert result.exit_code == 0
assert result.... | mit | Python |
d2de2d44a46ff521ab8c1d8bbc57d4eeb8d5dc53 | Fix an error | CMLL/taiga-back,obimod/taiga-back,gam-phon/taiga-back,frt-arch/taiga-back,crr0004/taiga-back,gam-phon/taiga-back,WALR/taiga-back,seanchen/taiga-back,coopsource/taiga-back,taigaio/taiga-back,EvgeneOskin/taiga-back,EvgeneOskin/taiga-back,taigaio/taiga-back,gauravjns/taiga-back,xdevelsistemas/taiga-back-community,gauravjn... | taiga/users/services.py | taiga/users/services.py | # Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the F... | # Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the F... | agpl-3.0 | Python |
31a2439c1137068d8532c5f85cc1c8fb913d7ee8 | Add reconnect to clamscan | awest1339/multiscanner,jmlong1027/multiscanner,MITRECND/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,mitre/multiscanner,mitre/multiscanner,MITRECND/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,mitre/multiscanner,jmlong1027/multiscanner | modules/Antivirus/ClamAVScan.py | modules/Antivirus/ClamAVScan.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
try:
import pyclam... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
try:
import pyclam... | mpl-2.0 | Python |
821e191e05269b9c1cc5f58b3d4cecf5bd20e896 | Correct Range sample | wmarshall484/streamsx.topology,ibmkendrick/streamsx.topology,wmarshall484/streamsx.topology,ibmkendrick/streamsx.topology,wmarshall484/streamsx.topology,IBMStreams/streamsx.topology,wmarshall484/streamsx.topology,ddebrunner/streamsx.topology,ddebrunner/streamsx.topology,wmarshall484/streamsx.topology,wmarshall484/strea... | samples/python/com.ibm.streamsx.topology.pysamples/opt/python/streams/spl_sources.py | samples/python/com.ibm.streamsx.topology.pysamples/opt/python/streams/spl_sources.py | # Licensed Materials - Property of IBM
# Copyright IBM Corp. 2015, 2016
from __future__ import absolute_import, division, print_function
# Simple inclusion of Python logic within an SPL application
# as a SPL "Function" operator. A "Function" operator has
# a single input port and single output port, a function
# is ... | # Licensed Materials - Property of IBM
# Copyright IBM Corp. 2015, 2016
from __future__ import absolute_import, division, print_function
# Simple inclusion of Python logic within an SPL application
# as a SPL "Function" operator. A "Function" operator has
# a single input port and single output port, a function
# is ... | apache-2.0 | Python |
b23a887edd6b55f2386c45c9b93c04431bceba5e | remove all__vary_rounds setting (deprecated in Passlib 1.7) | GLolol/PyLink | coremods/login.py | coremods/login.py | """
login.py - Implement core login abstraction.
"""
from pylinkirc import conf, utils, world
from pylinkirc.log import log
try:
from passlib.context import CryptContext
except ImportError:
CryptContext = None
log.warning("Hashed passwords are disabled because passlib is not installed. Please install "
... | """
login.py - Implement core login abstraction.
"""
from pylinkirc import conf, utils, world
from pylinkirc.log import log
try:
from passlib.context import CryptContext
except ImportError:
CryptContext = None
log.warning("Hashed passwords are disabled because passlib is not installed. Please install "
... | mpl-2.0 | Python |
b79a80d894bdc39c8fa6f76fe50e222567f00df1 | Update cofnig_default: add elastic search config | tranhuucuong91/simple-notebooks,tranhuucuong91/simple-notebooks,tranhuucuong91/simple-notebooks | config_default.py | config_default.py | # -*- coding: utf-8 -*-
"""
Created on 2015-10-23 08:06:00
@author: Tran Huu Cuong <tranhuucuong91@gmail.com>
"""
import os
# Blog configuration values.
# You may consider using a one-way hash to generate the password, and then
# use the hash again in the login view to perform the comparison. This is just
# for sim... | # -*- coding: utf-8 -*-
"""
Created on 2015-10-23 08:06:00
@author: Tran Huu Cuong <tranhuucuong91@gmail.com>
"""
import os
# Blog configuration values.
# You may consider using a one-way hash to generate the password, and then
# use the hash again in the login view to perform the comparison. This is just
# for sim... | mit | Python |
a7c084b4ff3d5529ca54209283d0e1a5984ebea2 | Fix lint error | john-kurkowski/tldextract | tldextract/cli.py | tldextract/cli.py | '''tldextract CLI'''
import logging
import sys
from .tldextract import TLDExtract
from ._version import version as __version__
def main():
'''tldextract CLI main command.'''
import argparse
logging.basicConfig()
parser = argparse.ArgumentParser(
prog='tldextract',
description='Par... | '''tldextract CLI'''
import logging
import sys
from .tldextract import TLDExtract
from ._version import version as __version__
def main():
'''tldextract CLI main command.'''
import argparse
logging.basicConfig()
parser = argparse.ArgumentParser(
prog='tldextract',
description='Pars... | bsd-3-clause | Python |
3f0930f4c7758bc690f01d09f743e24068db05c1 | extend benchmark to run both upload and download tests | deluge-clone/libtorrent,deluge-clone/libtorrent,deluge-clone/libtorrent,deluge-clone/libtorrent,deluge-clone/libtorrent,deluge-clone/libtorrent | tools/run_benchmark.py | tools/run_benchmark.py | import os
import time
import shutil
import subprocess
import sys
toolset = ''
if len(sys.argv) > 1:
toolset = sys.argv[1]
ret = os.system('cd ../examples && bjam boost=source profile statistics=on -j3 %s stage_client_test' % toolset)
ret = os.system('cd ../examples && bjam boost=source release -j3 %s stage_connectio... | import os
import time
import shutil
import subprocess
import sys
port = (int(time.time()) % 50000) + 2000
toolset = ''
if len(sys.argv) > 1:
toolset = sys.argv[1]
ret = os.system('cd ../examples && bjam boost=source profile statistics=on -j3 %s stage_client_test' % toolset)
ret = os.system('cd ../examples && bjam b... | bsd-3-clause | Python |
e7c462af8382a5eb7f5fee2abfc04f002e36b193 | Add varint and varlong tests | SpockBotMC/SpockBot,nickelpro/SpockBot,gamingrobot/SpockBot,MrSwiss/SpockBot,Gjum/SpockBot,luken/SpockBot | tests/mcp/test_datautils.py | tests/mcp/test_datautils.py | from spock.mcp import datautils
from spock.utils import BoundBuffer
def test_unpack_varint():
largebuff = BoundBuffer(b'\x80\x94\xeb\xdc\x03')
smallbuff = BoundBuffer(b'\x14')
assert datautils.unpack_varint(smallbuff) == 20
assert datautils.unpack_varint(largebuff) == 1000000000
def test_pack_varint... | mit | Python | |
ca885203ab82026ca21a200c1bee5ad3c0a82cb5 | Change default interval | awesto/djangocms-carousel,awesto/djangocms-carousel,awesto/djangocms-carousel | src/cmsplugin_carousel/models.py | src/cmsplugin_carousel/models.py | from adminsortable.models import SortableMixin
from cms.models import CMSPlugin
from cms.models.fields import PageField
from django.db import models
from django.utils.translation import ugettext_lazy as _
from filer.fields.image import FilerImageField
class CarouselPlugin(CMSPlugin):
interval = models.PositiveInt... | from adminsortable.models import SortableMixin
from cms.models import CMSPlugin
from cms.models.fields import PageField
from django.db import models
from django.utils.translation import ugettext_lazy as _
from filer.fields.image import FilerImageField
class CarouselPlugin(CMSPlugin):
interval = models.PositiveInt... | mit | Python |
f96f3f6ac5ca5f9301c2c463b0a3f4f710187f21 | Use utf-8 | Astalaseven/pdftoics | constantes.py | constantes.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from BeautifulSoup import BeautifulSoup
import requests
def get_profs():
r = requests.get("http://www.heb.be/esi/personnel_fr.htm")
soup = BeautifulSoup(r.text)
soup = soup.findAll('ul')[2]
profs = {}
for line in soup:
line = str(line)
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from BeautifulSoup import BeautifulSoup
import requests
def get_profs():
r = requests.get("http://www.heb.be/esi/personnel_fr.htm")
soup = BeautifulSoup(r.text)
soup = soup.findAll('ul')[2]
profs = {}
for line in soup:
line = str(line)
... | mit | Python |
afdc58945c710f623714e6b07c593489c0cd42be | Implement basic list command | xii/xii,xii/xii | src/xii/builtin/commands/list/list.py | src/xii/builtin/commands/list/list.py | import datetime
from xii import definition, command, error
from xii.need import NeedLibvirt, NeedSSH
class ListCommand(command.Command):
"""List all currently defined components
"""
name = ['list', 'ls']
help = "list all currently defined components"
@classmethod
def argument_parser(cls):
... | from xii import definition, command, error
from xii.need import NeedLibvirt, NeedSSH
class ListCommand(command.Command):
"""List all currently defined components
"""
name = ['list', 'ls']
help = "list all currently defined components"
@classmethod
def argument_parser(cls):
parser = co... | apache-2.0 | Python |
095ec4c38015f1b1b53cb88ae59fbf6a7596b492 | update VAF | MaxInGaussian/ZS-VAFNN | mnist/training.py | mnist/training.py | # Copyright 2017 Max W. Y. Lam
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | # Copyright 2017 Max W. Y. Lam
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | apache-2.0 | Python |
85537e3f8557a76b8b2ad89edc41848c29622c24 | Update the paint tool shape with the viewer image changes | paalge/scikit-image,ajaybhat/scikit-image,michaelaye/scikit-image,paalge/scikit-image,pratapvardhan/scikit-image,vighneshbirodkar/scikit-image,rjeli/scikit-image,SamHames/scikit-image,keflavich/scikit-image,robintw/scikit-image,GaZ3ll3/scikit-image,jwiggins/scikit-image,michaelpacer/scikit-image,emon10005/scikit-image,... | skimage/viewer/plugins/labelplugin.py | skimage/viewer/plugins/labelplugin.py | import numpy as np
from .base import Plugin
from ..widgets import ComboBox, Slider
from ..canvastools import PaintTool
__all__ = ['LabelPainter']
rad2deg = 180 / np.pi
class LabelPainter(Plugin):
name = 'LabelPainter'
def __init__(self, max_radius=20, **kwargs):
super(LabelPainter, self).__init_... | import numpy as np
from .base import Plugin
from ..widgets import ComboBox, Slider
from ..canvastools import PaintTool
__all__ = ['LabelPainter']
rad2deg = 180 / np.pi
class LabelPainter(Plugin):
name = 'LabelPainter'
def __init__(self, max_radius=20, **kwargs):
super(LabelPainter, self).__init_... | bsd-3-clause | Python |
8a6b100e671b4f22dee6b0399eb8a4bc8bf1a97e | update longdesc string | poldracklab/mriqc,oesteban/mriqc,poldracklab/mriqc,oesteban/mriqc,oesteban/mriqc,poldracklab/mriqc,oesteban/mriqc,poldracklab/mriqc | mriqc/info.py | mriqc/info.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
MRIQC
"""
__versionbase__ = '0.8.6'
__versionrev__ = 'a4'
__version__ = __versionbase__ + __versionrev__
__author__ = 'Oscar Esteban'
__email__ = 'code@osc... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
MRIQC
"""
__versionbase__ = '0.8.6'
__versionrev__ = 'a4'
__version__ = __versionbase__ + __versionrev__
__author__ = 'Oscar Esteban'
__email__ = 'code@osc... | apache-2.0 | Python |
fb2c9469f6d026e77e0f8c20a12f4373e68f9ba2 | update dependency xgboost to v1 (#543) | GoogleCloudPlatform/ai-platform-samples,GoogleCloudPlatform/ai-platform-samples | training/xgboost/structured/base/setup.py | training/xgboost/structured/base/setup.py | #!/usr/bin/env python
# Copyright 2019 Google LLC
#
# 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 a... | #!/usr/bin/env python
# Copyright 2019 Google LLC
#
# 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 a... | apache-2.0 | Python |
06a1b635b02e001e798fa57e70a56ad17f9df7d0 | fix country cleanup migrate script 5 | DOAJ/doaj,DOAJ/doaj,DOAJ/doaj,DOAJ/doaj | portality/migrate/p1p2/country_cleanup.py | portality/migrate/p1p2/country_cleanup.py | import sys
from datetime import datetime
from portality import models
from portality import xwalk
def main(argv=sys.argv):
start = datetime.now()
journal_iterator = models.Journal.all_in_doaj()
counter = 0
for j in journal_iterator:
counter += 1
oldcountry = j.bibjson().count... | import sys
from datetime import datetime
from portality import models
from portality import xwalk
def main(argv=sys.argv):
start = datetime.now()
journal_iterator = models.Journal.all_in_doaj()
counter = 0
for j in journal_iterator:
counter += 1
oldcountry = j.bibjson().count... | apache-2.0 | Python |
ccaca70aa28bdd3e4f2a9c6e46d76e3ff8653f88 | Fix public page hashids issue | crestify/crestify,crestify/crestify,crestify/crestify | crestify/views/public.py | crestify/views/public.py | from crestify import app, hashids
from crestify.models import Bookmark
from flask import render_template
@app.route('/public/<string:bookmark_id>', methods=['GET'])
def bookmark_public(bookmark_id):
bookmark_id = hashids.decode(str(bookmark_id))[0]
query = Bookmark.query.get(bookmark_id)
return render_tem... | from crestify import app, hashids
from crestify.models import Bookmark
from flask import render_template
@app.route('/public/<string:bookmark_id>', methods=['GET'])
def bookmark_public(bookmark_id):
bookmark_id = hashids.decode(bookmark_id)[0]
query = Bookmark.query.get(bookmark_id)
return render_template... | bsd-3-clause | Python |
bfdf4bffdb30e6f9651c96afb711d2a871b9ff87 | fix output to shell | ContinuumIO/pypi-conda-builds | create_recipes.py | create_recipes.py | import argparse
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument("package_list", help="List of packages for which" +
" recipies will be created")
args = parser.parse_args()
package_names = [package.strip() for package in
open(args.package_list, 'r').readlin... | import argparse
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument("package_list", help="List of packages for which" +
" recipies will be created")
args = parser.parse_args()
package_names = [package.strip() for package in
open(args.package_list, 'r').readlin... | bsd-3-clause | Python |
21000dfd4bf63ceae0e8c6ac343624fbf5c5bea2 | read tags before people | shaylavi/codeandtalk.com,szabgab/codeandtalk.com,szabgab/codeandtalk.com,mhorvvitz/codeandtalk.com,shaylavi/codeandtalk.com,szabgab/codeandtalk.com,szabgab/codeandtalk.com,mhorvvitz/codeandtalk.com,mhorvvitz/codeandtalk.com,rollandf/codeandtalk.com,shaylavi/codeandtalk.com,rollandf/codeandtalk.com,rollandf/codeandtalk.... | cat/test_cat.py | cat/test_cat.py | from cat.code import GenerateSite
import unittest
import json
import os
import sys
def read_json(file):
with open(file) as fh:
return json.loads(fh.read())
#return fh.read()
class TestDemo(unittest.TestCase):
def test_generate(self):
GenerateSite().generate_site()
assert True
... | from cat.code import GenerateSite
import unittest
import json
import os
import sys
def read_json(file):
with open(file) as fh:
return json.loads(fh.read())
#return fh.read()
class TestDemo(unittest.TestCase):
def test_generate(self):
GenerateSite().generate_site()
assert True
... | apache-2.0 | Python |
b220af1b5219c59735bd1f35493b0a659c627738 | Fix cookie handling for tornado | joelstanner/python-social-auth,S01780/python-social-auth,VishvajitP/python-social-auth,degs098/python-social-auth,JJediny/python-social-auth,bjorand/python-social-auth,python-social-auth/social-app-cherrypy,clef/python-social-auth,robbiet480/python-social-auth,falcon1kr/python-social-auth,rsteca/python-social-auth,msam... | social/strategies/tornado_strategy.py | social/strategies/tornado_strategy.py | import json
from tornado.template import Loader, Template
from social.utils import build_absolute_uri
from social.strategies.base import BaseStrategy, BaseTemplateStrategy
class TornadoTemplateStrategy(BaseTemplateStrategy):
def render_template(self, tpl, context):
path, tpl = tpl.rsplit('/', 1)
... | import json
from tornado.template import Loader, Template
from social.utils import build_absolute_uri
from social.strategies.base import BaseStrategy, BaseTemplateStrategy
class TornadoTemplateStrategy(BaseTemplateStrategy):
def render_template(self, tpl, context):
path, tpl = tpl.rsplit('/', 1)
... | bsd-3-clause | Python |
c5db8af5faca762e574a5b3b6117a0253e59cd05 | use new urls module | dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | couchexport/urls.py | couchexport/urls.py | from django.conf.urls import *
urlpatterns = patterns('',
url(r'^model/$', 'couchexport.views.export_data', name='model_download_excel'),
url(r'^async/$', 'couchexport.views.export_data_async', name='export_data_async'),
url(r'^saved/(?P<export_id>[\w-]+)/$', 'couchexport.views.download_saved_export',
... | from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^model/$', 'couchexport.views.export_data', name='model_download_excel'),
url(r'^async/$', 'couchexport.views.export_data_async', name='export_data_async'),
url(r'^saved/(?P<export_id>[\w-]+)/$', 'couchexport.views.download_saved_expo... | bsd-3-clause | Python |
b68da6c5b64009dbd2d53206be4c8d98ed1b0a45 | Add print option to exercise_oaipmh.py | libris/librisxl,libris/librisxl,libris/librisxl | librisxl-tools/scripts/exercise_oaipmh.py | librisxl-tools/scripts/exercise_oaipmh.py | import requests
from lxml import etree
from StringIO import StringIO
import time
PMH = "{http://www.openarchives.org/OAI/2.0/}"
def parse_oaipmh(start_url, name, passwd, do_print=False):
start_time = time.time()
resumption_token = None
record_count = 0
while True:
url = make_next_url(start_ur... | import requests
from lxml import etree
import time
PMH = "{http://www.openarchives.org/OAI/2.0/}"
def parse_oaipmh(start_url, name, passwd):
start_time = time.time()
resumption_token = None
record_count = 0
while True:
url = make_next_url(start_url, resumption_token)
res = requests.ge... | apache-2.0 | Python |
f4408cb2feb5a28a5117fefebe782a61ea80de96 | fix res_company | marcok/odoo_modules,marcok/odoo_modules,marcok/odoo_modules | hr_employee_time_clock/models/__init__.py | hr_employee_time_clock/models/__init__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2016 - now Bytebrand Outsourcing AG (<http://www.bytebrand.net>).
#
# This program is free software: you can redistribute it and/or modify
# it... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2016 - now Bytebrand Outsourcing AG (<http://www.bytebrand.net>).
#
# This program is free software: you can redistribute it and/or modify
# it... | agpl-3.0 | Python |
96158b6b5a153db6b9a5e5d40699efefc728a9b3 | Make our LiveWidget handle a 'topics' property along with 'topic' | mokshaproject/moksha,pombredanne/moksha,pombredanne/moksha,mokshaproject/moksha,mokshaproject/moksha,lmacken/moksha,lmacken/moksha,pombredanne/moksha,lmacken/moksha,mokshaproject/moksha,ralphbean/moksha,pombredanne/moksha,ralphbean/moksha,ralphbean/moksha | moksha/api/widgets/live/live.py | moksha/api/widgets/live/live.py | # This file is part of Moksha.
# Copyright (C) 2008-2009 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ... | # This file is part of Moksha.
# Copyright (C) 2008-2009 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ... | apache-2.0 | Python |
410f02a4f657f9a8b9c839f3e08b176f443de9e8 | Handle cases when searched word is only part of the people name. | nihn/linkedin-scraper,nihn/linkedin-scraper | linkedin_scraper/spiders/people_search.py | linkedin_scraper/spiders/people_search.py | from os import environ
from scrapy_splash import SplashRequest
from scrapy.spiders.init import InitSpider
from scrapy.http import Request, FormRequest
class PeopleSearchSpider(InitSpider):
name = 'people_search'
allowed_domains = ['linkedin.com']
login_page = 'https://www.linkedin.com/uas/login'
def... | from os import environ
from scrapy_splash import SplashRequest
from scrapy.spiders.init import InitSpider
from scrapy.http import Request, FormRequest
class PeopleSearchSpider(InitSpider):
name = 'people_search'
allowed_domains = ['linkedin.com']
login_page = 'https://www.linkedin.com/uas/login'
def... | mit | Python |
655fcce56abd0d3f0da9b52e911636d931157443 | bump version | penkin/python-dockercloud,penkin/python-dockercloud,docker/python-dockercloud,docker/python-dockercloud | dockercloud/__init__.py | dockercloud/__init__.py | import base64
import logging
import os
import requests
from future.standard_library import install_aliases
install_aliases()
from dockercloud.api import auth
from dockercloud.api.service import Service
from dockercloud.api.container import Container
from dockercloud.api.repository import Repository
from dockercloud.... | import base64
import logging
import os
import requests
from future.standard_library import install_aliases
install_aliases()
from dockercloud.api import auth
from dockercloud.api.service import Service
from dockercloud.api.container import Container
from dockercloud.api.repository import Repository
from dockercloud.... | apache-2.0 | Python |
dae16f72b9ca5d96c7f894601aa3a69facbbb00e | Fix memory limit in MongoDB while loading logs (#5) | xenx/recommendation_system,xenx/recommendation_system | scripts/load_logs_to_mongodb.py | scripts/load_logs_to_mongodb.py | import os
import sys
from datetime import datetime
from collections import defaultdict
from pymongo import MongoClient
logs_file = open(sys.argv[1])
article_urls = set()
article_views = defaultdict(list) # article_url: list of user's id's
article_times = {}
for line in logs_file:
try:
timestamp, url, user... | import os
import sys
from datetime import datetime
from collections import defaultdict
from pymongo import MongoClient
logs_file = open(sys.argv[1])
article_urls = set()
article_views = defaultdict(list) # article_url: list of user's id's
article_times = {}
for line in logs_file:
try:
timestamp, url, user... | mit | Python |
3375c9cd3311bff8ff3ab07c361e18c68226784c | remove stray print | praekelt/mc2,praekelt/mc2,praekelt/mc2,praekelt/mc2,praekelt/mc2 | mc2/controllers/base/managers/rabbitmq.py | mc2/controllers/base/managers/rabbitmq.py | import base64
import hashlib
import random
import time
import uuid
from django.conf import settings
from pyrabbit.api import Client
from pyrabbit.http import HTTPError
class ControllerRabbitMQManager(object):
def __init__(self, controller):
"""
A helper manager to get to connect to RabbitMQ
... | import base64
import hashlib
import random
import time
import uuid
from django.conf import settings
from pyrabbit.api import Client
from pyrabbit.http import HTTPError
class ControllerRabbitMQManager(object):
def __init__(self, controller):
"""
A helper manager to get to connect to RabbitMQ
... | bsd-2-clause | Python |
2cee1d5bff32831a9c15755e7482057ac7b9a39a | Update packets.py | jvanbrug/cs143sim,jvanbrug/cs143sim,jvanbrug/cs143sim | cs143sim/packets.py | cs143sim/packets.py | """This module contains all packet definitions.
.. autosummary::
Packet
DataPacket
RouterPacket
.. moduleauthor:: Lan Hongjian <lanhongjianlr@gmail.com>
.. moduleauthor:: Yamei Ou <oym111@gmail.com>
.. moduleauthor:: Samuel Richerd <dondiego152@gmail.com>
.. moduleauthor:: Jan Van Bruggen <jancvanbruggen... | """This module contains all packet definitions.
.. autosummary::
Packet
DataPacket
RouterPacket
.. moduleauthor:: Lan Hongjian <lanhongjianlr@gmail.com>
.. moduleauthor:: Yamei Ou <oym111@gmail.com>
.. moduleauthor:: Samuel Richerd <dondiego152@gmail.com>
.. moduleauthor:: Jan Van Bruggen <jancvanbruggen... | mit | Python |
0c35c0f7fe126b87eccdf4f69933b84927956658 | Fix account __type__ | vuolter/pyload,vuolter/pyload,vuolter/pyload | module/plugins/accounts/XFileSharingPro.py | module/plugins/accounts/XFileSharingPro.py | # -*- coding: utf-8 -*-
import re
from module.plugins.internal.XFSPAccount import XFSPAccount
class XFileSharingPro(XFSPAccount):
__name__ = "XFileSharingPro"
__type__ = "account"
__version__ = "0.02"
__description__ = """XFileSharingPro multi-purpose account plugin"""
__license__ = "GPLv3"
... | # -*- coding: utf-8 -*-
import re
from module.plugins.internal.XFSPAccount import XFSPAccount
class XFileSharingPro(XFSPAccount):
__name__ = "XFileSharingPro"
__type__ = "crypter"
__version__ = "0.01"
__description__ = """XFileSharingPro dummy account plugin for hook"""
__license__ = "GPLv3"
... | agpl-3.0 | Python |
a396d3e7b4de10710c2f2e0beab0ef82acaf866b | Create first test | masschallenge/impact-api,masschallenge/impact-api,masschallenge/impact-api,masschallenge/impact-api | web/impact/impact/tests/test_track_api_calls.py | web/impact/impact/tests/test_track_api_calls.py | from django.test import (
TestCase,
)
from mock import mock, patch
from impact.tests.api_test_case import APITestCase
class TestTrackAPICalls(APITestCase):
@patch('impact.middleware.track_api_calls.TrackAPICalls.process_request.logger')
def test_when_user_authenticated(self, logger_info_patch):
... | from django.test import (
RequestFactory,
TestCase,
)
from mock import patch
class TestTrackAPICalls(TestCase):
def test_when_user_auth(self):
pass
def test_when_no_user_auth(self):
pass
| mit | Python |
9e577694d2f8665599d590299e58355dd7472011 | Fix less | cupy/cupy,keisuke-umezawa/chainer,chainer/chainer,sinhrks/chainer,yanweifu/chainer,hvy/chainer,wkentaro/chainer,tkerola/chainer,niboshi/chainer,laysakura/chainer,hidenori-t/chainer,cemoody/chainer,ysekky/chainer,pfnet/chainer,chainer/chainer,okuta/chainer,hvy/chainer,cupy/cupy,kashif/chainer,keisuke-umezawa/chainer,nib... | cupy/logic/comparison.py | cupy/logic/comparison.py | from cupy.logic import ufunc
def allclose(a, b, rtol=1e-05, atol=1e-08):
# TODO(beam2d): Implement it
raise NotImplementedError
def isclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False, allocator=None):
# TODO(beam2d): Implement it
raise NotImplementedError
def array_equal(a1, a2):
# TODO(bea... | from cupy.logic import ufunc
def allclose(a, b, rtol=1e-05, atol=1e-08):
# TODO(beam2d): Implement it
raise NotImplementedError
def isclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False, allocator=None):
# TODO(beam2d): Implement it
raise NotImplementedError
def array_equal(a1, a2):
# TODO(bea... | mit | Python |
244f3262989b0331a120eb546ca22c9bea9194e4 | add DownloadDelta to the admin | crate-archive/crate-site,crateio/crate.pypi,crate-archive/crate-site | crate_project/apps/packages/admin.py | crate_project/apps/packages/admin.py | from django.contrib import admin
from packages.models import Package, Release, ReleaseFile, TroveClassifier, PackageURI
from packages.models import ReleaseRequire, ReleaseProvide, ReleaseObsolete, ReleaseURI, ChangeLog
from packages.models import DownloadDelta, ReadTheDocsPackageSlug
class PackageURIAdmin(admin.Tabu... | from django.contrib import admin
from packages.models import Package, Release, ReleaseFile, TroveClassifier, PackageURI
from packages.models import ReleaseRequire, ReleaseProvide, ReleaseObsolete, ReleaseURI, ChangeLog
from packages.models import ReadTheDocsPackageSlug
class PackageURIAdmin(admin.TabularInline):
... | bsd-2-clause | Python |
4c703480fe395ddef5faa6d388a472b7053f26af | Add debug command line option. | osks/jskom,osks/jskom,osks/jskom,osks/jskom | jskom/__main__.py | jskom/__main__.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import asyncio
import logging
from hypercorn.asyncio import serve
from hypercorn.config import Config
from jskom import app, init_app
log = logging.getLogger("jskom.main")
def run(host, port):
# use 127.0.0.1 instead of localhost to avoid delays re... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import asyncio
import logging
from hypercorn.asyncio import serve
from hypercorn.config import Config
from jskom import app, init_app
log = logging.getLogger("jskom.main")
def run(host, port):
# use 127.0.0.1 instead of localhost to avoid delays re... | mit | Python |
cdcc807ecd7126f533bbc01721276d62a4a72732 | fix all_docs dbs to work after flip | dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq | corehq/couchapps/__init__.py | corehq/couchapps/__init__.py | from corehq.preindex import CouchAppsPreindexPlugin
from django.conf import settings
CouchAppsPreindexPlugin.register('couchapps', __file__, {
'form_question_schema': 'meta',
'users_extra': (settings.USERS_GROUPS_DB, settings.NEW_USERS_GROUPS_DB),
'noneulized_users': (settings.USERS_GROUPS_DB, settings.NEW... | from corehq.preindex import CouchAppsPreindexPlugin
from django.conf import settings
CouchAppsPreindexPlugin.register('couchapps', __file__, {
'form_question_schema': 'meta',
'users_extra': (settings.USERS_GROUPS_DB, settings.NEW_USERS_GROUPS_DB),
'noneulized_users': (settings.USERS_GROUPS_DB, settings.NEW... | bsd-3-clause | Python |
a27e667dedeaaa0aefadc3328149f311bb277c45 | Update bottlespin.py | kallerdaller/Cogs-Yorkfield | bottlespin/bottlespin.py | bottlespin/bottlespin.py | import discord
from discord.ext import commands
from random import choice
class Bottlespin:
"""Spins a bottle and lands on a random user."""
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True, no_pm=True, alias=["bottlespin"])
async def spin(self, ctx, role):
... | import discord
from discord.ext import commands
from random import choice
class Bottlespin:
"""Spins a bottle and lands on a random user."""
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True, no_pm=True, alias=["bottlespin"])
async def spin(self, ctx, role):
... | mit | Python |
c63463ff040f79c605d6c0414261527dda3ed00a | Switch to new babel version in require test. | amol-/dukpy,amol-/dukpy,amol-/dukpy | tests/test_jsinterpreter.py | tests/test_jsinterpreter.py | import unittest
from dukpy._dukpy import JSRuntimeError
import dukpy
from diffreport import report_diff
class TestJSInterpreter(unittest.TestCase):
def test_interpreter_keeps_context(self):
interpreter = dukpy.JSInterpreter()
ans = interpreter.evaljs("var o = {'value': 5}; o")
assert ans... | import unittest
from dukpy._dukpy import JSRuntimeError
import dukpy
from diffreport import report_diff
class TestJSInterpreter(unittest.TestCase):
def test_interpreter_keeps_context(self):
interpreter = dukpy.JSInterpreter()
ans = interpreter.evaljs("var o = {'value': 5}; o")
assert ans... | mit | Python |
3681ada3917d5811e1e959270e1df0edea7ebf55 | Update __init__.py | rchristie/mapclientplugins.smoothfitstep | mapclientplugins/smoothfitstep/__init__.py | mapclientplugins/smoothfitstep/__init__.py |
'''
MAP Client Plugin
'''
__version__ = '0.1.0'
__author__ = 'Richard Christie'
__stepname__ = 'smoothfit'
__location__ = ''
# import class that derives itself from the step mountpoint.
from mapclientplugins.smoothfitstep import step
# Import the resource file when the module is loaded,
# this enables... |
'''
MAP Client Plugin
'''
__version__ = '0.1.0'
__author__ = 'Richard Christie'
__stepname__ = 'smoothfit'
__location__ = ''
# import class that derives itself from the step mountpoint.
from mapclientplugins.smoothfitstep import step
# Import the resource file when the module is loaded,
# this enables... | apache-2.0 | Python |
379d2df1041605d3c8a21d543f9955601ee07558 | Add threading to syncer | creativecommons/open-ledger,creativecommons/open-ledger,creativecommons/open-ledger | imageledger/management/commands/syncer.py | imageledger/management/commands/syncer.py | from collections import namedtuple
import itertools
import logging
from multiprocessing.dummy import Pool as ThreadPool
from elasticsearch import helpers
from django.core.management.base import BaseCommand, CommandError
from django.db import connection, transaction
from imageledger import models, search
console = l... | from collections import namedtuple
import itertools
import logging
from elasticsearch import helpers
from django.core.management.base import BaseCommand, CommandError
from django.db import connection, transaction
from imageledger import models, search
console = logging.StreamHandler()
log = logging.getLogger(__name_... | mit | Python |
33b7e9371305c4171594c21c154cd5724ea013cb | allow segment and overlap be specified as a parameter | jts/nanopolish,jts/nanopolish,jts/nanopolish,mateidavid/nanopolish,mateidavid/nanopolish,mateidavid/nanopolish,jts/nanopolish,mateidavid/nanopolish,mateidavid/nanopolish,jts/nanopolish | scripts/nanopolish_makerange.py | scripts/nanopolish_makerange.py | import sys
import argparse
from Bio import SeqIO
parser = argparse.ArgumentParser(description='Partition a genome into a set of overlapping segments')
parser.add_argument('--segment-length', type=int, default=50000)
parser.add_argument('--overlap-length', type=int, default=200)
args, extra = parser.parse_known_args()
... | import sys
from Bio import SeqIO
recs = [ (rec.name, len(rec.seq)) for rec in SeqIO.parse(open(sys.argv[1]), "fasta")]
SEGMENT_LENGTH = 50000
OVERLAP_LENGTH = 200
for name, length in recs:
n_segments = (length / SEGMENT_LENGTH) + 1
for n in xrange(0, length, SEGMENT_LENGTH):
if ( n + SEGMENT_LENGTH)... | mit | Python |
105a413b18456f9a505dd1ed4bf515987b4792d2 | add --force option to management command to force all files to be pushed | mntan/django-mediasync,sunlightlabs/django-mediasync,sunlightlabs/django-mediasync,mntan/django-mediasync,mntan/django-mediasync,sunlightlabs/django-mediasync | mediasync/management/commands/syncmedia.py | mediasync/management/commands/syncmedia.py | from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
import mediasync
class Command(BaseCommand):
help = "Sync local media with S3"
args = '[options]'
requires_model_validation = False
option_list = BaseCommand.option_list + (
make_op... | from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
import mediasync
class Command(BaseCommand):
help = "Sync local media with S3"
args = '[options]'
requires_model_validation = False
option_list = BaseCommand.option_list + (
make_op... | bsd-3-clause | Python |
0be6bddf8c92c461af57e7c61c2378c817fb0143 | Make oppetarkiv work with --all-episodes again | dalgr/svtplay-dl,selepo/svtplay-dl,leakim/svtplay-dl,leakim/svtplay-dl,dalgr/svtplay-dl,qnorsten/svtplay-dl,qnorsten/svtplay-dl,olof/svtplay-dl,spaam/svtplay-dl,iwconfig/svtplay-dl,olof/svtplay-dl,selepo/svtplay-dl,iwconfig/svtplay-dl,leakim/svtplay-dl,spaam/svtplay-dl | lib/svtplay_dl/service/oppetarkiv.py | lib/svtplay_dl/service/oppetarkiv.py | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import
import re
from svtplay_dl.service.svtplay import Svtplay
from svtplay_dl.log import log
class OppetArkiv(Svtplay):
supported_domains = ['oppetarkiv.se']
def find_all_episodes(self, ... | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import
import re
from svtplay_dl.service.svtplay import Svtplay
from svtplay_dl.log import log
class OppetArkiv(Svtplay):
supported_domains = ['oppetarkiv.se']
def find_all_episodes(self, ... | mit | Python |
a52b4097dfcb9fea26af0bc994426baecb97efc1 | update image if streetview url | justinwp/croplands,justinwp/croplands | croplands_api/views/api/locations.py | croplands_api/views/api/locations.py | from croplands_api import api
from croplands_api.models import Location
from processors import api_roles, add_user_to_posted_data, remove_relations, debug_post
from records import save_record_state_to_history
from croplands_api.utils.s3 import upload_image
import requests
import uuid
import cStringIO
def process_recor... | from croplands_api import api
from croplands_api.models import Location
from processors import api_roles, add_user_to_posted_data, remove_relations, debug_post
from records import save_record_state_to_history
from croplands_api.tasks.records import get_ndvi
def process_records(result=None, **kwargs):
"""
This... | mit | Python |
928d498b5f67970f9ec75d62068e8cbec0fdc352 | Update python3, flake8 | NORDUnet/niscanner | ni_scanner.py | ni_scanner.py | from ConfigParser import SafeConfigParser
from utils.cli import CLI
from api.queue import Queue
from api.nerds import NerdsApi
from scanner.host import HostScanner
from scanner.exceptions import ScannerExeption
from utils.url import url_concat
import logging
FORMAT = '%(name)s - %(levelname)s - %(message)s'
logging.ba... | from ConfigParser import SafeConfigParser
from utils.cli import CLI
from api.queue import Queue
from api.nerds import NerdsApi
from scanner.host import HostScanner
from scanner.exceptions import ScannerExeption
from utils.url import url_concat
import logging
FORMAT = '%(name)s - %(levelname)s - %(message)s'
logging.ba... | bsd-3-clause | Python |
496007543f941bb3ca46c011383f2673b9362e47 | Bump development version | lpomfrey/django-debreach,lpomfrey/django-debreach | debreach/__init__.py | debreach/__init__.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from distutils import version
__version__ = '1.4.1'
version_info = version.StrictVersion(__version__).version
default_app_config = 'debreach.apps.DebreachConfig'
| # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from distutils import version
__version__ = '1.4.0'
version_info = version.StrictVersion(__version__).version
default_app_config = 'debreach.apps.DebreachConfig'
| bsd-2-clause | Python |
31d6ce09382035458eca2a310f99cb3c958ea604 | Use main template environment for rendering document content | jreese/nib | nib/render.py | nib/render.py | import jinja2
from jinja2 import Environment, FileSystemLoader, Template
from os import path
import time
jinja_filters = {}
def jinja(name):
def decorator(f):
jinja_filters[name] = f
return f
return decorator
class Render(object):
def __init__(self, options, documents):
self.optio... | import jinja2
from jinja2 import Environment, FileSystemLoader, Template
from os import path
import time
jinja_filters = {}
def jinja(name):
def decorator(f):
jinja_filters[name] = f
return f
return decorator
class Render(object):
def __init__(self, options, documents):
self.optio... | mit | Python |
8a03a3fbcfdb22dc21e5539462a2b235e744abba | change open/close to with | raspearsy/bme590hrm | output.py | output.py | def summarizeECG(instHR, avgHR, brady, tachy):
"""Create txt file summarizing ECG analysis
:param instHR: (int)
:param avgHR: (int)
:param brady: (int)
:param tachy: (int)
"""
#Calls hrdetector() to get instantaneous heart rate
#instHR = findInstHR()
#Calls findAvgHR() to get avera... | def summarizeECG(instHR, avgHR, brady, tachy):
"""Create txt file summarizing ECG analysis
:param instHR: (int)
:param avgHR: (int)
:param brady: (int)
:param tachy: (int)
"""
#Calls hrdetector() to get instantaneous heart rate
#instHR = findInstHR()
#Calls findAvgHR() to get avera... | mit | Python |
b0a1f10d60abc6c9fc7751e3bae492976d3f3306 | Update version 1.0.0.dev3 -> 1.0.0.dev4 | oneklc/dimod,oneklc/dimod | dimod/package_info.py | dimod/package_info.py | __version__ = '1.0.0.dev4'
__author__ = 'D-Wave Systems Inc.'
__authoremail__ = 'acondello@dwavesys.com'
__description__ = 'A shared API for binary quadratic model samplers.'
| __version__ = '1.0.0.dev3'
__author__ = 'D-Wave Systems Inc.'
__authoremail__ = 'acondello@dwavesys.com'
__description__ = 'A shared API for binary quadratic model samplers.'
| apache-2.0 | Python |
518443854f7ef4466885d88cf7b379c626692da1 | Add PlannedBudgetLimits to Budgets::Budget BudgetData | cloudtools/troposphere,ikben/troposphere,ikben/troposphere,cloudtools/troposphere | troposphere/budgets.py | troposphere/budgets.py | # Copyright (c) 2012-2019, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
# Resource specification version: 8.0.0
from . import AWSObject
from . import AWSProperty
from .validators import boolean
from .validators import do... | # Copyright (c) 2012-2018, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
from .validators import boolean
class Spend(AWSProperty):
props = {
'Amount': (float, True),
'Unit': (basestring, True),
}
class CostTypes(... | bsd-2-clause | Python |
ba84f4a1b11f486d211254721397be43f8c9b07a | update __manifest__.py | thinkopensolutions/tkobr-addons,thinkopensolutions/tkobr-addons,thinkopensolutions/tkobr-addons,thinkopensolutions/tkobr-addons | tko_coexiste_coa/__manifest__.py | tko_coexiste_coa/__manifest__.py | # -*- coding: utf-8 -*-
# © 2017 TKO <http://tko.tko-br.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Plano de Contas Brasileiro',
'summary': '',
'description': 'Plano de contas brasileiro adaptável a qualquer segmento.',
'author': 'TKO',
'category': 'l10n_br',
... | # -*- coding: utf-8 -*-
# © 2017 TKO <http://tko.tko-br.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Plano de Contas Brasileiro',
'summary': '',
'description': 'Plano de contas brasileiro adaptável a qualquer segmento.',
'author': 'TKO',
'category': 'l10n_br',
... | agpl-3.0 | Python |
febb2e9369a706d7319d89851cac3dc9a1fd167e | add source of kyoko image | neynt/tsundiary,neynt/tsundiary,neynt/tsundiary,neynt/tsundiary | tsundiary/jinja_env.py | tsundiary/jinja_env.py | from tsundiary import app
app.jinja_env.globals.update(theme_nicename = {
'classic': 'Classic Orange',
'minimal': 'Minimal Black/Grey',
'misato-tachibana': 'Misato Tachibana',
'rei-ayanami': 'Rei Ayanami',
'saya': 'Saya',
'yuno': 'Yuno Gasai',
'kyoko-sakura': 'Kyoko Sakura',
'colorful':... | from tsundiary import app
app.jinja_env.globals.update(theme_nicename = {
'classic': 'Classic Orange',
'minimal': 'Minimal Black/Grey',
'misato-tachibana': 'Misato Tachibana',
'rei-ayanami': 'Rei Ayanami',
'saya': 'Saya',
'yuno': 'Yuno Gasai',
'kyoko-sakura': 'Kyoko Sakura',
'colorful':... | mit | Python |
3cf93f7f640ef04a1be31d515c19cffec19cec45 | Remove logging import unused | openstack/python-searchlightclient,openstack/python-searchlightclient | searchlightclient/osc/plugin.py | searchlightclient/osc/plugin.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distrib... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distrib... | apache-2.0 | Python |
57cb5546d0e832bae8b2171d42fc4428ebc6dc74 | add try for imports | benjspriggs/tumb-borg | tumb_borg/authorize.py | tumb_borg/authorize.py | #!/usr/bin/python
from tumblpy import Tumblpy as T
try:
from urllib.parse import urlparse, parse_qs
except ImportError:
from urlparse import urlparse, parse_qs
def authorize(KEY, SECRET, CALLBACK):
def get_authorization_properties():
t = T(KEY, SECRET)
return t \
.get_authentica... | #!/usr/bin/python
from tumblpy import Tumblpy as T
from urlparse import urlparse, parse_qs
def authorize(KEY, SECRET, CALLBACK):
def get_authorization_properties():
t = T(KEY, SECRET)
return t \
.get_authentication_tokens(
callback_url=CALLBACK)
auth_p = get... | apache-2.0 | Python |
722de274d3ee9866c7580a7f95e32de1777e6a3b | Add note | christabor/csscms,christabor/csscms,christabor/csscms | csscms/properties_scraper.py | csscms/properties_scraper.py | from pyquery import PyQuery as pq
"""
A quick and dirty scraper for w3c's css properties list.
See css_properties.py for the example output. This is meant to be run once, except when new properties
need to be scraped.
"""
def strip_all_prefixes(string):
bad_prefixes = [
'text-text-',
'pos-',
... | from pyquery import PyQuery as pq
"""A quick and dirty scraper for w3c's css properties list."""
def strip_all_prefixes(string):
bad_prefixes = [
'text-text-',
'pos-',
'font-font-',
'nav-',
'class-',
'gen-',
'tab-'
]
for prefix in bad_prefixes:
... | mit | Python |
d13204abb2cf5d341eff78416dd442c303042697 | Modify add_occupant method to raise exception in case of a duplicate | peterpaints/room-allocator | classes/room.py | classes/room.py | class Room(object):
def __init__(self, room_name, room_type, max_persons):
self.room_name = room_name
self.room_type = room_type
self.max_persons = max_persons
self.persons = []
def add_occupant(self, person):
if person not in self.persons:
if len(self.person... | class Room(object):
def __init__(self, room_name, room_type, max_persons):
self.room_name = room_name
self.room_type = room_type
self.max_persons = max_persons
self.persons = []
def add_occupant(self, person):
if len(self.persons) < self.max_persons:
self.per... | mit | Python |
90d3f00cd8fea8fab9274069ac06ea461f8e4dfd | Send only pics and gifs to OOO_B_R. | nsiregar/reddit2telegram,Fillll/reddit2telegram,nsiregar/reddit2telegram,Fillll/reddit2telegram | channels/ooo_b_r/app.py | channels/ooo_b_r/app.py | #encoding:utf-8
from utils import get_url, weighted_random_subreddit
# Group chat https://yal.sh/dvdahoy
t_channel = '-1001065558871'
subreddit = weighted_random_subreddit({
'ANormalDayInRussia': 1.0,
'ANormalDayInAmerica': 0.1,
'ANormalDayInJapan': 0.01
})
def send_post(submission, r2t):
what, url... | #encoding:utf-8
from utils import get_url, weighted_random_subreddit
# Group chat https://yal.sh/dvdahoy
t_channel = '-1001065558871'
subreddit = weighted_random_subreddit({
'ANormalDayInRussia': 1.0,
'ANormalDayInAmerica': 0.1,
'ANormalDayInJapan': 0.01
})
def send_post(submission, r2t):
what, url... | mit | Python |
d966b0973da71f5c883697ddd12c2728b2a04cce | Improve git tag to version conversion | autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/LanguageClient-neovim,autozimu/L... | ci/cleanup-binary-tags.py | ci/cleanup-binary-tags.py | #!/usr/bin/env python3
import os
import subprocess
import re
import semver
def tag_to_version(tag):
return tag.split('-')[1].lstrip('v')
subprocess.check_call('git pull --tags', shell=True)
tags = subprocess.check_output(
'git tag --list | grep binary', shell=True).decode('UTF-8').splitlines()
versions = s... | #!/usr/bin/env python3
import os
import subprocess
import re
import semver
def tag_to_version(tag):
version = re.sub(r'binary-', '', tag)
version = re.sub(r'-[x86|i686].*', '', version)
return version
subprocess.check_call('git pull --tags', shell=True)
tags = subprocess.check_output(
'git tag --li... | mit | Python |
94aed149fd39ba9a6dd6fcf5dcc44c6e4f2a09b9 | fix imports | it-projects-llc/website-addons,it-projects-llc/website-addons,it-projects-llc/website-addons | website_sale_search_clear/controllers.py | website_sale_search_clear/controllers.py | # -*- coding: utf-8 -*-
from odoo import http
from odoo.addons.website_sale.controllers.main import WebsiteSale as controller
class WebsiteSale(controller):
@http.route()
def shop(self, page=0, category=None, search='', **post):
if category and search:
category = None
return super... | # -*- coding: utf-8 -*-
from openerp import http
from openerp.addons.website_sale.controllers.main import website_sale as controller
class WebsiteSale(controller):
@http.route()
def shop(self, page=0, category=None, search='', **post):
if category and search:
category = None
retur... | mit | Python |
683ccc69c51a64146dda838ad01674ca3b95fccd | Remove useless hearing comments router | City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi | democracy/urls_v1.py | democracy/urls_v1.py | from django.conf.urls import include, url
from rest_framework_nested import routers
from democracy.views import (
CommentViewSet, ContactPersonViewSet, HearingViewSet, ImageViewSet, LabelViewSet, ProjectViewSet,
RootSectionViewSet, SectionCommentViewSet, SectionViewSet, UserDataViewSet, FileViewSet, ServeFileV... | from django.conf.urls import include, url
from rest_framework_nested import routers
from democracy.views import (
CommentViewSet, ContactPersonViewSet, HearingViewSet, ImageViewSet, LabelViewSet, ProjectViewSet,
RootSectionViewSet, SectionCommentViewSet, SectionViewSet, UserDataViewSet, FileViewSet, ServeFileV... | mit | Python |
ad153499a3982182533033acfa17971a35d7a587 | implement __eq__ | mandiant/capa,mandiant/capa | capa/features/address.py | capa/features/address.py | import abc
from dncil.clr.token import Token
class Address(abc.ABC):
@abc.abstractmethod
def __eq__(self, other):
...
@abc.abstractmethod
def __lt__(self, other):
# implement < so that addresses can be sorted from low to high
...
@abc.abstractmethod
def __hash__(self... | import abc
from dncil.clr.token import Token
class Address(abc.ABC):
@abc.abstractmethod
def __lt__(self, other):
# implement < so that addresses can be sorted from low to high
...
@abc.abstractmethod
def __hash__(self):
# implement hash so that addresses can be used in sets ... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.