commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
37d01f6088b1cf5673f66f4532dd51c73a0156f1 | Fix grammar in login error message | rest_framework/authtoken/serializers.py | rest_framework/authtoken/serializers.py | from django.contrib.auth import authenticate
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
class AuthTokenSerializer(serializers.Serializer):
username = serializers.CharField()
password = serializers.CharField()
def validate(self, attrs):
username... | from django.contrib.auth import authenticate
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
class AuthTokenSerializer(serializers.Serializer):
username = serializers.CharField()
password = serializers.CharField()
def validate(self, attrs):
username... | Python | 0.000763 |
059090cd945f51ed0281a967e1ba9502d2dc0a40 | Fix unittest | pymatgen/apps/borg/tests/test_queen.py | pymatgen/apps/borg/tests/test_queen.py | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
"""
Created on Mar 18, 2012
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "S... | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
"""
Created on Mar 18, 2012
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "S... | Python | 0.99804 |
098219137bdf30d7ac1c321f7973e14bfc82bda4 | Add configuration for PyBullet Ant. | agents/scripts/configs.py | agents/scripts/configs.py | # Copyright 2017 The TensorFlow Agents 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 or ag... | # Copyright 2017 The TensorFlow Agents 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 or ag... | Python | 0 |
e7530150120a542f264acc4c7ba74418c5e2ecdb | Add download_text and extractor train views. | extractor_train/public/views.py | extractor_train/public/views.py | # -*- coding: utf-8 -*-
'''Public section, including homepage and signup.'''
from flask import (Blueprint, request, render_template, flash, url_for,
redirect, session)
import flask
from flask.ext.login import login_user, login_required, logout_user
from extractor_train.extensions import login_man... | # -*- coding: utf-8 -*-
'''Public section, including homepage and signup.'''
from flask import (Blueprint, request, render_template, flash, url_for,
redirect, session)
from flask.ext.login import login_user, login_required, logout_user
from extractor_train.extensions import login_manager
from extra... | Python | 0 |
215439b43c27271c95fc208bf683a19619c81b8d | Add 3D slic tests (gray not working yet) | skimage/segmentation/tests/test_slic.py | skimage/segmentation/tests/test_slic.py | import itertools as it
import numpy as np
from numpy.testing import assert_equal, assert_array_equal
from skimage.segmentation import slic
def test_color_2d():
rnd = np.random.RandomState(0)
img = np.zeros((20, 21, 3))
img[:10, :10, 0] = 1
img[10:, :10, 1] = 1
img[10:, 10:, 2] = 1
img += 0.01 ... | import numpy as np
from numpy.testing import assert_equal, assert_array_equal
from skimage.segmentation import slic
def test_color():
rnd = np.random.RandomState(0)
img = np.zeros((20, 21, 3))
img[:10, :10, 0] = 1
img[10:, :10, 1] = 1
img[10:, 10:, 2] = 1
img += 0.01 * rnd.normal(size=img.shap... | Python | 0 |
52eb6a3d8188c5e8fbabbe4f4822d0c4ececf48b | Add option to see all available ldap attributes via ldapsearch command | pucas/management/commands/ldapsearch.py | pucas/management/commands/ldapsearch.py | from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from pucas.ldap import LDAPSearch, LDAPSearchException
class Command(BaseCommand):
help = 'Look up one or more users in LDAP by netid'
def add_arguments(self, parser):
parser.add_argument('netid', narg... | from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from pucas.ldap import LDAPSearch, LDAPSearchException
class Command(BaseCommand):
help = 'Look up one or more users in LDAP by netid'
def add_arguments(self, parser):
parser.add_argument('netid', narg... | Python | 0 |
ea3a390a88c63a566df567d245e22e505f17dcfe | Remove test_TextFile_bad_extension | tests/test_artefacts.py | tests/test_artefacts.py | import pytest
from pirec import artefacts
def test_Artefact_basename():
"""basename() should strip the extension from an artefact filename."""
img = artefacts.Artefact('foo.nii.gz', '.nii.gz', exists=False)
assert img.basename == 'foo'
def test_Artefact_dirname():
"""dirname() should return the path... | import pytest
from pirec import artefacts
def test_Artefact_basename():
"""basename() should strip the extension from an artefact filename."""
img = artefacts.Artefact('foo.nii.gz', '.nii.gz', exists=False)
assert img.basename == 'foo'
def test_Artefact_dirname():
"""dirname() should return the path... | Python | 0.000005 |
7b27c6aa2c30317c4cbc1510ddf05b6b305209b0 | Update objax/functional/core/ops.py | objax/functional/core/ops.py | objax/functional/core/ops.py | # Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Python | 0 |
547afc8237b31d8dec9eb4a15fff5d69936b3ed1 | Use load_ui from glue | glue_exp/importers/vizier/qt_widget.py | glue_exp/importers/vizier/qt_widget.py | import os
from glue.external.qt import QtGui
from glue.external.qt.QtCore import Qt
from glue.qt.qtutil import load_ui
from .vizier_helpers import query_vizier, fetch_vizier_catalog
__all__ = ["QtVizierImporter"]
UI_MAIN = os.path.join(os.path.dirname(__file__), 'vizier.ui')
class QtVizierImporter(QtGui.QDialog):... | import os
from glue.external.qt import QtGui
from glue.external.qt.QtCore import Qt
# TODO: update to use glue.qt once load_ui has been generalized
from PyQt4.uic import loadUi
from .vizier_helpers import query_vizier, fetch_vizier_catalog
__all__ = ["QtVizierImporter"]
UI_MAIN = os.path.join(os.path.dirname(__fil... | Python | 0 |
0226d6dff5bd46c3de1ba55e8b7bb01013be3d2f | Add additional contributions to savings goal | gnu_reporting/reports/savings_goals.py | gnu_reporting/reports/savings_goals.py | from datetime import datetime
import time
from dateutil.rrule import rrule, MONTHLY
from dateutil.relativedelta import relativedelta
from gnu_reporting.reports.base import Report
from gnu_reporting.wrapper import get_decimal, get_account, get_balance_on_date, account_walker
from gnu_reporting.periods import PeriodStart... | from datetime import datetime
import time
from dateutil.rrule import rrule, MONTHLY
from dateutil.relativedelta import relativedelta
from gnu_reporting.reports.base import Report
from gnu_reporting.wrapper import get_decimal, get_account, get_balance_on_date, account_walker
from gnu_reporting.periods import PeriodStart... | Python | 0 |
8b4981a7cae2c4c916d8671b420e29647bfeaaa9 | Remove duplicate import of Decimal | gnu_reporting/reports/savings_goals.py | gnu_reporting/reports/savings_goals.py | from datetime import datetime
import time
from dateutil.rrule import rrule, MONTHLY
from dateutil.relativedelta import relativedelta
from gnu_reporting.reports.base import Report
from gnu_reporting.wrapper import get_decimal, get_account, get_balance_on_date, account_walker
from gnu_reporting.periods import PeriodStart... | from datetime import datetime
import time
from dateutil.rrule import rrule, MONTHLY
from dateutil.relativedelta import relativedelta
from gnu_reporting.reports.base import Report
from gnu_reporting.wrapper import get_decimal, get_account, get_balance_on_date, account_walker
from gnu_reporting.periods import PeriodStart... | Python | 0.000287 |
cd9a51ab2fe6b99c0665b8f499363a4d557b4a4d | Modify script which split your region in smaller sample | DataWrangling/CaseStudy/sample_file.py | DataWrangling/CaseStudy/sample_file.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as ET # Use cElementTree or lxml if too slow
import os
OSM_FILE = "san-francisco-bay_california.osm" # Replace this with your osm file
SAMPLE_FILE = "sample_sfb.osm"
k = 20 # Parameter: take every k-th top level element
def get_element(osm... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as ET # Use cElementTree or lxml if too slow
import os
OSM_FILE = "san-francisco-bay_california.osm" # Replace this with your osm file
SAMPLE_FILE = "sample_sfb.osm"
k = 20 # Parameter: take every k-th top level element
def get_element(osm... | Python | 0 |
cd79441f0c11fbc36f2f0b0098196373006718e4 | Update binstar-push.py | continuous-integration/binstar-push.py | continuous-integration/binstar-push.py | import os
import glob
# import subprocess
# import traceback
from binstar_client.scripts import cli
def get_token():
token = None
if os.environ.get('TRAVIS_BRANCH', None) == 'master' or os.environ.get('APPVEYOR_REPO_BRANCH', None) == 'master':
token = os.environ.get('BINSTAR_TOKEN', None)
return t... | import os
import glob
# import subprocess
# import traceback
from binstar_client.scripts import cli
def get_token():
token = None
if os.environ.get('TRAVIS_BRANCH', None) == 'master' or os.environ.get('APPVEYOR_REPO_BRANCH', None) == 'master':
token = os.environ.get('BINSTAR_TOKEN', None)
return t... | Python | 0.000001 |
b7777486ef36a20e148e3a3d81846f2b330e8622 | Enable fullpath to be used in get_filenames | octotribble/Get_filenames.py | octotribble/Get_filenames.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
"""Get names of files that match regular expression.
Possibly better to use the glob module.
"""
import fnmatch
import os
from typing import List
# TODO: Try glob.glob
def get_filenames(path, regexp, regexp2=None, fullpath=False):
# type: (str, str, str) -> List[str... | #!/usr/bin/env python
# -*- coding: utf8 -*-
"""Get names of files that match regular expression.
Possibly better to use the glob module.
"""
import fnmatch
import os
from typing import List
# TODO: Try glob.glob
def get_filenames(path, regexp, regexp2=None):
# type: (str, str, str) -> List[str]
"""Regexp ... | Python | 0 |
0f0ef471e6bb9d873c890df2f538a00bbcae9637 | print removed | viewer/templatetags/custom_tags.py | viewer/templatetags/custom_tags.py | from django import template
import markdown
import datetime
register = template.Library()
@register.filter()
def custom_date(value):
date = datetime.datetime.strptime(value, '%a, %d %b %Y %H:%M:%S %z')
return date.strftime('%d, %b %Y')
@register.filter()
def markdown_data(value):
return markdown.markdo... | from django import template
import markdown
import datetime
register = template.Library()
@register.filter()
def custom_date(value):
date = datetime.datetime.strptime(value, '%a, %d %b %Y %H:%M:%S %z')
return date.strftime('%d, %b %Y')
@register.filter()
def markdown_data(value):
return markdown.markdo... | Python | 0.000001 |
0bac442df6fec974aec8cf6d9e4147a2e75cf139 | Switch from VERSION to $VERSION in model migration. | go/vumitools/conversation/migrators.py | go/vumitools/conversation/migrators.py | from vumi.persist.model import ModelMigrator
class ConversationMigrator(ModelMigrator):
def migrate_from_unversioned(self, mdata):
# Copy stuff that hasn't changed between versions
mdata.copy_values(
'conversation_type',
'start_timestamp', 'end_timestamp', 'created_at',
... | from vumi.persist.model import ModelMigrator
class ConversationMigrator(ModelMigrator):
def migrate_from_unversioned(self, mdata):
# Copy stuff that hasn't changed between versions
mdata.copy_values(
'conversation_type',
'start_timestamp', 'end_timestamp', 'created_at',
... | Python | 0 |
fd7348951e46763dcd06cb673a6b01f6894efe4e | Set version as 0.8.8.1 | alignak_webui/__init__.py | alignak_webui/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=global-statement
# Copyright (c) 2015-2017:
# Frederic Mohier, frederic.mohier@alignak.net
#
"""
Alignak - Web User Interface
"""
# Package name
__pkg_name__ = u"alignak_webui"
# Checks types for PyPI keywords
# Used for:
# - PyPI keywords
# - dir... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=global-statement
# Copyright (c) 2015-2017:
# Frederic Mohier, frederic.mohier@alignak.net
#
"""
Alignak - Web User Interface
"""
# Package name
__pkg_name__ = u"alignak_webui"
# Checks types for PyPI keywords
# Used for:
# - PyPI keywords
# - dir... | Python | 0.001032 |
2ed5c92aabd349337579792b20613854370aa2ac | add log test | kfdda/views/general.py | kfdda/views/general.py | # -*- coding: utf-8 -*-
from flask import Blueprint
from flask.views import MethodView
from ..core import db, logger
from ..exceptions import NoError, FormValidationError
from ..forms.login import LoginForm
from ..models.user import User
from ..tasks import add
bp = Blueprint('general', __name__)
class IndexView(... | # -*- coding: utf-8 -*-
from flask import Blueprint
from flask.views import MethodView
from ..core import db, logger
from ..exceptions import NoError, FormValidationError
from ..forms.login import LoginForm
from ..models.user import User
from ..tasks import add
bp = Blueprint('general', __name__)
class IndexView(... | Python | 0.000001 |
83a62e80d1b7551f0ccebf4bc95bba27c6bf94bc | Add compound nouns tests | tests/test_compounds.py | tests/test_compounds.py | import inflect
p = inflect.engine()
def test_compound_1():
assert p.singular_noun("hello-out-there") == "hello-out-there"
def test_compound_2():
assert p.singular_noun("hello out there") == "hello out there"
def test_compound_3():
assert p.singular_noun("continue-to-operate") == "continue-to-operate"... | import inflect
p = inflect.engine()
def test_compound_1():
assert p.singular_noun("hello-out-there") == "hello-out-there"
def test_compound_2():
assert p.singular_noun("hello out there") == "hello out there"
def test_compound_3():
assert p.singular_noun("continue-to-operate") == "continue-to-operate"... | Python | 0.999995 |
828e75919bd71912baf75a64010efcfcd93d07f1 | Update library magic to be recursive | library_magic.py | library_magic.py | import sys
import subprocess
import shutil
copied = []
def update_libraries(executable):
# Find all the dylib files and recursively add dependencies
print "\nChecking dependencies of " + executable
otool_cmd = ["otool", "-L",executable]
execfolder = executable.rsplit("/",1)[0]
otool_out = subprocess.check_outp... | import sys
import subprocess
import shutil
executable = sys.argv[1]
execfolder = sys.argv[1].rsplit("/",1)[0]
libdir = execfolder+"/lib"
otool_cmd = ["otool", "-L",executable]
# Run otool
otool_out = subprocess.check_output(otool_cmd).split("\n\t")
# Find all the dylib files
for l in otool_out:
s = l.split(".dylib"... | Python | 0 |
17ac4f42fae21dcd0ebb18a63b50d949540488f2 | Test for update on User Field | aligot/tests/test_user.py | aligot/tests/test_user.py | # coding: utf-8
from django.core.urlresolvers import reverse
from django.db.utils import IntegrityError
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from ..models import User
class TestUser(TestCase):
def test_create_with_same_email(self):
... | # coding: utf-8
from django.core.urlresolvers import reverse
from django.db.utils import IntegrityError
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from ..models import User
class TestUser(TestCase):
def test_create_with_same_email(self):
... | Python | 0 |
5c3af04057104e69531ae51e6dd755d0abbdc0be | move initialization code to init | yandextank/plugins/Influx/plugin.py | yandextank/plugins/Influx/plugin.py | # coding=utf-8
# TODO: make the next two lines unnecessary
# pylint: disable=line-too-long
# pylint: disable=missing-docstring
import logging
import sys
import datetime
from uuid import uuid4
from builtins import str
from influxdb import InfluxDBClient
from ...common.interfaces import AbstractPlugin, \
Monitori... | # coding=utf-8
# TODO: make the next two lines unnecessary
# pylint: disable=line-too-long
# pylint: disable=missing-docstring
import logging
import sys
import datetime
from uuid import uuid4
from builtins import str
from influxdb import InfluxDBClient
from ...common.interfaces import AbstractPlugin, \
Monitori... | Python | 0.000005 |
42b1f3e7b7cc856b099796c7eb118ec2a6a96216 | Optimize queries | lib/aquilon/worker/commands/compile.py | lib/aquilon/worker/commands/compile.py | # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2013,2014 Contributor
#
# 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... | # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2013,2014 Contributor
#
# 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... | Python | 0.000002 |
62cd48f8a0fc83261af5c4275a38102fc983d3ff | Increase failure tolerance for the Dashboard | tests/test_dashboard.py | tests/test_dashboard.py | from datetime import datetime, timedelta
from dateutil import parser as date_parser
import pytest
import pytz
from web_test_base import *
class TestIATIDashboard(WebTestBase):
requests_to_load = {
'Dashboard Homepage': {
'url': 'http://dashboard.iatistandard.org/'
}
}
def test_... | from datetime import datetime, timedelta
from dateutil import parser as date_parser
import pytest
import pytz
from web_test_base import *
class TestIATIDashboard(WebTestBase):
requests_to_load = {
'Dashboard Homepage': {
'url': 'http://dashboard.iatistandard.org/'
}
}
def test_... | Python | 0 |
c076fb75d40b85b593bd569eaf7f6e13ab95cdd8 | Replace Pykka internals misuse with proxies | mopidy/frontends/mpd/actor.py | mopidy/frontends/mpd/actor.py | import logging
import sys
import pykka
from mopidy import settings
from mopidy.core import CoreListener
from mopidy.frontends.mpd import session
from mopidy.utils import encoding, network, process
logger = logging.getLogger('mopidy.frontends.mpd')
class MpdFrontend(pykka.ThreadingActor, CoreListener):
"""
... | import logging
import sys
import pykka
from mopidy import settings
from mopidy.core import CoreListener
from mopidy.frontends.mpd import session
from mopidy.utils import encoding, network, process
logger = logging.getLogger('mopidy.frontends.mpd')
class MpdFrontend(pykka.ThreadingActor, CoreListener):
"""
... | Python | 0.000014 |
c68833f3c464720b676080705d2df4f7e37c4392 | fix template render() expect Context and not dict | feincms/tests/applicationcontent_urls.py | feincms/tests/applicationcontent_urls.py | """
This is a dummy module used to test the ApplicationContent
"""
from django import template
from django.conf.urls.defaults import *
from django.http import HttpResponse, HttpResponseRedirect
def module_root(request):
return 'module_root'
def args_test(request, kwarg1, kwarg2):
return HttpResponse(u'%s-%... | """
This is a dummy module used to test the ApplicationContent
"""
from django import template
from django.conf.urls.defaults import *
from django.http import HttpResponse, HttpResponseRedirect
def module_root(request):
return 'module_root'
def args_test(request, kwarg1, kwarg2):
return HttpResponse(u'%s-%... | Python | 0.000001 |
8b364a2b9eaff5e038d47a114746458de56b4ed5 | fix apitype casing for underscore classes | saga/base.py | saga/base.py |
import string
import saga.utils.logger
import saga.engine.engine
class SimpleBase (object) :
""" This is a very simple API base class which just initializes
the self._logger and self._engine members, but does not perform any further
initialization, nor any adaptor binding. This base is used for API clas... |
import string
import saga.utils.logger
import saga.engine.engine
class SimpleBase (object) :
""" This is a very simple API base class which just initializes
the self._logger and self._engine members, but does not perform any further
initialization, nor any adaptor binding. This base is used for API clas... | Python | 0.000001 |
1a830910b104476630bf5d1bc8a0eb8f757c1e20 | Fix scope for self view in orgchart. | mozillians/dino_park/views.py | mozillians/dino_park/views.py | import requests
import urlparse
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.http import HttpResponseForbidden, JsonResponse
from django.shortcuts import render
from django.views.decorators.cache import never_cache
f... | import requests
import urlparse
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.http import HttpResponseForbidden, JsonResponse
from django.shortcuts import render
from django.views.decorators.cache import never_cache
f... | Python | 0 |
b282b2df1aed13cf5ad42b656f9cc2910feb90c2 | removed whitespace | python-wallaroo/wallaroo/client/node.py | python-wallaroo/wallaroo/client/node.py | # Copyright (c) 2013 Red Hat, Inc.
# Author: William Benton (willb@redhat.com)
# 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 r... | # Copyright (c) 2013 Red Hat, Inc.
# Author: William Benton (willb@redhat.com)
# 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 r... | Python | 0.999428 |
2023f8ff3534b2bd70a4f31d247033b91dd76e79 | Fix crash when urlrewrite is configured to allow infinite rewriting | flexget/plugins/urlrewrite_urlrewrite.py | flexget/plugins/urlrewrite_urlrewrite.py | from __future__ import unicode_literals, division, absolute_import
import re
import logging
from flexget import plugin
from flexget.event import event
from flexget.plugins.plugin_urlrewriting import UrlRewritingError
log = logging.getLogger('urlrewrite')
class UrlRewrite(object):
"""
Generic configurable ur... | from __future__ import unicode_literals, division, absolute_import
import re
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('urlrewrite')
class UrlRewrite(object):
"""
Generic configurable urlrewriter.
Example::
urlrewrite:
demonoid:
... | Python | 0 |
bfc248e92afdc02a8b3089d7a2a5194b7f55c2fe | add in the split out setup_ufw_rules to the api and setupnode | woven/api.py | woven/api.py | #!/usr/bin/env python
"""
The full public woven api
"""
from fabric.state import env
from woven.decorators import run_once_per_node, run_once_per_version
from woven.deployment import deploy_files, mkdirs
from woven.deployment import upload_template
from woven.environment import check_settings, deployment_root, set_e... | #!/usr/bin/env python
"""
The full public woven api
"""
from fabric.state import env
from woven.decorators import run_once_per_node, run_once_per_version
from woven.deployment import deploy_files, mkdirs
from woven.deployment import upload_template
from woven.environment import check_settings, deployment_root, set_e... | Python | 0 |
bb74df460e0d1823048cbb3e09ce882e519167c5 | make not empty strings hold in node.text in XML backend | anyconfig/backend/xml_.py | anyconfig/backend/xml_.py | #
# Copyright (C) 2011 - 2014 Satoru SATOH <ssato @ redhat.com>
# License: MIT
#
# pylint: disable=R0921
from anyconfig.globals import LOGGER as logging
import anyconfig.backend.base as Base
import anyconfig.compat as AC
SUPPORTED = True
try:
# First, try lxml which is compatible with elementtree and looks faste... | #
# Copyright (C) 2011 - 2014 Satoru SATOH <ssato @ redhat.com>
# License: MIT
#
# pylint: disable=R0921
from anyconfig.globals import LOGGER as logging
import anyconfig.backend.base as Base
import anyconfig.compat as AC
SUPPORTED = True
try:
# First, try lxml which is compatible with elementtree and looks faste... | Python | 0.000001 |
1a755a0512753111fedc229241c57d302f0115d4 | Refactor test_importers | tests/test_importers.py | tests/test_importers.py | try:
from mock import Mock
except ImportError:
from unittest.mock import Mock
import yaml
from passpie.importers import find_importer
from passpie.importers.default_importer import DefaultImporter
def test_find_importer_returns_first_match_default_importer(mocker):
mock_importer = Mock()
mock_import... | try:
from mock import Mock
except ImportError:
from unittest.mock import Mock
import yaml
from passpie.importers import find_importer
from passpie.importers.default import DefaultImporter
def test_find_importer_returns_first_match_default_importer(mocker):
mock_importer = Mock()
mock_importer2 = Moc... | Python | 0 |
dbb153b4681a1fa73f93855e86d3657e4fff9bfb | remove self | tests/test_interface.py | tests/test_interface.py | ''' Script to check the readout system interface (software + FPGA firmware).
A global register test is performed with pyBAR and a simulation of the FPGA + FE-I4.
'''
import unittest
import shutil
import mock
from Queue import Empty
import subprocess
import time
import os
from pybar.run_manager import RunManager
from p... | ''' Script to check the readout system interface (software + FPGA firmware).
A global register test is performed with pyBAR and a simulation of the FPGA + FE-I4.
'''
import unittest
import shutil
import mock
from Queue import Empty
import subprocess
import time
import os
from pybar.run_manager import RunManager
from p... | Python | 0.000039 |
2c67dd081895d00ffb33e29d8750b3f80121dfe5 | Change import | tests/test_judicious.py | tests/test_judicious.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `judicious` package."""
import pytest
import judicious
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return requests.get('https://github.com... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `judicious` package."""
import pytest
from judicious import judicious
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return requests.get('htt... | Python | 0.000001 |
9a278ac9ea0c124cfd108f276bc5d74da6c5c50c | Update notebook test | tests/test_notebooks.py | tests/test_notebooks.py | # Copyright 2017 the GPflow 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 or agreed to in writi... | # Copyright 2017 the GPflow 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 or agreed to in writi... | Python | 0 |
be412947c0fe30dd659298cd7641b5a701310f7d | add auth option | gitdata.py | gitdata.py | """GitHub query CLI.
cli() --------------> Handle command-line arguments.
"""
import os
import click
from click.testing import CliRunner
#------------------------------------------------------------------------------
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.group(context_settings=CONTEXT_SE... | """GitHub query CLI.
cli() --------------> Handle command-line arguments.
"""
import os
import click
from click.testing import CliRunner
#------------------------------------------------------------------------------
@click.group()
@click.version_option(version='1.0', prog_name='Photerino')
def cli():
"""\b
... | Python | 0.000004 |
049d734486627224b87cba72c575450515060c55 | fix split | vlermv/_s3.py | vlermv/_s3.py | import tempfile
import boto
from ._abstract import AbstractVlermv
def split(x):
return tuple(x.split('/'))
class S3Vlermv(AbstractVlermv):
def __init__(self, bucketname, *args, connect_s3 = boto.connect_s3, **kwargs):
super(S3Vlermv, self).__init__(**kwargs)
self.bucket = connect_s3().creat... | import tempfile
import boto
from ._abstract import AbstractVlermv
def split(x):
return x.split('/')
class S3Vlermv(AbstractVlermv):
def __init__(self, bucketname, *args, connect_s3 = boto.connect_s3, **kwargs):
super(S3Vlermv, self).__init__(**kwargs)
self.bucket = connect_s3().create_bucke... | Python | 0.000001 |
394473b6d8fb9898a19bb7e3bd2141a59572adec | 更新 modules users/apps.py, 修正 PEP8 警告 | commonrepo/users/apps.py | commonrepo/users/apps.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.apps import AppConfig
from actstream import registry
class UsersAppConfig(AppConfig):
name = 'commonrepo.users'
def ready(self):
registry.register(self.get_model('User'))
import commonrepo.users.sig... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.apps import AppConfig
from actstream import registry
class UsersAppConfig(AppConfig):
name = 'commonrepo.users'
def ready(self):
registry.register(self.get_model('User'))
import commonrepo.users.sign... | Python | 0 |
999b8c29c7e3be974b29f69b8e007fcc77742e03 | fix broken test case | tests/test_transcode.py | tests/test_transcode.py | import os
from nose.tools import eq_
from pyexcel_cli.transcode import transcode
from click.testing import CliRunner
def test_simple_option():
runner = CliRunner()
test_fixture = os.path.join("tests", "fixtures",
"transcode_simple.csv")
output = "test_simple_option.csv"
... | import os
from nose.tools import eq_
from pyexcel_cli.transcode import transcode
from click.testing import CliRunner
def test_simple_option():
runner = CliRunner()
test_fixture = os.path.join("tests", "fixtures",
"transcode_simple.csv")
output = "test_simple_option.csv"
... | Python | 0.000008 |
dfa39db42cc5ce2c29da2ec0c388865ec7f41030 | Add allow field to form | oauth2_provider/forms.py | oauth2_provider/forms.py | from django import forms
class AllowForm(forms.Form):
allow = forms.BooleanField(required=False)
redirect_uri = forms.URLField(widget=forms.HiddenInput())
scopes = forms.CharField(required=False, widget=forms.HiddenInput())
client_id = forms.CharField(widget=forms.HiddenInput())
state = forms.Char... | from django import forms
class AllowForm(forms.Form):
redirect_uri = forms.URLField(widget=forms.HiddenInput())
scopes = forms.CharField(required=False, widget=forms.HiddenInput())
client_id = forms.CharField(widget=forms.HiddenInput())
state = forms.CharField(required=False, widget=forms.HiddenInput(... | Python | 0 |
07b7291caa83ce1948e6687651645c0a964c25b5 | Remove a space before colons | openquake/engine/settings.py | openquake/engine/settings.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2014, GEM Foundation.
#
# OpenQuake 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 Lice... | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2014, GEM Foundation.
#
# OpenQuake 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 Lice... | Python | 0.999998 |
7480fa45fac507a9d3a14589d87a9f96beb1ddbb | fix mute button bug | app/controllers/mixers.py | app/controllers/mixers.py | # -*- encoding: utf-8; py-indent-offset: 4 -*-
# +--------------------------------------------------------------------------+
# | _____ __ ___ ______ __ |
# | / ___// /___ ______/ (_)___ / ____/___ ____ ____ ___ _____/ /_ |
# | \__ \/ __/ / / / __ / / __ \ ... | # -*- encoding: utf-8; py-indent-offset: 4 -*-
# +--------------------------------------------------------------------------+
# | _____ __ ___ ______ __ |
# | / ___// /___ ______/ (_)___ / ____/___ ____ ____ ___ _____/ /_ |
# | \__ \/ __/ / / / __ / / __ \ ... | Python | 0.000002 |
cbb6929007b20d5b95be6aafba3e0841144a16e7 | Rename get_scheduled_report_ids keys helper and pull out guess_reporting_minute | corehq/apps/saved_reports/scheduled.py | corehq/apps/saved_reports/scheduled.py | from __future__ import absolute_import
from __future__ import unicode_literals
from calendar import monthrange
from datetime import datetime
from corehq.apps.saved_reports.models import ReportNotification
from corehq.util.soft_assert import soft_assert
from six.moves import range
_soft_assert = soft_assert(
to='{... | from __future__ import absolute_import
from __future__ import unicode_literals
from calendar import monthrange
from datetime import datetime
from corehq.apps.saved_reports.models import ReportNotification
from corehq.util.soft_assert import soft_assert
from six.moves import range
_soft_assert = soft_assert(
to='{... | Python | 0.000001 |
cc4aca4cef667bfa4eb51cfad677e63ec54e60a9 | update searching fields | emgapi/viewsets.py | emgapi/viewsets.py | # -*- coding: utf-8 -*-
# Copyright 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 requ... | # -*- coding: utf-8 -*-
# Copyright 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 requ... | Python | 0 |
b0ff934a2e20916f9e777874b795c9d0942a48e4 | use app.cfg from its proper place | openarticlegauge/core.py | openarticlegauge/core.py | import os, requests, json, redis
from flask import Flask
from openarticlegauge import config, licenses
from flask.ext.login import LoginManager, current_user
login_manager = LoginManager()
def create_app():
app = Flask(__name__)
configure_app(app)
if app.config['INITIALISE_INDEX']: initialise_index(app)
... | import os, requests, json, redis
from flask import Flask
from openarticlegauge import config, licenses
from flask.ext.login import LoginManager, current_user
login_manager = LoginManager()
def create_app():
app = Flask(__name__)
configure_app(app)
if app.config['INITIALISE_INDEX']: initialise_index(app)
... | Python | 0.000001 |
da1dbddaa47e087b19dbeb1b256b337a3e77ed73 | Fix os not defined | gaphor/services/tests/test_properties.py | gaphor/services/tests/test_properties.py | import os
import tempfile
from unittest import TestCase
from gaphor.services.properties import FileBackend, Properties
class MockEventManager(list):
def handle(self, event):
self.append(event)
class TestProperties(TestCase):
def setUp(self):
self.tmpdir = tempfile.mkdtemp()
backend ... | import tempfile
from unittest import TestCase
from gaphor.services.properties import FileBackend, Properties
class MockEventManager(list):
def handle(self, event):
self.append(event)
class TestProperties(TestCase):
def setUp(self):
self.tmpdir = tempfile.mkdtemp()
backend = FileBack... | Python | 0 |
11cd074f67668135d606f68dddb66c465ec01756 | Add db index on field tag name | opps/core/tags/models.py | opps/core/tags/models.py | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from opps.core.models import Date, Slugged
class Tag(Date, Slugged):
name = models.CharField(_(u'Name'), max_length=255, unique=True,
... | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from opps.core.models import Date, Slugged
class Tag(Date, Slugged):
name = models.CharField(_(u'Name'), max_length=255, unique=True)
def save(self,... | Python | 0 |
706aa6ed7170709828258bca1b9a1dfe6e8fa77e | improve helper functions | SLHelper.py | SLHelper.py | # -*- coding: utf-8 -*-
import re
import tkinter
from tkinter import messagebox
def file_content(filename):
with open(filename, 'rb') as fin:
content = fin.read()
return content.decode('utf-8')
def write_file(filename, content):
with open(filename, 'wb') as fout:
fout.write(c... | # -*- coding: utf-8 -*-
import re
import tkinter
from tkinter import messagebox
def file_content(filename):
with open(filename, 'r') as fin:
content = fin.read()
return content
def write_file(filename, content):
with open(filename, 'wb') as fout:
fout.write(content.encode('ut... | Python | 0.00001 |
c1a76b78b7c567f22e76372ae22380c511e7a2f1 | Complete docstring of parse_branches | readthedocs/vcs_support/backends/hg.py | readthedocs/vcs_support/backends/hg.py | # -*- coding: utf-8 -*-
"""Mercurial-related utilities."""
from __future__ import absolute_import
from readthedocs.projects.exceptions import RepositoryError
from readthedocs.vcs_support.base import BaseVCS, VCSVersion
class Backend(BaseVCS):
"""Mercurial VCS backend."""
supports_tags = True
supports_br... | # -*- coding: utf-8 -*-
"""Mercurial-related utilities."""
from __future__ import absolute_import
from readthedocs.projects.exceptions import RepositoryError
from readthedocs.vcs_support.base import BaseVCS, VCSVersion
class Backend(BaseVCS):
"""Mercurial VCS backend."""
supports_tags = True
supports_br... | Python | 0.000002 |
9d65b613384b1d4781efd65588639ad68261e8d7 | Remove unused import. | cryptography/hazmat/primitives/hmac.py | cryptography/hazmat/primitives/hmac.py | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | Python | 0 |
38a2d86aed4ea1e94691993c5f49722f9a69ac8d | Remove Python < 3.6 version check | lisa/__init__.py | lisa/__init__.py | #! /usr/bin/env python3
import warnings
import os
import sys
from lisa.version import __version__
# Raise an exception when a deprecated API is used from within a lisa.*
# submodule. This ensures that we don't use any deprecated APIs internally, so
# they are only kept for external backward compatibility purposes.
... | #! /usr/bin/env python3
import warnings
import os
import sys
from lisa.version import __version__
# Raise an exception when a deprecated API is used from within a lisa.*
# submodule. This ensures that we don't use any deprecated APIs internally, so
# they are only kept for external backward compatibility purposes.
... | Python | 0 |
13298bd49d9c72b8db6650fb0f8b316998b302f0 | Add permissions on TodoList model. | safarido/todos/models.py | safarido/todos/models.py | from django.conf import settings
from django.db import models
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
class TimestampedModel(models.Model):
created_on = models.DateTimeField(_('created on'), auto_now_add=True)
modified_on = models.DateTimeFiel... | from django.conf import settings
from django.db import models
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
class TimestampedModel(models.Model):
created_on = models.DateTimeField(_('created on'), auto_now_add=True)
modified_on = models.DateTimeFiel... | Python | 0 |
b16a1987075bd72cb7d31cf3dc7e529ce8d0e102 | fix loop | wisely_project/get_courses_file.py | wisely_project/get_courses_file.py | import sys
import os
import traceback
from django import db
sys.path.append('/root/wisely/wisely_project/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'wisely_project.settings.production'
from django.db.models import F, Q
from django.utils import timezone
from users.tasks import get_coursera_courses, get_edx_courses, ge... | import sys
import os
import traceback
from django import db
sys.path.append('/root/wisely/wisely_project/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'wisely_project.settings.production'
from django.db.models import F
from django.utils import timezone
from users.tasks import get_coursera_courses, get_edx_courses, get_u... | Python | 0.000002 |
f5f6b93d34318a1d6f65082df8482376e92960c9 | Revamp XML parsing method | wm_metrics/analyse_commons_dump.py | wm_metrics/analyse_commons_dump.py | # -*- coding: utf-8 -*-
import xml.dom.minidom
import re
import datetime
def handle_node(node, tag_name):
"""Return the contents of a tag based on his given name inside of a given node."""
element = node.getElementsByTagName(tag_name)
if element.length > 0:
if element.item(0).hasChildNodes():
... | # -*- coding: utf-8 -*-
import xml.dom.minidom
import re
import datetime
def handle_node(node, tag_name):
"""Return the contents of a tag based on his given name inside of a given node."""
element = node.getElementsByTagName(tag_name)
if element.length > 0:
if element.item(0).hasChildNodes():
... | Python | 0.998547 |
a2c484afc3951a77a6684f9c7323672c6db691aa | Fix name of celery queue | genomic_neuralnet/common/celery_slave.py | genomic_neuralnet/common/celery_slave.py | from __future__ import print_function
import os
import sys
import time
import numpy as np
import redis
import pickle
from itertools import chain
from genomic_neuralnet.common.base_compare import try_predictor
from genomic_neuralnet.util.ec2_util import get_master_dns
from celery import Celery
import celery.app.cont... | from __future__ import print_function
import os
import sys
import time
import numpy as np
import redis
import pickle
from itertools import chain
from genomic_neuralnet.common.base_compare import try_predictor
from genomic_neuralnet.util.ec2_util import get_master_dns
from celery import Celery
import celery.app.cont... | Python | 0.999924 |
e8003dbb1e6a7efe60b02c65207c7202236b1adb | Update InputDialogCtrl.py | helenae/gui/widgets/InputDialogCtrl.py | helenae/gui/widgets/InputDialogCtrl.py | # -*- coding: utf-8 -*-
import wx
class InputDialog(wx.Dialog):
def __init__(self, parent, id, title, ico_folder, validator):
wx.Dialog.__init__(self, parent, id, title, style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)
self.label = wx.StaticText(self, label="Имя элемента:", pos=(15, 20))
... | # -*- coding: utf-8 -*-
import wx
from validators.FileValidator import FileValidator
class InputDialog(wx.Dialog):
def __init__(self, parent, id, title, ico_folder, validator):
wx.Dialog.__init__(self, parent, id, title, style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)
self.label = wx.StaticText(... | Python | 0.000001 |
a705892cd7e32a540c5fee61a2bf4c4d67abf477 | add get_all_required_node_names method | xos/tosca/resources/xosresource.py | xos/tosca/resources/xosresource.py | class XOSResource(object):
xos_base_class = "XOSResource"
xos_model = None
provides = None
def __init__(self, user, nodetemplate):
self.dirty = False
self.user = user
self.nodetemplate = nodetemplate
def get_all_required_node_names(self):
results = []
for re... | class XOSResource(object):
xos_base_class = "XOSResource"
xos_model = None
provides = None
def __init__(self, user, nodetemplate):
self.dirty = False
self.user = user
self.nodetemplate = nodetemplate
def get_requirements(self, relationship_name, throw_exception=False):
... | Python | 0.000003 |
baee05c39e1d9424348d5634825788e001a01fea | Update generator | CarND-Behavioral-Cloning-P3/model.py | CarND-Behavioral-Cloning-P3/model.py | import csv
import cv2
import numpy as np
lines = []
# Open the csv log file and read the file name of the figure
with open('./data/driving_log.csv') as csvfile:
reader = csv.reader(csvfile)
for line in reader:
lines.append(line)
images = []
measurements = []
for line in lines:
fo... | import csv
import cv2
import numpy as np
lines = []
# Open the csv log file and read the file name of the figure
with open('./data/driving_log.csv') as csvfile:
reader = csv.reader(csvfile)
for line in reader:
lines.append(line)
images = []
measurements = []
for line in lines:
fo... | Python | 0.000001 |
cb3bb4d350d5b05c9f3f123dc71dc4cec9f70703 | Convert to use Context. | example_widgets.py | example_widgets.py | from picotui.context import Context
from picotui.screen import Screen
from picotui.widgets import *
from picotui.defs import *
with Context():
Screen.attr_color(C_WHITE, C_BLUE)
Screen.cls()
Screen.attr_reset()
d = Dialog(5, 5, 50, 12)
# Can add a raw string to dialog, will be converted to WLabe... | from picotui.screen import Screen
from picotui.widgets import *
from picotui.defs import *
if __name__ == "__main__":
s = Screen()
try:
s.init_tty()
s.enable_mouse()
s.attr_color(C_WHITE, C_BLUE)
s.cls()
s.attr_reset()
d = Dialog(5, 5, 50, 12)
# Can ad... | Python | 0.00001 |
e9a3ff651988e7bf45df2fefb1373a40080b934a | Update scapywrapper.py | src/Scapy2Library/utils/scapywrapper.py | src/Scapy2Library/utils/scapywrapper.py | from scapy.all import *
import scapy.contrib.igmp
def send_igmp_pkt(dst_mac, src_mac, vlan_id, dst_ip, src_ip, proto_type, mcast_addr, ttl, max_rsp_time, validate=1):
"""
brief: create igmp packet and send it
:param dst_mac: destination MAC address
:param src_mac: source MAC ad... | Python | 0 | |
36a57b00d96e2ffed57572aaa3de074305e03244 | Use attr** in solax (#62397) | homeassistant/components/solax/sensor.py | homeassistant/components/solax/sensor.py | """Support for Solax inverter via local API."""
import asyncio
from datetime import timedelta
from solax import real_time_api
from solax.inverter import InverterError
import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorDeviceClass,
SensorEntity,
SensorStateCla... | """Support for Solax inverter via local API."""
import asyncio
from datetime import timedelta
from solax import real_time_api
from solax.inverter import InverterError
import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorDeviceClass,
SensorEntity,
SensorStateCla... | Python | 0 |
bc6772cb8990039479f6fe2b238304765aafab41 | make 70_web.py better | examples/70_web.py | examples/70_web.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Run this script, then try the following urls:
#
# 1. http://127.0.0.1:5000/?person_id=mosky
# 2. http://127.0.0.1:5000/?name=Mosky Liu
# 3. http://127.0.0.1:5000/?name like=%Mosky%
#
import psycopg2
from flask import Flask, request, jsonify
from mosql.query import selec... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Run this script, then try the following urls:
#
# 1. http://127.0.0.1:5000/?person_id=mosky
# 2. http://127.0.0.1:5000/?name=Mosky Liu
# 3. http://127.0.0.1:5000/?name like=%Mosky%
#
import psycopg2
from flask import Flask, request, jsonify
from mosql.query import selec... | Python | 0.000151 |
cb5aeedc651773d1c298b167b07aa535dfd7beca | Fix typos/spelling in serializer docstrings (#2420) | parsl/serialize/concretes.py | parsl/serialize/concretes.py | import dill
import pickle
import logging
logger = logging.getLogger(__name__)
from parsl.serialize.base import SerializerBase
class PickleSerializer(SerializerBase):
""" Pickle serialization covers most python objects, with some notable exceptions:
* functions defined in a interpreter/notebook
* classes... | import dill
import pickle
import logging
logger = logging.getLogger(__name__)
from parsl.serialize.base import SerializerBase
class PickleSerializer(SerializerBase):
""" Pickle serialization covers most python objects, with some notable exceptions:
* functions defined in a interpretor/notebook
* classes... | Python | 0.000005 |
7fd76d87cfda8f02912985cb3cf650ee8ff2e11e | Remove py2 Ska.DBI assert in report test | mica/report/tests/test_write_report.py | mica/report/tests/test_write_report.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import tempfile
import os
import shutil
import pytest
from .. import report
try:
import Ska.DBI
with Ska.DBI.DBI(server='sqlsao', dbi='sybase', user='aca_ops', database='axafocat') as db:
HAS_SYBASE_ACCESS = True
except:
HAS_SYBASE_AC... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import tempfile
import os
import shutil
import pytest
from .. import report
try:
import Ska.DBI
with Ska.DBI.DBI(server='sqlsao', dbi='sybase', user='aca_ops', database='axafocat') as db:
assert db.conn._is_connected == 1
HAS_SYBA... | Python | 0 |
319d457e1e6511f6c240f5f4f5479181647f7cf6 | Fix bug with test | scopus/tests/test_AffiliationSearch.py | scopus/tests/test_AffiliationSearch.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `AffiliationSearch` module."""
from collections import namedtuple
from nose.tools import assert_equal, assert_true
import scopus
s = scopus.AffiliationSearch('af-id(60021784)', refresh=True)
def test_affiliations():
received = s.affiliations
asser... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `AffiliationSearch` module."""
from collections import namedtuple
from nose.tools import assert_equal, assert_true
import scopus
s = scopus.AffiliationSearch('af-id(60021784)', refresh=True)
def test_affiliations():
received = s.affiliations
asser... | Python | 0 |
ed0821bd41a10dd00727f09cf9ba82123bd2cf93 | Fix output of permissions import script | scripts/import_permissions_and_roles.py | scripts/import_permissions_and_roles.py | #!/usr/bin/env python
"""Import permissions, roles, and their relations from a TOML file.
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
import click
from byceps.services.authorization import impex_service
from byceps.util.system import get_config_filename_from... | #!/usr/bin/env python
"""Import permissions, roles, and their relations from a TOML file.
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
import click
from byceps.services.authorization import impex_service
from byceps.util.system import get_config_filename_from... | Python | 0.000003 |
cf94a8a51d4e8eb3fd96ca3587af0f4c38e2deec | Fix kdtree example | examples/kdtree.py | examples/kdtree.py | from __future__ import print_function
import numpy as np
import pcl
points_1 = np.array([[0, 0, 0],
[1, 0, 0],
[0, 1, 0],
[1, 1, 0]], dtype=np.float32)
points_2 = np.array([[0, 0, 0.2],
[1, 0, 0],
[0, 1, 0],
... | from __future__ import print_function
import numpy as np
import pcl
pc_1 = pcl.PointCloud()
pc_1.from_array(points_1)
pc_2 = pcl.PointCloud()
pc_2.from_array(points_2)
kd = pcl.KdTreeFLANN(pc_1)
points_1 = np.array([[0, 0, 0],
[1, 0, 0],
[0, 1, 0],
[1, 1... | Python | 0.000028 |
881290c3d29ad28fb0fddfdd895fe493d7909262 | make the wsgi.py work with all providers | django_deployer/paas_templates/wsgi.py | django_deployer/paas_templates/wsgi.py | import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),'{{ project_name }}')))
os.environ['DJANGO_SETTINGS_MODULE'] = '{{ django_settings }}_{{ provider }}'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler() | import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),'{{ project_name }}')))
os.environ['DJANGO_SETTINGS_MODULE'] = '{{ django_settings }}_stackato'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler() | Python | 0 |
b7b32005867b0bba06dd132713aebce4ed48f6c3 | update Param API | hwtLib/examples/hierarchy/unitWrapper.py | hwtLib/examples/hierarchy/unitWrapper.py | from hwt.hdl.constants import INTF_DIRECTION
from hwt.synthesizer.unit import Unit
from hwt.synthesizer.param import Param
class UnitWrapper(Unit):
"""
Class which creates wrapper around original unit instance,
original unit will be stored inside as subunit named baseUnit
:note: This is example of la... | from hwt.hdl.constants import INTF_DIRECTION
from hwt.synthesizer.unit import Unit
from hwt.synthesizer.param import Param
class UnitWrapper(Unit):
"""
Class which creates wrapper around original unit instance,
original unit will be stored inside as subunit named baseUnit
:note: This is example of la... | Python | 0.000001 |
7b84c2bd59f455050a249da795d1a73021b12581 | Add an import | pathvalidate/__init__.py | pathvalidate/__init__.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from ._error import NullNameError
from ._error import InvalidCharError
from ._error import InvalidCharWindowsError
from ._error import InvalidLengthError
from ._common import _validate_null_strin... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from ._error import NullNameError
from ._error import InvalidCharError
from ._error import InvalidLengthError
from ._common import _validate_null_string
from ._app import validate_excel_sheet_nam... | Python | 0.000005 |
343ed4b5ce1685c00eb611982319e48047c46361 | remove dead code | samples/test_a/test_a.py | samples/test_a/test_a.py | class project:
title = "Main Project"
estimate = 3
class task_a:
estimate = 8
class task_b:
title = "Task B"
estimate = 4
def deps(): return [project.task_a, other.task_d]
class task_c:
estimate = 6
def deps(): return [project.task_a]
class other:
... | class project:
title = "Main Project"
estimate = 3
class task_a:
estimate = 8
class task_b:
title = "Task B"
estimate = 4
def deps(): return [project.task_a, other.task_d]
class task_c:
estimate = 6
def deps(): return [project.task_a]
class other:
... | Python | 0.999454 |
64becacba2458587ee524aeaef1f9c1995e0c921 | fix cymrulib unicode problems | intelmq/bots/experts/cymru/cymrulib.py | intelmq/bots/experts/cymru/cymrulib.py | import binascii, dns.resolver, StringIO
from intelmq.lib.utils import reverse_ip
'''
Reference: http://www.team-cymru.org/Services/ip-to-asn.html#dns
'''
IP_QUERY = "%s.origin%s.asn.cymru.com"
ASN_QUERY = "AS%s.asn.cymru.com"
class Cymru():
@staticmethod
def query(ip, ip_version):
raw_result = ... | import binascii, dns.resolver
from intelmq.lib.utils import reverse_ip, decode
'''
Reference: http://www.team-cymru.org/Services/ip-to-asn.html#dns
'''
IP_QUERY = "%s.origin%s.asn.cymru.com"
ASN_QUERY = "AS%s.asn.cymru.com"
class Cymru():
@staticmethod
def query(ip, ip_version):
raw_result = Cy... | Python | 0.000014 |
7b0f431a896ce8cfb39e11c2a6f3e802085f2e09 | Correct target file suffixes. | __init__.py | __init__.py | import SCons.Builder
import SCons.Scanner
def asciidoc_scanner(node, env, path):
"""Scans AsciiDoc files for include::[] directives"""
import os
import re
fname = str(node)
# TODO: maybe raise an error here?
if not os.path.isfile(fname):
return []
reg = re.compile('include::(.+)... | import SCons.Builder
import SCons.Scanner
def asciidoc_scanner(node, env, path):
"""Scans AsciiDoc files for include::[] directives"""
import os
import re
fname = str(node)
# TODO: maybe raise an error here?
if not os.path.isfile(fname):
return []
reg = re.compile('include::(.+)... | Python | 0 |
ba0f68221ed0aa3d0fcf99efcb3180ddd9d89e0b | add imports to magenta/music/__init__.py for notebook functions (#246) | __init__.py | __init__.py | # Copyright 2016 Google 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 required by applicable law or ag... | # Copyright 2016 Google 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 required by applicable law or ag... | Python | 0 |
f21e1daa1324ec09e010ac7aa5b64134a97320db | Add test that runs `locust --help` | locust/test/test_main.py | locust/test/test_main.py | import os
import subprocess
from unittest import TestCase
from locust import main
from locust.argument_parser import parse_options
from locust.main import create_environment
from locust.core import HttpLocust, Locust, TaskSet
from .testcases import LocustTestCase
from .mock_locustfile import mock_locustfile
class Te... | import os
from locust import main
from locust.argument_parser import parse_options
from locust.main import create_environment
from locust.core import HttpLocust, Locust, TaskSet
from .testcases import LocustTestCase
from .mock_locustfile import mock_locustfile
class TestLoadLocustfile(LocustTestCase):
def test_i... | Python | 0.000001 |
0890014c18cd51f85534b096866c4d8b7cba6c3e | Create pool of processes and apply async | scripts4PAML/macse4cdsOrthofiles_TA.py | scripts4PAML/macse4cdsOrthofiles_TA.py | #!/usr/bin/python3
"""A program for aligning CDSs of a orthogroup.
USAGE: ./macse4cdsOrthofiles_TA.py
Author: Taruna Aggarwal
Affiliation: University of New Hampshire, Durham, NH, USA
Date: 01/27/2016
Purpose is
"""
import sys
import os
import subprocess
import argparse
import multiprocessing as mp
def runMACSE(inp... | #!/usr/bin/python3
"""A program for aligning CDSs of a orthogroup.
USAGE: ./macse4cdsOrthofiles_TA.py
Author: Taruna Aggarwal
Affiliation: University of New Hampshire, Durham, NH, USA
Date: 01/27/2016
Purpose is
"""
import sys
import os
import subprocess
import argparse
from multiprocessing import pool
def runMACSE... | Python | 0 |
b500c1277645350eb66610d796ffca3170e1bdc5 | Add options for excluding files | hashDir.py | hashDir.py | import argparse
import sys
from Furtive import Furtive
''' '''
def main():
# If Python 2.6 or lower, should import optparse but erroring out now
if sys.hexversion < 0x02070000:
raise SystemError("Python version 2.7.0 or greater is required. You are running " + sys.version)
parser = argparse.Argument... | import argparse
import sys
from Furtive import Furtive
''' '''
def main():
# If Python 2.6 or lower, should import optparse but erroring out now
if sys.hexversion < 0x02070000:
raise SystemError("Python version 2.7.0 or greater is required. You are running " + sys.version)
parser = argparse.Argument... | Python | 0.000001 |
3db5577f860ac5c931fd267092433c3f547693ab | Upgrade selenium to version 2.52.0 | seleniumbase/core/selenium_launcher.py | seleniumbase/core/selenium_launcher.py | """ Download and run the selenium server jar file """
import subprocess
import os
import socket
import urllib
import time
SELENIUM_JAR = ("http://selenium-release.storage.googleapis.com"
"/2.52/selenium-server-standalone-2.52.0.jar")
JAR_FILE = "selenium-server-standalone-2.52.0.jar"
def download_se... | """ Download and run the selenium server jar file """
import subprocess
import os
import socket
import urllib
import time
SELENIUM_JAR = ("http://selenium-release.storage.googleapis.com"
"/2.50/selenium-server-standalone-2.50.1.jar")
JAR_FILE = "selenium-server-standalone-2.50.1.jar"
def download_se... | Python | 0 |
1fd2623c1e718a1b6685c82f40d4bcb11dd8541d | Add a get_collection method. | matgendb/util.py | matgendb/util.py | """
Utility functions used across scripts
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "1.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Dec 1, 2012"
import bson
import datetime
import json
import os
from pymongo import Connection... | """
Utility functions used across scripts
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "1.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Dec 1, 2012"
import bson
import datetime
import json
import os
DEFAULT_PORT = 27017
DEFAULT... | Python | 0 |
2a02fa394430b724d414631927bdd506e3ca082c | Update tasks.py | logstash_plugin/tasks.py | logstash_plugin/tasks.py | ########
# Copyright (c) 2015 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 of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | ########
# Copyright (c) 2015 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 of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | Python | 0.000001 |
3204e36721a245277abcc2f647e374adc08f4b63 | Database name must be uppercase | luigi/gtrnadb/parsers.py | luigi/gtrnadb/parsers.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... | Python | 0.999999 |
0e43293a808d315b1cc5ea86c599511bb8cedd0a | exclude wikidata | mapreduce/dbpedia_dbm.py | mapreduce/dbpedia_dbm.py | """
Creates DBPedia labels-types Shelve file of the following format:
{ LABEL: [Type1, Type2, ...], ...}
For example:
Tramore: Town, Settlement, PopulatedPlace, Place
Tramore,_Ireland: Town, Settlement, PopulatedPlace, Place
"""
import subprocess
import urllib
from collections import defaultdict
impo... | """
Creates DBPedia labels-types Shelve file of the following format:
{ LABEL: [Type1, Type2, ...], ...}
For example:
Tramore: Town, Settlement, PopulatedPlace, Place
Tramore,_Ireland: Town, Settlement, PopulatedPlace, Place
"""
import subprocess
import urllib
from collections import defaultdict
impo... | Python | 0.002561 |
bcac244f676c494b28d81d79b7c661bdbc5cee39 | remove some whitespace I don't like | helpers.py | helpers.py | """
Imposter - Another weblog app
Copyright (c) 2010 by Jochem Kossen <jochem.kossen@gmail.com>
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
notice,... | """
Imposter - Another weblog app
Copyright (c) 2010 by Jochem Kossen <jochem.kossen@gmail.com>
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
notice,... | Python | 0.999982 |
988f2cfa9d7dfb643a1efe26e6fd9dc8985c5483 | decode utf8 coming from subprocess | modules/validation/export_validator.py | modules/validation/export_validator.py | from validator import Validator
from ..ether import exec_via_temp, ExportConfig, ether_to_sgml
import re
# TODO: would have been ideal to write this without any filesystem operations
class ExportValidator(Validator):
def __init__(self, rule):
self.corpus = rule[0]
self.doc = rule[1]
self.co... | from validator import Validator
from ..ether import exec_via_temp, ExportConfig, ether_to_sgml
import re
# TODO: would have been ideal to write this without any filesystem operations
class ExportValidator(Validator):
def __init__(self, rule):
self.corpus = rule[0]
self.doc = rule[1]
self.co... | Python | 0.998153 |
47077fd978866acefb127d3ca3b72182a468a020 | Support prelim.csv files in sort_sam.py script. | micall/utils/sort_sam.py | micall/utils/sort_sam.py | #! /usr/bin/env python3
import csv
import json
import os
from argparse import ArgumentParser, FileType, ArgumentDefaultsHelpFormatter
import subprocess
from pathlib import Path
import typing
def parse_args():
# noinspection PyTypeChecker
parser = ArgumentParser(description='Sort SAM file before viewing.',
... | #! /usr/bin/env python3
import os
from argparse import ArgumentParser, FileType
import subprocess
def parse_args():
parser = ArgumentParser(description='Sort SAM file before viewing.')
parser.add_argument('sam', help='SAM file to sort')
return parser.parse_args()
def main():
args = parse_args()
... | Python | 0 |
f2c800c5c9f88b4b583181e9cf49eb3cd8d538f0 | Improve open_in_browser base tag injection (#5319) | scrapy/utils/response.py | scrapy/utils/response.py | """
This module provides some useful functions for working with
scrapy.http.Response objects
"""
import os
import re
import tempfile
import webbrowser
from typing import Any, Callable, Iterable, Optional, Tuple, Union
from weakref import WeakKeyDictionary
import scrapy
from scrapy.http.response import Response
from t... | """
This module provides some useful functions for working with
scrapy.http.Response objects
"""
import os
import webbrowser
import tempfile
from typing import Any, Callable, Iterable, Optional, Tuple, Union
from weakref import WeakKeyDictionary
import scrapy
from scrapy.http.response import Response
from twisted.web... | Python | 0 |
19f26c267b4cc7a31e6fe2aeaa470d975cf3c3ae | Remove set and update docstring | motobot/core_plugins/bot_management.py | motobot/core_plugins/bot_management.py | from motobot import command, hook, Notice, IRCLevel, Command, Target, Action, Priority
@command('command', level=IRCLevel.master, priority=Priority.max)
def command_command(bot, context, message, args):
""" Command to manage the basic functions of the bot.
Valid arguments are: 'join', 'part', 'quit', 'show',... | from motobot import command, hook, Notice, IRCLevel, Command, Target, Action, Priority
@command('command', level=IRCLevel.master, priority=Priority.max)
def command_command(bot, context, message, args):
""" Command to manage the basic functions of the bot.
The 'join' and 'part' argument both require a channe... | Python | 0 |
1b3b3edac1b01a59519690c86647c70a67c4d90b | Add support for relative paths in mac os gen_snapshot. (#35324) | sky/tools/create_macos_gen_snapshots.py | sky/tools/create_macos_gen_snapshots.py | #!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import subprocess
import sys
import os
buildroot_dir = os.path.abspath(
os.path.join(os.path.realpath(__file__),... | #!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import subprocess
import sys
import os
def main():
parser = argparse.ArgumentParser(
description='Copies ar... | Python | 0 |
16b92aac9a7f82a3c15bd2e50d02e4af482a7cf0 | Fix crestHandler auth callback. | mint/web/cresthandler.py | mint/web/cresthandler.py | from conary.repository.netrepos import proxy
import restlib.http.modpython
from restlib import response
import crest.root
import crest.webhooks
from mint.rest.db import database as restDatabase
from mint.db import database
from mint.rest.middleware import auth
def handleCrest(uri, cfg, db, repos, req):
handler... | from conary.repository.netrepos import proxy
import restlib.http.modpython
from restlib import response
import crest.root
import crest.webhooks
from mint.rest.db import database as restDatabase
from mint.db import database
from mint.rest.middleware import auth
def handleCrest(uri, cfg, db, repos, req):
handler... | Python | 0 |
34e2f4ab9d7258763c4cf024f3f9e48ffec66a66 | Fix abbrs plugin | mistune3/plugins/abbr.py | mistune3/plugins/abbr.py | import re
import types
from ..util import escape
from ..helpers import PREVENT_BACKSLASH
__all__ = ['abbr']
# https://michelf.ca/projects/php-markdown/extra/#abbr
REF_ABBR = (
r'^ {0,3}\*\[(?P<abbr_key>[^\]]+)'+ PREVENT_BACKSLASH + r'\]:'
r'(?P<abbr_text>(?:[ \t]*\n(?: {3,}|\t)[^\n]+)|(?:[^\n]*))$'
)
def parse_... | import re
import types
from ..util import escape
from ..helpers import PREVENT_BACKSLASH
__all__ = ['abbr']
# https://michelf.ca/projects/php-markdown/extra/#abbr
REF_ABBR = (
r'^ {0,3}\*\[(?P<abbr_key>[^\]]+)'+ PREVENT_BACKSLASH + r'\]:'
r'(?P<abbr_text>(?:[ \t]*\n(?: {3,}|\t)[^\n]+)|(?:[^\n]*))$'
)
def parse_... | Python | 0 |
e3fb065c5985027cbcbe01dbfbc3414a96fff961 | Remove setting class variable | keystone/common/validation/validators.py | keystone/common/validation/validators.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | Python | 0.999429 |
f20c911285cc83f2cfe2b4650ba85f4b82eae43c | Improve description about the api | plyer/facades/temperature.py | plyer/facades/temperature.py | class Temperature(object):
'''Temperature facade.
Temperature sensor is used to measure the ambient room temperature in
degrees Celsius (°C)
With method `enable` you can turn on temperature sensor and 'disable'
method stops the sensor.
Use property `temperature` to get ambient air temperature in... | class Temperature(object):
'''Temperature facade.
Temperature sensor is used to measure the ambient room temperature in degrees Celsius
With method `enable` you can turn on temperature sensor and 'disable'
method stops the sensor.
Use property `temperature` to get ambient air temperature in degree C... | Python | 0.000004 |
bec24879cafaa4e17dd7cd56bcdaa3b04cb378b9 | remove test_dpdk_vf.py from run_tests | plugin_test/run_tests.py | plugin_test/run_tests.py | """Copyright 2015 Mirantis, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distri... | """Copyright 2015 Mirantis, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distri... | Python | 0.000002 |
6560d0e29fb5c86188d770958aed2a34921e811a | Remove unused import | socorro/scripts/add_crashid_to_queue.py | socorro/scripts/add_crashid_to_queue.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse
import os
import sys
import pika
from socorro.lib.ooid import is_crash_id_valid... | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse
import os
import os.path
import sys
import pika
from socorro.lib.ooid import is... | Python | 0.000001 |
f956159efe43f14618c1b2baed8abaddbab42488 | Fix export_models.py to work with new structure | scripts/export_models.py | scripts/export_models.py | import json
import os
import utils
def process_file(filename):
handle = open(filename, "r")
lines = handle.read().replace("\r", "").split("\n")
handle.close()
real_lines = []
for line in lines:
line = line.replace(" default ", " ")
raw_line = line.strip()
if raw_line.startsw... | import os
import utils
def process_file(filename):
handle = open(filename, "r")
lines = handle.read().replace("\r", "").split("\n")
handle.close()
real_lines = []
for line in lines:
line = line.replace(" default ", " ")
raw_line = line.strip()
if raw_line.startswith("@") or ... | Python | 0.000001 |
7f876881267da77efeb8c3f5bb585502e33e76fc | add imagefile funcs to namespace | ts_charting/__init__.py | ts_charting/__init__.py | from ts_charting.figure import Figure, Grapher
from ts_charting.charting import *
import ts_charting.ohlc
import ts_charting.boxplot
import ts_charting.span
from ts_charting.styler import styler, marker_styler, level_styler
from ts_charting.ipython import figsize, IN_NOTEBOOK
from ts_charting.plot_3d import plot_wire... | from ts_charting.figure import Figure, Grapher
from ts_charting.charting import *
import ts_charting.ohlc
import ts_charting.boxplot
import ts_charting.span
from ts_charting.styler import styler, marker_styler, level_styler
from ts_charting.ipython import figsize, IN_NOTEBOOK
from ts_charting.plot_3d import plot_wire... | Python | 0.000003 |
cb47cd2fbd37b9fce12abbf1c0ccff38d863f838 | Add some refactorings | scripts/generate_code.py | scripts/generate_code.py | from collections import namedtuple
from itertools import dropwhile, groupby
VARIABLE_SECTION_START = 'Pos. = '
VARIABLE_NAME_FIELD = 'Variable = '
VARIABLE_LABEL_FIELD = 'Variable label = '
VALUE_FIELD = 'Value = '
VALUE_LABEL_FIELD = 'Label = '
Variable = namedtuple('Variable', ['id', 'name', 'label', 'values'])
c... | from collections import namedtuple
from itertools import dropwhile, groupby
VARIABLE_SECTION_START = 'Pos. = '
VARIABLE_NAME_FIELD = 'Variable = '
VARIABLE_LABEL_FIELD = 'Variable label = '
VALUE_FIELD = 'Value = '
VALUE_LABEL_FIELD = 'Label = '
Variable = namedtuple('Variable', ['id', 'name', 'label', 'values'])
c... | Python | 0.000243 |
0c825167e814f6a62d7c50decc6877e401ce4e26 | Fix launch_master.py | scripts/launch_master.py | scripts/launch_master.py | #!/usr/bin/env python
# Copyright (c) 2012 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.
""" Repeatedly launch the build master in an infinite loop, updating the source
between launches. This script is intended to be run... | #!/usr/bin/env python
# Copyright (c) 2012 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.
""" Repeatedly launch the build master in an infinite loop, updating the source
between launches. This script is intended to be run... | Python | 0.000002 |
328c521e49659cb9b7d0e89cfcb1c7a22b4dbd21 | Make more flexible | scripts/matchToNative.py | scripts/matchToNative.py | #!/usr/bin/env ccp4-python
import os
import sys
root = os.sep.join( os.path.abspath(__file__).split( os.sep )[:-2] )
sys.path.insert( 0, os.path.join( root, "python" ) )
sys.path.insert( 0, os.path.join( root, "scripts" ) )
# We use MRBUMP's MTZ_parse
sys.path.append(os.path.join(os.environ["CCP4"], "share", "mrbump... | #!/usr/bin/env ccp4-python
import os
import sys
root = os.sep.join( os.path.abspath(__file__).split( os.sep )[:-2] )
sys.path.insert( 0, os.path.join( root, "python" ) )
sys.path.insert( 0, os.path.join( root, "scripts" ) )
# We use MRBUMP's MTZ_parse
sys.path.append(os.path.join(os.environ["CCP4"], "share", "mrbump... | Python | 0.000049 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.