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 |
|---|---|---|---|---|---|---|---|---|
f81e6ea2410a209a5d598a5d384e51fc447d9668 | update __init__.py | kangasbros/django-bitcoin,readevalprint/django-bitcoin | django_bitcoin/__init__.py | django_bitcoin/__init__.py | from django_bitcoin.models import Payment, getNewBitcoinPayment
from django_bitcoin.models import BitcoinWallet
from django_bitcoin.utils import generateuniquehash, int2base64, base642int, bitcoinprice
| from django_bitcoin.models import BitcoinPayment, getNewBitcoinPayment
from django_bitcoin.models import BitcoinWallet
from django_bitcoin.utils import generateuniquehash, int2base64, base642int, bitcoinprice
| mit | Python |
85ac27150218087217756969275249178cc695e2 | Prepare v2.10.73.dev | LynxyssCZ/Flexget,gazpachoking/Flexget,LynxyssCZ/Flexget,ianstalk/Flexget,jawilson/Flexget,Danfocus/Flexget,ianstalk/Flexget,Flexget/Flexget,malkavi/Flexget,jawilson/Flexget,Flexget/Flexget,Danfocus/Flexget,jawilson/Flexget,tobinjt/Flexget,Danfocus/Flexget,jawilson/Flexget,OmgOhnoes/Flexget,malkavi/Flexget,crawln45/Fle... | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | mit | Python |
316a53249a8da17097e54ffcc4fe983e1106eb85 | enable all plugins and increase duration | missionpinball/mpf,missionpinball/mpf | mpf/tests/MpfMachineTestCase.py | mpf/tests/MpfMachineTestCase.py | from mpf.tests.MpfTestCase import MpfTestCase
class MpfMachineTestCase(MpfTestCase):
def __init__(self, methodName='runTest'):
super().__init__(methodName)
# only disable bcp. everything else should run
self.machine_config_patches = dict()
self.machine_config_patches['bcp'] = []
... | from mpf.tests.MpfTestCase import MpfTestCase
class MpfMachineTestCase(MpfTestCase):
def getConfigFile(self):
return "config.yaml"
def getMachinePath(self):
return ""
def getAbsoluteMachinePath(self):
# do not use path relative to MPF folder
return self.getMachinePath() | mit | Python |
206bc6360709559a18be2bfa69925a804a7b2350 | add progress bar to build_cids.py | robrem/whoserep | build_cids.py | build_cids.py | """
Retrieves the OpenSecrets.org CIDs (Candidate IDs) for every US legislator and
write them to data/cids.txt.
The cids.txt file is used by TweetText to select a random legislator for each
tweet.
"""
import os
import json
from crpapi import CRP
try:
from config import secrets
except ImportError:
secrets = {... | import json
from crpapi import CRP
try:
from config import secrets
except ImportError:
secrets = {
"OPENSECRETS_API_KEY" : os.environ['OPENSECRETS_API_KEY']
}
crp = CRP(secrets['OPENSECRETS_API_KEY'])
states = [
"AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA",
"HI", "ID"... | mit | Python |
ce4f2216fa804f066187023d9950eb9da78461ae | fix PEP8 issue in example | amiryal/XKCD-password-generator,amiryal/XKCD-password-generator | examples/example_json.py | examples/example_json.py | from xkcdpass import xkcd_password as xp
from django.http import JsonResponse
def json_password_generator(request):
# Example Django view to generate passphrase suggestions via xkcd library
# Called with optional params e.g.
# /json_password_generator/?tc=true&separator=|&acrostic=face
if request.met... | from xkcdpass import xkcd_password as xp
from django.http import JsonResponse
def json_password_generator(request):
# Example Django view to generate passphrase suggestions via xkcd library
# Called with optional params e.g.
# /json_password_generator/?tc=true&separator=|&acrostic=face
if request.met... | bsd-3-clause | Python |
0d78ac36f49b8492702a8bc0c49a1508af7f86c2 | Remove explicit app_name | maikhoepfel/djangocms-oscar | djangocms_oscar/cms_app.py | djangocms_oscar/cms_app.py | # -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from django.conf.urls import patterns
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from oscar.app import application
from .menu import CategoriesMenu
class OscarApp(CMSApp):
"""
Allows "mounting" the... | # -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from django.conf.urls import patterns
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from oscar.app import application
from .menu import CategoriesMenu
class OscarApp(CMSApp):
"""
Allows "mounting" the... | mit | Python |
a8b2fddcd910606b6bb18ffe91fccdd2c505f390 | fix satella's import | piotrmaslanka/satella,piotrmaslanka/satella | satella/coding/concurrent/__init__.py | satella/coding/concurrent/__init__.py | from .atomic import AtomicNumber
from .callablegroup import CallableGroup, CallNoOftenThan, CancellableCallback
from .functions import parallel_execute, run_as_future
from .futures import Future, WrappingFuture, InvalidStateError
from .id_allocator import IDAllocator, SequentialIssuer
from .locked_dataset import Locked... | from .atomic import AtomicNumber
from .callablegroup import CallableGroup, CallNoOftenThan, CancellableCallback
from .functions import parallel_execute, run_as_future
from .futures import Future, WrappingFuture, InvalidStateError
from .id_allocator import IDAllocator, SequentialIssuer
from .locked_dataset import Locked... | mit | Python |
7a994fbb091854d4558de3336b4db6a3a6cb4eaf | Update json_field to use stdlib json module | mozilla/nuggets | json_field.py | json_field.py | from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
try:
import json # json module added in Python 2.6.
except ImportError:
from django.utils import simplejson as json
# https://bitbucket.org/offline/django-annoying
class JSONField(models.TextField):
"""
JSONField... | from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.utils import simplejson as json
# https://bitbucket.org/offline/django-annoying
class JSONField(models.TextField):
"""
JSONField is a generic textfield that neatly serializes/unserializes
JSON objects seaml... | bsd-3-clause | Python |
8078371a2fdb71f2f1ea57be2513ef7d78d8117c | fix for unix paths | 159356-1702-Extramural/capstone,159356-1702-Extramural/capstone,159356-1702-Extramural/capstone,159356-1702-Extramural/capstone | tests/seleniumPythonTest/run_all_tests.py | tests/seleniumPythonTest/run_all_tests.py | __author__ = 'QSG'
import unittest
import HTMLTestRunner
import os,sys, time
# Directory for locating test cases
test_dir=os.path.split(os.path.realpath(sys.argv[0]))[0]
test_case_dir= os.path.join(test_dir ,'test_case')
test_reports_dir= os.path.join(test_dir, 'selenium_test_reports')
print test_reports_dir
def creat... | __author__ = 'QSG'
import unittest
import HTMLTestRunner
import os,sys, time
# Directory for locating test cases
test_dir=os.path.split(os.path.realpath(sys.argv[0]))[0]
test_case_dir=test_dir+'\\test_case\\'
test_reports_dir=test_dir+'\\selenium_test_reports\\'
print test_reports_dir
def creatsuite():
testunit=un... | mpl-2.0 | Python |
4eda64c78401cc9fc66e176ff475860e457c3008 | Simplify a method slightly. | gwax/mtg_ssm,gwax/mtgcdb | mtg_ssm/serialization/mtgdict.py | mtg_ssm/serialization/mtgdict.py | """Methods for managing data in the form of dicts."""
from mtg_ssm.mtg import models
def get_printing(coll, card_dict):
"""Given a card dict and various indexes, get the matching CardPrinting."""
mtgjsid = card_dict.get('id')
set_code = card_dict.get('set')
name = card_dict.get('name')
mvid = car... | """Methods for managing data in the form of dicts."""
from mtg_ssm.mtg import models
def get_printing(coll, card_dict):
"""Given a card dict and various indexes, get the matching CardPrinting."""
mtgjsid = card_dict.get('id')
set_code = card_dict.get('set')
name = card_dict.get('name')
mvid = car... | mit | Python |
86b22c351d70ee8a84df5735020949dd02bdfb49 | Include object type only if a number (of objects) is present. | EUDAT-DPMT/eudat.accounting.client | src/eudat/accounting/client/utils.py | src/eudat/accounting/client/utils.py | # utilties module from eudat.accounting.client
# collects methods that could be useful for client code as well
USERKEY = "ACCOUNTING_USER"
PWKEY = "ACCOUNTING_PW"
URL_PATTERN = "%s/%s/%s/addRecord?"
import os
import sys
import requests
from eudat.accounting.client import LOG
def getCredentials(args):
"""Extrac... | # utilties module from eudat.accounting.client
# collects methods that could be useful for client code as well
USERKEY = "ACCOUNTING_USER"
PWKEY = "ACCOUNTING_PW"
URL_PATTERN = "%s/%s/%s/addRecord?"
import os
import sys
import requests
from eudat.accounting.client import LOG
def getCredentials(args):
"""Extrac... | bsd-2-clause | Python |
452452a8cb6f60250b2896fead64a10e41228c15 | change some pring to log | navotsil/Open-Knesset,DanaOshri/Open-Knesset,noamelf/Open-Knesset,ofri/Open-Knesset,daonb/Open-Knesset,habeanf/Open-Knesset,noamelf/Open-Knesset,DanaOshri/Open-Knesset,navotsil/Open-Knesset,otadmor/Open-Knesset,daonb/Open-Knesset,DanaOshri/Open-Knesset,ofri/Open-Knesset,MeirKriheli/Open-Knesset,alonisser/Open-Knesset,S... | src/knesset/mks/listeners.py | src/knesset/mks/listeners.py | #encoding: utf-8
from django.db.models.signals import post_save
from planet.models import Feed, Post
from actstream import action
from knesset.utils import cannonize, disable_for_loaddata
from knesset.laws.models import VoteAction
from knesset.links.models import Link, LinkType
from knesset.mks.models import Member
im... | #encoding: utf-8
from django.db.models.signals import post_save
from planet.models import Feed, Post
from actstream import action
from knesset.utils import cannonize, disable_for_loaddata
from knesset.laws.models import VoteAction
from knesset.links.models import Link, LinkType
from knesset.mks.models import Member
im... | bsd-3-clause | Python |
9f41f4feae76b56235598e4f45c76b4670e7eec8 | Add long description | bright-tools/varints | varints/setup.py | varints/setup.py | #!/usr/bin/python
# Copyright 2017 John Bailey
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | #!/usr/bin/python
# Copyright 2017 John Bailey
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | apache-2.0 | Python |
51d06cc32f5077cca462739204fa89ceebf76a81 | update tests | dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy | tests/test_pecanstreet_dataset_adapter.py | tests/test_pecanstreet_dataset_adapter.py | import sys
sys.path.append('../')
from disaggregator import PecanStreetDatasetAdapter
import unittest
class PecanStreetDatasetAdapterTestCase(unittest.TestCase):
def setUp(self):
db_url = "postgresql://USERNAME:PASSWORD@db.wiki-energy.org:5432/postgres"
self.psda = PecanStreetDatasetAdapter(db_u... | import sys
sys.path.append('../')
from disaggregator import PecanStreetDatasetAdapter
import unittest
class PecanStreetDatasetAdapterTestCase(unittest.TestCase):
def setUp(self):
db_url = "postgresql://USERNAME:PASSWORD@db.wiki-energy.org:5432/postgres"
self.psda = PecanStreetDatasetAdapter(db_u... | mit | Python |
e53491b8135d2edd338b57a6c39285fd4f1ef9ab | Raise an exception when input not real. | cournape/talkbox,cournape/talkbox | scikits/talkbox/tools/correlations.py | scikits/talkbox/tools/correlations.py | import numpy as np
from scipy.fftpack import fft, ifft
__all__ = ['nextpow2', 'acorr']
def nextpow2(n):
"""Return the next power of 2 such as 2^p >= n.
Note
----
Infinite and nan are left untouched, negative values are not allowed."""
if np.any(n < 0):
raise ValueError("n should be > 0")... | import numpy as np
from scipy.fftpack import fft, ifft
__all__ = ['nextpow2', 'acorr']
def nextpow2(n):
"""Return the next power of 2 such as 2^p >= n.
Note
----
Infinite and nan are left untouched, negative values are not allowed."""
if np.any(n < 0):
raise ValueError("n should be > 0")... | mit | Python |
756013fdc63eae95c9a0f510ea27357777114807 | remove dead code | armijnhemel/binaryanalysis | src/bat/piecharts.py | src/bat/piecharts.py | #!/usr/bin/python
## Binary Analysis Tool
## Copyright 2012-2013 Armijn Hemel for Tjaldur Software Governance Solutions
## Licensed under Apache 2.0, see LICENSE file for details
'''
This is a plugin for the Binary Analysis Tool. It generates images of results
of the ranking scan, like piecharts and version charts.
... | #!/usr/bin/python
## Binary Analysis Tool
## Copyright 2012-2013 Armijn Hemel for Tjaldur Software Governance Solutions
## Licensed under Apache 2.0, see LICENSE file for details
'''
This is a plugin for the Binary Analysis Tool. It generates images of results
of the ranking scan, like piecharts and version charts.
... | apache-2.0 | Python |
2b3e1498b6a346be779e0857b24540b958e41073 | Use new API version and fix an error if no price is supplied. | LemonTVnz/lemontv-scrapers | nzfilm.py | nzfilm.py | import json
import util
import urllib
# SHIFT API Documentation
# http://indiereign.github.io/shift72-docs/
DATA_URL = 'https://ondemand.nzfilm.co.nz/services/meta/v4/featured/8'
FILM_DETAILS_TEMPLATE = "https://ondemand.nzfilm.co.nz/services/meta/v2{0}/show_multiple"
PRICE_TEMPLATE = "https://ondemand.nzfilm.co.nz/s... | import json
import util
import urllib
# SHIFT API Documentation
# http://indiereign.github.io/shift72-docs/
DATA_URL = 'https://ondemand.nzfilm.co.nz/services/meta/v3/featured/show/home_page'
FILM_DETAILS_TEMPLATE = "https://ondemand.nzfilm.co.nz/services/meta/v2{0}/show_multiple"
PRICE_TEMPLATE = "https://ondemand.n... | mit | Python |
eb3b82cb356382bb4f48c917e0bf141818f78b90 | Fix test when creating duplicate campaign | wiki-ai/wikilabels,wiki-ai/wikilabels,wiki-ai/wikilabels | wikilabels/tests/utilities/test_new_campaign.py | wikilabels/tests/utilities/test_new_campaign.py | from wikilabels.utilities.new_campaign import main
item = {'wiki': "cawiki", 'name': "newiki", 'form': "chan",
'view': "bivicyt", 'labels_per_task': "1",
'task_per_task': "50", 'active': True,
'info_url':
"--info-url=https://www.mediawiki.org/wiki/ORES#Edit_quality"}
repeated = {'w... | from wikilabels.utilities.new_campaign import main
import pytest
item = {'wiki': "cawiki", 'name': "newiki", 'form': "chan",
'view': "bivicyt", 'labels_per_task': "1",
'task_per_task': "50", 'active': True,
'info_url':
"--info-url=https://www.mediawiki.org/wiki/ORES#Edit_quality"}
... | mit | Python |
2a2c9dc43a7d096dd5601f51c0407c36433e73e1 | Make coordinate 'frames' be imported | kelle/astropy,lpsinger/astropy,dhomeier/astropy,StuartLittlefair/astropy,DougBurke/astropy,astropy/astropy,stargaser/astropy,AustereCuriosity/astropy,lpsinger/astropy,stargaser/astropy,pllim/astropy,astropy/astropy,funbaker/astropy,joergdietrich/astropy,joergdietrich/astropy,kelle/astropy,aleksandr-bakanov/astropy,kell... | astropy/coordinates/__init__.py | astropy/coordinates/__init__.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This subpackage contains classes and functions for celestial coordinates
of astronomical objects. It also contains a framework for conversions
between coordinate systems.
"""
from __future__ import (absolute_import, division, print_function,
... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This subpackage contains classes and functions for celestial coordinates
of astronomical objects. It also contains a framework for conversions
between coordinate systems.
"""
from __future__ import (absolute_import, division, print_function,
... | bsd-3-clause | Python |
3cf81c31cad0ad55b0288aa70b67d03484a626b9 | Remove unused ngram references, add new thresholds for small matches | michaelrup/scancode-toolkit,yashdsaraf/scancode-toolkit,michaelrup/scancode-toolkit,michaelrup/scancode-toolkit,yashdsaraf/scancode-toolkit,marcreyesph/scancode-toolkit,michaelrup/scancode-toolkit,yashdsaraf/scancode-toolkit,michaelrup/scancode-toolkit,yashdsaraf/scancode-toolkit,michaelrup/scancode-toolkit,yashdsaraf/... | src/licensedcode/__init__.py | src/licensedcode/__init__.py | #
# Copyright (c) 2015 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | #
# Copyright (c) 2015 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | apache-2.0 | Python |
11a5c32396d7b97793bd7e1f0bf2baf11f737ef6 | fix localhost bug | quanted/ubertool_ecorest,puruckertom/ubertool_ecorest,puruckertom/ubertool_ecorest,puruckertom/ubertool_ecorest,puruckertom/ubertool_ecorest,quanted/ubertool_ecorest,quanted/ubertool_ecorest,quanted/ubertool_ecorest | celery_cgi.py | celery_cgi.py | from celery import Celery
celery_tasks = [
'hms_flask.modules.hms_controller',
'pram_flask.tasks'
]
# celery = Celery('flask_qed', broker='redis://localhost:6379/0', backend='redis://localhost:6379/0', include=celery_tasks)
celery = Celery('flask_qed', broker='redis://redis:6379/0', backend='redis://redis:63... | from celery import Celery
celery_tasks = [
'hms_flask.modules.hms_controller',
'pram_flask.tasks'
]
celery = Celery('flask_qed', broker='redis://localhost:6379/0', backend='redis://localhost:6379/0', include=celery_tasks)
# celery = Celery('flask_qed', broker='redis://redis:6379/0', backend='redis://redis:63... | unlicense | Python |
1e16e58f37a9e3b98638f66a66830e242aa76b77 | Fix to upload script | vishesh92/redash,ninneko/redash,getredash/redash,useabode/redash,jmvasquez/redashtest,useabode/redash,amino-data/redash,44px/redash,jmvasquez/redashtest,stefanseifert/redash,akariv/redash,44px/redash,moritz9/redash,getredash/redash,imsally/redash,alexanderlz/redash,hudl/redash,pubnative/redash,pubnative/redash,moritz9/... | bin/upload_version.py | bin/upload_version.py | #!python
import os
import sys
import json
import requests
if __name__ == '__main__':
version = sys.argv[1]
filepath = sys.argv[2]
filename = filepath.split('/')[-1]
github_token = os.environ['GITHUB_TOKEN']
auth = (github_token, 'x-oauth-basic')
commit_sha = os.environ['CIRCLE_SHA1']
params = json.dumps... | #!python
import os
import sys
import json
import requests
if __name__ == '__main__':
version = sys.argv[1]
filename = sys.argv[2].split('/')[-1]
github_token = os.environ['GITHUB_TOKEN']
auth = (github_token, 'x-oauth-basic')
commit_sha = os.environ['CIRCLE_SHA1']
params = json.dumps({
'tag_name': 'v{... | bsd-2-clause | Python |
9938b524bb5779d5c5ce132563b3100969c8c5d6 | Drop carreralib.fw --force flag. | tkem/carreralib | src/carreralib/fw.py | src/carreralib/fw.py | import argparse
import contextlib
import logging
import time
from . import ControlUnit
if __name__ == "__main__":
parser = argparse.ArgumentParser(prog="python -m carreralib.fw")
parser.add_argument(
"device",
metavar="DEVICE",
help="the Control Unit device, e.g. a serial port or MAC ... | import argparse
import contextlib
import logging
import time
from . import ControlUnit
if __name__ == "__main__":
parser = argparse.ArgumentParser(prog="python -m carreralib.fw")
parser.add_argument(
"device",
metavar="DEVICE",
help="the Control Unit device, e.g. a serial port or MAC ... | mit | Python |
a00dcd9c8ced0aa7280ed01ff061c32b552eae3c | Update common.py | sony/nnabla,sony/nnabla,sony/nnabla | build-tools/code_generator/utils/common.py | build-tools/code_generator/utils/common.py | # Copyright (c) 2017 Sony Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | # Copyright (c) 2017 Sony Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | apache-2.0 | Python |
a4d5db323910852ad701f9cd9953c3bedb63ae1d | Bump base version (#5842) | DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core,DataDog/integrations-core | vsphere/setup.py | vsphere/setup.py | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from codecs import open
from os import path
from setuptools import setup
HERE = path.abspath(path.dirname(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, "datadog_checks", "vsphere", ... | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from codecs import open
from os import path
from setuptools import setup
HERE = path.abspath(path.dirname(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, "datadog_checks", "vsphere", ... | bsd-3-clause | Python |
626606992854967c569296a35e641198839e5170 | use a model for test that is not influenced by the mail module | OCA/server-tools,OCA/server-tools,YannickB/server-tools,YannickB/server-tools,YannickB/server-tools,OCA/server-tools | auditlog/tests/test_auditlog.py | auditlog/tests/test_auditlog.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | agpl-3.0 | Python |
186e78667f87351a50943691a281c06f9e00b533 | Update background.py | strattadb/dotfiles,strattadb/dotfiles | autostart/scripts/background.py | autostart/scripts/background.py | #!/usr/bin/env python3
"""
Bing's wallpaper of the day background setter
Hits Bing's wallpaper API and compares the wallpaper of the day
with the OS's current one.
If they are the same, the script does nothing.
If they are different, it downloads the new wallpaper and sets it,
then remove the old one.
Usage:
=====... | #!/usr/bin/env python3
"""
Bing's wallpaper of the day background setter
Hits Bing's wallpaper API and compares the wallpaper of the day
with the OS's current one.
If they are the same, the script does nothing.
If they are different, it downloads the new wallpaper and sets it,
then remove the old one.
Usage:
=====... | mit | Python |
2fa9bad60d1ea5e4af2e07b6291083be95834fc5 | fix cyclic depndencies | ufal/neuralmonkey,ufal/neuralmonkey,ufal/neuralmonkey,ufal/neuralmonkey,ufal/neuralmonkey | neuralmonkey/runners/__init__.py | neuralmonkey/runners/__init__.py | from .beamsearch_runner import BeamSearchRunner
from .beamsearch_runner import beam_search_runner_range
from .label_runner import LabelRunner
from .logits_runner import LogitsRunner
from .perplexity_runner import PerplexityRunner
from .plain_runner import PlainRunner
from .regression_runner import RegressionRunner
from... | from .beamsearch_runner import BeamSearchRunner
from .beamsearch_runner import beam_search_runner_range
from .label_runner import LabelRunner
from .logits_runner import LogitsRunner
from .perplexity_runner import PerplexityRunner
from .plain_runner import PlainRunner
from .regression_runner import RegressionRunner
from... | bsd-3-clause | Python |
2a34d8cd07542228b15ed3f9b46fbe491a2c2a2c | fix MinMax | Larhard/backgammon,Larhard/backgammon | backgammon/bots/utils/minmax.py | backgammon/bots/utils/minmax.py | # Copyright (c) 2015, Bartlomiej Puget <larhard@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:
#
# * Redistributions of source code must retain the above copyright notice,
# this... | # Copyright (c) 2015, Bartlomiej Puget <larhard@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:
#
# * Redistributions of source code must retain the above copyright notice,
# this... | bsd-3-clause | Python |
ac6b38351264b6b7b301542793b7a9d164f3d5ec | fix get_global | phil65/script.module.kodi65 | lib/kodi65/addon.py | lib/kodi65/addon.py | # -*- coding: utf8 -*-
# Copyright (C) 2016 - Philipp Temminghoff <phil65@kodi.tv>
# This program is Free Software see LICENSE file for details
import xbmcaddon
import xbmc
import os
import xbmcgui
ADDON = xbmcaddon.Addon()
ID = ADDON.getAddonInfo('id')
ICON = ADDON.getAddonInfo('icon')
NAME = ADDON.getAddonInfo('na... | # -*- coding: utf8 -*-
# Copyright (C) 2016 - Philipp Temminghoff <phil65@kodi.tv>
# This program is Free Software see LICENSE file for details
import xbmcaddon
import xbmc
import os
import xbmcgui
ADDON = xbmcaddon.Addon()
ID = ADDON.getAddonInfo('id')
ICON = ADDON.getAddonInfo('icon')
NAME = ADDON.getAddonInfo('na... | lgpl-2.1 | Python |
662de028b7b521a122b8ce2c6d7d1a4e4b399811 | replace getitem calls with [] | jcrist/blaze,ChinaQuants/blaze,aterrel/blaze,ChinaQuants/blaze,maxalbert/blaze,aterrel/blaze,cpcloud/blaze,mrocklin/blaze,alexmojaki/blaze,dwillmer/blaze,ContinuumIO/blaze,alexmojaki/blaze,caseyclements/blaze,jdmcbr/blaze,jdmcbr/blaze,nkhuyu/blaze,LiaoPan/blaze,cowlicks/blaze,scls19fr/blaze,cowlicks/blaze,caseyclements... | blaze/serve/server.py | blaze/serve/server.py | from __future__ import absolute_import, division, print_function
from collections import Iterator
from flask import Flask, request, jsonify, json
from functools import partial, wraps
from .index import parse_index
class Server(object):
__slots__ = 'app', 'datasets'
def __init__(self, name='Blaze-Server', da... | from __future__ import absolute_import, division, print_function
from collections import Iterator
from flask import Flask, request, jsonify, json
from functools import partial, wraps
from .index import parse_index
class Server(object):
__slots__ = 'app', 'datasets'
def __init__(self, name='Blaze-Server', da... | bsd-3-clause | Python |
d3966eca1aff39640ae8a781d64e4e0525275110 | Add linhomy.candidate and linhomy.cdr_matrices to linhomy.selftest. | jfine2358/py-linhomy | py/linhomy/selftest.py | py/linhomy/selftest.py | '''Run self-test on all modules
Run this as a module and it will perform the self-test.
'''
# For Python2 compatibility
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
if __name__ == '__main__':
import doctest
... | '''Run self-test on all modules
Run this as a module and it will perform the self-test.
'''
# For Python2 compatibility
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
if __name__ == '__main__':
import doctest
... | mit | Python |
505214b9146f31244d60b13a15b86142a11abe4b | add print_duration_context() | aevri/phabricator-tools,bloomberg/phabricator-tools,bloomberg/phabricator-tools,kjedruczyk/phabricator-tools,cs-shadow/phabricator-tools,bloomberg/phabricator-tools,cs-shadow/phabricator-tools,cs-shadow/phabricator-tools,kjedruczyk/phabricator-tools,cs-shadow/phabricator-tools,bloomberg/phabricator-tools,aevri/phabrica... | py/phl/phlsys_timer.py | py/phl/phlsys_timer.py | """Determine the wall clock duration of events."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# phlsys_timer
#
# Public Classes:
# Timer
# .start
# .stop
# .restart
# .duration
#... | """Determine the wall clock duration of events."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# phlsys_timer
#
# Public Classes:
# Timer
# .start
# .stop
# .restart
# .duration
#... | apache-2.0 | Python |
6195a0665ed467f5a86f6e4ee5aab54bd1262ff7 | add data to api requests | SEL-Columbia/pybamboo,SEL-Columbia/pybamboo | pybamboo/connection.py | pybamboo/connection.py | import simplejson as json
import requests
from pybamboo.exceptions import ErrorParsingBambooData,\
ErrorRetrievingBambooData
DEFAULT_BAMBOO_URL = 'http://bamboo.io'
OK_STATUS_CODES = (200, 201, 202)
class Connection(object):
"""
Object that defines a connection to a bamboo instance.
"""
def _... | import simplejson as json
import requests
from pybamboo.exceptions import ErrorParsingBambooData,\
ErrorRetrievingBambooData
DEFAULT_BAMBOO_URL = 'http://bamboo.io'
OK_STATUS_CODES = (200, 201, 202)
class Connection(object):
"""
Object that defines a connection to a bamboo instance.
"""
def _... | bsd-3-clause | Python |
7a99a4d03fb00d25384135fd06c7fa8464c76539 | Fix __init__.py | yagays/pybitflyer | pybitflyer/__init__.py | pybitflyer/__init__.py | # -*- coding: utf-8 -*-
from .pybitflyer import API
| mit | Python | |
e1ec65c9ba1b1c6750df33d6669595a4be27d515 | add test case for prefixes | byteweaver/django-coupons,byteweaver/django-coupons | coupons/tests/test_models.py | coupons/tests/test_models.py | from datetime import timedelta
import re
from django.utils import timezone
from django.test import TestCase
from coupons.models import Coupon
from coupons.settings import (
CODE_LENGTH,
CODE_CHARS,
SEGMENT_LENGTH,
SEGMENT_SEPARATOR,
)
class CouponTestCase(TestCase):
def test_generate_code(self):... | from datetime import timedelta
import re
from django.utils import timezone
from django.test import TestCase
from coupons.models import Coupon
from coupons.settings import (
CODE_LENGTH,
CODE_CHARS,
SEGMENT_LENGTH,
SEGMENT_SEPARATOR,
)
class CouponTestCase(TestCase):
def test_generate_code(self):... | bsd-3-clause | Python |
dbe999de4798a4eed6f96073664715a181a12539 | fix FlaskMixin.handle_user_exception (closes #2) | popravich/cantal_tools | cantal_tools/flask.py | cantal_tools/flask.py | """This module provides Cantal Flask integration.
"""
from werkzeug.exceptions import HTTPException
from .metrics import appflow, web
web.ensure_branches('handle_request', 'handle_exception', 'render_template')
class FlaskMixin:
"""Flask App mixin."""
def wsgi_app(self, environ, start_response):
wi... | """This module provides Cantal Flask integration.
"""
from .metrics import appflow, web
web.ensure_branches('handle_request', 'handle_exception', 'render_template')
class FlaskMixin:
"""Flask App mixin.
Accepts extra keyword-only argument ``metrics``.
"""
def wsgi_app(self, environ, start_response... | mit | Python |
16d50a2b971ddfd4014c89e1bbe8bf52188eb205 | add col | 38elements/feedhoos,38elements/feedhoos,38elements/feedhoos,38elements/feedhoos | feedhoos/worker/admin.py | feedhoos/worker/admin.py | from django.contrib import admin
from feedhoos.worker.models.entry import EntryModel
from feedhoos.finder.models.feed import FeedModel
from feedhoos.reader.models.bookmark import BookmarkModel
class EntryModelAdmin(admin.ModelAdmin):
list_display = ('id', "feed_id", "updated", 'url', 'title')
admin.site.register(... | from django.contrib import admin
from feedhoos.worker.models.entry import EntryModel
from feedhoos.finder.models.feed import FeedModel
from feedhoos.reader.models.bookmark import BookmarkModel
admin.site.register(EntryModel)
admin.site.register(FeedModel)
admin.site.register(BookmarkModel)
| mit | Python |
c1e97f5a2a53f5886be06c43a0bd5e66b6fb76cb | fix import | peterkshultz/lightning-python,peterkshultz/lightning-python,lightning-viz/lightning-python,peterkshultz/lightning-python,garretstuber/lightning-python,garretstuber/lightning-python,lightning-viz/lightning-python,garretstuber/lightning-python | lightning/types/three.py | lightning/types/three.py | from lightning.types.base import Base
from lightning.types.decorators import viztype
from lightning.types.utils import vecs_to_points_three, add_property
from numpy import ndarray, asarray
from lightning.types.utils import array_to_im
@viztype
class Scatter3(Base):
_name = 'scatter3'
@staticmethod
def cl... | from lightning.types.base import Base
from lightning.types.decorators import viztype
from lightning.types.utils import vecs_to_points_three, add_property
@viztype
class Scatter3(Base):
_name = 'scatter3'
@staticmethod
def clean(x, y, z, color=None, label=None, alpha=None, size=None):
"""
... | mit | Python |
ab1028ccd73ea39d14f1eee57b91b303b31e2d63 | Bump version for v0.2.0 release. | pybee/briefcase | briefcase/__init__.py | briefcase/__init__.py | from __future__ import print_function, unicode_literals, absolute_import, division
__all__ = [
'__version__',
]
# Examples of valid version strings
# __version__ = '1.2.3.dev1' # Development release 1
# __version__ = '1.2.3a1' # Alpha Release 1
# __version__ = '1.2.3b1' # Beta Release 1
# __version__ = '... | from __future__ import print_function, unicode_literals, absolute_import, division
__all__ = [
'__version__',
]
# Examples of valid version strings
# __version__ = '1.2.3.dev1' # Development release 1
# __version__ = '1.2.3a1' # Alpha Release 1
# __version__ = '1.2.3b1' # Beta Release 1
# __version__ = '... | bsd-3-clause | Python |
08433e45da17ff74185d3588a0d5a2240e2b40a9 | Fix super call in config. | riga/law,riga/law | law/config.py | law/config.py | # -*- coding: utf-8 -*-
"""
law Config file interface.
"""
__all__ = ["Config"]
import os
try:
# python 3
from configparser import ConfigParser
except ImportError:
# python 2
from ConfigParser import ConfigParser
_no_default = object()
class Parser(ConfigParser):
def optionxform(self, opti... | # -*- coding: utf-8 -*-
"""
law Config file interface.
"""
__all__ = ["Config"]
import os
try:
# python 3
from configparser import ConfigParser
except ImportError:
# python 2
from ConfigParser import ConfigParser
_no_default = object()
class Parser(ConfigParser):
def optionxform(self, opti... | bsd-3-clause | Python |
dbc9b9b1bac2a05f8561be56ff15d528426a4740 | make references readonly in admin (too slow to low otherwise) | sunlightlabs/coleslaw,sunlightlabs/coleslaw,sunlightlabs/coleslaw,sunlightlabs/coleslaw | laws/admin.py | laws/admin.py | from django.contrib import admin
from laws.models import Law
class LawAdmin(admin.ModelAdmin):
list_filter = ["title"]
list_display = ["title", "section", "psection", "num_references", "level", "order", "text", "source"]
readonly_fields = ('references',)
admin.site.register(Law, LawAdmin)
| from django.contrib import admin
from laws.models import Law
class LawAdmin(admin.ModelAdmin):
list_filter = ["title"]
list_display = ["title", "section", "psection", "num_references", "level", "order", "text", "source"]
admin.site.register(Law, LawAdmin)
| bsd-3-clause | Python |
2b2da6988465b335ebc04ff8b955bc5f1c2e84e5 | Enhance crawl command with argv parameters | pyjobs/web,pyjobs/web,pyjobs/web | pyjobs_web/pyjobsweb/commands/crawl.py | pyjobs_web/pyjobsweb/commands/crawl.py | # -*- coding: utf-8 -*-
import os
from pyjobs_crawlers.run import start_crawlers
from crawlers import PyJobsWebConnector
from pyjobsweb.commands import AppContextCommand
class CrawlCommand(AppContextCommand):
def get_parser(self, prog_name):
parser = super(CrawlCommand, self).get_parser(prog_name)
... | # -*- coding: utf-8 -*-
import os
from pyjobs_crawlers.run import start_crawlers
from crawlers import PyJobsWebConnector
from pyjobsweb.commands import AppContextCommand
class CrawlCommand(AppContextCommand):
def take_action(self, parsed_args):
super(CrawlCommand, self).take_action(parsed_args)
... | mit | Python |
ec7e1123a96c0521f5cb4500c49406b9464f6227 | Make migration idempotent | alphagov/backdrop,alphagov/backdrop,alphagov/backdrop | migrations/003_add_capped_collections.py | migrations/003_add_capped_collections.py | """
Add capped collections for real time data
"""
import logging
log = logging.getLogger(__name__)
def up(db):
capped_collections = [
"fco_pay_legalisation_post_realtime",
"fco_pay_legalisation_drop_off_realtime",
"fco_pay_register_birth_abroad_realtime",
"fco_pay_register_death_a... | """
Add capped collections for real time data
"""
import logging
log = logging.getLogger(__name__)
def up(db):
capped_collections = [
"fco_pay_legalisation_post_realtime",
"fco_pay_legalisation_drop_off_realtime",
"fco_pay_register_birth_abroad_realtime",
"fco_pay_register_death_a... | mit | Python |
6b70a5c824d544348503b37edb52ff2e35b2f1ce | Update player.py | triested/logs-search | player.py | player.py | '''
Defines a class Player
Data Members:
data # a dictionary of the high-level log info. contains:
logs
date
id
title
results # number of results (capped at 1000 games)
success # false if retrieval url was formatted bad
Methods:
__init__(self, id64)
load_data(self, id64)
... | '''
Defines a class Player
Data Members:
data # a dictionary of the high-level log info. contains:
logs
date
id
title
results # number of results (capped at 1000 games)
success # false if retrieval url was formatted bad
Methods:
__init__(self, id64)
load_data(self, id64)
... | agpl-3.0 | Python |
87d1b24d8ee806c5aa6cf73d83472b129b0f87fe | Add random GT to a given vcf | sbg/Mitty,sbg/Mitty | mitty/simulation/genome/sampledgenome.py | mitty/simulation/genome/sampledgenome.py | import pysam
from numpy.random import choice
def assign_random_gt(input_vcf, outname, sample_name="HG", default_af=0.01):
vcf_pointer = pysam.VariantFile(filename=input_vcf)
new_header = vcf_pointer.header.copy()
if "GT" not in new_header.formats:
new_header.formats.add("GT", "1", "String", "Conse... | import pysam
from numpy.random import choice
import math
def assign_random_gt(input_vcf, outname, sample_name="HG", default_af=0.01):
vcf_pointer = pysam.VariantFile(filename=input_vcf)
new_header = vcf_pointer.header.copy()
if "GT" not in new_header.formats:
new_header.formats.add("GT", "1", "Str... | apache-2.0 | Python |
4260babfc83f2d9d5ad5a1122885330554fb841d | add pybloom folder | sujitmhj/document_similarity_based_on_bloom_filter,sujitmhj/document_similarity_based_on_bloom_filter,sujitmhj/document_similarity_based_on_bloom_filter,sujitmhj/document_similarity_based_on_bloom_filter | config/wsgi.py | config/wsgi.py | """
WSGI config for document_similarity project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_AP... | """
WSGI config for document_similarity project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_AP... | mit | Python |
45d6622f2f3b2383dd312101c8cd95367396152e | Update transformation command | rsk-mind/rsk-mind-framework | rsk_mind/core/commands.py | rsk_mind/core/commands.py | import argparse, os
def update_engine(setting):
pass
def transformation(setting):
DATASOURCE = setting.DATASOURCE
datasource = DATASOURCE['IN']['class'](*DATASOURCE['IN']['params'])
dataset = datasource.read()
dataset.setTransformer(setting.TRANSFORMER)
dataset.applyTransformations()
... | import argparse, os
def update_engine(setting):
pass
def transformation(setting):
DATASOURCE = setting.DATASOURCE
datasource = DATASOURCE['IN']['class'](*DATASOURCE['IN']['params'])
dataset = datasource.read()
datasource = DATASOURCE['OUT']['class'](*DATASOURCE['OUT']['params'])
datasource... | mit | Python |
09dfa61ce07c64320a545374f02c13c63f4a1600 | Add display of visitor counts to admin | michaelmior/pylinks,michaelmior/pylinks,michaelmior/pylinks | pylinks/links/admin.py | pylinks/links/admin.py | from django.contrib import admin
from pylinks.main.admin import ModelAdmin
from pylinks.links import models
class CategoryAdmin(ModelAdmin):
prepopulated_fields = {
'slug': ('title',)
}
search_fields = ('title',)
admin.site.register(models.Category, CategoryAdmin)
class LinkAdmin(ModelAdmin):
... | from django.contrib import admin
from pylinks.main.admin import ModelAdmin
from pylinks.links import models
class CategoryAdmin(ModelAdmin):
prepopulated_fields = {
'slug': ('title',)
}
search_fields = ('title',)
admin.site.register(models.Category, CategoryAdmin)
class LinkAdmin(ModelAdmin):
... | mit | Python |
1f8b54d22cee5653254514bf07c1b4cb1eb147cb | Remove test item from config grabbing script | weloxux/dotfiles,weloxux/dotfiles | _grabconfig.py | _grabconfig.py | #!/usr/bin/env python2
import os, shutil
files = ["/etc/crontab",
"/usr/local/bin/ssu", "/usr/local/bin/xyzzy",
"/home/dagon/.bashrc","/home/dagon/.i3status.conf", "/home/dagon/.profile", "/home/dagon/.vimrc", "/home/dagon/.i3/config", "/home/dagon/.vim",
"/home/dagon/.config/bless", "/home/... | #!/usr/bin/env python2
import os, shutil
files = ["/etc/crontab",
"/usr/local/bin/ssu", "/usr/local/bin/xyzzy",
"/home/dagon/.bashrc","/home/dagon/.i3status.conf", "/home/dagon/.profile", "/home/dagon/.vimrc", "/home/dagon/.i3/config", "/home/dagon/.vim",
"/home/dagon/.config/bless", "/home/... | unlicense | Python |
de31d92a07d85e83088c04a542b5fdf927a05797 | Remove redundant code | nathanbjenx/cairis,failys/CAIRIS,nathanbjenx/cairis,failys/CAIRIS,nathanbjenx/cairis,nathanbjenx/cairis,failys/CAIRIS | cairis/core/Target.py | cairis/core/Target.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | apache-2.0 | Python |
ee28e56c403389ac5baf1810fced232327931bdd | remove unused import from service command base | genome/flow-core,genome/flow-core,genome/flow-core | flow/commands/service.py | flow/commands/service.py | from flow.commands.base import CommandBase
from injector import inject, Injector
from twisted.internet import defer
import flow.interfaces
import logging
LOG = logging.getLogger(__name__)
@inject(storage=flow.interfaces.IStorage, broker=flow.interfaces.IBroker,
injector=Injector)
class ServiceCommand(Comman... | from flow.commands.base import CommandBase
from flow.configuration.inject.redis_conf import RedisConfiguration
from injector import inject, Injector
from twisted.internet import defer
import flow.interfaces
import logging
LOG = logging.getLogger(__name__)
@inject(storage=flow.interfaces.IStorage, broker=flow.interf... | agpl-3.0 | Python |
7ca2b660a316cc6a52dc111cd738e0b7779a55e5 | set new version number for development | Gustavosdo/django-salmonella,lincolnloop/django-salmonella,lincolnloop/django-salmonella,Gustavosdo/django-salmonella,Gustavosdo/django-salmonella,lincolnloop/django-salmonella,lincolnloop/django-salmonella | salmonella/__init__.py | salmonella/__init__.py | VERSION = (0, 5, 2, "a", "1") # following PEP 386
DEV_N = 1 # for PyPi releases, set this to None
def get_version(short=False):
version = "%s.%s" % (VERSION[0], VERSION[1])
if short:
return version
if VERSION[2]:
version = "%s.%s" % (version, VERSION[2])
if VERSION[3] != "f":
... | VERSION = (0, 5, 1, "f") # following PEP 386
DEV_N = None # for PyPi releases, set this to None
def get_version(short=False):
version = "%s.%s" % (VERSION[0], VERSION[1])
if short:
return version
if VERSION[2]:
version = "%s.%s" % (version, VERSION[2])
if VERSION[3] != "f":
v... | mit | Python |
dd1bcf71c6548f99e6bc133bf890c87440e13535 | Add a running state which can be used to know when a workflow is running. | openstack/taskflow,jessicalucci/TaskManagement,jimbobhickville/taskflow,openstack/taskflow,citrix-openstack-build/taskflow,jimbobhickville/taskflow,junneyang/taskflow,varunarya10/taskflow,pombredanne/taskflow-1,jessicalucci/TaskManagement,citrix-openstack-build/taskflow,junneyang/taskflow,pombredanne/taskflow-1,varunar... | taskflow/states.py | taskflow/states.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! Inc. 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
#
# ... | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ... | apache-2.0 | Python |
5cf39c69994245c0a6d743f06d4d81a05f88b0e5 | Fix flake8 | bulv1ne/django-utils,bulv1ne/django-utils | utils/tests/test_templatetags_markdown.py | utils/tests/test_templatetags_markdown.py | from django.template import Context, Template
from django.test import TestCase
template = '''
{% load md %}
{% markdown %}
# Foo
## Bar
Baz
{% endmarkdown %}
'''
template_html = '''
<h1>Foo</h1>
<h2>Bar</h2>
<p>Baz</p>
'''
class MarkdownTestCase(TestCase):
def test_markdown(self):
html = Template(templ... | from django.template import Context, Template
from django.test import TestCase
template = '''
{% load md %}
{% markdown %}
# Foo
## Bar
Baz
{% endmarkdown %}
'''
template_html = '''
<h1>Foo</h1>
<h2>Bar</h2>
<p>Baz</p>
'''
class MarkdownTestCase(TestCase):
def test_markdown(self):
html = Template(templa... | mit | Python |
545a9a0c5f7a7fac5eb4a1552969301f553d150e | Add some comments. | jdhp-docs/notebooks,jdhp-docs/notebook_skeleton,jdhp-docs/python-notebooks,jdhp-docs/notebooks | clean_ipynb.py | clean_ipynb.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# 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 witho... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# 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 witho... | mit | Python |
cfeca089dd10a6853d2b969d2d248a0f7d506d1a | Handle the weird field names from the new version of the API | e-mission/e-mission-server,sunil07t/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,yw374cornell/e-mission-server,e-mission/e-mission-server,joshzarrabi/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,joshzarrabi/e-mission-server,joshzarrabi/e-mission-server,yw374cornell/e-mis... | emission/net/usercache/formatters/android/motion_activity.py | emission/net/usercache/formatters/android/motion_activity.py | import logging
import emission.core.wrapper.motionactivity as ecwa
import emission.net.usercache.formatters.common as fc
import attrdict as ad
def format(entry):
formatted_entry = ad.AttrDict()
formatted_entry["_id"] = entry["_id"]
formatted_entry.user_id = entry.user_id
metadata = entry.metadata
... | import logging
import emission.core.wrapper.motionactivity as ecwa
import emission.net.usercache.formatters.common as fc
import attrdict as ad
def format(entry):
formatted_entry = ad.AttrDict()
formatted_entry["_id"] = entry["_id"]
formatted_entry.user_id = entry.user_id
metadata = entry.metadata
... | bsd-3-clause | Python |
4a2cb70e08d3762955ca0933f239114481a553b5 | add a python script for checking results | bremond/siconos,fperignon/siconos,radarsat1/siconos,bremond/siconos,siconos/siconos,fperignon/siconos,siconos/siconos,radarsat1/siconos,fperignon/siconos,bremond/siconos,bremond/siconos,radarsat1/siconos,fperignon/siconos,radarsat1/siconos,siconos/siconos,bremond/siconos,fperignon/siconos,siconos/siconos,radarsat1/sico... | examples/Mechanics/Mechanisms/SliderCrank/check_reference.py | examples/Mechanics/Mechanisms/SliderCrank/check_reference.py | import numpy
#results = numpy.loadtxt('simulation_results.dat')
results = []
results_ref = []
with open ("simulation_results.dat", "r") as myfile:
data=myfile.readlines()
#print data[1:]
for i in data[1:]:
data_l_i = i.split('\t')
data_l_i_f = []
#for val in i:
# print ... | import numpy
#results = numpy.loadtxt('simulation_results.dat')
results = []
results_ref = []
with open ("simulation_results.dat", "r") as myfile:
data=myfile.readlines()
#print data[1:]
for i in data[1:]:
data_l_i = i.split('\t')
data_l_i_f = []
#for val in i:
# pr... | apache-2.0 | Python |
f716e8bbf1f20e280d5f973664fd3b4fc91686de | Fix concatentation error on no args to `./mach rustc` | Adenilson/prototype-viewing-distance,AnthonyBroadCrawford/servo,anthgur/servo,ruud-v-a/servo,s142857/servo,echochamber/servo,SimonSapin/servo,jimberlage/servo,mbrubeck/servo,DominoTree/servo,GyrosOfWar/servo,pyecs/servo,rixrix/servo,g-k/servo,steveklabnik/servo,DominoTree/servo,tschneidereit/servo,pyfisch/servo,dhananj... | python/servo/devenv_commands.py | python/servo/devenv_commands.py | from __future__ import print_function, unicode_literals
from os import path
import subprocess
from mach.decorators import (
CommandArgument,
CommandProvider,
Command,
)
from servo.command_base import CommandBase, cd
@CommandProvider
class MachCommands(CommandBase):
@Command('cargo',
de... | from __future__ import print_function, unicode_literals
from os import path
import subprocess
from mach.decorators import (
CommandArgument,
CommandProvider,
Command,
)
from servo.command_base import CommandBase, cd
@CommandProvider
class MachCommands(CommandBase):
@Command('cargo',
de... | mpl-2.0 | Python |
23febe89d3868d91f9869517256b4422fde82dcf | update Merthyr import script for 2017 | DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_merthyr.py | polling_stations/apps/data_collection/management/commands/import_merthyr.py | from data_collection.management.commands import BaseHalaroseCsvImporter
class Command(BaseHalaroseCsvImporter):
council_id = 'W06000024'
addresses_name = 'Merthyr_polling_station_export-2017-04-13.csv'
stations_name = 'Merthyr_polling_station_export-2017-04-13.csv'
elections = ['local.mer... | """
Import Merthyr Tydfil
note: this script takes quite a long time to run
"""
from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseCsvStationsCsvAddressesImporter
from data_finder.helpers import geocode_point_only, PostcodeError
from data_collection.google_geocoding_api_wrappe... | bsd-3-clause | Python |
7628b46141efee1f0a267862d4da04fe020a48d4 | update for Telford & Wrekin | DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_telford.py | polling_stations/apps/data_collection/management/commands/import_telford.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "E06000020"
addresses_name = (
"local.2019-05-02/Version 2/Democracy_Club__02May2019 revised data.tsv"
)
stations_name = (
"local.2019-05-0... | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "E06000020"
addresses_name = "local.2019-05-02/Version 1/Democracy_Club__02May2019Telford.tsv"
stations_name = "local.2019-05-02/Version 1/Democracy_Club__02Ma... | bsd-3-clause | Python |
18beb88e495f53673f6256266c273c6db27cb03a | Remove uneeded check | aaxelb/osf.io,zkraime/osf.io,kch8qx/osf.io,danielneis/osf.io,ZobairAlijan/osf.io,lyndsysimon/osf.io,njantrania/osf.io,jeffreyliu3230/osf.io,wearpants/osf.io,jinluyuan/osf.io,billyhunt/osf.io,erinspace/osf.io,barbour-em/osf.io,chrisseto/osf.io,doublebits/osf.io,sbt9uc/osf.io,bdyetton/prettychart,fabianvf/osf.io,samchris... | framework/render/core.py | framework/render/core.py | # -*- coding: utf-8 -*-
import os
import time
import mfr
from mfr.ext import ALL_HANDLERS
import requests
from website import settings
from framework.render.exceptions import error_message_or_exception
def init_mfr(app):
"""Register all available FileHandlers and collect each
plugin's static assets to the... | # -*- coding: utf-8 -*-
import os
import time
import mfr
from mfr.ext import ALL_HANDLERS
import requests
from website import settings
from framework.render.exceptions import error_message_or_exception
def init_mfr(app):
"""Register all available FileHandlers and collect each
plugin's static assets to the... | apache-2.0 | Python |
b1a06b069232d9347ecf2d74fbe010948e019e4f | Add AD to secrets. | owainkenwayucl/stats-plus-plus,owainkenwayucl/stats-plus-plus,owainkenwayucl/stats-plus-plus,owainkenwayucl/stats-plus-plus | python/auth/secrets.py | python/auth/secrets.py | '''
This class lets us keep the user ids and passwords outside of the git repo.
This is basically a port of the equivalent I added to Bruno's old stats code.
Owain Kenway
'''
class Secrets:
def __init__(self):
import configparser
import os.path
self.filename = os.path.join(os.path.exp... | '''
This class lets us keep the user ids and passwords outside of the git repo.
This is basically a port of the equivalent I added to Bruno's old stats code.
Owain Kenway
'''
class Secrets:
def __init__(self):
import configparser
import os.path
self.filename = os.path.join(os.path.exp... | mit | Python |
5aa3dbf8f520f9ffaaed51ed397eb9f4c722882a | Fix pep8 order import issue | brantlk/python-sample-app | sample_app/__init__.py | sample_app/__init__.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | apache-2.0 | Python |
d2beae040b49babda3cea140c6a1fcefb71668a7 | fix missing key in ci_helper | sdpython/pyquickhelper,sdpython/pyquickhelper,sdpython/pyquickhelper,sdpython/pyquickhelper | src/pyquickhelper/pycode/ci_helper.py | src/pyquickhelper/pycode/ci_helper.py | """
@file
@brief Helpers for CI
.. versionadded:: 1.3
"""
def is_travis_or_appveyor():
"""
tells if is a travis environment or appveyor
@return ``'travis'``, ``'appveyor'`` or ``None``
The function should rely more on environement variables
``CI``, ``TRAVIS``, ``APPVEYOR``.
.. versi... | """
@file
@brief Helpers for CI
.. versionadded:: 1.3
"""
def is_travis_or_appveyor():
"""
tells if is a travis environment or appveyor
@return ``'travis'``, ``'appveyor'`` or ``None``
The function should rely more on environement variables
``CI``, ``TRAVIS``, ``APPVEYOR``.
.. versi... | mit | Python |
efe65f1e89ad8f5c1305084b1526a62595f9e732 | Fix monitoring test | JavaRabbit/CS496_capstone,GoogleCloudPlatform/python-docs-samples,hashems/Mobile-Cloud-Development-Projects,GoogleCloudPlatform/python-docs-samples,hashems/Mobile-Cloud-Development-Projects,canglade/NLP,canglade/NLP,sharbison3/python-docs-samples,canglade/NLP,JavaRabbit/CS496_capstone,sharbison3/python-docs-samples,sha... | monitoring/api/v3/list_resources_test.py | monitoring/api/v3/list_resources_test.py | #!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# di... | #!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# di... | apache-2.0 | Python |
449e79a8e00585c2a1ed595fc2c240151d77a4c0 | Update default-template.py | SNET-Entrance/Entrance-UM,SNET-Entrance/Entrance-UM,SNET-Entrance/Entrance-UM,SNET-Entrance/Entrance-UM | src/config/default-template.py | src/config/default-template.py | from const import basedir
import os
import socket
import re
ATTRIBUTE_AUTHORITY_URL = 'http://localhost:8095'
KEY_EXCHANGE_URL = 'http://localhost:20001'
CONTAINER_EXTENSION = '.media'
ALL_ATTRIBUTE = 'All'
# already registered at the KEX
# used to authenticate UM/CM against KEX
UMCM_CLIENT_ID = 'QlWDSSGCCUFdD9Nupq3... | from const import basedir
import os
import socket
import re
ATTRIBUTE_AUTHORITY_URL = 'http://localhost:8095'
KEY_EXCHANGE_URL = 'http://localhost:20001'
CONTAINER_EXTENSION = '.media'
ALL_ATTRIBUTE = 'All'
# already registered at the KEX
# used to authenticate UM/CM against KEX
UMCM_CLIENT_ID = 'QlWDSSGCCUFdD9Nupq3... | apache-2.0 | Python |
a4de7af5d4b177ac213f315ca45d99fa840fee9a | Handle connection more gracefully | Motoko11/MotoBot | motobot/core_plugins/network_handlers.py | motobot/core_plugins/network_handlers.py | from motobot import hook
from time import sleep
@hook('PING')
def handle_ping(bot, message):
""" Handle the server's pings. """
bot.send('PONG :' + message.params[-1])
@hook('439')
def handle_wait(bot, message):
""" Handles too fast for server message and waits 1 second. """
bot.identified = False
... | from motobot import hook
from time import sleep
@hook('PING')
def handle_ping(bot, message):
""" Handle the server's pings. """
bot.send('PONG :' + message.params[-1])
@hook('439')
def handle_wait(bot, message):
bot.identified = False
sleep(1)
@hook('NOTICE')
def handle_identification(bot, message... | mit | Python |
93fdcbf3358b062c8dbb03508507b49e9a7e9bf5 | fix tests | GoogleCloudPlatform/cloud-foundation-fabric,GoogleCloudPlatform/cloud-foundation-fabric,GoogleCloudPlatform/cloud-foundation-fabric,GoogleCloudPlatform/cloud-foundation-fabric | tests/examples/data_solutions/dp-foundation/test_plan.py | tests/examples/data_solutions/dp-foundation/test_plan.py | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
7be85339a1487697dab56dade362e92d16d0093f | Handle initial connection better | Motoko11/MotoBot | motobot/core_plugins/network_handlers.py | motobot/core_plugins/network_handlers.py | from motobot import hook
from time import sleep
@hook('PING')
def handle_ping(bot, message):
""" Handle the server's pings. """
bot.send('PONG :' + message.params[-1])
@hook('439')
def handle_wait(bot, message):
bot.identified = False
sleep(1)
@hook('NOTICE')
def handle_identification(bot, message... | from motobot import hook
from time import sleep
@hook('PING')
def handle_ping(bot, message):
""" Handle the server's pings. """
bot.send('PONG :' + message.params[-1])
@hook('439')
def handle_notice(bot, message):
""" Use the notice message to identify and register to the server. """
if not bot.iden... | mit | Python |
e4eb1925bff31a2e64d0ce6a55a6da97d2d60b9b | Add participants to button | umbc-hackafe/sign-drivers,umbc-hackafe/sign-drivers,umbc-hackafe/sign-drivers | python/games/button.py | python/games/button.py | import functools
import threading
import websocket
import graphics
import requests
import driver
import game
import json
import sys
import re
def on_message(game, ws, message):
a = json.loads(message)
game.reset_time(a["payload"]["seconds_left"])
game.reset_participants(a["payload"]["participants_text"])
... | import functools
import threading
import websocket
import graphics
import requests
import driver
import game
import json
import sys
import re
def on_message(game, ws, message):
a = json.loads(message)
game.reset_time(a["payload"]["seconds_left"])
class Button(game.Game):
def __init__(self, *args, **kwargs... | mit | Python |
02d6f690552586c002da55c8cec8124e9ec1855c | enable high dpi | ipython/ipython,ipython/ipython | IPython/terminal/pt_inputhooks/qt.py | IPython/terminal/pt_inputhooks/qt.py | import sys
import os
from IPython.external.qt_for_kernel import QtCore, QtGui
# If we create a QApplication, keep a reference to it so that it doesn't get
# garbage collected.
_appref = None
_already_warned = False
def inputhook(context):
global _appref
app = QtCore.QCoreApplication.instance()
if not app... | import sys
import os
from IPython.external.qt_for_kernel import QtCore, QtGui
# If we create a QApplication, keep a reference to it so that it doesn't get
# garbage collected.
_appref = None
_already_warned = False
def inputhook(context):
global _appref
app = QtCore.QCoreApplication.instance()
if not app... | bsd-3-clause | Python |
3e0ac9f0c7b42a8f608b65ac810e469e42be79ee | Add failure cases to integration group tests | fabric/fabric | integration/group.py | integration/group.py | from socket import gaierror
from spec import Spec, eq_, ok_
from fabric import ThreadingGroup as Group
from fabric.exceptions import GroupException
class Group_(Spec):
def simple_command(self):
group = Group('localhost', '127.0.0.1')
result = group.run('echo foo', hide=True)
eq_(
... | from spec import Spec, eq_
from fabric import ThreadingGroup as Group
class Group_(Spec):
def simple_command(self):
group = Group('localhost', '127.0.0.1')
result = group.run('echo foo', hide=True)
eq_(
[x.stdout.strip() for x in result.values()],
['foo', 'foo'],
... | bsd-2-clause | Python |
f7239feb9bef69c1f1cd07ceb066c82bf76fb67e | Abort build if package does not exist | Cal-CS-61A-Staff/ok-client | client/cli/publish.py | client/cli/publish.py | """This module is responsible for publishing OK."""
import argparse
import client
import os
import shutil
import sys
import zipfile
OK_ROOT = os.path.normpath(os.path.dirname(client.__file__))
CONFIG_NAME = 'config.ok'
EXTRA_PACKAGES = ['sanction', 'requests']
def abort(message):
print(message + ' Aborting', fil... | """This module is responsible for publishing OK."""
import argparse
import client
import os
import shutil
import sys
import zipfile
OK_ROOT = os.path.normpath(os.path.dirname(client.__file__))
CONFIG_NAME = 'config.ok'
EXTRA_PACKAGES = ['sanction', 'requests']
def abort(message):
print(message + ' Aborting', fil... | apache-2.0 | Python |
8d34d33286d954a94ab4b3fd7fe5350c5a724c48 | rename yield_execution to coroutine | freevo/kaa-base,freevo/kaa-base | test/async_lock.py | test/async_lock.py | import kaa
@kaa.coroutine(synchronize = True)
def f(x):
print 'in', x
yield kaa.YieldContinue
print 'work1', x
yield kaa.YieldContinue
print 'work2', x
yield kaa.YieldContinue
print 'out', x
f(1)
f(2)
f(3)
kaa.main.run()
| import kaa
@kaa.yield_execution(synchronize = True)
def f(x):
print 'in', x
yield kaa.YieldContinue
print 'work1', x
yield kaa.YieldContinue
print 'work2', x
yield kaa.YieldContinue
print 'out', x
f(1)
f(2)
f(3)
kaa.main.run()
| lgpl-2.1 | Python |
ba355cd70f43bfbec33d807248dfb3be73d6a3bc | change formatting | s0hvaperuna/Not-a-bot | cogs/server.py | cogs/server.py | from bot.bot import command
from cogs.cog import Cog
from discord.ext.commands import cooldown
class Server(Cog):
def __init__(self, bot):
super().__init__(bot)
@command(no_pm=True, pass_context=True)
@cooldown(1, 20)
async def top(self, ctx):
server = ctx.message.server
sort... | from bot.bot import command
from cogs.cog import Cog
from discord.ext.commands import cooldown
class Server(Cog):
def __init__(self, bot):
super().__init__(bot)
@command(no_pm=True, pass_context=True)
@cooldown(1, 20)
async def top(self, ctx):
server = ctx.message.server
sort... | mit | Python |
945cd889c6120d15e71764427217788a978d65ef | Fix env | buildbot/buildbot_travis,tardyp/buildbot_travis,tardyp/buildbot_travis,isotoma/buildbot_travis,buildbot/buildbot_travis,isotoma/buildbot_travis,tardyp/buildbot_travis,tardyp/buildbot_travis,buildbot/buildbot_travis | buildbot_travis/steps/runner.py | buildbot_travis/steps/runner.py | from twisted.internet import defer
from buildbot.process import buildstep
from buildbot.process.buildstep import SUCCESS, FAILURE
from .base import ConfigurableStep
class TravisRunner(ConfigurableStep):
haltOnFailure = True
flunkOnFailure = True
progressMetrics = ConfigurableStep.progressMetrics + ('com... | from twisted.internet import defer
from buildbot.process import buildstep
from buildbot.process.buildstep import SUCCESS, FAILURE
from .base import ConfigurableStep
class TravisRunner(ConfigurableStep):
haltOnFailure = True
flunkOnFailure = True
progressMetrics = ConfigurableStep.progressMetrics + ('com... | unknown | Python |
17d095914b095ccc370922aa9b42aed7d6b473f9 | add player `__repr__` | barraponto/python-pawn,barraponto/python-pawn | src/pawn/player.py | src/pawn/player.py | class Player(object):
def __init__(self, name='John Doe'):
self.name = name
def __repr__(self):
return 'Player(name={name!r})'.format(name=self.name)
| class Player(object):
def __init__(self, name='John Doe'):
self.name = name
| bsd-2-clause | Python |
5bc1f7e4fe5da198a37d5fc3b65357885b3b6697 | update update-hosts.py | wangyangjun/RealtimeStreamBenchmark,wangyangjun/RealtimeStreamBenchmark,wangyangjun/StreamBench,wangyangjun/RealtimeStreamBenchmark,wangyangjun/StreamBench,wangyangjun/RealtimeStreamBenchmark,wangyangjun/RealtimeStreamBenchmark,wangyangjun/StreamBench,wangyangjun/StreamBench,wangyangjun/RealtimeStreamBenchmark,wangyang... | script/update-hosts.py | script/update-hosts.py | #!/bin/python
from __future__ import print_function
import subprocess
import sys
import os
import json
from util import appendline
if __name__ == "__main__":
path = os.path.dirname(os.path.realpath(__file__))
config = json.load(open(path+'/cluster-config.json'));
for node in config['nodes']:
appendline('/etc/host... | #!/bin/python
from __future__ import print_function
import subprocess
import sys
import os
import json
from util import appendline
if __name__ == "__main__":
path = os.path.dirname(os.path.realpath(__file__))
config = json.load(open(path+'/cluster-config.json'));
for node in config['nodes']:
appendline('/etc/host... | apache-2.0 | Python |
dfb9384355ebfad21de28719eabb740f511a748b | Move to boto3 | century-arcade/xd,century-arcade/xd,century-arcade/xd,century-arcade/xd | scripts/49-cat-logs.py | scripts/49-cat-logs.py | #!/usr/bin/env python3
# Usage:
# $0 -o log.txt products/
#
# concatenates .log files (even those in subdirs or .zip) and combines into a single combined.log
from xdfile.utils import find_files_with_time, open_output, get_args
import boto3
# from boto.s3.connection import S3Connection
import os
def main():
a... | #!/usr/bin/env python3
# Usage:
# $0 -o log.txt products/
#
# concatenates .log files (even those in subdirs or .zip) and combines into a single combined.log
from xdfile.utils import find_files_with_time, open_output, get_args
from boto.s3.connection import S3Connection
import os
def main():
args = get_args(... | mit | Python |
8dcd64c347a47c55b22997990271468976a2d896 | Update comment | ECP-CANDLE/Database,ECP-CANDLE/Database | plots/json2loss.py | plots/json2loss.py |
# JSON TO LOSS
# NOTE: Run this with './json2table loss' (shell script wrapper)
# Converts a directory of runs into a simple loss over time table
# The output file format for each line is
# timestamp load
# where the timestamp is floating point Unix hours
# relative to first event
# and the loss is the validation ... |
# JSON TO LOSS
# NOTE: Run this with './json2table loss' (shell script wrapper)
# Converts a directory of runs into a simple loss over time table
# The output file format for each line is
# timestamp load
# where the timestamp is floating point Unix hours
# relative to first event
# and the loss is the validation ... | mit | Python |
37984a616fcd05f159c52d70e658a1268e4f5904 | Update expressions.py | ratnania/pyccel,ratnania/pyccel | scripts/expressions.py | scripts/expressions.py | # coding: utf-8
1
+1
-1
a + 2
3*a + 1
3*(4+a) + 1
3/(4+a) + 1
1.
+1.
-1.
a + 2.
3.*a + 1.
3.*(4.+a) + 1.
3./(4.+a) + 1.
True
False
not a
a and b
a or b
a == b
a != b
a < b
a > b
a <= b
a >= b
| # ... integers
1
+1
-1
a + 2
3*a + 1
3*(4+a) + 1
3/(4+a) + 1
# ...
# ... floats
1.
+1.
-1.
a + 2.
3.*a + 1.
3.*(4.+a) + 1.
3./(4.+a) + 1.
# ...
# ... booleans
True
False
not a
a and b
a or b
# ...
# ... relationals
a == b
a != b
a < b
a > b
a <= b
a >= b
# ...
| mit | Python |
8ce7a90218788174234176113defb602c9ebb87d | Format compose file | zero323/spark-in-a-box | sparkinabox/compose/__init__.py | sparkinabox/compose/__init__.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import yaml
def _image(context, role):
return "{0}/{1}-{2}".format(context["DOCKER_PREFIX"], context["DOCKER_NAME"], role)
def _interactive(context):
return context["CLIENT_ENTRYPOINT"] != "spar... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import yaml
def _image(context, role):
return "{0}/{1}-{2}".format(context["DOCKER_PREFIX"], context["DOCKER_NAME"], role)
def _interactive(context):
return context["CLIENT_ENTRYPOINT"] != "spar... | mit | Python |
01ebc8fe45dbcbfd665a586c6a3f2aa56ea35f9c | add a test to demonstrate recursive behavior | alfredodeza/merfi | merfi/tests/test_repocollector.py | merfi/tests/test_repocollector.py | from merfi.collector import RepoCollector
from os.path import join, dirname
class TestRepoCollector(object):
def setup(self):
self.paths = RepoCollector(path='/', _eager=False)
def test_simple_tree(self, repotree):
paths = RepoCollector(path=repotree)
# The root of the repotree fixtu... | from merfi.collector import RepoCollector
from os.path import join
class TestRepoCollector(object):
def setup(self):
self.paths = RepoCollector(path='/', _eager=False)
def test_simple_tree(self, repotree):
paths = RepoCollector(path=repotree)
# The root of the repotree fixture is its... | mit | Python |
977a13ec9078aacba2156a74c1adce2f32fd00a6 | Remove auto doc string. | access-missouri/am-django-project,access-missouri/am-django-project,access-missouri/am-django-project,access-missouri/am-django-project | am/am/urls.py | am/am/urls.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
am URL Configuration.
"""
from django.conf.urls import url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
]
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
am URL Configuration.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: u... | bsd-2-clause | Python |
d825b11868c37877660149ebc4b21d7429d6eaf0 | remove unnecessary python2 fallback | cigroup-ol/metaopt,cigroup-ol/metaopt,cigroup-ol/metaopt | metaopt/core/arg/util/modifier.py | metaopt/core/arg/util/modifier.py | # Future
from __future__ import absolute_import, division, print_function, \
unicode_literals, with_statement
class ArgsModifier(object):
'''
Modifies args in useful ways.
This module provides ways to modify given args. Specifically, args can be
combined to each other and randomized with a certai... | # Future
from __future__ import absolute_import, division, print_function, \
unicode_literals, with_statement
# Standard Library
import sys
if sys.version_info[0] == 2:
# python 3 has an iterative zip built in
from itertools import izip as zip
class ArgsModifier(object):
'''
Modifies args in us... | bsd-3-clause | Python |
c17e0f804a446ed0135730045ca96954c8967a48 | Bump version to 0.5.3 | botify-labs/simpleflow,botify-labs/simpleflow | simpleflow/__init__.py | simpleflow/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.5.3'
__author__ = 'Greg Leclercq'
__license__ = "MIT"
from .activity import Activity
from .workflow import Workflow
| # -*- coding: utf-8 -*-
__version__ = '0.5.2'
__author__ = 'Greg Leclercq'
__license__ = "MIT"
from .activity import Activity
from .workflow import Workflow
| mit | Python |
4146551d191152ae486f079911f53086f3a60a07 | Rename version field in Choice to question | holycattle/pysqueak-api,holycattle/pysqueak-api | api/models.py | api/models.py | from django.db import models
from rest_framework import serializers
class Question(models.Model):
version = models.CharField(primary_key=True, max_length=8)
text = models.TextField()
created_on = models.DateTimeField(auto_now_add=True)
updated_on = models.DateTimeField(auto_now=True)
class Choice(mode... | from django.db import models
from rest_framework import serializers
class Question(models.Model):
version = models.CharField(primary_key=True, max_length=8)
text = models.TextField()
created_on = models.DateTimeField(auto_now_add=True)
updated_on = models.DateTimeField(auto_now=True)
class Choice(mode... | mit | Python |
b9d54da73e5c4d859aa5ad8e9d8b96bb7527ae6d | Add position table and add field mid in box tables | g82411/s_square | api/models.py | api/models.py | from django.db import models
# Create your models here.
class User(models.Model):
uid = models.AutoField(primary_key=True)
uname = models.CharField(max_length=128)
session = models.CharField(max_length=35,unique=True)
class Box(models.Model):
bid = models.AutoField(primary_key=True)
level = models... | from django.db import models
# Create your models here.
class User(models.Model):
uid = models.AutoField(primary_key=True)
uname = models.CharField(max_length=128)
session = models.CharField(max_length=35,unique=True)
class Box(models.Model):
bid = models.AutoField(primary_key=True)
level = models... | apache-2.0 | Python |
5822fd465c69834774dabdc6d417e9712136f0d6 | Use count as option | dgengtek/scripts,dgengtek/scripts | admin/pwgen.py | admin/pwgen.py | #!/bin/env python3
# generate passwords
# TODO: generate passwords first then build aligned output table format
import sys
import random
import click
import string
@click.command("pwgen.py")
@click.argument("length", default=16)
@click.option("character_filter", "-f","--filter", help="Filter characters from the give... | #!/bin/env python3
# generate passwords
# TODO: generate passwords first then build aligned output table format
import sys
import random
import click
import string
@click.command("pwgen.py")
@click.argument("count", default=30)
@click.argument("length", default=12)
@click.option("character_filter", "-f","--filter", ... | mit | Python |
d1655e583c5012e09269a300d9d49bcab7266119 | Create prueba.py | aescoda/TFG | prueba.py | prueba.py | from flask import Flask
from flask import request
import os
import xml.etree.ElementTree as ET
from threading import Thread
import email_lib
app = Flask(__name__)
xml = ""
def send_email(xml):
print "2"
email_lib.prueba()
print xml
return None
@app.route('/webhook', methods=['POST','GET'])
def... | from flask import Flask
from flask import request
import os
import xml.etree.ElementTree as ET
from threading import Thread
import email_lib
app = Flask(__name__)
global xml = ""
def send_email(xml):
print "2"
email_lib.prueba()
print xml
return None
@app.route('/webhook', methods=['POST','GE... | apache-2.0 | Python |
e7cef2f5ab71f1841a1649f8838a48f5ba2130ae | Create prueba.py | aescoda/TFG | prueba.py | prueba.py | from flask import Flask
from flask import request
import os
import xml.etree.ElementTree as ET
from threading import Thread
import email_lib
app = Flask(__name__)
xml = None
def send_email(xml):
print "2"
email_lib.prueba()
print xml
return None
@app.route('/webhook', methods=['POST','GET'])... | from flask import Flask
from flask import request
import os
import xml.etree.ElementTree as ET
from threading import Thread
import email_lib
app = Flask(__name__)
xml =""
def send_email(xml):
print "2"
email_lib.prueba()
print xml
return None
@app.route('/webhook', methods=['POST','GET'])
de... | apache-2.0 | Python |
857d660f8908128aa320a6f303f34bced224c651 | Switch to python3 | jcommelin/vimnb,jcommelin/vimnb | pywrap.py | pywrap.py | #!/usr/bin/python3
import sys, time, traceback, pprint
sys.stdout.close()
while True:
line = sys.stdin.readline()
if line:
i = open(line[:-1] + ".in", "r")
sys.stdout = open(line[:-1] + ".out", "w")
try:
for l in i:
exec(l)
except:
traceb... | #!/usr/bin/python
import sys, time, traceback, pprint
sys.stdout.close()
while True:
line = sys.stdin.readline()
if line:
i = open(line[:-1] + ".in", "r")
sys.stdout = open(line[:-1] + ".out", "w")
try:
for l in i:
exec(l)
except:
traceba... | unlicense | Python |
ecf68c5d095a4f85856e012409e8dde4567376e2 | Fix negative values | kyleconroy/popfly | reaper.py | reaper.py | #!/usr/bin/env python
import boto
import base64
import json
from datetime import datetime
def seconds_from_hours(hours):
return hours * 60 * 60
def should_kill(instance):
attributes = instance.get_attribute("userData")
if attributes['userData'] == None:
print "Instance has no userdata"
... | #!/usr/bin/env python
import boto
import base64
import json
from datetime import datetime
def seconds_from_hours(hours):
return hours * 60 * 60
def should_kill(instance):
attributes = instance.get_attribute("userData")
if attributes['userData'] == None:
print "Instance has no userdata"
... | mit | Python |
9c4f927f9565fc158dea8a7840842839b986ca64 | Improve rest api | njbbaer/unicorn-remote,njbbaer/unicorn-remote,njbbaer/unicorn-remote | remote.py | remote.py | from flask import Flask, render_template, request
from flask_restful import Resource, Api
import unicornhat as unicorn
import argparse
import json
import subprocess
import sys
app = Flask(__name__)
api = Api(app)
class State:
''' Handle Unicorn HAT state'''
def __init__(self, brightness, program_name):
... | from flask import Flask, render_template, request
from flask_restful import Resource, Api
import unicornhat as unicorn
import argparse
import json
import subprocess
import sys
app = Flask(__name__)
api = Api(app)
class State:
''' Handle Unicorn HAT state'''
def __init__(self, brightness, program_name):
... | mit | Python |
97140ae5183c82c0da7817d09e6aaa5d3c74cb4a | Fix indentation in routes | AlexMathew/csipy-home | routes.py | routes.py | from flask import Flask, render_template, redirect, request
import psycopg2
from functools import wraps
import os
import urlparse
app = Flask(__name__)
def connectDB(wrapped):
@wraps(wrapped)
def inner(*args, **kwargs):
urlparse.uses_netloc.append("postgres")
url = urlparse.urlparse(os.envir... | from flask import Flask, render_template, redirect, request
import psycopg2
from functools import wraps
import os
import urlparse
app = Flask(__name__)
def connectDB(wrapped):
@wraps(wrapped)
def inner(*args, **kwargs):
urlparse.uses_netloc.append("postgres")
url = urlparse.urlparse(os.envir... | mit | Python |
6517f260eece4dd828dde5f74109b42b7e91e4bb | sort is realizing anyway | nathants/py-util,nathants/s | s/iter.py | s/iter.py | import itertools
import six
def groupby(val, key):
val = sorted(val, key=key)
return [(k, list(v)) for k, v in itertools.groupby(val, key=key)]
def nwise(val, n):
return six.moves.zip(*(itertools.islice(val, i, None) for i, val in enumerate(itertools.tee(val, n))))
def chunk(val, n, drop_extra=False):... | import itertools
import six
def groupby(val, key, realize=True):
val = sorted(val, key=key)
if realize:
return [(k, list(v)) for k, v in itertools.groupby(val, key=key)]
else:
return itertools.groupby(val, key=key)
def nwise(val, n):
return six.moves.zip(*(itertools.islice(val, i, No... | mit | Python |
dc3a848998567ddfe15df5a6ee3aaa50e2d6b9ce | Add samples | aidiary/python-recaius | sample.py | sample.py | # -*- coding: utf-8 -*-
from recaius.RecaiusTTS import RecaiusTTS
# 登録時に発行された自分のIDとパスワードを設定
rec = RecaiusTTS('YOUR_ID', 'YOUR_PASSWORD')
# デフォルトの話者はsakura
rec.speak('あらゆる現実をすべて自分のほうへねじ曲げたのだ。')
rec.speaker('moe').speak('嬉しいはずがゆっくり寝てもいられない。')
rec.speaker('hiroto').speak('テレビゲームやパソコンでゲームをして遊ぶ。')
rec.speaker('itaru').spe... | mit | Python | |
c39ed35ce4c21c6a7341ff81ab8cf186692c1845 | Read Guardian API key from positional argument. | mattpatey/news-to-epub | scrape.py | scrape.py | #!/usr/bin/env python
import argparse
from datetime import datetime
from json import loads
from bs4 import BeautifulSoup
from ebooklib import epub
import requests
def get_todays_news(api_key):
payload = {'api-key': api_key,
'section': 'world',
'from-date': '2015-03-22'}
r = re... | #!/usr/bin/env python
from datetime import datetime
from json import loads
from bs4 import BeautifulSoup
from ebooklib import epub
import requests
def get_todays_news():
api_key = ''
payload = {'api-key': api_key,
'section': 'world',
'from-date': '2015-03-22'}
r = requests... | mit | Python |
5d51479eaf6b03d6b86faa4fe4ac79dda609f44d | Add code to clean_code function to clean quotes and emoticons. | LWprogramming/Hack-Brown2017,liuisaiah/Hack-Brown2017 | script.py | script.py | '''
Dataset source: https://nlds.soe.ucsc.edu/sarcasm2
By Shereen Oraby, Vrindavan Harrison, Lena Reed, Ernesto Hernandez, Ellen Riloff and Marilyn Walker. "Creating and Characterizing a Diverse Corpus of Sarcasm in Dialogue." In The 17th Annual SIGdial Meeting on Discourse and Dialogue (SIGDIAL), Los Angeles, Califor... | '''
Dataset source: https://nlds.soe.ucsc.edu/sarcasm2
By Shereen Oraby, Vrindavan Harrison, Lena Reed, Ernesto Hernandez, Ellen Riloff and Marilyn Walker. "Creating and Characterizing a Diverse Corpus of Sarcasm in Dialogue." In The 17th Annual SIGdial Meeting on Discourse and Dialogue (SIGDIAL), Los Angeles, Califor... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.