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 |
|---|---|---|---|---|---|---|---|---|
ab065640d66fa9fab97e9430f411bf8a1c04971a | add start value to loop counter | haandol/algorithm_in_python | interview/amazon/gas.py | interview/amazon/gas.py | # https://www.interviewbit.com/problems/gas-station/
class Solution:
def canCompleteCircuit(self, gas, cost):
n = len(gas)
gas = gas*2
cost = cost*2
for start in xrange(n):
fuel = 0
for i in xrange(start, start+n+1):
fuel += gas[i]
... | # https://www.interviewbit.com/problems/gas-station/
class Solution:
def canCompleteCircuit(self, gas, cost):
n = len(gas)
gas = gas*2
cost = cost*2
for start in xrange(n):
fuel = 0
for i in xrange(start, n+1):
fuel += gas[i]
... | mit | Python |
427dab842e2d8aea1610c3e23d792119dc60c94b | Update our customized jQuery ui widgets | pombredanne/moksha,lmacken/moksha,mokshaproject/moksha,mokshaproject/moksha,lmacken/moksha,pombredanne/moksha,lmacken/moksha,mokshaproject/moksha,ralphbean/moksha,ralphbean/moksha,mokshaproject/moksha,ralphbean/moksha,pombredanne/moksha,pombredanne/moksha | moksha/widgets/jquery_ui_theme.py | moksha/widgets/jquery_ui_theme.py | """
:mod:`moksha.widgets.jquery_ui_theme` - jQuery UI Theme
=======================================================
.. moduleauthor:: Luke Macken <lmacken@redhat.com>
"""
from tw.api import Widget, CSSLink, CSSLink
ui_theme_css = CSSLink(link='/css/jquery-ui/ui.theme.css', modname=__name__)
ui_base_css = CSSLink(lin... | from tw.api import Widget, CSSLink
class JQueryUITheme(Widget):
css = [CSSLink(link='/css/jquery-ui/ui.theme.css', modname=__name__)]
template = ''
| apache-2.0 | Python |
f92592b5c9a193a1e1f6061e72d1c6c71c14caf1 | fix test | looker/sentry,zenefits/sentry,BuildingLink/sentry,gencer/sentry,JackDanger/sentry,ifduyue/sentry,zenefits/sentry,beeftornado/sentry,beeftornado/sentry,gencer/sentry,jean/sentry,JamesMura/sentry,gencer/sentry,JamesMura/sentry,ifduyue/sentry,ifduyue/sentry,ifduyue/sentry,jean/sentry,fotinakis/sentry,JamesMura/sentry,zene... | tests/sentry/api/endpoints/test_user_avatar.py | tests/sentry/api/endpoints/test_user_avatar.py | from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.models import UserAvatar
from sentry.testutils import APITestCase
class UserAvatarTest(APITestCase):
def test_get(self):
user = self.create_user(email='a@example.com')
self.login_as(user=user)
... | from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.models import UserAvatar
from sentry.testutils import APITestCase
class UserAvatarTest(APITestCase):
def test_get(self):
user = self.create_user(email='a@example.com')
avatar = UserAvatar.objects.crea... | bsd-3-clause | Python |
798aaced75b49f2761413ff26a397aab1a7d08b1 | Fix over indentation | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | tests/test_action_manager/test_email_action.py | tests/test_action_manager/test_email_action.py | from unittest.mock import patch
import pytest
from action_manager.actions.email import EMAIL_ACTION_EXECUTED, EmailAction
from tests.utils import BaseTest
# pylint:disable=protected-access
@pytest.mark.actions_mark
class TestEmailAction(BaseTest):
DISABLE_RUNNER = True
def test_attrs(self):
assert... | from unittest.mock import patch
import pytest
from action_manager.actions.email import EMAIL_ACTION_EXECUTED, EmailAction
from tests.utils import BaseTest
# pylint:disable=protected-access
@pytest.mark.actions_mark
class TestEmailAction(BaseTest):
DISABLE_RUNNER = True
def test_attrs(self):
assert... | apache-2.0 | Python |
9910bffe9f7377fe1a3797cb08a103d1bc833cc8 | Update upload_md.py | mariosky/databook | .github/workflows/upload_md.py | .github/workflows/upload_md.py | # -*- coding: utf-8 -*-
"""
Created on March 2021
@author: mariosky
Searches for markdown files in the current repo,
then it extracts the rendered markdown leaving only the basic html version,
then it extracts all html tags and sends the body to the redis-search server.
We need to add SEARCH_HOST and API_USER_PASSW... | # -*- coding: utf-8 -*-
"""
Created on March 2021
@author: mariosky
Searches for markdown files in the current repo,
then it extracts the rendered markdown leaving only the basic html version,
then it extracts all html tags and sends the body to the redis-search server.
We need to add SEARCH_HOST and API_USER_PASSW... | apache-2.0 | Python |
18db25bb026d33fe6ed2bc572c12363ce79e0dc6 | Update py-beautifulsoup4 (#4089) | krafczyk/spack,TheTimmy/spack,matthiasdiener/spack,TheTimmy/spack,LLNL/spack,matthiasdiener/spack,TheTimmy/spack,iulian787/spack,lgarren/spack,TheTimmy/spack,mfherbst/spack,mfherbst/spack,iulian787/spack,skosukhin/spack,TheTimmy/spack,matthiasdiener/spack,iulian787/spack,LLNL/spack,mfherbst/spack,krafczyk/spack,LLNL/sp... | var/spack/repos/builtin/packages/py-beautifulsoup4/package.py | var/spack/repos/builtin/packages/py-beautifulsoup4/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
c3e60e1b8b9d4690d02035f9fba0b76ba1b89074 | set atmos env to false | dashford/sentinel | src/Devices/Sensors/PMS5003.py | src/Devices/Sensors/PMS5003.py | import logging
from time import sleep
import pms5003
from blinker import signal
class PMS5003:
def __init__(self, address):
logging.info('Initialising PMS5003 sensor with address {}'.format(address))
self._sensor = pms5003.PMS5003(device=address)
def get_particulate_matter(self, mqtt_details... | import logging
from time import sleep
import pms5003
from blinker import signal
class PMS5003:
def __init__(self, address):
logging.info('Initialising PMS5003 sensor with address {}'.format(address))
self._sensor = pms5003.PMS5003(device=address)
def get_particulate_matter(self, mqtt_details... | mit | Python |
61b6bece20cbaeea7a0521e023cf63f7ae8f1c2a | Remove 'raise' in the image_correlation test | Nikea/scikit-xray,tacaswell/scikit-xray,yugangzhang/scikit-beam,danielballan/scikit-xray,danielballan/scikit-xray,tacaswell/scikit-beam,yugangzhang/scikit-beam,CJ-Wright/scikit-beam,ericdill/scikit-xray,scikit-xray/scikit-xray,ericdill/scikit-xray,ericdill/scikit-xray,scikit-xray/scikit-xray,licode/scikit-xray,licode/s... | skxray/core/accumulators/tests/test_correlation.py | skxray/core/accumulators/tests/test_correlation.py | from skxray.core.correlation.correlation import (multi_tau_auto_corr,
intermediate_data)
from skxray.core.accumulators.correlation import MultiTauCorrelation
import numpy as np
import pandas as pd
# turn off auto wrapping of pandas dataframes
pd.set_option('display.expan... | from skxray.core.correlation.correlation import (multi_tau_auto_corr,
intermediate_data)
from skxray.core.accumulators.correlation import MultiTauCorrelation
import numpy as np
import pandas as pd
# turn off auto wrapping of pandas dataframes
pd.set_option('display.expan... | bsd-3-clause | Python |
1b5f769ac2c875b02c0739ba9a0544b611380cfe | Remove useless js | l-vincent-l/APITaxi,odtvince/APITaxi,odtvince/APITaxi,odtvince/APITaxi,l-vincent-l/APITaxi,openmaraude/APITaxi,openmaraude/APITaxi,odtvince/APITaxi | APITaxi/backoffice/__init__.py | APITaxi/backoffice/__init__.py | # -*- coding: utf-8 -*-
from ..api import api
ns_administrative = api.namespace('administrative',
description="Administrative APIs", path='/')
def init_app(app):
from . import (ads, drivers, home, user_key, vehicle, zupc, profile,
documents, dash)
app.register_blueprint(ads.mod)
app.re... | # -*- coding: utf-8 -*-
from ..api import api
ns_administrative = api.namespace('administrative',
description="Administrative APIs", path='/')
def init_app(app):
from . import (ads, drivers, home, user_key, vehicle, zupc, profile,
documents, dash, js)
app.register_blueprint(ads.mod)
ap... | agpl-3.0 | Python |
79d8c1e95f3c876e600e1637253c7afcf3f36763 | Add input and random explainer to utility function. | pikinder/nn-patterns | nn_patterns/explainer/__init__.py | nn_patterns/explainer/__init__.py |
from .base import *
from .gradient_based import *
from .misc import *
from .pattern_based import *
from .relevance_based import *
def create_explainer(name,
output_layer, patterns=None, to_layer=None, **kwargs):
return {
# Utility.
"input": InputExplainer,
"random": ... |
from .base import *
from .gradient_based import *
from .misc import *
from .pattern_based import *
from .relevance_based import *
def create_explainer(name,
output_layer, patterns=None, to_layer=None, **kwargs):
return {
# Gradient based
"gradient": GradientExplainer,
... | mit | Python |
774436db4531ba83d1a595ae19f07da9cdd22c8d | bump to v0.1.1 | TomAugspurger/dota | dota/__init__.py | dota/__init__.py | __version__ = '0.1.1'
| __version__ = '0.1'
| mit | Python |
b6d12b9b469ccabc48a24615dfbdb2cd39b8ecdf | Add short git hash to storage method. | ElessarWebb/dummy,ElessarWebb/dummy,ElessarWebb/dummy | dummy/storage.py | dummy/storage.py | import json
import os
import shutil
import logging
from dummy import config
from dummy.utils import create_dir, subprocess
from dummy.models import TestResult
logger = logging.getLogger( __name__ )
JSON = 'json'
METHOD_CHOICES = ( JSON ) #Extend with .xml,.csv?
def clean( name ):
""" Clean the storage dir for test... | import json
import os
import shutil
import logging
from dummy import config
from dummy.utils import create_dir
from dummy.models import TestResult
logger = logging.getLogger( __name__ )
JSON = 'json'
METHOD_CHOICES = ( JSON ) #Extend with .xml,.csv?
def clean( name ):
""" Clean the storage dir for test `name`.
... | mit | Python |
f616330b2ababc81e69586392bb07b66751628c2 | Remove unnecessary import | morganbengtsson/microreader | microreader.py | microreader.py | import feedparser
import lxml.html
import xml.etree.ElementTree as ET
from bottle import route, run, view
@route('/api/<url:re:.+>')
def items(url = ''):
items = {'items' : [], 'url' : url}
urls = []
if url: urls.append(url)
else:
for channel in channels()['channels']:
urls.append(channel['url'])
for url... | import feedparser, bottle
import lxml.html
import xml.etree.ElementTree as ET
from bottle import route, run, view, SimpleTemplate
@route('/api/<url:re:.+>')
def items(url = ''):
items = {'items' : [], 'url' : url}
urls = []
if url: urls.append(url)
else:
for channel in channels()['channels']:
urls.append(ch... | mit | Python |
477d5887abbbce7a9d11dc827d954970d7c66bd7 | Bump up version | ayarshabeer/django-rest-framework-jwt,sandipbgt/django-rest-framework-jwt,orf/django-rest-framework-jwt,abdulhaq-e/django-rest-framework-jwt,diegueus9/django-rest-framework-jwt,coUrbanize/django-rest-framework-jwt,plentific/django-rest-framework-jwt,ajostergaard/django-rest-framework-jwt,icewater246/django-rest-framewo... | rest_framework_jwt/__init__.py | rest_framework_jwt/__init__.py | __version__ = '1.1.1'
# Version synonym
VERSION = __version__
| __version__ = '1.1.0'
# Version synonym
VERSION = __version__
| mit | Python |
96a5e09c020af35156669fc1c8546fcb1d1c320c | Fix import | ecreall/nova-ideo,ecreall/nova-ideo,ecreall/nova-ideo,ecreall/nova-ideo,ecreall/nova-ideo | novaideo/subscribers.py | novaideo/subscribers.py | # Copyright (c) 2014 by Ecreall under licence AGPL terms
# avalaible on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
from pyramid.events import subscriber
from pyramid.threadlocal import get_current_registry
from substanced.event import RootAdded
from substanced.util import find_ser... | # Copyright (c) 2014 by Ecreall under licence AGPL terms
# avalaible on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
from zope.processlifetime import IDatabaseOpenedWithRoot
from pyramid.events import subscriber
from pyramid.threadlocal import get_current_registry
from substanced.ev... | agpl-3.0 | Python |
686e5552ac978e50dc5bab7e00c26308db510f79 | Add evaluation module. | johnmartinsson/bird-species-classification,johnmartinsson/bird-species-classification | bird/evaluate.py | bird/evaluate.py | from models.cuberun import CubeRun
import numpy as np
import utils
import loader
nb_classes = 19
input_shape = (257, 624, 1)
(cols, rows, chs) = input_shape
image_shape = (cols, rows)
batch_size=32
def evaluate(model, data_filepath, file2labels_filepath):
model.compile(loss='binary_crossentropy', optimizer='adam'... | from models.cuberun import CubeRun
import numpy as np
import utils
import loader
nb_classes = 19
input_shape = (257, 624, 1)
(cols, rows, chs) = input_shape
image_shape = (cols, rows)
batch_size=32
def evaluate(model, data_filepath, file2labels_filepath):
model.compile(loss='binary_crossentropy', optimizer='adam'... | mit | Python |
a5ddf151e3a1203d220f8c4a7d75cd48f4a211a6 | fix timezone problem (hopefully) | fadenb/hopper.pw,manazag/hopper.pw,fadenb/hopper.pw,asmaps/hopper.pw,asmaps/hopper.pw,asmaps/hopper.pw,fadenb/hopper.pw,manazag/hopper.pw,manazag/hopper.pw,manazag/hopper.pw,asmaps/hopper.pw,fadenb/hopper.pw | nsupdate/stats/tasks.py | nsupdate/stats/tasks.py | from datetime import datetime
import pytz
from huey.djhuey import crontab, db_periodic_task, db_task
from django.conf import settings
from django.contrib.auth import get_user_model
from main.models import Host
from stats.models import StatisticsEntry
@db_periodic_task(crontab(hour='0', minute='0'))
def save_user_co... | import datetime
from huey.djhuey import crontab, db_periodic_task, db_task
from django.conf import settings
from django.contrib.auth import get_user_model
from main.models import Host
from stats.models import StatisticsEntry
@db_periodic_task(crontab(hour='0', minute='0'))
def save_user_count():
count = get_use... | bsd-3-clause | Python |
3cf1c818f0e1fea383019d16a1d4d3c5fa78065b | Fix crash due to non safe asyncronous function call | TheZoq2/neovim-colortheme-changer | rplugin/python/ColorMonitor.py | rplugin/python/ColorMonitor.py | import time
import fcntl
import os
import signal
import os
import random
import neovim
FOLDER_NAME = "/tmp/colors/"
COLOR_FILE_NAME = "vimtheme"
THEME_PATH = FOLDER_NAME + COLOR_FILE_NAME
@neovim.plugin
class ColorChanger(object):
def __init__(self, vim):
self.vim = vim
@neovim.command('... | import time
import fcntl
import os
import signal
import os
import random
import neovim
FOLDER_NAME = "/tmp/colors/"
COLOR_FILE_NAME = "vimtheme"
THEME_PATH = FOLDER_NAME + COLOR_FILE_NAME
@neovim.plugin
class ColorChanger(object):
def __init__(self, vim):
self.vim = vim
@neovim.command('... | mit | Python |
f3b73441923d209f62b12689efa0d1bef574690d | fix incorrect handling for nodes without id attribute | sixty-north/cosmic-ray | cosmic_ray/operators/remove_decorator.py | cosmic_ray/operators/remove_decorator.py | import ast
from .operator import Operator
class RemoveDecorator(Operator):
"""An operator that removes each of the non standard decorators."""
REGULAR_DECORATORS = frozenset(["classmethod", "staticmethod",
"abstractmethod"])
def visit_FunctionDef(self, node): # noqa
... | import ast
from .operator import Operator
class RemoveDecorator(Operator):
"""An operator that removes each of the non standard decorators."""
REGULAR_DECORATORS = frozenset(["classmethod", "staticmethod",
"abstractmethod"])
def visit_FunctionDef(self, node): # noqa
... | mit | Python |
c7516e843db62f448d0f5888b92069b4d3ab066c | fix for python2 | tomi77/python-t77-date | t77_date/datetime.py | t77_date/datetime.py | from __future__ import absolute_import
from datetime import timedelta
def start_of_day(date):
"""
Return a new datetime with values that represent a start of a day.
:param date: Date to ...
:type date: datetime.datetime
:rtype: datetime.datetime
"""
return date.replace(hour=0, minute=0, se... | from datetime import timedelta
def start_of_day(date):
"""
Return a new datetime with values that represent a start of a day.
:param date: Date to ...
:type date: datetime.datetime
:rtype: datetime.datetime
"""
return date.replace(hour=0, minute=0, second=0, microsecond=0)
def end_of_day... | mit | Python |
6b53fa1d771770394064db35539b0e5d3690fe86 | Move _stringToSequence up | robofab-developers/fontParts,robofab-developers/fontParts | Lib/fontParts/base/color.py | Lib/fontParts/base/color.py | class Color(tuple):
"""
An color object. This follows the :ref:`type-color`.
"""
def _get_r(self):
return _stringToSequence(self)[0]
r = property(_get_r, "The color's red component as :ref:`type-int-float`.")
def _get_g(self):
return _stringToSequence(self)[1]
g = proper... | class Color(tuple):
"""
An color object. This follows the :ref:`type-color`.
"""
def _get_r(self):
return _stringToSequence(self)[0]
r = property(_get_r, "The color's red component as :ref:`type-int-float`.")
def _get_g(self):
return _stringToSequence(self)[1]
g = proper... | mit | Python |
762fa1c227d038e5fd0dfbe6be2e6157a5fbd730 | Fix SF bug #763770, test_socket_ssl crash | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_socket_ssl.py | Lib/test/test_socket_ssl.py | # Test just the SSL support in the socket module, in a moderately bogus way.
from test import test_support
import socket
import time
# Optionally test SSL support. This requires the 'network' resource as given
# on the regrtest command line.
skip_expected = not (test_support.is_resource_enabled('network') and
... | # Test just the SSL support in the socket module, in a moderately bogus way.
from test import test_support
import socket
import time
# Optionally test SSL support. This requires the 'network' resource as given
# on the regrtest command line.
skip_expected = not (test_support.is_resource_enabled('network') and
... | mit | Python |
689417cef23297e54b5f082e31539bd2381798bf | Remove debugging statements and provide support for Python 2.7 | dsandersAzure/python_cowbull_server,dsandersAzure/python_cowbull_server | Persistence/RedisPersist.py | Persistence/RedisPersist.py | import redis
class RedisPersist:
_redis_connection = None
def __init__(self, host="localhost", port=6379, db=0):
self._redis_connection = redis.StrictRedis(
host=host,
port=port,
db=db
)
self._redis_connection.set('tmp_validate', 'tmp_validate')
... | import redis
class RedisPersist:
_redis_connection = None
def __init__(self, host="localhost", port=6379, db=0):
self._redis_connection = redis.StrictRedis(
host=host,
port=port,
db=db
)
self._redis_connection.set('tmp_validate', 'tmp_validate')
... | apache-2.0 | Python |
b9288cd1362740a0d8f32a65bcf163161873a95d | fix name extraction for py3 | scrapy/parsel | parsel/xpathfuncs.py | parsel/xpathfuncs.py | from lxml import etree
from six import iteritems, get_function_code
_XPATH_FUNCS = {}
def register(func):
fname = get_function_code(func).co_name.replace('_', '-')
_XPATH_FUNCS[fname] = func
return func
def setup():
fns = etree.FunctionNamespace(None)
for k, v in iteritems(_XPATH_FUNCS):
... | from lxml import etree
from six import iteritems
_XPATH_FUNCS = {}
def register(func):
fname = func.func_name.replace('_', '-')
_XPATH_FUNCS[fname] = func
return func
def setup():
fns = etree.FunctionNamespace(None)
for k, v in iteritems(_XPATH_FUNCS):
fns[k] = v
@register
def has_cla... | bsd-3-clause | Python |
bc7667c30b491d087a199dc2bb4dc1c8c0fdfc79 | Add see_offering method | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/util/update_instances_with_offering.py | dbaas/util/update_instances_with_offering.py | # coding: utf-8
class UpdateInstances(object):
@staticmethod
def do():
from dbaas_cloudstack.models import DatabaseInfraOffering
from dbaas_cloudstack.models import PlanAttr
infra_offerings = DatabaseInfraOffering.objects.all()
for infra_offering in infra_offerings:
... | # coding: utf-8
class UpdateInstances(object):
@staticmethod
def do():
from dbaas_cloudstack.models import DatabaseInfraOffering
from dbaas_cloudstack.models import PlanAttr
infra_offerings = DatabaseInfraOffering.objects.all()
for infra_offering in infra_offerings:
... | bsd-3-clause | Python |
5f430b076ad70c23c430017a6aa7a7893530e995 | Improve subject and text of URL report email | jbittel/django-deflect | deflect/management/commands/checkurls.py | deflect/management/commands/checkurls.py | from django.contrib.sites.models import Site
from django.core.mail import mail_managers
from django.core.management.base import NoArgsCommand
from django.core.urlresolvers import reverse
import requests
from deflect.models import ShortURL
class Command(NoArgsCommand):
help = "Validate short URL redirect targets... | from django.contrib.sites.models import Site
from django.core.mail import mail_managers
from django.core.management.base import NoArgsCommand
from django.core.urlresolvers import reverse
import requests
from deflect.models import ShortURL
class Command(NoArgsCommand):
help = "Validate short URL redirect targets... | bsd-3-clause | Python |
44366b4bf41fdc65d7a7941e4fb872ed39465929 | fix handler | cloudify-cosmo/cloudify-diamond-plugin,cloudify-cosmo/cloudify-diamond-plugin,geokala/cloudify-diamond-plugin,codilime/cloudify-diamond-plugin | diamond_agent/tests/resources/blueprint/handlers/test_handler.py | diamond_agent/tests/resources/blueprint/handlers/test_handler.py | #########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | #########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | apache-2.0 | Python |
fa470aac19051e1203d9ee23e0472d02625bb55f | make yapf | tamasgal/km3pipe,tamasgal/km3pipe | pipeinspector/gui.py | pipeinspector/gui.py | import urwid
from pipeinspector.widgets import BlobWidget, BlobBrowser
from pipeinspector.settings import UI
__author__ = "Tamas Gal"
__copyright__ = "Copyright 2016, Tamas Gal and the KM3NeT collaboration."
__credits__ = []
__license__ = "MIT"
__maintainer__ = "Tamas Gal"
__email__ = "tgal@km3net.de"
__status__ = "D... | import urwid
from pipeinspector.widgets import BlobWidget, BlobBrowser
from pipeinspector.settings import UI
__author__ = "Tamas Gal"
__copyright__ = "Copyright 2016, Tamas Gal and the KM3NeT collaboration."
__credits__ = []
__license__ = "MIT"
__maintainer__ = "Tamas Gal"
__email__ = "tgal@km3net.de"
__status__ = "D... | mit | Python |
073a0d763fcf38a530604157aa8da0b7e1894d4f | Fix up description of article syndication feeds | jeffcharles/Open-Source-at-Laurier-Website,jeffcharles/Open-Source-at-Laurier-Website,jeffcharles/Open-Source-at-Laurier-Website,jeffcharles/Open-Source-at-Laurier-Website | wluopensource/articles/feeds.py | wluopensource/articles/feeds.py | from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from articles.models import Article
class LatestArticlesRssFeed(Feed):
title = "Open Source at Laurier articles"
link = "/articles/"
description = "Various articles about open source software and Open Source... | from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from articles.models import Article
class LatestArticlesRssFeed(Feed):
title = "Open Source at Laurier articles"
link = "/articles/"
description = "Various articles revolving around open source software and ... | bsd-3-clause | Python |
b1850f72dd9a2cbc275f0727d34b5f6b6ac522b0 | fix broken test after making change to input protocol | meyersj/geotweet,meyersj/geotweet,meyersj/geotweet | geotweet/tests/integration/mapreduce/state-county_tests.py | geotweet/tests/integration/mapreduce/state-county_tests.py | import unittest
import os
from os.path import dirname
import sys
import json
from mrjob.job import MRJob
import Geohash
root = dirname(dirname(dirname(dirname(os.path.abspath(__file__)))))
sys.path.append(root)
GEOTWEET_DIR = root
DATA_DIR = os.path.join(root, 'data', 'geo')
COUNTIES_GEOJSON_LOCAL = os.path.join(DAT... | import unittest
import os
from os.path import dirname
import sys
import json
from mrjob.job import MRJob
import Geohash
root = dirname(dirname(dirname(dirname(os.path.abspath(__file__)))))
sys.path.append(root)
GEOTWEET_DIR = root
DATA_DIR = os.path.join(root, 'data', 'geo')
COUNTIES_GEOJSON_LOCAL = os.path.join(DAT... | mit | Python |
a28b2bc45b69503a8133b0df98ffa96d9aa4e229 | Modify migration file to include meta data changes | City-of-Helsinki/django-helusers,City-of-Helsinki/django-helusers | helusers/migrations/0002_add_oidcbackchannellogoutevent.py | helusers/migrations/0002_add_oidcbackchannellogoutevent.py | from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
("helusers", "0001_add_ad_groups"),
]
operations = [
migrations.CreateModel(
name="OIDCBackChannelLogoutEvent",
fields=[
(... | # Generated by Django 3.2.4 on 2021-06-21 05:46
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
("helusers", "0001_add_ad_groups"),
]
operations = [
migrations.CreateModel(
name="OIDCBackChannelLog... | bsd-2-clause | Python |
f57dbc3ff754fb1ca75463d53bd507d7003a154e | Print removed from CaseInsensitiveQuerySet | rogeliorv/django_base_model | django_base_model/CaseInsensitiveQuerySet.py | django_base_model/CaseInsensitiveQuerySet.py | '''
Created on Jun 15, 2012
@author: rogelio
'''
from django.db.models.query import QuerySet
class CaseInsensitiveQuerySet(QuerySet):
'''This QuerySet is not used by default in the ExtendedBaseModel, but is another utility
query set which provides case insensitive searches.
This Query set is used to... | '''
Created on Jun 15, 2012
@author: rogelio
'''
from django.db.models.query import QuerySet
class CaseInsensitiveQuerySet(QuerySet):
'''This QuerySet is not used by default in the ExtendedBaseModel, but is another utility
query set which provides case insensitive searches.
This Query set is used to... | mit | Python |
81d4f45ca75eca95e058e0d9b79b16458c20db6d | Fix typo | gregcowell/PFT,gregcowell/PFT,gregcowell/BAM,gregcowell/BAM | pft/tests/test_users.py | pft/tests/test_users.py | """User Model Tests."""
import unittest
from .. import create_app, db
from ..database import User
class UserModelTestCase(unittest.TestCase):
"""User model tests."""
def setUp(self):
"""Set up tests."""
self.app = create_app('testing')
self.app_context = self.app.app_context()
... | """User Model Tests."""
import unittest
from .. import create_app, db
from ..database import User
class UserModelTestCase(unittest.TestCase):
"""User model tests."""
def setUp(self):
"""Set up tests."""
self.app = create_app('testing')
self.app_context = self.app.app_context()
... | unknown | Python |
ea8edf65ac3bc8e6c5d551c4506ecc0ab5881e3e | Add argument `queue` to rqscheduler command | ryanisnan/django-rq,viaregio/django-rq,ryanisnan/django-rq,lechup/django-rq,lechup/django-rq,mjec/django-rq,meteozond/django-rq,meteozond/django-rq,sbussetti/django-rq,viaregio/django-rq,1024inc/django-rq,mjec/django-rq,ui/django-rq,sbussetti/django-rq,ui/django-rq,1024inc/django-rq | django_rq/management/commands/rqscheduler.py | django_rq/management/commands/rqscheduler.py | from django.core.management.base import BaseCommand
from optparse import make_option
from django_rq import get_scheduler
class Command(BaseCommand):
"""
Runs RQ scheduler
"""
help = __doc__
args = '<queue>'
option_list = BaseCommand.option_list + (
make_option(
'--interval... | from django.core.management.base import BaseCommand
from optparse import make_option
from django_rq import get_scheduler
class Command(BaseCommand):
"""
Runs RQ scheduler
"""
help = __doc__
option_list = BaseCommand.option_list + (
make_option(
'--interval',
type=in... | mit | Python |
f51a317ac34645a6cca6ce35b99f842d867abcd7 | add progress bar when downloading | snap-stanford/ogb | ogb/utils/url.py | ogb/utils/url.py | import urllib.request as ur
import zipfile
import os
import os.path as osp
from six.moves import urllib
import errno
from tqdm import tqdm
GBFACTOR = float(1 << 30)
def decide_download(url):
d = ur.urlopen(url)
size = int(d.info()["Content-Length"])/GBFACTOR
### confirm if larger than 1GB
if size > 1... | import urllib.request as ur
import zipfile
import os
import os.path as osp
from six.moves import urllib
import errno
def decide_download(url):
d = ur.urlopen(url)
GBFACTOR = float(1 << 30)
size = int(d.info()["Content-Length"])/GBFACTOR
### confirm if larger than 1GB
if size > 1:
return in... | mit | Python |
ca7d19715f0ff98e4ab5690290ab13432299135f | add camera id in tests because needed for the hardcoded psf parameters | gdhungana/desispec,timahutchinson/desispec,timahutchinson/desispec,desihub/desispec,gdhungana/desispec,desihub/desispec | py/desispec/test/test_cosmics.py | py/desispec/test/test_cosmics.py | """
test desispec.cosmics
"""
import unittest
import numpy as np
from desispec.image import Image
from desispec.cosmics import reject_cosmic_rays_ala_sdss
from desispec.log import get_logger
#- Create a DESI logger at level WARNING to quiet down the fiberflat calc
import logging
log = get_logger(logging.WARNING)
cl... | """
test desispec.cosmics
"""
import unittest
import numpy as np
from desispec.image import Image
from desispec.cosmics import reject_cosmic_rays_ala_sdss
from desispec.log import get_logger
#- Create a DESI logger at level WARNING to quiet down the fiberflat calc
import logging
log = get_logger(logging.WARNING)
cl... | bsd-3-clause | Python |
4a1afcd3ce3dde34917a134e1fbb254674fd9729 | Introduce scope_types in os-create-backup | mahak/nova,klmitch/nova,klmitch/nova,klmitch/nova,openstack/nova,mahak/nova,mahak/nova,openstack/nova,openstack/nova,klmitch/nova | nova/policies/create_backup.py | nova/policies/create_backup.py | # Copyright 2016 Cloudbase Solutions Srl
# 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 r... | # Copyright 2016 Cloudbase Solutions Srl
# 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 r... | apache-2.0 | Python |
f61cef283f576cfd45e446612d40d3c2c3bb4a42 | add __version__ to osbs/__init__.py | twaugh/osbs-client,DBuildService/osbs-client,DBuildService/osbs-client,jpopelka/osbs-client,pombredanne/osbs-client,pombredanne/osbs-client,vrutkovs/osbs-client,vrutkovs/osbs-client,jpopelka/osbs-client,twaugh/osbs-client,bfontecc007/osbs-client,projectatomic/osbs-client,bfontecc007/osbs-client,projectatomic/osbs-clien... | osbs/__init__.py | osbs/__init__.py | """
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import print_function, absolute_import, unicode_literals
import logging
__version__ = "0.14"
def set_logging(name="osbs",... | """
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import print_function, absolute_import, unicode_literals
import logging
def set_logging(name="osbs", level=logging.DEBUG):
... | bsd-3-clause | Python |
8d1b4a4fa93cd627a74144d993ab83d8dc748032 | Change argument order to osmqa-parser | Mapkin/osmgraph | osmgraph/main.py | osmgraph/main.py | from imposm.parser import OSMParser
from .importer import GraphImporter
def parse_file(filename, **kwargs):
"""
Return an OSM networkx graph from the input OSM file
Only works with OSM xml, xml.bz2 and pbf files. This function cannot take
OSM QA tile files. Use parse_qa_tile() for QA tiles.
>>>... | from imposm.parser import OSMParser
from .importer import GraphImporter
def parse_file(filename, **kwargs):
"""
Return an OSM networkx graph from the input OSM file
Only works with OSM xml, xml.bz2 and pbf files. This function cannot take
OSM QA tile files. Use parse_qa_tile() for QA tiles.
>>>... | mit | Python |
0ee7106e25a18982ed16fd7c3915749423b239d9 | test long line in ci | gboeing/osmnx,gboeing/osmnx | osmnx/bearing.py | osmnx/bearing.py | """Calculate graph edge bearings."""
import math
import numpy as np
def get_bearing(origin_point, destination_point):
"""
Calculate the bearing between two lat-lng points.
Each tuple should represent (lat, lng) as decimal degrees.
Parameters
----------
origin_point : tuple
(lat, lng... | """Calculate graph edge bearings."""
import math
import numpy as np
def get_bearing(origin_point, destination_point):
"""
Calculate the bearing between two lat-lng points.
Each tuple should represent (lat, lng) as decimal degrees.
Parameters
----------
origin_point : tuple
(lat, lng... | mit | Python |
cf1c7f98fe69af82d955a66107b8ed423ec1ffde | add log for sending queue | GordonGaoNY/py_rrfm_re,GORDON17/py_rrfm_re,GORDON17/py_rrfm_re,GordonGaoNY/py_rrfm_re | server/services/sqs_service.py | server/services/sqs_service.py | import json
from boto3.session import Session
from configurations.env_configs import *
class SQSService(object):
def __init__(self):
super(SQSService, self).__init__()
self.session = Session(
aws_access_key_id = AWS_ACCESS_KEY_ID,
aws_secret_access_key = AWS_SERET_ACCESS_KEY,
... | import json
from boto3.session import Session
from configurations.env_configs import *
class SQSService(object):
def __init__(self):
super(SQSService, self).__init__()
self.session = Session(
aws_access_key_id = AWS_ACCESS_KEY_ID,
aws_secret_access_key = AWS_SERET_ACCESS_KEY,
... | mit | Python |
6f88b12daa3556d7f906905e33e189aa6cd8bfd9 | Update messenger.py | WebShark025/TheZigZagProject,WebShark025/TheZigZagProject | plugins/messenger.py | plugins/messenger.py | in_chat_with_support = []
@bot.message_handler(commands=['support'])
def support(message):
userid = message.from_user.id
banlist = redisserver.sismember('zigzag_banlist', '{}'.format(userid))
if banlist:
return
if message.from_user.id not in in_chat_with_support:
bot.reply_to(message, JOINED_MESSENGER_M... | in_chat_with_support = []
@bot.message_handler(commands=['support'])
def support(message):
userid = message.from_user.id
banlist = redisserver.sismember('zigzag_banlist', '{}'.format(userid))
if banlist:
return
if message.from_user.id not in in_chat_with_support:
bot.reply_to(message, JOINED_MESSENGER_M... | mit | Python |
0130f608b710af0e441a21add605c3dc73c8659f | Replace Login form with UserLogin Form with validation | BugisDev/Capture-TheGepeng,BugisDev/Capture-TheGepeng,BugisDev/Capture-TheGepeng | app/user/form.py | app/user/form.py | from flask_wtf import Form
from wtforms import TextField, PasswordField
from wtforms.validators import DataRequired
class UserLoginForm(Form):
username = StringField('username', validators=[DataRequired()])
password = PasswordField('password', validators=[DataRequired()])
def validate_login(self):
... | from flask_wtf import Form
from wtforms import TextField, PasswordField
from wtforms.validators import DataRequired
class LoginForm(Form):
username = TextField('Username', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
| apache-2.0 | Python |
7472411cbebe1bfb24678d52045f946b372f47d5 | Update the API of the tag and the filter to handle the excluded markups | Fantomas42/django-emoticons,Fantomas42/django-emoticons | emoticons/templatetags/emoticons_tags.py | emoticons/templatetags/emoticons_tags.py | """Template tags for emoticons app"""
from django import template
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
from emoticons.settings import EMOTICONS_LIST
from emoticons.settings import EMOTICONS_COMPILED
register = template.Library()
def replace_emoticons(content... | """Template tags for emoticons app"""
from django import template
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
from emoticons.settings import EMOTICONS_LIST
from emoticons.settings import EMOTICONS_COMPILED
register = template.Library()
def replace_emoticons(content... | bsd-3-clause | Python |
a3b8f2c7c4bb064a235ec4ac8f75fe4a20536034 | Update gisgraphy.py | DenisCarriere/geocoder | geocoder/gisgraphy.py | geocoder/gisgraphy.py | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
import logging
from geocoder.base import OneResult, MultipleResultsQuery
class GisgraphyResult(OneResult):
@property
def lat(self):
return self.raw.get('lat')
@property
def lng(self):
return self.raw.get('lng'... | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
import logging
from geocoder.base import OneResult, MultipleResultsQuery
class GisgraphyResult(OneResult):
@property
def lat(self):
return self.raw.get('lat')
@property
def lng(self):
return self.raw.get('lng'... | mit | Python |
c5c7c4d0c1112e2e76b440a9e09c8e1a0e135694 | fix email address | jmontoyam/mne-python,Odingod/mne-python,alexandrebarachant/mne-python,antiface/mne-python,olafhauk/mne-python,andyh616/mne-python,olafhauk/mne-python,cmoutard/mne-python,andyh616/mne-python,rkmaddox/mne-python,yousrabk/mne-python,pravsripad/mne-python,rkmaddox/mne-python,kambysese/mne-python,teonlamont/mne-python,larso... | examples/export/plot_evoked_to_nitime.py | examples/export/plot_evoked_to_nitime.py | """
============================
Export evoked data to Nitime
============================
"""
# Author: Denis Engemann <denis.engemann@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
print(__doc__)
import mne
from mne.datasets import sample
from nitime.v... | """
============================
Export evoked data to Nitime
============================
"""
# Author: Denis Engemann <d.engemann@fz-juelichde>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
print(__doc__)
import mne
from mne.datasets import sample
from nitime.vi... | bsd-3-clause | Python |
f4b80e919b0b4700242ddeee0078ff22e756f74b | Update _common.py | djalex88/blender-gmdc | gmdc_tools/_common.py | gmdc_tools/_common.py | #-------------------------------------------------------------------------------
# Copyright (C) 2016 DjAlex88 (https://github.com/djalex88/)
#
# 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 Softwar... | #-------------------------------------------------------------------------------
# Copyright (C) 2016 DjAlex88 (https://github.com/djalex88/)
#
# 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 Softwar... | mit | Python |
a9883a91c535cbff1499be8395b4ad808a979bb5 | Improve utilities.cache documentation | cswiercz/abelfunctions,cswiercz/abelfunctions,cswiercz/abelfunctions,abelfunctions/abelfunctions,abelfunctions/abelfunctions,abelfunctions/abelfunctions | abelfunctions/utilities/cache.py | abelfunctions/utilities/cache.py | r"""Cache :mod:`abelfunctions.utilities.cache`
==========================================
Module defining cached function decorators.
The decorator :func:`cached_function` works with instance methods as well. It
relies on the ``decorator`` module for forwarding function signatures and
documentation. (Results in poore... | r"""Cache :mod:`abelfunctions.utilities.cache`
==========================================
Code for cacheing functions.
Authors:
- Chris Swierczewski (November 2012)
"""
import decorator
def cached_function(obj):
r"""Decorator for argument and keyword caching.
This memoizing decorator caches over arguments... | mit | Python |
de307d4edb40e8aafc3b38a386afe1b12fc827b2 | Remove the monitor service on removal as well | justin8/portinus,justin8/portinus | portinus/__init__.py | portinus/__init__.py | import logging
import os
from jinja2 import Template
from .cli import task
from . import portinus, restart, systemd, monitor
_script_dir = os.path.dirname(os.path.realpath(__file__))
template_dir = os.path.join(_script_dir, 'templates')
service_dir = '/usr/local/portinus-services'
def get_instance_dir(name):
r... | import logging
import os
from jinja2 import Template
from .cli import task
from . import portinus, restart, systemd, monitor
_script_dir = os.path.dirname(os.path.realpath(__file__))
template_dir = os.path.join(_script_dir, 'templates')
service_dir = '/usr/local/portinus-services'
def get_instance_dir(name):
r... | mit | Python |
f0b65ecaad91e969697ba1de7aab9da70cf15c95 | Allow for no provided argv and get it from sys.argv. | chrismattmann/politics-hacking | politics/countRussia.py | politics/countRussia.py | #!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Licen... | #!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Licen... | apache-2.0 | Python |
dd6110d6d4f53477df01f4204d9f29f6c273b6aa | remove unused import | euri10/populus,pipermerriam/populus,euri10/populus,pipermerriam/populus,euri10/populus | populus/cli/init_cmd.py | populus/cli/init_cmd.py | import os
import click
from populus.utils.filesystem import (
get_contracts_dir, ensure_path_exists
)
from .main import main
@main.command()
def init():
"""
Generate project layout with an example contract.
"""
project_dir = os.getcwd()
contracts_dir = get_contracts_dir(project_dir)
if... | import os
import click
from populus import utils
from populus.utils.filesystem import (
get_contracts_dir, ensure_path_exists
)
from .main import main
@main.command()
def init():
"""
Generate project layout with an example contract.
"""
project_dir = os.getcwd()
contracts_dir = get_contrac... | mit | Python |
d8265a795c9c44fc6650ec40284479790f2e3f34 | Add more repsonse sub-classes | funkybob/paws | paws/response.py | paws/response.py | import json
from Cookie import SimpleCookie
def response(body='', status=200, headers=None):
'''
Generate a response dict for Lambda Proxy
'''
if headers is None:
headers = {}
if isinstance(body, unicode):
body = body.encode('utf-8')
elif not isinstance(body, str):
body... | import json
from Cookie import SimpleCookie
def response(body='', status=200, headers=None):
'''
Generate a response dict for Lambda Proxy
'''
if headers is None:
headers = {}
if isinstance(body, unicode):
body = body.encode('utf-8')
elif not isinstance(body, str):
body... | bsd-3-clause | Python |
b858147e49c54e086b58a0109ba1529fa6372253 | fix naming bug introduced in dd6c61c462894ea7a5dcc4e291a1175802e0c1ba | adaptive-learning/proso-apps,adaptive-learning/proso-apps,adaptive-learning/proso-apps | proso/django/util.py | proso/django/util.py | from functools import wraps
import hashlib
import logging
import re
from django.core.cache import cache
from django.db import connection
LOGGER = logging.getLogger('django.request')
CACHE_MISS = 'proso-apps-cache-miss'
def disable_for_loaddata(signal_handler):
@wraps(signal_handler)
def wrapper(*args, **kwar... | from functools import wraps
import hashlib
import logging
import re
from django.core.cache import cache
from django.db import connection
LOGGER = logging.getLogger('django.request')
CACHE_MISS = 'proso-apps-cache-miss'
def disable_for_loaddata(signal_handler):
@wraps(signal_handler)
def wrapper(*args, **kwar... | mit | Python |
e5bf76e19052c0af8ed40c01ff074dea78941308 | Bump version | l04m33/pyx | pyx/version.py | pyx/version.py | __version__ = '0.1.4'
__all__ = ['__version__']
| __version__ = '0.1.3'
__all__ = ['__version__']
| mit | Python |
45b564629be9b27cdfd261ea68d815204c16567d | Fix clint plugin | tomleese/smartbot,thomasleese/smartbot-old,Cyanogenoid/smartbot,Muzer/smartbot | plugins/clint.py | plugins/clint.py | import random
import requests
import time
import urllib.parse
quotes = [
"I don't think it's nice you laughing.",
"See my mule don't like people laughing, get's the crazy idea you're laughing at him.",
"Get 3 coffins ready.",
"When you hang a man you better look at him.",
"Get off my lawn.",
"I... | import random
import requests
import time
import urllib.parse
quotes = [
"I don't think it's nice you laughing.",
"See my mule don't like people laughing, get's the crazy idea you're laughing at him.",
"Get 3 coffins ready.",
"When you hang a man you better look at him.",
"Get off my lawn.",
"I... | mit | Python |
8fce2ec244af975a42ef1b7cbcf7513712c2251b | Improve hello plugin | ratchetrobotics/espresso | plugins/hello.py | plugins/hello.py | # Be friendly
import random
from espresso.main import robot
hellos = [
"Well hello there!"
"Hello!",
"Hi there!",
"Hallo!"
]
@robot.respond('(?i)(hi)|(hello)|(howdy)|(hallo)')
def hello(res):
res.reply(res.msg.user, random.choice(hellos))
| # Be friendly
import random
from espresso.main import robot
@robot.respond('(?i)(hi)|(hello)|(howdy)|(hallo)')
def hello(res):
res.reply(res.msg.user, "Hi there!")
| bsd-3-clause | Python |
1727586dd06fb93aa4ff65a1e6746e6ee2f00507 | Add start and stop to docs | calou/compose,denverdino/denverdino.github.io,ph-One/compose,danix800/docker.github.io,kikkomep/compose,albers/compose,prologic/compose,hypriot/compose,sanscontext/docker.github.io,londoncalling/docker.github.io,dopry/compose,ralphtheninja/compose,swoopla/compose,jrabbit/compose,shubheksha/docker.github.io,bsmr-docker/... | plum/cli/main.py | plum/cli/main.py | import datetime
import logging
import sys
import os
import re
from docopt import docopt
from inspect import getdoc
from .. import __version__
from ..service_collection import ServiceCollection
from .command import Command
from .errors import UserError
from .docopt_command import NoSuchCommand
log = logging.getLogge... | import datetime
import logging
import sys
import os
import re
from docopt import docopt
from inspect import getdoc
from .. import __version__
from ..service_collection import ServiceCollection
from .command import Command
from .errors import UserError
from .docopt_command import NoSuchCommand
log = logging.getLogge... | apache-2.0 | Python |
36bb13699a14f45acb33fe48494e959b5237bd4e | Update main.py | clccmh/pomodoro | pomodoro/main.py | pomodoro/main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
import progressbar
import time
@click.command()
@click.option('--minutes', default=25, help='Number of minutes, default 25.')
def main(minutes):
bar = progressbar.ProgressBar(widgets=[
progressbar.Bar(),
])
for i in bar(range(minutes*60)):... | #!/usr/bin/env python
import click
import progressbar
import time
@click.command()
@click.option('--minutes', default=25, help='Number of minutes, default 25.')
def pomodoro(minutes):
bar = progressbar.ProgressBar(widgets=[
progressbar.Bar(),
])
for i in bar(range(minutes*60)):
time.sleep(... | mit | Python |
1c43d43ab09eda4913992621e9f21858be25ea2b | add a new method NullCollector.addReader() | TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl | AlphaTwirl/EventReaderPackage.py | AlphaTwirl/EventReaderPackage.py | # Tai Sakuma <sakuma@fnal.gov>
##____________________________________________________________________________||
class EventReaderPackage(object):
def __init__(self, ReaderClass, resultCollector = None):
self._ReaderClass = ReaderClass
self._resultCollector = resultCollector if resultCollector is no... | # Tai Sakuma <sakuma@fnal.gov>
##____________________________________________________________________________||
class EventReaderPackage(object):
def __init__(self, ReaderClass, resultCollector = None):
self._ReaderClass = ReaderClass
self._resultCollector = resultCollector if resultCollector is no... | bsd-3-clause | Python |
9f9ff24af74cf0ce4d3d77efaf6d3647c09e7da8 | fix bugs; unit tests passed; | sdenisen/python | yandex/task10/task10_resolve.py | yandex/task10/task10_resolve.py | """
def revertДана строка (возможно, пустая), состоящая из букв A-Z и пробелов, разделяющих слова.
Нужно написать функцию, которая развернет слова.
И сгенерирует ошибку, если на вход пришла невалидная строка.
Примеры:
"QUICK FOX JUMPS"->"KCIUQ XOF SPMUJ"
" QUICK FOX JUMPS "->" KCIUQ XOF SPMUJ "
" "->" "
""->"
... | """
def revertДана строка (возможно, пустая), состоящая из букв A-Z и пробелов, разделяющих слова.
Нужно написать функцию, которая развернет слова.
И сгенерирует ошибку, если на вход пришла невалидная строка.
Примеры:
"QUICK FOX JUMPS"->"KCIUQ XOF SPMUJ"
" QUICK FOX JUMPS "->" KCIUQ XOF SPMUJ "
" "->" "
""->"
"... | unlicense | Python |
16de098121c96bf0e03f466fb7b168dc5aa965c2 | Corrige Regiao no uso do objeto 'url' | ednilson/journals-catalog,scieloorg/journals-catalog,ednilson/jcatalog | extractors/scimago/downloader_scimago.py | extractors/scimago/downloader_scimago.py | # coding: utf-8
'''
This script downloads all Scimago data in XLS format.
Also adds the columns 'Region'; 'Year' and 'Activate (1)'.
'''
import os
import sys
import wget
from datetime import date
import time
import logging
PROJECT_PATH = os.path.abspath(os.path.dirname(''))
sys.path.append(PROJECT_PATH)
logging.bas... | # coding: utf-8
'''
This script downloads all Scimago data in XLS format.
Also adds the columns 'Region'; 'Country'; 'Year' and 'Activate (1)'.
'''
import os
import sys
import wget
from datetime import date
import time
import logging
PROJECT_PATH = os.path.abspath(os.path.dirname(''))
sys.path.append(PROJECT_PATH)
... | bsd-2-clause | Python |
7d9eafc4c698a514d62d84793ef137dfd8d0c906 | Bump to a stable version 2.0.0 | yoeo/guesslang | guesslang/__init__.py | guesslang/__init__.py | """
Guesslang: a machine learning program that guesses the programming language
of a given source code.
"""
from guesslang.guess import Guess, GuesslangError # noqa: F401
__version__ = '2.0.0'
| """
Guesslang: a machine learning program that guesses the programming language
of a given source code.
"""
from guesslang.guess import Guess, GuesslangError # noqa: F401
__version__ = '2.0.0a1'
| mit | Python |
1ccc3a2e52d27d98304121cd85073c8ff104f896 | remove unnecessary configuration to disable a rule for pylint | ssato/python-anyconfig,ssato/python-anyconfig | src/anyconfig/ioinfo/constants.py | src/anyconfig/ioinfo/constants.py | #
# Copyright (C) 2018 - 2021 Satoru SATOH <satoru.satoh @ gmmail.com>
# SPDX-License-Identifier: MIT
#
r"""ioinfo.constants to provide global constant variables.
"""
import os.path
import re
import typing
GLOB_MARKER: str = '*'
PATH_SEP: str = os.path.sep
SPLIT_PATH_RE: typing.Pattern = re.compile(
fr'([^{GLOB_... | #
# Copyright (C) 2018 - 2021 Satoru SATOH <satoru.satoh @ gmmail.com>
# SPDX-License-Identifier: MIT
#
# pylint: disable=invalid-name
r"""ioinfo.constants to provide global constant variables.
"""
import os.path
import re
import typing
GLOB_MARKER: str = '*'
PATH_SEP: str = os.path.sep
SPLIT_PATH_RE: typing.Pattern... | mit | Python |
0fc9529162e42197a86065f98d41e917392f71a4 | Add section content tick | sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer | falmer/content/models/section_content.py | falmer/content/models/section_content.py | from django.db import models
from wagtail.core import blocks
from wagtail.core.fields import StreamField
from wagtail.admin.edit_handlers import FieldPanel, TabbedInterface, StreamFieldPanel, ObjectList
from wagtail.images.edit_handlers import ImageChooserPanel
from falmer.content.blocks import ContactBlock, SectionBl... | from django.db import models
from wagtail.core import blocks
from wagtail.core.fields import StreamField
from wagtail.admin.edit_handlers import FieldPanel, TabbedInterface, StreamFieldPanel, ObjectList
from wagtail.images.edit_handlers import ImageChooserPanel
from falmer.content.blocks import ContactBlock, SectionBl... | mit | Python |
ed97bc7f1fe7e8902c698b72b57539d5cb371013 | implement rich comparison methods | mogproject/artifact-cli | src/artifactcli/util/caseclass.py | src/artifactcli/util/caseclass.py | from functools import total_ordering
from collections import Hashable
@total_ordering
class CaseClass(object):
"""
Implementation like Scala's case class
"""
def __init__(self, keys):
"""
:param keys: list of attribute names
"""
self.__keys = keys
def __eq__(self,... | class CaseClass(object):
"""
Implementation like Scala's case class
"""
def __init__(self, keys):
"""
:param keys: list of attribute names
"""
self.__keys = keys
def __cmp__(self, other):
if not isinstance(other, self.__class__):
# compare with c... | apache-2.0 | Python |
ff941da481120888548ea6054cc165f91c4e9c5e | fix bug | onelab-eu/sfa,onelab-eu/sfa,yippeecw/sfa,yippeecw/sfa,onelab-eu/sfa,yippeecw/sfa | sfa/rspecs/elements/element.py | sfa/rspecs/elements/element.py | class Element(dict):
fields = {}
def __init__(self, fields={}, element=None, keys=None):
self.element = element
dict.__init__(self, self.fields)
if not keys:
keys = fields.keys()
for key in keys:
if key in fields:
self[key] = fields[key] ... | class Element(dict):
fields = {}
def __init__(self, fields={}, element=None, keys=None):
self.element = element
dict.__init__(self, self.fields)
if not keys:
keys = fields.keys()
for key in keys:
if key in fields:
self[key] = fields[keys]... | mit | Python |
2f6d1127cf8944d089c74fa3c6577846f89cfc10 | Rename global var network to generic node | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | apps/network/src/main/core/node.py | apps/network/src/main/core/node.py | from syft.core.node.network.network import Network
node = Network(name="om-net")
| from syft.core.node.network.network import Network
network = Network(name="om-net")
| apache-2.0 | Python |
83cd6a78a61a81bb2e431ee493dbe9b443e05927 | Fix copypaste error in card definitions | NightKev/fireplace,beheh/fireplace,jleclanche/fireplace | fireplace/cards/wog/neutral_legendary.py | fireplace/cards/wog/neutral_legendary.py | from ..utils import *
##
# Minions
| from ..utils import *
##
# Minions
class OG_151:
"Tentacle of N'Zoth"
deathrattle = Hit(ALL_MINIONS, 1)
| agpl-3.0 | Python |
b9f688338973f4b9c9943871cbf202abc9835209 | Fix typo | jgorset/fandjango,jgorset/fandjango | fandjango/settings.py | fandjango/settings.py | from warnings import warn
from django.conf import settings
FACEBOOK_APPLICATION_ID = getattr(settings, 'FACEBOOK_APPLICATION_ID')
FACEBOOK_APPLICATION_SECRET_KEY = getattr(settings, 'FACEBOOK_APPLICATION_SECRET_KEY')
try:
FACEBOOK_APPLICATION_CANVAS_URL = getattr(settings, 'FACEBOOK_APPLICATION_CANVAS_URL')
exce... | from warnings import warn
from django.conf import settings
FACEBOOK_APPLICATION_ID = getattr(settings, 'FACEBOOK_APPLICATION_ID')
FACEBOOK_APPLICATION_SECRET_KEY = getattr(settings, 'FACEBOOK_APPLICATION_SECRET_KEY')
try:
FACEBOOK_APPLICATION_CANVAS_URL = getattr(settings, 'FACEBOOK_APPLICATION_CANVAS_URL')
exce... | mit | Python |
b6f246ecbb45d10149530de43eebe0dbbc8645a4 | stop running 'remove_unsafe_private_use' unnecessarily | dragon788/wordfreq | wordfreq/util.py | wordfreq/util.py | # coding: utf-8
from unicodedata import normalize
def standardize_word(word):
u"""
Apply various normalizations to the text. In languages where this is
relevant, it will end up in all lowercase letters, with pre-composed
diacritics.
Some language-specific gotchas:
- Words ending with a capit... | # coding: utf-8
from unicodedata import normalize
from ftfy.fixes import remove_unsafe_private_use
def standardize_word(word):
u"""
Apply various normalizations to the text. In languages where this is
relevant, it will end up in all lowercase letters, with pre-composed
diacritics.
Some language-s... | mit | Python |
8b900a8e37b83d89b4228762fe9602e388864377 | Fix and simplify `generate_random_users()`. Randomization wasn't guaranteed and I've seen it break with `IntegrityError: column username is not unique`. | armstrong/armstrong.dev | armstrong/dev/tests/utils/users.py | armstrong/dev/tests/utils/users.py | import random
try:
from django.contrib.auth import get_user_model
except ImportError: # Django < 1.5
from django.contrib.auth.models import User
else:
User = get_user_model()
def generate_random_users(count, **extra_fields):
"""Generator to create ``count`` number of unique random users"""
num =... | from armstrong.dev.tests.utils.base import ArmstrongTestCase
from django.contrib.auth.models import User
import random
def generate_random_user():
r = random.randint(10000, 20000)
return User.objects.create(username="random-user-%d" % r,
first_name="Some", last_name="Random User %d" % r)
def gene... | apache-2.0 | Python |
7f63ed9ff07f3bfe36d573049a0b1b09562e2b41 | Remove erronous comment | szeestraten/kidsakoder-minecraft,szeestraten/kidsakoder-minecraft,szeestraten/kidsakoder-minecraft,szeestraten/kidsakoder-minecraft | flask_app/database.py | flask_app/database.py | # -*- coding: utf-8 -*-
"""
flask_app.database
~~~~~~~~~~~~~~~~~~
The database controller
"""
db = None
def init(app):
"""
Initialize Flask-SQLAlchemy
:param app: The Flask application to create database for
:return: SQLAlchemy database reference
"""
from flask_sqlalchemy import SQLAlchemy
... | # -*- coding: utf-8 -*-
"""
flask_app.database
~~~~~~~~~~~~~~~~~~
The database controller
"""
db = None
def init(app):
"""
Initialize Flask-SQLAlchemy
:param app: The Flask application to create database for
:return: SQLAlchemy database reference
"""
from flask_sqlalchemy import SQLAlchemy
... | mit | Python |
e8f2f1c9db328dd8116a44d9d934ecef3bc7fb5e | Raise ValueError explicitly from __call__ rather than with super() | kissgyorgy/enum34-custom | enum34_custom.py | enum34_custom.py | from enum import Enum, EnumMeta
from functools import total_ordering
class _MultiValueMeta(EnumMeta):
def __init__(self, cls, bases, classdict):
# make sure we only have tuple values, not single values
for member in self.__members__.values():
if not isinstance(member.value, tuple):
... | from enum import Enum, EnumMeta
from functools import total_ordering
class _MultiValueMeta(EnumMeta):
def __init__(self, cls, bases, classdict):
# make sure we only have tuple values, not single values
for member in self.__members__.values():
if not isinstance(member.value, tuple):
... | mit | Python |
47c0b468e8025d79694c966f8faf5b5dc261620e | Add client_key to the methods | porduna/weblabdeusto,weblabdeusto/weblabdeusto,morelab/weblabdeusto,porduna/weblabdeusto,morelab/weblabdeusto,morelab/weblabdeusto,weblabdeusto/weblabdeusto,morelab/weblabdeusto,morelab/weblabdeusto,porduna/weblabdeusto,morelab/weblabdeusto,porduna/weblabdeusto,weblabdeusto/weblabdeusto,porduna/weblabdeusto,weblabdeust... | experiments/unmanaged/labview/test_server.py | experiments/unmanaged/labview/test_server.py | HOST = 'localhost'
PORT = 20000
# PORT = 80
WEBLAB_SECRET = "12345@&"
DEBUG_MESSAGE = True
DEBUG_COMMAND = True
import socket
import time
def _dbg_message(msg):
if DEBUG_MESSAGE:
print msg
def _dbg_command(msg):
if DEBUG_COMMAND:
print msg
def _send_message(message):
message = messag... | HOST = 'localhost'
PORT = 20000
# PORT = 80
WEBLAB_SECRET = "12345@&"
DEBUG_MESSAGE = True
DEBUG_COMMAND = True
import socket
import time
def _dbg_message(msg):
if DEBUG_MESSAGE:
print msg
def _dbg_command(msg):
if DEBUG_COMMAND:
print msg
def _send_message(message):
message = messag... | bsd-2-clause | Python |
7ab1f23f9a64b31d35e45530bf423eb26ab229c0 | fix defer html | IT-PM-OpenAdaptronik/Webapp,IT-PM-OpenAdaptronik/Webapp,IT-PM-OpenAdaptronik/Webapp | apps/utils/templatetags/defer.py | apps/utils/templatetags/defer.py | from django import template
from django.utils import html
register = template.Library()
def _collect(context, name):
if not context[name]:
return ''
res = ''
for node in context[name]():
res += node
return res
class DeferHtml(template.Node):
def __init__(self, nodelist):
s... | from django import template
from django.utils import html
register = template.Library()
def _collect(context, name):
if not hasattr(context, name):
return ''
res = ''
for node in context[name]():
res += node
return res
class DeferHtml(template.Node):
def __init__(self, nodelist):
... | mit | Python |
53e11d3cc624c35cf605eb33a2179875998c81e6 | Handle NoneType in encoder | erussell/hstore-field | hstore_field/forms.py | hstore_field/forms.py | import datetime, numbers
from django import forms
from django.forms import widgets
from django.forms.util import flatatt, ValidationError
from django.utils import simplejson
from django.utils.encoding import force_unicode
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
de... | import datetime, numbers
from django import forms
from django.forms import widgets
from django.forms.util import flatatt, ValidationError
from django.utils import simplejson
from django.utils.encoding import force_unicode
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
de... | bsd-3-clause | Python |
ab168e1c08491e8a180009cb200d1e99f6129e4f | fix migrations | tsotetsi/textily-web,tsotetsi/textily-web,ewheeler/rapidpro,pulilab/rapidpro,ewheeler/rapidpro,pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro,tsotetsi/textily-web,tsotetsi/textily-web,praekelt/rapidpro,praekelt/rapidpro,praekelt/rapidpro,ewheeler/rapidpro,reyrodrigues/EU-SMS,reyrodrigues/EU-SMS,tsotetsi/textily-web... | temba/values/migrations/0004_auto_20150728_1030.py | temba/values/migrations/0004_auto_20150728_1030.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def fix_district_contact_fields_values(apps, schema_editor):
Value = apps.get_model('values', 'Value')
ContactField = apps.get_model('contacts', 'ContactField')
for district_value in Value.objects.fi... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def fix_district_contact_fields_values(apps, schema_editor):
Value = apps.get_model('values', 'Value')
ContactField = apps.get_model('contacts', 'ContactField')
for district_value in Value.objects.fi... | agpl-3.0 | Python |
2d49bc0ff49d2dce8f0ba1e55e7062b28af6bb7c | Remove unused is_enabled() | Juraci/tempest,Tesora/tesora-tempest,vedujoshi/tempest,tudorvio/tempest,zsoltdudas/lis-tempest,nunogt/tempest,nunogt/tempest,bigswitch/tempest,manasi24/tempest,dkalashnik/tempest,sebrandon1/tempest,varunarya10/tempest,xbezdick/tempest,rakeshmi/tempest,JioCloud/tempest,dkalashnik/tempest,xbezdick/tempest,NexusIS/tempest... | tempest/services/compute/json/extensions_client.py | tempest/services/compute/json/extensions_client.py | # Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | # Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | apache-2.0 | Python |
7eac7f2a37347372a2dc9f26b7998c5423a03530 | add ConfigurationError handling for kafka CLI tools | Yelp/kafka-utils,anthonysandrin/kafka-utils,Yelp/kafka-utils,anthonysandrin/kafka-utils | yelp_kafka_tool/kafka_consumer_manager/main.py | yelp_kafka_tool/kafka_consumer_manager/main.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import logging
import sys
from yelp_kafka.error import ConfigurationError
from .commands.delete_topics import DeleteTopics
from .commands.list_topics import ListTopics
from .commands.o... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import logging
from .commands.delete_topics import DeleteTopics
from .commands.list_topics import ListTopics
from .commands.offset_advance import OffsetAdvance
from .commands.offset_get... | apache-2.0 | Python |
bd921b1b7820cd9ead731610c284a162ec5d8c14 | Remove accidental num classes | keras-team/keras-cv,keras-team/keras-cv,keras-team/keras-cv | keras_cv/layers/preprocessing/random_shear_test.py | keras_cv/layers/preprocessing/random_shear_test.py | # Copyright 2022 The KerasCV Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | # Copyright 2022 The KerasCV Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | apache-2.0 | Python |
9ade44116e653f995e72a61a1d4d6264e31fba84 | Make `Counter.get_and_increment` atomic | shoopio/shoop,shoopio/shoop,suutari-ai/shoop,shoopio/shoop,suutari-ai/shoop,suutari-ai/shoop | shuup/core/models/_counters.py | shuup/core/models/_counters.py | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import with_statement
from django.db import models... | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import with_statement
from django.db import models... | agpl-3.0 | Python |
73b24bd5d2ed471d2dbf85d5733742d3e8363017 | use ugettext_lazy | liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4 | adhocracy4/phases/models.py | adhocracy4/phases/models.py | from datetime import timedelta
from django.core.exceptions import ValidationError
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from adhocracy4.modules import models as modules_models
from . import content
from .validators import validate_conte... | from datetime import timedelta
from django.core.exceptions import ValidationError
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext as _
from adhocracy4.modules import models as modules_models
from . import content
from .validators import validate_content
... | agpl-3.0 | Python |
9b3a5cbaba92e8d7f234363277a5a1117024232b | fix itests for ZKTaskStore | somic/paasta,somic/paasta,Yelp/paasta,Yelp/paasta | paasta_itests/steps/paasta_native_task_store_steps.py | paasta_itests/steps/paasta_native_task_store_steps.py | from __future__ import absolute_import
from __future__ import unicode_literals
import json
from behave import given
from behave import then
from behave import when
from paasta_tools.frameworks.task_store import MesosTaskParameters
from paasta_tools.frameworks.task_store import ZKTaskStore
@given('a ZKTaskStore')
d... | from __future__ import absolute_import
from __future__ import unicode_literals
import json
from behave import given
from behave import then
from behave import when
from paasta_tools.frameworks.task_store import MesosTaskParameters
from paasta_tools.frameworks.task_store import ZKTaskStore
@given('a ZKTaskStore')
d... | apache-2.0 | Python |
731148e0e189a2d584cae8f084804fb6c2698dcb | Use CMake for libmng package (#14747) | LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/libmng/package.py | var/spack/repos/builtin/packages/libmng/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libmng(CMakePackage):
"""THE reference library for reading, displaying, writing
and... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libmng(AutotoolsPackage):
"""libmng -THE reference library for reading, displaying, writin... | lgpl-2.1 | Python |
263c90ef2674aecde32a4bcbb4fcd064ec78b2b6 | bump version to 0.2.1dev | dacoex/pvlib-python,mikofski/pvlib-python,anomam/pvlib-python,pvlib/pvlib-python,jforbess/pvlib-python,rubennj/pvlib-python,ianctse/pvlib-python,MoonRaker/pvlib-python,cwhanse/pvlib-python,alorenzo175/pvlib-python,wholmgren/pvlib-python,uvchik/pvlib-python | pvlib/version.py | pvlib/version.py | __version__ = "0.2.1dev"
| __version__ = "0.2.0"
| bsd-3-clause | Python |
b810a113af9ce32b7e83d122187878cf1b014631 | disable mmx | LLNL/spack,EmreAtes/spack,LLNL/spack,TheTimmy/spack,mfherbst/spack,matthiasdiener/spack,krafczyk/spack,iulian787/spack,mfherbst/spack,LLNL/spack,EmreAtes/spack,EmreAtes/spack,iulian787/spack,tmerrick1/spack,tmerrick1/spack,EmreAtes/spack,mfherbst/spack,LLNL/spack,iulian787/spack,EmreAtes/spack,tmerrick1/spack,skosukhin... | var/spack/repos/builtin/packages/pixman/package.py | var/spack/repos/builtin/packages/pixman/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
7d947b7fc4804b1e87736ff916b2e2f97a285274 | Update version.py | MoonRaker/pvlib-python,dacoex/pvlib-python,mikofski/pvlib-python,anomam/pvlib-python,jforbess/pvlib-python,wholmgren/pvlib-python,pvlib/pvlib-python,uvchik/pvlib-python,rubennj/pvlib-python,alorenzo175/pvlib-python,cwhanse/pvlib-python,ianctse/pvlib-python | pvlib/version.py | pvlib/version.py | __version__ = "0.2.0"
| __version__ = "0.2.0dev"
| bsd-3-clause | Python |
6d5c1f957e565276585366efa34febbe93a6a437 | use numpy uint8 dtype | jameshicks/pydigree,jameshicks/pydigree | pydigree/misc.py | pydigree/misc.py | from itertools import izip
import numpy as np
from pydigree.cyfuncs import ibs
# Extra genetics functions
def py_ibs(g1, g2, checkmissing=True):
"""
Returns the number of alleles identical by state between two genotypes
Arguements: Two tuples
Returns: an integer
"""
a, b = g1
c, d = g2
... | from itertools import izip
import numpy as np
from pydigree.cyfuncs import ibs
# Extra genetics functions
def py_ibs(g1, g2, checkmissing=True):
"""
Returns the number of alleles identical by state between two genotypes
Arguements: Two tuples
Returns: an integer
"""
a, b = g1
c, d = g2
... | apache-2.0 | Python |
b119a40f00130990f2fcb8e567b7a4e966efa297 | add option for turning off gmsh output | nschloe/python4gmsh | pygmsh/helper.py | pygmsh/helper.py | # -*- coding: utf-8 -*-
#
import numpy
import sys
if sys.platform == 'darwin':
# likely there.
gmsh_executable = '/Applications/Gmsh.app/Contents/MacOS/gmsh'
else:
gmsh_executable = 'gmsh'
def rotation_matrix(u, theta):
'''Return matrix that implements the rotation around the vector :math:`u`
by... | # -*- coding: utf-8 -*-
#
import numpy
import sys
if sys.platform == 'darwin':
# likely there.
gmsh_executable = '/Applications/Gmsh.app/Contents/MacOS/gmsh'
else:
gmsh_executable = 'gmsh'
def rotation_matrix(u, theta):
'''Return matrix that implements the rotation around the vector :math:`u`
b... | bsd-3-clause | Python |
4c30b4fe85ea8fbf71c37078fec7eed0c613e20f | Add line to suppress runtime warning from numpy | marcharper/Axelrod,marcharper/Axelrod,ranjinidas/Axelrod,ranjinidas/Axelrod | axelrod/eigen.py | axelrod/eigen.py | """
Compute the principal eigenvector of a matrix using power iteration.
See also numpy.linalg.eig which calculates all the eigenvalues and
eigenvectors.
"""
import numpy
def normalise(nvec):
"""Normalises the given numpy array."""
with numpy.errstate(invalid='ignore'):
result = nvec / numpy.sqrt(nu... | """
Compute the principal eigenvector of a matrix using power iteration.
See also numpy.linalg.eig which calculates all the eigenvalues and
eigenvectors.
"""
import numpy
def normalise(nvec):
"""Normalises the given numpy array."""
return nvec / numpy.sqrt(numpy.dot(nvec, nvec))
def squared_error(vector_1,... | mit | Python |
2727127836a525cc256c85018310f71034c0a9fc | Bump to version 2.0.0 | mayeut/pybase64,mayeut/pybase64 | pybase64/_version.py | pybase64/_version.py | __version__ = '0.2.0'
| __version__ = '0.1.2'
| bsd-2-clause | Python |
e84ec71e722c07beb2c2d3c7759fad2b3384ee78 | Remove hola comment | CulturePlex/pybossa,inteligencia-coletiva-lsd/pybossa,OpenNewsLabs/pybossa,CulturePlex/pybossa,proyectos-analizo-info/pybossa-analizo-info,stefanhahmann/pybossa,OpenNewsLabs/pybossa,PyBossa/pybossa,PyBossa/pybossa,inteligencia-coletiva-lsd/pybossa,Scifabric/pybossa,geotagx/pybossa,harihpr/tweetclickers,CulturePlex/pybo... | pybossa/view/home.py | pybossa/view/home.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa 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... | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa 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... | agpl-3.0 | Python |
027af870cb54a2d39caabac43cf302c4333a5b14 | Update circle.py | Kaceykaso/design_by_roomba,Kaceykaso/design_by_roomba | python/circle.py | python/circle.py | # Circle script
# Executed when asked to draw a circle by the user
# Draws a 12 inch circle
import serial
import create
from time import strftime
# Create robot
robot = create.Create("/dev/ttyUSB0")
robot.toFullMode()
# Record current position, at start of drawing
pose = robot.getPose()
now = strftime("%H:%M:%S %m-%... | # Square script
# Executed when asked to draw a square by the user
# Draws a 12 inch square
import serial
import create
from time import strftime
# Create robot
robot = create.Create("/dev/ttyUSB0")
robot.toFullMode()
# Record current position, at start of drawing
pose = robot.getPose()
now = strftime("%H:%M:%S %m-%... | mit | Python |
28c4792a4edcc6197931ffae84ae0f3cfb9db252 | fix indenting and message | jbisbee/python-shell-enhancement | pythonstartup.py | pythonstartup.py | # Pulled these two examples together for the following code
# http://docs.python.org/2/library/rlcompleter.html#module-rlcompleter
# http://geoffford.wordpress.com/2009/01/20/python-repl-enhancement/
try:
import readline
import rlcompleter
import atexit
import os
import sys
import platform
exce... | # Pulled these two examples together for the following code
# http://docs.python.org/2/library/rlcompleter.html#module-rlcompleter
# http://geoffford.wordpress.com/2009/01/20/python-repl-enhancement/
try:
import readline
import rlcompleter
import atexit
import os
import sys
import platform
exce... | mit | Python |
aac9bdc6ee410af47f6eadef0a1fbfb2c98c858b | Test multi-column indexes | SunDwarf/asyncqlio | tests/test_2table.py | tests/test_2table.py | """
Tests methods of Table.
"""
import pytest
from asyncqlio.db import DatabaseInterface
from asyncqlio.exc import DatabaseException
from asyncqlio.orm.schema.column import Column
from asyncqlio.orm.schema.index import Index
from asyncqlio.orm.schema.relationship import Relationship, ForeignKey
from asyncqlio.orm.sc... | """
Tests methods of Table.
"""
import pytest
from asyncqlio.db import DatabaseInterface
from asyncqlio.exc import DatabaseException
from asyncqlio.orm.schema.column import Column
from asyncqlio.orm.schema.index import Index
from asyncqlio.orm.schema.relationship import Relationship, ForeignKey
from asyncqlio.orm.sc... | mit | Python |
e2b14a367e9ce9186a98bf31a01b3917dc4957d2 | Add a fancy banner. | concordusapps/alchemist | alchemist/commands/shell.py | alchemist/commands/shell.py | # -*- coding: utf-8 -*-
from flask.ext import script
from alchemist import db
from termcolor import colored
from collections import defaultdict
import sys
def _make_context():
"""Create the namespace of items already pre-imported when using shell-plus
"""
namespace = {'db': db, 'session': db.session}
... | # -*- coding: utf-8 -*-
from flask.ext import script
from alchemist import db
import sys
def _make_context():
"""Create the namespace of items already pre-imported when using shell-plus
"""
namespace = {'db': db, 'session': db.session}
for component, registry in db.registry.items():
namespac... | mit | Python |
df41828fcb91e8c50cb2ad044f4a62ffd9d57bb5 | Change keyword BaseCSV init() to make consistent with settings attribute | soccermetrics/marcotti-events | etl/ecsv/base.py | etl/ecsv/base.py | import os
import csv
import glob
import logging
logger = logging.getLogger(__name__)
def extract(func):
"""
Decorator function. Open and extract data from CSV files. Return list of dictionaries.
:param func: Wrapped function with *args and **kwargs arguments.
"""
def _wrapper(*args):
o... | import os
import csv
import glob
import logging
logger = logging.getLogger(__name__)
def extract(func):
"""
Decorator function. Open and extract data from CSV files. Return list of dictionaries.
:param func: Wrapped function with *args and **kwargs arguments.
"""
def _wrapper(*args):
o... | mit | Python |
0aa105d7f9467e42bfeeb3b97e2559f6c09aaff5 | Complete my own alg_breadth_first_search.py | bowen0701/algorithms_data_structures | alg_breadth_first_search.py | alg_breadth_first_search.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from ds_queue import Queue
def bfs(graph_dict, start_vertex):
"""Breadth First Search algorith."""
ls_queue = Queue()
ls_queue.enqueue([start_vertex])
# print('ls_queue: {}'.format(ls_queue.sh... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from ds_queue import Queue
def bfs(graph_dict, start_vertex):
queue = Queue()
queue.enqueue(start_vertex)
visited_set = set()
while queue:
path = queue.dequeue()
vertex = pat... | bsd-2-clause | Python |
739a5a85a455105f01013b20762b1b493c4d5027 | Simplify invalid decode warning text | jbittel/django-deflect | deflect/views.py | deflect/views.py | from __future__ import unicode_literals
import base32_crockford
import logging
from django.db.models import F
from django.http import Http404
from django.http import HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from django.utils.timezone import now
from .models import ShortURL
from .m... | from __future__ import unicode_literals
import base32_crockford
import logging
from django.db.models import F
from django.http import Http404
from django.http import HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from django.utils.timezone import now
from .models import ShortURL
from .m... | bsd-3-clause | Python |
6b1fd125794c6be09efcdb02832f435232454bca | fix typo | obestwalter/i3configger | tests/test_config.py | tests/test_config.py | import json
import pytest
from i3configger import config
def test_initialization(tmpdir, monkeypatch):
"""Given empty sources directory a new config is created from defaults"""
monkeypatch.setattr(config, 'get_i3wm_config_path', lambda: tmpdir)
assert not (tmpdir / 'config.d').exists()
config.ensure... | import json
import pytest
from i3configger import config
def test_initialization(tmpdir, monkeypatch):
"""Given empty sources directory a new config is created from defaults"""
monkeypatch.setattr(config, 'get_i3wm_config_path', lambda: tmpdir)
assert not (tmpdir / 'config.d').exists()
config.ensure... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.