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 |
|---|---|---|---|---|---|---|---|---|
35cbc1eb4527a7d7e9183ba5f6e86357a6aef828 | change format | DennyZhang/devops_public,DennyZhang/devops_public,DennyZhang/devops_public,DennyZhang/devops_public | python/parse_haproxy_stats/haproxy_stats_metric.py | python/parse_haproxy_stats/haproxy_stats_metric.py | # -*- coding: utf-8 -*-
#!/usr/bin/python
##-------------------------------------------------------------------
## @copyright 2016 DennyZhang.com
## Licensed under MIT
## https://raw.githubusercontent.com/DennyZhang/devops_public/master/LICENSE
##
## File : haproxy_stats_metric.py
## Author : Denny <denny@dennyzhang... | # -*- coding: utf-8 -*-
#!/usr/bin/python
##-------------------------------------------------------------------
## @copyright 2016 DennyZhang.com
## Licensed under MIT
## https://raw.githubusercontent.com/DennyZhang/devops_public/master/LICENSE
##
## File : haproxy_stats_metric.py
## Author : Denny <denny@dennyzhang... | mit | Python |
81ce3e0f63a3a026d2172022726d61e337e556a0 | create a random 100x5 matrix | mbdebian/ml-playground | real_world_machine_learning/playground/chapter4.py | real_world_machine_learning/playground/chapter4.py | #
# Author : Manuel Bernal Llinares
# Project : ml-playground
# Timestamp : 26-10-2017 9:50
# ---
# © 2017 Manuel Bernal Llinares <mbdebian@gmail.com>
# All rights reserved.
#
"""
Scratchpad / playground for the 4th chapter on the book
"""
import time
import pylab
import random
# Seed pseudo-random number gen... | #
# Author : Manuel Bernal Llinares
# Project : ml-playground
# Timestamp : 26-10-2017 9:50
# ---
# © 2017 Manuel Bernal Llinares <mbdebian@gmail.com>
# All rights reserved.
#
"""
Scratchpad / playground for the 4th chapter on the book
"""
import time
import pylab
import random
# Seed pseudo-random number gen... | apache-2.0 | Python |
2145c7e6effad2eda8730ba8d738aa61cbbdd3e4 | Add func to build scipy tarball. | scipy/scipy-svn,lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt,scipy/scipy-svn,scipy/scipy-svn,lesserwhirls/scipy-cwt,lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor,scipy/scipy-svn,jasonmccampbell/scipy-refactor | tools/win32/build_scripts/prepare_bootstrap.py | tools/win32/build_scripts/prepare_bootstrap.py | import os
import subprocess
from os.path import join as pjoin, split as psplit, dirname, exists as pexists
import re
def build_sdist(chdir):
cwd = os.getcwd()
try:
os.chdir(chdir)
cmd = ["python", "setup.py", "sdist", "--format=zip"]
subprocess.call(cmd)
except Exception, e:
... | import os
import subprocess
from os.path import join as pjoin, split as psplit, dirname, exists as pexists
import re
def get_svn_version(chdir):
out = subprocess.Popen(['svn', 'info'],
stdout = subprocess.PIPE, cwd = chdir).communicate()[0]
r = re.compile('Revision: ([0-9]+)')
s... | bsd-3-clause | Python |
c9c2abe8c09a508a87d43f5f641d5fda9b4c72d1 | Test a change. | nzlosh/st2,Plexxi/st2,StackStorm/st2,nzlosh/st2,nzlosh/st2,Plexxi/st2,Plexxi/st2,Plexxi/st2,StackStorm/st2,StackStorm/st2,nzlosh/st2,StackStorm/st2 | st2tests/st2tests/fixtures/localrunner_pack/actions/text_gen.py | st2tests/st2tests/fixtures/localrunner_pack/actions/text_gen.py | #!/usr/bin/env python
from __future__ import absolute_import
import argparse
import string
try:
from string import letters as ascii_letters
except ImportError:
from string import ascii_letters
import random
def print_random_chars(chars=1000, selection=ascii_letters + string.digits):
s = []
for _ i... | #! /usr/bin/python
from __future__ import absolute_import
import argparse
import string
try:
from string import letters as ascii_letters
except ImportError:
from string import ascii_letters
import random
def print_random_chars(chars=1000, selection=ascii_letters + string.digits):
s = []
for _ in r... | apache-2.0 | Python |
26d2e0882377b16f8e67062a8092df99f6cd6785 | Remove TODO | davidgasquez/kaggle-airbnb | scripts/preprocessing.py | scripts/preprocessing.py | import pandas as pd
from kairbnb.preprocessing import one_hot_encoding
from kairbnb.io import load_users
VERSION = '4'
if __name__ == '__main__':
# Load raw data
train_users, test_users = load_users(version=VERSION)
# Join users
users = pd.concat((train_users, test_users), axis=0, ignore_index=True... | import pandas as pd
from kairbnb.preprocessing import one_hot_encoding
from kairbnb.io import load_users
VERSION = '4'
if __name__ == '__main__':
# Load raw data
train_users, test_users = load_users(version=VERSION)
# Join users
users = pd.concat((train_users, test_users), axis=0, ignore_index=True... | mit | Python |
44c4b8550307b837f55b4ad754d836ea9a3ba431 | fix wrong import !! | Agi-dev/pylaas_core | tests/fixtures/data_sets/service/dummy_adapter/dummy_adapter.py | tests/fixtures/data_sets/service/dummy_adapter/dummy_adapter.py | from pylaas_core.abstract.abstract_service import AbstractService
class DummyAdapter(AbstractService):
pass
| from abstract.abstract_service import AbstractService
class DummyAdapter(AbstractService):
pass
| mit | Python |
879ba45ea06744fb42a92e9052d9d473b3573a76 | Truncate tables when running silk_clear_request_log (#270) | crunchr/silk,django-silk/silk,jazzband/silk,django-silk/silk,crunchr/silk,crunchr/silk,django-silk/silk,crunchr/silk,jazzband/silk,jazzband/silk,mtford90/silk,mtford90/silk,django-silk/silk,mtford90/silk,mtford90/silk,jazzband/silk | silk/management/commands/silk_clear_request_log.py | silk/management/commands/silk_clear_request_log.py | from django.conf import settings
from django.core.management.base import BaseCommand
from django.db import connection
import silk.models
class Command(BaseCommand):
help = "Clears silk's log of requests."
@staticmethod
def delete_model(model):
engine = settings.DATABASES['default']['ENGINE']
... | from django.core.management.base import BaseCommand
import silk.models
class Command(BaseCommand):
help = "Clears silk's log of requests."
@staticmethod
def delete_model(model):
while True:
items_to_delete = list(
model.objects.values_list('pk', flat=True).all()[:1000... | mit | Python |
63d2b15d822aa3822cb855ffac8ba1bafa62b6b7 | delete import to productproduct | ingadhoc/product,ingadhoc/product | product_replenishment_cost/models/__init__.py | product_replenishment_cost/models/__init__.py | ##############################################################################
#
# Author: Alexandre Fayolle, Joel Grand-Guillaume
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | ##############################################################################
#
# Author: Alexandre Fayolle, Joel Grand-Guillaume
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | agpl-3.0 | Python |
044e70c2443ad5daf99f876b59c052e409f6119f | Fix tests | ddico/account-financial-tools,ddico/account-financial-tools | account_lock_date_update/tests/test_account_lock_date_update.py | account_lock_date_update/tests/test_account_lock_date_update.py | # Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import TransactionCase
from odoo.exceptions import UserError
class TestAccountLockDateUpdate(TransactionCase):
def setUp(self):
super(TestAccountLockDateUpdate, self).setUp()
self... | # Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import TransactionCase
from odoo.exceptions import UserError
class TestAccountLockDateUpdate(TransactionCase):
def setUp(self):
super(TestAccountLockDateUpdate, self).setUp()
self... | agpl-3.0 | Python |
e31176032b26b3dacc3312c7e84e9f5514eb0102 | Add __init__.py | jniediek/combinato | signalviewer/__init__.py | signalviewer/__init__.py | from __future__ import absolute_import
from .manager.tools import debug
from .manager.man_continuous import H5Manager
from .options import options
from .convert.convert_tools import make_blocks
| from __future__ import absolute_import
from .manager.tools import debug
from .manager.man_continuous import H5Manager
from .options import options
| mit | Python |
668a5240c29047d86fe9451f3078bb163bea0db9 | Add version info to package init | jni/skan | skan/__init__.py | skan/__init__.py | from .csr import skeleton_to_csgraph, branch_statistics, summarise
__version__ = '0.1-dev'
__all__ = ['skeleton_to_csgraph',
'branch_statistics',
'summarise']
| from .csr import skeleton_to_csgraph, branch_statistics, summarise
__all__ = ['skeleton_to_csgraph',
'branch_statistics',
'summarise'] | bsd-3-clause | Python |
49194baef2abc336122bab4cb7f8c8e49087b23c | Fix debugging console. (Bad import.) | ErinCall/sync-engine,gale320/sync-engine,EthanBlackburn/sync-engine,EthanBlackburn/sync-engine,nylas/sync-engine,gale320/sync-engine,jobscore/sync-engine,rmasters/inbox,closeio/nylas,PriviPK/privipk-sync-engine,jobscore/sync-engine,ErinCall/sync-engine,wakermahmud/sync-engine,wakermahmud/sync-engine,Eagles2F/sync-engin... | src/inbox/server/console.py | src/inbox/server/console.py | from inbox.server.mailsync.backends.imap import uidvalidity_cb
from .crispin import new_crispin
from .models import session_scope
from .models.tables.base import Account
import IPython
def user_console(user_email_address):
with session_scope() as db_session:
account = db_session.query(Account).filter_by(
... | from .mailsync.imap import uidvalidity_cb
from .crispin import new_crispin
from .models import session_scope
from .models.tables.base import Account
import IPython
def user_console(user_email_address):
with session_scope() as db_session:
account = db_session.query(Account).filter_by(
email_... | agpl-3.0 | Python |
8ad4850941e299d9dad02cac0e300dc2021b81be | Rename svg output based on sort attribute | jollyra/hubot-streak-podium,jollyra/hubot-commit-streak,jollyra/hubot-commit-streak,supermitch/streak-podium,supermitch/streak-podium,jollyra/hubot-streak-podium | streak-podium/render.py | streak-podium/render.py | import pygal
def horizontal_bar(sorted_streaks, sort):
"""
Render a horizontal bar chart of streaks.
Values have already been sorted by sort.
"""
users = [user for user, _ in sorted_streaks][::-1]
streaks = [getattr(streak, sort) for _, streak in sorted_streaks][::-1]
chart = pygal.Horiz... | import pygal
def horizontal_bar(sorted_streaks, sort_attrib):
"""
Render a horizontal bar chart of streaks.
Values have already been sorted by sort_attrib.
"""
users = [user for user, _ in sorted_streaks][::-1]
streaks = [getattr(streak, sort_attrib) for _, streak in sorted_streaks][::-1]
... | mit | Python |
2986a4e73e9bcf2d2c6f809be9b3db134c0141f8 | add infinite loop to try reconnection | xeno1991/GPIOControler | socket_client.py | socket_client.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""socket_client
サーバーとWebSocketを使って通信を行い,送られてきた命令に従ってGPIOの制御をする.
"""
import sys
import RPi.GPIO as GPIO
from GPIOControler.GPIOControler import SafetyThread
from WheelControler import WheelControler
import websocket
import time
wh = WheelControler([7,11,13,15])
th = Sa... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""socket_client
サーバーとWebSocketを使って通信を行い,送られてきた命令に従ってGPIOの制御をする.
"""
import sys
import RPi.GPIO as GPIO
from GPIOControler.GPIOControler import SafetyThread
from WheelControler import WheelControler
import websocket
wh = WheelControler([7,11,13,15])
th = SafetyThread(1... | mit | Python |
9b439891b3b774fdf39adc1390da1d57bcf18b52 | Bump version to 0.15 | petteraas/SoCo,KennethNielsen/SoCo,dajobe/SoCo,KennethNielsen/SoCo,petteraas/SoCo,dajobe/SoCo,SoCo/SoCo,petteraas/SoCo,SoCo/SoCo | soco/__init__.py | soco/__init__.py | # -*- coding: utf-8 -*-
"""SoCo (Sonos Controller) is a simple library to control Sonos speakers."""
# There is no need for all strings here to be unicode, and Py2 cannot import
# modules with unicode names so do not use from __future__ import
# unicode_literals
# https://github.com/SoCo/SoCo/issues/98
#
import log... | # -*- coding: utf-8 -*-
"""SoCo (Sonos Controller) is a simple library to control Sonos speakers."""
# There is no need for all strings here to be unicode, and Py2 cannot import
# modules with unicode names so do not use from __future__ import
# unicode_literals
# https://github.com/SoCo/SoCo/issues/98
#
import log... | mit | Python |
30e98035582793944666dfddd2565d460948269e | Fix saving collections | uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam | subcollections/admin.py | subcollections/admin.py | from django.contrib import admin
from subcollections.models import Collection, Syndication
from django.contrib.auth.models import User
#from django.db.models import ManyToManyField
class CollectionAdmin(admin.ModelAdmin):
list_display = ('id', 'title', 'is_public', 'is_syndicated', 'updated')
search_fields =... | from django.contrib import admin
from subcollections.models import Collection, Syndication
from django.contrib.auth.models import User
#from django.db.models import ManyToManyField
class CollectionAdmin(admin.ModelAdmin):
list_display = ('id', 'title', 'is_public', 'is_syndicated', 'updated')
search_fields =... | bsd-3-clause | Python |
01d53dc7ce1bfa2cdcd1081c15848f139b8bc970 | enable more evalfiles | xmunoz/rubberband,xmunoz/rubberband,ambros-gleixner/rubberband,ambros-gleixner/rubberband,ambros-gleixner/rubberband,xmunoz/rubberband,xmunoz/rubberband | rubberband/constants.py | rubberband/constants.py | INFINITY_KEYS = ("separating/flowcover/maxslackroot", "separating/flowcover/maxslack",
"heuristics/undercover/maxcoversizeconss")
INFINITY_MASK = -1
ZIPPED_SUFFIX = ".gz"
FILES_DIR = "files/"
STATIC_FILES_DIR = FILES_DIR + "static/"
ALL_SOLU = STATIC_FILES_DIR + "all.solu"
IPET_EVALUATIONS = {
... | INFINITY_KEYS = ("separating/flowcover/maxslackroot", "separating/flowcover/maxslack",
"heuristics/undercover/maxcoversizeconss")
INFINITY_MASK = -1
ZIPPED_SUFFIX = ".gz"
FILES_DIR = "files/"
STATIC_FILES_DIR = FILES_DIR + "static/"
ALL_SOLU = STATIC_FILES_DIR + "all.solu"
IPET_EVALUATIONS = {
... | mit | Python |
8a02ceeb5723b4d5075ab90bf64edefae9b81572 | Remove incorrect comment on enhanced models (#95) | googleapis/python-speech,googleapis/python-speech | samples/snippets/transcribe_enhanced_model.py | samples/snippets/transcribe_enhanced_model.py | #!/usr/bin/env python
# Copyright 2018 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... | #!/usr/bin/env python
# Copyright 2018 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... | apache-2.0 | Python |
d04d2c8d5387eca12682883ee00defc22f7ff00a | print some debug statements to see what the deal is with my failed filter statement | camswords/raspberry-pi-instagram-printer,camswords/raspberry-pi-instagram-printer | src/lib/media_repository.py | src/lib/media_repository.py | from database import Database
from media import Media
from support_team import SupportTeam
class MediaRepository:
def __init__(self):
self.database = Database()
def update_latest(self, media):
self.database.save("latest-media", media)
def latest(self):
if not self.database.has_ke... | from database import Database
from media import Media
from support_team import SupportTeam
class MediaRepository:
def __init__(self):
self.database = Database()
def update_latest(self, media):
self.database.save("latest-media", media)
def latest(self):
if not self.database.has_ke... | mit | Python |
86e652951e7a86827e6fd660c87dae50be232b4c | Make test time bounds explicit | kdeloach/nyc-trees,RickMohr/nyc-trees,RickMohr/nyc-trees,azavea/nyc-trees,RickMohr/nyc-trees,kdeloach/nyc-trees,maurizi/nyc-trees,kdeloach/nyc-trees,kdeloach/nyc-trees,azavea/nyc-trees,azavea/nyc-trees,RickMohr/nyc-trees,maurizi/nyc-trees,azavea/nyc-trees,kdeloach/nyc-trees,azavea/nyc-trees,maurizi/nyc-trees,maurizi/ny... | src/nyc_trees/apps/core/test_utils.py | src/nyc_trees/apps/core/test_utils.py | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from cStringIO import StringIO
from datetime import timedelta
from django.contrib.auth.models import AnonymousUser
from django.contrib.gis.geos import Point
from django.test import Re... | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from cStringIO import StringIO
from django.contrib.auth.models import AnonymousUser
from django.contrib.gis.geos import Point
from django.test import RequestFactory
from django.utils.t... | agpl-3.0 | Python |
90bd0974e0aebda46c71bc8f664a70a0961671e0 | Fix Nekbone power_balancer_energy | cmcantalupo/geopm,geopm/geopm,cmcantalupo/geopm,cmcantalupo/geopm,geopm/geopm,cmcantalupo/geopm,geopm/geopm,cmcantalupo/geopm,geopm/geopm,geopm/geopm | integration/experiment/energy_efficiency/run_power_balancer_energy_nekbone.py | integration/experiment/energy_efficiency/run_power_balancer_energy_nekbone.py | #!/usr/bin/env python
#
# Copyright (c) 2015, 2016, 2017, 2018, 2019, 2020, Intel Corporation
#
# 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 copyrig... | #!/usr/bin/env python
#
# Copyright (c) 2015, 2016, 2017, 2018, 2019, 2020, Intel Corporation
#
# 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 copyrig... | bsd-3-clause | Python |
0686b4c9e659d3471ffc5aacbb76c7e114033656 | Fix import order | jd/tenacity,william-silversmith/tenacity | tenacity/tests/test_async.py | tenacity/tests/test_async.py | # coding: utf-8
# Copyright 2016 Étienne Bersac
#
# 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 ... | # coding: utf-8
# Copyright 2016 Étienne Bersac
#
# 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 ... | apache-2.0 | Python |
0ef7b5f19cf5baa2b83e38c82f18e250698998e6 | Attach the codes of predict_model | gciteam6/xgboost,gciteam6/xgboost | src/models/predict_model.py | src/models/predict_model.py | # Built-in modules
from os import path, pardir
import sys
import logging
# not used in this stub but often useful for finding various files
PROJECT_ROOT_DIRPATH = path.join(path.dirname(__file__), pardir, pardir)
sys.path.append(PROJECT_ROOT_DIRPATH)
# Third-party modules
import click
from dotenv import find_dotenv, ... | mit | Python | |
a8ddbc484697810cd630b1abc0a459adf4fc64f6 | Update bot_photo.py | instagrambot/instabot,instagrambot/instabot,ohld/instabot | instabot/bot/bot_photo.py | instabot/bot/bot_photo.py | import os
from io import open
from tqdm import tqdm
def upload_photo(self, photo, caption=None, upload_id=None):
self.small_delay()
if self.api.upload_photo(photo, caption, upload_id):
self.logger.info("Photo '{}' is uploaded.".format(photo))
return True
self.logger.info("Photo '{}' is no... | import os
from io import open
from tqdm import tqdm
def upload_photo(self, photo, caption=None, upload_id=None):
self.small_delay()
if self.api.upload_photo(photo, caption, upload_id):
self.logger.info("Photo '{}' is uploaded.".format(photo))
return True
self.logger.info("Photo '{}' is no... | apache-2.0 | Python |
8602eea69e18d31cf5b31cfe85074127ec26da04 | Fix with_debug | spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc | thinc/layers/with_debug.py | thinc/layers/with_debug.py | from typing import Optional, Callable, Any, Tuple
from ..model import Model
do_nothing = lambda *args, **kwargs: None
def with_debug(
layer: Model,
name: Optional[str] = None,
*,
on_init: Callable[[Model, Any, Any], None] = do_nothing,
on_forward: Callable[[Model, Any, bool], None] = do_nothing... | from typing import Optional, Callable, Any, Tuple
from ..model import Model
do_nothing = lambda *args, **kwargs: None
def with_debug(
layer: Model,
name: Optional[str] = None,
*,
on_init: Callable[[Model, Any, Any], None] = do_nothing,
on_forward: Callable[[Model, Any, bool], None] = do_nothing... | mit | Python |
4b4d99ad3859fd8dbff60de87cdde1f5018e8ea0 | Increment version | MediaMath/t1-python,FodT/t1-python | terminalone/metadata.py | terminalone/metadata.py | # -*- coding: utf-8 -*-
__name__ = 'TerminalOne'
__author__ = 'MediaMath'
__copyright__ = 'Copyright 2015, MediaMath'
__license__ = 'Apache License, Version 2.0'
__version__ = '1.8.0'
__maintainer__ = 'MediaMath Developer Relations'
__email__ = 'developers@mediamath.com'
__status__ = 'Stable'
__url__ = 'http://www.med... | # -*- coding: utf-8 -*-
__name__ = 'TerminalOne'
__author__ = 'MediaMath'
__copyright__ = 'Copyright 2015, MediaMath'
__license__ = 'Apache License, Version 2.0'
__version__ = '1.7.1'
__maintainer__ = 'MediaMath Developer Relations'
__email__ = 'developers@mediamath.com'
__status__ = 'Stable'
__url__ = 'http://www.med... | apache-2.0 | Python |
38a3117c27df10d45cfb3c950140f1d7ec8ccd70 | change to make sure dcHOME is put out as the first element in the generate env files. THis way it will be defined before it is used | devopscenter/dcUtils,devopscenter/dcUtils | scripts/fixUpEnvFile.py | scripts/fixUpEnvFile.py | #!/usr/bin/env python
import sys
import argparse
from collections import OrderedDict
# ==============================================================================
"""
this script is called by deployenv.sh as a helper script to read a file,
remove duplicates and put the output into a second file. Both files will be
... | #!/usr/bin/env python
import sys
import argparse
from collections import OrderedDict
# ==============================================================================
"""
this script is called by deployenv.sh as a helper script to read a file,
remove duplicates and put the output into a second file. Both files will be
... | apache-2.0 | Python |
0c50e0466650b184c1af15fdcc822d1f6489a09a | Fix discarding output_dir | qzane/you-get,zmwangx/you-get,zmwangx/you-get,xyuanmu/you-get,xyuanmu/you-get,qzane/you-get,cnbeining/you-get,cnbeining/you-get | src/you_get/extractors/douyutv.py | src/you_get/extractors/douyutv.py | #!/usr/bin/env python
__all__ = ['douyutv_download']
from ..common import *
import json
import hashlib
import time
import random
import string
import urllib.parse, urllib.request
def douyutv_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
html = get_content(url)
room_id_patt = r'"... | #!/usr/bin/env python
__all__ = ['douyutv_download']
from ..common import *
import json
import hashlib
import time
import random
import string
import urllib.parse, urllib.request
def douyutv_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
html = get_content(url)
room_id_patt = r'"... | mit | Python |
2d9fce5715b2d7d5b920d2e77212f076e9ebd1be | Add CMS Pages to staticgen registry. | mishbahr/staticgen-demo,mishbahr/staticgen-demo,mishbahr/staticgen-demo | staticgen_demo/staticgen_views.py | staticgen_demo/staticgen_views.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.utils import translation
from staticgen.staticgen_pool import staticgen_pool
from staticgen.staticgen_views import StaticgenView
class StaicgenDemoStaticViews(StaticgenView):
def items(self):
r... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from staticgen.staticgen_pool import staticgen_pool
from staticgen.staticgen_views import StaticgenView
class StaicgenDemoStaticViews(StaticgenView):
def items(self):
return (
'sitemap.xml',
'robots.txt',
... | bsd-3-clause | Python |
3e721f881e19beb19ea46c0f58f83b32f7c30522 | remove imports | adrn/StreamMorphology,adrn/StreamMorphology,adrn/StreamMorphology | streammorphology/ensemble/core.py | streammorphology/ensemble/core.py | # coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Third-party
import numpy as np
__all__ = ['create_ball']
def create_ball(w0, potential, N=1000, m_scale=1E4):
menc = potential.mass_enclosed(w0)
rscale = (m_scale / (3*menc))**(1/3.) * np.sqrt(np... | # coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
import sys
# Third-party
import numpy as np
# Project
# ...
__all__ = ['create_ball']
def create_ball(w0, potential, N=1000, m_scale=1E4):
menc = potential.mass_enclosed(... | mit | Python |
4d73eb2a7e06e1e2607a2abfae1063b9969e70a0 | Add user_id to returned transactions | Don42/strichliste-django,hackerspace-bootstrap/strichliste-django | strichliste/strichliste/models.py | strichliste/strichliste/models.py | from django.db import models
from django.db.models import Sum
class User(models.Model):
name = models.CharField(max_length=254, unique=True)
create_date = models.DateTimeField(auto_now_add=True)
active = models.BooleanField(default=True)
mail_address = models.EmailField(null=True)
@property
d... | from django.db import models
from django.db.models import Sum
class User(models.Model):
name = models.CharField(max_length=254, unique=True)
create_date = models.DateTimeField(auto_now_add=True)
active = models.BooleanField(default=True)
mail_address = models.EmailField(null=True)
@property
d... | mit | Python |
1c6aa9e31fa5e53afa1cadfb918f3da013574edf | add code to manage F# projects | nosami/xamarin-monodevelop-fsharp-addin,nosami/xamarin-monodevelop-fsharp-addin,Ming-Tang/fsharpbinding,fsharp/fsharpbinding,fsharp/fsharpbinding,fsharp/fsharpbinding,fsharp/xamarin-monodevelop-fsharp-addin,Ming-Tang/fsharpbinding,Ming-Tang/fsharpbinding,fsharp/xamarin-monodevelop-fsharp-addin | sublimetext/FSharp/lib/project.py | sublimetext/FSharp/lib/project.py | # Copyright (c) 2014, Guillermo López-Anglada. Please see the AUTHORS file for details.
# All rights reserved. Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.)
from FSharp.sublime_plugin_lib.path import find_file_by_extension
from FSharp.sublime_plugin_lib.path impor... | apache-2.0 | Python | |
5ffca73e27c19d636548bd467e18e83440ccaa57 | Update cmd_utils.py | Tendrl/commons,rishubhjain/commons,r0h4n/commons | tendrl/commons/utils/cmd_utils.py | tendrl/commons/utils/cmd_utils.py | import logging
import shlex
from ansible_module_runner import AnsibleExecutableGenerationFailed
from ansible_module_runner import AnsibleRunner
ANSIBLE_MODULE_PATH = "core/commands/command.py"
LOG = logging.getLogger(__name__)
SAFE_COMMAND_LIST = [
"lsblk",
"cat",
"lscpu",
"getenforce",
"gluster"... | import logging
import shlex
from ansible_module_runner import AnsibleExecutableGenerationFailed
from ansible_module_runner import AnsibleRunner
ANSIBLE_MODULE_PATH = "core/commands/command.py"
LOG = logging.getLogger(__name__)
SAFE_COMMAND_LIST = [
"lsblk",
"cat",
"lscpu",
"getenforce",
"gluster"... | lgpl-2.1 | Python |
0f1cb413503034cbc1e2deddd8327ad1946201fe | Rewrite phis from outdated incoming exception blocks | flypy/flypy,flypy/flypy | numba2/compiler/optimizations/throwing.py | numba2/compiler/optimizations/throwing.py | # -*- coding: utf-8 -*-
"""
Rewrite exceptions that are thrown and caught locally to jumps.
"""
from numba2.compiler import excmodel
from pykit.analysis import cfa
from pykit.optimizations import local_exceptions
def rewrite_local_exceptions(func, env):
local_exceptions.run(func, env, exc_model=excmodel.ExcMode... | # -*- coding: utf-8 -*-
"""
Rewrite exceptions that are thrown and caught locally to jumps.
"""
from numba2.compiler import excmodel
from pykit.optimizations import local_exceptions
def rewrite_local_exceptions(func, env):
local_exceptions.run(func, env, exc_model=excmodel.ExcModel(env))
def rewrite_exceptions(... | bsd-2-clause | Python |
c00830ca27e63c206f116d0f8b92f552888743d9 | kill empty lines | Luxapodular/processing.py,mashrin/processing.py,jdf/processing.py,tildebyte/processing.py,Luxapodular/processing.py,jdf/processing.py,mashrin/processing.py,mashrin/processing.py,tildebyte/processing.py,jdf/processing.py,Luxapodular/processing.py,tildebyte/processing.py | examples.py/Topics/Effects/Metaball/Metaball.py | examples.py/Topics/Effects/Metaball/Metaball.py | """
Metaball Demo Effect
by luis2048. (Adapted to Python by Jonathan Feinberg)
Organic-looking n-dimensional objects. The technique for rendering
metaballs was invented by Jim Blinn in the early 1980s. Each metaball
is defined as a function in n-dimensions.
"""
numBlobs = 3
# Position vector for each... | """
Metaball Demo Effect
by luis2048. (Adapted to Python by Jonathan Feinberg)
Organic-looking n-dimensional objects. The technique for rendering
metaballs was invented by Jim Blinn in the early 1980s. Each metaball
is defined as a function in n-dimensions.
"""
numBlobs = 3
# Position vector for each... | apache-2.0 | Python |
935338ef6d2c04450fbcdf121eca19b3a9f37a3b | remove cache, sorry | hackerspace-silesia/jakniedojade,hackerspace-silesia/jakniedojade,hackerspace-silesia/jakniedojade | jakniedojade/app/views.py | jakniedojade/app/views.py | from django.db.models import Count, F
from django.shortcuts import get_object_or_404
from rest_framework.viewsets import ReadOnlyModelViewSet
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status as http_status
from app.models import Connection, Image, ... | from django.db.models import Count, F
from django.shortcuts import get_object_or_404
from rest_framework.viewsets import ReadOnlyModelViewSet
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status as http_status
from django.views.decorators.cache import c... | mit | Python |
8269c7e31c94e076f9f9f6d7cc8ace3a4c6af14e | Remove unused import "patch". | mliu7/jingo,jbalogh/jingo,jbalogh/jingo,mliu7/jingo,jsocol/jingo | jingo/tests/test_views.py | jingo/tests/test_views.py | from django.utils import translation
from mock import sentinel
from nose.tools import eq_
from jingo import get_env, render_to_string
def test_template_substitution_crash():
translation.activate('xx')
env = get_env()
# The localized string has the wrong variable name in it
s = '{% trans string="he... | from django.utils import translation
from mock import patch, sentinel
from nose.tools import eq_
from jingo import get_env, render_to_string
def test_template_substitution_crash():
translation.activate('xx')
env = get_env()
# The localized string has the wrong variable name in it
s = '{% trans str... | bsd-3-clause | Python |
b74ed84407aa99e0f9265f0834854d82a2442d74 | test correct `__tracebackhide__==True` behavior in `test_frame_info.py` | joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument,joerick/pyinstrument | test/low_level/test_frame_info.py | test/low_level/test_frame_info.py | import inspect
from pyinstrument.low_level import stat_profile as stat_profile_c
from pyinstrument.low_level import stat_profile_python
class AClass:
def get_frame_info_for_a_method(self, getter_function):
__tracebackhide__ = True
frame = inspect.currentframe()
assert frame
retur... | import inspect
from pyinstrument.low_level import stat_profile as stat_profile_c
from pyinstrument.low_level import stat_profile_python
class AClass:
def get_frame_info_for_a_method(self, getter_function):
frame = inspect.currentframe()
assert frame
return getter_function(frame)
def ... | bsd-3-clause | Python |
e6ce3c61460878faa1e87bcc04c29c525ebd4fc1 | make names unique" | salilab/rmf,salilab/rmf,salilab/rmf,salilab/rmf | test/test_data_types.py | test/test_data_types.py | #!/usr/bin/python
import unittest
import RMF
class GenericTest(unittest.TestCase):
def _do_test_type(self, nh, k, v):
print k, v
nh.set_value(k, v)
vo= nh.get_value(k)
self.assertEqual(vo, v)
def _do_test_types(self, f, pccc):
nh= f.get_root_node().add_child("testn", RMF... | #!/usr/bin/python
import unittest
import RMF
class GenericTest(unittest.TestCase):
def _do_test_type(self, nh, k, v):
print k, v
nh.set_value(k, v)
vo= nh.get_value(k)
self.assertEqual(vo, v)
def _do_test_types(self, f, pccc):
nh= f.get_root_node().add_child("testn", RMF... | apache-2.0 | Python |
355c50ac517492a8c94d760c6e75e8c33cb947eb | change fix to #36: wrap instead of unpacking | kcarnold/autograd,hips/autograd,barak/autograd,HIPS/autograd,hips/autograd,HIPS/autograd | autograd/numpy/numpy_wrapper.py | autograd/numpy/numpy_wrapper.py | from __future__ import absolute_import
from __future__ import print_function
import types
from .use_gpu_numpy import use_gpu_numpy
import six
if use_gpu_numpy():
print("Using GPU-supporting numpy wrapper")
import gpu_numpy as np
else:
import numpy as np
import warnings
from autograd.core import primitive
... | from __future__ import absolute_import
from __future__ import print_function
import types
from .use_gpu_numpy import use_gpu_numpy
import six
if use_gpu_numpy():
print("Using GPU-supporting numpy wrapper")
import gpu_numpy as np
else:
import numpy as np
import warnings
from autograd.core import primitive
... | mit | Python |
832647d6afbb8fdd1b8db9ca6f530d60af4d7e30 | Fix stdlib constant import test | evhub/coconut | tests/constants_test.py | tests/constants_test.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------------------------------------------------
# INFO:
#-----------------------------------------------------------------------------------------------------------------------
"""
Author: Evan Hubin... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------------------------------------------------
# INFO:
#-----------------------------------------------------------------------------------------------------------------------
"""
Author: Evan Hubin... | apache-2.0 | Python |
dcf8622f6b40ba41f67638614cf3754b17005d4d | Change next/prev finding logic to stay in same section | patricmutwiri/pombola,hzj123/56th,mysociety/pombola,geoffkilpin/pombola,patricmutwiri/pombola,mysociety/pombola,patricmutwiri/pombola,mysociety/pombola,hzj123/56th,patricmutwiri/pombola,hzj123/56th,patricmutwiri/pombola,ken-muturi/pombola,ken-muturi/pombola,patricmutwiri/pombola,ken-muturi/pombola,hzj123/56th,geoffkilp... | pombola/south_africa/templatetags/za_speeches.py | pombola/south_africa/templatetags/za_speeches.py | import datetime
from django import template
from speeches.models import Section
register = template.Library()
# NOTE: this code is far from ideal. Sharing it with others in a pull request
# to get opinions about how to improve.
# TODO:
# - cache results of min_speech_datetime and section_prev_next_links (both of
# ... | from django import template
register = template.Library()
@register.inclusion_tag('speeches/_section_prev_next_links.html')
def section_prev_next_links(section):
next_section = section.get_next_node()
prev_section = section.get_previous_node()
return {
"next": next_section,
"previous"... | agpl-3.0 | Python |
e5cfb4db3fd014312a694392b484a913ec972e47 | Rewrite ChainerX activation tests | niboshi/chainer,chainer/chainer,okuta/chainer,hvy/chainer,hvy/chainer,chainer/chainer,wkentaro/chainer,chainer/chainer,okuta/chainer,pfnet/chainer,wkentaro/chainer,niboshi/chainer,hvy/chainer,wkentaro/chainer,okuta/chainer,wkentaro/chainer,okuta/chainer,keisuke-umezawa/chainer,niboshi/chainer,hvy/chainer,keisuke-umezaw... | tests/chainerx_tests/unit_tests/routines_tests/test_activation.py | tests/chainerx_tests/unit_tests/routines_tests/test_activation.py | import unittest
import numpy
import chainerx
import chainerx.testing
from chainerx_tests import array_utils
from chainerx_tests import op_utils
@op_utils.op_test(['native:0', 'cuda:0'])
class TestRelu(op_utils.OpTest):
dodge_nondifferentiable = True
def setup(self, shape, dtype):
if dtype == 'boo... | import numpy
import pytest
import chainerx
import chainerx.testing
from chainerx_tests import array_utils
@chainerx.testing.numpy_chainerx_array_equal()
@pytest.mark.parametrize_device(['native:0', 'cuda:0'])
def test_relu(xp, device, shape, dtype):
if dtype == 'bool_':
return chainerx.testing.ignore()
... | mit | Python |
f649a2b2d53a2efe44bc68178e0c9e969512d95d | set override-redirect flag for feedback message window | baverman/snaked,baverman/snaked | snaked/core/feedback.py | snaked/core/feedback.py | import gtk
from gobject import timeout_add, source_remove
class EscapeObject(object): pass
class FeedbackPopup(object):
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_property('allow-shrink', True)
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_POPUP... | import gtk
from gobject import timeout_add, source_remove
class EscapeObject(object): pass
class FeedbackPopup(object):
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_property('allow-shrink', True)
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_POPUP... | mit | Python |
d2b6743b7f316a7b1180b64b58bd1b21cdb8efed | allow to partially update file metadata without using its contents | pyfidelity/rest-seed,pyfidelity/rest-seed,pyfidelity/rest-seed | backend/backrest/models/file.py | backend/backrest/models/file.py | from base64 import decodestring
from os.path import join, splitext, abspath
from re import match
from repoze.filesafe import create_file, open_file
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import Unicode
from uuid import uuid1
from .. import utils
from ... | from base64 import decodestring
from os.path import join, splitext, abspath
from re import match
from repoze.filesafe import create_file, open_file
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import Unicode
from uuid import uuid1
from .. import utils
from ... | bsd-2-clause | Python |
4165103206e0d3f9096e4ad11f2168ab4f863cda | FIX avoid crash in report caused by the failure to reformat a phone number | brain-tec/connector-telephony,treveradams/connector-telephony,treveradams/connector-telephony,brain-tec/connector-telephony,brain-tec/connector-telephony,treveradams/connector-telephony | base_phone/report_sxw_format.py | base_phone/report_sxw_format.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# Base Phone module for OpenERP
# Copyright (C) 2014 Alexis de Lattre <alexis@via.ecp.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero... | # -*- encoding: utf-8 -*-
##############################################################################
#
# Base Phone module for OpenERP
# Copyright (C) 2014 Alexis de Lattre <alexis@via.ecp.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero... | agpl-3.0 | Python |
211b7b28e2d8c7ed0e0f67bea1a1a68b520a53b1 | Use "blank" PD incident instance for triggering through PD service. | BlasiusVonSzerencsi/pagerduty-events-api | pagerduty_events_api/pagerduty_service.py | pagerduty_events_api/pagerduty_service.py | from pagerduty_events_api.pagerduty_incident import PagerdutyIncident
from pagerduty_events_api.pagerduty_rest_client import PagerdutyRestClient
class PagerdutyService:
def __init__(self, key):
self.__service_key = key
def get_service_key(self):
return self.__service_key
def trigger(self... | from pagerduty_events_api.pagerduty_incident import PagerdutyIncident
from pagerduty_events_api.pagerduty_rest_client import PagerdutyRestClient
class PagerdutyService:
def __init__(self, key):
self.__service_key = key
def get_service_key(self):
return self.__service_key
def trigger(self... | mit | Python |
f90fac30454537ec0727371ffc54bde4a1e2f78d | Put the code in __main__ for lesson 5 guess-a-number example. | razzius/PyClassLessons,razzius/PyClassLessons,razzius/PyClassLessons,razzius/PyClassLessons,PyClass/PyClassLessons,noisebridge/PythonClass,noisebridge/PythonClass,noisebridge/PythonClass,PyClass/PyClassLessons,noisebridge/PythonClass,PyClass/PyClassLessons | 5_control_statements_and_exceptions_hierarchy/guess-a-number-ex.py | 5_control_statements_and_exceptions_hierarchy/guess-a-number-ex.py | """
This is an example of the control structures.
"""
if __name__ == "__main__":
result = ""
our_number = 21
def test_number(answer):
answer = int(answer)
if answer == our_number:
return "got it right"
elif answer > our_number:
return "nope, lower"
... | """
This is an example of the control structures.
"""
result = ""
our_number = 21
def test_number(answer):
answer = int(answer)
if answer == our_number:
return "got it right"
elif answer > our_number:
return "nope, lower"
else:
return "nope, higher"
while result != "got i... | mit | Python |
eea6df13cb597df393c9f8764e936b625accd157 | update import | alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl | AlphaTwirl/Configure/build_progressMonitor_communicationChannel.py | AlphaTwirl/Configure/build_progressMonitor_communicationChannel.py | # Tai Sakuma <tai.sakuma@cern.ch>
import sys
from .. import ProgressBar
from .. import Concurrently
##__________________________________________________________________||
def build_progressMonitor_communicationChannel(quiet, processes):
if quiet:
progressBar = None
elif sys.stdout.isatty():
p... | # Tai Sakuma <tai.sakuma@cern.ch>
import sys
from ..ProgressBar import ProgressBar
from ..ProgressBar import ProgressPrint
from ..ProgressBar import ProgressMonitor, BProgressMonitor, NullProgressMonitor
from ..Concurrently import CommunicationChannel
from ..Concurrently import CommunicationChannel0
##_______________... | bsd-3-clause | Python |
524d5427d54342f26008a5b527140d4158f70edf | Clear websocket data to try and fix Travis | palfrey/mopidy-tachikoma,palfrey/mopidy-tachikoma | tests/test_extension.py | tests/test_extension.py | from __future__ import unicode_literals
import json
from test_helpers import MockTrack, get_websocket, make_frontend, patched_bot
from mopidy_tachikoma import Extension
def test_get_default_config():
ext = Extension()
config = ext.get_default_config()
assert '[tachikoma]' in config
assert 'enabled = true' in ... | from __future__ import unicode_literals
import json
from test_helpers import MockTrack, get_websocket, make_frontend, patched_bot
from mopidy_tachikoma import Extension
def test_get_default_config():
ext = Extension()
config = ext.get_default_config()
assert '[tachikoma]' in config
assert 'enabled = true' in ... | agpl-3.0 | Python |
120f10e99b4f7771ac56de9f035829209538bd04 | create tables again... | fp12/sfv-bot | src/db_access.py | src/db_access.py | from config import app_config
from db_models import DBPersistence, DBUpdateChannel
class DBAccess():
def __init__(self):
if 'heroku' in app_config:
import psycopg2
from urllib.parse import urlparse
url = urlparse(app_config['database'])
self._conn = psycopg2... | from config import app_config
from db_models import DBPersistence, DBUpdateChannel
class DBAccess():
def __init__(self):
if 'heroku' in app_config:
import psycopg2
from urllib.parse import urlparse
url = urlparse(app_config['database'])
self._conn = psycopg2... | mit | Python |
f9aa9d1574ce6a68615e08d2e137723da468672e | add the actual librato code | thumbor-community/librato | tc_librato/metrics/librato_metrics.py | tc_librato/metrics/librato_metrics.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
import os
import datetime
import librato
from thumbor.metrics import... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
import statsd
from thumbor.metrics import BaseMetrics
class Metric... | mit | Python |
4b9e49a8819b43f0fa5a80d7649a3b13118d6df6 | Add expectations path to telemetry config object. | catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult | telemetry/telemetry/project_config.py | telemetry/telemetry/project_config.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class ProjectConfig(object):
"""Contains information about the benchmark runtime environment.
Attributes:
top_level_dir: A dir that contains benchm... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class ProjectConfig(object):
"""Contains information about the benchmark runtime environment.
Attributes:
top_level_dir: A dir that contains benchm... | bsd-3-clause | Python |
f5494ef81c9458d10a7cc7307f7663eabb3ad072 | Load data directly. (#8399) | keras-team/keras,keras-team/keras | keras/datasets/cifar10.py | keras/datasets/cifar10.py | from __future__ import absolute_import
from .cifar import load_batch
from ..utils.data_utils import get_file
from .. import backend as K
import numpy as np
import os
def load_data():
"""Loads CIFAR10 dataset.
# Returns
Tuple of Numpy arrays: `(x_train, y_train), (x_test, y_test)`.
"""
dirname... | from __future__ import absolute_import
from .cifar import load_batch
from ..utils.data_utils import get_file
from .. import backend as K
import numpy as np
import os
def load_data():
"""Loads CIFAR10 dataset.
# Returns
Tuple of Numpy arrays: `(x_train, y_train), (x_test, y_test)`.
"""
dirname... | apache-2.0 | Python |
f9385eb87a526410a05130ff706f04a895788afd | UPdate docstring | jabesq/home-assistant,FreekingDean/home-assistant,aequitas/home-assistant,toddeye/home-assistant,jabesq/home-assistant,devdelay/home-assistant,jabesq/home-assistant,soldag/home-assistant,LinuxChristian/home-assistant,turbokongen/home-assistant,leppa/home-assistant,kyvinh/home-assistant,kyvinh/home-assistant,Teagan42/ho... | homeassistant/components/notify/command_line.py | homeassistant/components/notify/command_line.py | """
homeassistant.components.notify.command_line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
command_line notification service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.command_line/
"""
import logging
import subprocess
from homeassistant.h... | """
homeassistant.components.notify.command_line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
command_line notification service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.command_line/
"""
import logging
import subprocess
from homeassistant.helpers i... | apache-2.0 | Python |
c2fb7055ef975372ce23fbb37c1eef61dd624bab | Remove the incorrect Windows type label. | timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons | test/D/SharedObjects/Common/common.py | test/D/SharedObjects/Common/common.py | """
Support functions for all the tests.
"""
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, ... | """
Support functions for all the tests.
"""
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, ... | mit | Python |
0437fe437738b65ee3e55d4c93363e363deb2077 | Add start method for timer | ktbs/ktbs-bench,ktbs/ktbs-bench | ktbs_bench/utils/timer.py | ktbs_bench/utils/timer.py | import resource
import logging
from time import time
class Timer:
"""Measure process duration."""
def __init__(self, tick_now=True):
self.start_time = []
if tick_now:
self.start_time = self.tick()
self.stop_time = None
self.delta = None
@staticmethod
def ti... | import resource
from time import time
class Timer:
"""Measure process duration."""
def __init__(self, tick_now=True):
self.start_time = []
if tick_now:
self.start_time = self.tick()
self.stop_time = None
self.delta = None
@staticmethod
def tick():
"... | mit | Python |
27e850829ce99bd4b302d2cc272e8bb602b6833c | load all python plugins when invoking idascript from the command-line | devttys0/idascript | src/idascript.py | src/idascript.py | ##################################################################################################
# Python module for IDAPython scripts executed via idascript.
#
# Copied from the original idascript utility, with minor changes: http://www.hexblog.com/?p=128
#
# Craig Heffner
# 14-November-2012
# http://www.tacn... | ##################################################################################################
# Python module for IDAPython scripts executed via idascript.
#
# Copied from the original idascript utility, with minor changes: http://www.hexblog.com/?p=128
#
# Craig Heffner
# 14-November-2012
# http://www.tacn... | mit | Python |
87d2e511b0fedd2a09610c35337336d443a756a4 | Add polling loop to allow time for callback to be invoked | awslabs/chalice | tests/unit/cli/filewatch/test_stat.py | tests/unit/cli/filewatch/test_stat.py | import os
import time
from chalice.cli.filewatch import stat
class FakeOSUtils(object):
def __init__(self):
self.initial_scan = True
def walk(self, rootdir):
yield 'rootdir', [], ['bad-file', 'baz']
if self.initial_scan:
self.initial_scan = False
def joinpath(self, *... | import os
from chalice.cli.filewatch import stat
class FakeOSUtils(object):
def __init__(self):
self.initial_scan = True
def walk(self, rootdir):
yield 'rootdir', [], ['bad-file', 'baz']
if self.initial_scan:
self.initial_scan = False
def joinpath(self, *parts):
... | apache-2.0 | Python |
7fd1884ebc479175777a67c4bfb7b3def1bfe859 | Remove time consuming test case | faneshion/MatchZoo,faneshion/MatchZoo | tests/unit_test/models/test_models.py | tests/unit_test/models/test_models.py | import numpy as np
import shutil
import pytest
from matchzoo import engine
from matchzoo import models
from matchzoo import tasks
# To add a test for a new model, add a tuple of form:
# (model_class, customized_kwargs)
# If no customized_kwargs is needed, simply put a `None`.
# Notice that each of such tuple w... | import numpy as np
import shutil
import pytest
from matchzoo import engine
from matchzoo import models
from matchzoo import tasks
# To add a test for a new model, add a tuple of form:
# (model_class, customized_kwargs)
# If no customized_kwargs is needed, simply put a `None`.
# Notice that each of such tuple w... | apache-2.0 | Python |
1c895b60b70a297a930b9ad4b98f8d41c15db3bb | Fix commit id | davidzchen/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,karllessard/tensorflow,annarev/tensorflow,annarev/tensorflow,gautam1858/tensorflow,sarvex/tensorflow,xzturn/tensorflow,cxxgtxy/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,petewarden/tensorflow,gautam1858/tensorflow,yongtang/tensorflow,davidzchen/t... | third_party/pthreadpool/workspace.bzl | third_party/pthreadpool/workspace.bzl | """Loads the pthreadpool library, used by XNNPACK."""
load("//third_party:repo.bzl", "third_party_http_archive")
def repo():
third_party_http_archive(
name = "pthreadpool",
strip_prefix = "pthreadpool-ebd50d0cfa3664d454ffdf246fcd228c3b370a11",
sha256 = "ca4fc774cf2339cb739bba827de8ed4ccbd4... | """Loads the pthreadpool library, used by XNNPACK."""
load("//third_party:repo.bzl", "third_party_http_archive")
def repo():
third_party_http_archive(
name = "pthreadpool",
strip_prefix = "pthreadpool-4ea95bef8cdd942895f23f5cc09c778d10500551",
sha256 = "100f675c099c74da46dea8da025f6f9b5e03... | apache-2.0 | Python |
c583b71f5167f4e73e6dcbdbda72d96d9807e3e7 | Fix telemetry scripts: do not clobber .svn dir during cleanup. | ltilve/chromium,patrickm/chromium.src,dushu1203/chromium.src,anirudhSK/chromium,hgl888/chromium-crosswalk-efl,ChromiumWebApps/chromium,dushu1203/chromium.src,PeterWangIntel/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk-efl,chuan9/chromium-crosswalk,ma... | tools/telemetry/telemetry/__init__.py | tools/telemetry/telemetry/__init__.py | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
A library for cross-platform browser tests.
"""
import inspect
import os
import shutil
import sys
from telemetry.core.browser import Browser
from tel... | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
A library for cross-platform browser tests.
"""
import inspect
import os
import shutil
import sys
from telemetry.core.browser import Browser
from tel... | bsd-3-clause | Python |
0e28cca82a81fb97597096cf2e30a49eb9af5043 | fix build when sphinx reports version to stderr | john-mcnamara-intel/dpdk,john-mcnamara-intel/dpdk,john-mcnamara-intel/dpdk,john-mcnamara-intel/dpdk | buildtools/call-sphinx-build.py | buildtools/call-sphinx-build.py | #! /usr/bin/env python3
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2019 Intel Corporation
#
import sys
import os
from os.path import join
from subprocess import run, PIPE, STDOUT
from distutils.version import StrictVersion
(sphinx, src, dst) = sys.argv[1:] # assign parameters to variables
# for sphinx v... | #! /usr/bin/env python3
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2019 Intel Corporation
#
import sys
import os
from os.path import join
from subprocess import run, PIPE
from distutils.version import StrictVersion
(sphinx, src, dst) = sys.argv[1:] # assign parameters to variables
# for sphinx version >... | mit | Python |
767f03f82fc60d66e83b1f2c70bc73565b5c5e5a | add v1.09 (#24419) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/corset/package.py | var/spack/repos/builtin/packages/corset/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Corset(Package):
"""Corset is a command-line software program to go from a de novo
... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Corset(Package):
"""Corset is a command-line software program to go from a de novo
... | lgpl-2.1 | Python |
50cb742377fc0b7ac49a6494e835a530b411d6d9 | fix build error with clang (#27848) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/libdrm/package.py | var/spack/repos/builtin/packages/libdrm/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libdrm(AutotoolsPackage):
"""A userspace library for accessing the DRM, direct rendering m... | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libdrm(AutotoolsPackage):
"""A userspace library for accessing the DRM, direct rendering m... | lgpl-2.1 | Python |
d1ea17521b29e5e140401d1f59777af85c3b8360 | add some test cases .backends.find_parser* can find parsers | ssato/python-anyconfig,ssato/python-anyconfig | tests/backends.py | tests/backends.py | #
# Copyright (C) 2012 - 2015 Satoru SATOH <ssato @ redhat.com>
# License: MIT
#
# pylint: disable=missing-docstring
from __future__ import absolute_import
import os.path
import unittest
import anyconfig.backend.json
import anyconfig.backends as TT
from anyconfig.compat import pathlib
from anyconfig.globals import Un... | #
# Copyright (C) 2012 - 2015 Satoru SATOH <ssato @ redhat.com>
# License: MIT
#
# pylint: disable=missing-docstring
from __future__ import absolute_import
import unittest
import anyconfig.backends as TT
from anyconfig.globals import UnknownParserTypeError, UnknownFileTypeError
class Test(unittest.TestCase):
d... | mit | Python |
d525dd55e610ab8f389128c3350f1c9694c202ef | Change name field class for filters | GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek | geotrek/cirkwi/filters.py | geotrek/cirkwi/filters.py | from django_filters import ModelMultipleChoiceFilter, FilterSet
from django_filters.fields import ModelChoiceField
from geotrek.authent.models import Structure
from geotrek.common.models import TargetPortal
from geotrek.trekking.models import POI, Trek
from django.forms import ValidationError
class ComaSeparatedMulti... | from django_filters import ModelMultipleChoiceFilter, FilterSet
from django_filters.fields import ModelChoiceField
from geotrek.authent.models import Structure
from geotrek.common.models import TargetPortal
from geotrek.trekking.models import POI, Trek
from django.forms import ValidationError
class ComaSeparatedModel... | bsd-2-clause | Python |
d0d79b0efa827bb9d5df9f3e0d77857ebe16f73c | remove cattle-logging from system_namespaces check | cjellick/rancher,rancher/rancher,rancher/rancher,rancherio/rancher,cjellick/rancher,rancherio/rancher,rancher/rancher,cjellick/rancher,rancher/rancher | tests/integration/test_system_project.py | tests/integration/test_system_project.py | import pytest
from rancher import ApiError
systemProjectLabel = "authz.management.cattle.io/system-project"
defaultProjectLabel = "authz.management.cattle.io/default-project"
initial_system_namespaces = set(["kube-system",
"cattle-system",
"kube-public"... | import pytest
from rancher import ApiError
systemProjectLabel = "authz.management.cattle.io/system-project"
defaultProjectLabel = "authz.management.cattle.io/default-project"
initial_system_namespaces = set(["kube-system",
"cattle-system",
"kube-public"... | apache-2.0 | Python |
07ecff6efcf2d05dc544db0a5aa7fab0d0156daf | Fix import order. | triflesoft/django-application-talos,triflesoft/django-application-talos,triflesoft/django-application-talos | projects/talos_test/urls.py | projects/talos_test/urls.py | from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include
from django.urls import path
from talos.urls import auth_url_patterns
urlpatterns = [
path('admin/', admin.site.urls),
path('accounts/', include('django.contrib.auth.urls... | from django.conf import settings
from django.conf.urls.static import static
from django.urls import include
from django.urls import path
from django.contrib import admin
from talos.urls import auth_url_patterns
urlpatterns = [
path('admin/', admin.site.urls),
path('accounts/', include('django.contrib.auth.urls... | bsd-3-clause | Python |
4376f48a4ec802eff0b7ac76fd969af9a800dbd2 | Update for latest django-reversion | eldarion/django-boxes,pinax/pinax-boxes | pinax/boxes/admin.py | pinax/boxes/admin.py | from django.contrib import admin
try:
from reversion.admin import VersionAdmin as AdminBase
except ImportError:
AdminBase = admin.ModelAdmin
from .models import Box
class BoxAdmin(AdminBase):
list_display = ["label", "created_by", "last_updated_by", "last_updated"]
search_fields = ["content"]
admi... | from django.contrib import admin
try:
import reversion
AdminBase = reversion.VersionAdmin
except ImportError:
AdminBase = admin.ModelAdmin
from .models import Box
class BoxAdmin(AdminBase):
list_display = ["label", "created_by", "last_updated_by", "last_updated"]
search_fields = ["content"]
ad... | unknown | Python |
a8b92972b235666749f0dc291ab9bf2b5b160f5f | Send consul node health checks | CodersOfTheNight/oshino | oshino/agents/consul_agent.py | oshino/agents/consul_agent.py | import aiohttp
from functools import partial
from . import Agent
class ConsulAgent(Agent):
@property
def leader_url(self):
return "http://{host}:{port}/v1/status/leader".format(host=self.host,
port=self.port)
@property
def servi... | import aiohttp
from . import Agent
class ConsulAgent(Agent):
@property
def leader_url(self):
return "http://{host}:{port}/v1/status/leader".format(host=self.host,
port=self.port)
@property
def services_url(self):
return ("... | mit | Python |
8308ff12f60af1fc7256df7305dd25100325b0a6 | Update tests/conftest.py | cgohlke/imagecodecs,cgohlke/imagecodecs,cgohlke/imagecodecs | tests/conftest.py | tests/conftest.py | # imagecodecs/tests/conftest.py
def pytest_report_header(config):
import sys
try:
pyversion = f'Python {sys.version.splitlines()[0]}'
import imagecodecs
from imagecodecs import _imagecodecs
return '{}\npackagedir: {}\nversion: {}\ndependencies: {}'.format(
pyversi... | # -*- coding: utf-8 -*-
# imagecodecs/conftest.py
def pytest_report_header(config):
import sys
import os
try:
pyversion = 'Python %s' % sys.version.splitlines()[0]
if (
'imagecodecs_lite' in os.getcwd() or
os.path.exists(os.path.join(os.path.dirname(__file__), '..'... | bsd-3-clause | Python |
d6170685d92c809dd7b036f8b151ac834d4040ac | Sort keywords in funccall | altair-viz/altair_parser,altair-viz/schemapi | altair_parser/utils/funccall.py | altair_parser/utils/funccall.py | """Utilities for constructing function calls"""
class Variable(object):
def __init__(self, name):
self.name = name
def __repr__(self):
return str(self.name)
def construct_function_call(funcname, *args, **kwargs):
"""Construct a string version of a Python function call
The repr() of ... | """Utilities for constructing function calls"""
class Variable(object):
def __init__(self, name):
self.name = name
def __repr__(self):
return str(self.name)
def construct_function_call(funcname, *args, **kwargs):
"""Construct a string version of a Python function call
The repr() of ... | bsd-3-clause | Python |
17c857b5680e6e47d7777f16bdd78485f806ade9 | make in_tmpdir a yield fixture, return to orig dir | jck/uhdl | tests/conftest.py | tests/conftest.py | import pytest
@pytest.yield_fixture
def in_tmpdir(tmpdir):
"""Change to pytest-provided temporary directory"""
with tmpdir.as_cwd():
yield tmpdir
| import pytest
@pytest.fixture
def in_tmpdir(tmpdir):
"""Change to pytest-provided temporary directory"""
tmpdir.chdir()
| bsd-3-clause | Python |
a8962e0eef920a3947ee2b5f831cbf19034b565a | disable unused carousel | fnp/edumed,fnp/edumed,fnp/edumed | edumed/settings.d/50-static.py | edumed/settings.d/50-static.py | MEDIA_ROOT = path.join(PROJECT_DIR, 'media/')
MEDIA_URL = '/media/'
STATIC_ROOT = path.join(PROJECT_DIR, 'static/')
STATIC_URL = '/static/'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.... | MEDIA_ROOT = path.join(PROJECT_DIR, 'media/')
MEDIA_URL = '/media/'
STATIC_ROOT = path.join(PROJECT_DIR, 'static/')
STATIC_URL = '/static/'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.... | agpl-3.0 | Python |
5288dcbf710a750d8d0eb5b272e2e4e07344f32f | Remove duplicate function. | maxking/paper-to-git,maxking/paper-to-git | paper_to_git/utilities/modules.py | paper_to_git/utilities/modules.py | """
"""
import os
import sys
from contextlib import suppress
from string import Template
from pkg_resources import resource_listdir
from paper_to_git.config import config
__all__ = [
'expand',
'makedirs',
'find_components',
'dropbox_api',
]
def expand(template, extras, template_class=Template):... | """
"""
import os
import sys
from contextlib import suppress
from string import Template
from pkg_resources import resource_listdir
from paper_to_git.config import config
__all__ = [
'expand',
'makedirs',
'find_components',
'dropbox_api',
]
def expand(template, extras, template_class=Template):... | apache-2.0 | Python |
d4b29f09dae33c6ea0456a13968092c46e9cea94 | fix installing | DeadSix27/python_cross_compile_script | packages/dependencies/mujs.py | packages/dependencies/mujs.py | {
'repo_type' : 'git',
'url' : 'git://git.ghostscript.com/mujs.git',
# 'branch' : '3430d9a06d6f8a3696e2bbdca7681937e60ca7a9',
'needs_configure' : False,
'build_options' : '{make_prefix_options} prefix={target_prefix} HAVE_READLINE=no',
'install_options' : '{make_prefix_options} prefix={target_prefix} HAVE_READLIN... | {
'repo_type' : 'git',
'url' : 'git://git.ghostscript.com/mujs.git',
# 'branch' : '3430d9a06d6f8a3696e2bbdca7681937e60ca7a9',
'needs_configure' : False,
'build_options' : '{make_prefix_options} prefix={target_prefix} HAVE_READLINE=no',
'install_options' : '{make_prefix_options} prefix={target_prefix} HAVE_READLIN... | mpl-2.0 | Python |
d6879c5b4a71a2427a830e98998606ed2586c559 | fix tests post template refactor | sbnoemi/django-mapomatic | mapomatic/tests.py | mapomatic/tests.py | from django.utils import unittest
from django.template import Template, loader, Context
from mapomatic.models import MapPoint
class TemplateTestCase(unittest.TestCase):
def setUp(self):
MapPoint.objects.create(name='NYC', location='POINT(-73.9869510 40.7560540)')
MapPoint.objects.create(name='Atlan... | from django.utils import unittest
from django.template import Template, loader, Context
from mapomatic.models import MapPoint
class TemplateTestCase(unittest.TestCase):
def setUp(self):
MapPoint.objects.create(name='NYC', location='POINT(-73.9869510 40.7560540)')
MapPoint.objects.create(name='Atlan... | bsd-3-clause | Python |
fa1face4fe5f83d835436ffddc96ed62ba67b4a9 | Fix detect_phantomjs() when shutil.which() returns None (#7887) | mindriot101/bokeh,bokeh/bokeh,timsnyder/bokeh,mindriot101/bokeh,aavanian/bokeh,aavanian/bokeh,dennisobrien/bokeh,stonebig/bokeh,aavanian/bokeh,jakirkham/bokeh,jakirkham/bokeh,Karel-van-de-Plassche/bokeh,aavanian/bokeh,dennisobrien/bokeh,timsnyder/bokeh,bokeh/bokeh,jakirkham/bokeh,mindriot101/bokeh,dennisobrien/bokeh,st... | bokeh/util/dependencies.py | bokeh/util/dependencies.py | ''' Utilities for checking dependencies
'''
from importlib import import_module
import logging
import shutil
from subprocess import Popen, PIPE
from packaging.version import Version as V
from ..settings import settings
logger = logging.getLogger(__name__)
def import_optional(mod_name):
''' Attempt to import a... | ''' Utilities for checking dependencies
'''
from importlib import import_module
import logging
import shutil
from subprocess import Popen, PIPE
from packaging.version import Version as V
from ..settings import settings
logger = logging.getLogger(__name__)
def import_optional(mod_name):
''' Attempt to import a... | bsd-3-clause | Python |
78f503a4793513c199da34189fb6b3406e2c2d56 | Update test_runtime_scheduling.py | idlesign/uwsgiconf,idlesign/uwsgiconf | tests/runtime/test_runtime_scheduling.py | tests/runtime/test_runtime_scheduling.py | import pytest
from uwsgiconf.runtime.scheduling import *
def test_timers():
@register_timer(20)
def fire1():
pass
@register_timer_rb(3)
def fire2():
pass
@pytest.mark.xfail(reason='Flacky fail due to a date change. Need to change test someday')
def test_cron():
@register_cron... | import pytest
from uwsgiconf.runtime.scheduling import *
def test_timers():
@register_timer(20)
def fire1():
pass
@register_timer_rb(3)
def fire2():
pass
def test_cron():
@register_cron(hour=-3)
def fire1():
pass
with pytest.raises(RuntimeConfigurationError):... | bsd-3-clause | Python |
9c1b697900ab08ff32f8fc11dfd73a74af26cf2d | Make copy of rebuild_export_task() | qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/export/tasks.py | corehq/apps/export/tasks.py | from celery.task import task
from corehq.apps.export.export import get_export_file
from couchexport.models import Format
from couchexport.tasks import escape_quotes
from soil.util import expose_cached_download
@task
def populate_export_download_task(export_instances, filters, download_id, filename=None, expiry=10 * ... | from celery.task import task
from corehq.apps.export.export import get_export_file
from couchexport.models import Format
from couchexport.tasks import escape_quotes
from soil.util import expose_cached_download
@task
def populate_export_download_task(export_instances, filters, download_id, filename=None, expiry=10 * ... | bsd-3-clause | Python |
dfd872fe5a6c945b847a3b3ec2272300d2169233 | Move strip to rules | jogo/hackingignores | hackingignores.py | hackingignores.py | #!/usr/bin/python3
import collections
import glob
# Run from openstack git org directory
# Format
# Rule: [repo]
result = collections.defaultdict(list)
for file in glob.glob("*/tox.ini"):
repo = file.split('/')[0]
with open(file) as f:
for line in f.readlines():
if line.startswith("igno... | #!/usr/bin/python3
import collections
import glob
# Run from openstack git org directory
# Format
# Rule: [repo]
result = collections.defaultdict(list)
for file in glob.glob("*/tox.ini"):
repo = file.split('/')[0]
with open(file) as f:
for line in f.readlines():
if line.startswith("igno... | apache-2.0 | Python |
6dca03f7afef72dcbaab588870e21cfcd4420161 | hide some projects on projects page | ClintonMorrison/personal-website,ClintonMorrison/personal-website,ClintonMorrison/personal-website,ClintonMorrison/personal-website,ClintonMorrison/personal-website,ClintonMorrison/personal-website | pages/controllers/projects.py | pages/controllers/projects.py | from core import database as database
from pprint import pprint
import core.functions
def get_page_data(path, get, post, variables):
data = {}
projects_table = database.Table('project')
projects = projects_table.filter(
orderBy = 'date_published',
order = 'DESC',
limit = 15
)
formatted_projects... | from core import database as database
from pprint import pprint
import core.functions
def get_page_data(path, get, post, variables):
data = {}
projects_table = database.Table('project')
projects = projects_table.filter(
orderBy = 'date_published',
order = 'DESC',
limit = 15
)
for project in pro... | apache-2.0 | Python |
1a7541eb747f3518f58df10a14a0ef8262212ad6 | Check order and set behavior on ordered set queue | javrasya/watchdog,edevil/watchdog,edevil/watchdog,ymero/watchdog,mconstantin/watchdog,ymero/watchdog,gorakhargosh/watchdog,mconstantin/watchdog,gorakhargosh/watchdog,edevil/watchdog,teleyinex/watchdog,glorizen/watchdog,teleyinex/watchdog,javrasya/watchdog,edevil/watchdog,ymero/watchdog,glorizen/watchdog,mconstantin/wat... | tests/test_watchdog_utils_collections.py | tests/test_watchdog_utils_collections.py | # -*- coding: utf-8 -*-
import threading
import time
from nose.tools import *
try:
import queue
except ImportError:
import Queue as queue
from watchdog.events import DirModifiedEvent, FileModifiedEvent
from watchdog.utils.collections import OrderedSetQueue
class TestOrderedSetQueue:
def test_behavior_or... | # -*- coding: utf-8 -*-
import threading
import time
from nose.tools import *
try:
import queue
except ImportError:
import Queue as queue
from watchdog.events import DirModifiedEvent, FileModifiedEvent
from watchdog.utils.collections import OrderedSetQueue
class TestOrderedSetQueue:
def test_behavior_se... | apache-2.0 | Python |
29eb3661ace0f3dd62d210621ebd24ef95261162 | Make sure timestamp of log message is UTC when it goes into DB | jay3sh/logfire,jay3sh/logfire | src/listen.py | src/listen.py |
import redis
import re
from common import get_db
from datetime import datetime
MSGPATTERN = re.compile('^(\w+)\|(\d)\|([\s\S]*)$')
CHANNEL = 'logfire'
def listen(args):
global MSGPATTERN
rserver = redis.Redis('localhost')
pubsub = rserver.pubsub()
pubsub.subscribe(CHANNEL)
db = get_db(args.mongohost)
... |
import redis
import re
from common import get_db
from datetime import datetime
MSGPATTERN = re.compile('^(\w+)\|(\d)\|([\s\S]*)$')
CHANNEL = 'logfire'
def listen(args):
global MSGPATTERN
rserver = redis.Redis('localhost')
pubsub = rserver.pubsub()
pubsub.subscribe(CHANNEL)
db = get_db(args.mongohost)
... | mit | Python |
2ecf281813a20f50e5f1ab281ec7ba17d1a3f982 | Fix an old keyname | influence-usa/pupa,opencivicdata/pupa,rshorey/pupa,datamade/pupa,influence-usa/pupa,opencivicdata/pupa,mileswwatkins/pupa,rshorey/pupa,datamade/pupa,mileswwatkins/pupa | pupa/scrape/jurisdiction.py | pupa/scrape/jurisdiction.py | from pupa.models.organization import Organization
class Jurisdiction(object):
""" Base class for a jurisdiction """
# schema objects
name = None
url = None
chambers = {}
terms = None
session_details = None
feature_flags = []
building_maps = []
provides = []
parties = []
... | from pupa.models.organization import Organization
class Jurisdiction(object):
""" Base class for a jurisdiction """
# schema objects
name = None
url = None
chambers = {}
terms = None
session_details = None
feature_flags = []
capitol_maps = []
provides = []
parties = []
... | bsd-3-clause | Python |
fabaa09cb36e519100dc13752848acd9b8464e32 | Use FluxStandardAction instead of CSRFResponse | SUNET/eduid-webapp,SUNET/eduid-webapp,SUNET/eduid-webapp | src/eduid_webapp/jsconfig/views.py | src/eduid_webapp/jsconfig/views.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016 NORDUnet A/S
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# ... | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016 NORDUnet A/S
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# ... | bsd-3-clause | Python |
4d02ff34582974ee6cbeb6413b132984b10feef8 | Make processresult.pipeline and processresult.record importable from package | jstutters/Plumbium | plumbium/__init__.py | plumbium/__init__.py | from processresult import pipeline, record
| mit | Python | |
941ab0315d71fbea552b0ab12d75e4d8968adfce | Change the way we pass resolution to blender | Xyene/cube2sphere | cube2sphere/blender_init.py | cube2sphere/blender_init.py | __author__ = 'Xyene'
import bpy
import sys
import math
for scene in bpy.data.scenes:
scene.render.resolution_x = int(sys.argv[-5])
scene.render.resolution_y = int(sys.argv[-4])
scene.render.resolution_percentage = 100
scene.render.use_border = False
for i, name in enumerate(['bottom', 'top', 'left',... | __author__ = 'Xyene'
import bpy
import sys
import math
bpy.context.scene.cycles.resolution_x = int(sys.argv[-5])
bpy.context.scene.cycles.resolution_y = int(sys.argv[-4])
for i, name in enumerate(['bottom', 'top', 'left', 'right', 'back', 'front']):
bpy.data.images[name].filepath = "%s" % sys.argv[-6 - i]
came... | agpl-3.0 | Python |
04cede2c53ce5302257d968674b345aa679b1981 | Make ArrayRead and ArrayLen comparable | megajanlott/cbor-decoder | cbor/type/Array.py | cbor/type/Array.py | import cbor.CBORStream
import cbor.MajorType
import cbor.State
class ArrayInfo(cbor.State.State):
def run(self, stream: cbor.CBORStream.CBORStream, handler):
info = stream.read(1)
length = ord(info) & 0b00011111
handler('[')
if length < 24:
return [cbor.MajorType.Major... | import cbor.CBORStream
import cbor.MajorType
import cbor.State
class ArrayInfo(cbor.State.State):
def run(self, stream: cbor.CBORStream.CBORStream, handler):
info = stream.read(1)
length = ord(info) & 0b00011111
handler('[')
if length < 24:
return [cbor.MajorType.Major... | mit | Python |
345143db7bc7026fe3307560e4bb4789bfc1867a | Support concurrent updates. | Scifabric/pybossa,Scifabric/pybossa,PyBossa/pybossa,PyBossa/pybossa | pybossa/leaderboard/jobs.py | pybossa/leaderboard/jobs.py | # -*- coding: utf8 -*-
# This file is part of PYBOSSA.
#
# Copyright (C) 2015 Scifabric LTD.
#
# PYBOSSA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | # -*- coding: utf8 -*-
# This file is part of PYBOSSA.
#
# Copyright (C) 2015 Scifabric LTD.
#
# PYBOSSA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | agpl-3.0 | Python |
ad8d69e4c5447297db535f8ca9d1ac00e85f01e8 | Use pywsgi.py instead of wsgi (better chunked handling) | ewdurbin/httpbin,luhkevin/httpbin,Jaccorot/httpbin,yemingm/httpbin,shaunstanislaus/httpbin,mozillazg/bustard-httpbin,postmanlabs/httpbin,logonmy/httpbin,admin-zhx/httpbin,vscarpenter/httpbin,Lukasa/httpbin,Lukasa/httpbin,ashcoding/httpbin,yangruiyou85/httpbin,pestanko/httpbin,luosam1123/httpbin,mansilladev/httpbin,moja... | httpbin/runner.py | httpbin/runner.py | # -*- coding: utf-8 -*-
"""
httpbin.runner
~~~~~~~~~~~~~~
This module serves as a command-line runner for httpbin, powered by
gunicorn.
"""
import sys
from gevent.pywsgi import WSGIServer
from httpbin import app
def main():
try:
port = int(sys.argv[1])
except (KeyError, ValueError, IndexError):
... | # -*- coding: utf-8 -*-
"""
httpbin.runner
~~~~~~~~~~~~~~
This module serves as a command-line runner for httpbin, powered by
gunicorn.
"""
import sys
from gevent.wsgi import WSGIServer
from httpbin import app
def main():
try:
port = int(sys.argv[1])
except (KeyError, ValueError, IndexError):
... | isc | Python |
0093bc2dd4dc38e0dd1985eebad3e9791de1bb3d | Bump version to 1.0. | erikrose/pyelasticsearch | pyelasticsearch/__init__.py | pyelasticsearch/__init__.py | from __future__ import absolute_import
from pyelasticsearch.client import ElasticSearch
from pyelasticsearch.exceptions import (Timeout, ConnectionError,
ElasticHttpError,
InvalidJsonResponseError,
E... | from __future__ import absolute_import
from pyelasticsearch.client import ElasticSearch
from pyelasticsearch.exceptions import (Timeout, ConnectionError,
ElasticHttpError,
InvalidJsonResponseError,
E... | bsd-3-clause | Python |
c91fb4c13828d30d5d837dd813abef4cbc6f635e | bump version | radhermit/pychroot | chroot/_version.py | chroot/_version.py | __version__ = '0.9.11'
| __version__ = '0.9.10'
| bsd-3-clause | Python |
1c601e86abdb1b8bc78378f9b9ca9048d014f96a | Fix database not being cleared after each test | m4tx/techswarm-server | features/environment.py | features/environment.py | import os
import tempfile
from flask import json
import tsserver
# If set to True, each time the test is run, new database is created as a
# temporary file. If the value is equal to False, tests will be using SQLite
# in-memory database.
USE_DB_TEMP_FILE = False
def before_scenario(context, scenario):
if USE_... | import os
import tempfile
from flask import json
import tsserver
# If set to True, each time the test is run, new database is created as a
# temporary file. If the value is equal to False, tests will be using SQLite
# in-memory database.
USE_DB_TEMP_FILE = False
def before_scenario(context, scenario):
if USE_... | mit | Python |
b1ce33f9ccb6a22f9c33fdb173477291972e1c40 | Prepare 1.6.1 release | gregmuellegger/django-floppyforms,gregmuellegger/django-floppyforms,gregmuellegger/django-floppyforms | floppyforms/__init__.py | floppyforms/__init__.py | # flake8: noqa
from django.forms import (BaseModelForm, model_to_dict, fields_for_model,
ValidationError, Media, MediaDefiningClass)
from .fields import *
from .forms import *
from .models import *
from .widgets import *
try:
# Django < 1.9
from django.forms import save_instance
exce... | # flake8: noqa
from django.forms import (BaseModelForm, model_to_dict, fields_for_model,
ValidationError, Media, MediaDefiningClass)
from .fields import *
from .forms import *
from .models import *
from .widgets import *
try:
# Django < 1.9
from django.forms import save_instance
exce... | bsd-3-clause | Python |
ec75c01b83ae75980c21d5fad3653d87a36e3509 | update worst-case accuracy - it's actually 35km for gsm cells (ignoring extended range which would bump it to 120 km) | mozilla/ichnaea,therewillbecode/ichnaea,mozilla/ichnaea,therewillbecode/ichnaea,therewillbecode/ichnaea,mozilla/ichnaea,mozilla/ichnaea | ichnaea/search.py | ichnaea/search.py | from statsd import StatsdTimer
from ichnaea.db import Cell, RADIO_TYPE
from ichnaea.decimaljson import quantize
def search_cell(session, data):
radio = RADIO_TYPE.get(data['radio'], 0)
cell = data['cell'][0]
mcc = cell['mcc']
mnc = cell['mnc']
lac = cell['lac']
cid = cell['cid']
query = ... | from statsd import StatsdTimer
from ichnaea.db import Cell, RADIO_TYPE
from ichnaea.decimaljson import quantize
def search_cell(session, data):
radio = RADIO_TYPE.get(data['radio'], 0)
cell = data['cell'][0]
mcc = cell['mcc']
mnc = cell['mnc']
lac = cell['lac']
cid = cell['cid']
query = ... | apache-2.0 | Python |
5c08535a6c188c8f06b557da937dd98e83ca1026 | fix regex for '@@ -a,b +c,d @@' | felixcarmona/coveragit | coveragit/diff.py | coveragit/diff.py | import re
from subprocess import Popen, PIPE
class AdditionsFinder(object):
@staticmethod
def get_additions_for_base(base, repository_path):
additions = {}
command = ['git', 'diff', base, '--unified=0']
process = Popen(command, stdout=PIPE, cwd=repository_path)
raw_diff = pro... | import re
from subprocess import Popen, PIPE
class AdditionsFinder(object):
@staticmethod
def get_additions_for_base(base, repository_path):
additions = {}
command = ['git', 'diff', base, '--unified=0']
process = Popen(command, stdout=PIPE, cwd=repository_path)
raw_diff = pro... | mit | Python |
4a23339812b7049544f9cf024e5029f649d2f0c6 | Fix editor admin routes | genzgd/lampost_lib | lampost/editor/admin.py | lampost/editor/admin.py | import inspect
from lampost.server.link import link_route
from lampost.di.resource import Injected, module_inject
perm = Injected('perm')
module_inject(__name__)
admin_ops = {}
def admin_op(func):
a_spec = inspect.getargspec(func)
if a_spec.defaults:
params = [''] * (len(a_spec.args) - len(a_spec.... | import inspect
from lampost.server.link import link_route
from lampost.di.resource import Injected, module_inject
perm = Injected('perm')
module_inject(__name__)
admin_ops = {}
def admin_op(func):
a_spec = inspect.getargspec(func)
if a_spec.defaults:
params = [''] * (len(a_spec.args) - len(a_spec.... | mit | Python |
95091941842e816e77e8194ad2865b62984dac41 | Test account pages | okfse/froide,ryankanno/froide,ryankanno/froide,fin/froide,fin/froide,catcosmo/froide,CodeforHawaii/froide,CodeforHawaii/froide,LilithWittmann/froide,fin/froide,ryankanno/froide,okfse/froide,fin/froide,ryankanno/froide,catcosmo/froide,LilithWittmann/froide,okfse/froide,stefanw/froide,CodeforHawaii/froide,catcosmo/froide... | froide/account/tests.py | froide/account/tests.py | from django.test import TestCase
from django.core.urlresolvers import reverse
class AccountTest(TestCase):
fixtures = ['auth.json', 'publicbodies.json', 'foirequest.json']
def test_account_page(self):
ok = self.client.login(username='sw', password='wrong')
self.assertFalse(ok)
ok = sel... | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.