filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_17336
# Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch B.V. licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use ...
the-stack_106_17338
# -*- coding: utf-8 -*- r''' Execution of Salt modules from within states ============================================ These states allow individual execution module calls to be made via states. To call a single module function use a :mod:`module.run <salt.states.module.run>` state: .. code-block:: yaml mine.sen...
the-stack_106_17341
import pytest from utils.fakes import * cuda_required = pytest.mark.skipif(not torch.cuda.is_available(), reason="cuda enabled gpu is not available") a3b3b3 =torch.ones([1,3,3,3]) def test_model2half(): m = simple_cnn([3,6,6],bn=True) m = model2half(m) conv1 = m[0][0] bn...
the-stack_106_17342
# Can we create a standalone executable? # # target = "llvm -link-params" # https://discuss.tvm.apache.org/t/can-we-create-a-standalone-executable/8773 import numpy as np import tvm import tvm.testing import tvm.topi.testing from tvm import relay from tvm.contrib import graph_executor import onnx from onnx import Ten...
the-stack_106_17346
import tty import sys import curses import datetime import locale from decimal import Decimal import getpass import logging from typing import TYPE_CHECKING import electrum from electrum import util from electrum.util import format_satoshis from electrum.bitcoin import is_address, COIN from electrum.transaction import...
the-stack_106_17347
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
the-stack_106_17348
"""AirSim Collection Script """ import sys import json import logging import time from pprint import pprint import click import numpy as np from airsimcollect.helper.helper import update, update_collectors, DEFAULT_CONFIG from airsimcollect import AirSimCollect logger = logging.getLogger("AirSimCollect") logger.se...
the-stack_106_17349
import torch from collections import OrderedDict from torch import nn def batch_to_device(batch, device): for key in batch[0].keys(): batch[0][key] = batch[0][key].float() batch[0][key] = batch[0][key].to(device) batch[1] = batch[1].to(device) return batch class M3EP(nn.Module): """...
the-stack_106_17353
import re from semantic_version import Version _USER_AGENT_SEARCH_REGEX = re.compile(r"docker\/([0-9]+(?:\.[0-9]+){1,2})") _EXACT_1_5_USER_AGENT = re.compile(r"^Go 1\.1 package http$") _ONE_FIVE_ZERO = "1.5.0" def docker_version(user_agent_string): """ Extract the Docker version from the user agent, taking spec...
the-stack_106_17354
# Copyright 2019 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 writi...
the-stack_106_17356
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
the-stack_106_17362
"""Jump to where a function or class was defined on Ctrl+click or Ctrl+Enter. For this plugin to work, you also need the langserver plugin. """ from __future__ import annotations import dataclasses import logging import tkinter from functools import partial from pathlib import Path from typing import List from porcu...
the-stack_106_17363
"""Current-flow closeness centrality measures. """ # Copyright (C) 2010-2013 by # Aric Hagberg <hagberg@lanl.gov> # Dan Schult <dschult@colgate.edu> # Pieter Swart <swart@lanl.gov> # All rights reserved. # BSD license. import networkx_mod as nx from networkx_mod.algorithms.centrality.flow_matrix impor...
the-stack_106_17365
from __future__ import division import chainer import chainer.functions as F import numpy as np from chainercv.experimental.links.model.fcis.utils.mask_voting \ import mask_voting from chainercv.transforms.image.resize import resize class FCIS(chainer.Chain): """Base class for FCIS. This is a base cla...
the-stack_106_17367
import os import numpy as np import random as rand import pylab as py import matplotlib.pyplot as plt import scipy.interpolate import gudhi as gd import ot from matplotlib import cm from lib import helper as hp from lib.tda import sim_homology from scipy.interpolate import Rbf, interp1d, interp2d from typing import Li...
the-stack_106_17370
#!/usr/bin/python3 from pypine import * import pypinex_pack as pack tasks = Tasks() tasks.add("demo", "A demonstration PyPine script for packing with gzip.", [ core.src(".", "hello_world.txt"), pack.gzip(), core.cat(), pack.gunzip(), core.echo(), ] ) tasks.run("demo")
the-stack_106_17371
import math import numpy as np from PIL import Image def get_size_from_input(input_parameters: str, img_width: int, img_height: int): input_parameters = input_parameters.split() if len(input_parameters) == 1 and input_parameters[0].endswith('px'): pixels_count = int(input_parameters[0][0:-2]...
the-stack_106_17374
import gws.tools.net import gws.tools.xml2 from . import error _ows_error_strings = '<ServiceException', '<ServerException', '<ows:ExceptionReport' def raw_get(url, **kwargs): # the reason to use lax is that we want an exception text from the server # even if the status != 200 kwargs['lax'] = True ...
the-stack_106_17375
import tkinter import serial from threading import Thread, Condition import sys import glob class SliderGUIWindow: def __init__(self, serial_port): self.root = tkinter.Tk() self.root.protocol("WM_DELETE_WINDOW", self.closeRequested) self.slider_value = tkinter.DoubleVar() self.scale = tkinter.Scale(self.root...
the-stack_106_17382
import asyncio import enum import logging import os from pathlib import Path from typing import Optional, Union from async_generator import asynccontextmanager from meltano.core.logging.utils import SubprocessOutputWriter from .error import Error from .plugin import PluginRef from .plugin.config_service import Plugin...
the-stack_106_17384
# # 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 # ...
the-stack_106_17386
from typing import List import hikari import lightbulb import tweepy import os with open("./secrets/twitter") as t: _twitter = t.read().splitlines() _twitter_api = _twitter[0] _twitter_secret_api = _twitter[1] _twitter_access = _twitter[2] _twitter_access_secret = _twitter[3] authenti...
the-stack_106_17387
# Copyright (c) 2016 Ansible, Inc. # All Rights Reserved. # Python import base64 import binascii import re # Django from django.utils.translation import ugettext_lazy as _ # Tower from awx.conf import fields class PendoTrackingStateField(fields.ChoiceField): def to_internal_value(self, data): # Any fal...
the-stack_106_17390
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Apr 6 22:50:35 2019 @author: sarashashaani pipeT dataset most recent last_working_withuf max level = 3 min node size = 100 split quantile = 20 crps quantil = N/A """ import numpy as np from scipy import random as sr from random import sample import ...
the-stack_106_17397
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 23 11:31:21 2021 @author: ghiggi """ import numpy as np from cycler import cycler import matplotlib.pyplot as plt ##----------------------------------------------------------------------------. ### Check AR weights def check_ar_weights(ar_weights...
the-stack_106_17398
# Authors: Yousra Bekhti <yousra.bekhti@gmail.com> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # # License: BSD (3-clause) import os.path as op import numpy as np from scipy import linalg from numpy.testing import assert_array_equal, assert_equal import mne from mne.datasets import testing from mne.b...
the-stack_106_17401
#!/usr/env/python """ Hillslope model with block uplift. """ import sys import time from matplotlib.pyplot import axis from numpy import amax, arange, count_nonzero, logical_and, where, zeros from landlab.ca.boundaries.hex_lattice_tectonicizer import LatticeUplifter from landlab.ca.celllab_cts import Transition fro...
the-stack_106_17403
# coding: utf-8 # pylint: disable = invalid-name, W0105 """Training Library containing training routines of LightGBM.""" from __future__ import absolute_import import collections from operator import attrgetter import numpy as np from . import callback from .basic import Booster, Dataset, LightGBMError, _InnerPredic...
the-stack_106_17404
import torch import torch.nn as nn def MAEAUC_approx(x, x_hat, y, lambda_auc): # Computing error for each row err = torch.abs(x - x_hat).mean(axis = (1, 2)) # Selecting error of positive and negative example err_n = err[y == 1] err_a = err[y > 1] n_a = (err_a.shape)[0] n_n = (err_n.shape)...
the-stack_106_17406
""" Module for common functions """ import io import logging import json import os from json_validator.validator import JsonValidator from sap.cf_logging.formatters.json_formatter import JsonFormatter from sap.cf_logging.core.constants import \ LOG_SENSITIVE_CONNECTION_DATA, LOG_REMOTE_USER, LOG_REFERER from tests...
the-stack_106_17407
#!/usr/bin/env python # Copyright 2014 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # for py2/py3 compatibility import sys action = sys.argv[1] if action in ["help", "-h", "--help"] or len(sys.argv) != 3: print...
the-stack_106_17409
# -*-coding:utf-8-*- """ Author:yinshunyao Date:2019/7/31 0031下午 9:33 test for bbox """ from ai_tool.bbox import BBox, BBoxes import unittest class BBoxTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.bbox1 = BBox([0, 0, 100, 100]) cls.bbox2 = BBox([0, 0, 120, 120]) def tes...
the-stack_106_17416
import datetime import re import unittest import pytest from bson import ObjectId from mongoengine import * from mongoengine.errors import InvalidQueryError from mongoengine.queryset import Q class TestQ(unittest.TestCase): def setUp(self): connect(db="mongoenginetest") class Person(Document): ...
the-stack_106_17417
"""Tests for the Ambiclimate config flow.""" import ambiclimate from homeassistant import data_entry_flow from homeassistant.components.ambiclimate import config_flow from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET from homeassistant.setup import async_setup_component from homeassistant.util import ...
the-stack_106_17418
from typing import Any, Dict, Optional, Type, Union import numpy as np import torch as th from gym import spaces from torch.nn import functional as F import matplotlib.pyplot as plt from matplotlib.lines import Line2D from stable_baselines3.common import logger from stable_baselines3.common.on_policy_algorithm import...
the-stack_106_17419
#!/usr/bin/env python3 # Copyright (c) 2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * def read_du...
the-stack_106_17420
"""Support for information from HP iLO sensors.""" from datetime import timedelta import logging import hpilo import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( CONF_HOST, CONF_MONITORED_VARIABLES, CONF_NAME, CONF_PASSWORD, CONF_P...
the-stack_106_17422
# Copyright 2019 Xanadu Quantum Technologies 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 a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agre...
the-stack_106_17424
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from torch import nn from torch.nn import functional as F from ..box_head.roi_box_feature_extractors import ResNet50Conv5ROIFeatureExtractor from paa_core.modeling import registry from paa_core.modeling.poolers import Pooler from paa_core.modeling...
the-stack_106_17425
"""Pydantic loader using TOML serialization.""" import logging from os import PathLike from pathlib import Path from typing import Union, Optional import toml from pydantic import BaseSettings from toml.decoder import TomlDecodeError import pydantic_loader from pydantic_loader.encode import encode_pydantic_obj _LOG...
the-stack_106_17426
# -*- coding: utf-8 -*- ## Copyright 2014 Cognitect. 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 ## ## Unles...
the-stack_106_17427
# -*- coding: utf-8 -*- """ app.providers.aws ~~~~~~~~~~~~~~~~~ Provides AWS Sheets API related functions """ from datetime import datetime as dt import pygogo as gogo from app.helpers import flask_formatter as formatter from app.routes.auth import Resource logger = gogo.Gogo( __name__, low_formatte...
the-stack_106_17428
from copy import deepcopy from django.contrib import admin from django.contrib.admin import site from django.contrib.auth import get_user_model from django.contrib.sites.models import Site from django.utils.translation import gettext from cms.admin.forms import PageUserChangeForm, PageUserGroupForm from cms.exception...
the-stack_106_17429
# Copyright (c) Facebook, Inc. and its affiliates. # # 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 ...
the-stack_106_17430
#!/usr/bin/python3 # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # di...
the-stack_106_17432
#!/usr/bin/env python3 # Copyright (c) 2017-2019 The Tokyocoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test HD Wallet keypool restore function. Two nodes. Node1 is under test. Node0 is providing transact...
the-stack_106_17433
from __future__ import unicode_literals from oauthlib.oauth2 import WebApplicationClient, InsecureTransportError from oauthlib.oauth2 import is_secure_transport from requests.auth import AuthBase class OAuth2(AuthBase): """Adds proof of authorization (OAuth2 token) to the request.""" def __init__(se...
the-stack_106_17434
import logging from flexget import plugin from flexget.event import event log = logging.getLogger('est_released') class EstimateRelease(object): """ Front-end for estimator plugins that estimate release times for various things (series, movies). """ def estimate(self, entry): """ ...
the-stack_106_17435
import asyncio from operator import le import time import aiohttp from aiohttp import ClientSession tasks = [] async def fetch_html(url: str, session: ClientSession, **kwargs) -> str: resp = await session.request(method="GET", url=url, **kwargs) resp.raise_for_status() return await resp.text() async def m...
the-stack_106_17438
try: from setuptools import setup except ImportError: from distutils.core import setup config = { 'description': 'My Project', 'author': 'Lei Fan', 'url': 'http://www.example.com', 'download_url': 'http://www.example.com', 'author_email': 'email@example.com', 'version': '0.1', 'inst...
the-stack_106_17444
""" Custom Gender Settings is licensed under the Creative Commons Attribution 4.0 International public license (CC BY 4.0). https://creativecommons.org/licenses/by/4.0/ https://creativecommons.org/licenses/by/4.0/legalcode Copyright (c) COLONOLNUTTY """ from typing import Callable, Any from customgendersettings.enums...
the-stack_106_17445
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
the-stack_106_17447
# Copyright 2018 CNRS - Airbus SAS # Author: Joseph Mirabel # # 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, this list of conditions and th...
the-stack_106_17449
""" This file handles converting callables with numpy docstrings into config classes by parsing their docstrings to find their default values, finding the help text for each value, and then calling ``make_config`` to create a config class representing the arguments to that callable. """ import inspect import dataclasse...
the-stack_106_17450
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2020 Alibaba Group Holding Ltd. # # 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-...
the-stack_106_17454
from __future__ import annotations from collections import defaultdict from struct import pack, Struct from typing import List, TYPE_CHECKING from pyNastran.bdf import MAX_INT from pyNastran.op2.errors import SixtyFourBitError if TYPE_CHECKING: # pragma: no cover from pyNastran.op2.op2 import OP2 def write_geom1(...
the-stack_106_17457
r""" Evaluate match expressions, as used by `-k` and `-m`. The grammar is: expression: expr? EOF expr: and_expr ('or' and_expr)* and_expr: not_expr ('and' not_expr)* not_expr: 'not' not_expr | '(' expr ')' | ident ident: (\w|:|\+|-|\.|\[|\])+ The semantics are: - Empty expression evaluates to False. ...
the-stack_106_17458
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
the-stack_106_17459
import datetime import unittest import uuid from flask import current_app from sqlalchemy import create_engine from werkzeug.exceptions import InternalServerError from secure_message import constants from secure_message.application import create_app from secure_message.services.service_toggles import internal_user_se...
the-stack_106_17461
import argparse parser = argparse.ArgumentParser(description="Download and transform EEG dataset") parser.add_argument("action", type=str, choices=["download", "transform", "compress"], help="Action can be download/transform/compress the dataset") parser.add_...
the-stack_106_17465
import requests import sys import math import os import dataclasses import typing import time from interpreter import Interpreter import operations as op def get(index: int, node: op.Cons): if index == 0: return op.Ap(op.Car(), node).evaluate(op.Environment()) return get(index - 1, op.Ap(op.Cdr(), no...
the-stack_106_17466
import os from typing import Optional, List from rebulk.match import MatchesDict from organizer import config from organizer.api import tmdb_api from organizer.processor.abstract_processor import AbstractProcessor from organizer.util.translation import translate class EpisodeProcessor(AbstractProcessor): """ ...
the-stack_106_17469
import logging import json import importlib import binascii from typing import List from types import SimpleNamespace from neo3.core import cryptography version = '0.6' core_logger = logging.getLogger('neo3.core') network_logger = logging.getLogger('neo3.network') storage_logger = logging.getLogger('neo3.storage') ...
the-stack_106_17470
""" Support for Modbus switches. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.modbus/ """ import logging import voluptuous as vol from homeassistant.components.modbus import ( CONF_HUB, DEFAULT_HUB, DOMAIN as MODBUS_DOMAIN) from homeassista...
the-stack_106_17472
import os from gensim.models.doc2vec import Doc2Vec from utils.mapreduce import corpus_iterator import gensim.models import psutil import logging logger = logging.getLogger(__name__) CPU_CORES = psutil.cpu_count() assert gensim.models.doc2vec.FAST_VERSION > -1 class d2v_embedding(corpus_iterator): def __init...
the-stack_106_17473
# -*- coding: utf-8 -*- """ MIT License Copyright (c) 2017 Vic Chan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modi...
the-stack_106_17476
''' Задача «Разворот последовательности» Условие Дана последовательность целых чисел, заканчивающаяся числом 0. Выведите эту последовательность в обратном порядке. При решении этой задачи нельзя пользоваться массивами и прочими динамическими структурами данных. Рекурсия вам поможет. ''' def reverse(s): # s1 = lis...
the-stack_106_17477
import argparse import ast import astor parser = argparse.ArgumentParser() parser.add_argument('path') parser.add_argument('-i', '--ignore') class Transformer(ast.NodeTransformer): def visit_YieldFrom(self, node): return ast.Await(node.value) def visit_With(self, node): change_node = False...
the-stack_106_17478
import jpy _JCallbackAdapter = jpy.get_type('io.deephaven.server.plugin.python.CallbackAdapter') def initialize_all_and_register_into(callback: _JCallbackAdapter): try: from . import register except ModuleNotFoundError as e: # deephaven.plugin is an optional dependency, so if it can't be found...
the-stack_106_17479
# -*- coding: utf-8 -*- # Copyright 2017, IBM. # # This source code is licensed under the Apache License, Version 2.0 found in # the LICENSE.txt file in the root directory of this source tree. """ Quantum Fourier Transform examples. Note: if you have only cloned the Qiskit repository but not used `pip install`, the ...
the-stack_106_17483
GAME_DURATION = 40.0 TIME_BONUS_MIN = 2 TIME_BONUS_MAX = 5 TIME_BONUS_RANGE = 3.0 SEND_UPDATE = 0.2 TOW_WIN = 0 TOW_TIE = 1 TOW_LOSS = 2 TOON_VS_TOON = 0 TOON_VS_COG = 1 WAIT_FOR_CLIENTS_TIMEOUT = 20 TUG_TIMEOUT = 45 WAIT_FOR_GO_TIMEOUT = 15 WIN_JELLYBEANS = 15 LOSS_JELLYBEANS = 4 TIE_WIN_JELLYBEANS = 12 TIE_LOSS_JELLY...
the-stack_106_17487
import os from setuptools import find_packages, setup setup_dir = os.path.abspath(os.path.dirname(__file__)) def read_file(filename): filepath = os.path.join(setup_dir, filename) with open(filepath) as file: return file.read() setup( name="spark-plot", use_scm_version=True, packages=f...
the-stack_106_17488
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
the-stack_106_17489
import os import shutil from PIL import Image INP_SUB_PATH = '/storage/timm/' INP_SUB_FILE = 'submission_best_tf_efficientnet_b8.txt' OUT_SUB_PATH = '/storage/submissions/' OUT_SUB_FILE = 'team007_b8tf_datacrop_BEST_postproc_final.txt' TEST_SET_DIR = '/dataset/test_set_A_full/' THRESHOLD = { '0': 0...
the-stack_106_17491
# noinspection PyProtectedMember from torch.optim.lr_scheduler import _LRScheduler, MultiStepLR, CosineAnnealingLR # noinspection PyAttributeOutsideInit class GradualWarmupScheduler(_LRScheduler): """ Gradually warm-up(increasing) learning rate in optimizer. Proposed in 'Accurate, Large Minibatch SGD: Train...
the-stack_106_17493
import logging from typing import Callable from PIL import Image, ImageDraw, ImageFont from PIL.Image import Image as ImageType from custom_components.xiaomi_cloud_map_extractor.common.map_data import ImageData from custom_components.xiaomi_cloud_map_extractor.const import * _LOGGER = logging.getLogger(__name__) c...
the-stack_106_17495
from django.contrib.auth import get_user_model from django.test import TestCase from django.urls import reverse from rest_framework import status from rest_framework.test import APIClient from core.models import Tag from recipe.serializers import TagSerializer TAGS_URL = reverse("recipe:tag-list") class PublicTag...
the-stack_106_17498
# Copyright 2013 OpenStack Foundation # All Rights Reserved. # Copyright 2013 IBM Corp. # # 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/LIC...
the-stack_106_17499
""" Contacts - SOLUTION """ # You went to a conference and got people to sign up for text updates from your startup. Go through this dict to make the phone numbers readable to a computer. # Hint: It can't include any non-numeric # characters. contacts = { 'Jamie': '1.192.168.0143', 'Kartik': '1.837.209.1121', 'G...
the-stack_106_17500
from helpers.registry import registry import requests from helpers.console_utils import console from brownie import web3 def address_to_id(token_address): checksummed = web3.toChecksumAddress(token_address) if checksummed == web3.toChecksumAddress(registry.tokens.wbtc): return "wrapped-bitcoin" if...
the-stack_106_17501
import os from .markup_threaded_poll_text import MarkupThreadedPollText class LoadAverageBox( MarkupThreadedPollText ): defaults = [ ("update_interval", 5, "Update interval in seconds, if none, the " "widget updates whenever the event loop is idle."), ] def __init__( self, *args, **...
the-stack_106_17502
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
the-stack_106_17504
""" This file offers the methods to automatically retrieve the graph Cryomorphaceae bacterium BACL21 MAG-121220-bin10. The graph is automatically retrieved from the STRING repository. References --------------------- Please cite the following if you use the data: ```bib @article{szklarczyk2019string, title={ST...
the-stack_106_17507
# STANDARD ADDEDTOGAME = "该物品被添加到游戏中。" ALLCLASSESBOX = "[[All classes/zh-hans|全兵种]]" ITEMLOOK = "" # not matches Chinese translation very well NOUNMARKER_INDEFINITE_COSMETIC = "一件" NOUNMARKER_INDEFINITE_SET = "一个" NOUNMARKER_INDEFINITE_WEAPON = "一把" SENTENCE_1_ALL = "'''{{{{item name|{item_name}}}}}({item_name...
the-stack_106_17508
#!/usr/bin/env python #------------------------------------------------------------------------------- # scripts/readelf.py # # A clone of 'readelf' in Python, based on the pyelftools library # # Eli Bendersky (eliben@gmail.com) # This code is in the public domain #------------------------------------------------------...
the-stack_106_17510
import logging logging.basicConfig( level=logging.WARNING ) LOGGERS = {} def set_log_level(debug_level: int): logging.basicConfig(level=debug_level) for _, logger in LOGGERS.items(): logger.setLevel(debug_level) def get_logger(logger_name: str) -> logging.Logger: if logger_name not in LOGGER...
the-stack_106_17511
# -*- coding: utf-8 -*- """ Created on Sat Aug 1 14:11:42 2020 @author: jisuk """ # %% import basic modules from __future__ import absolute_import, division, print_function import matplotlib.pyplot as plt from tensorflow.keras.datasets import mnist import tensorflow as tf import numpy as np # %% MNIST dataset para...
the-stack_106_17512
import functools import unittest2 from compass.config_management.utils import config_merger from compass.config_management.utils import config_merger_callbacks from compass.config_management.utils import config_reference class TestConfigMerger(unittest2.TestCase): def test_merge(self): upper_config = { ...
the-stack_106_17513
import subprocess class Extractor: def __init__(self, config, jar_path, max_path_length, max_path_width): self.config = config self.max_path_length = max_path_length self.max_path_width = max_path_width self.jar_path = jar_path def extract_paths(self, path): command = ...
the-stack_106_17514
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import unittest from yaml import safe_load from maro.data_lib.cim.port_parser import PortsParser default_conf = """ ports: demand_port_001: capacity: 100000 empty_return: buffer_ticks: 1 noise: 4 full_return: bu...
the-stack_106_17515
#!/usr/bin/env python3 from result import Result from exceptions import CGECoreOutTypeError, CGECoreOutTranslateError class Translate(): def __init__(self, type, transl_table): self.transl_table = transl_table self.type = type if(type not in Result.beone_defs): raise CGECore...
the-stack_106_17516
#!/usr/bin/env python3 import cv2 import numpy as np from activity_service import add_to_sample, run_activity_inference import requests import json import base64 import configparser config = configparser.ConfigParser() config.read("config.ini") def encode_img(image): _, buffer = cv2.imencode('.jpg', image) ...
the-stack_106_17517
"""Summary """ from PyQt5.QtCore import QRectF, QPointF from PyQt5.QtWidgets import QGraphicsObject from cadnano import util from cadnano.views.pathview import pathstyles as styles from cadnano.gui.palette import getPenObj, getNoBrush _BW = styles.PATH_BASE_WIDTH _TOOL_RECT = QRectF(0, 0, _BW, _BW) # protected not p...
the-stack_106_17519
""" Copyright (c) 2022 Huawei Technologies Co.,Ltd. openGauss is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W...
the-stack_106_17520
"""Tasks for management of this project.""" from __future__ import print_function import datetime import doctest import markdown2 import os import shutil import sys import unittest from collections import ( namedtuple) from glob import ( glob) from jinja2 import ( Environment, FileSystemLoader) from ...
the-stack_106_17521
# Copyright 2016, FBPIC contributors # Authors: Remi Lehe, Manuel Kirchen, Kevin Peters, Soeren Jalas # License: 3-Clause-BSD-LBNL """ Fourier-Bessel Particle-In-Cell (FB-PIC) main file It defines a set of generic functions for printing simulation information. """ import sys, time from fbpic import __version__ from fbp...
the-stack_106_17522
import sqlite3 def readFromFile(filename): str = '' f = open(filename, 'r', encoding='UTF-8') while True: line = f.readline() if len(line) == 0: break str += line f.close() return str def init_db(): c = sqlite3.connect('../sql.db').cursor() ...
the-stack_106_17523
from typing import List class Solution: def findMaxConsecutiveOnes(self, nums: List[int]) -> int: count, ans = 0, 0 for n in nums: if n == 1: count += 1 ans = max(ans, count) else: count = 0 return ans # TESTS for nu...
the-stack_106_17525
from flask import Flask from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) # 设置flask 关联的数据库 # 使用mysql 进行连接 username = "root" pwd = "123456" ip = "134.175.28.202" # 和启动docker 服务设定的端口保持一致 port = "8888" database = "test_ck18" app.config['SQLALCHEMY_DATABASE_URI'] = \ f'mysql+pymysql://{username}:{pwd}@{ip}...
the-stack_106_17532
# Copyright 2018 The TensorFlow Authors All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...