commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
ce6c4cb4bcac22fecd0a4a00624c7bc7eca325d0 | saltapi/cli.py | saltapi/cli.py | '''
CLI entry-point for salt-api
'''
# Import salt libs
from salt.utils.parsers import (
ConfigDirMixIn,
DaemonMixIn,
LogLevelMixIn,
MergeConfigMixIn,
OptionParser,
OptionParserMeta,
PidfileMixin)
# Import salt-api libs
import saltapi.client
import saltapi.config
import saltapi.version
cl... | '''
CLI entry-point for salt-api
'''
# Import python libs
import sys
import logging
# Import salt libs
import salt.utils.verify
from salt.utils.parsers import (
ConfigDirMixIn,
DaemonMixIn,
LogLevelMixIn,
MergeConfigMixIn,
OptionParser,
OptionParserMeta,
PidfileMixin)
# Import salt-api lib... | Enforce verify file on the log file and actually setup the log file logger. | Enforce verify file on the log file and actually setup the log file logger.
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt |
257afb0046c4af30bbfe0d46c36f0ec3257051b6 | glooey/__init__.py | glooey/__init__.py | #!/usr/bin/env python3
__version__ = '0.1.0'
from .widget import *
from .root import *
from .containers import *
from .miscellaneous import *
from . import drawing
| #!/usr/bin/env python3
__version__ = '0.1.0'
from .widget import *
from .root import *
from .containers import *
from .miscellaneous import *
from . import drawing
from . import themes
| Make the themes module available by default. | Make the themes module available by default.
| Python | mit | kxgames/glooey,kxgames/glooey |
bea2e64d8ed8ab2a368d660a15ed2f8485fdc29a | set_offline.py | set_offline.py | import asyncio
import os
import discord
from discord.ext import commands
import SLA_bot.channelupdater as ChannelUpdater
import SLA_bot.config as cf
curr_dir = os.path.dirname(__file__)
default_config = os.path.join(curr_dir, 'default_config.ini'),
user_config = os.path.join(curr_dir, 'config.ini')
cf.load_configs... | import asyncio
import os
import discord
from discord.ext import commands
import SLA_bot.config as cf
curr_dir = os.path.dirname(__file__)
default_config = os.path.join(curr_dir, 'default_config.ini'),
user_config = os.path.join(curr_dir, 'config.ini')
if not os.path.isfile(user_config):
print("Could not find c... | Add EQ related links in offline bot message | Add EQ related links in offline bot message
| Python | mit | EsqWiggles/SLA-bot,EsqWiggles/SLA-bot |
45116fc996b097176bcfa2dcd7fb8c9710f6d66e | tests/test_basics.py | tests/test_basics.py |
import os
from xml.etree import ElementTree
from utils import with_app, pretty_print_xml
#=============================================================================
# Tests
@with_app(buildername="xml", srcdir="basics")
def test_basics(app, status, warning):
app.build()
tree = ElementTree.pars... |
import os
from xml.etree import ElementTree
from utils import with_app, pretty_print_xml
#=============================================================================
# Tests
@with_app(buildername="xml", srcdir="basics")
def test_basics(app, status, warning):
app.build()
tree = ElementTree.pars... | Remove debug printing from test case | Remove debug printing from test case
| Python | apache-2.0 | t4ngo/sphinxcontrib-traceables |
00712888b761bce556b73e36c9c7270829d3a1d4 | tests/test_entity.py | tests/test_entity.py | from test_provider_gtfs import provider
from busbus.entity import BaseEntityJSONEncoder
import json
import pytest
@pytest.fixture(scope='module')
def agency(provider):
return next(provider.agencies)
def test_entity_repr(agency):
assert 'DTA' in repr(agency)
def test_entity_failed_getattr(agency):
wi... | from test_provider_gtfs import provider
from busbus.entity import BaseEntityJSONEncoder
import json
import pytest
@pytest.fixture(scope='module')
def agency(provider):
return next(provider.agencies)
def test_entity_repr(agency):
assert 'DTA' in repr(agency)
def test_entity_failed_getattr(agency):
wi... | Test the failure branch in BaseEntityJSONDecoder | Test the failure branch in BaseEntityJSONDecoder
| Python | mit | spaceboats/busbus |
f0d87f1979ace66f530bb8f7f00cdc71ac8f549c | chainer/datasets/__init__.py | chainer/datasets/__init__.py | from chainer.datasets import cifar
from chainer.datasets import dict_dataset
from chainer.datasets import image_dataset
from chainer.datasets import mnist
from chainer.datasets import ptb
from chainer.datasets import sub_dataset
from chainer.datasets import tuple_dataset
DictDataset = dict_dataset.DictDataset
ImageDa... | from chainer.datasets import cifar
from chainer.datasets import dict_dataset
from chainer.datasets import image_dataset
from chainer.datasets import mnist
from chainer.datasets import ptb
from chainer.datasets import sub_dataset
from chainer.datasets import tuple_dataset
DictDataset = dict_dataset.DictDataset
ImageDa... | Add LabeledImageDataset to datasets module | Add LabeledImageDataset to datasets module
| Python | mit | chainer/chainer,kiyukuta/chainer,wkentaro/chainer,tkerola/chainer,kikusu/chainer,ysekky/chainer,wkentaro/chainer,delta2323/chainer,chainer/chainer,okuta/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,okuta/chainer,cupy/cupy,ktnyt/chainer,jnishi/chainer,kikusu/chainer,hvy/chainer,niboshi/chainer,hvy/chainer,aon... |
4051794670ec252cb972ed0c8cd1a5203e8a8de4 | amplpy/amplpython/__init__.py | amplpy/amplpython/__init__.py | # -*- coding: utf-8 -*-
import os
import sys
import ctypes
import platform
if platform.system() == 'Windows':
lib32 = os.path.join(os.path.dirname(__file__), 'lib32')
lib64 = os.path.join(os.path.dirname(__file__), 'lib64')
from glob import glob
try:
if ctypes.sizeof(ctypes.c_voidp) == 4:
... | # -*- coding: utf-8 -*-
import os
import sys
import ctypes
import platform
if platform.system() == 'Windows':
lib32 = os.path.join(os.path.dirname(__file__), 'cppinterface', 'lib32')
lib64 = os.path.join(os.path.dirname(__file__), 'cppinterface', 'lib64')
from glob import glob
try:
if ctypes.si... | Fix 'ImportError: DLL load failed' | Fix 'ImportError: DLL load failed'
| Python | bsd-3-clause | ampl/amplpy,ampl/amplpy,ampl/amplpy |
0d0e354627441daf33ea8c5702c3977de992cc7a | tests/unit/utils/test_yamldumper.py | tests/unit/utils/test_yamldumper.py | # -*- coding: utf-8 -*-
'''
Unit tests for salt.utils.yamldumper
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Libs
import salt.utils.yamldumper
# Import Salt Testing Libs
from tests.support.unit import TestCase, skipIf
from tests.support.mock imp... | # -*- coding: utf-8 -*-
'''
Unit tests for salt.utils.yamldumper
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Libs
import salt.ext.six
import salt.utils.yamldumper
# Import Salt Testing Libs
from tests.support.unit import TestCase, skipIf
from te... | Fix yamldumper test for both py2/py3 | Fix yamldumper test for both py2/py3
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt |
8555f6c4076a485d7615b8caef861536096c0ac1 | scripts/app.py | scripts/app.py | from rsk_mind.datasource import CSVDatasource
datasource = CSVDatasource('in.csv')
dataset = datasource.read()
dataset.setTransformer(1)
dataset.applyTransformations()
datasource = CSVDatasource('out.csv')
datasource.write(dataset)
| from rsk_mind.datasource import CSVDatasource
datasource = CSVDatasource('in.csv')
dataset = datasource.read()
dataset.applyTransformations()
datasource = CSVDatasource('out.csv')
datasource.write(dataset)
| Load source dataset and save transformed dataset | Load source dataset and save transformed dataset
| Python | mit | rsk-mind/rsk-mind-framework |
586fab3cdc9e059c082bf209a6113b6bb06f2119 | knox/settings.py | knox/settings.py | from datetime import timedelta
from django.conf import settings
from django.test.signals import setting_changed
from rest_framework.settings import api_settings, APISettings
USER_SETTINGS = getattr(settings, 'REST_KNOX', None)
DEFAULTS = {
'LOGIN_AUTHENTICATION_CLASSES': api_settings.DEFAULT_AUTHENTICATION_CLASSE... | from datetime import timedelta
from django.conf import settings
from django.test.signals import setting_changed
from rest_framework.settings import APISettings
USER_SETTINGS = getattr(settings, 'REST_KNOX', None)
DEFAULTS = {
'SECURE_HASH_ALGORITHM': 'cryptography.hazmat.primitives.hashes.SHA512',
'AUTH_TOKEN... | Revert "separate default authentication from the DRF's one" | Revert "separate default authentication from the DRF's one"
This reverts commit 73aef41ffd2be2fbed11cf75f75393a80322bdcb.
| Python | mit | James1345/django-rest-knox,James1345/django-rest-knox |
151f05738d760909d5c3eba6b6d7c182aa77e8d4 | opps/core/admin.py | opps/core/admin.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.utils import timezone
from django.conf import settings
from django.contrib.sites.models import Site
class PublishableAdmin(admin.ModelAdmin):
"""
Overrides standard admin.ModelAdmin save_model method
It sets user (a... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.utils import timezone
from django.conf import settings
from django.contrib.sites.models import Site
class PublishableAdmin(admin.ModelAdmin):
"""
Overrides standard admin.ModelAdmin save_model method
It sets user (a... | Add child_class on list filter PublishableAdmin | Add child_class on list filter PublishableAdmin
| Python | mit | williamroot/opps,jeanmask/opps,jeanmask/opps,opps/opps,williamroot/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,YACOWS/opps,opps/opps,YACOWS/opps,opps/opps,opps/opps,jeanmask/opps,jeanmask/opps,williamroot/opps |
48ffcca081ab1d143e9941e67e6cc5c6a2844d23 | pygotham/admin/talks.py | pygotham/admin/talks.py | """Admin for talk-related models."""
from pygotham.admin.utils import model_view
from pygotham.talks import models
__all__ = ('CategoryModelView', 'TalkModelView', 'TalkReviewModelView')
CategoryModelView = model_view(
models.Category,
'Categories',
'Talks',
form_columns=('name', 'slug'),
)
TalkMod... | """Admin for talk-related models."""
from pygotham.admin.utils import model_view
from pygotham.talks import models
__all__ = ('CategoryModelView', 'TalkModelView', 'TalkReviewModelView')
CategoryModelView = model_view(
models.Category,
'Categories',
'Talks',
form_columns=('name', 'slug'),
)
TalkMod... | Add filters to the talk admin | Add filters to the talk admin
@logston is reviewing talks and wanted to see the talk duration. He also
thought it would be useful to be able to filter by the duration and
status of the talk.
| Python | bsd-3-clause | djds23/pygotham-1,pathunstrom/pygotham,djds23/pygotham-1,PyGotham/pygotham,djds23/pygotham-1,PyGotham/pygotham,djds23/pygotham-1,PyGotham/pygotham,djds23/pygotham-1,pathunstrom/pygotham,pathunstrom/pygotham,PyGotham/pygotham,PyGotham/pygotham,pathunstrom/pygotham,pathunstrom/pygotham |
ad3173b5f701cc27532103fcffe52deca67432b7 | user_profile/models.py | user_profile/models.py | from django.db import models
from django.contrib.auth.models import User
class UserProfile(models.Model):
user = models.OneToOneField(User)
description = models.TextField(max_length=3000)
picture = models.ImageField(upload_to='media/profiles/')
thumbnail = models.ImageField(
upload_to='media/profiles/thum... | from django.db import models
from django.contrib.auth.models import User
class UserProfile(models.Model):
user = models.OneToOneField(User)
description = models.TextField(max_length=3000)
picture = models.ImageField(blank=True, upload_to='media/profiles/')
thumbnail = models.ImageField(
upload_to='media/p... | Change user_profile so picture can be null | Change user_profile so picture can be null
| Python | mit | DeWaster/Tviserrys,DeWaster/Tviserrys |
175ffb66a58d8f05150a50b2a6dce30663f5999c | user_profile/models.py | user_profile/models.py | from django.db import models
from django.contrib.auth.models import User
class UserProfile(models.Model):
user = models.OneToOneField(User)
description = models.TextField(max_length=3000)
picture = models.ImageField(upload_to='media/profiles/') | from django.db import models
from django.contrib.auth.models import User
class UserProfile(models.Model):
user = models.OneToOneField(User)
description = models.TextField(max_length=3000)
picture = models.ImageField(upload_to='media/profiles/')
follows = models.ManyToManyField("self", blank=True, null=True) | Add following into user profile | Add following into user profile
| Python | mit | DeWaster/Tviserrys,DeWaster/Tviserrys |
8a7be30e2847f6d50f401dedc616d667cb36a6c6 | rx/linq/observable/average.py | rx/linq/observable/average.py | from six import add_metaclass
from rx import Observable
from rx.internal import ExtensionMethod
class AverageValue(object):
def __init__(self, sum, count):
self.sum = sum
self.count = count
@add_metaclass(ExtensionMethod)
class ObservableAverage(Observable):
"""Uses a meta class to extend Obs... | from six import add_metaclass
from rx import Observable
from rx.internal import ExtensionMethod
class AverageValue(object):
def __init__(self, sum, count):
self.sum = sum
self.count = count
@add_metaclass(ExtensionMethod)
class ObservableAverage(Observable):
"""Uses a meta class to extend Obs... | Rename from select to map | Rename from select to map
| Python | mit | dbrattli/RxPY,ReactiveX/RxPY,ReactiveX/RxPY |
d9d051b7a80025d76cfe0827f0bf632cfbd18972 | app/handlers.py | app/handlers.py | import os
import io
import json
from aiohttp import web
class Handler:
def __init__(self, *, loop):
self.loop = loop
self.files = {}
def lookup_files(self, path):
for obj in os.listdir(path):
_path = os.path.join(path, obj)
if os.path.isfile(_path) or os.pat... | import os
import io
import json
from aiohttp import web
class Handler:
def __init__(self, *, loop):
self.loop = loop
self.files = {}
def lookup_files(self, path):
for obj in os.listdir(path):
_path = os.path.join(path, obj)
if os.path.isfile(_path):
... | Remove extra check of symlinks. | Remove extra check of symlinks.
| Python | apache-2.0 | pcinkh/fake-useragent-cache-server |
64bf087f818e58bec8c39c03fb51b62f4253b2ad | settings.py | settings.py | import os
LOWAGE = 15
UPAGE = 70
MAXAGE = 120
DATADIR = '/home/pieter/projects/factors/data'
INFILE = 'lifedb.xls'
XLSWB = os.path.join(DATADIR, INFILE)
INSURANCE_IDS = ['OPLL', 'NPLL-B', 'NPLL-O',
'NPLLRS', 'NPTL-B', 'NPTL-O', 'ay_avg']
| import os
LOWAGE = 15
UPAGE = 70
MAXAGE = 120
DATADIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data')
INFILE = 'lifedb.xls'
XLSWB = os.path.join(DATADIR, INFILE)
INSURANCE_IDS = ['OPLL', 'NPLL-B', 'NPLL-O',
'NPLLRS', 'NPTL-B', 'NPTL-O', 'ay_avg']
| Make DATADIR absolute path agnostic | Make DATADIR absolute path agnostic
| Python | mit | Oxylo/factors |
d39d922168a0918bce572049cd93844060a79b9a | awseed/test_iam_credentials_envar.py | awseed/test_iam_credentials_envar.py | # AWS_ACCESS_KEY_ID - AWS access key.
# AWS_SECRET_ACCESS_KEY - AWS secret key. Access and secret key variables override credentials stored in credential and config files.
# AWS_DEFAULT_REGION - AWS region. This variable overrides the default region of the in-use profile, if set.
#
# env AWS_ACCESS_KEY_ID=AKIAJOVZ2DVGJ... | # AWS_ACCESS_KEY_ID - AWS access key.
# AWS_SECRET_ACCESS_KEY - AWS secret key. Access and secret key variables override credentials stored in credential and config files.
# AWS_DEFAULT_REGION - AWS region. This variable overrides the default region of the in-use profile, if set.
#
# env AWS_ACCESS_KEY_ID=acb \
# A... | Remove AWS credential (IAM user have already been deleted from AWS) | Remove AWS credential (IAM user have already been deleted from AWS)
| Python | mit | nyue/awseed,nyue/awseed |
7fab2f02ddea20a790c4e6065b38229776c6b763 | spam/tests/test_preprocess.py | spam/tests/test_preprocess.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from spam.preprocess import PreProcess
from spam.common import params
class TestPreProcess(unittest.TestCase):
"""
Class for testing the preprocces.
"""
def setUp(self):
self.preprocess = PreProcess(
params.DATASET_PAT... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from spam.preprocess import PreProcess
from spam.common import params
class TestPreProcess(unittest.TestCase):
"""
Class for testing the preprocces.
"""
def setUp(self):
self.preprocess = PreProcess(
params.DATASET_PAT... | Add empty tests with descriptions. | Add empty tests with descriptions.
| Python | mit | benigls/spam,benigls/spam |
95a72d1f06c740b933983c2446b36bb450c4730e | ona_migration_script/migrate_toilet_codes.py | ona_migration_script/migrate_toilet_codes.py | import argparse
parser = argparse.ArgumentParser(description='Migrate toilet codes')
parser.add_argument(
'url', type=str,
help='The base URL for the django toilet database')
parser.add_argument(
'username', type=str, help='The username used to log in')
parser.add_argument(
'password', type=str, help='... | import argparse
parser = argparse.ArgumentParser(description='Migrate toilet codes')
parser.add_argument(
'url', type=str,
help='The base URL for the django toilet database')
parser.add_argument(
'username', type=str, help='The username used to log in')
parser.add_argument(
'password', type=str, help='... | Add dryrun command line argument | Add dryrun command line argument
| Python | bsd-3-clause | praekelt/go-imali-yethu-js,praekelt/go-imali-yethu-js,praekelt/go-imali-yethu-js |
cdb3a6f1a467c317817818a7df921dc168cacb4c | astropy/time/setup_package.py | astropy/time/setup_package.py | import os
from distutils.extension import Extension
TIMEROOT = os.path.relpath(os.path.dirname(__file__))
def get_extensions():
time_ext = Extension(
name="astropy.time.sofa_time",
sources=[os.path.join(TIMEROOT, "sofa_time.pyx"), "cextern/sofa/sofa.c"],
include_dirs=['numpy', 'cextern/sofa'],
la... | import os
from distutils.extension import Extension
from astropy import setup_helpers
TIMEROOT = os.path.relpath(os.path.dirname(__file__))
def get_extensions():
sources = [os.path.join(TIMEROOT, "sofa_time.pyx")]
include_dirs = ['numpy']
libraries = []
if setup_helpers.use_system_library('sofa'):
... | Update astropy.time setup to allow using system sofa_c library | Update astropy.time setup to allow using system sofa_c library
| Python | bsd-3-clause | lpsinger/astropy,saimn/astropy,tbabej/astropy,stargaser/astropy,lpsinger/astropy,DougBurke/astropy,StuartLittlefair/astropy,larrybradley/astropy,aleksandr-bakanov/astropy,funbaker/astropy,pllim/astropy,kelle/astropy,mhvk/astropy,mhvk/astropy,kelle/astropy,tbabej/astropy,larrybradley/astropy,larrybradley/astropy,stargas... |
a3f5e1338cc84c60b867fc04175253f7ab460912 | relay_api/api/backend.py | relay_api/api/backend.py | import json
from relay_api.core.relay import relay
from relay_api.conf.config import relays
def init_relays():
for r in relays:
relays[r]["object"] = relay(relays[r]["gpio"])
relays[r]["state"] = relays[r]["object"].get_state()
def get_all_relays():
relays_dict = __get_relay_dict()
retur... | import json
from relay_api.core.relay import relay
from relay_api.conf.config import relays
def init_relays():
for r in relays:
relays[r]["object"] = relay(relays[r]["gpio"])
relays[r]["state"] = relays[r]["object"].get_state()
def get_all_relays():
relays_dict = __get_relay_dict()
retur... | Add indent in json to improve debugging | Add indent in json to improve debugging
| Python | mit | pahumadad/raspi-relay-api |
c908c943f66468f91cb8abb450bca36ead731885 | test_app.py | test_app.py | import unittest
from unittest import TestCase
from user import User
from bucketlist import BucketList
from flask import url_for
from app import app
class BucketListTest(TestCase):
def setUp(self):
# creates a test client
self.client = app.test_client()
self.client.testing = True
... | import unittest
from unittest import TestCase
from user import User
from bucketlist import BucketList
from flask import url_for, session
from app import app
class BucketListTest(TestCase):
def setUp(self):
app.config['SECRET_KEY'] = 'seasasaskrit!'
# creates a test client
self.cli... | Add test for signup success | Add test for signup success
| Python | mit | mkiterian/bucket-list-app,mkiterian/bucket-list-app,mkiterian/bucket-list-app |
71cc3cf500a9db7a96aa5f1a6c19c387cf0ad4ec | fickle/backend.py | fickle/backend.py | import sklearn.cross_validation
class Backend(object):
def __init__(self):
self.dataset_id = 0
self.dataset = None
self.model = None
def load(self, dataset):
self.model = None
self.dataset_id += 1
self.dataset = dataset
self._data = dataset['data']
... | import sklearn.cross_validation
class Backend(object):
def __init__(self):
self.dataset_id = 0
self.random_id = 0
self.dataset = None
self.model = None
def load(self, dataset):
self.model = None
self.dataset_id += 1
self.dataset = dataset
self._d... | Validate with sequential random state | Validate with sequential random state
| Python | mit | norbert/fickle |
06dc2190d64e312b3b8285e69a0d50342bc55b46 | tests/integration/test_proxy.py | tests/integration/test_proxy.py | # -*- coding: utf-8 -*-
'''Test using a proxy.'''
# External imports
import multiprocessing
import pytest
requests = pytest.importorskip("requests")
from six.moves import socketserver, SimpleHTTPServer
from six.moves.urllib.request import urlopen
# Internal imports
import vcr
class Proxy(SimpleHTTPServer.SimpleHTT... | # -*- coding: utf-8 -*-
'''Test using a proxy.'''
# External imports
import multiprocessing
import pytest
from six.moves import socketserver, SimpleHTTPServer
from six.moves.urllib.request import urlopen
# Internal imports
import vcr
# Conditional imports
requests = pytest.importorskip("requests")
class Proxy(Sim... | Fix format string for Python 2.6 | Fix format string for Python 2.6
| Python | mit | kevin1024/vcrpy,graingert/vcrpy,kevin1024/vcrpy,graingert/vcrpy |
fce1b1bdb5a39bbe57b750cd453a9697b8447d6b | chat.py | chat.py | import re
from redis import Redis
import json
from datetime import datetime
def is_valid_chatroom(chatroom):
return re.match('[A-Za-z_\\d]+$', chatroom) is not None
def get_redis():
return Redis()
def get_conversation(chatroom):
if chatroom is None or len(chatroom) == 0:
return None
# if chat... | import re
from redis import Redis
import json
from datetime import datetime
def is_valid_chatroom(chatroom):
return re.match('[A-Za-z_\\d]+$', chatroom) is not None
def get_redis():
return Redis()
def get_conversation(chatroom):
if chatroom is None or len(chatroom) == 0:
return None
storage =... | Correct position of comment :) | Correct position of comment :)
| Python | bsd-3-clause | arturosevilla/notification-server-example,arturosevilla/notification-server-example |
2c90b0ca03c79cbba476897b8a2068e99cc6b2b1 | restaurant/urls.py | restaurant/urls.py | """restaurant URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | """restaurant URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | Change view for login url. Add url for index page | Change view for login url. Add url for index page
| Python | mit | Social-projects-Rivne/Rv-025.Python,Social-projects-Rivne/Rv-025.Python,Social-projects-Rivne/Rv-025.Python |
f6a382a9a52ef2321c18ba63a2ece6930dadcf62 | src/pybel/manager/__init__.py | src/pybel/manager/__init__.py | # -*- coding: utf-8 -*-
"""
The :mod:`pybel.manager` module serves as an interface between the BEL graph data structure and underlying relational
databases. Its inclusion allows for the caching of namespaces and annotations for much faster lookup than
downloading and parsing upon each compilation.
"""
from . import... | # -*- coding: utf-8 -*-
"""
The :mod:`pybel.manager` module serves as an interface between the BEL graph data structure and underlying relational
databases. Its inclusion allows for the caching of namespaces and annotations for much faster lookup than
downloading and parsing upon each compilation.
"""
from . import... | Add citation utils to init | Add citation utils to init
| Python | mit | pybel/pybel,pybel/pybel,pybel/pybel |
1c9b0185b98d1bfe06fb7bd565d255a1b4f23f96 | test_output.py | test_output.py | #!/usr/bin/env python
# -*- encoding: utf-8
"""
These are tests of the external behaviour -- feature tests, if you like.
They run the compiled binaries, and make assertions about the return code,
stdout and stderr.
"""
import unittest
from conftest import BaseTest
class TestSafariRS(BaseTest):
def test_urls_al... | #!/usr/bin/env python
# -*- encoding: utf-8
"""
These are tests of the external behaviour -- feature tests, if you like.
They run the compiled binaries, and make assertions about the return code,
stdout and stderr.
"""
import unittest
from conftest import BaseTest
class TestSafariRS(BaseTest):
def test_urls_al... | Add a test for the tidy-url command | Add a test for the tidy-url command
| Python | mit | alexwlchan/safari.rs,alexwlchan/safari.rs |
bdb46e88fb9ee14b6c12d2b9aa5087cfe973492c | pontoon/base/__init__.py | pontoon/base/__init__.py | """Application base, containing global templates."""
default_app_config = 'pontoon.base.apps.BaseConfig'
MOZILLA_REPOS = (
'ssh://hg.mozilla.org/users/m_owca.info/firefox-aurora/',
'ssh://hg.mozilla.org/users/m_owca.info/firefox-for-android-aurora/',
'ssh://hg.mozilla.org/users/m_owca.info/thunderbird-aur... | """Application base, containing global templates."""
default_app_config = 'pontoon.base.apps.BaseConfig'
MOZILLA_REPOS = (
'ssh://hg.mozilla.org/users/m_owca.info/firefox-beta/',
'ssh://hg.mozilla.org/users/m_owca.info/firefox-for-android-beta/',
'ssh://hg.mozilla.org/users/m_owca.info/thunderbird-beta/',... | Make Mozilla Beta repositories special | Make Mozilla Beta repositories special
| Python | bsd-3-clause | yfdyh000/pontoon,jotes/pontoon,participedia/pontoon,m8ttyB/pontoon,m8ttyB/pontoon,mastizada/pontoon,jotes/pontoon,mathjazz/pontoon,mozilla/pontoon,jotes/pontoon,yfdyh000/pontoon,mathjazz/pontoon,mastizada/pontoon,yfdyh000/pontoon,jotes/pontoon,sudheesh001/pontoon,yfdyh000/pontoon,mastizada/pontoon,sudheesh001/pontoon,m... |
ed34dac136af052c849b35adacc7c95b2d82e00a | tests/test_content_type.py | tests/test_content_type.py | import pytest
from rest_framework.request import Request
from rest_framework.test import APIRequestFactory
from rest_framework.parsers import JSONParser, FormParser, MultiPartParser
factory = APIRequestFactory()
def test_content_type_override_query():
from rest_url_override_content_negotiation import \
... | import pytest
from rest_framework.request import Request
from rest_framework.test import APIRequestFactory
from rest_framework.parsers import JSONParser, FormParser, MultiPartParser
factory = APIRequestFactory()
def test_content_type_override_query():
from rest_url_override_content_negotiation import \
... | Check media_type instead of class type | Check media_type instead of class type
The `parsers` list should contain instances, not classes.
| Python | mit | hzdg/drf-url-content-type-override |
d4f21288e7ba6bdc27f0f01fd0dba394a9786aa6 | open_humans/utilities.py | open_humans/utilities.py | import io
import os
from ConfigParser import RawConfigParser
def apply_env():
"""
Read the `.env` file and apply it to os.environ just like using `foreman
run` would.
"""
env = '[root]\n' + io.open('.env', 'r').read()
config = RawConfigParser(allow_no_value=True)
# Use `str` instead of ... | import io
import os
from ConfigParser import RawConfigParser
def apply_env():
"""
Read the `.env` file and apply it to os.environ just like using `foreman
run` would.
"""
try:
env = '[root]\n' + io.open('.env', 'r').read()
except IOError:
return
config = RawConfigParser(a... | Fix crash if .env does not exist | Fix crash if .env does not exist
| Python | mit | PersonalGenomesOrg/open-humans,OpenHumans/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,OpenHumans/open-humans,OpenHumans/open-humans,PersonalGenomesOrg/open-humans,PersonalGenomesOrg/open-humans |
8353339f9a907767a6cb89d4e65497e7adb541d9 | fridge/test/test_memoryfs.py | fridge/test/test_memoryfs.py | from fridge.memoryfs import MemoryFile
class TestMemoryFile(object):
def test_can_be_written(self):
f = MemoryFile()
f.write('test')
f.flush()
assert f.content == 'test'
| from fridge.memoryfs import MemoryFile
class TestMemoryFile(object):
def test_can_be_written(self):
f = MemoryFile()
f.write('test')
f.flush()
assert f.content == 'test'
def test_close_flushes_content(self):
f = MemoryFile()
f.write('test')
f.close()
... | Add more tests for MemoryFile. | Add more tests for MemoryFile.
| Python | mit | jgosmann/fridge,jgosmann/fridge |
4ba31b7c0cce69693df383cb875705d7e66c2945 | admin/base/migrations/0001_groups.py | admin/base/migrations/0001_groups.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.contrib.auth.models import Group
import logging
logger = logging.getLogger(__file__)
def add_groups(*args):
print args
group, created = Group.objects.get_or_create(name='prereg_group')
if... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.contrib.auth.models import Group
import logging
logger = logging.getLogger(__file__)
def add_groups(*args):
print args
group, created = Group.objects.get_or_create(name='prereg_group')
if... | Add group with more future permissions | Add group with more future permissions
| Python | apache-2.0 | monikagrabowska/osf.io,leb2dg/osf.io,pattisdr/osf.io,zachjanicki/osf.io,doublebits/osf.io,jnayak1/osf.io,laurenrevere/osf.io,TomBaxter/osf.io,cwisecarver/osf.io,mfraezz/osf.io,emetsger/osf.io,binoculars/osf.io,Nesiehr/osf.io,zamattiac/osf.io,amyshi188/osf.io,jnayak1/osf.io,pattisdr/osf.io,rdhyee/osf.io,crcresearch/osf.... |
faf35a814d045ce3d71921ed0d4ac268d5a9811c | app/notify_client/provider_client.py | app/notify_client/provider_client.py |
from app.notify_client import _attach_current_user, NotifyAdminAPIClient
class ProviderClient(NotifyAdminAPIClient):
def __init__(self):
super().__init__("a", "b", "c")
def init_app(self, app):
self.base_url = app.config['API_HOST_NAME']
self.service_id = app.config['ADMIN_CLIENT_USE... |
from app.notify_client import _attach_current_user, NotifyAdminAPIClient
class ProviderClient(NotifyAdminAPIClient):
def __init__(self):
super().__init__("a", "b", "c")
def init_app(self, app):
self.base_url = app.config['API_HOST_NAME']
self.service_id = app.config['ADMIN_CLIENT_USE... | Add provider client method to get provider version history | Add provider client method to get provider version history
| Python | mit | gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin |
6d5697a72793f50054fdfc268115fd8afb62969a | yunity/utils/tests/mock.py | yunity/utils/tests/mock.py | from factory import DjangoModelFactory, CREATE_STRATEGY, LazyAttribute, post_generation, SubFactory, PostGeneration
from yunity.utils.tests.fake import faker
class Mock(DjangoModelFactory):
class Meta:
strategy = CREATE_STRATEGY
model = None
abstract = True
class MockUser(Mock):
clas... | from factory import DjangoModelFactory, CREATE_STRATEGY, LazyAttribute, post_generation, SubFactory, PostGeneration
from yunity.utils.tests.fake import faker
class Mock(DjangoModelFactory):
class Meta:
strategy = CREATE_STRATEGY
model = None
abstract = True
class MockUser(Mock):
clas... | Refactor MockConversation to new model | Refactor MockConversation to new model
Renamed MockChat to MockConversation, remove removed administratedBy
Trait
| Python | agpl-3.0 | yunity/foodsaving-backend,yunity/yunity-core,yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend |
55f6b85e0c376ba56a2ce860fd8d33011c34bc7e | python/problem2.py | python/problem2.py |
def fib(size=-1):
def inner():
count = 0
last = 0
current = 1
while size < 0 or count < size:
last, current = current, last + current
if current > 4000000:
break
count += 1
yield current
return inner()
print su... |
def fib(size=-1):
count = 0
last = 0
current = 1
while size < 0 or count < size:
last, current = current, last + current
if current > 4000000:
break
count += 1
yield current
print sum((i for i in fib() if i % 2 == 0))
| Update probelm 2's generator function | Update probelm 2's generator function
| Python | mit | jreese/euler,jreese/euler,jreese/euler,jreese/euler |
f4851040b74a0c88980a1e82a8b518bd6147f508 | FF4P/Abilities.py | FF4P/Abilities.py | import csv
abilityList = {}
def loadAbilities():
global abilityList
with open('FF4/FF4Abil.csv', 'r') as csvFile:
abilityReader = csv.reader(csvFile, delimiter=',', quotechar='|')
i = 0
for row in abilityReader:
abilityList[i] = row
i += 1
def reloadAbilities():... | import os
import csv
abilityList = {}
def loadAbilities():
global abilityList
fileName = "FF4P/FF4P_Abil.csv"
if not os.path.exists(fileName):
fileName = "FF4P_Abil.csv"
with open(fileName, 'r') as csvFile:
abilityReader = csv.reader(csvFile, delimiter=',', quotechar='|')
i... | Fix Filename Errors Module folder had changed at some point in the past, fixed the file path so it could find the CSV | Fix Filename Errors
Module folder had changed at some point in the past, fixed the file
path so it could find the CSV
| Python | mit | einSynd/PyIRC |
cc754aeb16aa41f936d59a3b5746a3bec69489ef | sts/util/convenience.py | sts/util/convenience.py | import time
def timestamp_string():
return time.strftime("%Y_%m_%d_%H_%M_%S", time.localtime())
def find(f, seq):
"""Return first item in sequence where f(item) == True."""
for item in seq:
if f(item):
return item
def find_index(f, seq):
"""Return the index of the first item in sequence where f(ite... | import time
def is_sorted(l):
return all(l[i] <= l[i+1] for i in xrange(len(l)-1))
def is_strictly_sorted(l):
return all(l[i] < l[i+1] for i in xrange(len(l)-1))
def timestamp_string():
return time.strftime("%Y_%m_%d_%H_%M_%S", time.localtime())
def find(f, seq):
"""Return first item in sequence where f(ite... | Add little functions for checking if a list is sorted without sorting it | Add little functions for checking if a list is sorted without sorting it
| Python | apache-2.0 | ucb-sts/sts,jmiserez/sts,jmiserez/sts,ucb-sts/sts |
a8ee8b389359f67a4e0eb0891ccb2278608e3df0 | openacademy/model/openacademy_session.py | openacademy/model/openacademy_session.py | # -*- coding: utf-8 -*-
from openerp import fields, models
... | # -*- coding: utf-8 -*-
from openerp import fields, models
... | Add domain or and ilike | [REF] openacademy: Add domain or and ilike
| Python | apache-2.0 | hellomoto6/openacademy |
529f719555a42bbdfe74d678ef9839ed7377bcf1 | motor.py | motor.py | import sys
import RPi.GPIO as GPIO
# Register Pin number
enable1 = 22
input1a = 18
input1b = 16
def control(arg):
if arg == 'init':
GPIO.setmode(GPIO.BOARD)
GPIO.setup(enable1, GPIO.OUT)
GPIO.setup(input1a, GPIO.OUT)
GPIO.setup(input1b, GPIO.OUT)
elif arg == 'forward':
... | import sys
import RPi.GPIO as GPIO
# Register Pin number
enable1 = 22
input1a = 18
input1b = 16
def control(arg):
if arg == 'init':
GPIO.setmode(GPIO.BOARD)
GPIO.setup(enable1, GPIO.OUT)
GPIO.setup(input1a, GPIO.OUT)
GPIO.setup(input1b, GPIO.OUT)
elif arg == 'forward':
... | Add init process as default | Add init process as default
| Python | apache-2.0 | hideo54/R2-D2,hideo54/R2-D2,hideo54/R2-D2 |
b69170a0ab629f0e11d66ed71857989db1f647f9 | scripts/analytics/institutions.py | scripts/analytics/institutions.py | from modularodm import Q
from website.app import init_app
from website.models import User, Node, Institution
def get_institutions():
institutions = Institution.find(Q('_id', 'ne', None))
return institutions
def get_user_count_by_institutions():
institutions = get_institutions()
user_counts = []
... | from modularodm import Q
from website.app import init_app
from website.models import User, Node, Institution
from website.settings import KEEN as keen_settings
from keen.client import KeenClient
def get_institutions():
institutions = Institution.find(Q('_id', 'ne', None))
return institutions
def get_count_... | Update script to work with Keen | Update script to work with Keen
| Python | apache-2.0 | leb2dg/osf.io,alexschiller/osf.io,cslzchen/osf.io,mluo613/osf.io,alexschiller/osf.io,caneruguz/osf.io,mluo613/osf.io,felliott/osf.io,adlius/osf.io,aaxelb/osf.io,cslzchen/osf.io,alexschiller/osf.io,pattisdr/osf.io,chennan47/osf.io,leb2dg/osf.io,CenterForOpenScience/osf.io,HalcyonChimera/osf.io,aaxelb/osf.io,aaxelb/osf.i... |
ccbc40f5bfa160a9e41de86fc4845d68da40b8c4 | parse.py | parse.py | import re
import hashlib
import requests
location = "http://www.ieee.org/netstorage/standards/oui.txt"
number_name = re.compile(" *(\w{6}) *\(.*\)[^\w]+(.*)$")
oui_hash = hashlib.sha1()
companies = []
# Get the listing from the source location.
req = requests.get(location)
# Update our hash object with the value fro... | import re
import json
import hashlib
import requests
location = "http://www.ieee.org/netstorage/standards/oui.txt"
oui_id = re.compile(" *(\w{6}) *\(.*\)[^\w]+(.*)$")
request_hash = hashlib.sha1()
organizations = []
# Get the listing from the source location.
request = requests.get(location)
# Update our hash object... | Update variable names, add better comments, convert to JSON. | Update variable names, add better comments, convert to JSON.
| Python | isc | reillysiemens/macdb |
6bd46c60569f8b358eafee568194b797be5020e1 | scent.py | scent.py | from subprocess import call
from sniffer.api import runnable
@runnable
def execute_tests(*args):
fn = ['python', 'manage.py', 'test', '--noinput', '--settings=testsettings']
fn += args[1:]
return call(fn) == 0
| from subprocess import Popen
from sniffer.api import runnable
@runnable
def execute_tests(*args):
fn = ['python', 'manage.py', 'test', '--noinput', '--settings=testsettings']
fn += args[1:]
process = Popen(fn)
try:
return process.wait() == 0
except KeyboardInterrupt:
process.termin... | Kill Nose when ^C in sniffer | Kill Nose when ^C in sniffer
| Python | bsd-3-clause | dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq |
e83ea97a36bfa308359e3377dfd4a14aaf045be4 | shell.py | shell.py | import sys, os, subprocess
def run_shell_command(cmdline, pipe_output=True, **kwargs):
if sys.platform == "win32":
args = cmdline
else:
args = [os.environ.get("SHELL", "/bin/sh")]
process = subprocess.Popen(args,
stdin = subprocess.PIPE if sys.platform != "win32" else None,
... | import sys, os, subprocess
def make_environment(env=None):
if env is None:
env = os.environ
env = env.copy()
env["PYTHONUNBUFFERED"] = "1"
env["PYTHONIOENCODING"] = "UTF-8"
return env
def run_shell_command(cmdline, pipe_output=True, env=None, **kwargs):
if sys.platform == "win32":
... | Disable buffering in Python subprocesses so that output appears immediately, and make sure the output encoding is UTF-8. | Disable buffering in Python subprocesses so that output appears immediately, and make sure the output encoding is UTF-8.
| Python | mit | shaurz/devo |
df32343a60aaf39802953fdfb0270c9e0f5fa477 | reports/views.py | reports/views.py | from django.contrib.auth.decorators import permission_required
from django.core.paginator import Paginator
from django.shortcuts import render, get_object_or_404
from .forms import ReportForm, CopyFormSet
from .models import Report
@permission_required('reports.add_report', login_url='members:login')
def add_report(... | from django.contrib.auth.decorators import permission_required
from django.core.paginator import Paginator
from django.shortcuts import render, get_object_or_404, redirect
from .forms import ReportForm, CopyFormSet
from .models import Report
@permission_required('reports.add_report', login_url='members:login')
def a... | Fix the request.POST, usage of formset and redirect at the end | Fix the request.POST, usage of formset and redirect at the end
| Python | mit | Hackfmi/Diaphanum,Hackfmi/Diaphanum |
e85e9afec6afb038b3188038d6c83341d08c67da | src/service_api/python/cloudi_service_api.py | src/service_api/python/cloudi_service_api.py | #-*-Mode:python;coding:utf-8;tab-width:4;c-basic-offset:4;indent-tabs-mode:()-*-
# ex: set ft=python fenc=utf-8 sts=4 ts=4 sw=4 et nomod:
"""
CloudI Service API <https://cloudi.org/api.html#2_Intro>.
"""
# pylint: disable=wrong-import-position
import sys
import os
_FILE_DIRECTORY = os.path.dirname(os.path.abspath(__fi... | #-*-Mode:python;coding:utf-8;tab-width:4;c-basic-offset:4;indent-tabs-mode:()-*-
# ex: set ft=python fenc=utf-8 sts=4 ts=4 sw=4 et nomod:
"""
CloudI Service API <https://cloudi.org/api.html#2_Intro>.
"""
# pylint: disable=wrong-import-position
import sys
import os
_FILE_DIRECTORY = os.path.dirname(os.path.abspath(__fi... | Fix Python CloudI Service API interface using JSON-RPC. | Fix Python CloudI Service API interface using JSON-RPC.
| Python | mit | CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI,CloudI/CloudI |
94d47cfc6db684beda275f8658660a3bd92b319d | src/syft/grid/client/request_api/user_api.py | src/syft/grid/client/request_api/user_api.py | # stdlib
from typing import Any
from typing import Dict
# third party
from pandas import DataFrame
# syft relative
from ...messages.user_messages import CreateUserMessage
from ...messages.user_messages import DeleteUserMessage
from ...messages.user_messages import GetUserMessage
from ...messages.user_messages import ... | # stdlib
from typing import Any
from typing import Callable
# syft relative
from ...messages.user_messages import CreateUserMessage
from ...messages.user_messages import DeleteUserMessage
from ...messages.user_messages import GetUserMessage
from ...messages.user_messages import GetUsersMessage
from ...messages.user_me... | Update User API - ADD type hints - Remove unused imports | Update User API
- ADD type hints
- Remove unused imports
| Python | apache-2.0 | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft |
2a12a7d2e2d06e64ca076563b8b68454e92fefae | service_fabfile.py | service_fabfile.py | from fabric.api import *
from fabfile import install_requirements
from fabfile import migrate_db
def build(service=None):
"""Perform pre-installation tasks for the service."""
pass
def install(service=None):
"""Perform service specific post-installation tasks."""
install_requirements()
migrate_... | from fabric.api import *
from fabfile import install_requirements
from fabfile import migrate_db
def build(service=None):
"""Perform pre-installation tasks for the service."""
pass
def install(service=None):
"""Perform service specific post-installation tasks."""
install_requirements()
migrate_... | Deploy static files during installation | Deploy static files during installation
| Python | bsd-3-clause | CorbanU/corban-shopify,CorbanU/corban-shopify |
10e307a0dda94a9b38a1b7e143ef141e6062566b | skan/pipe.py | skan/pipe.py | from . import pre, csr
import imageio
import tqdm
import numpy as np
from skimage import morphology
import pandas as pd
def process_images(filenames, image_format, threshold_radius,
smooth_radius, brightness_offset, scale_metadata_path):
image_format = (None if self.image_format.get() == 'auto'... | from . import pre, csr
import imageio
import tqdm
import numpy as np
from skimage import morphology
import pandas as pd
def process_images(filenames, image_format, threshold_radius,
smooth_radius, brightness_offset, scale_metadata_path):
image_format = None if image_format == 'auto' else image_... | Add module for start-to-finish functions | Add module for start-to-finish functions
| Python | bsd-3-clause | jni/skan |
b74399679c739a70dd8e960cf63b4e9bd42bd65b | packager/core/test/test_check_dependencies.py | packager/core/test/test_check_dependencies.py | #! /usr/bin/python
from check_dependencies import CheckDependencies
def test_default():
CheckDependencies(None)
def test_hydrotrend():
CheckDependencies("hydrotrend")
def test_cem():
CheckDependencies("cem")
def test_child():
CheckDependencies("child")
def test_child():
CheckDependencies("sedf... | #! /usr/bin/python
#from check_dependencies import CheckDependencies
#def test_default():
# CheckDependencies(None)
#def test_hydrotrend():
# CheckDependencies("hydrotrend")
#def test_cem():
# CheckDependencies("cem")
#def test_child():
# CheckDependencies("child")
#def test_child():
# CheckDepende... | Disable unit tests for packager.core.check_dependencies.py | Disable unit tests for packager.core.check_dependencies.py
| Python | mit | csdms/packagebuilder |
5d762fba65575b11ccbc15a23852d6b2d18b3f05 | examples/qidle/qidle/utils.py | examples/qidle/qidle/utils.py | # -*- coding: utf-8 -*-
from glob import glob
import os
import platform
def get_interpreters():
if platform.system().lower() == 'linux':
executables = [os.path.join('/usr/bin/', exe)
for exe in ['python2', 'python3']
if os.path.exists(os.path.join('/usr/bin/',... | # -*- coding: utf-8 -*-
from glob import glob
import os
import platform
def get_interpreters():
if platform.system().lower() == 'linux':
executables = [os.path.join('/usr/bin/', exe)
for exe in ['python2', 'python3']
if os.path.exists(os.path.join('/usr/bin/',... | Fix interpreter detection on windows | Fix interpreter detection on windows
| Python | mit | mmolero/pyqode.python,zwadar/pyqode.python,pyQode/pyqode.python,pyQode/pyqode.python |
6abb42998633ebc3f530ebb8fc785255a6f360b3 | auditlog/__manifest__.py | auditlog/__manifest__.py | # -*- coding: utf-8 -*-
# © 2015 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': "Audit Log",
'version': "9.0.1.0.0",
'author': "ABF OSIELL,Odoo Community Association (OCA)",
'license': "AGPL-3",
'website': "http://www.osiell.com",
'categ... | # -*- coding: utf-8 -*-
# © 2015 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': "Audit Log",
'version': "9.0.1.0.0",
'author': "ABF OSIELL,Odoo Community Association (OCA)",
'license': "AGPL-3",
'website': "http://www.osiell.com",
'categ... | Remove pre_init_hook reference from openerp, no pre_init hook exists any more | auditlog: Remove pre_init_hook reference from openerp, no pre_init hook exists any more
| Python | agpl-3.0 | thinkopensolutions/server-tools,ovnicraft/server-tools,ovnicraft/server-tools,thinkopensolutions/server-tools,ovnicraft/server-tools |
969fcfa12bcb734720c3e48c508329b687f91bf6 | Cogs/Message.py | Cogs/Message.py | import asyncio
import discord
import textwrap
from discord.ext import commands
async def say(bot, msg, target, requestor, maxMessage : int = 5, characters : int = 2000):
"""A helper function to get the bot to cut his text into chunks."""
if not bot or not msg or not target:
return False
... | import asyncio
import discord
import textwrap
from discord.ext import commands
async def say(bot, msg, target, requestor, maxMessage : int = 5, characters : int = 2000):
"""A helper function to get the bot to cut his text into chunks."""
if not bot or not msg or not target:
return False
... | Create dm channel if it doesn't exist | Create dm channel if it doesn't exist | Python | mit | corpnewt/CorpBot.py,corpnewt/CorpBot.py |
6c20f8a2c722fca1b2f811d4f06ea5480ec6d945 | telethon/events/messagedeleted.py | telethon/events/messagedeleted.py | from .common import EventBuilder, EventCommon, name_inner_event
from ..tl import types
@name_inner_event
class MessageDeleted(EventBuilder):
"""
Event fired when one or more messages are deleted.
"""
def build(self, update):
if isinstance(update, types.UpdateDeleteMessages):
event ... | from .common import EventBuilder, EventCommon, name_inner_event
from ..tl import types
@name_inner_event
class MessageDeleted(EventBuilder):
"""
Event fired when one or more messages are deleted.
"""
def build(self, update):
if isinstance(update, types.UpdateDeleteMessages):
event ... | Set is private/group=True for messages deleted out of channels | Set is private/group=True for messages deleted out of channels
| Python | mit | LonamiWebs/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon,expectocode/Telethon,LonamiWebs/Telethon |
4c8c287abd0615610ec0571431e142f86a8c76e8 | tests/testapp/models.py | tests/testapp/models.py | from django.db import models
from partial_index import PartialIndex
class AB(models.Model):
a = models.CharField(max_length=50)
b = models.CharField(max_length=50)
class User(models.Model):
name = models.CharField(max_length=50)
class Room(models.Model):
name = models.CharField(max_length=50)
c... | from django.db import models
from partial_index import PartialIndex
class AB(models.Model):
a = models.CharField(max_length=50)
b = models.CharField(max_length=50)
class User(models.Model):
name = models.CharField(max_length=50)
class Room(models.Model):
name = models.CharField(max_length=50)
c... | Add on_delete parameter to ForegnKey fields in testapp Models. on_delete is mandatory from Django 2.0 onwards. | Add on_delete parameter to ForegnKey fields in testapp Models. on_delete is mandatory from Django 2.0 onwards.
| Python | bsd-3-clause | mattiaslinnap/django-partial-index |
30d643a6fed6d056f812db6c826e82e351d23c1d | litmus/cmds/__init__.py | litmus/cmds/__init__.py | #!/usr/bin/env python3
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
#
# 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 requir... | #!/usr/bin/env python3
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
#
# 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 requir... | Add shell=True to make sure that sdb does exist | Add shell=True to make sure that sdb does exist
| Python | apache-2.0 | dhs-shine/litmus |
edb905aec44e3fb2086ae87df960597e7b4c8356 | scoring/machinelearning/neuralnetwork.py | scoring/machinelearning/neuralnetwork.py | ## FIX use ffnet for now, use sklearn in future
from ffnet import ffnet,mlgraph,tmlgraph
import numpy as np
class neuralnetwork:
def __init__(self, shape, loadnet=None, full_conn=True, biases=False):
"""
shape: shape of a NN given as a tuple
"""
if loadnet:
self.model = ... | ## FIX use ffnet for now, use sklearn in future
from ffnet import ffnet,mlgraph,tmlgraph
import numpy as np
from scipy.stats import linregress
class neuralnetwork:
def __init__(self, shape, loadnet=None, full_conn=True, biases=False):
"""
shape: shape of a NN given as a tuple
"""
if... | Add missing methods to NN class | Add missing methods to NN class
| Python | bsd-3-clause | mwojcikowski/opendrugdiscovery |
df18229b38a01d87076f3b13aee5bfd1f0f989c2 | tunobase/blog/models.py | tunobase/blog/models.py | '''
Blog App
This module determines how to display the Blog app in Django's admin
and lists other model functions.
'''
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import models
from tunobase.core import models as core_models
class Blog(core_models.ContentModel):
... | '''
Blog App
This module determines how to display the Blog app in Django's admin
and lists other model functions.
'''
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import models
from tunobase.core import models as core_models
class Blog(core_models.ContentModel):
... | Update blog model with a more descriptive name | Update blog model with a more descriptive name
| Python | bsd-3-clause | unomena/tunobase,unomena/tunobase |
16bdf4d3951c7f88b96bd922b5d4273cd93c4d98 | test_asgi_redis.py | test_asgi_redis.py | from asgi_redis import RedisChannelLayer
from asgiref.conformance import make_tests
channel_layer = RedisChannelLayer(expiry=1)
RedisTests = make_tests(channel_layer, expiry_delay=1.1)
| import unittest
from asgi_redis import RedisChannelLayer
from asgiref.conformance import ConformanceTestCase
# Default conformance tests
class RedisLayerTests(ConformanceTestCase):
channel_layer = RedisChannelLayer(expiry=1, group_expiry=2)
expiry_delay = 1.1
| Update to match new asgiref test style | Update to match new asgiref test style
| Python | bsd-3-clause | django/asgi_redis |
d99ef1ab1dc414294a200d4dafcb0d21c2d3f6d8 | webapp/byceps/blueprints/board/formatting.py | webapp/byceps/blueprints/board/formatting.py | # -*- coding: utf-8 -*-
"""
byceps.blueprints.board.formatting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2014 Jochen Kupperschmidt
"""
import bbcode
def render_html(value):
"""Render text as HTML, interpreting BBcode."""
parser = bbcode.Parser(replace_cosmetic=False)
# Replace image tags.
... | # -*- coding: utf-8 -*-
"""
byceps.blueprints.board.formatting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2014 Jochen Kupperschmidt
"""
import bbcode
def create_parser():
"""Create a customized BBcode parser."""
parser = bbcode.Parser(replace_cosmetic=False)
# Replace image tags.
def rend... | Create and reuse a single BBcode parser instance. | Create and reuse a single BBcode parser instance.
| Python | bsd-3-clause | m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps |
6fec57fde4c67aeaf7622c6b1ee5d56fec2c5b57 | image.py | image.py | """Image."""
from PIL import Image
import os
class DatabaseImage(object):
"""Image from database."""
def __init__(self, path):
"""Construct DatabaseImage."""
self.path = path
self.bmp = Image.open(path)
filename = os.path.basename(path)
self.id = int(filename.split(... | """Image."""
from PIL import Image, ImageFilter
import numpy as np
import os
class DatabaseImage(object):
"""Image from database."""
def __init__(self, path):
"""Construct DatabaseImage."""
self.path = path
self.bmp = Image.open(path)
filename = os.path.basename(path)
... | Add matrix and edge detection | Add matrix and edge detection
| Python | mit | anassinator/codejam,anassinator/codejam-2014 |
1326203c81db0973ff5e1472a2ad80499b6f2189 | main.py | main.py | import csv
import logging
from config.config import Config
from d_spider import DSpider
from dev.logger import logger_setup
def main():
# setup
logger_setup(Config.get('APP_LOG_FILE'), ['ddd_site_parse'])
# log
logger = logging.getLogger('ddd_site_parse')
logger.addHandler(logging.NullHandler())... | import csv
import logging
import os
import time
from config.config import Config
from d_spider import DSpider
from dev.logger import logger_setup
def main():
# setup
logger_setup(Config.get('APP_LOG_FILE'), ['ddd_site_parse'])
# log
logger = logging.getLogger('ddd_site_parse')
logger.addHandler... | Add encoding support, move output to separate directory, change output filename to DD_MM_YYYY.csv | Add encoding support, move output to separate directory, change output filename to DD_MM_YYYY.csv
| Python | mit | Holovin/D_GrabDemo |
adcaa3bd5feb0939a6ffae8ce4637f5fd8369f2d | tests/base_test.py | tests/base_test.py | # -*- coding: utf-8 -*-
"""
test
~~~~
Flask-CORS is a simple extension to Flask allowing you to support cross
origin resource sharing (CORS) using a simple decorator.
:copyright: (c) 2014 by Cory Dolphin.
:license: MIT, see LICENSE for more details.
"""
try:
import unittest2 as unittest
ex... | # -*- coding: utf-8 -*-
"""
test
~~~~
Flask-CORS is a simple extension to Flask allowing you to support cross
origin resource sharing (CORS) using a simple decorator.
:copyright: (c) 2014 by Cory Dolphin.
:license: MIT, see LICENSE for more details.
"""
try:
import unittest2 as unittest
ex... | Improve testing docstring output for inherited classes | Improve testing docstring output for inherited classes
| Python | mit | ashleysommer/sanic-cors,corydolphin/flask-cors |
2693b563a80e6906ace3f97b17e42012404b5cdc | modules/ecrans/tools.py | modules/ecrans/tools.py | "tools for lefigaro backend"
# -*- coding: utf-8 -*-
# Copyright(C) 2011 Julien Hebert
#
# This file is part of weboob.
#
# weboob 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 t... | "tools for lefigaro backend"
# -*- coding: utf-8 -*-
# Copyright(C) 2011 Julien Hebert
#
# This file is part of weboob.
#
# weboob 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 t... | Remove useless function (2O minutes code in ecrans...) | Remove useless function (2O minutes code in ecrans...)
| Python | agpl-3.0 | nojhan/weboob-devel,nojhan/weboob-devel,yannrouillard/weboob,laurent-george/weboob,Konubinix/weboob,frankrousseau/weboob,frankrousseau/weboob,RouxRC/weboob,sputnick-dev/weboob,Boussadia/weboob,willprice/weboob,Konubinix/weboob,Boussadia/weboob,Boussadia/weboob,nojhan/weboob-devel,yannrouillard/weboob,frankrousseau/webo... |
9ec0c5dc170db0f6ffa05c09ea1d0f3e950b76a5 | djstripe/management/commands/djstripe_sync_customers.py | djstripe/management/commands/djstripe_sync_customers.py | from __future__ import unicode_literals
from django.core.management.base import BaseCommand
from ...settings import get_user_model
from ...sync import sync_customer
User = get_user_model()
class Command(BaseCommand):
help = "Sync customer data with stripe"
def handle(self, *args, **options):
qs =... | from __future__ import unicode_literals
from django.core.management.base import BaseCommand
from ...settings import User
from ...sync import sync_customer
class Command(BaseCommand):
help = "Sync customer data with stripe"
def handle(self, *args, **options):
qs = User.objects.exclude(customer__isn... | Make this work with Django 1.4 | Make this work with Django 1.4 | Python | mit | cjrh/dj-stripe,koobs/dj-stripe,tkwon/dj-stripe,aliev/dj-stripe,kavdev/dj-stripe,ctrengove/dj-stripe,StErMi/dj-stripe,kavdev/dj-stripe,mthornhill/dj-stripe,areski/dj-stripe,aliev/dj-stripe,maxmalynowsky/django-stripe-rest,areski/dj-stripe,jleclanche/dj-stripe,rawjam/dj-stripe,koobs/dj-stripe,doctorwidget/dj-stripe,rawja... |
74e240d3e2e397eb8f3b0e63a1666412c3c1c66b | app/__init__.py | app/__init__.py | from flask import Flask
from config import config
def create_app(config_name):
app = Flask(__name__)
app.config.from_object(config[config_name])
from .aflafrettir import aflafrettir as afla_blueprint
app.register_blueprint(afla_blueprint)
return app
| from flask import Flask
from flask.ext.bootstrap import Bootstrap
from config import config
bootstrap = Bootstrap()
def create_app(config_name):
app = Flask(__name__)
app.config.from_object(config[config_name])
bootstrap.init_app(app)
from .aflafrettir import aflafrettir as afla_blueprint
app.register_bl... | Add flask-bootstrap to the mix | Add flask-bootstrap to the mix
| Python | mit | finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is |
e1bc92abaf23002c37b9a8b7e5bf12b175be1a40 | tools/translate.py | tools/translate.py | #!/usr/bin/python
import re
import os
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)
path = '../web/l10n/'
files = [f for f in os.listdir(path) if os.path.isfile(path + f) and f.endswith('.js') and not f.endswith('en.js')]
for f in files:
f = path + f
print 'en -> ' + ... | #!/usr/bin/python
import os
import optparse
import urllib2
import json
import base64
parser = optparse.OptionParser()
parser.add_option("-u", "--user", dest="username", help="transifex user login")
parser.add_option("-p", "--password", dest="password", help="transifex user password")
(options, args) = parser.parse_a... | Use transifex service for tranlation | Use transifex service for tranlation
| Python | apache-2.0 | joseant/traccar-1,vipien/traccar,tananaev/traccar,jon-stumpf/traccar,jon-stumpf/traccar,al3x1s/traccar,AnshulJain1985/Roadcast-Tracker,joseant/traccar-1,AnshulJain1985/Roadcast-Tracker,al3x1s/traccar,tsmgeek/traccar,tsmgeek/traccar,ninioe/traccar,jon-stumpf/traccar,5of9/traccar,tananaev/traccar,orcoliver/traccar,tanana... |
4c12b100531597b2f6356b3512c9adf462122e3d | nova/scheduler/utils.py | nova/scheduler/utils.py | # All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | # All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | Make sure instance_type has extra_specs | Make sure instance_type has extra_specs
Make sure that when scheduling, the instance_type used in filters
contains the 'extra_specs'. This is a bit ugly, but will get cleaned up
with objects.
Fixes bug 1192331
Change-Id: I3614f3a858840c9561b4e618fc30f3d3ae5ac689
| Python | apache-2.0 | n0ano/gantt,n0ano/gantt |
47a41af1201085a7ed4f75a1a1ad27d38a3dba70 | ansible/roles/pico-web/files/start_competition.py | ansible/roles/pico-web/files/start_competition.py | #!/usr/bin/env python3
# Simple script to programmatically start a competition useful for development
# and testing purposes. Defaults to 1 year.
# If using a custom APP_SETTINGS_FILE, ensure the appropriate
# environment variable is set prior to running this script. This script is best
# run from the pico-web role (... | #!/usr/bin/env python3
# Simple script to programmatically start a competition useful for development
# and testing purposes. Defaults to 1 year.
# If using a custom APP_SETTINGS_FILE, ensure the appropriate
# environment variable is set prior to running this script. This script is best
# run from the pico-web role (... | Add a default Global event | Add a default Global event
| Python | mit | royragsdale/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF,picoCTF/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,royragsdale/picoCTF,royragsdale/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF |
412727440beb678ba3beef78ee0b934d412afe64 | examples/permissionsexample/views.py | examples/permissionsexample/views.py | from djangorestframework.views import View
from djangorestframework.permissions import PerUserThrottling, IsAuthenticated
from django.core.urlresolvers import reverse
class PermissionsExampleView(View):
"""
A container view for permissions examples.
"""
def get(self, request):
return [{'name':... | from djangorestframework.views import View
from djangorestframework.permissions import PerUserThrottling, IsAuthenticated
from django.core.urlresolvers import reverse
class PermissionsExampleView(View):
"""
A container view for permissions examples.
"""
def get(self, request):
return [{'name':... | Add an extra explenation on how to use curl on this view. | Add an extra explenation on how to use curl on this view.
| Python | bsd-2-clause | cyberj/django-rest-framework,johnraz/django-rest-framework,dmwyatt/django-rest-framework,ajaali/django-rest-framework,d0ugal/django-rest-framework,adambain-vokal/django-rest-framework,linovia/django-rest-framework,ticosax/django-rest-framework,xiaotangyuan/django-rest-framework,alacritythief/django-rest-framework,akali... |
1bd2bddca6de75f3139f986cb5bb6a76320f192a | axel/cleaner.py | axel/cleaner.py | import datetime
import textwrap
import transmissionrpc
from axel import config
from axel import pb_notify
def clean():
transmission_client = transmissionrpc.Client(
config['transmission']['host'], port=config['transmission']['port']
)
torrents = transmission_client.get_torrents()
now = datet... | import datetime
import textwrap
import transmissionrpc
from axel import config
from axel import pb_notify
def clean():
transmission_client = transmissionrpc.Client(
config['transmission']['host'], port=config['transmission']['port']
)
torrents = transmission_client.get_torrents()
now = datet... | Check stopped torrents when cleaning | Check stopped torrents when cleaning
| Python | mit | craigcabrey/axel |
3ccd8a0f65a4309d1d07f2d8d921348364586542 | util.py | util.py | #http://www.gefeg.com/edifact/d03a/s3/codes/cl1h.htm
state_names = ['Andhra Pradesh', 'Arunachal Pradesh', 'Assam', 'Bihar', 'Chhattisgarh', 'Goa', 'Gujarat', 'Haryana', 'Himachal Pradesh', 'Jamma and Kashmir', 'Jharkhand', 'Karnataka', 'Kerala', 'Madhya Pradesh', 'Maharashtra', 'Manipur', 'Meghalaya', 'Mizoram', 'Naga... | #http://www.gefeg.com/edifact/d03a/s3/codes/cl1h.htm
#This is a terrible method, but it works for now
state_names = ['Andhra Pradesh', 'Arunachal Pradesh', 'Assam', 'Bihar', 'Chhattisgarh', 'Goa', 'Gujarat', 'Haryana', 'Himachal Pradesh', 'Jamma and Kashmir', 'Jharkhand', 'Karnataka', 'Kerala', 'Madhya Pradesh', 'Mahar... | Add list of abbreviations for each state | Add list of abbreviations for each state
This is a horrible design. Just horrible.
| Python | bsd-3-clause | rkawauchi/IHK,rkawauchi/IHK |
db7df35458ac132bb84355df1cf2a5e329ca1d84 | quickphotos/templatetags/quickphotos_tags.py | quickphotos/templatetags/quickphotos_tags.py | from django import template
from quickphotos.models import Photo
register = template.Library()
@register.assignment_tag
def get_latest_photos(user, limit=None):
photos = Photo.objects.filter(user=user)
if limit is not None:
photos = photos[:limit]
return photos
| from django import template
from quickphotos.models import Photo
register = template.Library()
@register.assignment_tag
def get_latest_photos(*args, **kwargs):
limit = kwargs.pop('limit', None)
photos = Photo.objects.all()
if args:
photos = photos.filter(user__in=args)
if limit is not None... | Add support for multiple users photos | Add support for multiple users photos
| Python | bsd-3-clause | blancltd/django-quick-photos,kmlebedev/mezzanine-instagram-quickphotos |
2c2c51d5fa0594aa2d160d28c15895ece358cafe | setup.py | setup.py | #!/usr/bin/env python3
from os import curdir, pardir
from os.path import join
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
name = "VapourSynth",
description = "A frameserver for the 21st century",
url = "http://www.vapoursynth.com... | #!/usr/bin/env python3
from os import curdir, pardir
from os.path import join
from distutils.core import setup
from Cython.Distutils import Extension, build_ext
setup(
name = "VapourSynth",
description = "A frameserver for the 21st century",
url = "http://www.vapoursynth.com/",
download_url = "http://... | Use the Cython Extension class so we can place generated C files in the build dir. | Use the Cython Extension class so we can place generated C files in the build dir.
git-svn-id: ac1113e4705722bd5ee69cef058b32c421e857b8@491 f9120d27-2007-6f97-8312-0f4ebfa7710f
| Python | lgpl-2.1 | Kamekameha/vapoursynth,Kamekameha/vapoursynth,Kamekameha/vapoursynth,vapoursynth/vapoursynth,vapoursynth/vapoursynth,Kamekameha/vapoursynth,vapoursynth/vapoursynth,vapoursynth/vapoursynth |
10be723bf9396c3e513d09ce2a16a3aee0eebe36 | setup.py | setup.py | #!/usr/bin/env python
import os
from distutils.core import setup, Extension, Command
from distutils.command.sdist import sdist
from distutils.command.build_py import build_py
from numpy import get_include as get_numpy_include
numpy_includes = get_numpy_include()
ext_modules = [Extension("reproject._overlap_wrappe... | #!/usr/bin/env python
import os
from distutils.core import setup, Extension, Command
from distutils.command.sdist import sdist
from distutils.command.build_py import build_py
from numpy import get_include as get_numpy_include
numpy_includes = get_numpy_include()
ext_modules = [Extension("reproject._overlap_wrappe... | Make sure the package is built before it is tested | Make sure the package is built before it is tested | Python | bsd-3-clause | barentsen/reproject,mwcraig/reproject,astrofrog/reproject,astrofrog/reproject,bsipocz/reproject,barentsen/reproject,barentsen/reproject,astrofrog/reproject,bsipocz/reproject,mwcraig/reproject |
9fa2cfee9d182eefe918c0303c7966667d9673c9 | tasks.py | tasks.py | from os.path import join
from invoke import Collection
from invocations import docs as _docs, testing
d = 'sites'
# Usage doc/API site (published as docs.paramiko.org)
path = join(d, 'docs')
docs = Collection.from_module(_docs, name='docs', config={
'sphinx.source': path,
'sphinx.target': join(path, '_build... | from os.path import join
from invoke import Collection, task
from invocations import docs as _docs
d = 'sites'
# Usage doc/API site (published as docs.paramiko.org)
path = join(d, 'docs')
docs = Collection.from_module(_docs, name='docs', config={
'sphinx.source': path,
'sphinx.target': join(path, '_build'),... | Replace incorrect import of generic test runner w/ custom task | Replace incorrect import of generic test runner w/ custom task
| Python | lgpl-2.1 | zpzgone/paramiko,CptLemming/paramiko,digitalquacks/paramiko,reaperhulk/paramiko,Automatic/paramiko,selboo/paramiko,jorik041/paramiko,zarr12steven/paramiko,davidbistolas/paramiko,toby82/paramiko,torkil/paramiko,rcorrieri/paramiko,dorianpula/paramiko,thusoy/paramiko,ameily/paramiko,redixin/paramiko,SebastianDeiss/paramik... |
e39f6f310bf9d65e21aa3a923a836c836b6bcd2e | tests.py | tests.py | from unittest import TestCase
from preconditions import PreconditionError, preconditions
class InvalidPreconditionTests (TestCase):
def test_varargs(self):
self.assertRaises(PreconditionError, preconditions, lambda *a: True)
def test_kwargs(self):
self.assertRaises(PreconditionError, precond... | from unittest import TestCase
from preconditions import PreconditionError, preconditions
class InvalidPreconditionTests (TestCase):
def test_varargs(self):
self.assertRaises(PreconditionError, preconditions, lambda *a: True)
def test_kwargs(self):
self.assertRaises(PreconditionError, precond... | Add a basic precondition, and a relational precondition. | Add a basic precondition, and a relational precondition.
| Python | mit | nejucomo/preconditions |
a72a7f95af4e8ac03affe5e33bda0a3d57e29fd6 | examples/connect4/connect4.py | examples/connect4/connect4.py | class Connect4(object):
def __init__(self):
self.pieces = [[] for i in xrange(7)]
self.turn = 0
def move(self, column):
for i in xrange(column, column + 7):
if len(self.pieces[i % 7]) < 6:
self.pieces[i % 7].append(self.turn)
self.turn = 1 - s... | class Connect4(object):
def __init__(self):
self.pieces = [[] for i in xrange(7)]
self.turn = 0
def check(self, column):
vectors = ((1, 0), (1, 1), (0, 1), (-1, 1))
for i in xrange(4):
row = []
for j in xrange(-3, 4):
try:
... | Check for winner after every move | Check for winner after every move
| Python | mit | tysonzero/py-ann |
5691238ca1ce78d2a48619c61402681acef9dc7e | examples/sequencealignment.py | examples/sequencealignment.py | from alignment.sequence import Sequence
from alignment.vocabulary import Vocabulary
from alignment.sequencealigner import SimpleScoring, GlobalSequenceAligner
# Create sequences to be aligned.
a = Sequence("what a beautiful day".split())
b = Sequence("what a disappointingly bad day".split())
print "Sequence A:", a
pr... | from alignment.sequence import Sequence
from alignment.vocabulary import Vocabulary
from alignment.sequencealigner import SimpleScoring, GlobalSequenceAligner
# Create sequences to be aligned.
a = Sequence('what a beautiful day'.split())
b = Sequence('what a disappointingly bad day'.split())
print 'Sequence A:', a
pr... | Update the sequence alignment example. | Update the sequence alignment example.
| Python | bsd-3-clause | eseraygun/python-entities,eseraygun/python-alignment |
8715324d1c466d617fb832841413025b464b7012 | onitu/drivers/dropbox/tests/driver.py | onitu/drivers/dropbox/tests/driver.py | import os
from path import path
from tests.utils.testdriver import TestDriver
from tests.utils.tempdirs import dirs
from onitu.drivers.dropbox.libDropbox import LibDropbox
class Driver(TestDriver):
def __init__(self, *args, **options):
if 'root' not in options:
options['root'] = dirs.create()... | import os
from path import path
from tests.utils.testdriver import TestDriver
from tests.utils.tempdirs import dirs
from onitu.drivers.dropbox.dropboxDriver import dropboxDriver
class Driver(TestDriver):
def __init__(self, *args, **options):
if 'root' not in options:
options['root'] = dirs.cr... | Fix the imports in the tests of dropbox | Fix the imports in the tests of dropbox
| Python | mit | onitu/onitu,onitu/onitu,onitu/onitu |
091a68fef4bc2fcaf87279d36ea3ebec87bac071 | astropy/vo/samp/__init__.py | astropy/vo/samp/__init__.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This subpackage provides classes to communicate with other applications via the
`Simple Application Messaging Protocal (SAMP) <www.ivoa.net/samp>`_.
Before integration into Astropy it was known as
`SAMPy <https://pypi.python.org/pypi/sampy/>`_, and wa... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This subpackage provides classes to communicate with other applications via the
`Simple Application Messaging Protocal (SAMP)
<http://www.ivoa.net/documents/SAMP/>`_.
Before integration into Astropy it was known as
`SAMPy <https://pypi.python.org/pypi... | Correct URL and add http in SAMP docstring | Correct URL and add http in SAMP docstring
| Python | bsd-3-clause | lpsinger/astropy,lpsinger/astropy,stargaser/astropy,larrybradley/astropy,mhvk/astropy,MSeifert04/astropy,larrybradley/astropy,saimn/astropy,pllim/astropy,dhomeier/astropy,astropy/astropy,tbabej/astropy,StuartLittlefair/astropy,dhomeier/astropy,lpsinger/astropy,dhomeier/astropy,joergdietrich/astropy,tbabej/astropy,MSeif... |
b3f206d9b8cbde42ce2def6d8b9d8c1d90abfeeb | pyexperiment/utils/interactive.py | pyexperiment/utils/interactive.py | """Provides helper functions for interactive prompts
Written by Peter Duerr
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from pyexperiment import state
from pyexperiment import conf
def embed_interactive(**k... | """Provides helper functions for interactive prompts
Written by Peter Duerr
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from pyexperiment import state
from pyexperiment import conf
def embed_interactive(**k... | Fix style: not foo in [] => foo not in | Fix style: not foo in [] => foo not in
| Python | mit | duerrp/pyexperiment,kinverarity1/pyexperiment,DeercoderResearch/pyexperiment,shaunstanislaus/pyexperiment,shaunstanislaus/pyexperiment,kinverarity1/pyexperiment,kinverarity1/pyexperiment,duerrp/pyexperiment,DeercoderResearch/pyexperiment,shaunstanislaus/pyexperiment,duerrp/pyexperiment,DeercoderResearch/pyexperiment,De... |
b423d3f0da64a1d6781128653bd6230ac462ad85 | ava/text_to_speech/__init__.py | ava/text_to_speech/__init__.py | import time
import os
from tempfile import NamedTemporaryFile
from sys import platform as _platform
from gtts import gTTS
from pygame import mixer
from .playsound import playsound
from ..components import _BaseComponent
class TextToSpeech(_BaseComponent):
def __init__(self, queues):
super().__init__(q... | import time
import os
from tempfile import NamedTemporaryFile
from sys import platform as _platform
from gtts import gTTS
from pygame import mixer
from .playsound import playsound
from ..components import _BaseComponent
class TextToSpeech(_BaseComponent):
def __init__(self, queues):
super().__init__(q... | Put file created by the gtts on tmp folder | Put file created by the gtts on tmp folder
| Python | mit | ava-project/AVA |
608824b396c75c4c82579133d2291eab5491fab9 | src/odin/fields/future.py | src/odin/fields/future.py | from __future__ import absolute_import
from enum import Enum
from typing import TypeVar, Optional, Any # noqa
from odin.exceptions import ValidationError
from . import Field
__all__ = ("EnumField", )
ET = TypeVar('ET', Enum, Enum)
class EnumField(Field):
"""
Field for handling Python enums.
"""
... | from __future__ import absolute_import
from enum import Enum
from typing import TypeVar, Optional, Any, Type # noqa
from odin.exceptions import ValidationError
from . import Field
__all__ = ("EnumField",)
ET = TypeVar("ET", Enum, Enum)
class EnumField(Field):
"""
Field for handling Python enums.
"""... | Use Type[ET] as enum passed to init is a Type | Use Type[ET] as enum passed to init is a Type
| Python | bsd-3-clause | python-odin/odin |
9bc5ec59224116e2092f0c2e02831c8276360910 | providers/output/terminal.py | providers/output/terminal.py | from __future__ import print_function
import textwrap
from providers.output.provider import OutputProvider
IDENTIFIER = "Terminal"
class Provider(OutputProvider):
def process_data(self, movie_data):
movie_data = filter(lambda data: data.get("filmtipset_my_grade_type", "none") != "seen", movie_data)
... | from __future__ import print_function
import textwrap
from providers.output.provider import OutputProvider
IDENTIFIER = "Terminal"
class Provider(OutputProvider):
def process_data(self, movie_data):
movie_data = filter(lambda data: data.get("filmtipset_my_grade_type", "none") != "seen", movie_data)
... | Sort on imdb rating if filmtipset ratings are the same. | Sort on imdb rating if filmtipset ratings are the same.
| Python | mit | EmilStenstrom/nephele |
53fbfc19090ce9e2447d3811ef5807422b71f426 | indico/modules/events/registration/views.py | indico/modules/events/registration/views.py | # This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | # This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | Include static files specific to regform | Include static files specific to regform
| Python | mit | DirkHoffmann/indico,OmeGak/indico,OmeGak/indico,mvidalgarcia/indico,DirkHoffmann/indico,indico/indico,mvidalgarcia/indico,ThiefMaster/indico,pferreir/indico,mic4ael/indico,DirkHoffmann/indico,pferreir/indico,mic4ael/indico,indico/indico,pferreir/indico,mvidalgarcia/indico,OmeGak/indico,pferreir/indico,mic4ael/indico,Di... |
d239ac7241e61e35f8e9e7ce60a8a8735944028e | app/__init__.py | app/__init__.py | ''' FAB CITY - VISUALIZAR 2016
--------------------------------------------
A web application powered by Flask and d3.js
to generate networks/datavisualisations
------------------------------------------
licence CC : BY - SA
---------------------------------------------
project by :
- FABLAB BARCELONA
... | '''FAB CITY DASHBOARD - VISUALIZAR'16
--------------------------------------------
A dashboard for all the Fab Cities where citizens can understand the existing resilience of cities and how the Maker movement is having an impact on this.
------------------------------------------
license: AGPL 3.0
---------------------... | Update info about the project | Update info about the project
| Python | agpl-3.0 | rubenlorenzo/fab-city-dashboard,rubenlorenzo/fab-city-dashboard,rubenlorenzo/fab-city-dashboard |
44a2678526ee7f5bc897969ade7f00ce72e7e3a6 | setup.py | setup.py | import pelican_bibtex
from distutils.core import setup
CLASSIFIERS = """\
Development Status :: 5 - Production/Stable
Intended Audience :: Science/Research
Intended Audience :: Developers
License :: OSI Approved
Programming Language :: Python
Programming Language :: Python :: 3
Topic :: Software Development
Operating ... | import pelican_bibtex
from distutils.core import setup
CLASSIFIERS = """\
Development Status :: 5 - Production/Stable
Intended Audience :: Science/Research
Intended Audience :: Developers
License :: Public Domain
Programming Language :: Python
Programming Language :: Python :: 3
Topic :: Software Development
Operating... | Fix Markdown bug and correct license information | Fix Markdown bug and correct license information
| Python | unlicense | perror/pelican-bibtex,vene/pelican-bibtex,trovao/pelican-bibtex,anagno/pelican-bibtex |
d45c14c1ee3275212535a98db161a0dbd23ed292 | src/hue/BridgeScanner.py | src/hue/BridgeScanner.py | __author__ = 'hira'
| import requests
import json
def get_bridge_ips():
res = requests.get('http://www.meethue.com/api/nupnp').text
data = json.loads(res)
return [map['internalipaddress'] for map in data]
print(get_bridge_ips())
| Enable finding Hue bridge on network. | Enable finding Hue bridge on network.
| Python | mit | almichest/hue_app,almichest/hue_app |
9678a6cf5cb9431419f4f404ec07fc9d4091cbde | setup.py | setup.py | from setuptools import setup
import sys
setup(
name='bbcode',
version='1.0.5',
description='A pure python bbcode parser and formatter.',
author='Dan Watson',
author_email='dcwatson@gmail.com',
url='https://bitbucket.org/dcwatson/bbcode',
license='BSD',
py_modules=['bbcode'],
classif... | from distutils.core import setup
import sys
setup(
name='bbcode',
version='1.0.5',
description='A pure python bbcode parser and formatter.',
author='Dan Watson',
author_email='dcwatson@gmail.com',
url='https://bitbucket.org/dcwatson/bbcode',
license='BSD',
py_modules=['bbcode'],
cla... | Use distutils to avoid external dependencies | Use distutils to avoid external dependencies
| Python | bsd-2-clause | dcwatson/bbcode |
83928f77fb82da01b9521646ffc6b965f70e1a95 | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(
name='chainer',
version='1.0.0',
description='A flexible framework of neural networks',
author='Seiya Tokui',
author_email='tokui@preferred.jp',
url='http://chainer.org/',
packages=['chainer',
'chainer.cudnn',
... | #!/usr/bin/env python
from distutils.core import setup
setup(
name='chainer',
version='1.0.0',
description='A flexible framework of neural networks',
author='Seiya Tokui',
author_email='tokui@preferred.jp',
url='http://chainer.org/',
packages=['chainer',
'chainer.cudnn',
... | Add cuda.requirements to packages to install | Add cuda.requirements to packages to install
| Python | mit | niboshi/chainer,benob/chainer,jnishi/chainer,jnishi/chainer,muupan/chainer,woodshop/complex-chainer,chainer/chainer,keisuke-umezawa/chainer,wkentaro/chainer,tscohen/chainer,kikusu/chainer,ikasumi/chainer,jnishi/chainer,ktnyt/chainer,cemoody/chainer,ktnyt/chainer,ysekky/chainer,tkerola/chainer,wkentaro/chainer,nushio3/c... |
e848724c65f5ce2434d866543ba9587ac223d56e | premis_event_service/forms.py | premis_event_service/forms.py | from django import forms
import settings
OUTCOME_CHOICES = settings.EVENT_OUTCOME_CHOICES
EVENT_TYPE_CHOICES = settings.EVENT_TYPE_CHOICES
class EventSearchForm(forms.Form):
outcome = forms.ChoiceField(
widget=forms.Select(
attrs={
'id': 'prependedInput',
'cla... | from django import forms
import settings
OUTCOME_CHOICES = settings.EVENT_OUTCOME_CHOICES
EVENT_TYPE_CHOICES = settings.EVENT_TYPE_CHOICES
class EventSearchForm(forms.Form):
outcome = forms.ChoiceField(
widget=forms.Select(
attrs={
'id': 'prependedInput',
'cla... | Make all search form fields optional. | Make all search form fields optional.
| Python | bsd-3-clause | unt-libraries/django-premis-event-service,unt-libraries/django-premis-event-service,unt-libraries/django-premis-event-service |
231edf9e0e6eaf6a0fb82f25173164da53b206b8 | setup.py | setup.py | #!/usr/bin/python
"""Install, build, or test the HXL Proxy.
For details, try
python setup.py -h
"""
import sys, setuptools
if sys.version_info.major != 3:
raise SystemExit("The HXL Proxy requires Python 3.x")
setuptools.setup(
name = 'hxl-proxy',
packages = ['hxl_proxy'],
version = '1.6',
descr... | #!/usr/bin/python
"""Install, build, or test the HXL Proxy.
For details, try
python setup.py -h
"""
import sys, setuptools
if sys.version_info.major != 3:
raise SystemExit("The HXL Proxy requires Python 3.x")
setuptools.setup(
name = 'hxl-proxy',
packages = ['hxl_proxy'],
package_data={'hxl_proxy':... | Include SQL files in the distribution. | Include SQL files in the distribution.
| Python | unlicense | HXLStandard/hxl-proxy,HXLStandard/hxl-proxy,HXLStandard/hxl-proxy,HXLStandard/hxl-proxy |
0de340d41e44bb1057ead9f8d61b47f32732eabb | start.py | start.py | import github
import github_token
import repositories
import tagsparser
import flock
def main():
g = github.Github(github_token.GITHUB_TOKEN)
for repo in repositories.REPOSITORIES:
tags, releases = g.get_tags_and_releases(repo["owner"], repo["name"], repositories.COUNT)
print "Got", tags, rele... | import github
import github_token
import repositories
import tagsparser
import flock
def main():
g = github.Github(github_token.GITHUB_TOKEN)
for repo in repositories.REPOSITORIES:
tags, releases = g.get_tags_and_releases(repo["owner"], repo["name"], repositories.COUNT)
print "Got", [t.version... | Fix version printing of tags and releases | Fix version printing of tags and releases
| Python | mit | ayushgoel/LongShot |
c224fdecf174077f3b7a15f056e65b10282fed38 | tasks.py | tasks.py | from invoke import Collection
from invocations import docs, testing
# TODO: let from_module specify new name
api = Collection.from_module(docs)
# TODO: maybe allow rolling configuration into it too heh
api.configure({
'sphinx.source': 'sites/docs',
'sphinx.target': 'sites/docs/_build',
})
api.name = 'docs'
ma... | from invoke import Collection
from invocations import docs, testing
# Usage doc/API site
api = Collection.from_module(docs, name='docs', config={
'sphinx.source': 'sites/docs',
'sphinx.target': 'sites/docs/_build',
})
# Main/about/changelog site
main = Collection.from_module(docs, name='main', config={
's... | Use new behavior from newer Invoke | Use new behavior from newer Invoke
| Python | lgpl-2.1 | mirrorcoder/paramiko,thisch/paramiko,paramiko/paramiko,remram44/paramiko,zpzgone/paramiko,dlitz/paramiko,Automatic/paramiko,varunarya10/paramiko,ameily/paramiko,mhdaimi/paramiko,redixin/paramiko,rcorrieri/paramiko,thusoy/paramiko,torkil/paramiko,SebastianDeiss/paramiko,zarr12steven/paramiko,dorianpula/paramiko,toby82/p... |
de17439cf237d073236fffd0130c883683f1ba28 | tokens/models.py | tokens/models.py | from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from .conf import PHASES, TOKEN_TYPES
class Token(models.Model):
public_name = models.CharField(max_length=200)
symbol = models.CharField(max_length=4)
decimals = models.IntegerField(
default=18... | from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from .conf import PHASES, TOKEN_TYPES
class Token(models.Model):
public_name = models.CharField(max_length=200)
symbol = models.CharField(max_length=4)
decimals = models.IntegerField(
default=18... | Add class_name property to Token model | Add class_name property to Token model
| Python | apache-2.0 | onyb/ethane,onyb/ethane,onyb/ethane,onyb/ethane |
22186f8ac1033f9e98add968fc983c7281aaf4b5 | scrapy-webscanner/scanner/rules/regexrule.py | scrapy-webscanner/scanner/rules/regexrule.py | # The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"basis,
#... | # The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"basis,
#... | Use DOTALL flag on regex. | Use DOTALL flag on regex.
| Python | mpl-2.0 | os2webscanner/os2webscanner,os2webscanner/os2webscanner,os2webscanner/os2webscanner,os2webscanner/os2webscanner |
e526ebe84159bde0be325ec561cc728ab7c0daee | src/zeit/edit/testing.py | src/zeit/edit/testing.py | # Copyright (c) 2010 gocept gmbh & co. kg
# See also LICENSE.txt
import gocept.lxml.interfaces
import gocept.selenium.ztk
import grokcore.component as grok
import zeit.cms.testing
import zeit.edit.container
import zeit.edit.interfaces
ZCML_LAYER = zeit.cms.testing.ZCMLLayer('ftesting.zcml')
SELENIUM_LAYER = gocept.s... | # Copyright (c) 2010 gocept gmbh & co. kg
# See also LICENSE.txt
import gocept.lxml.interfaces
import gocept.selenium.ztk
import grokcore.component as grok
import zeit.cms.testing
import zeit.edit.container
import zeit.edit.interfaces
ZCML_LAYER = zeit.cms.testing.ZCMLLayer('ftesting.zcml')
SELENIUM_LAYER = gocept.s... | Use vivi-Layer since the editor resides on that | Use vivi-Layer since the editor resides on that
| Python | bsd-3-clause | ZeitOnline/zeit.edit,ZeitOnline/zeit.edit,ZeitOnline/zeit.edit |
13ab83d88739baccbff204d20f9782e0db447cdc | voteswap/urls.py | voteswap/urls.py | """voteswap URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | """voteswap URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | Add logout url, but it redirects to /admin | Add logout url, but it redirects to /admin
| Python | mit | sbuss/voteswap,sbuss/voteswap,sbuss/voteswap,sbuss/voteswap |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.