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 |
|---|---|---|---|---|---|---|---|---|
986bb7f8bbbb03d44905406f3ccf4373341cbb38 | Allow render_docs to be called as a shell script | moijes12/oh-mainline,nirmeshk/oh-mainline,SnappleCap/oh-mainline,eeshangarg/oh-mainline,SnappleCap/oh-mainline,campbe13/openhatch,SnappleCap/oh-mainline,heeraj123/oh-mainline,waseem18/oh-mainline,eeshangarg/oh-mainline,eeshangarg/oh-mainline,Changaco/oh-mainline,waseem18/oh-mainline,nirmeshk/oh-mainline,nirmeshk/oh-mai... | tools/render_docs.py | tools/render_docs.py | #!/usr/bin/env python
"""Generate html documentation"""
__requires__ = 'Sphinx>=1.1.2'
import sys,os,re
from pkg_resources import load_entry_point
# Allow this script to find its doc config resource
docs_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),'../docs')
sys.path.insert(0,docs_path)
import co... | """Generate html documentation"""
__requires__ = 'Sphinx>=1.1.2'
import sys,os,re
from pkg_resources import load_entry_point
# Allow this script to find its doc config resource
docs_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),'../docs')
sys.path.insert(0,docs_path)
import conf
def main(argv=None... | agpl-3.0 | Python |
574dac56e8e2d34c5d9b8d4f76917921809b4382 | add / to path to scan | bl4de/security-tools,bl4de/security-tools,bl4de/security-tools,bl4de/security-tools,bl4de/security-tools | dirscan.py | dirscan.py | #!/usr/bin/python
#
# webserver dir bruteforce scanner
#
import sys
import urllib
def scan_directory(__url, __directory):
print __url + __directory
resp = urllib.urlopen(__url + __directory)
print resp.code
if resp.code == 200:
print '\33[33m' + __url + __directory + '\33[0m'
return Tr... | #!/usr/bin/python
#
# webserver dir bruteforce scanner
#
import sys
import urllib
def scan_directory(__url, __directory):
print __url + __directory
resp = urllib.urlopen(__url + __directory)
print resp.code
if resp.code == 200:
print '\33[33m' + __url + __directory + '\33[0m'
return Tr... | mit | Python |
14a2e983502c4c36ba29307d8a67a6286960d8bb | set path and gdal_data env in wpstestclient | sradanov/flyingpigeon,KatiRG/flyingpigeon,KatiRG/flyingpigeon,sradanov/flyingpigeon,bird-house/flyingpigeon,sradanov/flyingpigeon,KatiRG/flyingpigeon,KatiRG/flyingpigeon,KatiRG/flyingpigeon,sradanov/flyingpigeon,sradanov/flyingpigeon | tests/common.py | tests/common.py | import os
import pywps
import lxml
NAMESPACES = {
'xlink': "http://www.w3.org/1999/xlink",
'wps': "http://www.opengis.net/wps/1.0.0",
'ows': "http://www.opengis.net/ows/1.1",
'gml': "http://www.opengis.net/gml",
'xsi': "http://www.w3.org/2001/XMLSchema-instance"
}
SERVICE = "http://localhost:8093/... | import os
import pywps
import lxml
NAMESPACES = {
'xlink': "http://www.w3.org/1999/xlink",
'wps': "http://www.opengis.net/wps/1.0.0",
'ows': "http://www.opengis.net/ows/1.1",
'gml': "http://www.opengis.net/gml",
'xsi': "http://www.w3.org/2001/XMLSchema-instance"
}
SERVICE = "http://localhost:8093/... | apache-2.0 | Python |
52f8d82b2c8aa165a06e71122eccfaee19fde277 | Fix a missing import | MarcMeszaros/envitro | tests/docker.py | tests/docker.py | # -*- coding: utf-8 -*-
"""Unit tests for the envitro module."""
import os
import unittest
import envitro
import envitro.docker
class TestDocker(unittest.TestCase):
def test_protocol(self):
envitro.set('DB_PORT', 'tcp://172.17.0.82:5432')
self.assertEqual(envitro.docker.protocol('DB'), 'tcp')
... | # -*- coding: utf-8 -*-
"""Unit tests for the envitro module."""
import unittest
import envitro
import envitro.docker
class TestDocker(unittest.TestCase):
def test_protocol(self):
envitro.set('DB_PORT', 'tcp://172.17.0.82:5432')
self.assertEqual(envitro.docker.protocol('DB'), 'tcp')
def test... | apache-2.0 | Python |
ed4a868443364839806694c5885cd1986363fb16 | fix undefined variables in Log.__str__ | wagtail/django-modelcluster,theju/django-modelcluster,thenewguy/django-modelcluster,torchbox/django-modelcluster | tests/models.py | tests/models.py | from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from modelcluster.tags import ClusterTaggableManager
from taggit.models import TaggedItemBase
from modelcluster.fields import ParentalKey
from modelcluster.models import ClusterableModel... | from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from modelcluster.tags import ClusterTaggableManager
from taggit.models import TaggedItemBase
from modelcluster.fields import ParentalKey
from modelcluster.models import ClusterableModel... | bsd-3-clause | Python |
7095980badfca611a1adfc8b57a7df08a3c603c6 | add some doc and comments | thefab/tornadis,thefab/tornadis | tornadis/pipeline.py | tornadis/pipeline.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of tornadis library released under the MIT license.
# See the LICENSE file for more information.
class Pipeline(object):
"""Pipeline class to stack redis commands.
A pipeline object is just a kind of stack. You stack complete redis
comma... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of tornadis library released under the MIT license.
# See the LICENSE file for more information.
class Pipeline(object):
pipelined_args = None
number_of_stacked_calls = None
def __init__(self):
self.pipelined_args = []
s... | mit | Python |
2b3e1aaab1a2aca3599026c65f0acc9a4c83065a | Remove unused import. | laurentguilbert/django-trampoline,simion/django-trampoline | trampoline/mixins.py | trampoline/mixins.py | """
Mixins for trampoline.
"""
from django.contrib.contenttypes.models import ContentType
from trampoline import get_trampoline_config
from trampoline.tasks import es_delete_doc
from trampoline.tasks import es_index_object
trampoline_config = get_trampoline_config()
class ESIndexableMixin(object):
"""
Provi... | """
Mixins for trampoline.
"""
from django.contrib.contenttypes.models import ContentType
from elasticsearch.exceptions import NotFoundError
from trampoline import get_trampoline_config
from trampoline.tasks import es_delete_doc
from trampoline.tasks import es_index_object
trampoline_config = get_trampoline_config()... | mit | Python |
769195c58b147ecafb6e595612f29e376075c131 | Update treetime/__init__.py | neherlab/treetime,neherlab/treetime | treetime/__init__.py | treetime/__init__.py | version="0.9.2"
## Here we define an error class for TreeTime errors, MissingData, UnknownMethod and NotReady errors
## are all due to incorrect calling of TreeTime functions or input data that does not fit our base assumptions.
## Errors marked as TreeTimeOtherErrors might be due to data not fulfilling base assumption... | version="0.9.2"
## Here we define an error class for TreeTime errors, MissingData, UnknownMethod and NotReady errors
## are all due to incorrect calling of TreeTime functions or input data that does not fit our base assumptions.
## Errors marked as TreeTimeOtherErrors might be due to data not fulfilling base assumption... | mit | Python |
cd513ee5fcbbd139ca1a3601df0bd6fd7d81e453 | add BoardSchema, BoardDetailsSchema and add refactor TaskSchema to include `number` field and status validation | kokimoribe/todo-api | todo/schemas.py | todo/schemas.py | """Request/Response Schemas are defined here"""
# pylint: disable=invalid-name
from marshmallow import Schema, fields, validate
from todo.constants import TO_DO, IN_PROGRESS, DONE
class TaskSchema(Schema):
"""Schema for serializing an instance of Task"""
id = fields.Int(required=True)
title = fields.Str... | """Request/Response Schemas are defined here"""
# pylint: disable=invalid-name
from marshmallow import Schema, fields
class TaskSchema(Schema):
"""Schema for api.portal.models.Panel"""
id = fields.Int(required=True)
title = fields.Str(required=True)
description = fields.Str(required=True)
status ... | mit | Python |
fa56b8a5e9b5c32726281081062a45adcd8e7ffb | Update mcmc.py | RonsenbergVI/trendpy,RonsenbergVI/trendpy | trendpy/mcmc.py | trendpy/mcmc.py | # -*- coding: utf-8 -*-
# mcmc.py
# MIT License
# Copyright (c) 2017 Rene Jean Corneille
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation ... | # mcmc.py
# MIT License
# Copyright (c) 2017 Rene Jean Corneille
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy... | mit | Python |
e5bd79a2cb80c18662a85b0fcb63b7dd8812a9ea | set var collection name on connection api | chrisdamba/mining,mining/mining,avelino/mining,seagoat/mining,mlgruby/mining,AndrzejR/mining,jgabriellima/mining,mlgruby/mining,chrisdamba/mining,avelino/mining,seagoat/mining,mining/mining,mlgruby/mining,AndrzejR/mining,jgabriellima/mining | controllers/api/connection.py | controllers/api/connection.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from bottle import Bottle
from bottle.ext.mongo import MongoPlugin
from .base import get, post, put, delete
ADMIN_BUCKET_NAME = 'openminig-admin'
collection = 'connection'
connection_app = Bottle()
mongo = MongoPlugin(uri="mongodb://127.0.0.1", db=ADMIN_BUCKET_NAME,
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from bottle import Bottle
from bottle.ext.mongo import MongoPlugin
from .base import get, post, put, delete
ADMIN_BUCKET_NAME = 'openminig-admin'
connection_app = Bottle()
mongo = MongoPlugin(uri="mongodb://127.0.0.1", db=ADMIN_BUCKET_NAME,
json_mong... | mit | Python |
81e0a52f40d2a706ff5f7a347af48637f1b439f6 | revert _case_blocks functionality in reportxform pillow | qedsoftware/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,gmimano/commcaretest,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,SEL-Co... | corehq/pillows/reportxform.py | corehq/pillows/reportxform.py | import copy
from django.conf import settings
from casexml.apps.case.xform import extract_case_blocks
from corehq.pillows.base import convert_property_dict
from .mappings.reportxform_mapping import REPORT_XFORM_INDEX, REPORT_XFORM_MAPPING
from .xform import XFormPillow
COMPUTED_CASEBLOCKS_KEY = '_case_blocks'
class R... | from django.conf import settings
from corehq.pillows.base import convert_property_dict
from .mappings.reportxform_mapping import REPORT_XFORM_INDEX, REPORT_XFORM_MAPPING
from .xform import XFormPillow
class ReportXFormPillow(XFormPillow):
"""
an extension to XFormPillow that provides for indexing of arbitrar... | bsd-3-clause | Python |
16eeb4ea9bda060389dac5c52903a7a8804c690b | add docstrings | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/util/datadog/gauges.py | corehq/util/datadog/gauges.py | from functools import wraps
from celery.task import periodic_task
from corehq.util.datadog import statsd, datadog_logger
from corehq.util.soft_assert import soft_assert
def datadog_gauge_task(name, fn, run_every, enforce_prefix='commcare'):
"""
helper for easily registering datadog gauges to run periodically
... | from functools import wraps
from celery.task import periodic_task
from corehq.util.datadog import statsd, datadog_logger
from corehq.util.soft_assert import soft_assert
def datadog_gauge_task(name, fn, run_every, enforce_prefix='commcare'):
"""
helper for easily registering datadog gauges to run periodically
... | bsd-3-clause | Python |
547f92524913f4d01094ff000ba3e3fe9d7b68a8 | Update customize.py | ayiis/webShell,ayiis/webShell | customize/python/customize.py | customize/python/customize.py | # -*- coding:utf-8 -*-
import urllib
import os
import shutil
import time
import datetime
def getDirInfo(path):
ret = {
'f': [],
'd': [],
}
pList = os.listdir(path)
for p in pList:
pp = path + p
mtime = time.localtime(os.stat(pp).st_mtime)
mtime = time.strftime('... | #
| mit | Python |
2d42e22a2fc6873821d61a63b14c66ff0a9fed3e | Remove test code. | wireservice/agate,onyxfish/agate,JoeGermuska/agate,onyxfish/journalism,flother/agate | example.py | example.py | #!/usr/bin/env python
import agate
tester = agate.TypeTester(force={
'fips': agate.Text()
})
table = agate.Table.from_csv('examples/realdata/ks_1033_data.csv', column_types=tester)
# Question 1: What was the total cost to Kansas City area counties?
# Filter to counties containing Kansas City
kansas_city = tabl... | #!/usr/bin/env python
import agate
tester = agate.TypeTester(force={
'fips': agate.Text()
})
table = agate.Table.from_csv('examples/realdata/ks_1033_data.csv', column_types=tester)
a = table.pivot('county', computation=agate.Percent('pivot'))
a.print_table(max_rows=10)
import sys
sys.exit()
# Question 1: Wha... | mit | Python |
4b5147ca4659ced9173033c5d1b9b09aa173073b | fix example.py | ashbc/pybreak | example.py | example.py | from cards import Ice, Breaker
# Example implementation for funky cards
# Subclassing would be better and would allow for grouping of similar effects
# (eg breakers that break "up to X" subroutines rather than exactly X
# (which actually turns out to be the case for most multi-sub breakers).
# this has a certain inter... |
# Example implementation for funky cards
# Subclassing would be better and would allow for grouping of similar effects
# (eg breakers that break "up to X" subroutines rather than exactly X
# (which actually turns out to be the case for most multi-sub breakers).
# this has a certain interaction with so-called "optiona... | isc | Python |
a74e91613be376d6d71fb90c15cab689af661e37 | Add __getattr__ method in order to be able to call non-defined methods | mdsrosa/money-conversion-py | money_conversion/money.py | money_conversion/money.py | from currency_rates import rates
class Money(object):
def __init__(self, amount, currency):
self.amount = amount
self.currency = currency.upper()
def __repr__(self):
return "%.2f %s" % (self.amount, self.currency)
def __getattr__(self, currency):
def convert():
... | from currency_rates import rates
class Money(object):
def __init__(self, amount, currency):
self.amount = amount
self.currency = currency.upper()
def __repr__(self):
return "%.2f %s" % (self.amount, self.currency)
def to_currency(self, new_currency):
new_currency = new_c... | mit | Python |
67afd6a7808e2d63809d08537d733c1fe740918b | Change the description | vnc-biz/openerp-server,xrg/openerp-server,MarkusTeufelberger/openobject-server,gisce/openobject-server,gisce/openobject-server,gisce/openobject-server,ovnicraft/openerp-server,MarkusTeufelberger/openobject-server,MarkusTeufelberger/openobject-server,xrg/openerp-server,splbio/openobject-server,splbio/openobject-server,o... | bin/release.py | bin/release.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistrib... | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistrib... | agpl-3.0 | Python |
20b757c31564be88a4e574661af72cbf57487858 | remove reference to celery in fabric file | Lancey6/woodwind,Lancey6/woodwind | fabfile.py | fabfile.py | from fabric.api import local, prefix, cd, run, env, lcd, sudo
env.hosts = ['orin.kylewm.com']
REMOTE_PATH = '/srv/www/kylewm.com/woodwind'
def commit():
local("git add -p")
local("git diff-index --quiet HEAD || git commit")
def push():
local("git push origin master")
def pull():
with cd(REMOTE_P... | from fabric.api import local, prefix, cd, run, env, lcd, sudo
env.hosts = ['orin.kylewm.com']
REMOTE_PATH = '/srv/www/kylewm.com/woodwind'
def commit():
local("git add -p")
local("git diff-index --quiet HEAD || git commit")
def push():
local("git push origin master")
def pull():
with cd(REMOTE_P... | bsd-2-clause | Python |
9d8e5daf88affc2d766229602067a478f105b496 | add missing import | renalreg/radar-client,renalreg/radar-client,renalreg/radar-client | fabfile.py | fabfile.py | import binascii
import os
import re
from pkg_resources import parse_version
from fabric.api import task, put, run, cd
@task
def deploy(archive=None, name='radar-client'):
if archive is None:
archive = sorted(filter(lambda x: x.endswith('.tar.gz'), os.listdir('.')), key=parse_version)[-1]
version = r... | import os
import re
from pkg_resources import parse_version
from fabric.api import task, put, run, cd
@task
def deploy(archive=None, name='radar-client'):
if archive is None:
archive = sorted(filter(lambda x: x.endswith('.tar.gz'), os.listdir('.')), key=parse_version)[-1]
version = re.search('-([^-]... | agpl-3.0 | Python |
0d9c81996e436f5f717801e8abdd6c12e9c39084 | Update fabfile | explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc | fabfile.py | fabfile.py | from fabric.api import task, local, run, lcd, cd, env
from os.path import exists as file_exists
from fabtools.python import virtualenv
from os import path
PWD = path.dirname(__file__)
VENV_DIR = path.join(PWD, '.env')
#def dev():
# # Allow this to persist, since we aren't as rigorous about keeping state clean
# ... | from fabric.api import local, run, lcd, cd, env
from os.path import exists as file_exists
from fabtools.python import virtualenv
from os import path
PWD = path.dirname(__file__)
VENV_DIR = path.join(PWD, '.env')
DEV_ENV_DIR = path.join(PWD, '.denv')
def dev():
# Allow this to persist, since we aren't as rigorou... | mit | Python |
34e7b2503f2dbd99e0a61e9fc2fa6cac8a3a69e8 | Hide qualimap's median coverage (avg. cov is reported by bcbio) | vladsaveliev/MultiQC_bcbio,MultiQC/MultiQC_bcbio,lpantano/MultiQC_bcbio | multiqc_bcbio/__init__.py | multiqc_bcbio/__init__.py | from __future__ import absolute_import
from .bcbio import MultiqcModule
from multiqc import config
# Add search patterns and config options for the things that are used in MultiQC_bcbio
def multiqc_bcbio_config():
""" Set up MultiQC config defaults for this package """
bcbio_search_patterns = {
'bcbi... | from __future__ import absolute_import
from .bcbio import MultiqcModule
from multiqc import config
# Add search patterns and config options for the things that are used in MultiQC_bcbio
def multiqc_bcbio_config():
""" Set up MultiQC config defaults for this package """
bcbio_search_patterns = {
'bcbi... | mit | Python |
cf20e89c12cf88ab57f9cdc758acbbde70282a93 | Set index_prefix to '' in CONFIG_TEMPLATE. | philipsoutham/py-mysql2pgsql | mysql2pgsql/lib/config.py | mysql2pgsql/lib/config.py | from __future__ import with_statement, absolute_import
import os.path
from yaml import load
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
from .errors import ConfigurationFileInitialized,\
ConfigurationFileNotFound
class ConfigBase(objec... | from __future__ import with_statement, absolute_import
import os.path
from yaml import load
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
from .errors import ConfigurationFileInitialized,\
ConfigurationFileNotFound
class ConfigBase(objec... | mit | Python |
9a698d1428fbe0744c9dba3532b778569dbe1dd4 | Add docstrings and author reference | facundovictor/non-blocking-socket-samples | server.py | server.py | """
A Simple Server class that allows to configure a socket in a very simple way.
It is for studying purposes only.
"""
import socket
import sys
__author__ = "Facundo Victor"
__license__ = "MIT"
__email__ = "facundovt@gmail.com"
class SimpleServer(object):
"""Simple server using the socket library"""
def ... | import socket
import sys
class SimpleServer(object):
"""Simple server using the socket library"""
def __init__(self, blocking=False, connection_oriented=True):
"""
The constructor initializes socket specifying the blocking status and
if it must be a connection oriented socket.
... | mit | Python |
195adc56728d2c0e958d81142fb3f4b90cef35ea | Make server.py work in both python 2 and 3 | colevk/dark-souls-map-viewer,colevk/dark-souls-map-viewer | server.py | server.py | #!/usr/bin/env python
from __future__ import print_function
import os
try:
# python 2
from SimpleHTTPServer import SimpleHTTPRequestHandler
from BaseHTTPServer import HTTPServer
import SimpleHTTPServer
test = SimpleHTTPServer.test
except ImportError:
# python 3
from http.server import Sim... | #!/usr/bin/env python
import os
import SimpleHTTPServer
import BaseHTTPServer
class GzipHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
We want to save space with the .iv files, so send them gzipped.
This overr... | mit | Python |
ce2b797cb61301f3e8b7f21389baa112db7c1f90 | Allow user to specify active and comment | redhat-cip/python-dciclient,redhat-cip/python-dciclient | dciclient/v1/api/jobdefinition.py | dciclient/v1/api/jobdefinition.py | # -*- encoding: utf-8 -*-
#
# Copyright 2015-2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | # -*- encoding: utf-8 -*-
#
# Copyright 2015-2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | apache-2.0 | Python |
21df1908fa019ca6ad37631888b530a4a9f5abe6 | Fix test recent files when using python runtest.py | pyQode/pyqode.core,pyQode/pyqode.core,zwadar/pyqode.core | test/test_widgets/test_recent_files.py | test/test_widgets/test_recent_files.py | import pytest
from pyqode.core.widgets import RecentFilesManager, MenuRecentFiles
import pyqode.core
def test_open_file():
manager = RecentFilesManager('pyQode', 'test')
manager.clear()
assert manager.last_file() is None
manager.open_file(__file__)
assert len(manager.get_recent_files()) == 1
... | import pytest
from pyqode.core.widgets import RecentFilesManager, MenuRecentFiles
import pyqode.core
def test_open_file():
manager = RecentFilesManager('pyQode', 'test')
manager.clear()
assert manager.last_file() is None
manager.open_file(__file__)
assert len(manager.get_recent_files()) == 1
a... | mit | Python |
40869b7aa7001f26a76e4849f6bf604bf6056462 | Increase version number | sebest/py2loggly | py2loggly/__init__.py | py2loggly/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Sebastien Estienne'
__email__ = 'sebastien.estienne@gmail.com'
__version__ = '1.1.1'
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Sebastien Estienne'
__email__ = 'sebastien.estienne@gmail.com'
__version__ = '0.2'
| mit | Python |
197fcfb88a034b0a12c841da3e06d7d8c37e55af | bump dev version after 0.17.1 tag | desihub/desisim,desihub/desisim | py/desisim/_version.py | py/desisim/_version.py | __version__ = '0.17.1.dev753'
| __version__ = '0.17.1'
| bsd-3-clause | Python |
27d3b463896b2bf04e22f49952746a368e4904e0 | FIX remove coma at end of line | acsone/bank-payment,hbrunn/bank-payment,diagramsoftware/bank-payment,CompassionCH/bank-payment,CompassionCH/bank-payment,open-synergy/bank-payment | account_payment_partner/wizard/payment_order_create.py | account_payment_partner/wizard/payment_order_create.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Account Payment Partner module for Odoo
# Copyright (C) 2014-2015 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can... | # -*- coding: utf-8 -*-
##############################################################################
#
# Account Payment Partner module for Odoo
# Copyright (C) 2014-2015 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can... | agpl-3.0 | Python |
c07ee0cc90c32e842b0a3b0eed203f2cb2161188 | Bump version | mesnardo/snake | snake/version.py | snake/version.py | # file: version.py
# author: Olivier Mesnard (mesnardo@gwu.edu)
# description: Set up the version.
import os
_version_major = 0
_version_minor = 1
_version_micro = '2'
_version_extra = 'dev'
# construct full version string
_ver = [_version_major, _version_minor]
if _version_micro:
_ver.append(_version_micro)
if ... | # file: version.py
# author: Olivier Mesnard (mesnardo@gwu.edu)
# description: Set up the version.
import os
_version_major = 0
_version_minor = 1
_version_micro = '1'
_version_extra = 'dev'
# construct full version string
_ver = [_version_major, _version_minor]
if _version_micro:
_ver.append(_version_micro)
if ... | mit | Python |
3a4cfdfbb6f14e5f54b3ac3a57cb13ac1dfd40f9 | Remove 'punkt_word_tokenize' from tokenize.__all__. This function should not be necessary. | nltk/nltk,nltk/nltk,nltk/nltk | nltk/tokenize/__init__.py | nltk/tokenize/__init__.py | # Natural Language Toolkit: Tokenizers
#
# Copyright (C) 2001-2008 NLTK Project
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# Steven Bird <sb@csse.unimelb.edu.au> (minor additions)
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Functions for X{tokenizing}, i.e., dividi... | # Natural Language Toolkit: Tokenizers
#
# Copyright (C) 2001-2008 NLTK Project
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# Steven Bird <sb@csse.unimelb.edu.au> (minor additions)
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Functions for X{tokenizing}, i.e., dividi... | apache-2.0 | Python |
e692b2f3dc7e45c389f6a4a1969229fd04f617f7 | Fix up IO-to-pin iterable lists. | synapse-wireless/pyduino-includes | pyduinoincludes/io.py | pyduinoincludes/io.py | # Copyright (C) 2016 Synapse Wireless, Inc.
# Subject to your agreement of the disclaimer set forth below, permission is given by Synapse Wireless, Inc. ("Synapse") to you to freely modify, redistribute or include this SNAPpy code in any program. The purpose of this code is to help you understand and learn about SNAPpy... | # Copyright (C) 2016 Synapse Wireless, Inc.
# Subject to your agreement of the disclaimer set forth below, permission is given by Synapse Wireless, Inc. ("Synapse") to you to freely modify, redistribute or include this SNAPpy code in any program. The purpose of this code is to help you understand and learn about SNAPpy... | apache-2.0 | Python |
cb876e51d18c17efb662e1725a8ae6206f2d8e9f | update __init__.py file | christophreimer/pygeobase | pygeobase/__init__.py | pygeobase/__init__.py | import pkg_resources
try:
__version__ = pkg_resources.get_distribution(__name__).version
except:
__version__ = 'unknown'
| from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
| bsd-3-clause | Python |
5b5f2b05251b991620c29316dbfeac52f8cfa119 | Update helper example/callback.py with some output verbose | JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton | examples/callback.py | examples/callback.py |
from triton import *
# Output
#
# TID (0) 0x40056d push rbp
# TID (0) 0x40056e mov rbp, rsp
# TID (0) 0x400571 mov qword ptr [rbp-0x18], rdi
# TID (0) 0x400575 mov dword ptr [rbp-0x4], 0x0
# TID (0) 0x40057c jmp 0x4005bd
# TID (0) 0x4005bd cmp dword ptr [rbp-0x4], 0x4
# TID (0) 0x4005c1 jle 0x40057e
# TID (0) 0x40057... |
from triton import *
def my_callback_before(instruction):
print 'TID (%d) %#x %s' %(instruction['threadId'], instruction['address'], instruction['assembly'])
if __name__ == '__main__':
# Start the symbolic analysis from the 'check' function
startAnalysisFromSymbol('check')
# Add a callback
ad... | apache-2.0 | Python |
b9f8d73c984e21915a60d986d5f49fb4b2cb7470 | Update defaults.py | gemalto/pycryptoki | pycryptoki/defaults.py | pycryptoki/defaults.py | """
A file containing commonly used strings or other data similar to a config file
"""
# The location of the cryptoki file, if specified as None the environment variable
# ChrystokiConfigurationPath will be used or it will revert to using /etc/Chrystoki.conf
import os
CHRYSTOKI_CONFIG_FILE = None
# The location of t... | """
A file containing commonly used strings or other data similar to a config file
"""
# The location of the cryptoki file, if specified as None the environment variable
# ChrystokiConfigurationPath will be used or it will revert to using /etc/Chrystoki.conf
import os
CHRYSTOKI_CONFIG_FILE = None
# The location of t... | apache-2.0 | Python |
26df9fbabc1bc23644fede1cee4405454ea73b0d | Optimize SDE integration | kpj/SDEMotif,kpj/SDEMotif | solver.py | solver.py | """
Solve stochastic differential equation
"""
import numpy as np
import numpy.random as npr
def solve_system(system, tmax=50, dt=0.1, seed=None):
""" Solve stochastic differential equation (SDE)
"""
J = system.jacobian
D = system.fluctuation_vector
E = system.external_influence
dim = J.shape... | """
Solve stochastic differential equation
"""
import numpy as np
import numpy.random as npr
def solve_system(system, tmax=50, dt=0.1, seed=None):
""" Solve stochastic differential equation (SDE)
"""
J = system.jacobian
D = system.fluctuation_vector
E = system.external_influence
eq = lambda ... | mit | Python |
9d57de48f4b786ac746be0190f6e21bfecfa165b | Extend variance to 99.9%. | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment | analysis/compress-jacobians.py | analysis/compress-jacobians.py | #!/usr/bin/env python
import climate
import joblib
import lmj.pca
import numpy as np
import os
import database
logging = climate.get_logger('compress')
def extract(trial, prefix):
trial.load()
cols = [c for c in trial.df.columns if c.startswith(prefix)]
return trial.df[cols].values
@climate.annotate(... | #!/usr/bin/env python
import climate
import joblib
import lmj.pca
import numpy as np
import os
import database
logging = climate.get_logger('compress')
def jac(trial, prefix):
trial.load()
cols = [c for c in trial.df.columns if c.startswith(prefix)]
return trial.df[cols].values
@climate.annotate(
... | mit | Python |
5657c925e5693931320b4eb5738e332d5899120d | Improve EvaluationFactory | SCUEvals/scuevals-api,SCUEvals/scuevals-api | tests/fixtures/factories/evaluation.py | tests/fixtures/factories/evaluation.py | import factory
from .professor import ProfessorFactory
from .section import SectionFactory
from .student import StudentFactory
from scuevals_api import models
from scuevals_api.resources.evaluations import EvaluationSchemaV1
eval_v1_data = {
'attitude': 1,
'availability': 1,
'clarity': 1,
'grading_spe... | import factory
from .professor import ProfessorFactory
from .section import SectionFactory
from .student import StudentFactory
from scuevals_api import models
class EvaluationFactory(factory.alchemy.SQLAlchemyModelFactory):
class Meta:
model = models.Evaluation
sqlalchemy_session = models.db.sess... | agpl-3.0 | Python |
6c2c40e5e5915f1ebed1302933d6257a14e163d9 | Fix accidental conflict diff | spool/django-allauth,spool/django-allauth,spool/django-allauth | allauth/socialaccount/providers/eventbrite/provider.py | allauth/socialaccount/providers/eventbrite/provider.py | """Customise Provider classes for Eventbrite API v3."""
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class EventbriteAccount(ProviderAccount):
"""ProviderAccount subclass for Eventbrite."""
def get_avatar_url(self... | """Customise Provider classes for Eventbrite API v3."""
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class EventbriteAccount(ProviderAccount):
"""ProviderAccount subclass for Eventbrite."""
def get_avatar_url(self... | mit | Python |
de611106429ef9c6cfbc13e48cee5e88affe7ab8 | Modify models.py | NTsystems/NoTes-API,NTsystems/NoTes-API,NTsystems/NoTes-API | notes/apps/auth/models.py | notes/apps/auth/models.py | from django.db import models
from django.contrib.auth.models import AbstractBaseUser
class User(AbstractBaseUser):
password = models.CharField(_('password'), max_length=50)
e_mail = models.EmailField(unique=True)
is_admin = models.BooleanField(default=False)
USERNAME_FIELD = 'e_mail'
REQUIRED_FIE... | from django.db import models
from django.contrib.auth.models import AbstractBaseUser
class User(AbstractBaseUser):
username = models.CharField(max_length=30, unique=True)
password = models.CharField(max_length=30)
is_admin = models.BooleanField(default=False)
USERNAME_FIELD = 'username'
REQUIRED_... | mit | Python |
5af50ae039c72b495ba0dff12cdfca4e1adf6769 | Add a TODO to sharding | LPgenerator/django-cacheops,Suor/django-cacheops | cacheops/sharding.py | cacheops/sharding.py | from funcy import cached_property
from django.core.exceptions import ImproperlyConfigured
from .conf import settings
def get_prefix(**kwargs):
return settings.CACHEOPS_PREFIX(PrefixQuery(**kwargs))
class PrefixQuery(object):
def __init__(self, **kwargs):
assert set(kwargs) <= {'func', '_queryset', ... | from funcy import cached_property
from django.core.exceptions import ImproperlyConfigured
from .conf import settings
def get_prefix(**kwargs):
return settings.CACHEOPS_PREFIX(PrefixQuery(**kwargs))
class PrefixQuery(object):
def __init__(self, **kwargs):
assert set(kwargs) <= {'func', '_queryset', ... | bsd-3-clause | Python |
f637b84a0ec13fdae1e91030161afb0e59bcbabc | remove unused var | dankilman/pysource,dankilman/pysource | pysource/arguments.py | pysource/arguments.py | # Copyright 2014 Dan Kilman
#
# 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, softw... | # Copyright 2014 Dan Kilman
#
# 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, softw... | apache-2.0 | Python |
9275eb01ef0bcdcefb46eb936d6a85c921e92e9f | make the void return type not return an explicit Py_None, to prevent a bug hwere None is being returned as first element of tuple when there are out/inout parameters | ftalbrecht/pybindgen,gjcarneiro/pybindgen,ftalbrecht/pybindgen,cawka/pybindgen-old,gjcarneiro/pybindgen,ftalbrecht/pybindgen,gjcarneiro/pybindgen,gjcarneiro/pybindgen,ftalbrecht/pybindgen,cawka/pybindgen-old,cawka/pybindgen-old,cawka/pybindgen-old | pybindgen/typehandlers/voidtype.py | pybindgen/typehandlers/voidtype.py | # docstrings not neede here (the type handler interfaces are fully
# documented in base.py) pylint: disable-msg=C0111
from base import ReturnValue
class VoidReturn(ReturnValue):
CTYPES = ['void']
def get_c_error_return(self):
return "return;"
def convert_python_to_c(self, wrapper):
... | # docstrings not neede here (the type handler interfaces are fully
# documented in base.py) pylint: disable-msg=C0111
from base import ReturnValue
class VoidReturn(ReturnValue):
CTYPES = ['void']
def get_c_error_return(self):
return "return;"
def convert_python_to_c(self, wrapper):
... | lgpl-2.1 | Python |
47c65ea8a642e7e7494cc403c00158b90ad359a5 | Delete debug message from theano_functions.py | nkoep/pymanopt,tingelst/pymanopt,pymanopt/pymanopt,nkoep/pymanopt,nkoep/pymanopt,j-towns/pymanopt,pymanopt/pymanopt | pymanopt/tools/theano_functions.py | pymanopt/tools/theano_functions.py | """
Module containing functions to compile and differentiate Theano graphs. Part of
the pymanopt package.
Jamie Townsend December 2014
"""
import theano.tensor as T
import theano
from warnings import warn
def compile(objective, argument):
"""
Wrapper for the theano.function(). Compiles a theano graph into a... | """
Module containing functions to compile and differentiate Theano graphs. Part of
the pymanopt package.
Jamie Townsend December 2014
"""
import theano.tensor as T
import theano
from warnings import warn
def compile(objective, argument):
"""
Wrapper for the theano.function(). Compiles a theano graph into a... | bsd-3-clause | Python |
e39fbef683e0541f8cc189aa8a612f8008a98410 | Add function to load converted lidar records | oliverlee/antlia | python/antlia/dtype.py | python/antlia/dtype.py | # -*- coding: utf-8 -*-
import gzip
import pickle
import numpy as np
LIDAR_NUM_ANGLES = 1521
LIDAR_FOV_DEG = 190
LIDAR_SAMPLE_RATE = 20
LIDAR_ANGLES = np.linspace( # in radians
(90 - LIDAR_FOV_DEG/2)*np.pi/180,
(90 + LIDAR_FOV_DEG/2)*np.pi/180,
LIDAR_NUM_ANGLES
)
"""LIDAR datatype format is:
(
... | # -*- coding: utf-8 -*-
import numpy as np
LIDAR_NUM_ANGLES = 1521
LIDAR_FOV_DEG = 190
LIDAR_SAMPLE_RATE = 20
LIDAR_ANGLES = np.linspace( # in radians
(90 - LIDAR_FOV_DEG/2)*np.pi/180,
(90 + LIDAR_FOV_DEG/2)*np.pi/180,
LIDAR_NUM_ANGLES
)
"""LIDAR datatype format is:
(
timestamp (long),
... | bsd-2-clause | Python |
5f501af61b416dae0e46236a8e1f9684dcc66e21 | Write out concatenated frame on decode test failure | scanner-research/scanner,scanner-research/scanner,scanner-research/scanner,scanner-research/scanner | python/decoder_test.py | python/decoder_test.py | import argparse
import scanner
import numpy as np
import cv2
from decode import db
@db.loader('frame')
def load_frames(buf, metadata):
return np.frombuffer(buf, dtype=np.uint8) \
.reshape((metadata.height,metadata.width,3))
def extract_frames(args):
job = load_frames(args['dataset'], 'edr')
v... | import argparse
import scanner
import numpy as np
import cv2
from decode import db
@db.loader('frame')
def load_frames(buf, metadata):
return np.frombuffer(buf, dtype=np.uint8) \
.reshape((metadata.height,metadata.width,3))
def extract_frames(args):
job = load_frames(args['dataset'], 'edr')
v... | apache-2.0 | Python |
21140c20c62fb90806f77f0820a046e364567a6d | fix tune stopper attribute name (#28517) | ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray,ray-project/ray | python/ray/tune/stopper/stopper.py | python/ray/tune/stopper/stopper.py | import abc
from ray.util.annotations import PublicAPI
@PublicAPI
class Stopper(abc.ABC):
"""Base class for implementing a Tune experiment stopper.
Allows users to implement experiment-level stopping via ``stop_all``. By
default, this class does not stop any trials. Subclasses need to
implement ``__c... | import abc
from ray.util.annotations import PublicAPI
@PublicAPI
class Stopper(abc.ABC):
"""Base class for implementing a Tune experiment stopper.
Allows users to implement experiment-level stopping via ``stop_all``. By
default, this class does not stop any trials. Subclasses need to
implement ``__c... | apache-2.0 | Python |
eb3aed68e470e44c26bcf4d2973f204be8bff6cd | Delete unnecessary comma. | sony/nnabla,sony/nnabla,sony/nnabla | python/test/function/test_round.py | python/test/function/test_round.py | # Copyright (c) 2017 Sony Corporation. 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 applicabl... | # Copyright (c) 2017 Sony Corporation. 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 applicabl... | apache-2.0 | Python |
ddecbb79f995cfac469d121d71cbdc6941f6cfef | delete for user api | ironcamel/openstack.api,ntt-pf-lab/backup_openstackx | openstack/extras/users.py | openstack/extras/users.py | from openstack.api import base
class User(base.Resource):
def __repr__(self):
return "<User %s>" % self._info
def delete(self):
self.manager.delete(self)
def update(self, description=None, enabled=None):
description = description or self.description or '(none)'
self.manag... | from openstack.api import base
class User(base.Resource):
def __repr__(self):
return "<User %s>" % self._info
def delete(self):
self.manager.delete(self)
def update(self, description=None, enabled=None):
description = description or self.description or '(none)'
self.manag... | bsd-3-clause | Python |
c35021091ee308c1be999b2a2a479dd83753cf98 | correct urls include statement | joaquimrocha/Rancho,joaquimrocha/Rancho,joaquimrocha/Rancho | rancho/project/urls.py | rancho/project/urls.py | ########################################################################
# Rancho - Open Source Group/Project Management Tool
# Copyright (C) 2008 The Rancho Team
#
# 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 t... | ########################################################################
# Rancho - Open Source Group/Project Management Tool
# Copyright (C) 2008 The Rancho Team
#
# 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 t... | agpl-3.0 | Python |
46da58250234b1d7351fbb318d318a5a7f5552f2 | Remove binaural models from __init__ file | achabotl/pambox | pambox/speech/__init__.py | pambox/speech/__init__.py | """
The :mod:`pambox.speech` module gather speech intelligibility
models, a framework to run intelligibility experiments, as well as a wrapper
around speech materials.
"""
from __future__ import absolute_import
from .sepsm import Sepsm
from .mrsepsm import MrSepsm
from .sii import Sii
from .stec import Stec
from .mate... | """
The :mod:`pambox.speech` module gather speech intelligibility
models, a framework to run intelligibility experiments, as well as a wrapper
around speech materials.
"""
from __future__ import absolute_import
from .binauralsepsm import BinauralSepsm
from .binauralmrsepsm import BinauralMrSepsm
from .sepsm import Sep... | bsd-3-clause | Python |
64ba451049c614eb14d336c2e7989ffaa81b2bb5 | make StreamConsumedError doubly inherit | psf/requests | requests/exceptions.py | requests/exceptions.py | # -*- coding: utf-8 -*-
"""
requests.exceptions
~~~~~~~~~~~~~~~~~~~
This module contains the set of Requests' exceptions.
"""
from .packages.urllib3.exceptions import HTTPError as BaseHTTPError
class RequestException(IOError):
"""There was an ambiguous exception that occurred while handling your
request.""... | # -*- coding: utf-8 -*-
"""
requests.exceptions
~~~~~~~~~~~~~~~~~~~
This module contains the set of Requests' exceptions.
"""
from .packages.urllib3.exceptions import HTTPError as BaseHTTPError
class RequestException(IOError):
"""There was an ambiguous exception that occurred while handling your
request.""... | apache-2.0 | Python |
952b21499759ed727e2185261192e6839ed95221 | improve code for getting history from params | shimniok/rockblock,shimniok/rockblock,shimniok/rockblock | status.py | status.py | #!/usr/bin/env python
import math
import cgi
#import cgitb; cgitb.enable() # for troubleshooting
import json
import csv
import config
print "Content-type: application/json"
print
result = [];
form = cgi.FieldStorage()
try:
maximum = int(form.getvalue("history"))
except:
maximum = 1
# TODO: revise to use logfi... | #!/usr/bin/env python
import math
import cgi
#import cgitb; cgitb.enable() # for troubleshooting
import json
import csv
import config
print "Content-type: application/json"
print
result = [];
form = cgi.FieldStorage()
history = form.getvalue("history")
if history == None:
maximum = 1
else:
maximum = int(histor... | mit | Python |
a09c4bac6e65bb5847f0878822a23235d7f52d51 | Remove all index operations | jrasky/planetlabs-challenge | stocks.py | stocks.py | #!/usr/bin/env python
def find_profit(prices, window):
pivot = None
pivot_price = None
next_pivot = None
next_price = None
profit = 0
for i, price in enumerate(prices):
if pivot is None or price < pivot_price:
pivot = i
pivot_price = price
if pivot ... | #!/usr/bin/env python
def find_profit(prices, window):
pivot = None
next_pivot = None
profit = 0
for i, price in enumerate(prices):
if pivot is None or price < prices[pivot]:
pivot = i
next_pivot = max(next_pivot, pivot + 1)
if pivot != i and (next_pivot is No... | mit | Python |
af074f6c1cae0521cdcb135f9413a5b9e1808d44 | fix broken method enqueue | fedusia/python | data_structs/queue.py | data_structs/queue.py | #!/usr/bin/env python3
''' Linear queue '''
class Queue:
def __init__(self, items=[]):
self.items = items
def is_Empty(self):
return self.items == []
def size(self):
return len(self.items)
def enqueue(self, item):
self.items.insert(0, item)
def dequeue(self):
... | #!/usr/bin/env python3
''' Linear queue '''
class Queue:
def __init__(self, items=[]):
self.items = items
def is_Empty(self):
return self.items == []
def size(self):
return len(self.items)
def enqueue(self, item):
self.Queue.insert(0, item)
def dequeue(self):
... | apache-2.0 | Python |
e2cba02550dfbe8628daf024a2a35c0dffb234e9 | Handle different environments, for automation (I4). | rroart/aether,rroart/aether,rroart/aether,rroart/aether,rroart/aether | python/cli/request.py | python/cli/request.py | import requests
import os
aport = os.environ.get('MYAPORT')
if aport is None:
aport = "80"
aport = "23456"
ahost = os.environ.get('MYAHOST')
if ahost is None:
ahost = "localhost"
url1 = 'http://' + ahost + ':' + aport + '/'
#headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
#hea... | import requests
import os
aport = os.environ.get('MYAPORT')
if aport is None:
aport = "80"
aport = "23456"
url1 = 'http://localhost:' + aport + '/'
url2 = 'http://localhost:' + aport + '/action/improvesimulateinvest'
url3 = 'http://localhost:' + aport + '/action/autosimulateinvest'
url4 = 'http://localhost:' + a... | agpl-3.0 | Python |
de2831df77928523bb58aeb8faa96fbf3d56d4f5 | use renamed package | rdeits/iris,rdeits/iris,rdeits/iris,rdeits/iris | python/irispy/iris.py | python/irispy/iris.py | from __future__ import division
import numpy as np
from irispy.hyperplanes import compute_obstacle_planes
from irispy.mosek_ellipsoid.lownerjohn_ellipsoid import lownerjohn_inner
def inflate_region(obstacle_pts, A_bounds, b_bounds, start, require_containment=False):
A_bounds = np.array(A_bounds)
b_bounds = n... | from __future__ import division
import numpy as np
from irispy.hyperplanes import compute_obstacle_planes
from irispy.mosek.lownerjohn_ellipsoid import lownerjohn_inner
def inflate_region(obstacle_pts, A_bounds, b_bounds, start, require_containment=False):
A_bounds = np.array(A_bounds)
b_bounds = np.array(b_... | bsd-2-clause | Python |
c15b51b93d21673e67975ffcd9a071aacb197975 | Add `app_name` to urls.py for Django v2 | pinax/pinax-invitations,eldarion/kaleo | pinax/invitations/urls.py | pinax/invitations/urls.py | from django.conf.urls import url
from .views import (
AddToAllView,
AddToUserView,
InviteView,
TopOffAllView,
InviteStatView,
TopOffUserView
)
app_name = "pinax_invitations"
urlpatterns = [
url(r"^invite/$", InviteView.as_view(), name="invite"),
url(r"^invite-stat/(?P<pk>\d+)/$", Invi... | from django.conf.urls import url
from .views import (
AddToAllView,
AddToUserView,
InviteView,
TopOffAllView,
InviteStatView,
TopOffUserView
)
urlpatterns = [
url(r"^invite/$", InviteView.as_view(), name="invite"),
url(r"^invite-stat/(?P<pk>\d+)/$", InviteStatView.as_view(), name="inv... | unknown | Python |
059780cb468042327caf7ff55f29702f3de4d98f | Change formatting. | Aegis8/utility-fabfiles | checksite/fabfile.py | checksite/fabfile.py | ## Check if a website is up from two different locations, eg. localhost and a remote host.
## Used to confirm if an alert is valid or not.
## Normal curl result is displayed from each host.
## Usage: run fab checksite
## Import Fabric's API module
from fabric.api import *
##Get required info
##User can be hard-code... | ## Check if a website is up from two different locations, eg. localhost and a remote host.
## Used to confirm if an alert is valid or not.
## Normal curl result is displayed from each host.
## Usage: run fab checksite
## Import Fabric's API module
from fabric.api import *
##Get required info
##User can be hard-code... | mit | Python |
5edb070308e2597047f82ecb44cb84b314b488c9 | Use blank string instead of None as default origin | crodjer/qotr,sbuss/qotr,crodjer/qotr,sbuss/qotr,rmoorman/qotr,curtiszimmerman/qotr,curtiszimmerman/qotr,sbuss/qotr,rmoorman/qotr,crodjer/qotr,sbuss/qotr,curtiszimmerman/qotr,rmoorman/qotr,crodjer/qotr,curtiszimmerman/qotr,rmoorman/qotr | qotr/handlers/base.py | qotr/handlers/base.py | import logging
from fnmatch import fnmatch
from tornado import web
from qotr.config import config
L = logging.getLogger(__name__)
ALLOWED_ORIGINS = [o.strip() for o in config.allowed_origin.split(',')]
def set_cors_headers(handler):
'''
Given a handler, set the CORS headers on it.
'''
origin = hand... | import logging
from fnmatch import fnmatch
from tornado import web
from qotr.config import config
L = logging.getLogger(__name__)
ALLOWED_ORIGINS = [o.strip() for o in config.allowed_origin.split(',')]
def set_cors_headers(handler):
'''
Given a handler, set the CORS headers on it.
'''
origin = hand... | agpl-3.0 | Python |
1fdf1f4693ac17e41fce64b2d708102903bdf0ab | Support for magnet uris. | bittorrent/btc | btc/btc_add.py | btc/btc_add.py | import argparse
import time
import hashlib
import os
from . import btclient
from . import utils
from .bencode import bdecode, bencode
from .btc import encoder, decoder, client, error
_description = 'add torrent to client'
def main():
parser = argparse.ArgumentParser()
parser.add_argument('value')
group = ... | import argparse
import time
import hashlib
import os
from . import btclient
from . import utils
from .bencode import bdecode, bencode
from .btc import encoder, decoder, client, error
_description = 'add torrent to client'
def main():
parser = argparse.ArgumentParser()
parser.add_argument('value')
group = ... | mit | Python |
26205e73a7fc9651cbbd36c911bdd834f377d335 | Add some more searchengines | The-Compiler/dotfiles,The-Compiler/dotfiles,The-Compiler/dotfiles | qutebrowser/config.py | qutebrowser/config.py | config.load_autoconfig()
c.tabs.background = True
c.new_instance_open_target = 'window'
c.downloads.position = 'bottom'
c.spellcheck.languages = ['en-US']
config.bind(',ce', 'config-edit')
config.bind(',p', 'config-cycle -p content.plugins ;; reload')
config.bind(',rta', 'open {url}top/?sort=top&t=all')
config.bind(... | config.load_autoconfig()
c.tabs.background = True
c.new_instance_open_target = 'window'
c.downloads.position = 'bottom'
c.spellcheck.languages = ['en-US']
config.bind(',ce', 'config-edit')
config.bind(',p', 'config-cycle -p content.plugins ;; reload')
config.bind(',rta', 'open {url}top/?sort=top&t=all')
config.bind(... | mit | Python |
b0631bdf88a6c86c0dd1c2bffe65b5bb7dbd9d5d | Bump version | dstufft/recliner | recliner/__about__.py | recliner/__about__.py | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
__all__ = [
"__title__", "__summary__", "__uri__", "__version__", "__author__",
"__email__", "__license__", "__copyright__",
]
__title__ = "recliner"
__summary__ = ""
__uri__ = "https://github.com/cr... | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
__all__ = [
"__title__", "__summary__", "__uri__", "__version__", "__author__",
"__email__", "__license__", "__copyright__",
]
__title__ = "recliner"
__summary__ = ""
__uri__ = "https://github.com/cr... | bsd-2-clause | Python |
c88e18d722fbcc5692010a2e4d672657994a13a4 | Add System Checks for requirements | fdroidtravis/repomaker,fdroidtravis/repomaker,fdroidtravis/repomaker,fdroidtravis/repomaker | repomaker/__init__.py | repomaker/__init__.py | import os
import sys
from django.core.checks import Error, register
from fdroidserver import common
from fdroidserver.exception import FDroidException
# The name of the default user. Please DO NOT CHANGE
DEFAULT_USER_NAME = 'user'
def runserver():
execute([sys.argv[0], 'migrate']) # TODO move into package hook... | import os
import sys
# The name of the default user. Please DO NOT CHANGE
DEFAULT_USER_NAME = 'user'
def runserver():
execute([sys.argv[0], 'migrate']) # TODO move into package hook?
if len(sys.argv) <= 1 or sys.argv[1] != 'runserver':
sys.argv = sys.argv[:1] + ['runserver'] + sys.argv[1:]
execu... | agpl-3.0 | Python |
389f41b66aa83d802c88fc6205e6a697fafd77a5 | add docopt and an option to specify destination dir for media files | rsalmond/headline_news_podcasts,rsalmond/headline_news_podcasts | grabber.py | grabber.py | """
A very simple podcast grabber
Usage:
grabber.py [options]
Options:
--help
--dest=<location> Where to put downloaded files, default is CWD
"""
import feedparser
import requests
from docopt import docopt
import os
def dload(download_dir, url, status=True):
""" I use this code snippet so often ... | import feedparser
import requests
import os
working_dir = './working'
def dload(url):
tmp = url.split('/')
filename = tmp[len(tmp) - 1]
response = requests.get(url, stream=True)
with open(os.path.join(working_dir, filename), 'wb') as f:
for chunk in response.iter_content(chunk_size=1024):
... | unlicense | Python |
5bb46586a6bb87ad732310b81a9e14ef388e6711 | return 0 for patients with neoantigens | hammerlab/cohorts,hammerlab/cohorts | cohorts/functions.py | cohorts/functions.py | # Copyright (c) 2016. Mount Sinai School of Medicine
#
# 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 o... | # Copyright (c) 2016. Mount Sinai School of Medicine
#
# 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 o... | apache-2.0 | Python |
f9e1dd68d5f57f75da73e6d3cf4b18d815de4c2f | Remove clutter from available_algorithms | TheReverend403/Pyper,TheReverend403/Pyper | commands/cmd_hash.py | commands/cmd_hash.py | import hashlib
from lib.command import Command
class HashCommand(Command):
name = 'hash'
description = 'Hashes text.'
def run(self, message, args):
# Remove duplicates
available_algorithms = hashlib.algorithms_guaranteed
if not args or len(args) < 2:
self.reply(messag... | import hashlib
from lib.command import Command
class HashCommand(Command):
name = 'hash'
description = 'Hashes text.'
def run(self, message, args):
# Remove duplicates
available_algorithms = list(set(x.lower() for x in hashlib.algorithms_available))
if not args or len(args) < 2:
... | agpl-3.0 | Python |
99115b69871033c08b4fb88b55960ec03e5bb353 | Fix filter problems | fniephaus/alfred-gmail | src/gmail.py | src/gmail.py | import datetime
import sys
from gmail_refresh import refresh_cache
from workflow import Workflow, PasswordNotFound, MATCH_SUBSTRING
from workflow.background import run_in_background, is_running
def main(wf):
if len(wf.args):
query = wf.args[0]
else:
query = None
if not wf.cached_data_fre... | import datetime
import sys
from gmail_refresh import refresh_cache
from workflow import Workflow, PasswordNotFound, MATCH_SUBSTRING
from workflow.background import run_in_background, is_running
def search_key_for_mail(mail):
elements = []
elements.append(mail['From'])
elements.append(mail['snippet'])
... | mit | Python |
9faf52229e96000c2dbb79f2f4a1964751283b83 | upgrade version | DataCanvasIO/pyDataCanvas | datacanvas/version.py | datacanvas/version.py | version = "0.5.0"
| version = "0.4.9"
| apache-2.0 | Python |
6cfcf5ea2c4f1f53b7aa40ab503cd21392f444d1 | bump hotfix version to 1.0.1 | emory-libraries/ddi-search,emory-libraries/ddi-search | ddisearch/__init__.py | ddisearch/__init__.py | # file ddisearch/__init__.py
#
# Copyright 2014 Emory University
#
# 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 appli... | # file ddisearch/__init__.py
#
# Copyright 2014 Emory University
#
# 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 appli... | apache-2.0 | Python |
5dcd279434d0ab87409c699b9ed6f594ffdb61f5 | Update script to get location -add rate limiting -add bucket location caching | samchrisinger/osf.io,Johnetordoff/osf.io,DanielSBrown/osf.io,brianjgeiger/osf.io,mluo613/osf.io,DanielSBrown/osf.io,chrisseto/osf.io,felliott/osf.io,hmoco/osf.io,monikagrabowska/osf.io,adlius/osf.io,Nesiehr/osf.io,leb2dg/osf.io,alexschiller/osf.io,pattisdr/osf.io,amyshi188/osf.io,erinspace/osf.io,TomBaxter/osf.io,Johne... | scripts/s3/migrate_folder_language.py | scripts/s3/migrate_folder_language.py | import logging
import sys
import time
from modularodm import Q
from framework.mongo import database
from framework.transactions.context import TokuTransaction
from website.app import init_app
from website.addons.base.exceptions import InvalidAuthError, InvalidFolderError
from website.addons.s3.utils import get_bucke... | import logging
import sys
from modularodm import Q
from framework.mongo import database
from framework.transactions.context import TokuTransaction
from website.app import init_app
from scripts import utils as script_utils
logger = logging.getLogger(__name__)
def migrate(dry_run=False):
sns_collection = databas... | apache-2.0 | Python |
934a8cb077c733542f01da2312c3084559c2271c | remove obsolete KBUILD_VERBOSE | galak/zephyr,punitvara/zephyr,explora26/zephyr,zephyriot/zephyr,zephyrproject-rtos/zephyr,kraj/zephyr,Vudentz/zephyr,mbolivar/zephyr,aceofall/zephyr-iotos,explora26/zephyr,ldts/zephyr,GiulianoFranchetto/zephyr,punitvara/zephyr,mbolivar/zephyr,GiulianoFranchetto/zephyr,zephyriot/zephyr,finikorg/zephyr,Vudentz/zephyr,zep... | scripts/support/zephyr_flash_debug.py | scripts/support/zephyr_flash_debug.py | #! /usr/bin/env python3
# Copyright (c) 2017 Linaro Limited.
#
# SPDX-License-Identifier: Apache-2.0
"""Zephyr flash/debug script
This script is a transparent replacement for legacy Zephyr flash and
debug scripts which have now been removed. It will be refactored over
time as the rest of the build system is taught t... | #! /usr/bin/env python3
# Copyright (c) 2017 Linaro Limited.
#
# SPDX-License-Identifier: Apache-2.0
"""Zephyr flash/debug script
This script is a transparent replacement for legacy Zephyr flash and
debug scripts which have now been removed. It will be refactored over
time as the rest of the build system is taught t... | apache-2.0 | Python |
952841ab7df91533b03fe590fd8f4d88a35f1441 | Fix a copy-and-paste bug in the seattlegeni statistics module just added. | sburnett/seattle,sburnett/seattle,sburnett/seattle,sburnett/seattle,sburnett/seattle,sburnett/seattle | seattlegeni/common/util/statistics.py | seattlegeni/common/util/statistics.py | """
Provides information about the data in the database. This is for generating
reports, not for any core functionality of seattlegeni.
Some of the functions in the module are very database intensive. They could
be done more efficiently, but where possible this module tries to use the
maindb api so that summarized inf... | """
Provides information about the data in the database. This is for generating
reports, not for any core functionality of seattlegeni.
Some of the functions in the module are very database intensive. They could
be done more efficiently, but where possible this module tries to use the
maindb api so that summarized inf... | mit | Python |
091d2f91402e2ce52a2a07b88c74ae722cf1b19c | Add the first element of data_list at the end again, as the probablity of it beign selected was zero | pombredanne/dedupe,tfmorris/dedupe,neozhangthe1/dedupe,tfmorris/dedupe,dedupeio/dedupe,davidkunio/dedupe,pombredanne/dedupe,01-/dedupe,dedupeio/dedupe-examples,datamade/dedupe,davidkunio/dedupe,dedupeio/dedupe,datamade/dedupe,neozhangthe1/dedupe,01-/dedupe,nmiranda/dedupe,nmiranda/dedupe | dedupe/convenience.py | dedupe/convenience.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Convenience functions for in memory deduplication
"""
import collections
import dedupe.core
def dataSample(data, sample_size, constrained_matching=False):
'''Randomly sample pairs of records from a data dictionary'''
data_list = data.values()
if const... | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Convenience functions for in memory deduplication
"""
import collections
import dedupe.core
def dataSample(data, sample_size, constrained_matching=False):
'''Randomly sample pairs of records from a data dictionary'''
data_list = data.values()
if const... | mit | Python |
d2ba774814546f821ba967c95f0ecff8b7f4a596 | Correct release2 command | zamattiac/SHARE,zamattiac/SHARE,CenterForOpenScience/SHARE,CenterForOpenScience/SHARE,CenterForOpenScience/SHARE,laurenbarker/SHARE,aaxelb/SHARE,aaxelb/SHARE,laurenbarker/SHARE,aaxelb/SHARE,zamattiac/SHARE,laurenbarker/SHARE | share/management/commands/release2.py | share/management/commands/release2.py | from django.core.management.base import BaseCommand
from django.db import connection
from django.db import transaction
class Command(BaseCommand):
def handle(self, *args, **options):
with transaction.atomic():
with connection.cursor() as c:
c.execute('''
DO... | from django.core.management.base import BaseCommand
from django.db import connection
from django.db import transaction
class Command(BaseCommand):
def handle(self, *args, **options):
with transaction.atomic():
with connection.cursor() as c:
c.execute('''
DO... | apache-2.0 | Python |
dd45f15ced95ed43b889f464b4116bb8f4124d99 | Use explicit keyword for dtype | dpshelio/scikit-image,WarrenWeckesser/scikits-image,vighneshbirodkar/scikit-image,SamHames/scikit-image,ClinicalGraphics/scikit-image,ajaybhat/scikit-image,almarklein/scikit-image,Britefury/scikit-image,Midafi/scikit-image,Hiyorimi/scikit-image,chriscrosscutler/scikit-image,oew1v07/scikit-image,chintak/scikit-image,rje... | skimage/segmentation/_clear_border.py | skimage/segmentation/_clear_border.py | import numpy as np
from scipy.ndimage import label
def clear_border(image, buffer_size=0, bgval=0):
"""Clear objects connected to image border.
The changes will be applied to the input image.
Parameters
----------
image : (N, M) array
Binary image.
buffer_size : int, optional
... | import numpy as np
from scipy.ndimage import label
def clear_border(image, buffer_size=0, bgval=0):
"""Clear objects connected to image border.
The changes will be applied to the input image.
Parameters
----------
image : (N, M) array
Binary image.
buffer_size : int, optional
... | bsd-3-clause | Python |
0adadcb3f04e2ecb98b5ca5de1afba2ba7208d23 | Fix beam parse model test | aikramer2/spaCy,spacy-io/spaCy,recognai/spaCy,recognai/spaCy,explosion/spaCy,recognai/spaCy,explosion/spaCy,spacy-io/spaCy,recognai/spaCy,explosion/spaCy,spacy-io/spaCy,spacy-io/spaCy,aikramer2/spaCy,explosion/spaCy,spacy-io/spaCy,aikramer2/spaCy,spacy-io/spaCy,honnibal/spaCy,explosion/spaCy,honnibal/spaCy,aikramer2/sp... | spacy/tests/parser/test_beam_parse.py | spacy/tests/parser/test_beam_parse.py | # coding: utf8
from __future__ import unicode_literals
import pytest
@pytest.mark.models('en')
def test_beam_parse(EN):
doc = EN(u'Australia is a country', disable=['ner'])
ents = EN.entity(doc, beam_width=2)
print(ents)
| import spacy
import pytest
@pytest.mark.models
def test_beam_parse():
nlp = spacy.load('en_core_web_sm')
doc = nlp(u'Australia is a country', disable=['ner'])
ents = nlp.entity(doc, beam_width=2)
print(ents)
| mit | Python |
54d2a1c109de23aa8ab0556bc07cfd4dc29f7f25 | fix return in check function | sdpython/code_beatrix,sdpython/code_beatrix,sdpython/code_beatrix,sdpython/code_beatrix | src/code_beatrix/scratchs/__init__.py | src/code_beatrix/scratchs/__init__.py | """
@file
@brief shortcuts for scratch
"""
#from .example_echiquier import check as check1
from .example_echiquier import check_echiquier
from .example_tri import check_tri
from .example_pyramide import check_pyramide
from .example_chute import check_chute
def check():
"""
run checking functions
"""
... | """
@file
@brief shortcuts for scratch
"""
#from .example_echiquier import check as check1
from .example_echiquier import check_echiquier
from .example_tri import check_tri
from .example_pyramide import check_pyramide
from .example_chute import check_chute
def check():
"""
run checking functions
"""
... | mit | Python |
6e8f60a27a5a1dc05162ad33fe3490677469b956 | Bump version to 5.2.4b1 | platformio/platformio-core,platformio/platformio,platformio/platformio-core | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | apache-2.0 | Python |
ea576dc8a8082172d8b2c7a9edf1e00d384b5f14 | move import so it installs | SergioChan/Stream-Framework,Architizer/Feedly,Anislav/Stream-Framework,smuser90/Stream-Framework,nikolay-saskovets/Feedly,nikolay-saskovets/Feedly,izhan/Stream-Framework,turbolabtech/Stream-Framework,smuser90/Stream-Framework,turbolabtech/Stream-Framework,Anislav/Stream-Framework,nikolay-saskovets/Feedly,turbolabtech/S... | feedly/connection.py | feedly/connection.py | #cache this at the process module level
connection_cache = {}
def get_redis_connection():
from nydus.db import create_cluster
from django.conf import settings
config = settings.NYDUS_CONFIG['CONNECTIONS']['redis']
key = unicode(config)
cluster = connection_cache.get(key)
if not cluster:
... | from nydus.db import create_cluster
#cache this at the process module level
connection_cache = {}
def get_redis_connection():
from django.conf import settings
config = settings.NYDUS_CONFIG['CONNECTIONS']['redis']
key = unicode(config)
cluster = connection_cache.get(key)
if not cluster:
c... | bsd-3-clause | Python |
9a8d3fb2c65de3078eea987378c26360363217d2 | use django urlencode to fix string conversion of postcode in addressfinder | ministryofjustice/cla_frontend,ministryofjustice/cla_frontend,ministryofjustice/cla_frontend,ministryofjustice/cla_frontend | cla_frontend/apps/legalaid/addressfinder.py | cla_frontend/apps/legalaid/addressfinder.py | from django.conf import settings
from django.utils.http import urlencode
import requests
def query(path, **kwargs):
return requests.get(
"{host}/{path}?{args}".format(
host=settings.ADDRESSFINDER_API_HOST,
path=path,
args=urlencode(kwargs)),
headers={
... | import urllib
from django.conf import settings
import requests
def query(path, **kwargs):
return requests.get(
"{host}/{path}?{args}".format(
host=settings.ADDRESSFINDER_API_HOST,
path=path,
args=urllib.urlencode(kwargs)),
headers={
'Authorization':... | mit | Python |
a105323c9f0a3f1868f31cd6e65008b25b46c9e4 | Move the matplotlib.pyplot code to its own function. | eliteraspberries/fftresize | fftresize/imutils.py | fftresize/imutils.py | #!/usr/bin/env python2
'''Read and write image files as NumPy arrays
'''
from matplotlib import pyplot
from numpy import amax, amin, around, asarray, zeros as _zeros
from numpy import float32, uint8
from os.path import exists, splitext
from PIL import Image
from random import randint
from sys import float_info as _f... | #!/usr/bin/env python2
'''Read and write image files as NumPy arrays
'''
from matplotlib import pyplot
from numpy import amax, amin, around, asarray, zeros as _zeros
from numpy import float32, uint8
from os.path import exists, splitext
from PIL import Image
from random import randint
from sys import float_info as _f... | isc | Python |
d311f8069e8a4bf9a4d45c356955622059d75f10 | fix importing dependencies | levabd/stack-updater | stackupdater/src/lib/wrappers/process.py | stackupdater/src/lib/wrappers/process.py | # coding=utf-8
from .. import logger
class ProcessWrapper(object):
"""Wraps the subprocess popen method and provides logging."""
def __init__(self):
pass
@staticmethod
def call(*popenargs, **kwargs):
"""Run command with arguments. Wait for command to complete. Sends
output to... | # coding=utf-8
from lib import logger
class ProcessWrapper(object):
"""Wraps the subprocess popen method and provides logging."""
def __init__(self):
pass
@staticmethod
def call(*popenargs, **kwargs):
"""Run command with arguments. Wait for command to complete. Sends
output t... | mit | Python |
96243824bbccecd2bfe3b19e09dd7e6daf16621d | Remove our own sizing | quozl/sugar-toolkit-gtk3,samdroid-apps/sugar-toolkit-gtk3,sugarlabs/sugar-toolkit-gtk3,puneetgkaur/backup_sugar_sugartoolkit,manuq/sugar-toolkit-gtk3,godiard/sugar-toolkit-gtk3,manuq/sugar-toolkit-gtk3,quozl/sugar-toolkit-gtk3,tchx84/sugar-toolkit-gtk3,Daksh/sugar-toolkit-gtk3,quozl/sugar-toolkit-gtk3,tchx84/debian-pkg... | sugar/graphics/filechooser.py | sugar/graphics/filechooser.py | import gtk
from sugar.graphics import units
class FileChooserDialog(gtk.FileChooserDialog):
def __init__(self, title=None, parent=None,
action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons=None):
gtk.FileChooserDialog.__init__(self, title, parent, action, buttons)
| import gtk
from sugar.graphics import units
class FileChooserDialog(gtk.FileChooserDialog):
def __init__(self, title=None, parent=None,
action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons=None):
gtk.FileChooserDialog.__init__(self, title, parent, action, buttons)
self.set_default_size(un... | lgpl-2.1 | Python |
c2d6c4876355053f1219b1f9829114d7f9ddbe18 | Test ignoring defaults | Asnelchristian/coala,SambitAcharya/coala,djkonro/coala,Shade5/coala,FeodorFitsner/coala,Tanmay28/coala,stevemontana1980/coala,FeodorFitsner/coala,sophiavanvalkenburg/coala,NalinG/coala,shreyans800755/coala,SambitAcharya/coala,scottbelden/coala,saurabhiiit/coala,andreimacavei/coala,d6e/coala,aptrishu/coala,SanketDG/coal... | coalib/tests/settings/SettingsTest.py | coalib/tests/settings/SettingsTest.py | """
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT... | """
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT... | agpl-3.0 | Python |
00c01e9f92c0f527fa0e1ea324ee65890d1ae4a8 | comment :grin: | CloudbrainLabs/htm-challenge,lambdaloop/htm-challenge,CloudbrainLabs/htm-challenge,CloudbrainLabs/htm-challenge | brainsquared/test/test_eeg_encoder.py | brainsquared/test/test_eeg_encoder.py | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from brainsquared.encoder.eeg_encoder import EEGEncoder
CHUNK = 128
SLIDING_WINDOW = 64
RATE = 250
MI_DATA = "data/motor_data.csv"
def visualizeSDRs(sdrs):
sdrsToVisualize = []
for sdr in sdrs:
sdrsToVisualize.append([255 if x else 0 f... | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from brainsquared.encoder.eeg_encoder import EEGEncoder
CHUNK = 128
SLIDING_WINDOW = 64
RATE = 250
MI_DATA = "data/motor_data.csv"
def visualizeSDRs(sdrs):
sdrsToVisualize = []
for sdr in sdrs:
sdrsToVisualize.append([255 if x else 0 f... | agpl-3.0 | Python |
1f2deb95ba543bf05dd78f1df2e9ee6d17a2c4c3 | Test profiles manager filterting method | vtemian/buffpy,bufferapp/buffer-python | buffer/tests/test_profiles_manager.py | buffer/tests/test_profiles_manager.py | import json
from nose.tools import eq_, raises
from mock import MagicMock, patch
from buffer.managers.profiles import Profiles
from buffer.models.profile import Profile, PATHS
mocked_response = {
'name': 'me',
'service': 'twiter',
'id': 1
}
def test_profiles_manager_all_method():
'''
Test basic profiles... | import json
from nose.tools import eq_, raises
from mock import MagicMock, patch
from buffer.managers.profiles import Profiles
from buffer.models.profile import PATHS
mocked_response = {
'name': 'me',
'service': 'twiter',
'id': 1
}
def test_profiles_manager_all_method():
'''
Test basic profiles retrievi... | mit | Python |
7469a750a7303b346a91376ae16dc42b69208c18 | Support for X-Ten machine IDs | SciLifeLab/TACA,SciLifeLab/TACA,kate-v-stepanova/TACA,senthil10/TACA,b97pla/TACA,guillermo-carrasco/TACA,kate-v-stepanova/TACA,SciLifeLab/TACA,senthil10/TACA,vezzi/TACA,b97pla/TACA,guillermo-carrasco/TACA,vezzi/TACA | pm/utils/filesystem.py | pm/utils/filesystem.py | """ Filesystem utilities
"""
import contextlib
import os
RUN_RE = '\d{6}_[a-zA-Z\d\-]+_\d{4}_[AB][A-Z\d]{9}'
@contextlib.contextmanager
def chdir(new_dir):
"""Context manager to temporarily change to a new directory.
"""
cur_dir = os.getcwd()
# This is weird behavior. I'm removing and and we'll see if... | """ Filesystem utilities
"""
import contextlib
import os
RUN_RE = '\d{6}_[a-zA-Z\d]+_\d{4}_[AB][A-Z\d]{9}'
@contextlib.contextmanager
def chdir(new_dir):
"""Context manager to temporarily change to a new directory.
"""
cur_dir = os.getcwd()
# This is weird behavior. I'm removing and and we'll see if a... | mit | Python |
2acaea560eaaea88a97c5b450e18ea018a3b74ad | Refactor for ease of unit testing. | geekofalltrades/quora-coding-challenges | typeahead_search/search.py | typeahead_search/search.py | import sys
from warnings import warn
class TypeAheadSearch(object):
"""Class encapsulating the action of the typeahead search."""
def __init__(self):
# Keep a record of all commands processed.
self.commands = []
def main(self):
"""Main search loop."""
# Get the number of ... | import sys
from warnings import warn
class TypeAheadSearch(object):
"""Class encapsulating the action of the typeahead search."""
def __init__(self):
# Keep a record of all commands processed.
self.commands = []
def main(self):
"""Main search loop."""
# Get the number of ... | mit | Python |
8d3931fd5effabf9c5d56cb03ae15630ae984963 | Create simple CLI for the `places` function | FlowFX/postalcodes_mexico | postalcodes_mexico/cli.py | postalcodes_mexico/cli.py | # -*- coding: utf-8 -*-
"""Console script for postalcodes_mexico."""
import sys
import click
from postalcodes_mexico import postalcodes_mexico
@click.command()
@click.argument('postalcode', type=str)
def main(postalcode):
"""Console script for postalcodes_mexico."""
places = postalcodes_mexico.places(postal... | # -*- coding: utf-8 -*-
"""Console script for postalcodes_mexico."""
import sys
import click
@click.command()
def main(args=None):
"""Console script for postalcodes_mexico."""
click.echo("Replace this message by putting your code into "
"postalcodes_mexico.cli.main")
click.echo("See click ... | mit | Python |
5ff8a884961555deaee314f915be9092c041bd4c | Bump version: now compatible with python 2.7 and 3 | SciLifeLab/taca-ngi-pipeline | taca_ngi_pipeline/__init__.py | taca_ngi_pipeline/__init__.py | """ Main taca_ngi_pipeline module
"""
__version__ = '0.9.0'
| """ Main taca_ngi_pipeline module
"""
__version__ = '0.8.3'
| mit | Python |
4ad2b46fc06c71fb77b751b3cec5d4ac2d915ff7 | Complete docker compose with ln | hatchery/Genepool2,hatchery/genepool | genes/docker/main.py | genes/docker/main.py | from genes.apt import commands as apt
from genes.brew import commands as brew
from genes.curl.commands import download
from genes.debian.traits import is_debian, get_codename
from genes.gnu_coreutils.commands import ln
from genes.lib.traits import if_any_funcs
from genes.linux.traits import get_distro
from genes.mac.tr... | from genes.apt import commands as apt
from genes.brew import commands as brew
from genes.curl.commands import download
from genes.debian.traits import is_debian, get_codename
from genes.lib.traits import if_any_funcs
from genes.linux.traits import get_distro
from genes.mac.traits import is_osx
from genes.ubuntu.traits ... | mit | Python |
062d39cdb3922740586c2af191dc12de2e842a3c | make gradient multiplier a kwarg | kapadia/geoblend | geoblend/__init__.py | geoblend/__init__.py |
import numpy as np
from geoblend.vector import create_vector
def blend(source, reference, mask, solver, gradient_multiplier=1.0):
"""
Run a Poisson blend between two arrays.
:param source:
ndarray representing the source image
:param reference:
ndarray representing the reference ... |
import numpy as np
from geoblend.vector import create_vector
def blend(source, reference, mask, solver, gradient_multiplier):
"""
Run a Poisson blend between two arrays.
:param source:
ndarray representing the source image
:param reference:
ndarray representing the reference imag... | mit | Python |
d16f2cd7cdacf5897ba21f2ea92d65724e56e377 | Add TODOs to build. | joeyespo/gitpress | gitpress/building.py | gitpress/building.py | import os
from .repository import require_repo, presentation_files
from .helpers import copy_files, remove_directory
default_out_directory = '_site'
def build(directory=None, out_directory=None):
"""Builds the site from its content and presentation repository."""
directory = directory or '.'
out_directo... | import os
from .repository import require_repo, presentation_files
from .helpers import copy_files, remove_directory
default_out_directory = '_site'
def build(directory=None, out_directory=None):
"""Builds the site from its content and presentation repository."""
directory = directory or '.'
out_directo... | mit | Python |
e51fd2045565a3cd6897cfe843ecd2746cc687dd | Fix ImportErrors on Python 3 | pettazz/pygooglevoice | googlevoice/tests.py | googlevoice/tests.py | import os
from unittest import TestCase, main
from six.moves import input
from googlevoice import Voice
from googlevoice import conf
class VoiceTest(TestCase):
voice = Voice()
voice.login()
outgoing = input('Outgoing number (blank to ignore call tests): ')
forwarding = None
if outgoing:
... | import os
from unittest import TestCase, main
from six.moves import input
from googlevoice import Voice
class VoiceTest(TestCase):
voice = Voice()
voice.login()
outgoing = input('Outgoing number (blank to ignore call tests): ')
forwarding = None
if outgoing:
forwarding = input('Forwardin... | bsd-3-clause | Python |
a32cc7a92f4bb3fb6531fbd0d2afe436c8b02ee7 | Make cleaner actually run | mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge | srcleaner.py | srcleaner.py | #!/usr/bin/env python
# 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/.
import logging
import os
import shutil
import stoneridge
@stoneridge.main
def main():
"""A ... | #!/usr/bin/env python
# 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/.
import logging
import os
import shutil
import stoneridge
@stoneridge.main
def main():
"""A ... | mpl-2.0 | Python |
96e7c4da370ae306e760789a874c238374b03508 | Fix styling | untitaker/vdirsyncer,untitaker/vdirsyncer,untitaker/vdirsyncer | tests/unit/cli/test_config.py | tests/unit/cli/test_config.py | import os
from vdirsyncer.cli.config import _resolve_conflict_via_command
from vdirsyncer.utils.vobject import Item
def test_conflict_resolution_command():
def check_call(command):
command, a_tmp, b_tmp = command
assert command == os.path.expanduser('~/command')
with open(a_tmp) as f:
... | import os
from vdirsyncer.cli.config import _resolve_conflict_via_command
from vdirsyncer.utils.vobject import Item
def test_conflict_resolution_command():
def check_call(command):
command, a_tmp, b_tmp = command
assert command == os.path.expanduser('~/command')
with open(a_tmp) as f:
... | mit | Python |
20c241a912ed37fea5bdfa89c9c2e3fb4d9112e6 | set timtec theme | mupi/timtec,virgilio/timtec,virgilio/timtec,hacklabr/timtec,virgilio/timtec,GustavoVS/timtec,AllanNozomu/tecsaladeaula,GustavoVS/timtec,hacklabr/timtec,AllanNozomu/tecsaladeaula,GustavoVS/timtec,AllanNozomu/tecsaladeaula,mupi/timtec,GustavoVS/timtec,virgilio/timtec,hacklabr/timtec,mupi/tecsaladeaula,mupi/timtec,mupi/te... | timtec/settings_local_test.py | timtec/settings_local_test.py | # -*- coding: utf-8 -*-
# configurations for the test server
# https://docs.djangoproject.com/en/dev/ref/settings/
DEBUG = False
TEMPLATE_DEBUG = DEBUG
SITE_ID = 1
ALLOWED_HOSTS = [
'timtec-test.hacklab.com.br',
'.timtec.com.br',
]
TIMTEC_THEME = 'timtec'
DATABASES = {
'default': {
'ENGINE': 'dj... | # -*- coding: utf-8 -*-
# configurations for the test server
# https://docs.djangoproject.com/en/dev/ref/settings/
DEBUG = False
TEMPLATE_DEBUG = DEBUG
SITE_ID = 1
ALLOWED_HOSTS = [
'timtec-test.hacklab.com.br',
'.timtec.com.br',
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgres... | agpl-3.0 | Python |
1a5626e545b8483192d93ea57572da097a28e328 | Update version 0.7.8 -> 0.7.9 | oneklc/dimod,oneklc/dimod | dimod/package_info.py | dimod/package_info.py | # Copyright 2018 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | # Copyright 2018 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.