filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_26556
# -*- coding: utf-8 -*- __author__ = "Gian Gamberi, Gui Reis, Rone FIlho, Marcelo Takayama" __copyright__ = "GadosComp" __version__ = "2.0" __status__ = "Production" __license__ = """ MIT License Copyright (c) 2021 GadosComp Permission is hereby granted, free of charge, to any person obtaining a copy of this softwa...
the-stack_106_26557
import os from typing import List import matplotlib.pyplot as plt import pandas as pd import numpy as np if __name__ == '__main__': data_path: str = os.path.join('.', 'datawarehouse', 'memory_comparison') file: str = os.path.join(data_path, 'mem_time.csv') df: pd.DataFrame = pd.read_csv(file, header=0) ...
the-stack_106_26559
from pylab import * from synapseConstants import * figure() title("NMDA synapse - Mg dependence") Vrange = arange(-80e-3,0e-3,1e-3) eta = 1.0 / mitral_granule_NMDA_KMg_A gamma = 1.0 / mitral_granule_NMDA_KMg_B Vdep = [ 1.0/(1+eta*MG_CONC*exp(-gamma*V)) for V in Vrange] plot(Vrange,Vdep,'r,-') show()
the-stack_106_26561
import numpy as np from .shape import Shape from .._shapes_utils import ( triangulate_edge, triangulate_ellipse, center_radii_to_corners, rectangle_to_box, ) class Ellipse(Shape): """Class for a single ellipse Parameters ---------- data : (4, D) array or (2, 2) array. Either a...
the-stack_106_26564
''' Description: The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calculate the Hamming distance. Note: 0 ≤ x, y < 231. Example: Input: x = 1, y = 4 Output: 2 Explanation: 1 (0 0 0 1) 4 (0 1 0 0) ↑ ↑ The...
the-stack_106_26565
#!/usr/bin/env python # Copyright (c) 2014 Wladimir J. van der Laan # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Run this script from the root of the repository to update all translations from transifex. It will do the follo...
the-stack_106_26566
import numpy as np __author__ = 'Otilia Stretcu' def normalize(data, axis, offset=None, scale=None, return_offset=False): """ Normalizes the data along the provided axis. If offset and scale are provided, we compute (data-offset) / scale, otherwise the offset is the mean, and the scale is the std (i....
the-stack_106_26567
"""Store configuration options as a singleton.""" import os import re import subprocess import sys from argparse import Namespace from functools import lru_cache from typing import Any, Dict, List, Optional, Tuple from packaging.version import Version from ansiblelint.constants import ANSIBLE_MISSING_RC DEFAULT_KIND...
the-stack_106_26569
import os, sys # We allow a two-level project structure where your root folder contains # project-specific apps and the "common" subfolder contains common apps. COMMON_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) PROJECT_DIR = os.path.dirname(COMMON_DIR) if os.path.basename(COMMON_DIR) == 'common-...
the-stack_106_26571
import pygame from map import game_map from gameSettings import * '''def ray_casting(screen, position, angle): half_angle = angle - h_fov #Angle of the first ray of scope xc, yc = position #Position of the player/camera //Starting position of all rays for ray in range(no_of_rays): sinA = math.sin(h...
the-stack_106_26572
#!/usr/bin/env python # # Copyright (c) 2009 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
the-stack_106_26573
"""packer_builder/__main__.py""" import os from packer_builder.cli import cli_args from packer_builder.build import Build from packer_builder.distros import Distros from packer_builder.templates import Templates from packer_builder.logger import setup_logger def build(args): """Build images.""" # Get diction...
the-stack_106_26574
import os from abc import ABC, abstractmethod from typing import Dict, List from typing import TYPE_CHECKING if TYPE_CHECKING: from superai.data_program import DataProgram from superai import Client from ..workflow import Workflow from superai.log import logger log = logger.get_logger(__name__) class Router(A...
the-stack_106_26576
#!/usr/bin/env python3 # # Copyright (c) 2017, Piotr Przymus # # 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, mod...
the-stack_106_26580
from random import randint from time import sleep from operator import itemgetter jogo = dict() quant = int(input('\nInforme o número de jogadores: ')) # Definindo o dicionário jogo: for c in range(quant): jogo[f'jogador{c+1}'] = randint(1, 6) # Exibindo o dicionário jogo: print('\nValores sorteados:\n') for k,...
the-stack_106_26582
"""Ray constants used in the Python code.""" import logging import math import os logger = logging.getLogger(__name__) def env_integer(key, default): if key in os.environ: return int(os.environ[key]) return default def env_bool(key, default): if key in os.environ: return True if os.env...
the-stack_106_26584
# coding: utf-8 import pprint import re import six class ThreadCollection(object): """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types...
the-stack_106_26585
# coding: utf-8 # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
the-stack_106_26586
# Copyright 2020 The StackStorm Authors. # Copyright 2019 Extreme Networks, 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 ...
the-stack_106_26587
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import torch from torch.utils.data import Dataset import numpy as np import jsonlines import json from pytorch_transformers.tokeniz...
the-stack_106_26588
from setuptools import setup with open("README.md", "r") as fh: long_description = fh.read() setup( author='Pelle Drijver', author_email='pelledrijver@gmail.com', url='https://github.com/pelledrijver/twitch-highlights', name='twitch-highlights', version='1.1.1', long_description=long_descr...
the-stack_106_26589
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. BK-LOG 蓝鲸日志平台 is licensed under the MIT License. License for BK-LOG 蓝鲸日志平台: ------------------------------------------------...
the-stack_106_26591
#!/usr/bin/env python # coding: utf-8 # This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges). # # Solution Notebook # ## Problem: Format license keys. # # See the [LeetCode](https://leetcode...
the-stack_106_26593
from .base import * # Django Debug Toolbar # https://django-debug-toolbar.readthedocs.io/en/latest/ INSTALLED_APPS += [ 'debug_toolbar', ] MIDDLEWARE += [ 'debug_toolbar.middleware.DebugToolbarMiddleware', ] INTERNAL_IPS = [ '127.0.0.1', ] # Static files (CSS, JavaScript, Images) # https://docs.djangop...
the-stack_106_26595
import numpy as np import pandas as pd from data_generation import * from calibration_functions import * from calibration_function_derivates import * from dataframe_helpers import * from binnings import * from os.path import join def create_CV_trick_rows(df): data_rows = [] selection = d...
the-stack_106_26597
# https://www.hackerrank.com/challenges/re-sub-regex-substitution/problem import re PATTERN = r"(?<= )(&&|\|\|)(?= )" N = int(input()) for _ in range(N): func = lambda x: "and" if x.group() == "&&" else "or" result = re.sub(PATTERN, func, input()) print(result)
the-stack_106_26599
# -*- python -*- # Copyright (C) 2009-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later versio...
the-stack_106_26600
#!/usr/bin/env python import random def getAnswer(number): if number == 1: return 'Hmm.. Good!!' elif number == 3: return 'Not good!' else: return 'Hmm.. Dunno!' ans = getAnswer(random.randint(0, 3)) print(ans)
the-stack_106_26601
"""Unit tests for the Hypersphere.""" import scipy.special import geomstats.backend as gs import geomstats.tests from geomstats.geometry.hypersphere import Hypersphere, HypersphereMetric from geomstats.learning.frechet_mean import FrechetMean from tests.conftest import Parametrizer from tests.data.hypersphere_data im...
the-stack_106_26602
from torch.utils.data import Dataset from torch.utils.data import DataLoader, WeightedRandomSampler import torch import numpy as np import scipy class TorchDataset(Dataset): """ Format for numpy array Parameters ---------- X: 2D array The input matrix y: 2D array ...
the-stack_106_26603
from __future__ import division, print_function import argparse import os import random import time import numpy as np import torch import torch.nn as nn import torch.optim as optim import factorial_crf_tagger import unit import utils parser = argparse.ArgumentParser() parser.add_argument( "--treebank_path", ...
the-stack_106_26605
import zmq import argparse import logging from logging import StreamHandler, Formatter from logging.handlers import SysLogHandler logger = logging.getLogger("") # setup the root logger def setup_logger(debug=False): if debug: level = logging.DEBUG else: level = logging.INFO logger.setLeve...
the-stack_106_26606
# # 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 us...
the-stack_106_26608
import json import logging from django.contrib.auth.models import ContentType, Permission from django.contrib.contenttypes.models import ContentType from django.http import ( HttpResponse, HttpResponseBadRequest, HttpResponseServerError, HttpResponseNotFound, ) from django.views.decorators.csrf import ...
the-stack_106_26612
# # Jasy - Web Tooling Framework # Copyright 2010-2012 Zynga Inc. # Copyright 2013-2014 Sebastian Werner # import jasy.core.Console as Console import jasy.item.Abstract as AbstractItem class ResolverError(Exception): """Error which is throws when resolving items could be be finished because of items which could...
the-stack_106_26619
import sqlalchemy as sa from sqlalchemy import event from sqlalchemy import exc from sqlalchemy import func from sqlalchemy import Integer from sqlalchemy import MetaData from sqlalchemy import select from sqlalchemy import String from sqlalchemy import testing from sqlalchemy.ext.declarative import comparable_using fr...
the-stack_106_26621
import logging from typing import Dict, List, Optional, Tuple import aiosqlite from mint.consensus.block_record import BlockRecord from mint.types.blockchain_format.sized_bytes import bytes32 from mint.types.blockchain_format.sub_epoch_summary import SubEpochSummary from mint.types.full_block import FullBlock from mi...
the-stack_106_26624
import cv2 import time import mediapipe as mp import autopy import numpy as np import math ##################################### width_cam, height_cam = 640, 480 frame_reduction = 100 smoothen = 3 ##################################### p_time = 0 p_loca_x, p_loca_y = 0, 0 cap = cv2.VideoCapture(0) cap.set(3, height_c...
the-stack_106_26626
"""Use the EPA crosswalk to connect EPA units to EIA generators and other data. A major use case for this dataset is to identify subplants within plant_ids, which are the smallest coherent units for aggregation. Despite the name, plant_id refers to a legal entity that often contains multiple distinct power plants, eve...
the-stack_106_26627
#!/usr/bin/env python # -*- coding: utf-8 -*- # Name : FedAvg_tutorial.py # Time : 2020/3/3 13:55 # Author : Fu Yao # Mail : fy38607203@163.com """ This file is to show how to use this framework in general ML scenarios. Because this model (Linear Regression) is super simple, multi-process FL is slower then ...
the-stack_106_26628
""" Module difflib -- helpers for computing deltas between objects. Function get_close_matches(word, possibilities, n=3, cutoff=0.6): Use SequenceMatcher to return list of the best "good enough" matches. Function context_diff(a, b): For two lists of strings, return a delta in context diff format. Function nd...
the-stack_106_26629
import os os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = "-1" import numpy as np import pandas as pd import tensorflow as tf from tqdm import tqdm import matplotlib.pyplot as plt import random from Utils.DataProcessing import * import scipy import sys seed = 2605 l = 9 r = 50 epsil...
the-stack_106_26631
#!/usr/bin/env python from __future__ import absolute_import, print_function, unicode_literals import os from optparse import OptionParser from django.core.management import ManagementUtility def create_project(parser, options, args): # Validate args if len(args) < 2: parser.error("Please specify a ...
the-stack_106_26632
''' Comparison of basis data against authoritative sources ''' from ..api import get_basis from ..misc import compact_elements from ..sort import sort_shells, sort_potentials from ..lut import element_sym_from_Z from .. import manip from ..readers import read_formatted_basis_file from .compare import _reldiff def _p...
the-stack_106_26633
# coding: utf-8 """ Pure Storage FlashBlade REST 1.3 Python SDK Pure Storage FlashBlade REST 1.3 Python SDK, developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/). OpenAPI spec version: 1.3 Contact: i...
the-stack_106_26635
# flake8: noqa import copy from typing import List, Tuple, Union from django import forms from django.conf import settings from django.forms import BaseForm, BaseInlineFormSet, BaseModelForm, BaseModelFormSet from django.forms.forms import DeclarativeFieldsMetaclass from django.forms.models import ModelFormMetaclass ...
the-stack_106_26636
import json import logging import subprocess import re import sys import unicodedata from HTMLParser import HTMLParser # Input text must be pre-processed for fastText to use class MLStripper(HTMLParser): def __init__(self): self.reset() self.fed = [] def handle_data(self, d): self.fed...
the-stack_106_26637
import pytest import time from esclient import TextfileDocument @pytest.fixture def textfile_document(request): textfile_document = TextfileDocument() textfile_document.delete_index() textfile_document.put_index() textfile_document.put_mapping() def clean_up(): textfile_document.delete_in...
the-stack_106_26639
#!/usr/bin/env python import sys import tensorflow as tf import numpy as np if len(sys.argv) == 2: ckpt_fpath = sys.argv[1] else: print('Usage: python count_ckpt_param.py path-to-ckpt') sys.exit(1) # Open TensorFlow ckpt and count the number of trainable parameters in the model reader = tf.train.NewCheck...
the-stack_106_26640
import os import re import mock import requests import shutil import subprocess import _test_helpers as helpers def make_r_side_effect(recognized = True): ''' Make a mock of mocks subprocess.check_output() for R CMD BATCH commands The executable_recognized argument determines whether "R" is a recogniz...
the-stack_106_26641
import os import sys import logging import subprocess from typing import List, NoReturn, Union, Any from . import __pyright_version__, node from .utils import env_to_bool __all__ = ( 'run', 'main', ) log: logging.Logger = logging.getLogger(__name__) def main(args: List[str], **kwargs: Any) -> int: ret...
the-stack_106_26642
#!/usr/bin/env python3 """ NAPALM using nxos_ssh has the following data structure in one of its unit tests (the below data is in JSON format). { "Ethernet2/1": { "ipv4": { "1.1.1.1": { "prefix_length": 24 } } }, "Ethernet2/2": { "ipv4": { ...
the-stack_106_26643
import argparse import os import pathlib import random import typing import pycspr from pycspr.client import NodeClient from pycspr.client import NodeConnectionInfo from pycspr.types import Deploy from pycspr.types import PrivateKey from pycspr.types import PublicKey from pycspr.types import UnforgeableReference # ...
the-stack_106_26647
# # This file is part of BDC Core. # Copyright (C) 2019-2020 INPE. # # BDC Core is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. # """Authentication decorators such scope validator and token require.""" from functools import wraps impo...
the-stack_106_26651
import matplotlib.pyplot as plt import numpy as np lines = open('log.txt').readlines() scores = [] # print(len(lines)) for line in lines: score = line.split(' ')[5] score = score.split('\n') if len(score) > 1: scores.append(float(score[0])) plt.plot(scores) plt.show()
the-stack_106_26653
# -*- coding: utf-8 -*- # 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...
the-stack_106_26655
# encoding: latin2 """Transport Layer geometry """ __author__ = "Juan C. Duque, Alejandro Betancourt" __credits__ = "Copyright (c) 2009-10 Juan C. Duque" __license__ = "New BSD License" __version__ = "1.0.0" __maintainer__ = "RiSE Group" __email__ = "contacto@rise-group.org" __all__ = ['getBbox'] # transportLayer de...
the-stack_106_26656
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from math import exp, pi import os import random import torch import unittest import gpytorch from torch import optim from gpytorch.kernels import RBFKernel, ScaleKernel...
the-stack_106_26657
import time import board import busio import adafruit_bno055 import numpy as np np.set_printoptions(linewidth=np.inf, precision=6, suppress=True) i2c = busio.I2C(board.SCL, board.SDA) sensor = adafruit_bno055.BNO055_I2C(i2c) sensor.mode = adafruit_bno055.IMUPLUS_MODE tt = None for i in range(1000000): t0 = tim...
the-stack_106_26658
import json from snet.snet_cli.utils.utils import get_address_from_private, get_contract_object, normalize_private_key DEFAULT_GAS = 300000 TRANSACTION_TIMEOUT = 500 class TransactionError(Exception): """Raised when an Ethereum transaction receipt has a status of 0. Can provide a custom message. Optionally incl...
the-stack_106_26660
import base64 import os import re import shutil import subprocess import tempfile import urllib from contextlib import contextmanager from datetime import timedelta from typing import ( Any, Callable, Collection, Dict, Iterable, Iterator, List, Mapping, Optional, Sequence, Se...
the-stack_106_26662
import copy from typing import Any, Dict, List from pytest import lazy_fixture # type: ignore from pytest import fixture, mark, param from omegaconf import OmegaConf from omegaconf._utils import ValueKind, _is_missing_literal, get_value_kind def build_dict( d: Dict[str, Any], depth: int, width: int, leaf_value...
the-stack_106_26663
import pytest import json import time import logging import os from tests.common.fixtures.ptfhost_utils import copy_ptftests_directory # lgtm[py/unused-import] from tests.ptf_runner import ptf_runner from tests.common.devices import AnsibleHostBase from tests.common.fixtures.conn_graph_facts import conn_graph_facts...
the-stack_106_26664
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from code import Code from model import PropertyType import any_helper import cpp_util class CppTypeGenerator(object): """Manages the types of propert...
the-stack_106_26665
import typing as t from collections import Counter from weakref import WeakSet class Metric: def __init__( self, name: str, counter: t.MutableMapping[str, t.Union[float, int]], default: t.Union[float, int] = 0, ): self.name: str = name self.counter = counter sel...
the-stack_106_26666
"""Base option parser setup""" # The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False from __future__ import absolute_import import logging import optparse import sys import textwrap from distutils.util import strtobool from pip._vendor.six import string_types fr...
the-stack_106_26670
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import os.path as osp import numpy as np # `pip install easydict` if you don't have it from easydict import EasyDict as edict __C = edict() # Consumers can get config by: # from fast_rcnn_config im...
the-stack_106_26671
# -*- coding: utf-8 -*- """ Created on Wed Feb 3 14:33:25 2016 @author: hjalmar """ from ht_helper import get_input, FrameStepper, CountdownPrinter import matplotlib.pyplot as plt from datetime import datetime from scipy.misc import imresize from time import sleep from glob import glob import numpy as np import war...
the-stack_106_26673
# -*- coding: utf-8 -*- # 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, softw...
the-stack_106_26675
# -*- coding: utf-8 -*- # Copyright 2013 Mirantis, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
the-stack_106_26677
# Copyright (c) 2009-2015 Tom Keffer <tkeffer@gmail.com> # See the file LICENSE.txt for your rights. """Example of how to implement a low battery alarm in weewx. ******************************************************************************* To use this alarm, add the following somewhere in your configuration...
the-stack_106_26681
from src.application.usecase.place_order import PlaceOrder from src.infra.repository.memory.item_repository_memory import ItemRepositoryMemory from src.infra.repository.memory.order_repository_memory import OrderRepositoryMemory def test_place_order(): input = { "cpf": "847.903.332-05", "order_ite...
the-stack_106_26682
import copy def mat_shift(mat, way = 'down', inplace = False): """ Shifts a matrix's rows by one position """ assert mat.size != None if inplace: cmat = mat else: cmat = copy.deepcopy(mat) temp_mat = copy.deepcopy(cmat) if way.lower() == 'down': for r in range...
the-stack_106_26683
"""Test FAST extractor.""" from os.path import dirname, join, realpath from cd2h_repo_project.modules.terms.fast import FAST class TestFAST(object): """Test FAST extractor.""" filename = 'fast_test_file.nt' @classmethod def filepath(cls): return join(dirname(realpath(__file__)), cls.filenam...
the-stack_106_26684
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import re import sys import cv2 from face_track import tracker request_run: bool = True def main(args=None) -> int: """The main routine.""" if args is None: args = sys.argv[1:] print(f"OpenCV version: {cv2.__version__}") cv_info = [ r...
the-stack_106_26685
from django.conf import settings from django.db import migrations def update_site_forward(apps, schema_editor): """Set site domain and name.""" Site = apps.get_model("sites", "Site") Site.objects.update_or_create(id=settings.SITE_ID, defaults={"domain": "pola.pl", "name": "pola"}) def update_site_backwa...
the-stack_106_26686
import io import os from operator import itemgetter from os.path import join import pytest from dvc.fs import get_cloud_fs from dvc.fs.local import LocalFileSystem from dvc.path_info import PathInfo from dvc.repo import Repo from dvc.scm import SCM from tests.basic_env import TestDir, TestGit, TestGitSubmodule clas...
the-stack_106_26687
""" Test Figure.grdimage. """ import numpy as np import pytest import xarray as xr from pygmt import Figure from pygmt.datasets import load_earth_relief from pygmt.exceptions import GMTInvalidInput from pygmt.helpers.testing import check_figures_equal @pytest.fixture(scope="module", name="grid") def fixture_grid(): ...
the-stack_106_26688
from blackbot.core.utils import get_path_in_package from blackbot.core.wss.atomic import Atomic from terminaltables import SingleTable import os import json class Atomic(Atomic): def __init__(self): self.name = 'Impact/T1489-2' self.controller_type = '' self.external_id = 'T1489' s...
the-stack_106_26689
import torch from torch.autograd import Variable import torch.nn as nn import torch.utils.model_zoo as model_zoo import torch.nn.functional as F import random import numpy as np import os __all__ = [ 'VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn', 'vgg19_bn', 'vgg19', 'model' ...
the-stack_106_26691
# timing_t.cfg # NON-REGRESSSION Unit test configuration file for MessageLogger service: # This variant puts Timing into job report. # Tester should run with FrameworkJobReport.fwk and timing_t.log for proper timing info. import FWCore.ParameterSet.Config as cms process = cms.Process("TEST") import FWCore.Framewor...
the-stack_106_26692
import shutil from dataclasses import dataclass from pathlib import Path from typing import Union import requests from fastapi.logger import logger from mealie.core.config import app_dirs from mealie.services.image import minify @dataclass class ImageOptions: ORIGINAL_IMAGE: str = "original*" MINIFIED_IMAGE:...
the-stack_106_26698
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # Copyright 2015 and onwards Google, 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/license...
the-stack_106_26699
from typing import List, Optional, Tuple, Dict import numpy as np from docknet.layer.abstract_layer import AbstractLayer class AdamOptimizer(object): def __init__(self, learning_rate: float = 0.01, beta1: float = 0.9, beta2: float = 0.999, epsilon: float = 1e-8): """ Builds a new Adam Optimizer ...
the-stack_106_26700
# Copyright (c) 2010 Advanced Micro Devices, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source code must retain the above copyright # notice, this list of conditions...
the-stack_106_26701
# Copyright (c) 2018, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. import unittest from cybox.test import EntityTestCase, round_trip from maec.bundle.bundle import Bundle from maec.bundle.malware_action import MalwareAction from cybox.core import Object from maec.bundle.behavior i...
the-stack_106_26703
from typing import List, Tuple import numpy as np from collections import defaultdict from gnes.indexer.base import BaseChunkIndexer as BCI class KeywordIndexer(BCI): def __init__(self, *args, **kwargs): """ Initialize an indexer that implements the AhoCorasick Algorithm """ supe...
the-stack_106_26705
import os import sqlite3 from functools import update_wrapper from dagster import check from .sql import run_migrations_offline as run_migrations_offline_ from .sql import run_migrations_online as run_migrations_online_ def run_migrations_offline(*args, **kwargs): try: run_migrations_offline_(*args, **k...
the-stack_106_26707
# -*- coding: utf-8 -*- """ Cloudformation Template Generation. """ import json from troposphere_mate import ( Template, Parameter, Ref, helper_fn_sub, iam, awslambda, canned, ) from ..devops.config_init import config template = Template() param_env_name = Parameter( "EnvironmentName", Type="Strin...
the-stack_106_26708
""" High level interface to PyTables for reading and writing pandas data structures to disk """ import copy from datetime import date, tzinfo import itertools import os import re from typing import ( TYPE_CHECKING, Any, Dict, Hashable, List, Optional, Tuple, Type, Union, ) import wa...
the-stack_106_26710
prisonCell = "" windows = int(input("Please enter the amount of windows in your home: ")) if windows < 0: print("\nI'm pretty sure thats impossible") elif windows == 0: print("\nI'm beginning to suspect you live\nin some kind of military compound") elif windows == 1: prisonCell = (str(input("\nDo y...
the-stack_106_26711
import logging import threading import time import message import shared class Advertiser(threading.Thread): def __init__(self): super().__init__(name='Advertiser') def run(self): while True: time.sleep(0.4) if shared.shutting_down: logging.debug('Shut...
the-stack_106_26714
#!/usr/bin/env python # An example of building a state machine in ROS. # # state_machine.py # # Bill Smart # # This code is an example of how to put together a state machine in ROS using smach. The # state machine is defined in code, rather than in some description format, which gives it # more flexibility. Note th...
the-stack_106_26715
import argparse import gensim import json import numpy as np import os import torch from nltk.tokenize import word_tokenize from tqdm import tqdm from models import InferSent def transform_sentences(_sentences, _model, _pretrained): _model.cuda() if _pretrained == 'ft': W2V_PATH = 'fastText/crawl-30...
the-stack_106_26717
import pytest from tests.unit_tests.test_resources.mock_for_querybuilder_tests import all_query_builders from sokannonser.repository.platsannonser import transform_platsannons_query_stats_result from tests.test_resources.stats import region_stats, region_stats_result, municipality_stats, municipality_stats_result, \ ...
the-stack_106_26719
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2020. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
the-stack_106_26721
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2013 Boris Pavlovic (boris@pavlovic.me). # 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 # # ...
the-stack_106_26723
#!/bin/env python3 """ This script creates a canonicalized version of KG2 stored in TSV files, ready for import into neo4j. The TSVs are created in the current working directory. Usage: python3 create_canonicalized_kg_tsvs.py [--test] """ import argparse import ast import csv import os import sys import time import tra...
the-stack_106_26724
"""Tool to get AWS credentials from AWS STS when MFA is required to AWS CLI.""" from configparser import ConfigParser from typing import ( Dict, Optional ) from sys import ( exit, stderr ) import json import os import subprocess def get_aws_credentials( aws_profile: str, aws_config_file: str...
the-stack_106_26732
#!/usr/bin/env python # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """git drover: A tool for merging changes to release branches.""" import argparse import pickle import functools import logging import ...