text
stringlengths
4
1.02M
meta
dict
"""Provides a UPNP discovery method that mimicks Hue hubs.""" import threading import socket import logging import select from aiohttp import web from homeassistant import core from homeassistant.components.http import HomeAssistantView _LOGGER = logging.getLogger(__name__) class DescriptionXmlView(HomeAssistantVi...
{ "content_hash": "3039f6e01fe091716a6c4ee5a25d927c", "timestamp": "", "source": "github", "line_count": 158, "max_line_length": 76, "avg_line_length": 31.848101265822784, "alnum_prop": 0.6063195548489666, "repo_name": "LinuxChristian/home-assistant", "id": "f8d414240649c080bf1495c95ce849dea875f742", ...
"""Client for interacting with the Google Cloud DNS API.""" from google.api_core import page_iterator from google.cloud.client import ClientWithProject from google.cloud.dns._http import Connection from google.cloud.dns.zone import ManagedZone class Client(ClientWithProject): """Client to bundle configuration n...
{ "content_hash": "3ca5d684fcf7c95df3aac07fd66c5615", "timestamp": "", "source": "github", "line_count": 123, "max_line_length": 77, "avg_line_length": 38.6260162601626, "alnum_prop": 0.6091349189644285, "repo_name": "jonparrott/gcloud-python", "id": "386190bab7a0ab719682b89237e4de6a1539b2f3", "size...
from django.core.exceptions import FieldError from django.test import TestCase from .models import Article, Author class CustomColumnsTests(TestCase): @classmethod def setUpTestData(cls): cls.a1 = Author.objects.create(first_name="John", last_name="Smith") cls.a2 = Author.objects.create(firs...
{ "content_hash": "dd9b3e10a3a4d0458ac3de66e06da012", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 117, "avg_line_length": 32.19672131147541, "alnum_prop": 0.580193482688391, "repo_name": "ar4s/django", "id": "20e649de03a4185f3888967c48ee219970ca5359", "size": "3928", ...
""" Tests that check that we ignore the appropriate files when importing courses. """ import unittest from mock import Mock from xmodule.modulestore.xml_importer import import_static_content from opaque_keys.edx.locations import SlashSeparatedCourseKey from xmodule.tests import DATA_DIR ''' TODO: Update class IgnoredF...
{ "content_hash": "89500337e0d234cc84b820da9afe115d", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 89, "avg_line_length": 45.7906976744186, "alnum_prop": 0.6678517013712545, "repo_name": "bmedx/modulestore", "id": "7f96e95c8d38b945ceef1a61581294ef274446b6", "size": "1969...
''' Created on 2012-10-12 @author: s00228753 ''' from grantee import Grantee class Grant(object): #=========================================================================== # 初始化 # @param grantee 被授权者 # @param permission 权限 #=================================================================...
{ "content_hash": "4560acb85deec9b4210408d9d6fe0272", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 80, "avg_line_length": 21.2, "alnum_prop": 0.4308176100628931, "repo_name": "Fangfenghua/docker-registry-driver-huaweimos", "id": "874707841f2ce6ba893134c5aa2f0896727480cf", ...
"""Support for MyQ gateways.""" from pymyq.const import ( DEVICE_FAMILY as MYQ_DEVICE_FAMILY, DEVICE_FAMILY_GATEWAY as MYQ_DEVICE_FAMILY_GATEWAY, DEVICE_STATE as MYQ_DEVICE_STATE, DEVICE_STATE_ONLINE as MYQ_DEVICE_STATE_ONLINE, KNOWN_MODELS, MANUFACTURER, ) from homeassistant.components.binary_...
{ "content_hash": "4866ed0cbf40399985378459b7b92061", "timestamp": "", "source": "github", "line_count": 87, "max_line_length": 82, "avg_line_length": 30.298850574712645, "alnum_prop": 0.6426403641881638, "repo_name": "soldag/home-assistant", "id": "57bd2451d2ab2cd517c8f1b6c21b81210d79bca5", "size":...
"""Configuration.from_env() tests.""" from pytest import mark, raises def test(config): config.from_env("CONFIG_TEST_ENV") assert config() == "test-value" def test_with_children(config): config.section1.value1.from_env("CONFIG_TEST_ENV") assert config() == {"section1": {"value1": "test-value"}} ...
{ "content_hash": "0e45f4d72873ba963ad4a1573324a68d", "timestamp": "", "source": "github", "line_count": 98, "max_line_length": 84, "avg_line_length": 30.224489795918366, "alnum_prop": 0.7052667116812964, "repo_name": "rmk135/dependency_injector", "id": "4c9a70db5bed75096933027980d3e71a60df2f6f", "s...
import tests.model_control.test_ozone_custom_models_enabled as testmod testmod.build_model( ['Difference'] , ['MovingMedian'] , ['Seasonal_WeekOfYear'] , ['MLP'] );
{ "content_hash": "2805bcdfcc6870582c7e927dcf3157d5", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 93, "avg_line_length": 41.5, "alnum_prop": 0.7228915662650602, "repo_name": "antoinecarme/pyaf", "id": "0bdd8296f20d71dd5a3cb82ce43b32a418524f70", "size": "166", "binary":...
import distutils.spawn import importlib import multiprocessing import os import shutil import sys import types import traceback from datetime import datetime import attributes from lib import utilities class Attribute(object): def __init__(self, attribute, **goptions): self.name = attribute.get('name', ...
{ "content_hash": "a7ebe06f1ce8059720a3a4d4b5ed95c3", "timestamp": "", "source": "github", "line_count": 270, "max_line_length": 79, "avg_line_length": 34.15185185185185, "alnum_prop": 0.5294436612081119, "repo_name": "RepoReapers/reaper", "id": "221e40f1b080559379f985b99d2c2bacb2c03e52", "size": "9...
"""Test the cbuildbot_run module.""" import logging import os import cPickle import sys import time sys.path.insert(0, os.path.abspath('%s/../..' % os.path.dirname(__file__))) from chromite.cbuildbot import cbuildbot_config from chromite.cbuildbot import cbuildbot_run from chromite.lib import cros_test_lib from chrom...
{ "content_hash": "c17b0c0971d3f2e73b83f513c1da598c", "timestamp": "", "source": "github", "line_count": 646, "max_line_length": 80, "avg_line_length": 37.77554179566563, "alnum_prop": 0.6922509527517109, "repo_name": "chadversary/chromiumos.chromite", "id": "970f8e4216e164f25ab26efee58def954d790f2c",...
from datetime import datetime from operator import itemgetter import six from pyga import utils from pyga import exceptions __author__ = "Arun KR (kra3) <the1.arun@gmail.com>" __license__ = "Simplified BSD" class Campaign(object): ''' A representation of Campaign Properties: _type -- See TYPE_* cons...
{ "content_hash": "042e1064238b19663981df7f1b2f7c78", "timestamp": "", "source": "github", "line_count": 504, "max_line_length": 136, "avg_line_length": 38.51190476190476, "alnum_prop": 0.6116434827408552, "repo_name": "pannal/Subliminal.bundle", "id": "130c8db4627bade149bf8928cb02f0042d460bcc", "si...
"""Requirements specific to SQLAlchemy's own unit tests. """ import sys from sqlalchemy import exc from sqlalchemy import util from sqlalchemy.sql import text from sqlalchemy.testing import exclusions from sqlalchemy.testing.exclusions import against from sqlalchemy.testing.exclusions import fails_if from sqlalchem...
{ "content_hash": "fc04d7c21ea2dee81bb66ac9f6896104", "timestamp": "", "source": "github", "line_count": 1609, "max_line_length": 103, "avg_line_length": 31.09633312616532, "alnum_prop": 0.5455690130711116, "repo_name": "graingert/sqlalchemy", "id": "669e0b7eb178743b76b7055deb7152260c27504a", "size"...
import sys import os from argparse import ArgumentParser from Bio import SeqIO try: from string import maketrans except ImportError: maketrans = str.maketrans def lesserkmer(s): '''returns the lesser of a kmer and its reverse complement''' t = revc(s) if t < s: return t else: re...
{ "content_hash": "109ac977d17d94f5001c33787f570b9b", "timestamp": "", "source": "github", "line_count": 165, "max_line_length": 146, "avg_line_length": 33.018181818181816, "alnum_prop": 0.5552496328928047, "repo_name": "wltrimbl/kmerspectrumanalyzer", "id": "a6d40c924f35cb91ea1e6bd91d897fa885ce2364",...
import functools import unittest from test import support from ctypes import * from ctypes.test import need_symbol import _ctypes_test class Callbacks(unittest.TestCase): functype = CFUNCTYPE ## def tearDown(self): ## import gc ## gc.collect() def callback(self, *args): self.got_args...
{ "content_hash": "545c1e406ec9066c71008e87714fdda0", "timestamp": "", "source": "github", "line_count": 285, "max_line_length": 79, "avg_line_length": 31.84561403508772, "alnum_prop": 0.5672102247686205, "repo_name": "IronLanguages/ironpython3", "id": "125fdb7dd8c07107a78635d663bdfb02fba0df6c", "si...
""" Support for functionality to download files. For more details about this component, please refer to the documentation at https://home-assistant.io/components/downloader/ """ import logging import os import re import threading import requests import voluptuous as vol from homeassistant.helpers import validate_con...
{ "content_hash": "34412c98680b9e43ad19e42c3fef2dbc", "timestamp": "", "source": "github", "line_count": 137, "max_line_length": 78, "avg_line_length": 31.437956204379564, "alnum_prop": 0.540051079637799, "repo_name": "devdelay/home-assistant", "id": "c639619d7a70fc9386e7392e01b8920afb8a1785", "size...
"""Test create_pipeline functionality""" from unittest import mock import pytest from foremast.pipeline import SpinnakerPipeline TEST_FORMAT_GENERATOR = mock.Mock() TEST_SETTINGS = { 'dev': { 'regions': ['us-east-1'], 'us-east-1': { 'app': { 'app_description': 'Test App...
{ "content_hash": "b9676b75abb317f428fdb2ca8c818561", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 112, "avg_line_length": 34.875, "alnum_prop": 0.6161290322580645, "repo_name": "gogoair/foremast", "id": "9a1ab53566beecfb6997373bbe142d534672c941", "size": "3417", "bina...
''' ubmodule-msg.py: simple response packet logger Authors: Zdenek Vasicek (vasicek AT fit.vutbr.cz) Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz) Copyright (c) 2008. All rights reserved. This software is open source. Redistribution and use in source and binary forms, with or without modification,...
{ "content_hash": "6524e219def61f24bb21943e761372a3", "timestamp": "", "source": "github", "line_count": 167, "max_line_length": 201, "avg_line_length": 40.808383233532936, "alnum_prop": 0.6290535583272193, "repo_name": "NLnetLabs/unbound", "id": "1eb7af5b16e5a3b2d993bb48ec9c048a535a8571", "size": "...
from __future__ import absolute_import, unicode_literals import datetime import os from decimal import Decimal import warnings from django import forms from django.core.exceptions import FieldError from django.core.files.uploadedfile import SimpleUploadedFile from django.core.validators import ValidationError from dj...
{ "content_hash": "098b6c193a5f4c6d82aff79037bcedaf", "timestamp": "", "source": "github", "line_count": 1796, "max_line_length": 219, "avg_line_length": 42.224387527839646, "alnum_prop": 0.5999868134766269, "repo_name": "dex4er/django", "id": "e33372f0badd20317feddda7edbb272d0c5b02cb", "size": "758...
from __future__ import absolute_import __all__ = ['DocSection', 'Endpoint', 'StatsMixin'] import time from datetime import datetime, timedelta from django.conf import settings from django.utils.http import urlquote from django.views.decorators.csrf import csrf_exempt from enum import Enum from pytz import utc from r...
{ "content_hash": "412831baf79f360d0beeba7a05931620", "timestamp": "", "source": "github", "line_count": 233, "max_line_length": 97, "avg_line_length": 31.71244635193133, "alnum_prop": 0.6012992285830289, "repo_name": "vperron/sentry", "id": "1891d3b4236aedb550a83e9b90af60e649888a61", "size": "7389"...
import qhsm from qhsm import QSignals, QEvent # generated by PythonGenerator version 0.1 class TestSample1(qhsm.QHsm): def initialiseStateMachine(self): self.initialiseState(self.s_StateX) def s_StateX(self, ev): if ev.QSignal == QSignals.Entry: self.enterStateX() elif e...
{ "content_hash": "8fc0a6c033603135ffd4fe1dc2af855b", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 48, "avg_line_length": 25.96551724137931, "alnum_prop": 0.547808764940239, "repo_name": "poobalan-arumugam/stateproto", "id": "9d7cc0c21fb675fa25cd867f98fa29dddb573119", "s...
unittest.skip #segfault .... def omp_parallel_num_threads(): import omp max_threads = 0 failed = 0 if 'omp parallel': if 'omp master': max_threads = omp.get_num_threads() for threads in xrange(1, max_threads + 1): nthreads = 0 if 'omp parallel reduction(+:failed...
{ "content_hash": "1f3a2d7271b393a6d69fe0f8356781b7", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 67, "avg_line_length": 25.8, "alnum_prop": 0.5581395348837209, "repo_name": "artas360/pythran", "id": "2581cac9ae59ff292e77b2c3cc8c99bb84272675", "size": "516", "binary":...
from oslo_log import log as logging from nca47.common.exception import NonExistParam, ParamNull, ParamValueError from nca47.common.i18n import _ from nca47.common.i18n import _LE from nca47.manager import central from oslo_messaging.exceptions import MessagingException from nca47.common.exception import BadRequest from...
{ "content_hash": "edc37809fb609df812a7620bfffa4ae8", "timestamp": "", "source": "github", "line_count": 186, "max_line_length": 77, "avg_line_length": 42.02150537634409, "alnum_prop": 0.5772773797338793, "repo_name": "willowd878/nca47", "id": "924317e64075548d525c43951c5d4fc58fe72bbb", "size": "781...
import pandas as pd import numpy as np file = "/Users/szabolcs/dev/git/DAT210x/Module6/Datasets/parkinsons.data" X = pd.read_csv(file) y = X[["status"]].values.reshape(-1, 1) X = X.drop(["name", "status"], axis=1) print(X.head()) print("X", X.shape) print("y", y.shape) from sklearn.model_selection import train_test...
{ "content_hash": "abbb4915ee30c8e0d1964d1e9df4f11c", "timestamp": "", "source": "github", "line_count": 70, "max_line_length": 88, "avg_line_length": 26.9, "alnum_prop": 0.541157727031333, "repo_name": "szigyi/DAT210x", "id": "0b305a55fe6f09778aea460d88bf3cf955764c8a", "size": "1971", "binary": f...
""" pyexcel_io.database.django ~~~~~~~~~~~~~~~~~~~ The lower level handler for django import and export :copyright: (c) 2014-2017 by Onni Software Ltd. :license: New BSD License, see LICENSE for more details """ import logging from pyexcel_io.book import BookReader, BookWriter from pyexcel_io.she...
{ "content_hash": "6a93e87891f7ccd717cd1c6046dec386", "timestamp": "", "source": "github", "line_count": 140, "max_line_length": 74, "avg_line_length": 30.142857142857142, "alnum_prop": 0.5959715639810427, "repo_name": "fuhrysteve/pyexcel-io", "id": "df48623ea954384d41c7234e47b972d10fe8bedd", "size"...
import os import re from xml.etree import ElementTree import asninja.helpers class AtmelStudioProject(object): NSMAP = {'msb': 'http://schemas.microsoft.com/developer/msbuild/2003'} def __init__(self, file_name, output): self.prj = ElementTree.parse(file_name) self.config_group = None ...
{ "content_hash": "c4f89ab01f41879649b6df8b436648c6", "timestamp": "", "source": "github", "line_count": 274, "max_line_length": 111, "avg_line_length": 45.55474452554745, "alnum_prop": 0.6051113603589169, "repo_name": "alunegov/AtmelStudioToNinja", "id": "ddc5b761c3cdb7695ac58997fb44010548c9881b", ...
from flask import Flask, jsonify from modules.get_dir_list import path_to_dict app = Flask(__name__) @app.route('/flask/treeRoot') def send_root_dirs(): nodes = path_to_dict('/mnt/data', 1) return jsonify(nodes = [nodes])
{ "content_hash": "491ba93cf0dbbb357bb31f4fb83ed362", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 45, "avg_line_length": 25.77777777777778, "alnum_prop": 0.6810344827586207, "repo_name": "vangalamaheshh/bib", "id": "b784dc984362f6d4aa88b37366b8fb4f37e14454", "size": "296...
""" Copyright (c) 2014,掌阅科技 All rights reserved. 摘 要: agent.py 创 建 者: zhuangshixiong 创建日期: 2015-08-26 """ import urllib import operator import json from difflib import Differ from tornado.web import authenticated from peewee import OperationalError from kazoo.exceptions import NoNodeError from handler.bases import...
{ "content_hash": "5d3934550cd9fffa22bd40f4c6483878", "timestamp": "", "source": "github", "line_count": 296, "max_line_length": 91, "avg_line_length": 30.99662162162162, "alnum_prop": 0.573732970027248, "repo_name": "ireaderlab/zkdash", "id": "f1bce9be46165d8e5b440c576874d86bdd02f728", "size": "949...
from __future__ import absolute_import from contextlib import contextmanager from celery import states from celery.exceptions import IncompleteStream, TimeoutError from celery.five import range from celery.result import ( AsyncResult, EagerResult, TaskSetResult, result_from_tuple, ) from celery.utils ...
{ "content_hash": "3171e5d47f5cebe6b9630ba5d49316b6", "timestamp": "", "source": "github", "line_count": 731, "max_line_length": 77, "avg_line_length": 33.01641586867305, "alnum_prop": 0.5894344313238036, "repo_name": "bdh1011/wau", "id": "50a9e234eeff8d3842ce7f747b88bb43889dfbd1", "size": "24135", ...
import magento import json from .api import Core from trytond.model import ModelView, fields from trytond.pool import PoolMeta, Pool from trytond.transaction import Transaction from trytond.pyson import PYSONEncoder, Eval from trytond.wizard import ( Wizard, StateView, Button, StateAction, StateTransition ) __all...
{ "content_hash": "1f5524ed8e5e29463b62f59b6bf347fb", "timestamp": "", "source": "github", "line_count": 522, "max_line_length": 79, "avg_line_length": 30.011494252873565, "alnum_prop": 0.597408400357462, "repo_name": "prakashpp/trytond-magento", "id": "2e0c7e99cffceb0c3935644b880c9fa73e40c776", "si...
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('hqadmin', '0003_auto_20160715_1543'), ] operations = [ migrations.AlterField( model_name='vcmmigration', name='migrated', field=models.DateTimeField(null...
{ "content_hash": "d29b2adbf4ee8dbcd809e201f063b1db", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 50, "avg_line_length": 22.352941176470587, "alnum_prop": 0.5789473684210527, "repo_name": "dimagi/commcare-hq", "id": "9d387d8479be914a1899dc34af4a39c59f7b883e", "size": "3...
from __future__ import print_function # pylint: disable-msg=W0612,E1101 from warnings import catch_warnings import re import operator import pytest from numpy.random import randn import numpy as np from pandas.core.api import DataFrame, Panel from pandas.core.computation import expressions as expr from pandas impor...
{ "content_hash": "c8aa9286edcbeb13fe7aba9ad17e75a1", "timestamp": "", "source": "github", "line_count": 443, "max_line_length": 79, "avg_line_length": 39.73363431151242, "alnum_prop": 0.4924440404499489, "repo_name": "louispotok/pandas", "id": "56e00fa8af23d3b77b0f90e710d0ed33170f971e", "size": "17...
from __future__ import division, unicode_literals import base64 import io import itertools import time from .fragment import FragmentFD from ..compat import ( compat_etree_fromstring, compat_urlparse, compat_urllib_error, compat_urllib_parse_urlparse, compat_struct_pack, compat_struct_unpack, ...
{ "content_hash": "55f11aa10b5b84ee2ff8188585501411", "timestamp": "", "source": "github", "line_count": 429, "max_line_length": 139, "avg_line_length": 35.696969696969695, "alnum_prop": 0.5718949980410082, "repo_name": "lodemo/CATANA", "id": "c8fde9a89093393132262f7b7d5ec60d83de4b8d", "size": "1531...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import pytest from mock import ANY from ansible.module_utils.network.fortios.fortios import FortiOSHandler try: from ansible.modules.network.fortios import fortios_wireless_controller_timers except Import...
{ "content_hash": "78d585d55eedea429b369434afdb40d5", "timestamp": "", "source": "github", "line_count": 239, "max_line_length": 133, "avg_line_length": 36.31799163179916, "alnum_prop": 0.5830645161290322, "repo_name": "thaim/ansible", "id": "8f5a418119a4e521375f320968db579339a187b3", "size": "9376"...
""" A general tool for converting data from the dictionary format to an (n x k) python list that's ready for training an sklearn algorithm n--no. of key-value pairs in dictonary k--no. of features being extracted dictionary keys are names of persons in dataset dictionary values are dicti...
{ "content_hash": "242297fbb4720e0ade944edaa1b93d11", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 126, "avg_line_length": 35.795081967213115, "alnum_prop": 0.6180444240897641, "repo_name": "wllmtrng/udacity_data_analyst_nanodegree", "id": "ab7739b969ffa78ee7dab2cfc81e255...
"""Take alignments of PacBio data highest quality, any quality (low quality), or subreads and output the best aligned molecules The purpose of this is to produce an output with only one read per molecule, and that molecule representing the best alignment of that read. Now the 'best' alignment of a read is based on t...
{ "content_hash": "62e8919c6ee7573ae65f9fb47283078e", "timestamp": "", "source": "github", "line_count": 216, "max_line_length": 391, "avg_line_length": 50.38425925925926, "alnum_prop": 0.7081687034824956, "repo_name": "jason-weirather/py-seq-tools", "id": "9b3ab85eaade2cf5a29277c7fe624799518cb3ba", ...
from runner.koan import * import functools class AboutDecoratingWithClasses(Koan): def maximum(self, a, b): if a>b: return a else: return b def test_partial_that_wrappers_no_args(self): """ Before we can understand this type of decorator we need to cons...
{ "content_hash": "91d59280180de03550979fe56ff8cd15", "timestamp": "", "source": "github", "line_count": 125, "max_line_length": 92, "avg_line_length": 29.344, "alnum_prop": 0.5226281352235551, "repo_name": "ducngtuan/my-python3-koans-solution", "id": "3e764ba8ee8555d04ad29ef76f12a32f62566f68", "siz...
def extractTranslatingboredomCom(item): ''' Parser for 'translatingboredom.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('PRC', 'PRC', 'translated'), ('Loitero...
{ "content_hash": "88e0ee357c6e279c19ab7f995a76a139", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 104, "avg_line_length": 26.476190476190474, "alnum_prop": 0.6348920863309353, "repo_name": "fake-name/ReadableWebProxy", "id": "d5e677dabadcb469a8ae62baf73903791d8a42c2", "...
from hwt.code import If from hwt.code_utils import rename_signal from hwt.hdl.types.bits import Bits from hwt.interfaces.std import VldSynced from hwt.interfaces.utils import addClkRstn, propagateClkRstn from hwt.serializer.mode import serializeParamsUniq from hwt.synthesizer.param import Param from hwt.synthesizer.rtl...
{ "content_hash": "2b02ae75bc5b1a47bf85b60f24d181d6", "timestamp": "", "source": "github", "line_count": 245, "max_line_length": 132, "avg_line_length": 39.11020408163265, "alnum_prop": 0.5978918806094761, "repo_name": "Nic30/hwtLib", "id": "48843948af767240f1663954cff9ca02de010a0c", "size": "9630",...
from __future__ import absolute_import from __future__ import print_function __all__ = ["json_encoder", "utils"] import logging from .utils import TqdmLoggingHandler logger = logging.getLogger("root_optimize") logger.addHandler(TqdmLoggingHandler())
{ "content_hash": "fde101a28da9d1ffd6d759e9181e1e92", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 43, "avg_line_length": 25.3, "alnum_prop": 0.758893280632411, "repo_name": "kratsg/optimization", "id": "bf0fc9cfcfbf3b5d2b8e888bf253b5cabf282295", "size": "300", "binary...
from django.forms import ModelForm, DateInput from django import forms from survey.models.households import HouseholdMember class HouseholdMemberForm(ModelForm): def __init__(self, *args, **kwargs): super(HouseholdMemberForm, self).__init__(*args, **kwargs) class Meta: model = HouseholdMember...
{ "content_hash": "8e6cabe1f78c1c637d6210b53903dea4", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 107, "avg_line_length": 42.45, "alnum_prop": 0.6136631330977621, "repo_name": "antsmc2/mics", "id": "af34172ae696fd87922a94101eba5342d025d0f5", "size": "849", "binary": f...
import random import netaddr from oslo.config import cfg from sqlalchemy import event from sqlalchemy import orm from sqlalchemy.orm import exc from neutron.api.v2 import attributes from neutron.common import constants from neutron.common import exceptions as n_exc from neutron import context as ctx from neutron.db i...
{ "content_hash": "808ab3b2d2c05065eab19afc74737745", "timestamp": "", "source": "github", "line_count": 1533, "max_line_length": 79, "avg_line_length": 45.90084801043705, "alnum_prop": 0.5298155359122303, "repo_name": "vijayendrabvs/hap", "id": "0701ff8cc5eb798380b0eff84de77ddbded83e85", "size": "7...
import abc class AbstractTypeRegistry: __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_namespaces(self): raise NotImplementedError @abc.abstractmethod def get_types(self, namespace=None): raise NotImplementedError @abc.abstractmethod def register_namespace...
{ "content_hash": "d932a0f06dbe712459aa7f82a3c5abe3", "timestamp": "", "source": "github", "line_count": 92, "max_line_length": 60, "avg_line_length": 24.619565217391305, "alnum_prop": 0.6874172185430464, "repo_name": "scanon/data_api2", "id": "a40ffa7adac37b738d63a75398a96134a66c8e22", "size": "226...
from tinydb import TinyDB, where from tinydb.database import Table from tinydb.storages import MemoryStorage import pytest from tinydb_smartcache import SmartCacheTable @pytest.fixture def db_smartcache(): TinyDB.table_class = SmartCacheTable db_ = TinyDB(storage=MemoryStorage) table = db_.table('_defau...
{ "content_hash": "fc21a032533276834e5560183c7c5158", "timestamp": "", "source": "github", "line_count": 308, "max_line_length": 76, "avg_line_length": 21.68831168831169, "alnum_prop": 0.5781437125748503, "repo_name": "msiemens/tinydb-smartcache", "id": "e1e00cbb9d365a40629db56aad45ea8a4385b89a", "s...
def not_a_method(): return super(None, None).not_a_method() class Base(object): def something(self): pass class NotUselessSuper(Base): def multiple_statements(self): first = 42 * 24 return super(NotUselessSuper, self).multiple_statements() + first def not_a_call(self): ...
{ "content_hash": "8f3b08dfb29ee844aa4d2c7f6a641090", "timestamp": "", "source": "github", "line_count": 127, "max_line_length": 87, "avg_line_length": 34.52755905511811, "alnum_prop": 0.675484606613455, "repo_name": "rvmoura96/projeto-almoxarifado", "id": "b8aa71df35cea652d71460a28ccc0b5d5bc36780", ...
"""Unit tests for low_rank.py.""" from itertools import product import copy import numpy as np import pytest from scipy.linalg import expm from scipy.sparse.linalg import expm as sp_expm import openfermion as of from openfermion import givens_decomposition_square from openfermion.testing.testing_utils import ( ra...
{ "content_hash": "0e4f6ca2ab59c448ea86e5cacef7e781", "timestamp": "", "source": "github", "line_count": 270, "max_line_length": 80, "avg_line_length": 39.3962962962963, "alnum_prop": 0.5574880135376515, "repo_name": "quantumlib/OpenFermion-FQE", "id": "281453079af4a84bfa52bb1c2076507c2e1886de", "si...
def catalyst_pmid_request(first, middle, last, email, debug=False): """ Give an author name at the University of Florida, return the PMIDs of papers that are likely to be the works of the author. The Harvard Catalyst GETPMIDS service is called. Uses HTTP XML Post request, by www.forceflow.be "...
{ "content_hash": "d8a14e97f5618225108df9caebad351c", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 78, "avg_line_length": 40.06382978723404, "alnum_prop": 0.6075411577270313, "repo_name": "indera/vivo-pump", "id": "afd75f2a832a5a155226efdf9bde780f7408bd12", "size": "1883...
""" Allows access to the bot account's watchlist. The watchlist can be updated manually by running this script. Syntax: python pwb.py watchlist [-all | -new] Command line options: -all - Reloads watchlists for all wikis where a watchlist is already present -new - Load watchlists for all...
{ "content_hash": "d636d33ce4c75aab9adf3afc785fdf25", "timestamp": "", "source": "github", "line_count": 120, "max_line_length": 79, "avg_line_length": 27.35, "alnum_prop": 0.6279707495429616, "repo_name": "magul/pywikibot-core", "id": "cde0c0377a73e85e60e6b61d14e5df3c5f150a4c", "size": "3324", "b...
from __future__ import unicode_literals import getpass from optparse import make_option from django.core.management.base import BaseCommand from django.utils.six.moves import input from django.utils.translation import ugettext_lazy as _ from reviewboard.hostingsvcs.errors import (AuthorizationError, ...
{ "content_hash": "ced05b0b4f07620d16a141a52089720b", "timestamp": "", "source": "github", "line_count": 92, "max_line_length": 78, "avg_line_length": 34.83695652173913, "alnum_prop": 0.5082683307332293, "repo_name": "brennie/reviewboard", "id": "5f12d70139cf3a97c45732155bf69dc8f2726715", "size": "3...
import asyncio import threading from . import * from ...util.Configuration import Configuration from ...util.funcutils import is_none """ Protocolar handler of the secure connection with the server """ class ProtocolHandler(asyncio.Protocol): """ The secure protocol handler used to communicate with the serv...
{ "content_hash": "92068b7647fa4c9fc525f41c32430ead", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 80, "avg_line_length": 42.94059405940594, "alnum_prop": 0.5826608254553839, "repo_name": "thethythy/Mnemopwd", "id": "0eaad51462ebfbd12c0aea2117da3cc72c178cd9", "size": "5...
class Operation(object): def __eq__(self, other): return self.__class__ == other.__class__ and self.__dict__ == other.__dict__ class Update(Operation): def __init__(self, from_package, to_package, reason=None): self.from_package = from_package self.to_package = to_package self.r...
{ "content_hash": "2decd19d267b21aaee1355cf857fb0ba", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 84, "avg_line_length": 33.9, "alnum_prop": 0.5948869223205506, "repo_name": "enthought/depsolver", "id": "64321bad9f8854ec64f2a02e8495e8f40209946e", "size": "1017", "bina...
from unittest import mock from neutron_lib import context from neutron_lib.plugins import utils as plugin_utils from oslo_config import cfg from oslo_db import exception as exc from sqlalchemy.orm import query from neutron.plugins.ml2.drivers import type_vlan from neutron.tests.unit import testlib_api TENANT_NET = ...
{ "content_hash": "0fbc1cba221a20c3b51ea070fb1aa4ca", "timestamp": "", "source": "github", "line_count": 141, "max_line_length": 79, "avg_line_length": 45.1063829787234, "alnum_prop": 0.6388364779874214, "repo_name": "openstack/neutron", "id": "8714e96b477fea3b3b530fc888d6a289702540b2", "size": "699...
import psycopg2 # noqa: F401 import sqlalchemy.dialects.postgresql as custom_types # GeoAlchemy adds support for PostGIS extensions in SQLAlchemy. In order to # activate it, we must import it so that it can hook into SQLAlchemy. While # we don't use the Geometry type that we import, we do care about the side # effect...
{ "content_hash": "6b09daec5eaf1e201386128ac2a2fd68", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 85, "avg_line_length": 34.541666666666664, "alnum_prop": 0.7243667068757539, "repo_name": "linkedin/WhereHows", "id": "dedbb95a859e48524755d723a17a2ed70cb4912d", "size": "1...
""" test_sanity_bundle_augmentation.py Unittest for bundle augmentation. """ from __future__ import absolute_import import sys import unittest from ydk.services import CRUDService from ydk.providers import NetconfServiceProvider from ydk.models.augmentation import ietf_aug_base_1 from ydk.models.augmentat...
{ "content_hash": "578b2b81f97c941383565ba9660f7f9c", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 77, "avg_line_length": 32.1764705882353, "alnum_prop": 0.6497257769652651, "repo_name": "CiscoDevNet/ydk-gen", "id": "5ec76f7b2d8bd24f38f18fcf89397e41c3adc670", "size": "34...
categories = ["save_and_restore_state", "save_and_restore_control_and_status"] microcode = ''' # 128 bit multimedia and scientific instructions ''' for category in categories: exec("from . import %s as cat" % category) microcode += cat.microcode
{ "content_hash": "2cebd385dfa1481304cffe7a9df22407", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 52, "avg_line_length": 29.88888888888889, "alnum_prop": 0.6728624535315985, "repo_name": "gem5/gem5", "id": "53d48190701f64a35978c9cecbd45cdcd7cd48b2", "size": "2367", "bi...
import os import sys def is_active(): return True def get_name(): return "iOS" def can_build(): import sys import os if sys.platform == 'darwin' or os.environ.has_key("OSXCROSS_IOS"): return True return False def get_opts(): return [ ('IPHONEPLATFORM', 'name of the...
{ "content_hash": "fd3bba5550124361ef5b6df70698e350", "timestamp": "", "source": "github", "line_count": 189, "max_line_length": 496, "avg_line_length": 52.08465608465608, "alnum_prop": 0.4907557903291345, "repo_name": "exabon/godot", "id": "c20d8e90f46298314c7cc85558dc4f243cd8a9d6", "size": "9844",...
""" ulid/time/time_ns ~~~~~~~~~~~~~~~~~ Implements nanosecond time provider using :func:`~time.time_ns`. """ import time from ... import hints from . import base class Provider(base.Provider): """ Returns time values from :func:`~time.time_ns`. This class will only work on python 3.7+. ...
{ "content_hash": "24d702b78d924cf59a11c328a9695938", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 68, "avg_line_length": 23.485714285714284, "alnum_prop": 0.5790754257907542, "repo_name": "ahawker/ulid", "id": "345389e7cd286420b8cdb90138d587af62d28939", "size": "822", ...
from __future__ import print_function import copy import gyp.input import optparse import os.path import re import shlex import sys import traceback from gyp.common import GypError try: # Python 2 string_types = basestring except NameError: # Python 3 string_types = str # Default debug modes for GYP ...
{ "content_hash": "694b4e3d7fb11719cc559d75aec9253d", "timestamp": "", "source": "github", "line_count": 551, "max_line_length": 88, "avg_line_length": 40.1978221415608, "alnum_prop": 0.6528962932863787, "repo_name": "refack/node-gyp", "id": "d5fa9ecf501845e12495d46fbf6a2f55c2ca1725", "size": "22329...
from rest_framework import serializers as ser from rest_framework import exceptions from modularodm import Q from modularodm.exceptions import ValidationValueError from framework.auth.core import Auth from framework.exceptions import PermissionsError from django.conf import settings from website.project.metadata.sc...
{ "content_hash": "024b1c2433dbdbbdd6ddc4225e6b1921", "timestamp": "", "source": "github", "line_count": 737, "max_line_length": 141, "avg_line_length": 37.87516960651289, "alnum_prop": 0.6255284086838145, "repo_name": "kwierman/osf.io", "id": "b62fd76e18c5dad184870b15ee31d5c2f17a10c5", "size": "279...
from openstack.network import network_service from openstack import resource2 as resource class Listener(resource.Resource): resource_key = 'listener' resources_key = 'listeners' base_path = '/lbaas/listeners' service = network_service.NetworkService() # capabilities allow_create = True a...
{ "content_hash": "2bf7f0b574a5b347ed7e4a91ee465ebe", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 75, "avg_line_length": 40.21568627450981, "alnum_prop": 0.681618722574354, "repo_name": "briancurtin/python-openstacksdk", "id": "39bf8b1c3f37d44e570cfa409d210593ef7d1b17", ...
from pyramid_celery import celery_app as app from datetime import datetime @app.task def get_date(*args, **kwargs): msg = app.conf['PYRAMID_REGISTRY'].settings['message'] print(msg % datetime.utcnow()) @app.task def get_date_2(*args, **kwargs): msg = app.conf['PYRAMID_REGISTRY'].settings['message'] ...
{ "content_hash": "c2a6e5f340a2925b5f6a1eb607e94bd4", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 58, "avg_line_length": 22.9375, "alnum_prop": 0.6784741144414169, "repo_name": "edelooff/pyramid_celery", "id": "1e1bc018476f232c20f811562a852901714b5fdf", "size": "367", ...
import os import sys try: from setuptools import setup except ImportError: from distutils.core import setup version = "0.2.0" if sys.argv[-1] == 'publish': try: import wheel except ImportError: print('Wheel library missing. Please run "pip install wheel"') sys.exit() os.sy...
{ "content_hash": "c264b29329543c239f2739bd65d7a584", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 70, "avg_line_length": 28.35483870967742, "alnum_prop": 0.5927189988623436, "repo_name": "pydanny/dj-ango", "id": "e916fc7a14854badd8caa76078cc3e8af867e908", "size": "1805"...
""" Server Density Plugin Proftpd connection details https://github.com/serverdensity/sd-agent-plugins/ Autor: @bitbeans Version: 1.0.0 """ import json import sys import subprocess import platform import logging import time from decimal import * try: """ Q&D check if there is a proftpd binary, so count ...
{ "content_hash": "3595a4559458b39a60115580f065f06c", "timestamp": "", "source": "github", "line_count": 75, "max_line_length": 77, "avg_line_length": 29.213333333333335, "alnum_prop": 0.5727978092195345, "repo_name": "bencer/sd-agent-plugins", "id": "7a1396607b114bdce14a216b2f2950395b4f21ce", "size...
"""Support for Minut Point.""" import asyncio import logging import voluptuous as vol from homeassistant import config_entries from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_TOKEN, CONF_WEBHOOK_ID from homeassistant.helpers import config_validation as cv from homeassistant.h...
{ "content_hash": "93a6f1713cb0d3e607dda9217379852c", "timestamp": "", "source": "github", "line_count": 335, "max_line_length": 78, "avg_line_length": 33.03283582089552, "alnum_prop": 0.6169347551057293, "repo_name": "molobrakos/home-assistant", "id": "c0b2f7acd0fcd0e09ad231fe7730bee2a038f93d", "si...
""" Box.net OAuth2 backend, docs at: https://python-social-auth.readthedocs.io/en/latest/backends/box.html """ from .oauth import BaseOAuth2 class BoxOAuth2(BaseOAuth2): """Box.net OAuth authentication backend""" name = "box" AUTHORIZATION_URL = "https://www.box.com/api/oauth2/authorize" ACCESS_T...
{ "content_hash": "c78cbe7f0023a0d3b32fa084e43b13e2", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 83, "avg_line_length": 37.06896551724138, "alnum_prop": 0.5995348837209302, "repo_name": "python-social-auth/social-core", "id": "2fc86dd285a752049f4c069642a4ab8c3fca6bb0", ...
import unittest from fbmq import template as Template from fbmq import utils class TemplateTest(unittest.TestCase): def test_button_web(self): btn = Template.ButtonWeb(title="title", url="https://test.com") self.assertEquals('{"title": "title", "type": "web_url", "url": "https://test.com"}', utils...
{ "content_hash": "acb79d1d2d4f74f8c6d5d3fff193e3cf", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 120, "avg_line_length": 57.18803418803419, "alnum_prop": 0.4917052757435361, "repo_name": "antikytheraton/pocBot_GBM", "id": "8124718751f77f92ef8b19c7f734d6d24325bba3", "s...
__author__ = 'sergey' __NUMBER__ = 20160422002 def run(manager): """ :param manager: Database manager :type manager: dedupsqlfs.db.sqlite.manager.DbManager|dedupsqlfs.db.mysql.manager.DbManager :return: bool """ if manager.TYPE == "sqlite": try: table_sv = manager.getTa...
{ "content_hash": "c67499da1de06a77ed076fba20b15827", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 120, "avg_line_length": 33.661764705882355, "alnum_prop": 0.5176933158584535, "repo_name": "sergey-dryabzhinsky/dedupsqlfs", "id": "cb0c8b2604eaf47333487a57d41662f64372ad7b",...
from subprocess import call import os call(['l10n', 'link', '1big52YCGIDxU8Tsjh7SPjrSuwuOmuHUkMRWjup1owgA']) call(['l10n', 'export', '--exporter=android', '--fallback', 'en_US']) call(['cp', 'strings-en_US.xml', '../mpos-ui/src/main/res/values/strings.xml']) call(['mv', 'strings-en_US.xml', '../mpos-ui/src/main/res/...
{ "content_hash": "b3d0cf4077f8505786396f46c16b40fa", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 82, "avg_line_length": 60.666666666666664, "alnum_prop": 0.6602564102564102, "repo_name": "payworks/mpos-ui.android.paybutton", "id": "290c946b7acdc97bc063391e8626171c59fdb02...
from handlers import host_post_start from handlers import host_pre_stop from handlers import _set_send_node_event_on_error_handler from workflow import WfEvent from workflow import build_wf_event def _get_nodes_instances(ctx, node_id): instances = [] for node in ctx.nodes: for instance in node.instanc...
{ "content_hash": "539278a6fa8cd2bdd8f3c50d8c054158", "timestamp": "", "source": "github", "line_count": 414, "max_line_length": 183, "avg_line_length": 49.089371980676326, "alnum_prop": 0.658564188358018, "repo_name": "victorkeophila/alien4cloud-cloudify3-provider", "id": "09238482e1f18a2a1fe28762f57...
import inspect from collections import OrderedDict # THIRD PARTY import numpy as np import pytest # LOCAL from astropy.cosmology import Cosmology from astropy.cosmology.io.mapping import from_mapping, to_mapping from .base import ToFromDirectTestBase, ToFromTestMixinBase ############################################...
{ "content_hash": "e0811141e5234df6bb7947e81e537b4d", "timestamp": "", "source": "github", "line_count": 201, "max_line_length": 89, "avg_line_length": 39.36318407960199, "alnum_prop": 0.6086956521739131, "repo_name": "pllim/astropy", "id": "922e7c435fe1810b41829cf6c9d77f7c73c9884c", "size": "7986",...
from __future__ import division, absolute_import import numpy as np from copy import deepcopy from fatiando import utils, gridder from mesher import ProlateEllipsoid import prolate_ellipsoid from numpy.testing import assert_almost_equal from pytest import raises # Local-geomagnetic field F = 30000 inc = 2 dec = -27 ...
{ "content_hash": "6695edec3cf52abb0905f01c7991b52e", "timestamp": "", "source": "github", "line_count": 339, "max_line_length": 77, "avg_line_length": 40.89085545722714, "alnum_prop": 0.5764680421295628, "repo_name": "pinga-lab/magnetic-ellipsoid", "id": "5b313012483bab126a7e40a5fae380a988fcfea1", ...
"""Tests for aodh/storage/impl_mongodb.py .. note:: In order to run the tests against another MongoDB server set the environment variable aodh_TEST_MONGODB_URL to point to a MongoDB server before running the tests. """ from aodh.alarm.storage import impl_mongodb as impl_mongodb from aodh.tests import base as t...
{ "content_hash": "eaf012fb773e7e25a3fb4b18085ed354", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 72, "avg_line_length": 38.07692307692308, "alnum_prop": 0.6097643097643097, "repo_name": "chungg/aodh", "id": "8dc61de94ec2d3f935a88aab14c1badb8defa804", "size": "3571", ...
""" Implementation of logging for PyWPS-4 """ from pywps import configuration from pywps.exceptions import NoApplicableCode import sqlite3 import datetime _CONNECTION = None def log_request(uuid, request): """Write OGC WPS request (only the necessary parts) to database logging system """ conn = get_...
{ "content_hash": "d3912e0c412f90cf07b383fc7a637b90", "timestamp": "", "source": "github", "line_count": 186, "max_line_length": 82, "avg_line_length": 25.231182795698924, "alnum_prop": 0.5785212017898999, "repo_name": "ricardogsilva/PyWPS", "id": "96a2b831c7f14bb2e171b15f7cb5a82447d7036a", "size": ...
from __future__ import absolute_import from geocoder.base import Base class IpinfoIo(Base): """ API Reference ------------- https://ipinfo.io """ provider = 'ipinfoio' method = 'geocode' def __init__(self, location='', **kwargs): self.location = location self.url = 'htt...
{ "content_hash": "13eaa0c368896a79d01653f6a4bf52e5", "timestamp": "", "source": "github", "line_count": 86, "max_line_length": 78, "avg_line_length": 25.488372093023255, "alnum_prop": 0.5483576642335767, "repo_name": "epyatopal/geocoder-1", "id": "65fa4e5e83083ec328d2b2afbda0a702f575997e", "size": ...
import urlparse # project from util import headers from checks import AgentCheck # 3rd party import requests class Apache(AgentCheck): """Tracks basic connection/requests/workers metrics See http://httpd.apache.org/docs/2.2/mod/mod_status.html for more details """ GAUGES = { 'IdleWorkers': '...
{ "content_hash": "5bb691704414ac1f79bd9d93340f0b22", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 146, "avg_line_length": 37.97938144329897, "alnum_prop": 0.5667752442996743, "repo_name": "JohnLZeller/dd-agent", "id": "9dece7b8e9d510e2215953165fde867df751b97a", "size": ...
""" Determine whether an integer is a palindrome. Do this without extra space. """ __author__ = 'Danyang' class Solution: def isPalindrome(self, x): """ Algorithm: int, compare lsb and msb No extra space If you are thinking of converting the integer to string, note the r...
{ "content_hash": "243de43c745a21b3ba39277e77593d0e", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 107, "avg_line_length": 21.595238095238095, "alnum_prop": 0.4696802646085998, "repo_name": "algorhythms/LeetCode", "id": "d871ba7b55172b6a30aa9f842faae5d31e80e8f4", "size":...
from ..utils import RequestHandler import logging class _PrometheusCollector: def __init__(self, server): self.worker = server self.logger = logging.getLogger("distributed.dask_worker") self.crick_available = True try: import crick # noqa: F401 except ImportEr...
{ "content_hash": "359684318e78b75741b7667a171da24d", "timestamp": "", "source": "github", "line_count": 98, "max_line_length": 119, "avg_line_length": 33.01020408163265, "alnum_prop": 0.598145285935085, "repo_name": "blaze/distributed", "id": "a60de3a6b64856610a6eaf5b31415dd340b2b4d0", "size": "323...
''' Salt-specific interface for calling Salt Cloud directly ''' # Import python libs from __future__ import absolute_import import os import logging import copy # Import salt libs try: import salt.cloud HAS_SALTCLOUD = True except ImportError: HAS_SALTCLOUD = False import salt.utils # Import 3rd-party l...
{ "content_hash": "559600db33609261cff76c4fed9de217", "timestamp": "", "source": "github", "line_count": 389, "max_line_length": 163, "avg_line_length": 21.282776349614394, "alnum_prop": 0.6343761323831381, "repo_name": "stephane-martin/salt-debian-packaging", "id": "f4cd488631105c91776c29fa1b67effdf3...
import csv from ibms.db_funcs import csvload, saverow from sfm.models import CostCentre, SFMMetric, MeasurementValue, Quarter COLS_SFM_METRICS = 5 COLS_COSTCENTRES = 3 def import_to_sfmmetrics(fileName, fy): reader, file, fileName = csvload(fileName) try: i = 1 for row in reader: ...
{ "content_hash": "debf9296f9aa0f60dff3a4fac384a96a", "timestamp": "", "source": "github", "line_count": 177, "max_line_length": 169, "avg_line_length": 33.28813559322034, "alnum_prop": 0.5441276306856755, "repo_name": "parksandwildlife/ibms", "id": "9e0f60b841315b1455083c0f2126e71b109b784f", "size"...
""" WSGI config for main 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.11/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application from whitenoise.django import DjangoWh...
{ "content_hash": "e96c210983180a82991469048eb11a5e", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 78, "avg_line_length": 26.5, "alnum_prop": 0.7882599580712788, "repo_name": "rajeshgupta14/pathend", "id": "8373c0eb9b4780407d416acbac92470ab2c1ca3f", "size": "477", "bin...
import contextlib import os from exceptions import Exception def determine_jdk_directory(cluster): """ Return the directory where the JDK is installed. For example if the JDK is located in /usr/java/jdk1.8_91, then this method will return the string 'jdk1.8_91'. This method will throw an Excepti...
{ "content_hash": "b8d16896b8571b2eb30234d9d9a9e8b9", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 101, "avg_line_length": 38.391304347826086, "alnum_prop": 0.6834654586636466, "repo_name": "prestodb/presto-admin", "id": "edd66ad6c1373d28a843208da602ad459b55c544", "size"...
"""Tests for GRU V2 layer.""" import copy import os import shutil from absl.testing import parameterized import numpy as np from tensorflow.core.protobuf import config_pb2 from tensorflow.core.protobuf import rewriter_config_pb2 from tensorflow.python import keras from tensorflow.python.data.ops import dataset_ops f...
{ "content_hash": "2610fa09e075faddb9599c7db63bc9cc", "timestamp": "", "source": "github", "line_count": 816, "max_line_length": 80, "avg_line_length": 36.245098039215684, "alnum_prop": 0.6551257776575602, "repo_name": "Intel-Corporation/tensorflow", "id": "177bed37ab568bbd63509c67e0c9bc421d30a25d", ...
import logging try: from urllib import urlencode from urlparse import urlsplit, parse_qs, urlunsplit except ImportError: from urllib.parse import urlsplit, parse_qs, urlunsplit, urlencode from Cryptodome.PublicKey import RSA from django.contrib.auth.views import ( redirect_to_login, logout, ) imp...
{ "content_hash": "64fb13f5dae8e398ae3031048fa96872", "timestamp": "", "source": "github", "line_count": 348, "max_line_length": 142, "avg_line_length": 37.439655172413794, "alnum_prop": 0.593445391050733, "repo_name": "bunnyinc/django-oidc-provider", "id": "f1b90f09958fae9c238884ca0eadabc356107912", ...
""" This module provides a client class for SMS. """ import copy import logging import json from baidubce import utils from baidubce.auth import bce_v1_signer from baidubce.bce_base_client import BceBaseClient from baidubce.http import bce_http_client from baidubce.http import handler from baidubce.http import http_h...
{ "content_hash": "6720bad7b54b7f995778c833e07b8b85", "timestamp": "", "source": "github", "line_count": 312, "max_line_length": 98, "avg_line_length": 35.032051282051285, "alnum_prop": 0.5534309240622141, "repo_name": "smices/mWorkerService", "id": "b4a67d7265368658363aced5533c4aeef6f8b535", "size"...
"""Heat API Server. An OpenStack ReST API to Heat. """ import eventlet eventlet.monkey_patch(os=False) import sys from oslo_config import cfg import oslo_i18n as i18n from oslo_log import log as logging from oslo_reports import guru_meditation_report as gmr from oslo_service import systemd import six from heat.com...
{ "content_hash": "d103c2b9240f392e94516cb875802916", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 68, "avg_line_length": 26.73076923076923, "alnum_prop": 0.6611510791366907, "repo_name": "pratikmallya/heat", "id": "b5a751814243717d703e10bb160ab5c7a72b52b0", "size": "198...
"""Support for Homekit climate devices.""" import logging from homeassistant.components.climate import ClimateDevice from homeassistant.components.climate.const import ( STATE_COOL, STATE_HEAT, STATE_IDLE, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_HUMIDITY) from homeassistant.const imp...
{ "content_hash": "f53657d666ffbb5bbdc8615030e44b83", "timestamp": "", "source": "github", "line_count": 183, "max_line_length": 79, "avg_line_length": 34.32786885245902, "alnum_prop": 0.6203438395415473, "repo_name": "auduny/home-assistant", "id": "2cbd8f6d7000d7b28f085e8a3ef1551d788e6542", "size":...
"""Utilities for meta-estimators""" # Author: Joel Nothman # Andreas Mueller # License: BSD from abc import ABCMeta, abstractmethod from operator import attrgetter from functools import update_wrapper import numpy as np from ..utils import safe_indexing from ..externals import six from ..base import BaseEstim...
{ "content_hash": "43ff2f74c4343aee907485b7791cbcc6", "timestamp": "", "source": "github", "line_count": 210, "max_line_length": 81, "avg_line_length": 36.90952380952381, "alnum_prop": 0.6154044639401367, "repo_name": "vortex-ape/scikit-learn", "id": "49b059b3245951c27498a6284d88c8318bc18a28", "size...
from __future__ import absolute_import import six import mock import pytest from django.core.exceptions import SuspiciousOperation from sentry.constants import VERSION_LENGTH from uuid import UUID from sentry.coreapi import ( APIError, APIUnauthorized, Auth, ClientApiHelper, CspApiHelper, API...
{ "content_hash": "39696157fb8a2d127c350264356b5e65", "timestamp": "", "source": "github", "line_count": 742, "max_line_length": 571, "avg_line_length": 37.594339622641506, "alnum_prop": 0.5430722351675927, "repo_name": "gencer/sentry", "id": "d1cd513b8dab2645ad28df4b53a747738f7d4f82", "size": "2792...
"""Provides a way of easily overriding labels in skin.conf files with other languages. Useful for skin designers who want to use multiple skin.conf files and easily make the skins available in multiple languages. 1) Place this file in bin/user/translategenerator.py 2) Store each language specific file in skins/langua...
{ "content_hash": "d15c90c5e66832e279438defa6c5b376", "timestamp": "", "source": "github", "line_count": 92, "max_line_length": 159, "avg_line_length": 34.84782608695652, "alnum_prop": 0.6834061135371179, "repo_name": "tony-rasskazov/meteo", "id": "1968dc096ed6d73e0bbab046c047059809079592", "size": ...
c.NotebookApp.allow_password_change = True ## Allow requests where the Host header doesn't point to a local server # # By default, requests get a 403 forbidden response if the 'Host' header shows # that the browser thinks it's on a non-local domain. Setting this option to # True disables this check. # # This p...
{ "content_hash": "078b94eb3ec53dff449c04c9c753c20f", "timestamp": "", "source": "github", "line_count": 810, "max_line_length": 103, "avg_line_length": 39.8604938271605, "alnum_prop": 0.7053612909220429, "repo_name": "scray/scray", "id": "f1aa09338dcfb5dcbf21ea550c070506f0727011", "size": "34506", ...
"""FastPair: Data-structure for the dynamic closest-pair problem. This data-structure is based on the observation that the conga line data structure, in practice, does better the more subsets you give to it: even though the worst case time for k subsets is O(nk log (n/k)), that worst case seems much harder to reach th...
{ "content_hash": "e7242b531d5baedffecf591b826f2d4c", "timestamp": "", "source": "github", "line_count": 280, "max_line_length": 88, "avg_line_length": 40.44285714285714, "alnum_prop": 0.6074708583539385, "repo_name": "carsonfarmer/fastpair", "id": "9f7332106f246ec2489d3da6a5d1fadc135616bc", "size":...
import requests from starlette.requests import Request from typing import Dict from transformers import pipeline from ray import serve # 1: Wrap the pretrained sentiment analysis model in a Serve deployment. @serve.deployment(route_prefix="/") class SentimentAnalysisDeployment: def __init__(self): self....
{ "content_hash": "1ac2099e0aaecd5c16e03ddd9083bcaf", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 72, "avg_line_length": 26.275862068965516, "alnum_prop": 0.7034120734908137, "repo_name": "ray-project/ray", "id": "c5bc266c9265ac9d9f0f83575ab5b54d01a9070d", "size": "762"...
"""Compute-related Utilities and helpers.""" import re import string import traceback from oslo.config import cfg from nova import block_device from nova.compute import flavors from nova import exception from nova.network import model as network_model from nova import notifications from nova.openstack.common import ...
{ "content_hash": "5584fea23cbaced2a62484f52ba736b7", "timestamp": "", "source": "github", "line_count": 344, "max_line_length": 78, "avg_line_length": 36.098837209302324, "alnum_prop": 0.6301336769205992, "repo_name": "Brocade-OpenSource/OpenStack-DNRM-Nova", "id": "d40d4cab01ab0c1e561d809bc4c05be5ac...
"""Lingvo layers that used for spectrum augmentation.""" import lingvo.compat as tf from lingvo.core import base_layer from lingvo.core import py_utils _SPECAUGMENT_ARGS = ( 'freq_mask_max_bins', 'freq_mask_count', 'use_dynamic_time_mask_max_frames', 'time_mask_max_frames', 'time_mask_count', ...
{ "content_hash": "5c46458115fbee73ba876159b796a910", "timestamp": "", "source": "github", "line_count": 1059, "max_line_length": 80, "avg_line_length": 38.29745042492918, "alnum_prop": 0.6301994723475602, "repo_name": "tensorflow/lingvo", "id": "35a33b131e9feb07f25f7990c09b7e68b02d895d", "size": "4...
from setuptools import setup, find_packages setup( name = "Boids", version = "1.0", description = "The Boids!", author = "Irina Grigorescu", author_email = "irina.grigorescu.15@ucl.ac.uk", url = "https://github.com/irinagrigorescu/bad_boids", packages = find_packages(exclude=['*test']), ...
{ "content_hash": "6a8eb7a1587e6fcdf0beb893f183c75c", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 58, "avg_line_length": 31.615384615384617, "alnum_prop": 0.6399026763990268, "repo_name": "irinagrigorescu/bad_boids", "id": "559061af8e9b8f779e26f1ed4b222e2349535918", "si...
import SimpleHTTPServer import SocketServer import subprocess import signal import os PORT = 8080 def killapp(name): p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE) out, err = p.communicate() for line in out.splitlines(): if name in line: pid = int(line.split(None, 1)[0]) os.kill(pid, signal.SIG...
{ "content_hash": "9c1e85a13456725de482b2385b659e86", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 77, "avg_line_length": 28, "alnum_prop": 0.6785714285714286, "repo_name": "matisanh/retropie-administrator", "id": "181fa05fb88f92afe3858954335b33b3e1b27e16", "size": "1652...
from scoring_engine.engine.basic_check import BasicCheck, CHECKS_BIN_PATH class SSHCheck(BasicCheck): required_properties = ['commands'] CMD = CHECKS_BIN_PATH + '/ssh_check {0} {1} {2} {3} {4}' def command_format(self, properties): account = self.get_random_account() return ( ...
{ "content_hash": "36bacd6889e11e209b4f4a054dda5591", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 73, "avg_line_length": 28.6875, "alnum_prop": 0.5816993464052288, "repo_name": "pwnbus/scoring_engine", "id": "ce97747b3c1dfd51159bb6a201154b652c2db6d0", "size": "459", "...
import six from oslo_log import log as logging from tempest_lib import exceptions as lib_exc from tempest.api.compute import base from tempest.common.utils import data_utils from tempest import config from tempest import test CONF = config.CONF LOG = logging.getLogger(__name__) class AuthorizationTestJSON(base.Ba...
{ "content_hash": "b6ed5177aaf44cb73cdc6d5dc35f9b89", "timestamp": "", "source": "github", "line_count": 375, "max_line_length": 79, "avg_line_length": 47.650666666666666, "alnum_prop": 0.6126811796966815, "repo_name": "redhat-cip/tempest", "id": "58c2206965b305fcf670dfdb4fc7c26407f94761", "size": "...
from __future__ import print_function from cStringIO import StringIO import glob import json import logging import optparse import os import re import subprocess import sys from kudu_util import get_upstream_commit, check_output, ROOT, Colors, init_logging import iwyu.fix_includes from iwyu.fix_includes import ParseAn...
{ "content_hash": "9e6a957188118f355638b98bf0d8428a", "timestamp": "", "source": "github", "line_count": 276, "max_line_length": 99, "avg_line_length": 36.21739130434783, "alnum_prop": 0.662264905962385, "repo_name": "EvilMcJerkface/kudu", "id": "f267d0c3c59d238ff9ac06205850102a1fed7a48", "size": "1...
""" Represents an EC2 Keypair """ class KeyPair: def __init__(self, connection=None): self.connection = connection self.name = None self.fingerprint = None self.material = None def __repr__(self): return 'KeyPair:%s' % self.name def startElement(self, name, at...
{ "content_hash": "d35ead068827b3f8badd1d13fd7d9e95", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 57, "avg_line_length": 22.818181818181817, "alnum_prop": 0.5697211155378487, "repo_name": "carlgao/lenga", "id": "172a80c955d166983b599158d3800808a589691c", "size": "1858",...
__version__=''' $Id: attrmap.py 3601 2009-11-26 15:11:20Z rgbecker $ ''' __doc__='''Framework for objects whose assignments are checked. Used by graphics. We developed reportlab/graphics prior to Python 2 and metaclasses. For the graphics, we wanted to be able to declare the attributes of a class, check them on assign...
{ "content_hash": "dc7ae590bfd127a407ddace41f8bafce", "timestamp": "", "source": "github", "line_count": 165, "max_line_length": 134, "avg_line_length": 33.92727272727273, "alnum_prop": 0.5691318327974276, "repo_name": "icomms/wqmanager", "id": "d0b7d45dd0f9f1de7ae0538b4efd6103616e093d", "size": "57...