filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_20836
import asyncio from dataclasses import dataclass, field from dateutil import parser from enum import Enum import json from typing import Dict, List from typing import Optional from typing import NoReturn from functools import cached_property from pydantic import BaseSettings from rich.progress import ( BarColumn,...
the-stack_106_20837
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket 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-2.0 # # Unless required by applicab...
the-stack_106_20839
# Copyright 2014 Hewlett-Packard Development Company, L.P. # Copyright 2014 OpenStack Foundation # 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 # # ht...
the-stack_106_20843
"""This module contains the virtual motion glove interface.""" import contextlib import io import ipaddress import struct import time from typing import ContextManager, Sequence import serial from .data import GloveSample, IMUSample from .error import GloveConnectionError, GloveError, GlovePacketError, GloveTimeoutE...
the-stack_106_20844
from __future__ import unicode_literals from functools import total_ordering from operator import attrgetter from django import VERSION from django.conf import settings from django.contrib.contenttypes.fields import GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import conne...
the-stack_106_20845
from bs4 import BeautifulSoup import requests import random HEADERS_LIST = [ 'Mozilla/5.0 (Windows; U; Windows NT 6.1; x64; fr; rv:1.9.2.13) Gecko/20101203 Firebird/3.6.13', 'Mozilla/5.0 (compatible, MSIE 11, Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; rv:2....
the-stack_106_20846
import pytest from commitizen.cz.conventional_commits.conventional_commits import ( ConventionalCommitsCz, parse_scope, parse_subject, ) from commitizen.cz.exceptions import AnswerRequiredError valid_scopes = ["", "simple", "dash-separated", "camelCase" "UPPERCASE"] scopes_transformations = [["with space...
the-stack_106_20847
#Import Libraries import matplotlib.pyplot as plt import pandas as pd import numpy as np dataset = pd.read_csv('BankNote_Authentication.csv') X = dataset.iloc[:, [0,1]].values y = dataset.iloc[:, 4].values from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_test_split(X, y, ...
the-stack_106_20851
""" Checks the latest release from the "Ace" project (https://github.com/ajaxorg/ace-builds) which provides builds of the Ace code editor. """ import click import glob import json import logging import os import requests import shutil import tempfile import zipfile # Refers to the root of the project. BASE_DIR = os.p...
the-stack_106_20852
import time import struct import pytest import pysoem class El1259ConfigFunction: def __init__(self, device): self._device = device def fn(self, slave_pos): """ struct format characters B - uint8 x - pac byte H - uint16 """ self._device.sdo...
the-stack_106_20853
# coding: utf-8 from __future__ import unicode_literals from debparse import utils from . import paragraphs, classes def parse(path=None, data=None): """ Main deb_control package api method. Takes path to debian control file or its contents. """ assert path or data, 'path or data should be given...
the-stack_106_20854
"""Base class for encoders and generic multi encoders.""" import torch.nn as nn from onmt.utils.misc import aeq class EncoderBase(nn.Module): """ Base encoder class. Specifies the interface used by different encoder types and required by :class:`onmt.Models.NMTModel`. .. mermaid:: graph BT ...
the-stack_106_20855
# Copyright (c) 2022 F5, 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 agreed t...
the-stack_106_20856
# Copyright 2019 Arie Bregman # # 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 agree...
the-stack_106_20857
# Copyright 2020- Robot Framework Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
the-stack_106_20858
import boto3 import json import os,sys,time from opereto.helpers.services import ServiceTemplate from opereto.utils.validations import JsonSchemeValidator, validate_dict from opereto.exceptions import * class ServiceRunner(ServiceTemplate): def __init__(self, **kwargs): ServiceTemplate.__init__(self, **kw...
the-stack_106_20860
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 Cisco Systems, 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...
the-stack_106_20861
import typing class UnionFind(): def __init__( self, n: int, ) -> typing.NoReturn: self.__a = [-1] * n def find( self, u: int, ) -> int: a = self.__a au = a[u] if au < 0: return u au = self.find(au) a[u] = au return au def unite( self, u: int, ...
the-stack_106_20863
# WE SHOULD PUT MORE STRUCTURE ON THESE TAGS SO WE CAN ACCESS DOCUMENT # FIELDS ELEGANTLY # These are common variable tags that we'll want to access INSTANCE_DOC_NAME = u"_name" ID = u"_id" UUID = u"_uuid" SITE = u"fs_site" FS_STATUS = u"fs_status" FS_UUID = u"fs_uuid" FS_PROJECT_UUID = u"fs_project_uuid" FS_SITE_IDEN...
the-stack_106_20865
""" The GROVER models for pretraining, finetuning and fingerprint generating. """ from argparse import Namespace from typing import List, Dict, Callable import numpy as np import torch from torch import nn as nn from grover.data import get_atom_fdim, get_bond_fdim from grover.model.layers import Readout, GTransEncode...
the-stack_106_20866
from textwrap import wrap import matplotlib.pyplot as plt import numpy as np import seaborn as sns __all__ = ["likert_bar_plot"] DEFAULT_GROUPED_CHOICES = [ { "left": ["Yes"], "center": ["I don’t know", "I don’t want to answer this question", "No Answer"], "right": ["No"], }, { ...
the-stack_106_20867
# -*- coding: utf-8 -*- import pytest def test_local(pepper_cli, session_minion_id): '''Sanity-check: Has at least one minion - /run - /login query type is parameterized''' ret = pepper_cli('*', 'test.ping') assert ret[session_minion_id] is True @pytest.mark.xfail( pytest.config.getoption("--salt-ap...
the-stack_106_20868
# # Copyright 2014 Infoxchange Australia # # 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...
the-stack_106_20869
"""Load & convert data from CSV file using Python built-in csv module""" import bz2 import csv from collections import namedtuple from datetime import datetime Column = namedtuple('Column', 'src dest convert') def parse_timestamp(text): return datetime.strptime(text, '%Y-%m-%d %H:%M:%S') columns = [ Column...
the-stack_106_20871
import numpy as np from time import time import datetime from keras import layers from keras.layers import Input, Dense, Activation, ZeroPadding2D, BatchNormalization, Flatten, Conv2D from keras.layers import AveragePooling2D, MaxPooling2D, Dropout, GlobalMaxPooling2D, GlobalAveragePooling2D from keras.models import Mo...
the-stack_106_20877
from __future__ import absolute_import from unittest import TestCase from lintreview.review import Comment, Problems from lintreview.tools.xo import Xo from nose.tools import eq_ from tests import root_dir, requires_image FILE_WITH_NO_ERRORS = 'tests/samples/xo/no_errors.js', FILE_WITH_ERRORS = 'tests/samples/xo/has_...
the-stack_106_20878
# -*- coding: utf-8 -*- # # WeatherPlugin E2 # # Coded by Dr.Best (c) 2012-2013 # Support: www.dreambox-tools.info # E-Mail: dr.best@dreambox-tools.info # # This plugin is open source but it is NOT free software. # # This plugin may only be distributed to and executed on hardware which # is licensed by Dream Multimedia...
the-stack_106_20880
black=0,0,0 blue=(0,0,255) sky_blue=(200,200,255) red=(255,0,0) green=(0,255,0) yellow=(255,255,0) screen_width = 1000 screen_height = 600 #Spacing between water height locations spacing = 10 #pixels sea_level = 200 friction = 0.02 surface_tension = 0.3 #Number of water spacings beyond the right side of the screen th...
the-stack_106_20884
# qubit number=2 # total number=69 import pyquil from pyquil.api import local_forest_runtime, QVMConnection from pyquil import Program, get_qc from pyquil.gates import * import numpy as np conn = QVMConnection() def make_circuit()-> Program: prog = Program() # circuit begin prog += H(0) # number=1 pr...
the-stack_106_20886
import atmPy.atmos.gas_props as gp import atmPy.atmos.water as water from atmPy.atmos.constants import R, Na from numpy import sqrt, pi class Air(gp.Gas): def __init__(self, t=20.0, p=1013.25, **kwargs): super(Air, self).__init__(t, p) self._Rd = 287.05 self._Rv = 461.495 ...
the-stack_106_20887
import logging from typing import Iterable, Optional, Sequence from google.protobuf.struct_pb2 import ListValue as ProtobufList from google.protobuf.struct_pb2 import Struct as ProtobufStruct from lookout.core.analyzer import Analyzer, AnalyzerModel, DummyAnalyzerModel, ReferencePointer from lookout.core.api.event_pb...
the-stack_106_20888
#!/usr/bin/python # # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = ''' --- module: ordnance_facts author: "Alexander Turner (@alexanderturne...
the-stack_106_20892
import unittest from pbxproj.XcodeProject import * class PBXGenericTargetTest(unittest.TestCase): def testGetBuildPhase(self): project = XcodeProject({ "objects": { "1": {"isa": "PBXGenericTarget", "buildPhases": ["2"]}, "2": {"isa": "PBXGenericBuildPhase"} ...
the-stack_106_20893
#!/usr/bin/env python3 # Copyright (c) 2019 The OPALCOIN 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 sync_blocks, sync_m...
the-stack_106_20894
# This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load in import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O...
the-stack_106_20896
import os from django import forms from django.forms import widgets from django.utils import six from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from django.template.defaultfilters import filesizeformat from avatar.conf import settings from avatar.models import Av...
the-stack_106_20897
#!/usr/bin/env python # # minos documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All c...
the-stack_106_20898
"""Reads all ships and some of their basic attributes from the CCP SDE dump, and writes them into a CSV file.""" import csv import io import sqlite3 import shutil import constants as const # Terminology # # Skinned ship: # This term refers to a ship that differs from its "unskinned" sibling only in its looks, but ...
the-stack_106_20899
# Test means dtype import sys import numpy as np from frovedis.exrpc.server import FrovedisServer from frovedis.matrix.dense import FrovedisRowmajorMatrix from frovedis.mllib.gmm import GaussianMixture # initializing the Frovedis server argvs = sys.argv argc = len(argvs) if (argc < 2): print ('Please give frovedi...
the-stack_106_20900
# Copyright 2020-2021 Huawei Technologies Co., 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-2.0 # # Unless required by applicable law or agre...
the-stack_106_20901
from django.core.exceptions import PermissionDenied from django.contrib import messages from django.shortcuts import get_object_or_404, redirect from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from trix.trix_core.models import Course, User from trix.trix_course.views import base...
the-stack_106_20903
""" Planar Point Pattern Class """ import numpy as np import sys from pysal.lib.cg import KDTree from .centrography import hull from .window import as_window, poly_from_bbox from .util import cached_property import pandas as pd from matplotlib import pyplot as plt from matplotlib.collections import PatchCollection fr...
the-stack_106_20905
#!/usr/bin/env python3 import os import sys import tempfile import unittest from subvol_utils import Subvol from .temp_subvolumes import TempSubvolumes class SubvolTestCase(unittest.TestCase): ''' NB: The test here is partially redundant with demo_sendstreams, but coverage easier to manage when there's ...
the-stack_106_20906
# model settings model = dict( type='CascadeRCNN', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch', init_cfg=dict...
the-stack_106_20907
CHANNEL = "#bugbyte-ita" BOTNAME = "CovidBot" IRC_SERVER_ADDRESS = "irc.freenode.net" HTTP_REQUEST_TIMEOUT = 20 # timeout in seconds # https://console.cloud.google.com/apis/credentials YOUTUBE_KEY = '' # https://programmablesearchengine.google.com/ SEARCH_ENGINE = '' # https://newsapi.org/register NEWSAPI_KEY = ''...
the-stack_106_20908
#! /usr/bin/python import ck.kernel as ck import copy import re import argparse # Batch size iteration parameters. bs={ 'start':1, 'stop':1, 'step':1, 'default':1 } # Number of statistical repetitions. num_repetitions=3 def do(i, arg): # Detect basic platform info. ii={'action':'detect', 'modu...
the-stack_106_20909
import warnings warnings.filterwarnings("ignore", category=FutureWarning) import os import argparse import xml.etree.ElementTree as ET import pandas as pd import numpy as np import csv import time import datetime # Useful if you want to perform stemming. import nltk nltk.download("punkt") tokenizer = nltk.RegexpTokeni...
the-stack_106_20910
# Copyright 2012 OpenStack LLC. # 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 b...
the-stack_106_20911
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # C...
the-stack_106_20912
from collections import namedtuple import numpy as np from jesse.helpers import get_candle_source from jesse.helpers import slice_candles from jesse.indicators.ma import ma MACDEXT = namedtuple('MACDEXT', ['macd', 'signal', 'hist']) def macdext(candles: np.ndarray, fast_period: int = 12, fast_matype: int = 0, slow...
the-stack_106_20917
try: from setuptools import setup except ImportError: from distutils import setup description="transparent support for multiple templating languages in Django" long_description="""\ Smorgasbord makes it possible to use multiple template languages in Django, even for 3rd party applications that don't use y...
the-stack_106_20920
import serial import random import time import sys import signal """ ANTES DE EJECUTAR ESTE SCRIPT Instalar pyserial. En la consola de anaconda (Anaconda prompt) ejectutar: conda install pyserial EJECUTAR ESTE SCRIPT En la consola de anaconda (Anaconda prompt) ejectutar: cd path/to/script py...
the-stack_106_20921
"""Script to check the configuration file.""" import argparse import logging import os from collections import OrderedDict, namedtuple from glob import glob from typing import Dict, List, Sequence from unittest.mock import patch import attr import voluptuous as vol from homeassistant import bootstrap, core, loader f...
the-stack_106_20922
import six from django.conf import settings from django.shortcuts import redirect, reverse from django.contrib import messages from social_django.middleware import SocialAuthExceptionMiddleware from social_core.exceptions import NotAllowedToDisconnect, SocialAuthBaseException class SocialLoginExceptionMiddleware(Soc...
the-stack_106_20924
#!/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.mininode import * from test_framework.test_framework import BitcoinTestFramework from test...
the-stack_106_20927
# coding: utf-8 import sys from setuptools import setup, find_packages NAME = "dgidb-transformer" VERSION = "2.1.0" # To install the library, run the following # # python setup.py install # # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools REQUIRES = [ "connexion>=2.0.2", "swagger-ui-bundl...
the-stack_106_20928
import pytest from immudb import consistency from immudb.schema import schema_pb2 from immudb.client import ImmudbClient from immudb.consistency import verify import grpc._channel class TestConsistency: def test_verify_path(self): path = [] assert True == consistency.verify_path(path, 0, 0, bytes(...
the-stack_106_20929
import colorama import socket from typing import List, Optional import time import logging import paramiko.ssh_exception import paramiko.client from .worker_pool import WorkerPoolManager logger = logging.getLogger("thorctl") _COLORS = [ colorama.Fore.GREEN, colorama.Fore.YELLOW, colorama.Fore.CYAN, c...
the-stack_106_20930
import numpy as np import scipy.io as sio import h5py import random from PIL import Image import tensorflow as tf import keras.backend as K import os import glob data_path = 'data/' def gpu_config(gpu_id=0, gpu_mem=0.8): if gpu_mem: os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_V...
the-stack_106_20931
# Copyright 2014 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
the-stack_106_20932
#!/usr/bin/env python """Pathspecs are methods of specifying the path on the client. The GRR client has a number of drivers to virtualize access to different objects to create a Virtual File System (VFS) abstraction. These are called 'VFS Handlers' and they provide typical file-like operations (e.g. read, seek, tell a...
the-stack_106_20933
# coding=UTF-8 # ex:ts=4:sw=4:et=on # Copyright (c) 2013, Mathijs Dumon # All rights reserved. # Complete license can be found in the LICENSE file. import numpy as np from math import pi import logging logger = logging.getLogger(__name__) def get_atomic_scattering_factor(angstrom_range, atom_type): r""" Calc...
the-stack_106_20936
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ This file contains components with some default boilerplate logic user may need in training / testing. They will not work for everyone, but many users may find them useful. The behavior of functions/classes in this file ...
the-stack_106_20937
from zen.removeDuplicates import removeDuplicates from zen.removeAll import removeAll from zen.iterable import iterable def intersect(*args,**keywords): for k in keywords: if k in locals(): exec(k+'=keywords[k]') elif k in shortNames: exec(shortNames[k]+'=keywords[k]') sel=[] for a in args: sel....
the-stack_106_20938
# Copyright (C) 2020 leafcloud b.v. # Copyright (C) 2020 FUJITSU LIMITED # 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/lice...
the-stack_106_20939
"""Implements the BaseModule class used with the Measure and Source Modules of the M81.""" from lakeshore.xip_instrument import RegisterBase class SSMSystemModuleQuestionableRegister(RegisterBase): """Class object representing the questionable status register of a module""" bit_names = [ "read_error...
the-stack_106_20941
"""Optimization related functions.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import re from absl import flags import absl.logging as _logging import tensorflow.compat.v1 as tf import tpu_optimizer ##### Optimization related flags ##### # learni...
the-stack_106_20944
import tensorflow as tf import numpy as np from tensorflow.contrib import rnn from tensorflow.contrib import legacy_seq2seq class RNNModel: def __init__(self, vocabulary_size, batch_size, sequence_length, hidden_layer_size, cell...
the-stack_106_20945
# -*- coding: utf-8 -*- import tensorflow as tf from collections import namedtuple from cnn import CNN hps = namedtuple('hps', ['modelname', 'training_set_dir', 'test_set_dir', 'optimizer', 'loss_function', ...
the-stack_106_20946
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2017, John McNamara, jmcnamara@cpan.org # from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """...
the-stack_106_20949
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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_20951
"""Metrics to assess performance on classification task given class prediction Functions named as ``*_score`` return a scalar value to maximize: the higher the better Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize: the lower the better """ # Authors: Alexandre Gramfort <alexandre.gramf...
the-stack_106_20952
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file acc...
the-stack_106_20955
""" Hyperspy dataset converter to sidpy part of SciFiReader, a pycroscopy package author: Gerd Duscher, UTK First Version 11/19/2021 """ import sidpy import numpy as np try: import hyperspy.api as hs except ModuleNotFoundError: hs = None def convert_hyperspy(s): """ imports a hyperspy signal object...
the-stack_106_20956
#!/usr/bin/env python # -*- coding: utf-8 -*- # # diffpy.structure documentation build configuration file, created by # sphinx-quickstart on Mon Mar 27 11:16:48 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in t...
the-stack_106_20957
from sys import exit def gold_room(): print("This room is full of gold. How much do you take?") choice = input("> ") if "0" in choice or "1" in choice: how_much = int(choice) else: dead("Man, learn to type a number.") if how_much < 50: print("Nice, you're not gree...
the-stack_106_20958
# -*- coding: utf-8 -*- from setuptools import setup, find_packages import re, ast with open('requirements.txt') as f: install_requires = f.read().strip().split('\n') # get version from __version__ variable in cai/__init__.py _version_re = re.compile(r'__version__\s+=\s+(.*)') with open('cai/__init__.py', 'rb') as ...
the-stack_106_20959
import logging from tornado.options import options from pymongo import MongoClient from pymongo.errors import ConnectionFailure import tornado.web import tornado.escape import csv import re from oauth.decorator import CheckAuthorized from pretty_json import PrettyJsonRequestHandler RESERVED_KEYS = ["output", "outp...
the-stack_106_20960
#!/usr/bin/env python2 # -*- coding: utf-8 -*-" # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Script to build a component artifact.""" from __future__ import print_function import json import os ...
the-stack_106_20962
from __future__ import absolute_import, division, print_function import os import re import string import sys import time import unittest from collections import defaultdict, namedtuple, OrderedDict import numpy as np import ray import ray.test.test_functions as test_functions import ray.test.test_utils if sys.vers...
the-stack_106_20963
from unittest.mock import Mock from django.apps import apps from cms import app_registration from cms.utils.setup import setup_cms_apps from djangocms_internalsearch.base import BaseSearchConfig from .utils import TestCase class TestModelConfig(BaseSearchConfig): pass class InternalSearchInvalidConfigTestCa...
the-stack_106_20965
# coding: utf-8 import re import six from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization class ListSlowlogRequest: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key...
the-stack_106_20967
import logging from typing import Any, Dict, Optional, Type import pydantic from datahub.configuration.common import ( ConfigModel, ConfigurationError, DynamicTypedConfig, ) from datahub.ingestion.api.common import PipelineContext from datahub.ingestion.api.ingestion_state_provider import IngestionStatePr...
the-stack_106_20968
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.3.3 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # ## Rendering with seria...
the-stack_106_20969
import sys def compute_min_refills(distance , tank , stops): length , refill = 0,0 stops.append(distance) z = 0 stops.insert(0,z) stops.sort() for i in range(len(stops) - 1): if stops[i+1] - stops[i] > tank: return -1 if tank >= distance: return 0 i = 0 w...
the-stack_106_20970
#!/usr/bin/env python """A keyword index of client machines. An index of client machines, associating likely identifiers to client IDs. """ from grr.lib import keyword_index from grr.lib import rdfvalue from grr.lib import utils # The system's primary client index. MAIN_INDEX = rdfvalue.RDFURN("aff4:/client_index")...
the-stack_106_20973
from neuwon.database.time import TimeSeries from neuwon.examples.HH import make_model_with_hh import matplotlib.pyplot as plt import numpy as np class Model: def __init__(self, time_step = 1e-3, stagger = True, # These parameters approximately match Figure 4.9 & 4.10 o...
the-stack_106_20974
from django.core.urlresolvers import reverse from _index.models import Ids as _IndexIds from avatar.templatetags.avatar import avatar from _commons.helpers.types import TypesHelper from tutorial.models import Author as TutorialAuthor class ContentHelper(object): """ An helper on content operations """ ...
the-stack_106_20975
import sys from functools import update_wrapper from future.utils import iteritems from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db.models.base import ModelBase from django.utils import six from django.views.decorators.cache import never_cache from django.template....
the-stack_106_20977
from __future__ import unicode_literals from xml.dom.minidom import getDOMImplementation, parseString, Node from rd.core import RD, Element, Link, Property, Title XRD_NAMESPACE = "http://docs.oasis-open.org/ns/xri/xrd-1.0" def _get_text(root): text = '' for node in root.childNodes: if node.nodeType ...
the-stack_106_20980
import requests from app.modules.error_messages import error_messages def get_all_contries(url): # Requests: HTTP for Humans # Documentation: https://docs.python-requests.org/en/latest/ # The information is obtained from the countries and returned without any processing. try: print('Obtaini...
the-stack_106_20982
#!/usr/bin/env python3 # # Copyright (c) 2014-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # import json import time from typing import Dict, List import tabulate from openr.cli.utils import utils from openr.cli...
the-stack_106_20984
from setuptools import setup, find_packages from pathlib import Path import os directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'yumi_gym', 'envs', 'assets') data_files = [] for root, dirs, files in os.walk(directory): for file in files: data_files.append(os.path.join(root, file)) se...
the-stack_106_20986
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Gplates(CMakePackage): """GPlates is desktop software for the interactive visualisation of...
the-stack_106_20988
#!/usr/bin/python2.4 # Copyright 2009 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
the-stack_106_20990
import torch import torch.nn as nn from torch.utils.data import Dataset class MetricDataset(Dataset): def __init__(self, data): super(MetricDataset, self).__init__() self.data = data[0].squeeze() self.targets = data[1].squeeze() def __getitem__(self, index): return ( ...
the-stack_106_20991
"""The FSI for zipfiles""" import zipfile import os import tempfile import time import shutil import datetime import stat from io import BytesIO from stashutils.fsi import base from stashutils.fsi import errors # TODO: check filename bug when writing class ZipfileFSI(base.BaseFSI): """FSI for zipfiles""" ...
the-stack_106_20995
# -*- coding: utf-8 -*- from .common import * from ..test_program import ProgramTestBase class NodeTreeCreatorTestCase(TestCase): def build_xml(self, node): xml_str = BlocklyXmlBuilder().build(node) xml_str = xml_str.replace('<xml>', '<xml xmlns="http://www.w3.org/1999/xhtml">') return ...
the-stack_106_20996
import logging from FapgansControleBot.Exceptions.database_exceptions import NoResult from FapgansControleBot.Models.credit import Credit from FapgansControleBot.Models.gans import Gans from FapgansControleBot.Models.user import User from FapgansControleBot.Repository.i_unit_of_work import IUnitOfWork from FapgansCont...
the-stack_106_20997
"""Read CSV file from 2021 Digital Science Maturity and Skills Survey and rank skills by importance. Example: python rank_skills.py DSMS_Survey_20210803.csv The file argument is as downloaded (All Responses Data) from the GA Digital Science Maturity and Skills Deep Dive on Survey Monkey. The script is specific to...