text
stringlengths
2
999k
# Copyright 2019 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...
# Copyright (c) 2014-2015, Ericsson AB. All rights reserved. # # 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...
from sys import argv script, first, second, third = argv #these 4 things with commas are argv broken down into 4 variables or placeholders #names or labels have been given to portions of the data (argv--argument variable which gets assigned to 4 variables instead of 1 holding all) print("The script is called:", sc...
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from dataclasses import dataclass from typing import Optional, Tuple from pants.backend.python.lint.bandit.subsystem import Bandit from pants.backend.python.rules import pex from pants.ba...
""" Argo Server API You can get examples of requests and responses by using the CLI with `--gloglevel=9`, e.g. `argo list --gloglevel=9` # noqa: E501 The version of the OpenAPI document: VERSION Generated by: https://openapi-generator.tech """ import re # noqa: F401 import sys # noqa: F401 from ...
from __future__ import division from itertools import tee from operator import itemgetter from collections import defaultdict from math import log def l(k, n, x): # dunning's likelihood ratio with notation from # http://nlp.stanford.edu/fsnlp/promo/colloc.pdf p162 return log(max(x, 1e-10)) * k + log(max(1...
import os, time, fnmatch, socket, errno from os.path import isdir, isfile, join, exists, splitext, basename, realpath import whisper from graphite.remote_storage import RemoteStore from django.conf import settings import libmc import numpy as np LOCAL_MEMCACHE = settings.LOCAL_MEMCACHE EXPIRE_TIME = settings.EXPIRE_TI...
from statistics import mean from rb.complexity.complexity_index import ComplexityIndex from rb.core.lang import Lang from rb.core.text_element import TextElement from rb.complexity.index_category import IndexCategory from rb.complexity.measure_function import MeasureFunction from rb.core.text_element_type import TextEl...
# 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 # # http://www.apache.org/licenses/LICENSE-2.0...
import numpy as np from PuzzleLib.Backend import gpuarray from PuzzleLib.Modules.Module import ModuleError, Module class Concat(Module): def __init__(self, axis, name=None): super().__init__(name) self.registerBlueprint(locals()) self.axis = axis self.sections = None def updateData(self, data): self.s...
import pytest import torch from transformers import AutoTokenizer from typing import List, Dict from pkg_resources import resource_filename from nerblackbox.modules.ner_training.data_preprocessing.tools.csv_reader import ( CsvReader, ) from nerblackbox.modules.ner_training.data_preprocessing.tools.input_example imp...
#!/usr/bin/python #coding:utf-8 # *************************************************************** # 绘制正态分布曲线 # author: pruce # email: 1756983926@qq.com # date: 20180919 # *************************************************************** import numpy as np import matplotlib.mlab as mlab import matplot...
"""Classifiers for the Toxic Comment Classification Kaggle challenge, https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge To run locally: python keras-trainer/model.py """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse...
import numpy as np import scipy.special class NeuralNetwork: def __init__(self, input_nodes, hidden_nodes, output_nodes, learning_rate=0.1): self.inodes = input_nodes self.hnodes = hidden_nodes self.onodes = output_nodes self.lr = learning_rate self.weights_ih = np.random.r...
# Generated by Django 2.2.4 on 2019-08-08 11:44 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0002_auto_20190802_1553'), ] operations = [ migrations.AddField( model_name='partilha', name='icone', ...
# -*- coding: utf-8 -*- """Test the module can be imported.""" import unittest import os import yaml from linkml_model_enrichment.importers.owl_import_engine import OwlImportEngine from linkml.generators.yamlgen import YAMLGenerator from tests import INPUT_DIR, OUTPUT_DIR SHACL = os.path.join(INPUT_DIR, 'shacl.ofn')...
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # # SPDX-License-Identifier: MIT """A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ from setuptools import setup, find_packages # To use a consistent encoding from ...
# # Copyright (C) Intel Corporation. All rights reserved. # Licensed under the MIT License. # import os import sys import importlib from writeUI import writeUI from statistic import statistic from callStack import callStack from util import * class core: def __init__(self): self.source = None sel...
import os import re import sys import json import shutil import sqlite3 import tempfile import datetime from pprint import pprint from copy import deepcopy from collections import namedtuple from subprocess import check_output from multiprocessing import Process, cpu_count, Manager import numpy as np import mead import...
"""Llama View""" __docformat__ = "numpy" import logging import os from typing import List, Optional import matplotlib.pyplot as plt from matplotlib import ticker from gamestonk_terminal import config_terminal as cfg from gamestonk_terminal.config_plot import PLOT_DPI from gamestonk_terminal.cryptocurrency.cryptocurr...
# MIT licensed # Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al. from .simple_json import simple_json HACKAGE_URL = 'https://hackage.haskell.org/package/%s/preferred.json' def _version_from_json(data): return data['normal-version'][0] get_version, get_cacheable_conf = simple_json( HACKAGE_URL, '...
from csympy.utilities import raises from csympy import Integer def test_integer(): i = Integer(5) assert str(i) == "5" def test_integer_long(): i = Integer(123434444444444444444) assert str(i) == "123434444444444444444" def test_integer_string(): raises(TypeError, lambda: Integer("133")) def te...
import clingine, random class Star(clingine.shapes.Rect): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.char = random.choice(["*", ".", "o"]) def reset(self): self.y = 0 self.x = random.randrange(self.window.width - 1) def check_bounds(self): if self.y > self.window.height:...
import unittest from commonroad.scenario.intersection import Intersection, IntersectionIncomingElement class TestIntersection(unittest.TestCase): def setUp(self) -> None: self._incoming_id_1 = 2 lanelets_1 = {10, 11} successors_right_1 = {12, 13} successors_straight_1 = {14, 15} ...
from flask import request from flask_restful import Resource from src.music.model import MusicManager from src.music.parser import musicparser class MusicController(Resource): """Music resource for restful api.""" def get(self): manager = MusicManager() response = manager.search() ret...
import numpy as np import time from openvino.inference_engine import IENetwork, IECore import os import cv2 import argparse import sys class Queue: ''' Class for dealing with queues ''' def __init__(self): self.queues=[] def add_queue(self, points): self.queues.append(points) ...
import random def reverse(phrase): return phrase [::-1] def str_shuffle(phrase): l = list(phrase) random.shuffle(l) shuffled_str = ''.join(l) return shuffled_str
import numpy as np def Cal_IoU(GT_bbox, Pred_bbox): ''' Args: GT_bbox: the bounding box of the ground truth Pred_bbox: the bounding box of the predicted Returns: IoU: Intersection over Union ''' #1. Calculate the area of the intersecting area ixmin = max(GT_bbox[0], Pre...
class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: subsets = [[]] while len(nums) > 0: new_element = nums.pop() subsets += [subset + [new_element] for subset in subsets] return subsets
# 开发环境映射 import os import sys # 数据库参数 DATABASE = { 'product': { 'ENGINE': 'mysql', # 'HOST': '192.168.2.222', 'HOST': '', 'PASSWORD': '', 'USER': '', 'PORT': '3306', 'NAME': '', "CHARSET": "utf8" }, ...
''' Evaluation of agent trajectories ''' import json import os import sys sys.path.append('build') from collections import defaultdict import networkx as nx import numpy as np import pprint pp = pprint.PrettyPrinter(indent=4) from env import R2RBatch from utils import load_datasets, load_nav_graphs from agent import ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """The setup script.""" from setuptools import setup, find_packages with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read() requirements = [ 'gino', 'aiohttp', ] setup_...
from nose.tools import eq_ from ..diff_engine import DiffEngine def test_from_config(): doc = { 'diff_engines': { 'segment_matcher':{ 'class': "deltas.algorithms.SegmentMatcher", 'segmenter': "western_psw", 'tokenizer': "wikitext_split" ...
import subprocess import typer from typer.testing import CliRunner from parameter_types.datetime import tutorial001 as mod runner = CliRunner() app = typer.Typer() app.command()(mod.main) def test_help(): result = runner.invoke(app, ["--help"]) assert result.exit_code == 0 assert "[%Y-%m-%d|%Y-%m-%dT%...
#!/usr/bin/env python3 import unittest import torch from gpytorch.lazy import RootLazyTensor from gpytorch.test.lazy_tensor_test_case import LazyTensorTestCase class TestRootLazyTensor(LazyTensorTestCase, unittest.TestCase): seed = 0 should_test_sample = True should_call_lanczos = False should_call...
#! /usr/bin/env python # -*- encoding: utf-8 -*- import logging import pika import json LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) ' '-35s %(lineno) -5d: %(message)s') LOGGER = logging.getLogger(__name__) class AsyncPublisher(object): """This is an example publisher that...
# coding: utf-8 """ Clever API The Clever API # noqa: E501 OpenAPI spec version: 2.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six from clever.models.teacher import Teacher # noqa: F401,E501 class TeacherObject(obj...
#!/usr/bin/env python ############################################################################## # Copyright 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. ################################...
# %% from tensorflow.keras.callbacks import LearningRateScheduler from tensorflow.keras.preprocessing.image import random_rotation, random_shear, random_zoom from sklearn.metrics import confusion_matrix, classification_report from tensorflow.keras.applications.efficientnet import preprocess_input from tensorflow.keras....
import ijson import pandas import numpy as np from scipy.stats import norm, expon import matplotlib.pyplot as plt def main(): with open('BTCUSDT.json', 'r') as f: trades = ijson.items(f, 'item') previous_price = None previous_time = None changes = [] interarrivals = [] volumes = [] for trade in tr...
# -*- coding: utf-8 -*- from operator import attrgetter from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType from pyangbind.lib.yangtypes import RestrictedClassType from pyangbind.lib.yangtypes import TypedListType from pyangbind.lib.yangtypes import YANGBool from pyangbind.lib.yangtypes import YANGListTy...
# 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...
# # Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # This software is distributed under the terms of the MIT License. # # (@@@@%%%%%%%%%&@@&. # /%&&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&@@( # *@&%%%%%%%%%&...
from baldwin.src.target import Target with Target() as target: target.reset()
""" Defines the settings for ConfD/CSP based unicon connections """ __author__ = "Dave Wapstra <dwapstra@cisco.com>" from ..settings import ConfdSettings class CspSettings(ConfdSettings): """" Generic platform settings """ def __init__(self): """ initialize """ super().__init__() ...
from AgroMetEquations.convert import ( celsius2kelvin, kelvin2celsius, deg2rad, rad2deg, watt2mj15min, dailyto15min, dms2dd, dd2dms ) from AgroMetEquations.fao import ( atm_pressure, avp_from_temperature_min, avp_from_rhmin_rhmax, avp_from_rhmax, avp_from_rhmean, ...
""" A module to contain various decorators used to build readable and useful code. """ __all__ = [ "angular_freq_to_hz", "check_relativistic", "check_values", "check_units", "preserve_signature", "validate_quantities", "CheckBase", "CheckUnits", "CheckValues", "ValidateQuantities...
from crownstone_core.packets.serviceDataParsers.containers.elements.AdvTypes import AdvType class AdvExternalErrorPacket: def __init__(self): self.type = AdvType.EXTERNAL_ERROR self.crownstoneId = None self.errorsBitmask = None self.errorTimestamp ...
from ._datajoint_core import ffi from .datajoint_core_lib import dj_core def datajoint_core_assert_success(error_code): if error_code != dj_core.ErrorCode_Success: error_message_raw = dj_core.datajoint_core_get_last_error_message() if error_message_raw == ffi.NULL: raise AssertionError...
from contextlib import contextmanager import django from django.contrib.auth import BACKEND_SESSION_KEY, get_user_model, load_backend, login from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin from django.db import transaction from django.http import HttpResponseBadRequest, HttpResponseRedir...
import json import numpy as np from sanic import Sanic from sanic import response from geojson import Polygon from shapely import geometry as geo import threading app = Sanic("PopulationDataInquireServer") def fetchPopulationFromFile(lon, lat): global mutex, datafile x = int((lat + 90) * 5) y = int((lon ...
from xml.sax.saxutils import escape, quoteattr def build_tbx_v2_file(term_translations, locale): """ Generates contents of the TBX 2008 (v2) file (TBX-Default dialect): TBX files could contain large amount of entries and it's impossible to render all the data with django templates. Rendering a string...
# Copyright 2009-present MongoDB, 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 to in wr...
"""Helper methods for various modules.""" from __future__ import annotations import asyncio from datetime import datetime, timedelta import enum from functools import wraps import random import re import socket import string import threading from types import MappingProxyType from typing import Any, Callable, Coroutin...
from __future__ import division import gzip try: import cPickle as pickle except: import pickle def save(fname, var_list, source_dict): var_list = [var.strip() for var in var_list.split() if len(var.strip())>0] fo = gzip.GzipFile(fname, 'wb') pickle.dump(var_list, fo) for var in var_list: pickl...
#!/usr/bin/env python #coding: utf-8 import gettext # 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 ...
import os.path as osp from copy import deepcopy from typing import Optional import numpy as np from PIL import Image import torch from torchvision.datasets import CIFAR10, STL10 import cvpods from cvpods.data.base_dataset import BaseDataset from cvpods.data.registry import DATASETS, PATH_ROUTES _PREDEFINED_SPLITS_C...
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import ...
import boto3 import json import os def lambda_handler(event, context): s3 = boto3.resource('s3') bucket_name = event['Records'][0]['s3']['bucket']['name'] file_key = event['Records'][0]['s3']['object']['key'] (request_id, plate_name) = get_panorama_request_and_parse(s3, bucket_name, file_key) send...
#!/usr/bin/env python3 # Copyright (c) 2015-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 RobbieconTestFramework fr...
import PIL import glob from pathlib import Path import os def crop_image_from_thang_to_size(thang, size): lst_imgs = [i for i in glob.glob("img/{}/*.*".format(thang))] # It creates a folder called ltl if does't exist folder = "crp\\{}".format(thang) if not Path(folder).exists(): #if folder not in...
# Copyright (C) GRyCAP - I3M - UPV # # 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...
# Find the divisors! # Create a function named divisors/Divisors that takes an integer n > 1 and returns an array with all of the integer's # divisors(except for 1 and the number itself), from smallest to largest. If the number is prime return the string # '(integer) is prime' (null in C#) (use Either String a in Hask...
# # 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...
# -*- coding: utf-8 -*- import datetime import hashlib import json import os import urlparse import uuid from operator import attrgetter from django.conf import settings from django.core.cache import cache from django.core.exceptions import ObjectDoesNotExist from django.core.files.storage import default_storage as st...
#!/usr/bin/env python # 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 # # Authors: # - Paul Nilsson, paul.nilsson@cern.ch, 2019-2022 from __future_...
from unittest import mock import pytest from airflow.exceptions import AirflowException, TaskDeferred from astronomer.providers.amazon.aws.operators.batch import BatchOperatorAsync from astronomer.providers.amazon.aws.triggers.batch import BatchOperatorTrigger JOB_NAME = "51455483-c62c-48ac-9b88-53a6a725baa3" JOB_ID...
# -*- coding: utf-8 -*- """ Project: My_Test_Project Creator: bytedance Create time: 2021-06-22 10:33 IDE: PyCharm Introduction: """
#!/usr/bin/env python3 # Copyright (c) 2015-2017 The DigiByte Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test BIP66 (DER SIG). Test that the DERSIG soft-fork activates at (regtest) height 1251. """ from te...
# Generated by Django 3.2.7 on 2021-09-06 06:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('projects', '0001_initial'), ] operations = [ migrations.CreateModel( name='Upload', fields=[ ('id', ...
import datetime import numpy as np import time from transformations import rotation_from_matrix import sklearn.metrics as metrics import pickle import os from registration.registration import initializePointCoud, globalRegistration, selectFunction, refine_registration, makeMatchesSet import math # from registration i...
# This Python file uses the following encoding: utf-8 """autogenerated by genpy from cartographer_ros_msgs/StatusCode.msg. Do not edit.""" import codecs import sys python3 = True if sys.hexversion > 0x03000000 else False import genpy import struct class StatusCode(genpy.Message): _md5sum = "90c460dc6da71af1a19af661...
#!/usr/bin/env python3 # coding: utf-8 import os import tempfile import pytest from wellcomeml.io import read_jsonl, write_jsonl from .common import TEST_JSONL @pytest.fixture(scope="module") def temp_file(): temp_file, temp_file_name = tempfile.mkstemp() return temp_file_name def test_read_jsonl(): ...
from typing import List import numpy as np import scipy.linalg def form_L(B312: List[np.ndarray], k: int, verbose: bool) -> np.ndarray: ''' Return L, R3 ''' L = np.empty((k, k)) # step 1: compute R3 that diagonalizes B312[0] L[0], R3 = scipy.linalg.eig(B312[0]) R3 = R3.real # step 2: ob...
import os import pytest @pytest.fixture def expected_content(request): def _expected_content(filename): module_path = request.module.__file__ test_directory = os.path.split(module_path)[0] module_filename_with_extension = os.path.basename(module_path) module_filename = os.path.spl...
import math def encode(msg): msg = _cleanse(msg) sqrsz = int(math.sqrt(len(msg))) if sqrsz * sqrsz < len(msg): sqrsz += 1 cols = [msg[i1::sqrsz] for i1 in range(sqrsz)] cols_str = ''.join(cols) return ' '.join(cols_str[i1:i1 + 5] for i1 in range(0, len(cols_str), 5)) def decode(ciph...
#!/usr/bin/env python # -*- coding: utf-8 -*- from subprocess import check_output from sys import argv, exit def com2asm(comfilename): """Reads a com file and returns a map of label addresses and instructions""" disasm = str(check_output(["ndisasm", "-b", "16", "-p", "intel", comfilename]), encoding="utf-8") ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "48d868493fa74025e7768afacdbbbd3ea9c82468" LLVM_SHA256 = "542019be2fa6734121b3d3b562f10b2e74972c1e99c8d7108ab9b470ded288c4" tf_http_archive( ...
from rack import Rack import time def results(tiles, dd, t, rows): rack = Rack(tiles, dd, t) cutoffs = {0: 15, 1: 10, 2: 7, 3: 0} time_0 = time.time() if rack.num_letters >= cutoffs[min(rack.num_blanks, 3)]: res = rack.frequency_solve() s...
import sys from os.path import dirname, abspath sys.path.append(dirname(dirname(abspath(__file__)))) from SCZ_RNAseq.syn4590909.utils import * from numpy import interp from sklearn.metrics import roc_curve, auc from sklearn.model_selection import StratifiedKFold path="../../data/SCZ_RNAseq/output/syn4590909/" datase...
from __future__ import print_function import sheets import metrics import challenges import upload SHEET_ID = '18VXeazbKykDuyu4RDabgq9y8Ox4lm_UnQqSWC8aMWaw' def main(): """ Note: new metrics should be in the following form: { "name1": {"metric1": 1, "metric2": 134, "metric3": 11} "name2": {"m...
import math import torch from torch.distributions import StudentT from distributions.diagonal_normal_wishart import NormalDiagonalWishart from utils.func_utils import mvdigamma class NormalWishartPrior(NormalDiagonalWishart): r""" A Normal-Wishart prior distribution to emulate ensemble of Gaussians "...
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
#!/usr/local/bin/python3 import datetime import json import os.path import pickle import re from . import config from .employees import Employee from . import cloudability DL_OWNER_CACHE_NAME = 'dl_owners.pickle' def match_type_prefix(prefix): return lambda i: i['nodeType'].startswith(prefix) def match_recomm...
from __future__ import division from __future__ import absolute_import import six __copyright__ = "Copyright (C) 2012 Andreas Kloeckner" __license__ = """ 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 S...
#!/usr/bin/env python import subprocess # returns: tuple (type, error, op, file, line) # #+-------------------------- FPChecker Warning Report --------------------------+ # Error : Underflow # Operation : ADD ...
''' comp_modal_nrjflux.py compute horizontal flux of vertically integrated energy and energy density ; read per chunk, compute every modes at the same time per chunk and store in mode-chunked files (in addition to x-chunked and y-chunked: small files strategy) from comp_modal_nrjflux_chunked.py ; NJAL April 2018 '''...
# TODO: Add stub methods here for diffprivlib models
# --- Input file to test the particle scraper and the Python wrappers # --- to access the buffer of scraped particles. from pywarpx import picmi ########################## # numerics parameters ########################## # --- Number of time steps max_steps = 60 diagnostic_intervals = 20 # --- Grid nx = 64 ny = 64 ...
# Python import unittest from unittest.mock import Mock # ATS from pyats.topology import Device from pyats.topology import loader # Metaparser from genie.metaparser.util.exceptions import SchemaEmptyParserError,\ SchemaMissingKeyError # iosxe show_snmp from genie.libs.pa...
import numpy as np import torch import torch.nn as nn from mmcv.cnn import kaiming_init, normal_init from torch.nn.modules.utils import _pair import torch.nn.functional as F from mmdet.core import force_fp32 from ..builder import build_loss from ..registry import HEADS from ..utils import ConvModule import mmcv @HEA...
#!/usr/bin/env python # -*- coding: UTF-8 -*- # pylint:disable=bad-whitespace # pylint:disable=line-too-long # pylint:disable=too-many-lines # pylint:disable=invalid-name # ######################################################### # # ************** !! WARNING !! *************** # ******* THIS FILE WAS A...
""" byceps.services.shop.order.email.service ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Notification e-mails about shop orders :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ from __future__ import annotations from dataclasses import dataclass from typing import It...
""" Container set for groups and parameters """ class Param(object): allowed_keys = ('CMD_OPTION','USAGE','PROMPT','OPTION_LIST', 'VALIDATION_FUNC','DEFAULT_VALUE','MASK_INPUT','LOOSE_VALIDATION', 'CONF_NAME','USE_DEFAULT','NEED_CONFIRM','CONDITION') def __init__(self, a...
try: import infomap as imp except ModuleNotFoundError: imp = None try: from wurlitzer import pipes except ModuleNotFoundError: pipes = None try: import igraph as ig except ModuleNotFoundError: ig = None try: import leidenalg except ModuleNotFoundError: leidenalg = None try: impor...
from controller import Controller controller = Controller() controller.run_spider(verbose=False, sample=0)
from pathlib import Path import xarray KEY = "imgs" # handle to write inside the output file CLVL = 1 # ZIP compression level def writeframes(outfn: Path, img: xarray.DataArray): """writes image stack to disk""" assert img.ndim == 3 if outfn is None: return outfn = Path(outfn).expanduser(...
import torch """ A fully-connected ReLU network with one hidden layer and no biases, trained to predict y from x by minimizing squared Euclidean distance. This implementation computes the forward pass using operations on PyTorch Tensors, and uses PyTorch autograd to compute gradients. In this implementation we imple...
fname = input('Enter the file name: ') fhand = open(fname) for line in fhand: print(line.upper())
import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, xavier_init import torch import numpy as np from mmdet.ops import NonLocal2D from ..builder import NECKS @NECKS.register_module class FPNRelation(nn.Module): """by weighting bottom-up and top-down process outputs (bottom-up...