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 |
|---|---|---|---|---|---|---|---|---|
0e3c7463cd2763db93ddb2227a44519fa06fb178 | Fix duplicate auth_section issue | openstack/zaqar,openstack/zaqar,openstack/zaqar,openstack/zaqar | zaqar/transport/auth.py | zaqar/transport/auth.py | # Copyright (c) 2013 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 applicable law or agreed to in writ... | # Copyright (c) 2013 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 applicable law or agreed to in writ... | apache-2.0 | Python |
4384a5f0227ef0d7269e213e625cd30f1e965954 | fix json encoding of bytes | lbryio/lbry,lbryio/lbry,lbryio/lbry | lbrynet/daemon/json_response_encoder.py | lbrynet/daemon/json_response_encoder.py | from decimal import Decimal
from binascii import hexlify
from datetime import datetime
from json import JSONEncoder
from lbrynet.wallet.transaction import Transaction, Output
class JSONResponseEncoder(JSONEncoder):
def __init__(self, *args, ledger, **kwargs):
super().__init__(*args, **kwargs)
sel... | from decimal import Decimal
from binascii import hexlify
from datetime import datetime
from json import JSONEncoder
from lbrynet.wallet.transaction import Transaction, Output
class JSONResponseEncoder(JSONEncoder):
def __init__(self, *args, ledger, **kwargs):
super().__init__(*args, **kwargs)
sel... | mit | Python |
3ee48de461c0efbe7ed0c706650264d772331e10 | add test for adding images without correct json | shaunster0/object_recognition_service | test_recognition_server.py | test_recognition_server.py | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 12 19:16:24 2017
@author: Shaun Werkhoven
@purpose: run unit tests for recognition_server.py
"""
import pytest
import os
import recognition_server
import unittest
import json
class Recognition_ServerTestCase(unittest.TestCase):
def setUp(self):
recognition_... | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 12 19:16:24 2017
@author: Shaun Werkhoven
@purpose: run unit tests for recognition_server.py
"""
import pytest
import os
import recognition_server
import unittest
import json
class Recognition_ServerTestCase(unittest.TestCase):
def setUp(self):
recognition_... | apache-2.0 | Python |
50195fd913d05834fce3cf4ab088795cb738f41d | Bump version for pypi to 0.2018.06.25.0108 | oduwsdl/ipwb,oduwsdl/ipwb,oduwsdl/ipwb,oduwsdl/ipwb | ipwb/__init__.py | ipwb/__init__.py | __version__ = '0.2018.06.25.0108'
| __version__ = '0.2018.06.22.0317'
| mit | Python |
ca2789ad15cba31449e4946494122ab271a83c92 | Set MEDIA_ROOT setting for Production. | FarmCodeGary/InspirationForge,FarmCodeGary/InspirationForge,FarmCodeGary/InspirationForge | inspirationforge/settings/production.py | inspirationforge/settings/production.py | from .base import *
DEBUG = False
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# Security-related settings
ALLOWED_HOSTS = ["*"]
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
CSRF_COOKIE_HTTPONLY = T... | from .base import *
DEBUG = False
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
# TODO: Add MEDIA_ROOT setting.
#MEDIA_ROOT = get_secret("MEDIA_ROOT")
# Security-related settings
ALLOWED_HOSTS = ["*"]
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https'... | mit | Python |
fe316b69471ba1df05b3e9bcdd55fdd30195acde | Bump version for pypi to 0.2018.07.08.0411 | oduwsdl/ipwb,oduwsdl/ipwb,oduwsdl/ipwb,oduwsdl/ipwb | ipwb/__init__.py | ipwb/__init__.py | __version__ = '0.2018.07.08.0411'
| __version__ = '0.2018.07.08.0343'
| mit | Python |
0054667fa2edc2f118de0dd68eb6f47c7129ed4a | Bump version to 0.1.4 | pennersr/django-hijack,arteria/django-hijack,arteria/django-hijack,arteria/django-hijack,pennersr/django-hijack | hijack/__init__.py | hijack/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.1.4'
| # -*- coding: utf-8 -*-
__version__ = '0.1.3'
| mit | Python |
4cda284c8e1019726bb7dc6af6a50d63176b6424 | fix bug if trying to logout without being logged in | saruberoz/photodl,saruberoz/photodl | photodl/app/account.py | photodl/app/account.py | #! /usr/bin/env python
# External Imports
from flask import (
Blueprint,
request,
url_for,
redirect,
render_template,
session,
flash
)
from functools import wraps
from instagram import client
from instagram.oauth2 import OAuth2AuthExchangeError
api = None
account = Blueprint('account', __... | #! /usr/bin/env python
# External Imports
from flask import (
Blueprint,
request,
url_for,
redirect,
render_template,
session,
flash
)
from functools import wraps
from instagram import client
from instagram.oauth2 import OAuth2AuthExchangeError
api = None
account = Blueprint('account', __... | mit | Python |
9dab5f31d7d8c704e5e528373c46361d810cad20 | remove spurious MealFactory | madmath/sous-chef,savoirfairelinux/sous-chef,savoirfairelinux/santropol-feast,madmath/sous-chef,savoirfairelinux/sous-chef,madmath/sous-chef,savoirfairelinux/sous-chef,savoirfairelinux/santropol-feast,savoirfairelinux/santropol-feast | django/santropolFeast/meal/factories.py | django/santropolFeast/meal/factories.py | # coding=utf-8
import factory
from meal.models import Ingredient, Allergy
class IngredientFactory(factory.DjangoModelFactory):
class Meta:
model = Ingredient
name = "Tomato"
@classmethod
def __init__(self, **kwargs):
name = kwargs.pop('name', None)
ingredients = super(Ingred... | # coding=utf-8
import factory
from meal.model import Meal, Ingredient, Allergy
class MealFactory(factory.DjangoModelFactory):
class Meta:
model = Meal
name = "Tomato Soupe"
description = "A Simple Tomato Soupe"
size = "R"
@classmethod
def __init__(self, **kwargs):
name = kwa... | agpl-3.0 | Python |
b6152f3cfc64b71fe9bda1c574dd1b6037dd2694 | Make corruptors alloc method be a) a classmethod b) return self. | CIFASIS/pylearn2,bartvm/pylearn2,alexjc/pylearn2,JesseLivezey/pylearn2,abergeron/pylearn2,woozzu/pylearn2,Refefer/pylearn2,lunyang/pylearn2,chrish42/pylearn,daemonmaker/pylearn2,fishcorn/pylearn2,sandeepkbhat/pylearn2,kastnerkyle/pylearn2,se4u/pylearn2,hyqneuron/pylearn2-maxsom,chrish42/pylearn,kose-y/pylearn2,kose-y/p... | corruption.py | corruption.py | """
Corruptor classes: classes that encapsulate the noise process for the DAE
training criterion.
"""
import numpy
import theano
from theano import tensor
theano.config.warn.sum_div_dimshuffle_bug = False
floatX = theano.config.floatX
sharedX = lambda X, name : theano.shared(numpy.asarray(X, dtype=floatX), name=name)
... | """
Corruptor classes: classes that encapsulate the noise process for the DAE
training criterion.
"""
import numpy
import theano
from theano import tensor
theano.config.warn.sum_div_dimshuffle_bug = False
floatX = theano.config.floatX
sharedX = lambda X, name : theano.shared(numpy.asarray(X, dtype=floatX), name=name)
... | bsd-3-clause | Python |
809eba95fb5a031a9820712a88f99ba2a7c4706b | fix tests | com4/eventmq | eventmq/tests/test_sender.py | eventmq/tests/test_sender.py | # This file is part of eventmq.
#
# eventmq 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.
#
# eventmq is distributed in the hope that... | # This file is part of eventmq.
#
# eventmq 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.
#
# eventmq is distributed in the hope that... | lgpl-2.1 | Python |
3f2ab5710fb07a78c5b7f67afb785e9aab5e7695 | Break potential cycle because we are storing the traceback | saghul/evergreen,saghul/evergreen | evergreen/core/threadpool.py | evergreen/core/threadpool.py | #
# This file is part of Evergreen. See the NOTICE for more information.
#
import pyuv
import sys
from evergreen.event import Event
from evergreen.futures import Future
__all__ = ('ThreadPool')
"""Internal thread pool which uses the pyuv work queuing capability. This module
is for internal use of Evergreen.
"""
c... | #
# This file is part of Evergreen. See the NOTICE for more information.
#
import pyuv
import sys
from evergreen.event import Event
from evergreen.futures import Future
__all__ = ('ThreadPool')
"""Internal thread pool which uses the pyuv work queuing capability. This module
is for internal use of Evergreen.
"""
c... | mit | Python |
962e5ead833efc9021bcfa3ab37f26e48e1d29da | Add hub connect ip based on OpenShift information | luisfdez/oauthenticator,luisfdez/oauthenticator | example/jupyterhub_config.py | example/jupyterhub_config.py | # Configuration file for Jupyter Hub
import os
import codecs
c = get_config()
c.JupyterHub.log_level = 10
c.JupyterHub.authenticator_class = 'oauthenticator.openshift.LocalOpenShiftOAuthenticator'
c.LocalOpenShiftOAuthenticator.create_system_users = True
with codecs.open('/var/run/secrets/kubernetes.io/serviceaccou... | # Configuration file for Jupyter Hub
import os
import codecs
c = get_config()
c.JupyterHub.log_level = 10
c.JupyterHub.authenticator_class = 'oauthenticator.openshift.LocalOpenShiftOAuthenticator'
c.LocalOpenShiftOAuthenticator.create_system_users = True
with codecs.open('/var/run/secrets/kubernetes.io/serviceaccou... | bsd-3-clause | Python |
56cdcde184b613dabdcc3f999b90915f75e03726 | Update test to check basic case for playback without current track | hkariti/mopidy,mopidy/mopidy,abarisain/mopidy,quartz55/mopidy,ZenithDK/mopidy,quartz55/mopidy,priestd09/mopidy,diandiankan/mopidy,dbrgn/mopidy,diandiankan/mopidy,SuperStarPL/mopidy,adamcik/mopidy,rawdlite/mopidy,liamw9534/mopidy,pacificIT/mopidy,jcass77/mopidy,bencevans/mopidy,mokieyue/mopidy,swak/mopidy,bacontext/mopi... | tests/backends/__init__.py | tests/backends/__init__.py | from mopidy.models import Track
class BaseCurrentPlaylistControllerTest(object):
uris = []
backend_class = None
def setUp(self):
self.backend = self.backend_class()
def test_add(self):
playlist = self.backend.current_playlist
for uri in self.uris:
playlist.add(uri... | from mopidy.models import Track
class BaseCurrentPlaylistControllerTest(object):
uris = []
backend_class = None
def setUp(self):
self.backend = self.backend_class()
def test_add(self):
playlist = self.backend.current_playlist
for uri in self.uris:
playlist.add(uri... | apache-2.0 | Python |
7ebda7fca01372ae49a8c66812c958fc8200f4b0 | Change Django field filter kwarg from name to field_name for Django 2 support | dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4 | apps/events/filters.py | apps/events/filters.py | import django_filters
from django_filters.filters import Lookup
from apps.events.models import Event
class ListFilter(django_filters.Filter):
# https://github.com/carltongibson/django-filter/issues/137#issuecomment-37820702
def filter(self, qs, value):
value_list = value.split(u',')
return su... | import django_filters
from django_filters.filters import Lookup
from apps.events.models import Event
class ListFilter(django_filters.Filter):
# https://github.com/carltongibson/django-filter/issues/137#issuecomment-37820702
def filter(self, qs, value):
value_list = value.split(u',')
return su... | mit | Python |
fd980f99ad674cc77ac0a5cc7f348b4d9ae2d67b | Edit docstring | Alweezy/alvin-mutisya-dojo-project | models/people.py | models/people.py | class Person(object):
"""Models the kind of people available at Andela,
It forms the base class from which classes Fellow and Staff inherit"""
person_id = 0
staff_id = ''
fellow_id = ''
def __init__(self, first_name, last_name, occupation):
"""Initializes the base class Person
... | class Person(object):
"""Models the kind of people available at Andela,
It forms the base class from which classes Fellow and Staff inherit"""
person_id = 0
staff_id = ''
fellow_id = ''
def __init__(self, first_name, last_name, occupation):
"""Initializes the base class Person
... | mit | Python |
f3d868840a919613583172e2de313394f76b65ab | Remove view and placement information from the LiveFeedWidget | mokshaproject/moksha,ralphbean/moksha,ralphbean/moksha,lmacken/moksha,mokshaproject/moksha,pombredanne/moksha,pombredanne/moksha,ralphbean/moksha,mokshaproject/moksha,mokshaproject/moksha,pombredanne/moksha,lmacken/moksha,pombredanne/moksha,lmacken/moksha | moksha/api/widgets/feed/live.py | moksha/api/widgets/feed/live.py | # This file is part of Moksha.
#
# Moksha 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.
#
# Moksha is distributed in the hope that it... | # This file is part of Moksha.
#
# Moksha 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.
#
# Moksha is distributed in the hope that it... | apache-2.0 | Python |
544aa6c34851fdad373ad929bb337710e172553d | Move tensorflow version check before the imports. | tensorflow/hub,tensorflow/hub | tensorflow_hub/__init__.py | tensorflow_hub/__init__.py | # Copyright 2018 The TensorFlow Hub Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | # Copyright 2018 The TensorFlow Hub Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | apache-2.0 | Python |
047b2771abbb89f7b0cd838518c6251bafc8dad9 | Update singleton funtionality to be slightly more generic | 3ptscience/properties,aranzgeo/properties | properties/extras/singleton.py | properties/extras/singleton.py | """Singleton behavior for tracking individual objects (enum-like)"""
import six
from ..base import HasProperties, PropertyMetaclass
class SingletonMetaclass(PropertyMetaclass):
"""Metaclass to produce singleton behaviour"""
def __call__(cls, name, **kwargs):
"""Look up an entry by name in the regist... | """Singleton behaviour for tracking individual objects (enum-like)"""
from collections import OrderedDict
from properties.base import PropertyMetaclass
from properties import HasProperties
import six
class SingletonMetaclass(PropertyMetaclass):
"""Metaclass to produce singleton behaviour"""
def __call__(cls... | mit | Python |
df880b478683486982ef3b0a583feb0faa49d3df | Fix test | memsharded/conan,memsharded/conan,conan-io/conan,memsharded/conan,conan-io/conan,memsharded/conan,conan-io/conan | conans/test/unittests/server/revision_list_test.py | conans/test/unittests/server/revision_list_test.py | from math import floor
import time
import unittest
from conans.server.revision_list import RevisionList
from conans.util.dates import from_timestamp_to_iso8601
class RevisionListTest(unittest.TestCase):
def test_remove_latest(self):
rev = RevisionList()
rev.add_revision("rev1")
rev.add_... | import time
import unittest
from conans.server.revision_list import RevisionList
from conans.util.dates import from_timestamp_to_iso8601
class RevisionListTest(unittest.TestCase):
def test_remove_latest(self):
rev = RevisionList()
rev.add_revision("rev1")
rev.add_revision("rev2")
... | mit | Python |
dfca650bd816b1ac7b74bf5cd1d6d34480c9da69 | Fix separator | karel-brinda/prophyle,karel-brinda/prophyle,karel-brinda/prophyle,karel-brinda/prophyle | prophyle/prophyle_test_tree.py | prophyle/prophyle_test_tree.py | #! /usr/bin/env python3
"""Test whether given trees are valid for Prophyle.
Author: Karel Brinda <kbrinda@hsph.harvard.edu>
Licence: MIT
Example:
$ prophyle_test_tree.py ~/prophyle/bacteria.nw ~/prophyle/viruses.nw
"""
import os
import sys
import argparse
from ete3 import Tree
import logging
DEFAULT_FORMAT = ... | #! /usr/bin/env python3
"""Test whether given trees are valid for Prophyle.
Author: Karel Brinda <kbrinda@hsph.harvard.edu>
Licence: MIT
Example:
$ prophyle_test_tree.py ~/prophyle/bacteria.nw ~/prophyle/viruses.nw
"""
import os
import sys
import argparse
from ete3 import Tree
import logging
DEFAULT_FORMAT = ... | mit | Python |
d6a1e13ed6fc1db1d2087ba56fc9130f9ab641f9 | Use utf-8 when encoding our test data paths to bytes | rawdlite/mopidy,jcass77/mopidy,SuperStarPL/mopidy,jcass77/mopidy,bencevans/mopidy,jmarsik/mopidy,vrs01/mopidy,jcass77/mopidy,ali/mopidy,pacificIT/mopidy,tkem/mopidy,jodal/mopidy,diandiankan/mopidy,tkem/mopidy,adamcik/mopidy,vrs01/mopidy,mokieyue/mopidy,adamcik/mopidy,bencevans/mopidy,swak/mopidy,swak/mopidy,ali/mopidy,... | tests/__init__.py | tests/__init__.py | from __future__ import unicode_literals
import os
def path_to_data_dir(name):
if not isinstance(name, bytes):
name = name.encode('utf-8')
path = os.path.dirname(__file__)
path = os.path.join(path, b'data')
path = os.path.abspath(path)
return os.path.join(path, name)
class IsA(object):
... | from __future__ import unicode_literals
import os
import sys
def path_to_data_dir(name):
if not isinstance(name, bytes):
name = name.encode(sys.getfilesystemencoding())
path = os.path.dirname(__file__)
path = os.path.join(path, b'data')
path = os.path.abspath(path)
return os.path.join(pat... | apache-2.0 | Python |
ba8a84b3f7914fbbb4709d5bc9d8319dad7cbc86 | Bump RTMOD version to 1.1 | SKIRT/PTS,SKIRT/PTS,SKIRT/PTS | modeling/welcome.py | modeling/welcome.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | #!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | agpl-3.0 | Python |
b20f6f38fdefcf174bd62e39b84d13fb3ee1cd2b | Update info | sebastinas/debian-devel-changes-bot | DebianDevelChanges/__init__.py | DebianDevelChanges/__init__.py | # -*- coding: utf-8 -*-
#
# Debian Changes Bot
# Copyright (C) 2008 Chris Lamb <chris@chris-lamb.co.uk>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the... | # -*- coding: utf-8 -*-
#
# Debian Changes Bot
# Copyright (C) 2008 Chris Lamb <chris@chris-lamb.co.uk>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the... | agpl-3.0 | Python |
b4645ea417342f9460752b2f0390a88fdb4f1da7 | Include logging of the TAS API for jetstream/api.py | CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend | jetstream/api.py | jetstream/api.py | import requests
from django.conf import settings
import logging
from .exceptions import TASAPIException
logger = logging.getLogger(__name__)
def tacc_api_post(url, post_data):
username = settings.TACC_API_USER
password = settings.TACC_API_PASS
logger.info("REQ: %s" % url)
logger.info("REQ BODY: %s" ... | import requests
from django.conf import settings
import logging
from .exceptions import TASAPIException
logger = logging.getLogger(__name__)
def tacc_api_post(url, post_data):
username = settings.TACC_API_USER
password = settings.TACC_API_PASS
#logger.info(url)
#logger.info(post_data)
resp = req... | apache-2.0 | Python |
9ef34cdb341791a87262c4ec81ce7e3ac64a32df | fix for python3 support | ncollins/say_what,ncollins/nytimeshackday2013 | wordsearch.py | wordsearch.py | #!/usr/bin/env python
# Copyright (c) 2012, BSD-3 clause, Sunlight Labs
from sunlight import capitolwords
from sunlight import congress
phrase = "obamacare"
# Today, we'll be printing out the Twitter IDs of all legislators that use
# this phrase most in the congressional record.
for cw_record in capitolwords.phrases... | #!/usr/bin/env python
# Copyright (c) 2012, BSD-3 clause, Sunlight Labs
from sunlight import capitolwords
from sunlight import congress
phrase = "obamacare"
# Today, we'll be printing out the Twitter IDs of all legislators that use
# this phrase most in the congressional record.
for cw_record in capitolwords.phrases... | mit | Python |
3dcc97d3018e7d59eb4439f3dabac85f769139da | Fix memory example! Just needed to up the momentum. | devdoer/theanets,lmjohns3/theanets,chrinide/theanets | examples/recurrent-memory.py | examples/recurrent-memory.py | #!/usr/bin/env python
import climate
import logging
import matplotlib.pyplot as plt
import numpy as np
import theanets
climate.enable_default_logging()
TIME = 10
BITS = 3
BATCH_SIZE = 32
e = theanets.Experiment(
theanets.recurrent.Regressor,
layers=(1, 10, 1),
recurrent_error_start=TIME - BITS,
batc... | #!/usr/bin/env python
import climate
import logging
import matplotlib.pyplot as plt
import numpy as np
import theanets
climate.enable_default_logging()
TIME = 10
BITS = 3
BATCH_SIZE = 32
e = theanets.Experiment(
theanets.recurrent.Regressor,
layers=(1, 100, 1),
recurrent_error_start=TIME - BITS,
bat... | mit | Python |
6c283b37b985500f03496930de1d595630fe22f2 | fix error where `update_task()` and `delete_task()` operations get task as dict instead of model instance | kokimoribe/todo-api | todo/api.py | todo/api.py | """Operations are defined here"""
from todo.models import Task
from todo.exceptions import NotFoundError
from todo.database import session
from todo.schemas import TaskSchema
def get_tasks():
"""Get all tasks"""
tasks = Task.query.all()
return TaskSchema().dump(tasks, many=True).data
def get_task(task_... | """Operations are defined here"""
from todo.models import Task
from todo.exceptions import NotFoundError
from todo.database import session
from todo.schemas import TaskSchema
def get_tasks():
"""Get all tasks"""
tasks = Task.query.all()
return TaskSchema().dump(tasks, many=True).data
def get_task(task_... | mit | Python |
1ee5aaf72a7a83a45b493f587471bd4edb0bfe5f | remove pygame dep. | mkoval/FieldforceTCM | scripts/event.py | scripts/event.py | #!/usr/bin/env python
# vim: set fileencoding=utf-8 :
from __future__ import print_function
"""
Copyright (c) 2012, Cody Schafer <cpschafer --- gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:... | #!/usr/bin/env python
# vim: set fileencoding=utf-8 :
from __future__ import print_function
"""
Copyright (c) 2012, Cody Schafer <cpschafer --- gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:... | bsd-2-clause | Python |
4c14c6812db2654d86ed0002ed70e922a57de372 | fix assumption about initialization order | marietje/maried,bwesterb/mirte,bwesterb/sarah | lastfm.py | lastfm.py | from core import Module
from urllib2 import URLError
import threading
import scrobbler
import time
class Scrobbler(Module):
def __init__(self, settings, logger):
super(Scrobbler, self).__init__(settings, logger)
self.desk.on_playing_changed.register(self._on_playing_changed)
self.register_on_setting_changed('us... | from core import Module
from urllib2 import URLError
import threading
import scrobbler
import time
class Scrobbler(Module):
def __init__(self, settings, logger):
super(Scrobbler, self).__init__(settings, logger)
self.desk.on_playing_changed.register(self._on_playing_changed)
self.register_on_setting_changed('us... | agpl-3.0 | Python |
fbd99212c7af806137f996ac3c1d6c018f9402a7 | Add Let's Encrypt env var | puffinrocks/puffin,loomchild/puffin,loomchild/puffin,loomchild/puffin,puffinrocks/puffin,loomchild/jenca-puffin,loomchild/puffin,loomchild/puffin,loomchild/jenca-puffin | puffin/core/compose.py | puffin/core/compose.py | from .applications import get_application_domain, get_application_name
from .machine import get_env_vars
from .. import app
from subprocess import Popen, STDOUT, PIPE
from os import environ
from os.path import join
def init():
pass
def compose_start(machine, user, application, **environment):
compose_run(ma... | from .applications import get_application_domain, get_application_name
from .machine import get_env_vars
from .. import app
from subprocess import Popen, STDOUT, PIPE
from os import environ
from os.path import join
def init():
pass
def compose_start(machine, user, application, **environment):
compose_run(ma... | agpl-3.0 | Python |
3952ea7dbcd00f542d1062558ca9253306122638 | call anonumous client method to remove dependency of google application credentials (#9455) | googleapis/python-storage,googleapis/python-storage | tests/perf/benchwrapper.py | tests/perf/benchwrapper.py | import argparse
import sys
import time
import grpc
import os
from concurrent import futures
import storage_pb2_grpc
import storage_pb2
from google.cloud import storage
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
parser = argparse.ArgumentParser()
if os.environ.get("STORAGE_EMULATOR_HOST") is None:
sys.exit(
"This... | import argparse
import sys
import time
import grpc
import os
from concurrent import futures
import storage_pb2_grpc
import storage_pb2
from google.cloud import storage
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
parser = argparse.ArgumentParser()
if os.environ.get("STORAGE_EMULATOR_HOST") is None:
sys.exit(
"This... | apache-2.0 | Python |
7d0bd7ed20f0d2b2c2b0fc76170cbeaa019955b8 | add persistent view in on_ready to avoid loop issues | Rapptz/discord.py,Harmon758/discord.py,Harmon758/discord.py,rapptz/discord.py | examples/views/persistent.py | examples/views/persistent.py | from discord.ext import commands
import discord
# Define a simple View that persists between bot restarts
# In order a view to persist between restarts it needs to meet the following conditions:
# 1) The timeout of the View has to be set to None
# 2) Every item in the View has to have a custom_id set
# It is recommen... | from discord.ext import commands
import discord
class PersistentViewBot(commands.Bot):
def __init__(self):
super().__init__(command_prefix=commands.when_mentioned_or('$'))
async def on_ready(self):
print(f'Logged in as {self.user} (ID: {self.user.id})')
print('------')
# Define a si... | mit | Python |
e5c6108484ebbbce7772eae8bf764a9fcdfc2bfd | Add missing comma | jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot | tot/urls.py | tot/urls.py | """tot URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/dev/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based v... | """tot URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/dev/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based v... | mit | Python |
4e69326faca7d3847ca31ba0c694a27ef51a8e17 | Remove unused imports | yashodhank/frappe,adityahase/frappe,adityahase/frappe,adityahase/frappe,saurabh6790/frappe,mhbu50/frappe,yashodhank/frappe,StrellaGroup/frappe,yashodhank/frappe,saurabh6790/frappe,frappe/frappe,mhbu50/frappe,adityahase/frappe,frappe/frappe,StrellaGroup/frappe,almeidapaulopt/frappe,saurabh6790/frappe,yashodhank/frappe,S... | frappe/tests/test_monitor.py | frappe/tests/test_monitor.py | # -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
import frappe.monitor
from frappe.utils import set_request
from frappe.utils.response import build_response
from frappe.moni... | # -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
import frappe.monitor
from frappe.utils import set_request
from frappe.utils.response import build_response
from frappe.moni... | mit | Python |
7db07d054a18c5ed200d9bcac88101d9ae721ef5 | add force option to research command | Clinical-Genomics/scout,Clinical-Genomics/scout,Clinical-Genomics/scout | scout/commands/load_research.py | scout/commands/load_research.py | import logging
import click
from scout.load.variant import load_variants
log = logging.getLogger(__name__)
@click.command(short_help='Upload research variants')
@click.option('-c', '--case-id', help='family or case id')
@click.option('-i', '--institute', help='institute id of related cases')
@click.option('-f', '-... | import logging
import click
from scout.load.variant import load_variants
log = logging.getLogger(__name__)
@click.command(short_help='Upload research variants')
@click.option('-c', '--case-id', help='family or case id')
@click.option('-i', '--institute', help='institute id of related cases')
@click.pass_context
de... | bsd-3-clause | Python |
02e7541dab7bb541be288d8a77c737c78bcb602d | Remove unused import in staff tests. | nVentiveUX/mystartupmanager,nVentiveUX/mystartupmanager | mystartupmanager/staff/tests.py | mystartupmanager/staff/tests.py | # Copyright (c) 2016 nVentiveUX
#
# 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, modify, merge, publish,
# distri... | # Copyright (c) 2016 nVentiveUX
#
# 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, modify, merge, publish,
# distri... | mit | Python |
4d1fc17a9b40b634c776360c39c33f37b5895aa9 | Add engine animation | shivnshu/AMR-System,shivnshu/AMR-System,shivnshu/AMR-System,shivnshu/AMR-System | temp.py | temp.py | #!/usr/bin/env python
from __future__ import print_function
from OCC.STEPControl import STEPControl_Reader
from OCC.IFSelect import IFSelect_RetDone, IFSelect_ItemsByEntity
from OCC.Display.SimpleGui import init_display
from OCC.gp import gp_Ax1, gp_Pnt, gp_Dir, gp_Trsf
from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox... | #!/usr/bin/env python
from OCC.STEPControl import STEPControl_Reader
from OCC.IFSelect import IFSelect_RetDone, IFSelect_ItemsByEntity
from OCC.Display.SimpleGui import init_display
step_reader = STEPControl_Reader()
status = step_reader.ReadFile('./models/ice/Assembly1.stp')
if status == IFSelect_RetDone: # chec... | mit | Python |
52b5a61eaae06024073b2721a78574a48faf0430 | Fix order of Box parameters. | hodgestar/laghuis,hodgestar/laghuis | laghuis/lagjack.py | laghuis/lagjack.py | """ Main Laghuis script.
"""
from gi.repository import GObject, Gst as gst, GLib as glib
from .box import Box
from .twiddle import PrintTwiddler
class LagJack(object):
def __init__(self):
GObject.threads_init()
gst.init(None)
def _on_bus_message(self, bus, msg):
mtype = msg.type
... | """ Main Laghuis script.
"""
from gi.repository import GObject, Gst as gst, GLib as glib
from .box import Box
from .twiddle import PrintTwiddler
class LagJack(object):
def __init__(self):
GObject.threads_init()
gst.init(None)
def _on_bus_message(self, bus, msg):
mtype = msg.type
... | mit | Python |
005feb1c49f99205fcf829c90d01017aa9f453f3 | Fix expected_version in test_distribution | scikit-build/ninja-python-distributions | tests/test_distribution.py | tests/test_distribution.py |
import os
import pytest
from path import Path, matchers
DIST_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '../dist'))
def _check_ninja_install(virtualenv):
expected_version = "1.9.0.git.kitware.dyndep-1.jobserver-1"
for executable_name in ["ninja"]:
output = virtualenv.run(
... |
import os
import pytest
from path import Path, matchers
DIST_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '../dist'))
def _check_ninja_install(virtualenv):
expected_version = "1.9.0.g5b44b.kitware.dyndep-1.jobserver-1"
for executable_name in ["ninja"]:
output = virtualenv.run(
... | apache-2.0 | Python |
9d853ce842a1b15ec9b49811ad73e9b4c1860c26 | Fix test for py3 | eBay/wextracto,eBay/wextracto,gilessbrown/wextracto,gilessbrown/wextracto | tests/test_http_decoder.py | tests/test_http_decoder.py | import os
import zlib
from gzip import GzipFile
import pytest
from six import BytesIO
from wex.http_decoder import GzipDecoder, DeflateDecoder
def decode(uncompressed, compress, decoder_class):
compressed = compress(uncompressed)
decoder = decoder_class(compressed)
# mimic the small/large read of wex.re... | import os
import zlib
from gzip import GzipFile
import pytest
from six import BytesIO
from wex.http_decoder import GzipDecoder, DeflateDecoder
def decode(uncompressed, compress, decoder_class):
compressed = compress(uncompressed)
decoder = decoder_class(compressed)
# mimic the small/large read of wex.re... | bsd-3-clause | Python |
0bcf53ce13e7ad26a3a7a9279448774486bc4d9c | add tests for static resource requests | gratipay/aspen.py,gratipay/aspen.py | tests/test_website_flow.py | tests/test_website_flow.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from pando.http.request import Request
from pando.http.response import Response
def test_website_can_respond(harness):
harness.fs.www.mk(('index.html.spt', '[---]\... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from pando.http.request import Request
from pando.http.response import Response
def test_website_can_respond(harness):
harness.fs.www.mk(('index.html.spt', '[---]\... | mit | Python |
5cc89e47bb88f312fb70a2bd4e3246182bc9defe | Fix argv mistake | ajvpot/CTFd,CTFd/CTFd,ajvpot/CTFd,CTFd/CTFd,CTFd/CTFd,isislab/CTFd,LosFuzzys/CTFd,ajvpot/CTFd,isislab/CTFd,isislab/CTFd,LosFuzzys/CTFd,LosFuzzys/CTFd,CTFd/CTFd,isislab/CTFd,LosFuzzys/CTFd,ajvpot/CTFd | import.py | import.py | """
python import.py export.zip challenges,teams,both,metadata
"""
from CTFd import create_app
from CTFd.utils import import_ctf
import sys
app = create_app()
with app.app_context():
if len(sys.argv) == 3:
segments = sys.argv[2].split(',')
else:
segments = None
import_ctf(sys.argv[1], seg... | """
python import.py export.zip challenges,teams,both,metadata
"""
from CTFd import create_app
from CTFd.utils import import_ctf
import sys
app = create_app()
with app.app_context():
if len(sys.argv) == 2:
segments = sys.argv[2].split(',')
else:
segments = None
import_ctf(sys.argv[1], seg... | apache-2.0 | Python |
add6195082ac48d5d4d71b45a923f5a715e295d1 | Add keycode logging | haikuginger/riker | riker/worker/utils.py | riker/worker/utils.py | from logging import getLogger
import tempfile
from threading import Thread
import lirc
from django.conf import settings
from systemstate.models import RemoteButton
from systemstate.utils import push_button
LOGGER = getLogger(__name__)
LIRCRC_TEMPLATE = '''
begin
prog = {lirc_name}
button = {key_... | import tempfile
from threading import Thread
import lirc
from django.conf import settings
from systemstate.models import RemoteButton
from systemstate.utils import push_button
LIRCRC_TEMPLATE = '''
begin
prog = {lirc_name}
button = {key_name}
config = {key_name}
end
'''
class LircListen... | mit | Python |
21f38708260a5ae1eb316c108fb35b896a5b4909 | fix mongodb | shmiko/big-fat-python-tests,shmiko/big-fat-python-tests | mongodb_query.py | mongodb_query.py | db.schedule.find("bookings" : {"$elemMatch" : { "date" : new ISODate("2016-08-09T10:00:00.000Z")}})
>> { "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
"date": ISODate("2016-08-09T10:00:00.000Z")
}
]
}
db.schedule.insert(
{ "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
... | db.schedule.find("bookings" : {"$elemMatch" : { "date" : new ISODate("2016-08-09T10:00:00.000Z")}})
>> { "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
"date": ISODate("2016-08-09T10:00:00.000Z")
}
]
}
db.schedule.insert(
{ "bookings" : [
{
"event" : "MongoDB On Site Interveiw",
... | apache-2.0 | Python |
c753b3824cd55b914a009569fd142fc5b2f3dc40 | Add copyright to the file (#333) | uber/vertica-python | vertica_python/tests/common/conftest.py | vertica_python/tests/common/conftest.py | # Copyright (c) 2019 Micro Focus or one of its affiliates.
#
# 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 ... | def pytest_configure(config):
config.addinivalue_line(
"markers", "integration_tests: mark test to be an integration test"
)
config.addinivalue_line(
"markers", "unit_tests: mark test to be an unit test"
)
| apache-2.0 | Python |
34a0ba5979333c63d06e780ea2c58aeece477fef | Add parsing line | torufurukawa/triparse,torufurukawa/triparse,torufurukawa/triparse | triparse.py | triparse.py | """Parse PDF that contains triathlon race result"""
import sys
import re
import codecs
def main():
# TODO: use argparse
fin = open(sys.argv[1], encoding='utf8')
for line in fin:
# TODO:DOING parse
pattern = r'\d+ (\d+).*?\d:\d{2}:\d{2} (\d:\d{2}:\d{2}) \d+ (\d:\d{2}:\d{2}) \d+ \d:\d{2}:\... | """Parse PDF that contains triathlon race result"""
import sys
import codecs
def main():
# TODO: use argparse
fin = open(sys.argv[1], encoding='utf8')
for line in fin:
print(line.strip())
# TODO: parse
# TODO: print
pass
# TODO: analyze and visualize
if __name__ == '__main__':
... | mit | Python |
3bf9c3e61f5a1bda53aae91fac18e12993bb4adb | update example to fix threshold() call | elvandy/nltools,ljchang/nltools,ljchang/neurolearn | examples/01_DataOperations/plot_mask.py | examples/01_DataOperations/plot_mask.py | """
Masking Example
===============
This tutorial illustrates methods to help with masking data.
"""
#########################################################################
# Load Data
# ---------
#
# First, let's load the pain data for this example.
from nltools.datasets import fetch_pain
data = fetch_pain()
... | """
Masking Example
===============
This tutorial illustrates methods to help with masking data.
"""
#########################################################################
# Load Data
# ---------
#
# First, let's load the pain data for this example.
from nltools.datasets import fetch_pain
data = fetch_pain()
... | mit | Python |
d3fcc353ce9bb8efdfa231e17cf979f4689a7124 | Make PyLint tool find executable on that platform too. | kayhayen/Nuitka,kayhayen/Nuitka,kayhayen/Nuitka,kayhayen/Nuitka | nuitka/tools/pylint/__main__.py | nuitka/tools/pylint/__main__.py | #!/usr/bin/env python
# Copyright 2017, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fi... | #!/usr/bin/env python
# Copyright 2017, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fi... | apache-2.0 | Python |
c343ddcf5fe1e4bdab17e50c450e83f5b79490ca | fix geocoder | qtux/instmatcher | instmatcher/geo.py | instmatcher/geo.py | # Copyright 2016 Matthias Gazzari
#
# 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 writ... | # Copyright 2016 Matthias Gazzari
#
# 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 writ... | apache-2.0 | Python |
abfc91a687b33dda2659025af254bc9f50c077b5 | Mark index migration as non atomic | dissemin/dissemin,wetneb/dissemin,wetneb/dissemin,dissemin/dissemin,dissemin/dissemin,dissemin/dissemin,wetneb/dissemin,dissemin/dissemin,wetneb/dissemin | publishers/migrations/0008_fix_name_indices.py | publishers/migrations/0008_fix_name_indices.py | # Generated by Django 2.1.7 on 2019-05-12 16:08
from django.db import migrations, models
class Migration(migrations.Migration):
atomic = False
dependencies = [
('publishers', '0007_publisher_romeo_parent_id'),
]
operations = [
migrations.AlterField(
model_name='journal',... | # Generated by Django 2.1.7 on 2019-05-12 16:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('publishers', '0007_publisher_romeo_parent_id'),
]
operations = [
migrations.AlterField(
model_name='journal',
name='... | agpl-3.0 | Python |
2a141d34a14545175eee94e34d826e899f545a0c | Resolve upcoming Python deprecation | kennethreitz/legit,kennethreitz/legit | legit/bootstrap.py | legit/bootstrap.py | # -*- coding: utf-8 -*-
"""
legit.bootstrap
~~~~~~~~~~~~~~~
This module boostraps the Legit runtime.
"""
import clint.textui.colored
from clint import resources
from six.moves import configparser
from .settings import settings
resources.init('kennethreitz', 'legit')
try:
config_file = resources.user.open('co... | # -*- coding: utf-8 -*-
"""
legit.bootstrap
~~~~~~~~~~~~~~~
This module boostraps the Legit runtime.
"""
import clint.textui.colored
from clint import resources
from six.moves import configparser
from .settings import settings
resources.init('kennethreitz', 'legit')
try:
config_file = resources.user.open('co... | bsd-3-clause | Python |
a710744383ca3f290e6499a624fa670428dd99bc | Remove redundant linking flag | markfejes/node-argon2,ranisalt/node-argon2,ranisalt/node-argon2,ranisalt/node-argon2,markfejes/node-argon2,markfejes/node-argon2 | binding.gyp | binding.gyp | {
"target_defaults": {
"target_conditions": [
["OS != 'win'", {
"cflags": ["-fvisibility=hidden"]
}],
["OS == 'mac'", {
"xcode_settings": {
"MACOSX_DEPLOYMENT_TARGET": "10.9",
}
}]
]
},
"targets": [
{
"target_name": "libargon2",
"so... | {
"target_defaults": {
"target_conditions": [
["OS != 'win'", {
"cflags": ["-fvisibility=hidden"]
}],
["OS == 'mac'", {
"xcode_settings": {
"MACOSX_DEPLOYMENT_TARGET": "10.9",
}
}]
]
},
"targets": [
{
"target_name": "libargon2",
"so... | mit | Python |
4f2c951a6e586e99413fe73bbe1df5eb0974c21f | improve speed test | SixTrack/SixTrackLib,dpellegr/sixtracklib,SixTrack/SixTrackLib,dpellegr/sixtracklib,SixTrack/SixTrackLib,SixTrack/SixTrackLib,dpellegr/sixtracklib | examples/lhc_sixtrack/speed_longtest.py | examples/lhc_sixtrack/speed_longtest.py | #!/usr/bin/env python
import numpy as np
import sixtracktools
import sixtracklib
six =sixtracktools.SixTrackInput('.')
line,rest,iconv=six.expand_struct()
names,types,args=zip(*line)
idx=dict( (nn,ii) for ii,nn in enumerate(six.struct) if not 'BLOC' in nn)
names2=np.array(names)[iconv]
sixtrackbeam=sixtracktools.S... | #!/usr/bin/env python
import numpy as np
import sixtracktools
import sixtracklib
six =sixtracktools.SixTrackInput('.')
line,rest,iconv=six.expand_struct()
names,types,args=zip(*line)
idx=dict( (nn,ii) for ii,nn in enumerate(six.struct) if not 'BLOC' in nn)
names2=np.array(names)[iconv]
sixtrackbeam=sixtracktools.S... | lgpl-2.1 | Python |
8dc551cf20d0205524cecf8a72cece34751f4b14 | Add hook to init | Motoko11/MotoBot | motobot/__init__.py | motobot/__init__.py | from .irc_level import IRCLevel
from .irc_message import IRCMessage
from .irc_bot import IRCBot, hook, command, match, sink, action
| from .irc_level import IRCLevel
from .irc_message import IRCMessage
from .irc_bot import IRCBot, command, match, sink, action
| mit | Python |
5ea86c6582453491d009567844160c8718b4d88e | add p.is_alive check to loop in test_run_example | OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic,OpenSourcePolicyCenter/dynamic | ogusa/tests/test_run_example.py | ogusa/tests/test_run_example.py | '''
This test tests whether starting a `run_ogusa_example.py` run of the model does
not break down (is still running) after 5 minutes or 300 seconds.
'''
import multiprocessing
import time
import os, sys
import importlib.util
from pathlib import Path
def call_run_ogusa_example():
cur_path = os.path.split(os.path... | '''
This test tests whether starting a `run_ogusa_example.py` run of the model does
not break down (is still running) after 5 minutes or 300 seconds.
'''
import multiprocessing
import time
import os, sys
import importlib.util
from pathlib import Path
def call_run_ogusa_example():
cur_path = os.path.split(os.path... | mit | Python |
a93e2b8f658f40abbd62bc0d1c4b90b2a888f099 | print info function | cychiang/ToolMan | Features/hog_feature.py | Features/hog_feature.py | # -*- coding: utf-8 -*-
import numpy as np
import itertools as it
from glob import glob
import cv2, sys
help_message = '''
USAGE: hog_feature.py <image_names> ...
This function is generate hog feature into file.
'''
def print_bins_info(bins):
print 'cols: %d' %(len(bins))
print 'rows: %d' %(len(bins[0]))
... | # -*- coding: utf-8 -*-
import numpy as np
import itertools as it
from glob import glob
import cv2, sys
help_message = '''
USAGE: hog_feature.py <image_names> ...
This function is generate hog feature into file.
'''
def print_size_info(items):
print 'cols: %d' %(len(items))
print 'rows: %d' %(len(items[0]))
... | apache-2.0 | Python |
215255b7d630fa365ae1bd5b298c7273d0f6f975 | Add a project dict in the settings | pcadottemichaud/xm,pc-m/xm,pcadottemichaud/xm,pc-m/xm | xm/settings.py | xm/settings.py | projects = {}
| projects = {
'cti': {'path': '',},
}
| bsd-2-clause | Python |
1c8e4918e47c72769349491732fe7eacc2283914 | Make compatible with plotly | HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core | core/timeline.py | core/timeline.py | from collections import Counter
#import plotly.graph_objs as go
def create_timeline( data ):
if len(data) == 0:
print "Dataset empty."
return [go.Scatter( x = [] , y = [] )]
timeline_data = Counter( sorted( map( lambda d: d['date'], data ) ) )
return timeline_data
#return [go.Scatte... | from collections import Counter
import matplotlib.pyplot as plt
def create_timeline( data ):
if len(data) == 0:
print "Dataset empty."
return
date_series = Counter( sorted( map( lambda d: d['date'], data ) ) )
plt.plot_date( x = date_series.keys(), y = date_series.values(), fmt = "r-" )
... | mit | Python |
03c9786834e976d599b29a50b03ad839ef7d16d1 | Clean up githubs revisions model | rafaeldelucena/waterbutler,hmoco/waterbutler,Johnetordoff/waterbutler,rdhyee/waterbutler,Ghalko/waterbutler,chrisseto/waterbutler,icereval/waterbutler,RCOSDP/waterbutler,felliott/waterbutler,TomBaxter/waterbutler,kwierman/waterbutler,cosenal/waterbutler,CenterForOpenScience/waterbutler | waterbutler/providers/github/metadata.py | waterbutler/providers/github/metadata.py | import os
from waterbutler.core import metadata
class BaseGitHubMetadata(metadata.BaseMetadata):
def __init__(self, raw, folder=None, **kwargs):
super().__init__(raw)
self.folder = folder
self.extras = kwargs
@property
def provider(self):
return 'github'
@property
... | import os
from waterbutler.core import metadata
class BaseGitHubMetadata(metadata.BaseMetadata):
def __init__(self, raw, folder=None, **kwargs):
super().__init__(raw)
self.folder = folder
self.extras = kwargs
@property
def provider(self):
return 'github'
@property
... | apache-2.0 | Python |
a9b25aa2a2a4a8eb0d6203c7249e44f7e679c124 | add cust to plan | HandyCodeJob/upcraft-flask-url,HandyCodeJob/upcraft-flask-url | url_test.py | url_test.py | from flask import Flask, redirect, request, render_template
import requests
import stripe
import os
stripe.api_key = "sk_test_hzmKNeyNVEbyi1BWiTRwRHMe"
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def hello():
if request.method == 'GET':
return render_template("test.html")
elif requ... | from flask import Flask, redirect, request, render_template
import requests
import stripe
import os
stripe.api_key = "sk_test_hzmKNeyNVEbyi1BWiTRwRHMe"
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def hello():
if request.method == 'GET':
return render_template("test.html")
elif requ... | mit | Python |
d68d4b3dd66acdee0fe4af4dadcb74a962e6e696 | use category factory for category creation test | byteweaver/django-forums,ckcnik/django-forums,ckcnik/django-forums,byteweaver/django-forums | forums/tests/models_tests.py | forums/tests/models_tests.py | from django.test import TestCase
from forums.models import Category
from forums.tests.factories import CategoryFactory
class CategoryModelTest(TestCase):
def test_category_creation(self):
category = CategoryFactory.create()
self.assertEquals(category.name, 'Category')
| from django.test import TestCase
from forums.models import Category
class CategoryModelTest(TestCase):
def test_category_creation(self):
category = Category.objects.create(**{
'name': 'Category',
})
self.assertEquals(category.name, 'Category')
| bsd-3-clause | Python |
2e667b4117cfaecba7fc1094f64199801c4fa2b3 | bump again | wdecoster/NanoPlot,wdecoster/NanoPlot | nanoplot/version.py | nanoplot/version.py | __version__ = "0.17.3"
| __version__ = "0.17.2"
| mit | Python |
577bc8c1d8f78ee9ebd1027f1588a050787bdac7 | Update utils.py | OnroerendErfgoed/crabpy_pyramid | crabpy_pyramid/utils.py | crabpy_pyramid/utils.py | # -*- coding: utf-8 -*-
'''
Utility functions to help with range handling.
.. versionadded:: 0.1.0
'''
import re
MAX_NUMBER_ITEMS = 5000
def parse_range_header(range):
'''
Parse a range header as used by the dojo Json Rest store.
:param str range: The content of the range header to be parsed.
... | # -*- coding: utf-8 -*-
'''
Utility functions to help with range handling.
.. versionadded:: 0.1.0
'''
import re
MAX_NUMBER_ITEMS = 5000
def parse_range_header(range):
'''
Parse a range header as used by the dojo Json Rest store.
:param str range: The content of the range header to be parsed.
... | mit | Python |
f12e35ee7e68a8eefb78bb2fbabe1fcc90b1f586 | Add basic multilinear interpolator with decay | econ-ark/HARK,econ-ark/HARK | HARK/econforgeinterp.py | HARK/econforgeinterp.py | from .core import MetricObject
from interpolation.splines import eval_linear, UCGrid
from interpolation.splines import extrap_options as xto
import numpy as np
class LinearFast(MetricObject):
distance_criteria = ["f_val", "grid_list"]
def __init__(self, f_val, grids, extrap_options=None):
self.f_va... | from .core import MetricObject
from interpolation.splines import eval_linear, UCGrid
import numpy as np
class LinearFast(MetricObject):
distance_criteria = ["f_val", "grid_list"]
def __init__(self, f_val, grids, extrap_options=None):
self.f_val = f_val
self.grid_list = grids
self.Gri... | apache-2.0 | Python |
95c7037a4a1e9c3921c3b4584046824ed469ae7f | Add test for osfclient's session object | betatim/osf-cli,betatim/osf-cli | osfclient/tests/test_session.py | osfclient/tests/test_session.py | from unittest.mock import patch
from unittest.mock import MagicMock
import pytest
from osfclient.models import OSFSession
from osfclient.exceptions import UnauthorizedException
def test_basic_auth():
session = OSFSession()
session.basic_auth('joe@example.com', 'secret_password')
assert session.auth == (... | from osfclient.models import OSFSession
def test_basic_auth():
session = OSFSession()
session.basic_auth('joe@example.com', 'secret_password')
assert session.auth == ('joe@example.com', 'secret_password')
assert 'Authorization' not in session.headers
def test_basic_build_url():
session = OSFSess... | bsd-3-clause | Python |
a10ae4bd88363414e2cdffe5a92781dd4bf8b7f1 | return genres as list | Impactstory/total-impact-webapp,Impactstory/total-impact-webapp,total-impact/total-impact-webapp,total-impact/total-impact-webapp,total-impact/total-impact-webapp,total-impact/total-impact-webapp,Impactstory/total-impact-webapp,Impactstory/total-impact-webapp | totalimpactwebapp/genre.py | totalimpactwebapp/genre.py | import logging
from totalimpactwebapp.cards_factory import make_genre_cards
from totalimpactwebapp.util import cached_property
from totalimpactwebapp.util import dict_from_dir
logger = logging.getLogger("tiwebapp.genre")
def make_genres_dict(profile_id, products):
genres = {}
for product in products:
... | import logging
from totalimpactwebapp.cards_factory import make_genre_cards
from totalimpactwebapp.util import cached_property
from totalimpactwebapp.util import dict_from_dir
logger = logging.getLogger("tiwebapp.genre")
def make_genres_dict(profile_id, products):
genres = {}
for product in products:
... | mit | Python |
8febff1065c67db1599f6b9bccd27f843981dd95 | Add an initial rating to new links in the rss seeder. | tsybulevskij/drum,j00bar/drum,j00bar/drum,yodermk/drum,skybluejamie/wikipeace,yodermk/drum,renyi/drum,sing1ee/drum,yodermk/drum,renyi/drum,tsybulevskij/drum,stephenmcd/drum,sing1ee/drum,j00bar/drum,stephenmcd/drum,abendig/drum,tsybulevskij/drum,renyi/drum,skybluejamie/wikipeace,abendig/drum,sing1ee/drum,abendig/drum | main/management/commands/poll_rss.py | main/management/commands/poll_rss.py |
from datetime import datetime
from time import mktime
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from django.utils.timezone import get_default_timezone, make_aware
from feedparser import parse
from mezzanine.generic.models import Rating
from ...models import Link... |
from datetime import datetime
from time import mktime
from django.core.management.base import BaseCommand
from django.utils.timezone import get_default_timezone, make_aware
from feedparser import parse
from ...models import Link
class Command(BaseCommand):
def handle(self, *urls, **options):
for url i... | bsd-2-clause | Python |
9499721aa6a3ae6c01b94594f6a9e595560c2c7e | Fix opencage reverse issue where it was using self.lcoation instead of just location | DenisCarriere/geocoder | geocoder/opencage_reverse.py | geocoder/opencage_reverse.py | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
import logging
from geocoder.opencage import OpenCageResult, OpenCageQuery
from geocoder.location import Location
class OpenCageReverseResult(OpenCageResult):
@property
def ok(self):
return bool(self.address)
class OpenCageR... | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
import logging
from geocoder.opencage import OpenCageResult, OpenCageQuery
from geocoder.location import Location
class OpenCageReverseResult(OpenCageResult):
@property
def ok(self):
return bool(self.address)
class OpenCageR... | mit | Python |
c1fb4c16ef8f23ed540560e31f4e2288f46bbd07 | Add tests for lexer | lnsp/tea,lnsp/tea | runtime/test_lexer.py | runtime/test_lexer.py | """Test the runtime.lexer module."""
import unittest
from runtime.lexer import TokenTuple, NUMBER, OPERATOR, WHITESPACE, IDENTIFIER, STRING, run
class TestLexer(unittest.TestCase):
"""Test the lexer."""
def test_simple(self):
"""A small collection of simple test cases."""
test_cases = [
... | """Test the runtime.lexer module."""
import unittest
from runtime.lexer import TokenTuple, NUMBER, OPERATOR, WHITESPACE, IDENTIFIER, STRING, run
class TestLexer(unittest.TestCase):
"""Test the lexer."""
def test_simple(self):
"""A small collection of simple test cases."""
test_cases = [
... | mit | Python |
3162f96b708a6a216901ff609b007844a6f7562e | update views | citationfinder/scholarly_citation_finder | scholarly_citation_finder/api/crawler/views.py | scholarly_citation_finder/api/crawler/views.py | from django.http import HttpResponse, JsonResponse
from requests.exceptions import ConnectionError
from scholarly_citation_finder.api.crawler.search.HtmlParser import HtmlParser
from scholarly_citation_finder.api.crawler.search.Duckduckgo import Duckduckgo,\
DuckduckgoResponseException
from scholarly_citation_find... | from django.http import HttpResponse
from requests.exceptions import ConnectionError
from scholarly_citation_finder.api.crawler.search.HtmlParser import HtmlParser
from scholarly_citation_finder.api.crawler.search.Duckduckgo import Duckduckgo,\
DuckduckgoResponseException
from scholarly_citation_finder.api.crawler... | mit | Python |
8d691c56c7fb0953e28308557c6f217bd619566c | add string representation | coink/cryptex | cryptex/trade.py | cryptex/trade.py | class Trade(object):
BUY = 0
SELL = 1
def __init__(self, trade_id, trade_type, base_currency, counter_currency,
time, order_id, amount, price, fee=None):
self.trade_id = trade_id
self.trade_type = trade_type
self.base_currency = base_currency
self.counter_currency = c... | class Trade(object):
BUY = 0
SELL = 1
def __init__(self, trade_id, trade_type, base_currency, counter_currency,
time, order_id, amount, price, fee=None):
self.trade_id = trade_id
self.trade_type = trade_type
self.base_currency = base_currency
self.counter_currency = c... | mit | Python |
5e05eaf2d72de70b685ed0cdaa98210b6a2de273 | add 'bitorder' attribute support | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | cupy/_binary/packing.py | cupy/_binary/packing.py | import cupy
from cupy import _core
_packbits_kernel = _core.ElementwiseKernel(
'raw T myarray, raw int32 myarray_size', 'uint8 packed',
'''for (int j = 0; j < 8; ++j) {
int k = i * 8 + j;
int bit = k < myarray_size && myarray[k] != 0;
packed |= bit << (7 - j);
}''',
'cupy_packb... | import cupy
from cupy import _core
_packbits_kernel = _core.ElementwiseKernel(
'raw T myarray, raw int32 myarray_size', 'uint8 packed',
'''for (int j = 0; j < 8; ++j) {
int k = i * 8 + j;
int bit = k < myarray_size && myarray[k] != 0;
packed |= bit << (7 - j);
}''',
'cupy_packb... | mit | Python |
f1cc79cc45b27cecb8d2ceddd6cd26b968610385 | make available at top level | adrn/gala,adrn/gala,adrn/gary,adrn/gary,adrn/gary,adrn/gala | gala/coordinates/__init__.py | gala/coordinates/__init__.py | from .sgr import *
from .orphan import *
from .gd1 import *
from .oph import *
from .pal5 import *
from .jhelum import *
from .velocity_frame_transforms import *
from .poincarepolar import *
from .quaternion import *
from .magellanic_stream import *
from .reflex import *
from .greatcircle import *
from .pm_cov_transfor... | from .sgr import *
from .orphan import *
from .gd1 import *
from .oph import *
from .pal5 import *
from .jhelum import *
from .velocity_frame_transforms import *
from .poincarepolar import *
from .quaternion import *
from .magellanic_stream import *
from .reflex import *
from .greatcircle import *
from .pm_cov_transfor... | mit | Python |
511890a872b5277286ba991019057c5b1c7d8f44 | Fix for cached file | googleinterns/inventory-visualizer,googleinterns/inventory-visualizer,googleinterns/inventory-visualizer,googleinterns/inventory-visualizer,googleinterns/inventory-visualizer | backend/data_reader.py | backend/data_reader.py | import csv
from google.protobuf.timestamp_pb2 import Timestamp
from datetime import datetime
from grpc.messages import data_pb2
saved_data = {}
def add_data(segment, date, inventory):
timestamp = Timestamp()
timestamp.FromDatetime(datetime.strptime(date, '%Y-%m-%d'))
segment.dates.append(timestamp)
s... | import csv
from google.protobuf.timestamp_pb2 import Timestamp
from datetime import datetime
from grpc.messages import data_pb2
saved_data = {}
def add_data(segment, date, inventory):
timestamp = Timestamp()
timestamp.FromDatetime(datetime.strptime(date, '%Y-%m-%d'))
segment.dates.append(timestamp)
s... | apache-2.0 | Python |
cad8b9989d008a016633914ec35562f0ca04114a | Fix string format and property name | flumotion-mirror/flumotion-fragmented-streaming,flumotion-mirror/flumotion-fragmented-streaming | flumotion/component/muxers/fmp4/fmp4.py | flumotion/component/muxers/fmp4/fmp4.py | # -*- Mode: Python; test-case-name: flumotion.muxers.mpegts.mpegts -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2009,2010 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# flumotion-fragmented-streaming - Flumotion Advanced fragmented streaming
# Licensees having purc... | # -*- Mode: Python; test-case-name: flumotion.muxers.mpegts.mpegts -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2009,2010 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# flumotion-fragmented-streaming - Flumotion Advanced fragmented streaming
# Licensees having purc... | lgpl-2.1 | Python |
cb5ad3e05af1f87575dbe71c78409f19fc05d554 | Update version to 1.0b3 | jasonmccampbell/numpy-refactor-sprint,efiring/numpy-work,efiring/numpy-work,teoliphant/numpy-refactor,illume/numpy3k,Ademan/NumPy-GSoC,Ademan/NumPy-GSoC,teoliphant/numpy-refactor,jasonmccampbell/numpy-refactor-sprint,chadnetzer/numpy-gaurdro,illume/numpy3k,Ademan/NumPy-GSoC,Ademan/NumPy-GSoC,jasonmccampbell/numpy-refac... | numpy/version.py | numpy/version.py | version='1.0b3'
release=False
if not release:
import os
svn_version_file = os.path.join(os.path.dirname(__file__),
'core','__svn_version__.py')
if os.path.isfile(svn_version_file):
import imp
svn = imp.load_module('numpy.core.__svn_version__',
... | version='1.0b2'
release=False
if not release:
import os
svn_version_file = os.path.join(os.path.dirname(__file__),
'core','__svn_version__.py')
if os.path.isfile(svn_version_file):
import imp
svn = imp.load_module('numpy.core.__svn_version__',
... | bsd-3-clause | Python |
557b79cdb260cf4060944ae1dfdeed6fd40ca600 | fix scaledimage test | cr33dog/pyxfce,cr33dog/pyxfce,cr33dog/pyxfce | gui/tests/testscaledimage.py | gui/tests/testscaledimage.py | #!/usr/bin/env python
# doesnt work correctly
import pygtk
pygtk.require("2.0")
import gtk
import xfce4
iv = gtk.Invisible()
pb = iv.render_icon(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_DIALOG)
widget = xfce4.gui.ScaledImage()
widget.set_from_pixbuf(pb)
widget.show()
w = gtk.Window()
w.connect("destroy", lambda x: gtk.m... | #!/usr/bin/env python
import pygtk
pygtk.require("2.0")
import gtk
import xfce4
iv = gtk.Invisible()
pb = iv.render_icon(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_DIALOG)
widget = xfce4.gui.ScaledImage()
widget.set_from_pixbuf(pb)
widget.show()
w = gtk.Window()
w.connect("destroy", lambda x: gtk.main_quit())
w.set_bord... | bsd-3-clause | Python |
a3d404a7f7352fd85a821b445ebeb8d7ca9b21c9 | Change GroupSerializer to display attributes as strings | ProjetSigma/backend,ProjetSigma/backend | sigma_core/serializers/group.py | sigma_core/serializers/group.py | from rest_framework import serializers
from sigma_core.models.group import Group
class GroupSerializer(serializers.ModelSerializer):
class Meta:
model = Group
visibility = serializers.SerializerMethodField()
membership_policy = serializers.SerializerMethodField()
validation_policy = seri... | from rest_framework import serializers
from sigma_core.models.group import Group
class GroupSerializer(serializers.ModelSerializer):
class Meta:
model = Group
| agpl-3.0 | Python |
26228220266799eaec723a9b16fded9314e73c61 | Build waste, _Help and _Scrap too. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Mac/OSX/setup.jaguar.py | Mac/OSX/setup.jaguar.py | from distutils.core import Extension, setup
from distutils import sysconfig
import os
SRCDIR="../.."
def find_file(filename, std_dirs, paths):
"""Searches for the directory where a given file is located,
and returns a possibly-empty list of additional directories, or None
if the file couldn't be found at ... | from distutils.core import Extension, setup
setup(name="MacPython for Jaguar extensions", version="2.2",
ext_modules=[
Extension("OverrideFrom23._Res",
["../Modules/res/_Resmodule.c"],
include_dirs=["../Include"],
extra_link_args=['-framework', 'Carbon']),
]) | mit | Python |
414ebe237d70025af35caf18e55555a8c999160a | fix license info in setup.py | oaubert/python-vlc,oaubert/python-vlc | generator/templates/setup.py | generator/templates/setup.py | from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup
setup(name='python-vlc',
version = '{bindings_version}',
author='Olivier Aubert',
author_email='contact@olivieraubert.net',
maintainer='Olivier Aubert',
maintainer_email='contact@olivieraubert.net',... | from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup
setup(name='python-vlc',
version = '{bindings_version}',
author='Olivier Aubert',
author_email='contact@olivieraubert.net',
maintainer='Olivier Aubert',
maintainer_email='contact@olivieraubert.net',... | lgpl-2.1 | Python |
0be0ad27c19211712e933c7673e8581868e4e95c | make OrganizationUtil available from genestack_client | genestack/python-client | genestack_client/__init__.py | genestack_client/__init__.py | # -*- coding: utf-8 -*-
import sys
if not ((2, 7, 5) <= sys.version_info < (3, 0)):
sys.stderr.write(
'Python version "%s" is not supported. Required version 2.7.5+, Python 3 is not supported\n' % sys.version
)
exit(1)
from version import __version__
from genestack_exceptions import (GenestackAu... | # -*- coding: utf-8 -*-
import sys
if not ((2, 7, 5) <= sys.version_info < (3, 0)):
sys.stderr.write(
'Python version "%s" is not supported. Required version 2.7.5+, Python 3 is not supported\n' % sys.version
)
exit(1)
from version import __version__
from genestack_exceptions import (GenestackAu... | mit | Python |
ab25537b67b14a8574028280c1e16637faa8037c | Fix assumption that tornado.web was imported. | mvaled/gunicorn,wong2/gunicorn,prezi/gunicorn,elelianghh/gunicorn,wong2/gunicorn,WSDC-NITWarangal/gunicorn,MrKiven/gunicorn,mvaled/gunicorn,alex/gunicorn,1stvamp/gunicorn,z-fork/gunicorn,1stvamp/gunicorn,ephes/gunicorn,prezi/gunicorn,gtrdotmcs/gunicorn,tejasmanohar/gunicorn,urbaniak/gunicorn,gtrdotmcs/gunicorn,prezi/gu... | gunicorn/workers/gtornado.py | gunicorn/workers/gtornado.py | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import os
import sys
import tornado.web
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop, PeriodicCallback
from gunicorn.workers.base import Worker
from gunicorn... | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import os
import sys
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop, PeriodicCallback
from gunicorn.workers.base import Worker
from gunicorn import __version__... | mit | Python |
e8c193f6ef54d8169c3cc34c051f655eb3c8fb67 | Fix typo | yasyf/bcferries | bcferries/fuzzydict.py | bcferries/fuzzydict.py | import collections, functools32, datetime
from Levenshtein import ratio
from dateutil.parser import parse
class FuzzyDict(collections.MutableMapping):
def __init__(self, *args, **kwargs):
self.d = dict()
self.update(dict(*args, **kwargs))
@functools32.lru_cache(128)
def __get_best_time_match(self, key):... | import collections, functools32, datetime
from Levenshtein import ratio
from dateutil.parser import parse
class FuzzyDict(collections.MutableMapping):
def __init__(self, *args, **kwargs):
self.d = dict()
self.update(dict(*args, **kwargs))
@functools32.lru_cache(128)
def __get_best_time_match(self, key):... | mit | Python |
a0319ecf5222dca4731a0cde2f3ae50923046d10 | Bump to 2021.8 (#636) | google/santa,tburgin/santa,tburgin/santa,tburgin/santa,russellhancox/santa,russellhancox/santa,google/santa,google/santa,russellhancox/santa | version.bzl | version.bzl | """The version for all Santa components."""
SANTA_VERSION = "2021.8"
| """The version for all Santa components."""
SANTA_VERSION = "2021.7"
| apache-2.0 | Python |
3df72eb5f00195d62fc9e00ad2aeb0bb6578a12f | Add pip detection | oddt/oddt,mkukielka/oddt,oddt/oddt,mkukielka/oddt | oddt/__init__.py | oddt/__init__.py | """Open Drug Discovery Toolkit
==============================
Universal and easy to use resource for various drug discovery tasks, ie docking, virutal screening, rescoring.
Attributes
----------
toolkit : module,
Toolkits backend module, currenlty OpenBabel [ob] and RDKit [rdk].
This settin... | """Open Drug Discovery Toolkit
==============================
Universal and easy to use resource for various drug discovery tasks, ie docking, virutal screening, rescoring.
Attributes
----------
toolkit : module,
Toolkits backend module, currenlty OpenBabel [ob] and RDKit [rdk].
This settin... | bsd-3-clause | Python |
1410c1697079e6735432d9a9c420122c9722a7e6 | Increment version | NeuralEnsemble/libNeuroML,NeuralEnsemble/libNeuroML | neuroml/__init__.py | neuroml/__init__.py | from .nml.nml import * # allows importation of all neuroml classes
__version__ = '0.2.13'
current_neuroml_version = "v2beta4"
| from .nml.nml import * # allows importation of all neuroml classes
__version__ = '0.2.12'
current_neuroml_version = "v2beta4"
| bsd-3-clause | Python |
ee3dd1ca62ad15965a41c9569d812bc622359cd9 | remove firebase push from matchmanipulator | bvisness/the-blue-alliance,1fish2/the-blue-alliance,bvisness/the-blue-alliance,phil-lopreiato/the-blue-alliance,phil-lopreiato/the-blue-alliance,fangeugene/the-blue-alliance,phil-lopreiato/the-blue-alliance,bdaroz/the-blue-alliance,tsteward/the-blue-alliance,the-blue-alliance/the-blue-alliance,the-blue-alliance/the-blu... | helpers/match_manipulator.py | helpers/match_manipulator.py | import logging
from helpers.manipulator_base import ManipulatorBase
class MatchManipulator(ManipulatorBase):
"""
Handle Match database writes.
"""
@classmethod
def updateMerge(self, new_match, old_match):
"""
Given an "old" and a "new" Match object, replace the fields in the
... | import logging
from helpers.manipulator_base import ManipulatorBase
from helpers.firebase.firebase_pusher import FirebasePusher
class MatchManipulator(ManipulatorBase):
"""
Handle Match database writes.
"""
@classmethod
def updateMerge(self, new_match, old_match):
"""
Given an ... | mit | Python |
85f24349beff52a0458238545b0149d2ec1b3c40 | update version | saydulk/newfies-dialer,saydulk/newfies-dialer,newfies-dialer/newfies-dialer,laprice/newfies-dialer,romonzaman/newfies-dialer,berinhard/newfies-dialer,newfies-dialer/newfies-dialer,berinhard/newfies-dialer,Star2Billing/newfies-dialer,romonzaman/newfies-dialer,romonzaman/newfies-dialer,saydulk/newfies-dialer,newfies-dial... | newfies/__init__.py | newfies/__init__.py | # -*- coding: utf-8 -*-
"""Voice Broadcast Application"""
# :copyright: (c) 2010 - 2011 by Arezqui Belaid.
# :license: AGPL, see COPYING for more details.
VERSION = (1, 0, 6, "a3")
__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:])
__author__ = "Arezqui Belaid"
__contact__ = "info@star2billing.com... | # -*- coding: utf-8 -*-
"""Voice Broadcast Application"""
# :copyright: (c) 2010 - 2011 by Arezqui Belaid.
# :license: AGPL, see COPYING for more details.
VERSION = (1, 0, 6, "a2")
__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:])
__author__ = "Arezqui Belaid"
__contact__ = "info@star2billing.com... | mpl-2.0 | Python |
dd5774c30f950c8a52b977a5529300e8edce4bc7 | Fix proper default values for metadata migration | streamr/marvin,streamr/marvin,streamr/marvin | migrations/versions/2c240cb3edd1_.py | migrations/versions/2c240cb3edd1_.py | """Add movie metadata (imdb rating, number of votes, metascore) and relevancy
Revision ID: 2c240cb3edd1
Revises: 588336e02ca
Create Date: 2014-02-09 13:46:18.630000
"""
# revision identifiers, used by Alembic.
revision = '2c240cb3edd1'
down_revision = '588336e02ca'
from alembic import op
import sqlalchemy as sa
d... | """Add movie metadata (imdb rating, number of votes, metascore) and relevancy
Revision ID: 2c240cb3edd1
Revises: 588336e02ca
Create Date: 2014-02-09 13:46:18.630000
"""
# revision identifiers, used by Alembic.
revision = '2c240cb3edd1'
down_revision = '588336e02ca'
from alembic import op
import sqlalchemy as sa
d... | mit | Python |
85bcbf492ff1b845a5f300007d52a2e1c94f536e | Add tell method | dbrattli/OSlash | oslash/writer.py | oslash/writer.py | from typing import Any, Callable, Tuple
from .abc import Functor
from .abc import Monad
from .abc import Monoid
from .util import unit
class Writer(Monad, Functor):
"""The writer monad."""
def __init__(self, value: Any, log: Monoid):
"""Initialize a new writer.
:param value Any: Value to
... | from typing import Any, Callable, Tuple
from .abc import Functor
from .abc import Monad
from .abc import Monoid
class Writer(Monad, Functor):
"""The writer monad."""
def __init__(self, value: Any, log: Monoid):
"""Initialize a new writer.
:param value Any: Value to
"""
supe... | apache-2.0 | Python |
1e148822b4611403add32154fbe47bc8775f8001 | Enable foreign key constraint for SQLite | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | py/garage/garage/sql/sqlite.py | py/garage/garage/sql/sqlite.py | __all__ = [
'create_engine',
]
import sqlalchemy
def create_engine(db_uri, check_same_thread=False, echo=False):
engine = sqlalchemy.create_engine(
db_uri,
echo=echo,
connect_args={
'check_same_thread': check_same_thread,
},
)
@sqlalchemy.event.listens_for... | __all__ = [
'create_engine',
]
import sqlalchemy
def create_engine(db_uri, check_same_thread=False, echo=False):
engine = sqlalchemy.create_engine(
db_uri,
echo=echo,
connect_args={
'check_same_thread': check_same_thread,
},
)
@sqlalchemy.event.listens_for... | mit | Python |
2852abc7afd731ff8368424914431c8803a333bc | document what's going on in the wsgi script | wagnerand/zamboni,muffinresearch/olympia,andymckay/addons-server,mstriemer/olympia,crdoconnor/olympia,kmaglione/olympia,luckylavish/zamboni,johancz/olympia,mozilla/addons-server,wagnerand/zamboni,harikishen/addons-server,mstriemer/zamboni,spasovski/zamboni,Joergen/zamboni,Jobava/zamboni,shahbaz17/zamboni,Witia1/olympia... | wsgi/zamboni.wsgi | wsgi/zamboni.wsgi | import os
import site
# Add the zamboni dir to the python path so we can import manage which sets up
# other paths and settings.
wsgidir = os.path.dirname(__file__)
site.addsitedir(os.path.abspath(os.path.join(wsgidir, '../')))
# We let Apache tell us where to find site packages through the SITE variable
# in the wsg... | import os
import site
# Add the zamboni dir to the python path so we can import manage which sets up
# other paths and settings.
wsgidir = os.path.dirname(__file__)
site.addsitedir(os.path.abspath(os.path.join(wsgidir, '../')))
# manage adds the `apps` and `lib` directories to the path.
class ZamboniApp:
def __i... | bsd-3-clause | Python |
94f33f29ed03de391dbf6fca01d50d67d0edf1ec | Fix imports | joaojunior/y_text_recommender_system | y_text_recommender_system/recommender.py | y_text_recommender_system/recommender.py | import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
def recommend(doc, docs, stop_words=None):
vectorizer = TfidfVectorizer(min_df=1, stop_words=stop_words)
docs.insert(0, doc)
corpus = create_corpus_from_dict(docs)
model = vectorizer.fit_transform(corpus)
model_dense = ... | from sklearn.feature_extraction.text import TfidfVectorizer
import numpy as np
def recommend(doc, docs, stop_words=None):
vectorizer = TfidfVectorizer(min_df=1, stop_words=stop_words)
docs.insert(0, doc)
corpus = create_corpus_from_dict(docs)
model = vectorizer.fit_transform(corpus)
model_dense = ... | mit | Python |
ac27c690564acdcb6d1a9043ef4a8a6c4ff17cfa | allow updates for unversioned packages | TheKevJames/packtex | packtex/error.py | packtex/error.py | import sys
from packtex import local_info
def arguments(command, args, fail=False):
if not args:
print 'Could not', command, 'package(s). Error:', command, 'command requires at least one argument.'
if fail:
sys.exit(-1)
def installed(command, package, fail=False):
pkg = package.lower()
if not local_info.... | import sys
from packtex import local_info
def arguments(command, args, fail=False):
if not args:
print 'Could not', command, 'package(s). Error:', command, 'command requires at least one argument.'
if fail:
sys.exit(-1)
def installed(command, package, fail=False):
pkg = package.lower()
if not local_info.... | mit | Python |
7ba864920ec6b904247761b8ea058569fc964b7e | Initialize DB if it doesn’t exist | kyrias/mrw | server/server.py | server/server.py | from flask import Flask, request, g, Response
from auth import requires_auth
import datetime, msgpack, os.path, sqlite3
app = Flask(__name__)
app.config.from_object('config')
insert_query = '''INSERT INTO utmp (host, user, uid, rhost, line, time, updated)
VALUES (:host, :user, :uid, :rhost, :... | from flask import Flask, request, g, Response
from auth import requires_auth
import sqlite3, msgpack, datetime
app = Flask(__name__)
app.config.from_object('config')
insert_query = '''INSERT INTO utmp (host, user, uid, rhost, line, time, updated)
VALUES (:host, :user, :uid, :rhost, :line, :ti... | isc | Python |
774b4f4b24053379b6f5fbd2272ddadd8b1223b3 | Update Clock.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | service/Clock.py | service/Clock.py | # start the services
python = Runtime.start("python","Python")
clock = Runtime.start("clock","Clock")
log = Runtime.start("log","Log")
audio = Runtime.start("audio","AudioFile")
# define a ticktock method
def ticktock(timedata):
print timedata
audio.playResource("/resource/Clock/tick.mp3")
#create a message... | # start the services
python = Runtime.start("python","Python")
clock = Runtime.start("clock","Clock")
log = Runtime.start("log","Log")
audio = Runtime.start("audio","AudioFile")
# define a ticktock method
def ticktock(timedata):
print timedata
audio.playResource("/resource/Clock/tick.mp3")
#create a message... | apache-2.0 | Python |
69a56f640c9f69fcd930ef116d1d6a20a6965f1f | Remove trylast mark from test_replace_files.py | rlee287/pyautoupdate,rlee287/pyautoupdate | test/test_replace_files.py | test/test_replace_files.py | from __future__ import absolute_import, print_function
from ..pyautoupdate.launcher import Launcher
from logging import DEBUG
import os
import shutil
import pytest
@pytest.fixture(scope='function')
def fixture_update_setup(request):
"""Sets up and tears down version docs and code files"""
def teardown():
... | from __future__ import absolute_import, print_function
from ..pyautoupdate.launcher import Launcher
from logging import DEBUG
import os
import shutil
import pytest
@pytest.fixture(scope='function')
def fixture_update_setup(request):
"""Sets up and tears down version docs and code files"""
def teardown():
... | lgpl-2.1 | Python |
56b8bbdb1660e3c026e8b9ec0825199bf8031a05 | Disable the old ticket views. | occrp/id-backend | settings/urls.py | settings/urls.py | from django.conf import settings
from django.conf.urls import include, url
from django.views.generic import TemplateView
from django.views.generic.base import RedirectView
from django.views.i18n import javascript_catalog
from django.conf.urls.static import static
from core.manage import Panel
from core.admin import ad... | from django.conf import settings
from django.conf.urls import include, url
from django.views.generic import TemplateView
from django.views.i18n import javascript_catalog
from django.conf.urls.static import static
from core.manage import Panel
from core.admin import admin_site
from accounts.manage import Statistics
fro... | mit | Python |
e34c86c42c6e85fb5b5541b3fff244861b72bc5a | update test script | icchy/tracecorn | test.py | test.py | import unitracer
from unitracer.lib.windows.pe import PE
from capstone import *
from capstone.x86_const import *
def test_pe():
# print "kernel32.dll"
# pe = PE("./dll/kernel32.dll")
# print "imagebase: 0x{0:x}".format(pe.imagebase)
# api = "AcquireSRWLockExclusive"
# addr = pe.exports[api]
#... | import unitracer
from unitracer.lib.windows.pe import PE
from capstone import *
from capstone.x86_const import *
def test_pe():
# print "kernel32.dll"
# pe = PE("./dll/kernel32.dll")
# print "imagebase: 0x{0:x}".format(pe.imagebase)
# api = "AcquireSRWLockExclusive"
# addr = pe.exports[api]
#... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.