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 |
|---|---|---|---|---|---|---|---|---|
26924b1e88851cd4fbdb41914a824c3b9a727658 | fix oops | mono/bockbuild,mono/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild | packages/mono-master.py | packages/mono-master.py | import os
class MonoMasterPackage(Package):
def __init__(self):
Package.__init__(self, 'mono', os.getenv('MONO_VERSION'),
sources = [os.getenv('MONO_REPOSITORY') or 'git://github.com/mono/mono.git'],
revision = os.getenv('MONO_BUILD_REVISION'),
configure_flags = [
'--enable-nls=no',
'--with-ikvm=y... | import os
class MonoMasterPackage(Package):
def __init__(self):
Package.__init__(self, 'mono', os.getenv('MONO_VERSION'),
sources = [os.getenv('MONO_REPOSITORY') or 'git://github.com/mono/mono.git'],
revision = os.getenv('MONO_BUILD_REVISION'),
configure_flags = [
'--enable-nls=no',
'--with-ikvm=y... | mit | Python |
c8a1314896d86249c15934925afd218688b2863b | fix wsgi app | tracon/infotv-tracon | infotv_tracon/wsgi.py | infotv_tracon/wsgi.py | b"""
WSGI config for infotv_tracon project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "infotv_tracon.settings")
from ... | b"""
WSGI config for kompassi_oauth2_example project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kompassi_oauth2_examp... | mit | Python |
f2c489d7174abae92732ab791fdb6383547af466 | Send tests for enabled & disabled. | saltduck/OpenBazaar-Server,OpenBazaar/Network,OpenBazaar/Network,OpenBazaar/OpenBazaar-Server,saltduck/OpenBazaar-Server,tyler-smith/OpenBazaar-Server,cpacia/OpenBazaar-Server,OpenBazaar/Network,saltduck/OpenBazaar-Server,tyler-smith/OpenBazaar-Server,cpacia/OpenBazaar-Server,cpacia/OpenBazaar-Server,OpenBazaar/OpenBaz... | market/tests/test_smtpnotification.py | market/tests/test_smtpnotification.py | from twisted.trial import unittest
from twisted.python import log
from mock import patch, MagicMock
import mock
from market.smtpnotification import SMTPNotification
class MarketSMTPTest(unittest.TestCase):
def setUp(self):
self.catcher = []
observer = self.catcher.append
log.addObserver(o... | from twisted.trial import unittest
from twisted.python import log
from mock import MagicMock
from market.smtpnotification import SMTPNotification
class MarketSMTPTest(unittest.TestCase):
def setUp(self):
self.catcher = []
observer = self.catcher.append
log.addObserver(observer)
se... | mit | Python |
2aab00dcf8b358c2a559fa29ddd175918e9e4adb | Remove tfds.features.text.Xyz from the public API. | tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets,tensorflow/datasets | tensorflow_datasets/core/features/__init__.py | tensorflow_datasets/core/features/__init__.py | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | apache-2.0 | Python |
a6103a28540051a284f7b8fda016a7c6f45afb45 | bump version to 2.2.0 | Beeblio/django-vote | vote/__init__.py | vote/__init__.py | VERSION = (2, 2, 0)
default_app_config = 'vote.apps.VoteAppConfig'
| VERSION = (2, 1, 7)
default_app_config = 'vote.apps.VoteAppConfig'
| bsd-3-clause | Python |
3140f320e14d9072671eeabe18748204214dee89 | Fix replace | wandb/client,wandb/client,wandb/client | wandb/jupyter.py | wandb/jupyter.py | import wandb
class Run(object):
def __init__(self, run=None):
self.run = run or wandb.run
def _repr_html_(self):
url = self.run.get_url()+"?jupyter=true"
return '''<iframe src="%s" style="border:none;width:100%%;height:420px">
</iframe>''' % url
| import wandb
class Run(object):
def __init__(self, run=None):
self.run = run or wandb.run
def _repr_html_(self):
url = self.run.get_url().replace('https://app.wandb.ai',
'http://app.test') + "?jupyter=true"
return '''<iframe src="%s" style="bor... | mit | Python |
b4763d82dcfd7423f63ca88a9206d9a6ad5d330f | Remove unused training code from Tradingresults | lukovkin/ufcnn-keras,lukovkin/ufcnn-keras | models/a3c/Tradingresults.py | models/a3c/Tradingresults.py | # -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
from a3c_util import choose_action
from game_state import GameState
from game_ac_network import GameACFFNetwork, GameACLSTMNetwork
from constants import ACTION_SIZE
from constants import PARALLEL_SIZE
from constants import CHECKPOINT_DIR
from constant... | # -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
import random
from a3c_util import choose_action
from game_state import GameState
from game_ac_network import GameACFFNetwork, GameACLSTMNetwork
from a3c_training_thread import A3CTrainingThread
from rmsprop_applier import RMSPropApplier
from constant... | mit | Python |
954c7c88563deaad69b98bc9fd961b7cf929f41b | Update to next version | darashenka/aem-cmd,darashenka/aem-cmd,darashenka/aem-cmd | acmd/__init__.py | acmd/__init__.py | # coding: utf-8
__version__ = '0.9.1b'
# Standard error codes that can be returned from any tool.
OK = 0
USER_ERROR = 4711
CONFIG_ERROR = 4712
SERVER_ERROR = 4713
INTERNAL_ERROR = 4714
import acmd.logger
init_log = acmd.logger.init_log
log = acmd.logger.log
warning = acmd.logger.warning
error = acmd.logger.error
i... | # coding: utf-8
__version__ = '0.9.0'
# Standard error codes that can be returned from any tool.
OK = 0
USER_ERROR = 4711
CONFIG_ERROR = 4712
SERVER_ERROR = 4713
INTERNAL_ERROR = 4714
import acmd.logger
init_log = acmd.logger.init_log
log = acmd.logger.log
warning = acmd.logger.warning
error = acmd.logger.error
im... | mit | Python |
76ee4cacbcc67b51bfd42b894042d6b0eee9d908 | Revert changes in release/ dir | CartoDB/crankshaft,CartoDB/crankshaft | release/python/0.0.1/crankshaft/crankshaft/__init__.py | release/python/0.0.1/crankshaft/crankshaft/__init__.py | import random_seeds
import clustering
| import random_seeds
import clustering
import segmentation
| bsd-3-clause | Python |
aa13c8b54a7ea25fb8166a1836427fcf00726390 | remove a redundant word 'invocation' | luci/luci-py,luci/luci-py,luci/luci-py,luci/luci-py | appengine/swarming/server/resultdb.py | appengine/swarming/server/resultdb.py | # Copyright 2020 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Functions to communicate with ResultDB for swarming tasks."""
import logging
import uuid
from google.appengine.api import app_identity
from go... | # Copyright 2020 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Functions to communicate with ResultDB for swarming tasks."""
import logging
import uuid
from google.appengine.api import app_identity
from go... | apache-2.0 | Python |
20399522475ca3f2e936e54b891f10205821d38c | add assertion to ensure update_token from ResultDB | luci/luci-py,luci/luci-py,luci/luci-py,luci/luci-py | appengine/swarming/server/resultdb.py | appengine/swarming/server/resultdb.py | # Copyright 2020 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Functions to communicate with ResultDB for swarming tasks."""
import logging
import uuid
from google.appengine.api import app_identity
from go... | # Copyright 2020 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Functions to communicate with ResultDB for swarming tasks."""
import logging
import uuid
from google.appengine.api import app_identity
from go... | apache-2.0 | Python |
98bfa1f697683fe27ba831c4f258361adc51e765 | improve acis exploration tools | mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf | exploration/acis/acis-extractor.py | exploration/acis/acis-extractor.py | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
from typing import cast
import sys
from pathlib import Path
from argparse import ArgumentParser
import ezdxf
from ezdxf.entities import Body
DIR = Path("~/Desktop/Outbox").expanduser()
if not DIR.exists():
DIR = Path(".")
SEARCH_TYPES = {"3DSOLID", "RE... | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
from typing import cast
import sys
from pathlib import Path
from argparse import ArgumentParser
import ezdxf
from ezdxf.entities import Body
DIR = Path("~/Desktop/Outbox").expanduser()
if not DIR.exists():
DIR = Path(".")
SEARCH_TYPES = {"3DSOLID", "RE... | mit | Python |
0635109abeabc94b6c908379064947f154cab96f | Improve a snippet. | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/numpy/savetxt_with_header.py | python/numpy/savetxt_with_header.py | #!/usr/bin/env python
import numpy as np
def save_np_array(output_file_path, data_array, header_list):
np.savetxt(output_file_path,
data_array,
#fmt="%10.5f",
#delimiter=" ",
header="; ".join(header_list),
#comments="# " #... | #!/usr/bin/env python
import numpy as np
a = np.random.rand(10, 4)
fd = open("test.dat", "w")
fd.write("# This is a test\n")
fd.write("# with a header\n")
np.savetxt(fd, a)
fd.close()
| mit | Python |
dc4ba659069eb7f3754024b6f8faa05002044889 | use Markdown parse mode | kibitzr/kibitzr,kibitzr/kibitzr | kibitzr/notifier/telegram.py | kibitzr/notifier/telegram.py | from __future__ import absolute_import
import logging
from ..conf import settings
logger = logging.getLogger(__name__)
class TelegramBot(object):
def __init__(self, chat_id=None):
from telegram.bot import Bot
telegram_creds = settings().creds['telegram']
token = telegram_creds['token']
... | from __future__ import absolute_import
import logging
from ..conf import settings
logger = logging.getLogger(__name__)
class TelegramBot(object):
def __init__(self, chat_id=None):
from telegram.bot import Bot
telegram_creds = settings().creds['telegram']
token = telegram_creds['token']
... | mit | Python |
14df19f84ff9255359194ec99cb8e941d0e713da | raise for bad statuses | alfredodeza/chacractl,ceph/chacractl | chacractl/api/repos.py | chacractl/api/repos.py | import os
from textwrap import dedent
import logging
import requests
from tambo import Transport
import chacractl
from chacractl.decorators import catches, requests_errors
logger = logging.getLogger(__name__)
class Repo(object):
_help = dedent("""
Operate on repositories on a remote chacra instance. Both `r... | import os
from textwrap import dedent
import logging
import requests
from tambo import Transport
import chacractl
from chacractl.decorators import catches, requests_errors
logger = logging.getLogger(__name__)
class Repo(object):
_help = dedent("""
Operate on repositories on a remote chacra instance. Both `r... | mit | Python |
53bcccb33f7c49b8cfa854b7998a26d7602ed133 | Remove extra parens | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline | luigi/tasks/quickgo/load_annotations.py | luigi/tasks/quickgo/load_annotations.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | apache-2.0 | Python |
a981d2eff81eec01d3663c5530e79852619e9d7e | Change "pcap" to "pcapy" | openstack/steth,openstack/steth | steth/agent/drivers/pcap_driver.py | steth/agent/drivers/pcap_driver.py | # Copyright 2016 UnitedStack, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | # Copyright 2016 UnitedStack, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | apache-2.0 | Python |
0b42244a2fe47e58f9601f9eac352b2accc6c0b7 | Add missing import | SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci | mrbelvedereci/build/views.py | mrbelvedereci/build/views.py | from datetime import datetime
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.http import HttpResponseForbidden
from django.shortcuts import get_object_or_404
from ansi2html import Ansi2HTMLConverter
from mrbelvedereci.build.models import Build
from mrbelvedereci.build.task... | from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.http import HttpResponseForbidden
from django.shortcuts import get_object_or_404
from ansi2html import Ansi2HTMLConverter
from mrbelvedereci.build.models import Build
from mrbelvedereci.build.tasks import run_build
from mrbelv... | bsd-3-clause | Python |
04dc7f98d3a21db58237ecc176c2b09e6589b263 | remove unneeded imports | geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/drf-utm-zone-info,geometalab/drf-utm-zone-info | tests/conversion/converters/converter_test.py | tests/conversion/converters/converter_test.py | import pytest
import osmaxx.conversion.formats
from osmaxx.conversion.converters.converter import Conversion
format_list = osmaxx.conversion.formats.FORMAT_DEFINITIONS.keys()
@pytest.fixture(params=format_list)
def conversion_format(request):
return request.param
def test_start_format_extraction(conversion_fo... | import pytest
import osmaxx.conversion.formats
from osmaxx.conversion.converters.converter import Conversion
from osmaxx.conversion.converters.converter_garmin.garmin import Garmin
from osmaxx.conversion.converters.converter_gis.gis import GISConverter
format_list = osmaxx.conversion.formats.FORMAT_DEFINITIONS.keys()... | mit | Python |
5f6be35ccd68d89a5ca88dba154f6cd25c49d59d | use rstrip | gmimano/commcaretest,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,gmimano/commcaretest,gmimano/commcaretest,qedsoftware/... | custom/openlmis/api.py | custom/openlmis/api.py | from datetime import datetime
import json
import feedparser
import time
import requests
from custom.openlmis.exceptions import OpenLMISAPIException
class RssMetadata(object):
def __init__(self, id, updated, metadata):
self.id = id
self.updated = updated
self.metadata = metadata
@clas... | from datetime import datetime
import json
import feedparser
import time
import requests
from custom.openlmis.exceptions import OpenLMISAPIException
class RssMetadata(object):
def __init__(self, id, updated, metadata):
self.id = id
self.updated = updated
self.metadata = metadata
@clas... | bsd-3-clause | Python |
8604e8bfc7e177052413754bebe62ab20cd9e2df | handle new sendgrid error format | Cue/greplin-tornado-sendgrid | src/greplin/tornado/sendgrid.py | src/greplin/tornado/sendgrid.py | # Copyright 2011 The greplin-tornado-sendgrid Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | # Copyright 2011 The greplin-tornado-sendgrid Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | apache-2.0 | Python |
3a7f90792f2cdfd5332ddce2fdcba89e771d6b09 | Fix tests | songyi199111/sentry,kevinlondon/sentry,daevaorn/sentry,felixbuenemann/sentry,kevinlondon/sentry,BuildingLink/sentry,zenefits/sentry,ewdurbin/sentry,daevaorn/sentry,ewdurbin/sentry,looker/sentry,BuildingLink/sentry,ifduyue/sentry,gg7/sentry,ngonzalvez/sentry,fotinakis/sentry,zenefits/sentry,korealerts1/sentry,korealerts... | tests/sentry/api/endpoints/test_group_tags.py | tests/sentry/api/endpoints/test_group_tags.py | from django.core.urlresolvers import reverse
from sentry.models import GroupTagKey, GroupTagValue, TagKey, TagValue
from sentry.testutils import APITestCase
class GroupTagsTest(APITestCase):
def test_simple(self):
group = self.create_group()
group.data['tags'] = (['foo', 'bar'], ['biz', 'baz'])
... | from django.core.urlresolvers import reverse
from sentry.models import TagKey, GroupTagKey, GroupTagValue
from sentry.testutils import APITestCase
class GroupTagsTest(APITestCase):
def test_simple(self):
group = self.create_group()
group.data['tags'] = (['foo', 'bar'], ['biz', 'baz'])
grou... | bsd-3-clause | Python |
c33e9af2ec4edad618b64c1d6e6143969410ce42 | Address review comments. | mozilla/releasetasks,bhearsum/releasetasks,rail/releasetasks | releasetasks/__init__.py | releasetasks/__init__.py | # -*- coding: utf-8 -*-
from os import path
import yaml
import arrow
from chunkify import chunkify
from functools import partial
from jinja2 import Environment, FileSystemLoader, StrictUndefined
from thclient import TreeherderClient
from taskcluster.utils import stableSlugId, encryptEnvVar
from releasetasks.util impo... | # -*- coding: utf-8 -*-
from os import path
import yaml
import arrow
from chunkify import chunkify
from functools import partial
from jinja2 import Environment, FileSystemLoader, StrictUndefined
from thclient import TreeherderClient
from taskcluster.utils import stableSlugId, encryptEnvVar
from releasetasks.util impo... | mpl-2.0 | Python |
f38098c49f5525efae25fcc99d02f84ae4a07ef6 | add handshake events handling | facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift | build/fbcode_builder/specs/fbzmq.py | build/fbcode_builder/specs/fbzmq.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import specs.fbthrift as fbthrift
import specs.folly as folly
import specs.gmock as gmock
import ... | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import specs.fbthrift as fbthrift
import specs.folly as folly
import specs.gmock as gmock
import ... | apache-2.0 | Python |
67184ed2a4a925f1cc92993c9a09cfbf6dbdef2f | Use backported unittest. | jwg4/qual,jwg4/calexicon | calexicon/dates/tests/test_dates.py | calexicon/dates/tests/test_dates.py | import sys
if sys.hexversion < 0x02070000:
import unittest2 as unittest
else:
import unittest
from datetime import date, timedelta
from calexicon.dates import DateWithCalendar
class TestDateWithCalendar(unittest.TestCase):
def setUp(self):
date_dt = date(2010, 8, 1)
self.date_wc = DateW... | import unittest
from datetime import date, timedelta
from calexicon.dates import DateWithCalendar
class TestDateWithCalendar(unittest.TestCase):
def setUp(self):
date_dt = date(2010, 8, 1)
self.date_wc = DateWithCalendar(None, date_dt)
self.addTypeEqualityFunc(
DateWithCalend... | apache-2.0 | Python |
4584493476a68976aa589a6e0d117d8a8c94c8bb | update start time before run method | TheGhouls/oct-turrets,karec/oct-turrets | oct_turrets/turret.py | oct_turrets/turret.py | import time
from base import BaseTurret
from canon import Canon
class Turret(BaseTurret):
"""This class represent the classic turret for oct
"""
def start(self):
"""Start the turret and wait for the master to run the test
"""
while self.start_loop:
msg = self.master_pu... | from base import BaseTurret
from canon import Canon
class Turret(BaseTurret):
"""This class represent the classic turret for oct
"""
def start(self):
"""Start the turret and wait for the master to run the test
"""
while self.start_loop:
msg = self.master_publisher.recv_... | mit | Python |
2b69ef5cac62e5167185556f248e4618e24dd9aa | Add reference_date argument | Meisterschueler/ogn-python,Meisterschueler/ogn-python,Meisterschueler/ogn-python,glidernet/ogn-python,glidernet/ogn-python,Meisterschueler/ogn-python,glidernet/ogn-python,glidernet/ogn-python | ogn/gateway/manage.py | ogn/gateway/manage.py | import logging
from ogn.client import AprsClient
from ogn.gateway.process import process_beacon
from manager import Manager
manager = Manager()
logging_formatstr = '%(asctime)s - %(levelname).4s - %(name)s - %(message)s'
log_levels = ['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG']
@manager.command
def run(aprs_... | import logging
from ogn.client import AprsClient
from ogn.gateway.process import process_beacon
from manager import Manager
manager = Manager()
logging_formatstr = '%(asctime)s - %(levelname).4s - %(name)s - %(message)s'
log_levels = ['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG']
@manager.command
def run(aprs_... | agpl-3.0 | Python |
cd1551d13fca61ab40aa560d49ac526eb97dd0a5 | Update contract_mandate/models/contract.py | OCA/contract,OCA/contract,OCA/contract | contract_mandate/models/contract.py | contract_mandate/models/contract.py | # Copyright 2017 Carlos Dauden - Tecnativa <carlos.dauden@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class ContractContract(models.Model):
_inherit = 'contract.contract'
mandate_id = fields.Many2one(
comodel_name='account.banki... | # Copyright 2017 Carlos Dauden - Tecnativa <carlos.dauden@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class ContractContract(models.Model):
_inherit = 'contract.contract'
mandate_id = fields.Many2one(
comodel_name='account.banki... | agpl-3.0 | Python |
376364883ee06ad443a2eddfbe77d5772e8f443e | test account creation | ava-project/ava-website,ava-project/ava-website,ava-project/ava-website | website/user/tests.py | website/user/tests.py | import unittest
from django.test import Client
class DuplicateTest(unittest.TestCase):
def setUp(self):
self.client = Client()
def test_register(self):
# Issue a GET request.
response = self.client.post('/user/register/', {
'username': 'test',
'email': 'test@tes... | from django.test import TestCase
# Create your tests here.
| mit | Python |
85693a53d0039e83242e112e65f41c2b95b6e5ad | Enhance comments | bowen0701/algorithms_data_structures | lc0011_container_with_most_water.py | lc0011_container_with_most_water.py | """Leetcode 11. Container With Most Water
Medium
URL: https://leetcode.com/problems/container-with-most-water/
Given n non-negative integers a1, a2, ..., an , where each represents a
point at coordinate (i, ai). n vertical lines are drawn such that the two
endpoints of line i is at (i, ai) and (i, 0). Find two line... | """Leetcode 11. Container With Most Water
Medium
URL: https://leetcode.com/problems/container-with-most-water/
Given n non-negative integers a1, a2, ..., an , where each represents a
point at coordinate (i, ai). n vertical lines are drawn such that the two
endpoints of line i is at (i, ai) and (i, 0). Find two line... | bsd-2-clause | Python |
6a6963cea8ac1e852c9c84a6e9827132341f2888 | Disable the 'Add' option of comments in the admin, because the program crash when you try to create a new comment, is better delete this option for avoid this problem. | tuxinhang1989/mezzanine,Cicero-Zhao/mezzanine,spookylukey/mezzanine,adrian-the-git/mezzanine,jjz/mezzanine,saintbird/mezzanine,SoLoHiC/mezzanine,Skytorn86/mezzanine,spookylukey/mezzanine,batpad/mezzanine,christianwgd/mezzanine,geodesign/mezzanine,vladir/mezzanine,mush42/mezzanine,jerivas/mezzanine,industrydive/mezzanin... | mezzanine/generic/admin.py | mezzanine/generic/admin.py | from __future__ import unicode_literals
from django.contrib import admin
from django.contrib.comments.admin import CommentsAdmin
from django.utils.translation import ugettext_lazy as _
from mezzanine.conf import settings
from mezzanine.generic.models import ThreadedComment
class ThreadedCommentAdmin(CommentsAdmin):... | from __future__ import unicode_literals
from django.contrib import admin
from django.contrib.comments.admin import CommentsAdmin
from django.utils.translation import ugettext_lazy as _
from mezzanine.conf import settings
from mezzanine.generic.models import ThreadedComment
class ThreadedCommentAdmin(CommentsAdmin):... | bsd-2-clause | Python |
1d97a343e536159b5d1d572c76996cd6ae975255 | revert 365e4abca73d55fe4ba1b51a0057556ff8487c41 | bowlofstew/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes,bowlofstew/changes,wfxiang08/changes,wfxiang08/changes,dropbox/changes,bowlofstew/changes,dropbox/changes,wfxiang08/changes,dropbox/changes | changes/listeners/build_revision.py | changes/listeners/build_revision.py | import logging
from flask import current_app
from fnmatch import fnmatch
from changes.api.build_index import BuildIndexAPIView
from changes.config import db
from changes.models import ItemOption, Project
logger = logging.getLogger('build_revision')
def should_build_branch(revision, allowed_branches):
if not r... | import logging
from flask import current_app
from fnmatch import fnmatch
from changes.api.build_index import BuildIndexAPIView
from changes.config import db
from changes.models import ItemOption
logger = logging.getLogger('build_revision')
def should_build_branch(revision, allowed_branches):
if not revision.b... | apache-2.0 | Python |
6b37d496c1c129651d446b063b473f2ce2be9f9d | fix the shimclient to actually work by creating a 'fake' servercache object and pass the latest client version to the server. | fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary | repository/shimclient.py | repository/shimclient.py | #
# Copyright (c) 2005 rpath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/licen... | #
# Copyright (c) 2005 rpath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/licen... | apache-2.0 | Python |
fc6167dd73f99224b2b05dc5014e994fb6294582 | enable empty run list and empty attributes | Fewbytes/cosmo-plugin-chef-connection-configurer | chef_connection_configurer/tasks.py | chef_connection_configurer/tasks.py | #/*******************************************************************************
# * Copyright (c) 2013 GigaSpaces Technologies Ltd. All rights reserved
# *
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance with the License.
# * You may obtain a copy... | #/*******************************************************************************
# * Copyright (c) 2013 GigaSpaces Technologies Ltd. All rights reserved
# *
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance with the License.
# * You may obtain a copy... | apache-2.0 | Python |
914df318b5939e390cb0e87e19f3eff06632bc2c | Fix spelling Snapshot field description | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/backup/models.py | dbaas/backup/models.py | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from util.models import BaseModel
from logical.models import Database
import logging
LOG = logging.getLogger(__name__)
class BackupInfo(BaseModel):
SNAPSHOPT = 1
#DUMP = 2
TYPE_CHOICES = (
... | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from util.models import BaseModel
from logical.models import Database
import logging
LOG = logging.getLogger(__name__)
class BackupInfo(BaseModel):
SNAPSHOPT = 1
#DUMP = 2
TYPE_CHOICES = (
... | bsd-3-clause | Python |
dde0da92d1e0ba2eb0a844025cf8bbc7aef4fd68 | fix mongodb dump/restore with empty HOST or PORT | django-dbbackup/django-dbbackup,mjs7231/django-dbbackup,mjs7231/django-dbbackup,django-dbbackup/django-dbbackup | dbbackup/db/mongodb.py | dbbackup/db/mongodb.py | from dbbackup import utils
from .base import BaseCommandDBConnector
class MongoDumpConnector(BaseCommandDBConnector):
"""
MongoDB connector, creates dump with ``mongodump`` and restore with
``mongorestore``.
"""
dump_cmd = 'mongodump'
restore_cmd = 'mongorestore'
object_check = True
dr... | from dbbackup import utils
from .base import BaseCommandDBConnector
class MongoDumpConnector(BaseCommandDBConnector):
"""
MongoDB connector, creates dump with ``mongodump`` and restore with
``mongorestore``.
"""
dump_cmd = 'mongodump'
restore_cmd = 'mongorestore'
object_check = True
dr... | bsd-3-clause | Python |
03cbf444a89d2ec73afc0187bf9aa81be0c0b419 | Use Django's utility for parsing datetime from strings | Niklas9/django-unixdatetimefield,Niklas9/django-unixdatetimefield | django_unixdatetimefield/fields.py | django_unixdatetimefield/fields.py | import datetime
import time
from django.conf import settings
import django.db.models as models
from django.utils import timezone
from django.utils.dateparse import parse_datetime
class UnixDateTimeField(models.DateTimeField):
# TODO(niklas9):
# * should we take care of transforming between time zones in any... | import datetime
import time
from django.conf import settings
import django.db.models as models
from django.utils import timezone
class UnixDateTimeField(models.DateTimeField):
# TODO(niklas9):
# * should we take care of transforming between time zones in any way here ?
# * get default datetime format fr... | bsd-3-clause | Python |
d9d0b0539e91de0a685f0e71d015398b8346492c | add target function for test | CJ-Wright/scikit-beam,Nikea/scikit-xray,ericdill/scikit-xray,hainm/scikit-xray,tacaswell/scikit-beam,giltis/scikit-xray,ericdill/scikit-xray,scikit-xray/scikit-xray,danielballan/scikit-xray,licode/scikit-xray,danielballan/scikit-xray,scikit-xray/scikit-xray,ericdill/scikit-xray,licode/scikit-xray,CJ-Wright/scikit-beam,... | nsls2/fitting/fit_wrapper.py | nsls2/fitting/fit_wrapper.py | # Copyright (c) Brookhaven National Lab 2O14
# All rights reserved
# BSD License
# See LICENSE for full text
import numpy as np
import matplotlib.pyplot as plt
#from scipy.optimize import curve_fit
import scipy.optimize
def target(x, y, **args):
a = args["a"]
b = args["b"]
c = args["c"]
return a * ... | # Copyright (c) Brookhaven National Lab 2O14
# All rights reserved
# BSD License
# See LICENSE for full text
def fit(x, y, param_dict, fitting_engine, target_function, limit_dict=None,
engine_dict=None):
"""
Top-level function for fitting, magic and ponies
Parameters
----------
x : array... | bsd-3-clause | Python |
57bdaf54f3ac44da97835c6e878287f9981d6e54 | Update insecure dependency walker URL to HTTPS (#972) | kayhayen/Nuitka,kayhayen/Nuitka,kayhayen/Nuitka,kayhayen/Nuitka | nuitka/freezer/DependsExe.py | nuitka/freezer/DependsExe.py | # Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | # Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | apache-2.0 | Python |
0f63434e6a0657bc9041acf5d9ffc697711b66e0 | store raw request | david-farrar/exaproxy,PrFalken/exaproxy,jbfavre/exaproxy,david-farrar/exaproxy,PrFalken/exaproxy,jbfavre/exaproxy,david-farrar/exaproxy,PrFalken/exaproxy | lib/exaproxy/http/request.py | lib/exaproxy/http/request.py | # encoding: utf-8
"""
request.py
Created by Thomas Mangin on 2012-02-27.
Copyright (c) 2012 Exa Networks. All rights reserved.
"""
class Request (object):
def __init__ (self,request):
self.raw = request
method, self.uri, version = request.split()
self.method = method.upper()
self.version = version.split('/')... | # encoding: utf-8
"""
request.py
Created by Thomas Mangin on 2012-02-27.
Copyright (c) 2012 Exa Networks. All rights reserved.
"""
class Request (object):
def __init__ (self,request):
method, self.uri, version = request.split()
self.method = method.upper()
self.version = version.split('/')[-1]
def parse (sel... | bsd-2-clause | Python |
25db366201aa259b0f4f9afe0afe6be3d540b785 | Update print_current_status for v3 | nettube/mbtapuller,nettube/mbtapuller,nettube/mbtapuller | print_current_status.py | print_current_status.py | import db_objects as db
import Database
import datetime
session = Database.connect()
import ipdb; ipdb.set_trace()
past_bound = datetime.datetime.utcnow() - datetime.timedelta(hours=3)
for trip in session.query(db.Trip).filter(db.Trip.date < past_bound):
print("{}: {}".format(trip, trip.get_status(session)))
| import db_objects as db
import Database
import datetime
session = Database.connect()
for trip in session.query(db.Trip).filter(db.Trip.date == datetime.date.today()):
print "%s: %s" % (trip, trip.get_status(session))
| mit | Python |
971f68a0d08f919a0ed9db1b87783731d36fc3ec | Revert "test: Ensure docker is started before running sosrport" (#10406) | moraleslazaro/cockpit,cockpit-project/cockpit,mvollmer/cockpit,cockpituous/cockpit,deryni/cockpit,mvollmer/cockpit,mvollmer/cockpit,mvollmer/cockpit,andreasn/cockpit,deryni/cockpit,andreasn/cockpit,cockpituous/cockpit,deryni/cockpit,cockpituous/cockpit,cockpit-project/cockpit,garrett/cockpit,cockpituous/cockpit,andreas... | test/avocado/selenium-sosreport.py | test/avocado/selenium-sosreport.py | #!/usr/bin/python2
# we need to be able to find and import seleniumlib, so add this directory
import os
import sys
machine_test_dir = os.path.dirname(os.path.abspath(__file__))
if not machine_test_dir in sys.path:
sys.path.insert(1, machine_test_dir)
from avocado import main
from avocado.utils import process
fro... | #!/usr/bin/python2
# we need to be able to find and import seleniumlib, so add this directory
import os
import sys
machine_test_dir = os.path.dirname(os.path.abspath(__file__))
if not machine_test_dir in sys.path:
sys.path.insert(1, machine_test_dir)
from avocado import main
from avocado.utils import process
fro... | lgpl-2.1 | Python |
e8dda454470032e49c90fd194194fc648f328cd7 | Update requests.py | 10se1ucgo/cassiopeia,meraki-analytics/cassiopeia,robrua/cassiopeia | cassiopeia/dto/requests.py | cassiopeia/dto/requests.py | import urllib.parse
import urllib.request
import json
api_versions = {
"champion": "v1.2",
"league": "v2.5"
}
api_key = ""
region = "NA"
mirror = "NA"
printCalls = False
def get(request, params={}, static=False):
# Set server
server = "global" if static else mirror.lower()
# En... | import urllib.parse
import urllib.request
import json
api_versions = {
"champion": "v1.2",
"league": "v2.5"
}
api_key = "f1a5a360-a8e6-4788-8fc5-284769430480"
region = "NA"
mirror = "NA"
printCalls = False
def get(request, params={}, static=False):
# Set server
server = "global" if st... | mit | Python |
a13523d422d41ae6baa96439846fcfac2fac70e4 | add some functions in the skeleton of the proxy | hubsaysnuaa/odoo,rdeheele/odoo,frouty/odoogoeen,csrocha/OpenUpgrade,ujjwalwahi/odoo,lightcn/odoo,idncom/odoo,Kilhog/odoo,grap/OpenUpgrade,havt/odoo,windedge/odoo,0k/OpenUpgrade,abstract-open-solutions/OCB,apanju/GMIO_Odoo,odootr/odoo,Drooids/odoo,pedrobaeza/odoo,hoatle/odoo,ovnicraft/odoo,arthru/OpenUpgrade,KontorConsu... | addons/point_of_sale/controllers.py | addons/point_of_sale/controllers.py | # -*- coding: utf-8 -*-
import logging
try:
import openerp.addons.web.common.http as openerpweb
except ImportError:
import web.common.http as openerpweb
class PointOfSaleController(openerpweb.Controller):
_cp_path = '/pos'
@openerpweb.jsonrequest
def dispatch(self, request, iface, **kwargs):
... | # -*- coding: utf-8 -*-
import logging
try:
import openerp.addons.web.common.http as openerpweb
except ImportError:
import web.common.http as openerpweb
class PointOfSaleController(openerpweb.Controller):
_cp_path = '/pos'
@openerpweb.jsonrequest
def dispatch(self, request, iface, **kwargs):
... | agpl-3.0 | Python |
b71e19506f36de5fdc58baafd6060cb8d57541a2 | Remove use of substitution in standard validators. It forced usage of the values with custom messages. | skytreader/wtforms,Aaron1992/wtforms,cklein/wtforms,Xender/wtforms,jmagnusson/wtforms,pawl/wtforms,subyraman/wtforms,Aaron1992/wtforms,hsum/wtforms,pawl/wtforms,crast/wtforms,wtforms/wtforms | wtforms/validators.py | wtforms/validators.py | """
wtforms.validators
~~~~~~~~~~~~~~~~~~
TODO
:copyright: 2007-2008 by James Crasta, Thomas Johansson.
:license: MIT, see LICENSE.txt for details.
"""
import re
class ValidationError(ValueError):
pass
def email(message=u'Invalid email address.'):
def _email(form, field):
... | """
wtforms.validators
~~~~~~~~~~~~~~~~~~
TODO
:copyright: 2007-2008 by James Crasta, Thomas Johansson.
:license: MIT, see LICENSE.txt for details.
"""
import re
class ValidationError(ValueError):
pass
def email(message=u'Invalid email address.'):
def _email(form, field):
... | bsd-3-clause | Python |
8e671c9ca7417b53d01f3e44a15e74c4215c9d0f | debug code is now logged so this is not needed anymore | spreeker/democracygame,spreeker/democracygame,spreeker/democracygame | emocracy/api/urls.py | emocracy/api/urls.py | from django.conf.urls.defaults import *
from django.conf import settings
from piston.resource import Resource
from piston.authentication import OAuthAuthentication
from piston.emitters import Emitter
from piston.emitters import JSONEmitter
from emocracy.api.handlers import IssueHandler
from emocracy.api.handlers impo... | from django.conf.urls.defaults import *
from django.conf import settings
from piston.resource import Resource
from piston.authentication import OAuthAuthentication
from piston.emitters import Emitter
from piston.emitters import JSONEmitter
from emocracy.api.handlers import IssueHandler
from emocracy.api.handlers impo... | bsd-3-clause | Python |
f35fae51469cd8b9d7c214801162f1da6c4c1255 | Remove django group from the django admin | ofa/connect,ofa/connect,ofa/connect | open_connect/groups/admin.py | open_connect/groups/admin.py | """Admin functionality for group app"""
from django.contrib import admin
from django.contrib.auth.models import Group as AuthGroup
from open_connect.groups.models import Category
class CategoryAdmin(admin.ModelAdmin):
"""Admin for Group Categories"""
readonly_fields = [
'modified_at', 'created_at'
... | """Admin functionality for group app"""
from django.contrib import admin
from open_connect.groups.models import Category
class CategoryAdmin(admin.ModelAdmin):
"""Admin for Group Categories"""
readonly_fields = [
'modified_at', 'created_at'
]
admin.site.register(Category, CategoryAdmin)
| mit | Python |
2b05a59b09e72f263761dae2feac360f5abd1f82 | Remove some debug logging config | kfdm/promgen,kfdm/promgen,kfdm/promgen,kfdm/promgen | promgen/__init__.py | promgen/__init__.py | default_app_config = 'promgen.apps.PromgenConfig'
| default_app_config = 'promgen.apps.PromgenConfig'
import logging
logging.basicConfig(level=logging.DEBUG)
| mit | Python |
30a836c9603ebb9289887a766e3c053a14c23c9f | Update Arch package to 2.7 | biicode/packages,bowlofstew/packages,bowlofstew/packages,biicode/packages | archlinux/archpack_settings.py | archlinux/archpack_settings.py | #
# Biicode Arch Linux package settings.
#
# Check PKGBUILD_template docs for those settings and
# what they mean.
#
def settings():
return { "version": "2.7",
"release_number": "1",
"arch_deps": ["cmake>=3.0.2",
"zlib",
"glibc",
"sqlite",
... | #
# Biicode Arch Linux package settings.
#
# Check PKGBUILD_template docs for those settings and
# what they mean.
#
def settings():
return { "version": "2.6.1",
"release_number": "1",
"arch_deps": ["cmake>=3.0.2",
"zlib",
"glibc",
"sqlite",
... | bsd-2-clause | Python |
384cde9c1a180f55a834599e51e5be4dbb7526ce | add kwarg to test | diogo149/treeano,jagill/treeano,diogo149/treeano,diogo149/treeano,nsauder/treeano,jagill/treeano,nsauder/treeano,nsauder/treeano,jagill/treeano | canopy/handlers/tests/monitor_test.py | canopy/handlers/tests/monitor_test.py | import nose.tools as nt
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
import canopy
fX = theano.config.floatX
def test_time_call():
network = tn.InputNode("i", shape=()).network()
fn = canopy.handlers.handled_fn(
network,
[canopy.handle... | import nose.tools as nt
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
import canopy
fX = theano.config.floatX
def test_time_call():
network = tn.InputNode("i", shape=()).network()
fn = canopy.handlers.handled_fn(
network,
[canopy.handle... | apache-2.0 | Python |
78dd86246dda75754b6863b72d36010852c704fc | Update irrigate.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | device/src/irrigate.py | device/src/irrigate.py | #!/usr/bin/env python
#In this project, I use a RS360 micro water pump which is drived by relay,
#the realy's open/close status define start/stop water.
#Use steering enging to rotate the waterpipe so as to extend the irrigation field.
#Steering engine pin connection:
#deep red <--> GND
#red <--> VCC
#yellow <... | #!/usr/bin/env python
#In this project, I use a servo to simulate the water tap.
#Roating to 90 angle suggest that the water tap is open, and 0 angle means close.
#Pin connection:
#deep red <--> GND
#red <--> VCC
#yellow <--> signal(X1)
#Update!!!!!
#Use real water pump(RS360) to irrigate the plants, need to us... | mit | Python |
bfcb8c35c3bfa931e737e000ac684629a1340bc2 | Update version number | touilleMan/marshmallow-mongoengine | marshmallow_mongoengine/__init__.py | marshmallow_mongoengine/__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from marshmallow_mongoengine.schema import (
SchemaOpts,
ModelSchema,
)
from marshmallow_mongoengine.convert import (
ModelConverter,
fields_for_model,
convert_field,
field_for,
)
from marshmallow_mongoengine.exceptions import Mode... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from marshmallow_mongoengine.schema import (
SchemaOpts,
ModelSchema,
)
from marshmallow_mongoengine.convert import (
ModelConverter,
fields_for_model,
convert_field,
field_for,
)
from marshmallow_mongoengine.exceptions import Mode... | mit | Python |
62af213ce739130e777c0dff44313e0fd008c177 | Update version to 2.02.3 | Synss/pyhard2 | pyhard2/__init__.py | pyhard2/__init__.py | __version__ = u"2.02.3 beta"
| __version__ = u"2.02.2 beta"
| mit | Python |
a96bb479b70bff8c8ec49c73cbe85845b13f54dc | add unit test for box:ap #tddBitch | przemyslawjanpietrzak/pyMonet | pymonet/test_box.py | pymonet/test_box.py | from pymonet.box import Box
def test_eq_should_compare_only_box_value():
assert Box(42) == Box(42)
assert Box(43) != Box(42)
assert Box([]) == Box([])
assert Box({}) == Box({})
assert Box(None) == Box(None)
def test_map_should_return_box_with_mapped_value():
box = Box(42)
assert box.map(... | from pymonet.box import Box
def test_eq_should_compare_only_box_value():
assert Box(42) == Box(42)
assert Box(43) != Box(42)
assert Box([]) == Box([])
assert Box({}) == Box({})
assert Box(None) == Box(None)
def test_map_should_return_box_with_mapped_value():
box = Box(42)
assert box.map(... | mit | Python |
de63e8c8daff89f95ec3b6649884588828bc3382 | Remove logic from get_registration_url for RegistrationSerializer. /v2/registrations/<id> will use RegistrationSerializer. /v2/nodes/<id> will use NodeSerializer. | hmoco/osf.io,samanehsan/osf.io,felliott/osf.io,samchrisinger/osf.io,caseyrollins/osf.io,icereval/osf.io,Johnetordoff/osf.io,Ghalko/osf.io,zachjanicki/osf.io,samanehsan/osf.io,aaxelb/osf.io,billyhunt/osf.io,caseyrollins/osf.io,DanielSBrown/osf.io,pattisdr/osf.io,HalcyonChimera/osf.io,mattclark/osf.io,mfraezz/osf.io,erin... | api/registrations/serializers.py | api/registrations/serializers.py | from rest_framework import serializers as ser
from rest_framework import exceptions
from api.base.utils import absolute_reverse
from api.nodes.serializers import NodeSerializer
from api.base.serializers import IDField, JSONAPIHyperlinkedIdentityField, LinksField
class RegistrationSerializer(NodeSerializer):
ret... | from rest_framework import serializers as ser
from rest_framework import exceptions
from api.base.utils import absolute_reverse
from api.nodes.serializers import NodeSerializer
from api.base.serializers import IDField, JSONAPIHyperlinkedIdentityField, LinksField
class RegistrationSerializer(NodeSerializer):
ret... | apache-2.0 | Python |
6ef6df7116cd950dff420de77f2cfaac4c22585e | allow filtering for unique instance | CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend | api/v2/views/instance_history.py | api/v2/views/instance_history.py | from django.db.models import Q
from rest_framework import filters
import django_filters
from core.models import InstanceStatusHistory
from api.v2.serializers.details import InstanceStatusHistorySerializer
from api.v2.views.base import AuthReadOnlyViewSet
from api.v2.views.mixins import MultipleFieldLookup
class Ins... | from django.db.models import Q
from rest_framework import filters
import django_filters
from core.models import InstanceStatusHistory
from api.v2.serializers.details import InstanceStatusHistorySerializer
from api.v2.views.base import AuthReadOnlyViewSet
from api.v2.views.mixins import MultipleFieldLookup
class Ins... | apache-2.0 | Python |
edbf3ca145c7eb3efc3e29c3d7aae32604154607 | Fix Batch add tasks failure message (#8078) | Azure/azure-sdk-for-python,Azure/azure-sdk-for-python,Azure/azure-sdk-for-python,Azure/azure-sdk-for-python | sdk/batch/azure-batch/azure/batch/custom/custom_errors.py | sdk/batch/azure-batch/azure/batch/custom/custom_errors.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | mit | Python |
25fc6e822be738751e8c5055ff66dfc1ecc39825 | use constructor from classmethod #265 | RasaHQ/rasa_core,RasaHQ/rasa_nlu,RasaHQ/rasa_nlu,RasaHQ/rasa_core,RasaHQ/rasa_nlu,RasaHQ/rasa_core | rasa_core/broker.py | rasa_core/broker.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import pika
from typing import Text
logger = logging.getLogger(__name__)
class EventChannel(object):
def publish(self, event):
# type: (Text... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import pika
from typing import Text
logger = logging.getLogger(__name__)
class EventChannel(object):
def publish(self, event):
# type: (Text... | apache-2.0 | Python |
f848418311e14609fdba20658ae85257927939ba | Simplify preprocessor | ipython-contrib/IPython-notebook-extensions,motleytech/IPython-notebook-extensions,benvarkey/IPython-notebook-extensions,Konubinix/IPython-notebook-extensions,benvarkey/IPython-notebook-extensions,jcb91/IPython-notebook-extensions,ipython-contrib/IPython-notebook-extensions,juhasch/IPython-notebook-extensions,andyneff/... | usability/python-markdown/pymdpreprocessor.py | usability/python-markdown/pymdpreprocessor.py | # -*- coding: utf-8 -*-
"""This preprocessor replaces Python code in markdowncell with the result
stored in cell metadata
"""
from nbconvert.preprocessors import *
import re
class PyMarkdownPreprocessor(Preprocessor):
def replace_variables(self, source, variables):
"""
Replace {{variablename... | # -*- coding: utf-8 -*-
"""This preprocessor replaces Python code in markdowncell with the result
stored in cell metadata
"""
from nbconvert.preprocessors import *
import re
def get_variable( match, variables):
try:
x = variables[match]
return x
except KeyError:
return ""
class PyMar... | bsd-3-clause | Python |
b9208f569f0ad76928691b7093bbb2ad34387cb8 | Use signal in test to determine when profiling is finished | spyder-ide/spyder.line-profiler,Nodd/spyder.line_profiler,spyder-ide/spyder.line_profiler | spyder_line_profiler/widgets/tests/test_lineprofiler.py | spyder_line_profiler/widgets/tests/test_lineprofiler.py | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Spyder Project Developers
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Tests for l... | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Spyder Project Developers
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Tests for l... | mit | Python |
27dd4ca9b385ac5f38aca8664e708f608be5e46b | Rewrite ring unittest test to pytest (#41151) | jawilson/home-assistant,aronsky/home-assistant,Danielhiversen/home-assistant,balloob/home-assistant,w1ll1am23/home-assistant,mezz64/home-assistant,partofthething/home-assistant,Danielhiversen/home-assistant,home-assistant/home-assistant,FreekingDean/home-assistant,balloob/home-assistant,w1ll1am23/home-assistant,tboyce1... | tests/components/ring/test_init.py | tests/components/ring/test_init.py | """The tests for the Ring component."""
from datetime import timedelta
import homeassistant.components.ring as ring
from homeassistant.setup import async_setup_component
from tests.common import load_fixture
ATTRIBUTION = "Data provided by Ring.com"
VALID_CONFIG = {
"ring": {"username": "foo", "password": "bar"... | """The tests for the Ring component."""
from asyncio import run_coroutine_threadsafe
from datetime import timedelta
import unittest
import requests_mock
import homeassistant.components.ring as ring
from tests.common import get_test_home_assistant, load_fixture
ATTRIBUTION = "Data provided by Ring.com"
VALID_CONFIG... | apache-2.0 | Python |
c157113dc0ae559f6f4e6a59f3d3845984c5297a | Bump to v0.26.6 | gisce/enerdata | enerdata/__init__.py | enerdata/__init__.py | __author__ = 'ecarreras'
__version__ = '0.26.6'
| __author__ = 'ecarreras'
__version__ = '0.26.5'
| mit | Python |
36b3584411661d2957cfcd7f2c2f45afd1890055 | Remove double creation | bowlofstew/changes,bowlofstew/changes,bowlofstew/changes,dropbox/changes,dropbox/changes,wfxiang08/changes,dropbox/changes,wfxiang08/changes,wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes | changes/api/build_retry.py | changes/api/build_retry.py | from flask import Response
from sqlalchemy.orm import joinedload, subqueryload_all
from datetime import datetime
from changes.api.base import APIView
from changes.config import db, queue
from changes.constants import Cause, Status
from changes.models import Build
class BuildRetryAPIView(APIView):
def post(self,... | from flask import Response
from sqlalchemy.orm import joinedload, subqueryload_all
from datetime import datetime
from changes.api.base import APIView
from changes.config import db, queue
from changes.constants import Cause, Status
from changes.models import Build
class BuildRetryAPIView(APIView):
def post(self,... | apache-2.0 | Python |
0f7a73ea97110a8134376ebb01eeec7e45a3839e | Make sqlite3 optional for Heroku support. Thanks to @nathancahill | femtotrader/requests-cache,reclosedev/requests-cache,YetAnotherNerd/requests-cache | requests_cache/backends/__init__.py | requests_cache/backends/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
requests_cache.backends
~~~~~~~~~~~~~~~~~~~~~~~
Classes and functions for cache persistence
"""
from .base import BaseCache
registry = {
'memory': BaseCache,
}
try:
# Heroku doesn't allow the SQLite3 module to be installed
from .sqlite impor... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
requests_cache.backends
~~~~~~~~~~~~~~~~~~~~~~~
Classes and functions for cache persistence
"""
from .sqlite import DbCache
from .base import BaseCache
registry = {
'sqlite': DbCache,
'memory': BaseCache,
}
try:
from .mongo import MongoCache
... | bsd-2-clause | Python |
9552b68e78cb3a0d6b3a49f3076989474fd66af3 | use different memory metric for alerting | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | nagios/check_sar_memory.py | nagios/check_sar_memory.py | """Capture some stats from sar memory"""
import subprocess
import sys
def process(res):
"""Parse and do stuff with the output"""
lines = res.strip().split("\n")
if len(lines) < 2 or not lines[-1].startswith("Average:"):
print('CRITICAL: ERROR %s' % ("|".join(lines),))
sys.exit(2)
token... | """Capture some stats from sar memory"""
import subprocess
import sys
def process(res):
"""Parse and do stuff with the output"""
lines = res.strip().split("\n")
if len(lines) < 2 or not lines[-1].startswith("Average:"):
print('CRITICAL: ERROR %s' % ("|".join(lines),))
sys.exit(2)
token... | mit | Python |
84019aff643a9acfd6263ea1c9a5fd4f15b86116 | remove hardcoded string/file path | tetherless-world/setlr,tetherless-world/setlr | tests/setlr_test/test_read_json.py | tests/setlr_test/test_read_json.py | import unittest
import rdflib
import json
from setlr import read_json
# Checks the the file stays open through reading
class TestReadJson(unittest.TestCase):
def test_read_json(self):
expected_string = ''
json_file = "tests/setlr_test/test_read_json.json"
with open(json_file) as f:
... | import unittest
import rdflib
import json
from setlr import read_json
# Checks the the file stays open through reading
class TestReadJson(unittest.TestCase):
def test_read_json(self):
expected_string = '''
[
{
"ID": "Alice",
"Name": "Alice Smith",
... | apache-2.0 | Python |
4991691ab87d7abedd6ca83e199d5d72263df966 | add rsync_conn to sync files using a connection | alfredodeza/remoto | remoto/file_sync.py | remoto/file_sync.py | import execnet
from remoto.backends import basic_remote_logger
from remoto.backends import BaseConnection as Connection
class _RSync(execnet.RSync):
"""
Inherits from ``execnet.RSync`` so that we can log nicely with the user
logger instance (if any) back with the ``_report_send_file`` method
"""
... | import execnet
from remoto.backends import basic_remote_logger
from remoto.backends import BaseConnection as Connection
class _RSync(execnet.RSync):
"""
Inherits from ``execnet.RSync`` so that we can log nicely with the user
logger instance (if any) back with the ``_report_send_file`` method
"""
... | mit | Python |
fd077e8ab23b522fcdae642620e56a5a74614bde | Increase to version 0.2.10 | dulaccc/django-accounting,dulaccc/django-accounting,dulaccc/django-accounting,dulaccc/django-accounting | accounting/__init__.py | accounting/__init__.py | import os
# Use 'final' as the 4th element to indicate
# a full release
VERSION = (0, 2, 10)
def get_short_version():
return '%s.%s' % (VERSION[0], VERSION[1])
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
# Append 3rd digit if > 0
if VERSION[2]:
version = '%s.%s' % (vers... | import os
# Use 'final' as the 4th element to indicate
# a full release
VERSION = (0, 2, 9)
def get_short_version():
return '%s.%s' % (VERSION[0], VERSION[1])
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
# Append 3rd digit if > 0
if VERSION[2]:
version = '%s.%s' % (versi... | mit | Python |
b146c4db47bf858aec17c9d5f3a77233b7c75e73 | fix tests | admitad/admitad-python-api | pyadmitad/tests/base.py | pyadmitad/tests/base.py | # -*- coding: utf-8 -*-
from mocker import MockerTestCase
from pyadmitad.api import get_oauth_client
from pyadmitad.transport import build_headers, \
HttpTransportPagination, HttpTransportOrdering, HttpTransportFiltering
class BaseTestCase(MockerTestCase):
def prepare_data(self, **kwargs):
with_pagi... | # -*- coding: utf-8 -*-
from mocker import MockerTestCase
from pyadmitad.api import get_oauth_client
from pyadmitad.transport import build_headers, \
HttpTransportPagination, HttpTransportOrdering, HttpTransportFiltering
class BaseTestCase(MockerTestCase):
def prepare_data(self, **kwargs):
with_pagi... | mit | Python |
f539ccfaa57b1bb1a21eff57aa08a94c25dc17ae | Add funcarg to use the Examples from the Racket documentation directly. | pycket/pycket,krono/pycket,samth/pycket,pycket/pycket,samth/pycket,vishesh/pycket,magnusmorton/pycket,magnusmorton/pycket,magnusmorton/pycket,vishesh/pycket,vishesh/pycket,krono/pycket,cderici/pycket,pycket/pycket,samth/pycket,cderici/pycket,cderici/pycket,krono/pycket | pycket/test/conftest.py | pycket/test/conftest.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# conftest - configuring pytest, especially funcargs
#
def _doctstring_tempfile_named(request, name):
tmpdir = request.getfuncargvalue('tmpdir')
assert request.function.__doc__ is not None
file_name = tmpdir / name
file_name.write(request.function.__doc_... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# conftest - configuring pytest, especially funcargs
#
def _doctstring_tempfile_named(request, name):
tmpdir = request.getfuncargvalue('tmpdir')
assert request.function.__doc__ is not None
file_name = tmpdir / name
file_name.write(request.function.__doc_... | mit | Python |
d4274336756ed6d6c36f94cbaae7e8328ac50f9a | Handle wrong order of middleware. | andreif/djedi-cms,andreif/djedi-cms,andreif/djedi-cms,5monkeys/djedi-cms,5monkeys/djedi-cms,5monkeys/djedi-cms | djedi/auth/__init__.py | djedi/auth/__init__.py | import logging
_log = logging.getLogger(__name__)
def has_permission(request):
user = getattr(request, 'user', None)
if user:
if user.is_superuser:
return True
if user.is_staff and user.groups.filter(name__iexact='djedi').exists():
return True
else:
_log.w... | def has_permission(request):
user = request.user
if user:
if user.is_superuser:
return True
if user.is_staff and user.groups.filter(name__iexact='djedi').exists():
return True
return False
def get_username(request):
user = request.user
if hasattr(user, 'ge... | bsd-3-clause | Python |
3e624251ae572f6d234e688cfff3259961c9b5ca | Remove unnecessary import | Stvad/CrowdAnki,Stvad/CrowdAnki,Stvad/CrowdAnki | crowd_anki/anki_exporter_wrapper.py | crowd_anki/anki_exporter_wrapper.py | from .thirdparty.pathlib import Path
import anki.exporting
import aqt.utils
from .utils import constants
from .anki_exporter import AnkiJsonExporter
from .anki_overrides import exporting
class AnkiJsonExporterWrapper:
"""
Wrapper designed to work with standard export dialog in anki.
"""
key = "Crow... | #from . import crowd_anki # Unnecessary?
from .thirdparty.pathlib import Path
import anki.exporting
import aqt.utils
from .utils import constants
from .anki_exporter import AnkiJsonExporter
from .anki_overrides import exporting
class AnkiJsonExporterWrapper:
"""
Wrapper designed to work with standard export... | mit | Python |
e48c954a319c497b7c47a978b56ece246017c53a | Fix spelling mistake | tensorflow/lucid,tensorflow/lucid,tensorflow/lucid,tensorflow/lucid | lucid/optvis/param/random.py | lucid/optvis/param/random.py | # Copyright 2018 The Lucid Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | # Copyright 2018 The Lucid Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | apache-2.0 | Python |
bde988478b12eabff3e74ace5b3b52b42ed9c07b | print overall table of statistics | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | command_line/spot_counts_per_image.py | command_line/spot_counts_per_image.py | from __future__ import division
# LIBTBX_PRE_DISPATCHER_INCLUDE_SH export BOOST_ADAPTBX_FPE_DEFAULT=1
from dials.util.options import OptionParser
from dials.util.options \
import flatten_reflections, flatten_datablocks, flatten_experiments
from dials.algorithms.peak_finding import per_image_analysis
import iotbx... | from __future__ import division
# LIBTBX_PRE_DISPATCHER_INCLUDE_SH export BOOST_ADAPTBX_FPE_DEFAULT=1
from dials.util.options import OptionParser
from dials.util.options \
import flatten_reflections, flatten_datablocks, flatten_experiments
from dials.algorithms.peak_finding import per_image_analysis
import iotbx... | bsd-3-clause | Python |
6f79ff61ec6f1e1a7587ae1ae2338b970a4ddb65 | Update waas_rest_api_example.py | barracudanetworks/waf-automation,barracudanetworks/waf-automation,barracudanetworks/waf-automation,barracudanetworks/waf-automation,barracudanetworks/waf-automation | waf-as-a-service-api/waas_rest_api_example.py | waf-as-a-service-api/waas_rest_api_example.py | import requests
import pprint
import sys
from getpass import getpass
# Fix Python 2.x.
try: input = raw_input
except NameError: pass
try:
from urllib.parse import urlparse
from urllib.parse import urljoin
except ImportError:
from urlparse import urlparse
from urlparse import urljoin
API_BASE = "https:/... | import requests
import pprint
import sys
from getpass import getpass
from urllib.parse import urlencode, urljoin
API_BASE = "https://api.waas.barracudanetworks.com/v1/waasapi/"
def waas_api_login(email, password):
res = requests.post(urljoin(API_BASE, 'api_login/'), data=dict(email=email, password=password))
... | mit | Python |
2dfc3817881d9e90456dc3ea94b1fd0ec308fb5e | Fix MorphingField: polymorphic_identy is already the string we want | beavyHQ/beavy,beavyHQ/beavy,beavyHQ/beavy,beavyHQ/beavy | beavy/common/morphing_field.py | beavy/common/morphing_field.py | from marshmallow.fields import Field
class MorphingField(Field):
# registry = {
# }
def __init__(self, many=False, fallback=None, overwrite=None, **metadata):
self.many = False
self.fallback = fallback or self.FALLBACK
self.overwrite = overwrite
# Common alternative:
# d... | from marshmallow.fields import Field
class MorphingField(Field):
# registry = {
# }
def __init__(self, many=False, fallback=None, overwrite=None, **metadata):
self.many = False
self.fallback = fallback or self.FALLBACK
self.overwrite = overwrite
# Common alternative:
# d... | mpl-2.0 | Python |
56b469eb2836d1fb6c2a7702b4693978512ecb51 | Fix wards code sequences restart | MasterFacilityList/mfl_api,MasterFacilityList/mfl_api,MasterFacilityList/mfl_api,MasterFacilityList/mfl_api,MasterFacilityList/mfl_api | common/migrations/admin_unit_codes.py | common/migrations/admin_unit_codes.py | # -*- coding: utf-8 -*-
from django.db import models, migrations
from facilities.models import Facility
def set_min_code_value(apps, schema_editor):
from django.db import connection
cursor = connection.cursor()
sql = """
ALTER SEQUENCE common_constituency_code_seq restart 1000 start 1000 minvalue... | # -*- coding: utf-8 -*-
from django.db import models, migrations
from facilities.models import Facility
def set_min_code_value(apps, schema_editor):
from django.db import connection
cursor = connection.cursor()
sql = """
ALTER SEQUENCE common_constituency_code_seq restart 1000 start 1000 minvalue... | mit | Python |
db8d22621f8921bf42532af9bdd1c4ed1bddabef | Add the color field to public employee | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo | addons/hr/models/hr_employee_base.py | addons/hr/models/hr_employee_base.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class HrEmployeeBase(models.AbstractModel):
_name = "hr.employee.base"
_description = "Basic Employee"
_order = 'name'
name = fields.Char()
active = fields.Boolean("... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class HrEmployeeBase(models.AbstractModel):
_name = "hr.employee.base"
_description = "Basic Employee"
_order = 'name'
name = fields.Char()
active = fields.Boolean("... | agpl-3.0 | Python |
287c2da6d72155a4988665ac3c4031032dd835e3 | Fix log test to use real user and id | sloria/osf.io,cwisecarver/osf.io,mattclark/osf.io,CenterForOpenScience/osf.io,pattisdr/osf.io,laurenrevere/osf.io,aaxelb/osf.io,TomBaxter/osf.io,binoculars/osf.io,chrisseto/osf.io,cslzchen/osf.io,adlius/osf.io,baylee-d/osf.io,caneruguz/osf.io,mfraezz/osf.io,brianjgeiger/osf.io,CenterForOpenScience/osf.io,caseyrollins/o... | admin_tests/common_auth/test_logs.py | admin_tests/common_auth/test_logs.py | from nose import tools as nt
from tests.base import AdminTestCase
from osf_tests.factories import UserFactory
from osf.models.admin_log_entry import AdminLogEntry, update_admin_log
class TestUpdateAdminLog(AdminTestCase):
def test_add_log(self):
user = UserFactory()
update_admin_log(user.id, 'df... | from nose import tools as nt
from tests.base import AdminTestCase
from osf.models.admin_log_entry import AdminLogEntry, update_admin_log
class TestUpdateAdminLog(AdminTestCase):
def test_add_log(self):
update_admin_log('123', 'dfqc2', 'This', 'log_added')
nt.assert_equal(AdminLogEntry.objects.co... | apache-2.0 | Python |
fc0e97de5b910e6a041b5e44072995f3a32d0b9f | order in yaml should be preserved | maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex | python/vaex/settings.py | python/vaex/settings.py | import logging
logger = logging.getLogger("vaex.settings")
class Files(object):
def __init__(self, open, recent):
self.open = open
self.recent = recent
import yaml
from yaml import Loader, Dumper
class Settings(object):
def __init__(self, filename):
self.filename = filename
if not os.path.exists(filename)... | import logging
logger = logging.getLogger("vaex.settings")
class Files(object):
def __init__(self, open, recent):
self.open = open
self.recent = recent
import yaml
from yaml import Loader, Dumper
class Settings(object):
def __init__(self, filename):
self.filename = filename
if not os.path.exists(filename)... | mit | Python |
b1073725348c1a19bf63b7751fa1a0f0701535e3 | Create file if it doesn't exist already. | MrFlynn/pushbullet-backup | backup.py | backup.py | #!/usr/bin/env python3
# Need requests and configparser.
import requests
import configparser
import time
import json
def main():
# List of pushes:
push_list = []
# Import configuration with API token.
c = configparser.ConfigParser()
# Read config file and set token var.
c.read("config.ini")... | #!/usr/bin/env python3
# Need requests and configparser.
import requests
import configparser
import time
import json
def main():
# List of pushes:
push_list = []
# Import configuration with API token.
c = configparser.ConfigParser()
# Read config file and set token var.
c.read("config.ini")... | mit | Python |
172fedb8f7548f4b3e739c6c81a2ac07e012dff7 | fix missing comma in example settings | openkamer/openkamer,openkamer/openkamer,openkamer/openkamer,openkamer/openkamer | website/local_settings_example.py | website/local_settings_example.py | # user settings, included in settings.py
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = True
# SECURITY WARNING: Make this unique, and don't share it with anybody.
SECRET_KEY = ''
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgre... | # user settings, included in settings.py
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = True
# SECURITY WARNING: Make this unique, and don't share it with anybody.
SECRET_KEY = ''
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgre... | mit | Python |
ebe831dae22edad13e7bb984eb1dad422ecbd533 | clean up; | hhsecond/myscripts | notify_me/notifications.py | notify_me/notifications.py | import notify2
import datetime
import random
import time
import pygame
from os import path
def hey_notify(sleep_fact = 0, *args):
n = notify2.Notification(*args)
n.show()
pygame.mixer.music.play()
time.sleep(sleep_fact * mul_fact)
notify2.init('foo')
pygame.mixer.init()
pygame.mixer.music.load(path.a... | import notify2
import datetime
import random
import time
import pygame
def hey_notify(*args, sleep_fact):
n = notify2.Notification(*args)
n.show()
pygame.mixer.music.play()
time.sleep(sleep_fact * mul_fact)
notify2.init('foo')
pygame.mixer.init()
pygame.mixer.music.load("/home/hhsecond/notify_me/mon... | apache-2.0 | Python |
9e776eedce9e3f6f77546ba20e7ae97675c95a49 | Move lupe lookup into arguments.py | salspaugh/queryutils,salspaugh/queryutils | queryutils/arguments.py | queryutils/arguments.py | from queryutils.databases import PostgresDB, SQLite3DB
from queryutils.files import CSVFiles, JSONFiles
SOURCES = {
"csvfiles": (CSVFiles, ["path", "version"]),
"jsonfiles": (JSONFiles, ["path", "version"]),
"postgresdb": (PostgresDB, ["database", "user", "password"]),
"sqlite3db": (SQLite3DB, ["srcpat... | from queryutils.databases import PostgresDB, SQLite3DB
from queryutils.files import CSVFiles, JSONFiles
SOURCES = {
"csvfiles": (CSVFiles, ["path", "version"]),
"jsonfiles": (JSONFiles, ["path", "version"]),
"postgresdb": (PostgresDB, ["database", "user", "password"]),
"sqlite3db": (SQLite3DB, ["srcpat... | bsd-3-clause | Python |
e8d7113cf91e332f2508600bb5f753d6c972903e | Revert change | mirnylab/cooler | cooler/cli/__init__.py | cooler/cli/__init__.py | # -*- coding: utf-8 -*-
from __future__ import division, print_function
import click
# Monkey patch
click.core._verify_python3_env = lambda: None
CONTEXT_SETTINGS = {
'help_option_names': ['-h', '--help'],
}
@click.group(context_settings=CONTEXT_SETTINGS)
def cli():
pass
from . import (
makebins,
... | # -*- coding: utf-8 -*-
from __future__ import division, print_function
import click
# Monkey patch
click.core._verify_python3_env = lambda: None
CONTEXT_SETTINGS = {
'help_option_names': ['-h', '--help'],
}
@click.group(context_settings=CONTEXT_SETTINGS)
def cli():
pass
from . import (
makebins,
... | bsd-3-clause | Python |
3c93111dd869075aa6c77b19343f90b5a08d4960 | Comment out unused code in config_services.py | mattstibbs/blockbuster-server,mattstibbs/blockbuster-server | blockbuster/config_services.py | blockbuster/config_services.py | # import os
# SERVICE_LIST = os.environ.get('SERVICE_LIST')
# list_of_services = SERVICE_LIST.split('|')
# new_service_list = {}
# for service_item in list_of_services:
# service_config_items = service_item.split(':')
# service = {
# 'number': service_config_items[0],
# 'instance_name': ser... | import os
SERVICE_LIST = os.environ.get('SERVICE_LIST')
list_of_services = SERVICE_LIST.split('|')
new_service_list = {}
for service_item in list_of_services:
service_config_items = service_item.split(':')
service = {
'number': service_config_items[0],
'instance_name': service_config_items[... | mit | Python |
a2a8c2a6e86c46e43bffbbe5b413ffe53d5569f3 | Bump to v1.0.12 | britco/opbeat_pyramid,monokrome/opbeat_pyramid | opbeat_pyramid/__init__.py | opbeat_pyramid/__init__.py | __VERSION__ = '1.0.12'
def _should_ignore_module(module_name):
return module_name.endswith('_spec')
def includeme(config, module_name='opbeat_pyramid'):
""" Extensibility function for using this module with any Pyramid app. """
config.scan(module_name, ignore=_should_ignore_module)
| __VERSION__ = '1.0.11'
def _should_ignore_module(module_name):
return module_name.endswith('_spec')
def includeme(config, module_name='opbeat_pyramid'):
""" Extensibility function for using this module with any Pyramid app. """
config.scan(module_name, ignore=_should_ignore_module)
| mit | Python |
48cef9beadbd6abc6f17bd4cd8eabbcd527dee50 | Use classmethods in SocketClientManager | pajlada/tyggbot,pajlada/tyggbot,pajlada/pajbot,pajlada/pajbot,pajlada/tyggbot,pajlada/pajbot,pajlada/pajbot,pajlada/tyggbot | pajbot/models/sock.py | pajbot/models/sock.py | import json
import logging
import threading
from pajbot.managers.redis import RedisManager
log = logging.getLogger(__name__)
class SocketManager:
def __init__(self, streamer_name):
self.handlers = {}
self.pubsub = RedisManager.get().pubsub()
self.running = True
self.streamer_name... | import json
import logging
import threading
from pajbot.managers.redis import RedisManager
log = logging.getLogger(__name__)
class SocketManager:
def __init__(self, streamer_name):
self.handlers = {}
self.pubsub = RedisManager.get().pubsub()
self.running = True
self.streamer_name... | mit | Python |
ac351f691f07d91ce2253d8ca7f9c025a8611f08 | Update check_install() to close pipes and avoid ResourceWarnings. | reviewboard/rbtools,reviewboard/rbtools,reviewboard/rbtools | rbtools/utils/checks.py | rbtools/utils/checks.py | from __future__ import unicode_literals
import os
import subprocess
from rbtools.utils.process import execute
GNU_DIFF_WIN32_URL = 'http://gnuwin32.sourceforge.net/packages/diffutils.htm'
def check_install(command):
"""Check if the given command is installed.
Try executing an external command and return ... | from __future__ import unicode_literals
import os
import subprocess
from rbtools.utils.process import execute
GNU_DIFF_WIN32_URL = 'http://gnuwin32.sourceforge.net/packages/diffutils.htm'
def check_install(command):
"""Check if the given command is installed.
Try executing an external command and return ... | mit | Python |
521c1a6ddc10d0234f0c11bfc1d6be1e204b9184 | add index script | MIT-LCP/mimic-code-sharing,MIT-LCP/mimic-code,fereshteh-razmi/mimic-code,fereshteh-razmi/mimic-code,MIT-LCP/mimic-code,MIT-LCP/mimic-code,MIT-LCP/mimic-code-sharing,fereshteh-razmi/mimic-code | buildmimic/tests/test_build.py | buildmimic/tests/test_build.py | import unittest
import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
import pandas as pd
import os
from subprocess import call
# Config
sqluser = 'postgres'
testdbname = 'mimic_test_db'
hostname = 'localhost'
# Set paths for scripts to be tested
curpath = os.path.join(os.path.dirname(__file__)) ... | import unittest
import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
import pandas as pd
import os
from subprocess import call
# Config
sqluser = 'postgres'
testdbname = 'mimic_test_db'
hostname = 'localhost'
# Set paths for scripts to be tested
curpath = os.path.join(os.path.dirname(__file__)) ... | mit | Python |
199b1ed1dc16fbac8b6d5cfa96f53d38ed00d9c6 | fix protected_abs_paths | fishtown-analytics/dbt,fishtown-analytics/dbt,analyst-collective/dbt,analyst-collective/dbt,fishtown-analytics/dbt | core/dbt/task/clean.py | core/dbt/task/clean.py | import os.path
import os
import shutil
from dbt.task.base import ProjectOnlyTask
from dbt.logger import GLOBAL_LOGGER as logger
class CleanTask(ProjectOnlyTask):
def __is_project_path(self, path):
proj_path = os.path.abspath('.')
return not os.path.commonprefix(
[proj_path, os.path.a... | import os.path
import os
import shutil
from dbt.task.base import ProjectOnlyTask
from dbt.logger import GLOBAL_LOGGER as logger
class CleanTask(ProjectOnlyTask):
def __is_project_path(self, path):
proj_path = os.path.abspath('.')
return not os.path.commonprefix(
[proj_path, os.path.a... | apache-2.0 | Python |
62c50c656a9b92395bed8ca6c602ec811ec5fba4 | fix name error in storage config | free-free/pyblog,free-free/pyblog,free-free/pyblog,free-free/pyblog | app/conf/conf.py | app/conf/conf.py | #-*- coding:utf-8 -*-
app={
'template_path':'./templates',
'static_prefix':'/static',
'static_path':'static',
'locale':'chinese',
'debug':False
}
database={
'default':'mysql',
'connections':{
'mysql':{
'host':'127.0.0.1',
'user':'root',
'port':3306,
'password':'526114',
'database':'pyblog'
},
... | #-*- coding:utf-8 -*-
app={
'template_path':'./templates',
'static_prefix':'/static',
'static_path':'static',
'locale':'chinese',
'debug':False
}
database={
'default':'mysql',
'connections':{
'mysql':{
'host':'127.0.0.1',
'user':'root',
'port':3306,
'password':'526114',
'database':'pyblog'
},
... | mit | Python |
1aa4461ba69f53ac40254f5e03b090446bacec07 | Remove exception hook, it doesn't work most of the time anyway. | GitExl/WhackEd4,GitExl/WhackEd4 | whacked4/main.py | whacked4/main.py | #!/usr/bin/env python
#coding=utf8
from whacked4 import config
from whacked4.ui import mainwindow
import argparse
import sys
import wx
if __name__ == '__main__':
# Parse common commandline arguments.
parser = argparse.ArgumentParser()
parser.add_argument('-debug', action='store_true', help='Enable d... | #!/usr/bin/env python
#coding=utf8
from whacked4 import config
from whacked4.ui import mainwindow
import argparse
import os.path
import sys
import traceback
import wx
if __name__ == '__main__':
# Parse common commandline arguments.
parser = argparse.ArgumentParser()
parser.add_argument('-debug', act... | bsd-2-clause | Python |
d61f5aac566307cfdff22fe83b610e51803e9774 | clean up | hanshoffman/crispy-fortnight,WesleyThurner/crispy-fortnight | crispy/modules/apps.py | crispy/modules/apps.py | import logging
from crispy.lib.module import *
from crispy.lib.fprint import *
logger = logging.getLogger(__name__)
__class_name__ = "AppsModule"
class AppsModule(CrispyModule):
""" Enum applications on a remote machine. """
# can be: 'Darwin', 'Linux', 'Windows', 'Android'
compatible_systems = ['Darwin... | import logging
from crispy.lib.module import *
from crispy.lib.fprint import *
logger = logging.getLogger(__name__)
__class_name__ = "AppsModule"
class AppsModule(CrispyModule):
""" Enum applications on a remote machine. """
# can be: 'Darwin', 'Linux', 'Windows', 'Android'
compatible_systems = ['Darwin... | mit | Python |
1856189e5adaab4c51697f2932cac53b7ce75cd5 | fix comment | okuta/chainer,ktnyt/chainer,cupy/cupy,wkentaro/chainer,chainer/chainer,okuta/chainer,cupy/cupy,niboshi/chainer,niboshi/chainer,ysekky/chainer,keisuke-umezawa/chainer,okuta/chainer,pfnet/chainer,okuta/chainer,jnishi/chainer,ktnyt/chainer,wkentaro/chainer,jnishi/chainer,jnishi/chainer,jnishi/chainer,hvy/chainer,hvy/chain... | chainer/functions/math/ceil.py | chainer/functions/math/ceil.py | from chainer import cuda
from chainer import function
from chainer import utils
from chainer.utils import type_check
class Ceil(function.Function):
@property
def label(self):
return 'ceil'
def check_type_forward(self, in_types):
type_check.expect(
in_types.size() == 1,
... | from chainer import cuda
from chainer import function
from chainer import utils
from chainer.utils import type_check
class Ceil(function.Function):
@property
def label(self):
return 'ceil'
def check_type_forward(self, in_types):
type_check.expect(
in_types.size() == 1,
... | mit | Python |
b845eb0bb516de5a83c21ec937bf6edc420b38fc | fix error of | HakureiClub/hakurei-site,HakureiClub/hakurei-site,HakureiClub/hakurei-site,HakureiClub/hakurei-site | hakureiclub_app/core_view/admin.py | hakureiclub_app/core_view/admin.py | from sanic import Blueprint
from sanic.response import text,html
from mu_sanic.render_template import render_template
from ..core_model.github_auth import authit,getuser
from ..core_model.mongodb import ActiInfo , BlogInfo , AuthInfo
import markdown2
from mu_sanic.config import loop
blog = BlogInfo()
acti = ActiInfo()... | from sanic import Blueprint
from sanic.response import text,html
from mu_sanic.render_template import render_template
from ..core_model.github_auth import authit,getuser
from ..core_model.mongodb import ActiInfo , BlogInfo , AuthInfo
import markdown2
from mu_sanic.config import loop
blog = BlogInfo()
acti = ActiInfo()... | mit | Python |
ed08fbc657e8dfd5faee4112e3843f72bbab3b33 | simplify plot_fft example | wardi/python-thinkrf | examples/plot_fft.py | examples/plot_fft.py | #!/usr/bin/env python
from thinkrf.devices import WSA4000
from thinkrf.config import TriggerSettings
import sys
import time
import math
from numpy import fft, abs, log10
from matplotlib.pyplot import plot, figure, axis, xlabel, ylabel, show
# connect to wsa
dut = WSA4000()
dut.connect(sys.argv[1])
# setup test con... | #!/usr/bin/env python
from thinkrf.devices import WSA4000
from thinkrf.config import TriggerSettings
import sys
import time
import math
from numpy import fft
from matplotlib.pyplot import plot, figure, axis, xlabel, ylabel, show
def logpower(i, q):
return 20 * math.log10(math.sqrt((i*i) + (q*q)))
# connect to ... | bsd-3-clause | Python |
3258387d59b5badba973e154437658cae088ba96 | Resolve conflicts | rfhk/rqn-custom,rfhk/rqn-custom,rfhk/rqn-custom | auditlog_ext_nrq/models/__init__.py | auditlog_ext_nrq/models/__init__.py | # -*- coding: utf-8 -*-
from . import auditlog_log
from . import auditlog_log_line
| # -*- coding: utf-8 -*-
from . import auditlog_log
| agpl-3.0 | Python |
7a19c5cc8f2e094be447bdd3cbeababa408d3624 | Fix test factories | opennode/nodeconductor-saltstack | src/nodeconductor_saltstack/exchange/tests/factories.py | src/nodeconductor_saltstack/exchange/tests/factories.py | import factory
from rest_framework.reverse import reverse
from nodeconductor.core.models import SynchronizationStates
from nodeconductor.structure.models import ServiceSettings
from nodeconductor.structure.tests.factories import CustomerFactory, ProjectFactory
from nodeconductor_saltstack.exchange.models import User, ... | import factory
from rest_framework.reverse import reverse
from nodeconductor.core.models import SynchronizationStates
from nodeconductor.structure.models import ServiceSettings
from nodeconductor.structure.tests.factories import CustomerFactory, ProjectFactory
from nodeconductor_saltstack.exchange.models import User, ... | mit | Python |
d82a0c6799878be5a09242be8af9e5acbdc285cf | Update py-hieroglyph (#23279) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-hieroglyph/package.py | var/spack/repos/builtin/packages/py-hieroglyph/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 PyHieroglyph(PythonPackage):
"""Hieroglyph is an extension for Sphinx which builds HTML
... | # 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 PyHieroglyph(PythonPackage):
"""Hieroglyph is an extension for Sphinx which builds HTML
... | lgpl-2.1 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.