text
stringlengths
3.07k
12.6k
# -*- coding: utf-8 -*- import logging import simplejson as jsonlib from requests import Session logger = logging.getLogger(__name__) class CoreAPIError(Exception): pass class CoreAPI: def __init__(self, host, version='v1', timeout=None, password='', auth_token='', zone=None): self.zone = zone ...
""" https://github.com/FrederikSchorr/sign-language Train a pre-trained I3D convolutional network to classify videos """ import os import glob import time import sys import numpy as np import pandas as pd import keras from keras import backend as K from datagenerator import VideoClasses, FramesGenerator from model...
# Make sure that session files can be read in a backward-compatible manner import os import pytest from mock import patch import numpy as np from numpy.testing import assert_equal from glue.core.state import GlueUnSerializer from ..volume.volume_viewer import QMessageBox DATA = os.path.join(os.path.dirname(__file_...
"""Cloudformation module.""" import logging import os import re import sys import yaml from . import RunwayModule, run_module_command from ..util import change_dir LOGGER = logging.getLogger('runway') def ensure_stacker_compat_config(config_filename): """Ensure config file can be loaded by Stacker.""" try:...
import xml.etree.ElementTree as ET import pickle import os from os import listdir, getcwd from os.path import join import tensorlayer as tl import os from PIL import Image from scipy.misc import imread, imsave, imshow, imresize # sets=[('2012', 'train'), ('2012', 'val'), ('2007', 'train'), ('2007', 'val'), ('2007...
# -*- coding: utf-8 -*- # # Copyright (C) 2022 CERN. # # Invenio-Vocabularies is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see LICENSE file for more # details. """Pytest configuration. See https://pytest-invenio.readthedocs.io/ for documentation on which test fixtur...
# mako/ast.py # Copyright 2006-2021 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """utilities for analyzing expressions and blocks of Python code, as well as generating Python from AST no...
import nipype.pipeline.engine as pe import nipype.interfaces.utility as ul import nipype.interfaces.fsl as fsl import nipype.interfaces.afni as afni import phaseprep.interfaces as pp def pickfirst(files): if isinstance(files, list): return files[0] else: return files def calcrelmotion(in_file)...
""" @author: lileilei @file: opearexcel.py @time: 2018/4/4 16:10 """ ''' 写入Excel,导入接口的可以用到 ''' import xlwt from xlwt import * def yangshi1(): style = XFStyle() fnt = Font() fnt.name = u'微软雅黑' fnt.bold = True style.font = fnt alignment = xlwt.Alignment() alignment.horz = xlwt.Alignment.HO...
#!/usr/bin/env python3 import argparse as arp import sys import os.path as osp import os import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt import PIL.Image as Image import PIL.ImageOps from sklearn.gaussian_process.kernels import RBF,Matern from sklearn.gaussian_process import...
# Copyright 2018 Johns Hopkins University (author: <NAME>) # Apache 2.0 import os import torch import numpy as np from skimage.transform import resize from torch.utils.data import Dataset from waldo.data_manipulation import convert_to_combined_image, compress_image_with_mask from waldo.data_transformation impor...
import os import glob import datetime import pytz import pandas as pd import numpy as np import pandas_market_calendars as mcal FILEPATH = '/home/nate/Dropbox/data/zacks/' def load_clean_buy_sell_df(filename): # auto date parse doesn't work df = pd.read_csv(filename, sep='\t')#, parse_dates=['Date Added'], ...
""" Sobol Attribution Method explainer """ from enum import Enum import cv2 import numpy as np import tensorflow as tf from ...types import Callable, Union, Optional, Tuple from ...commons import batch_tensor, repeat_labels from ..base import BlackBoxExplainer, sanitize_input_output from .estimators import SobolEsti...
from json import loads, dumps, load from hmac import new from datetime import datetime from hashlib import sha256 from tabulate import tabulate from urllib.request import urlopen, Request from csv import writer class Config: settings = {} def __init__(self): f = open("settings.json") Config....
""" Model utility functions """ import sys import json import tensorflow as tf import numpy as np from texar import HParams def transform_gpt2_to_texar_config(input_json_path): """ Remap the config file """ config_gpt = json.loads(open(input_json_path).read()) configs = dict() configs["vocab_si...
import os import sys import pytest import operator from ctypes import byref, c_int, c_uint16 import sdl2 from sdl2.stdinc import SDL_TRUE, SDL_FALSE from sdl2 import SDL_Init, SDL_Quit, rwops, version, audio if sys.version_info[0] >= 3: from functools import reduce sdlmixer = pytest.importorskip("sdl2.sdlmixer") ...
"""Defines the configuration for running an instance of Scan""" from __future__ import unicode_literals import logging import os import re from jsonschema import validate from jsonschema.exceptions import ValidationError from ingest.handlers.file_handler import FileHandler from ingest.handlers.file_rule import FileR...
# Copyright (c) 2021 <NAME> # # 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, modify, merge, publish, distribute, ...
""" Utility functions for SMOT: Single-Shot Multi Object Tracking https://arxiv.org/abs/2010.16031 """ import time import logging from contextlib import contextmanager import mxnet as mx import numpy as np def timeit(method): """ The timing decorator to wrap the functions """ def timed(*args, **kw): ...
import argparse import logging import numpy as np import os import sys import torch from models.graph2seq_series_rel import Graph2SeqSeriesRel from models.seq2seq import Seq2Seq from torch.utils.data import DataLoader from utils import parsing from utils.data_utils import canonicalize_smiles, load_vocab, S2SDataset, G2...
# Functions for generating the proposal set for optimization # # <NAME>, <NAME>, <NAME>, <NAME>, # <NAME> and <NAME>. "Unconstrained Salient # Object Detection via Proposal Subset Optimization." # CVPR, 2016. # Code written by <NAME>, 2020 import numpy as np from scipy import cluster import cv2 from tensorflow.keras.a...
import os from argparse import ArgumentParser from pseudo_smart_problem_solver_machine import train_model, visualize_2D_3D_interactive, visualize_error_per_dimension import tensorflow as tf import numpy as np import json print(""" _____ / ____| ...
from __future__ import annotations import dataclasses import io import math from fractions import Fraction from pathlib import Path from django.core import checks from django.core.files.base import ContentFile from django.core.files.storage import Storage from django.db.models import ImageField from django.db.models....
from __future__ import annotations import json import websockets class WSKrakenOutMsg: def __init__(self, payload: str | dict) -> None: self.payload = ( payload if type(payload) is str else json.dumps(payload) ) class WSKrakenInMsg: def __init__(self, payload: str) ->...
# ================================================================= # # Authors: <NAME> <<EMAIL>> # # Copyright (c) 2014 <NAME> # # 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 # res...
""" Copyright 2019 Samsung SDS 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 ...
from queue import Queue from collections import deque, OrderedDict from logging import getLogger from threading import Thread from sqlalchemy.exc import DBAPIError from time import time from random import shuffle from itertools import chain import asyncio from .utils import dump_pickle, load_pickle, get_current_hour,...
# -*- coding: utf-8 -*- """ helpers for controller manual_annot_funcs """ from __future__ import absolute_import, division, print_function, unicode_literals from six.moves import zip, range, filter, map # NOQA import six import utool as ut import uuid from vtool import geometry (print, rrr, profile) = ut.inject2(__nam...
#Reference code: https://github.com/adambielski/siamese-triplet/blob/master/Experiments_MNIST.ipynb import numpy as np import torch import os from datasets import FID300, TripletFID from torchvision import transforms from torch.optim import lr_scheduler import torch.optim as optim from torch.autograd import Variable ...
from django.db import models from ckeditor.fields import RichTextField # Create your models here. class Department(models.Model): name = models.CharField('院系', max_length=30, null=False, unique=True) class Meta: verbose_name = '院系' verbose_name_plural = '院系' def __str__(self): #...
#!/usr/bin/env python """Tests for `magic_dot` package.""" import pytest from collections import namedtuple from magic_dot import MagicDot from magic_dot import NOT_FOUND from magic_dot.exceptions import NotFound def test_can(): """Test that dict key is accessible as a hash .""" md = MagicDot({"num": 1}) ...
# ---------------------------------------------------------------------------- # - Open3D: www.open3d.org - # ---------------------------------------------------------------------------- # The MIT License (MIT) # # Copyright (c) 2018-2021 www.open3d.org # # Permission i...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # logalyzer: # Parses your bloated HTTP access logs to extract the info you want # about hits from (hopefully) real people instead of just the endless # stream of hackers and bots that passes for web traffic # nowadays. Stores the info in a relational database where you c...
# Generic fitting function for flax classifiers. # <EMAIL> # We assume the model has an apply method # that returns the *log probabities* of each class as an N*C array, # where N is the size of the batch. # We assume the dataset iterators return a stream of minibatches # of dicts, with fields # X: (N,D) containing fe...
""" JSONField automatically serializes most Python terms to JSON data. Creates a TEXT field with a default value of "{}". See test_json.py for more information. from django.db import models from django_extensions.db.fields import json class LOL(models.Model): extra = json.JSONField() This field originated f...
import os from typing import List, Tuple, Union import nibabel as nib import numpy as np from deepreg.dataset.loader.interface import FileLoader from deepreg.dataset.util import get_sorted_file_paths_in_dir_with_suffix from deepreg.registry import REGISTRY DATA_FILE_SUFFIX = ["nii.gz", "nii"] def load_nifti_file(f...
from .base import AnnotationNode, AnnotationAttribute, key_for_cypher, AnnotationCollectionNode, \ AnnotationCollectionAttribute class PauseAnnotation(AnnotationNode): def __init__(self, corpus, hierarchy): super(PauseAnnotation, self).__init__('word', corpus, hierarchy) self.subset_labels = [...
from sklearn.model_selection import StratifiedKFold from sklearn.metrics import accuracy_score from sklearn.svm import LinearSVC import numpy as np from numpy import linalg import matplotlib.pyplot as plt from time import time import DataReader as DR def find_anchors_from_class_0(X, y): y_u = np.unique(y) poi...
"""Rules for generating code from Arcs schemas. Rules are re-exported in build_defs.bzl -- use those instead. """ load("//devtools/build_cleaner/skylark:build_defs.bzl", "register_extension_info") load(":kotlin.bzl", "arcs_kt_library", "arcs_kt_plan") load(":manifest.bzl", "arcs_manifest") load(":tools.oss.bzl", "arc...
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
from math import log2 import torch from torch import nn class SRCNN(nn.Sequential): """PyTorch Module for SRCNN https://arxiv.org/pdf/1501.00092.pdf. """ def __init__(self): super(SRCNN, self).__init__( nn.Conv2d(3, 64, 9, padding=4), nn.ReLU(True), nn.Co...
# 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 argparse import collections import pathlib import pickle import numpy as np import models import torch from config import MMCIF_PATH ...
import itertools from typing import Optional, List, Tuple import numpy as np from bandit.context.AbstractContextGenerator import AbstractContextGenerator, Node from bandit.discrete.DiscreteBandit import DiscreteBandit def generate_partition(collection): if len(collection) == 1: yield [collection] ...
# MIT License # # Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2018 # # 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 # r...
import baseObject import config import synthDriverHandler import queueHandler from autoSettingsUtils.driverSetting import BooleanDriverSetting, NumericDriverSetting class SynthSetting(baseObject.AutoPropertyObject): """a numeric synth setting. Has functions to set, get, increase and decrease its value """ def __ini...
""" https://github.com/pytest-dev/pytest """ import ast import inspect import textwrap import tokenize import types import warnings from bisect import bisect_right from typing import Iterable from typing import Iterator from typing import List from typing import Optional from typing import overload from typing import T...
"""Main Flask integration.""" from os import environ from boto3.session import Session from flask import current_app from .errors import ConfigurationError class DynamoLazyTables(object): """Manages access to Dynamo Tables.""" def __init__(self, connection, table_config): self._table_config = table...
""" MIT License Copyright (c) 2019 <NAME> 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, modify, merge, publish, distri...
import requests, os import warnings warnings.filterwarnings("ignore") from lxml import etree import urllib from urllib.request import urlopen import re, time def geturl(classification): global list headers = { 'User-Agent': 'Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/...
# # Copyright 2018 PyWren Team # # 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...
# -*- coding: utf-8 -*- """ Created on Mon Dec 9 16:16:50 2019 @author: lwdnx """ import requests import re import os from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import A4,portrait from PIL import Image from selenium import webdriver import time def getHTMLText(url): try: ...
from datetime import datetime from unittest import TestCase from marshmallow.utils import INCLUDE from ...models.credential import VerifiableCredential from ...models.linked_data_proof import LDProof from ....ld_proofs.constants import ( CREDENTIALS_CONTEXT_V1_URL, VERIFIABLE_CREDENTIAL_TYPE, ) CREDENTIAL = ...
import json import os.path import sys import charliecloud as ch ## Main ## def main(cli): ch.dependencies_check() # Set things up. ref = ch.Image_Ref(cli.image_ref) if (cli.parse_only): ch.INFO(ref.as_verbose_str) sys.exit(0) image = ch.Image(ref, cli.image_dir) ch.INFO("pulling image:...
from sapling.node import Node, traverse_method # cache for all dynamically created tree classes _dynamic_tree_classes = {} def printTree(start_node, vbar='|', level_hbar='|--', level_last_hbar='`--', level_offset=0): def _print(node, level_indent='', next_l...
# MIT License # # Copyright (c) 2018 <NAME> # # 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, modify, merge, publi...
# -*- coding: utf-8 -*- import os import shutil import sys import tempfile import time import unittest from dirq import queue from dirq.queue import Queue, QueueError __all__ = ['TestQueue', 'TestQueueModuleFunctions'] class TestDirQueue(unittest.TestCase): def setUp(self): self.tempdir = tempfile.mkd...
# -*- coding: utf-8 -*- """ This file contains the VCGen algorithm as described in the class. It also implements the weakest preconditions and strongest postcondition strategies, as well as safety verification. See the report for further references. """ from imp_ast import * skip = lambda x: isinstance(x,Skip) ...
# Course: Course ID # Name: XXXXXXXX # Student number: 0000000 # File: MovingBox.py # This program creates a graphical window, displays a message and a square. # After a click, the square starts rolling to the right. When it rolls all # the way to the right, a message is displayed, and after a click, the # program ...
# Copyright (c) 2020, NVIDIA CORPORATION. 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 appli...
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities fro...
# Copyright 2021 CMakePP # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software...
# Copyright © 2019 Province of British Columbia # # 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 agr...
# MIT License # # Copyright (c) 2017- Delve Labs Inc. # # 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, modify, me...
import sys import os import json import numpy as np from multiprocessing import Pool from collections import defaultdict from hepmc import * dir_base = None # allow encoding of numpy arrays via tolist class NumpyEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, np.ndarray): ...
from __future__ import annotations from typing import Sequence from .typing import StyleOptions from .utils import is_oneliner # Codes can be combined, e.g.: # - "3;33": italic yellow # - "3;4;33": italic underlined yellow # # Some terminals support a 256-color extended color set: # - ansi pattern: "\033[38;5;{color...
from django.conf import settings from django.shortcuts import render from django.db.models import Count, Avg, Min, Max, Q from django.http import HttpResponse, JsonResponse, HttpResponseRedirect from django.views.decorators.cache import cache_page from django.views.generic import TemplateView, View from interac...
from torch.autograd import Function import torch import torch.nn as nn import torch.nn.functional as F from magpie import model class Autoencoder(model.MagpieModel, prefix="ae"): def __init__(self, config): super().__init__(config) self.hidden_sizes = config["hidden_sizes"] self.input_si...
from __future__ import print_function from collections import defaultdict from moneywagon import ExchangeUniverse from moneywagon.services import Service def all_balances(currency, services=None, verbose=False, timeout=None): """ Get balances for passed in currency for all exchanges. """ balances = {...
import ROOT import numpy as np from threeML.minimizer.minimization import LocalMinimizer, FitFailed, CannotComputeCovariance from threeML.io.dict_with_pretty_print import DictWithPrettyPrint # These are the status returned by Minuit # status = 1 : Covariance was made pos defined # status = 2 : Hesse is ...
# -*- coding: utf-8 -*- # File name : astyle.py # Author : <NAME> <<EMAIL>> # Created : 11/16/2018 # Python Version : # Requirements : Artistic Style Version 3.1 # Description : Launch astyle on found source files import argparse import os import re import ...
#import datetime import jinja2 import pandas as pd import time import matplotlib.pyplot as plt plt.rcParams['font.sans-serif'] = [u'Songti SC'] plt.rcParams['axes.unicode_minus'] = False from enum import Enum class Phase(Enum): # 项目阶段:技术交流、技术方案、PoC、招投标、合同签署、实施交付、维护、关闭 TECH_COMMUNICATION = '技术交流' TECH_S...
# coding: utf-8 import pathlib import cv2 import numpy as np def load_data(fn='texts.npz', to=False): from keras.utils import to_categorical data = np.load(fn) texts, labels = data['texts'], data['labels'] texts = texts / 255.0 _, h, w = texts.shape texts.shape = (-1, h, w, 1) ...
import json import dateparser import demistomock as demisto import requests from CommonServerPython import * # noqa: E402 lgtm [py/polluting-import] from CommonServerUserPython import * # noqa: E402 lgtm [py/polluting-import] # IMPORTS # Disable insecure warnings requests.packages.urllib3.disable_warnings() # CO...
""" byceps.services.shop.order.email.service ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Notification e-mails about shop orders :Copyright: 2014-2022 <NAME> :License: Revised BSD (see `LICENSE` file for details) """ from __future__ import annotations from dataclasses import dataclass from typing import Iterator from f...
""" Filename: plot_interhemispheric_heat_difference.py Author: <NAME>, <EMAIL> Description: Plot ensemble interhemispheric heat difference timeseries for OHC, hfds and rndt """ # Import general Python modules import sys, os, pdb import argparse import numpy import pandas import iris import matplotlib.pypl...
""" Telegram event handlers """ import sys import logging from typing import Dict import telegram.error from telegram import Bot, Update, BotCommand from telegram.ext import ( Updater, Dispatcher, Filters, CommandHandler, MessageHandler, CallbackQueryHandler, ConversationHandler ) from dtb.celery impo...
""" Set up range of initial data for the reactive Riemann problem and see if the wave pattern changes with tangential velocity. """ from r3d2 import eos_defns, State, RiemannProblem from itertools import combinations import numpy as np def check_wave_pattern(U_l, U_r, vt_side, vts=[-0.9,0.5,0.0,-0.5,0.9]): """ ...
from numpy import * import os import numpy as np from PIL import Image from numpy import random import tensorflow as tf def conv(input, kernel, biases, k_h, k_w, c_o, s_h, s_w, padding="VALID", group=1): c_i = input.get_shape()[-1] assert c_i%group==0 assert c_o%group==0 convolve = lambda i, k: tf.nn....
# Copyright 2021 cstsunfu. 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 law or agr...
import plotly.express as px import plotly.graph_objects as go import dash_core_components as dcc import dash_html_components as html from .workout import WORKOUTS COLORS = {"graph_bg": "#1E1E1E", "text": "#696969"} def layout_config_panel(current_user): """The Dash app layout for the user config panel""" ...
#!/usr/bin/env python # Copyright 2018 LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
# ============================================================================= # Draws two tiles: the top one (using most of the matrix) displays scrolling # text. The bottom one displays the progress of the scrolling text. # # This example relies on an external text drawing library: # https://github.com/adafruit/...
import numpy as np from autograd import jacobian from algorithms import GsGDA class StochHamiltonian(object): def __init__(self, X1, Jv_stoch): self.X = X1.copy() self.X_his = [X1.copy()] self.Jv = Jv_stoch def step(self, gamma): J1, v1 = self.Jv(self.X) J2, v2 = self...
import torch import os import numpy as np import cv2 as cv2 from PIL import Image import numpy as np import matplotlib.pyplot as plt import os import torchvision.datasets as datasets import torchvision.transforms as transforms from settings import PATH_TO_SAVE_TRAIN, PATH_TO_SAVED_MODEL, DS_MACHINE_MODE, OUTPUT_IMAGE_S...
# I found a cool plot of sin(x) with tangent lines plotted at equal intervals: # https://www.reddit.com/r/mathpics/comments/3ki2nh/drawing_thousands_of_tangents/ # This script is for generating a similar plot #!/usr/bin/env python3 import numpy as np import matplotlib.pyplot as plt import time # function params xbeg...
from math import tanh from pysqlite2 import dbapi2 as sqlite def dtanh(y): return 1.0 - y * y class searchnet(object): """docstring for searchnet""" def __init__(self, dbname): self.con = sqlite.connect(dbname, timeout=10) def __del__(self): self.con.close() def maketables(sel...
import ast import cmd import fnmatch from .query_processor import ( EvaluateQueries, queries_preprocess, TractQuerierSyntaxError, TractQuerierLabelNotFound, keywords ) def safe_method(f): """exception handling decorator""" def newfunc(*args, **kwargs): try: return f(*args, **kw...
import functools import os from re import X from flask import Flask, render_template, flash, request, redirect, url_for, session, send_file, current_app, g, make_response import utils from db import get_db, close_db from werkzeug.security import generate_password_hash, check_password_hash from formulario import ...
#!/usr/bin/env python3 # Copyright (c) 2016-2017 Intel Corporation # # 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, cop...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities __...
import json import os import cv2 import numpy as np import tensorflow as tf from pycocotools.coco import COCO from tqdm import tqdm tf.keras.backend.clear_session() from tensorflow.keras.layers import Conv2D, Conv2DTranspose, \ Dense, Reshape, InputLayer, Flatten from alibi_detect.od import OutlierAE from crop_u...
# coding=utf-8 from descriptor_tools.instance_properties import DelegatedProperty __all__ = ['Lazy', 'LateInit', 'ByMap', 'Validating'] no_value = object() class Lazy(DelegatedProperty): """ :Lazy defines a type of :DelegatedProperty that will lazily calculate the value of the attribute. When created,...
from __future__ import print_function from __future__ import absolute_import import numpy as np import cv2 from RRtoolbox.lib.arrayops import overlay, brightness, background, getOtsuThresh, \ process_as_blocks, rescale, getBilateralParameters from RRtoolbox.lib.image import loadFunc from RRtoolbox.lib.plotter impor...
#!/usr/bin/env python3 """Read a training log file and then dump out all rep maxes for all lifts. My training log file is formatted like this: 2021-07-17 low-bar squat 5x290 3x325 0x365 3x345 3x325 3x310 5x290 5x270 20x250 FAIL sumo deadlift 5x165 5x195 (3,5,7,4,6)x230 0x320 RDL (12,12,12)x175 kneeling ab wheel rol...
import json #from lib.jobObj import * import requests import uuid,shutil,os class pathway: """docstring for pathway""" def __init__(self, gene,database,pathway_name,pathway_url,pathway_all_info,pathway_reference_list=[]): self.gene = gene self.database = database self.pathway_name = pathway_name self.pathway...
import tensorflow as tf import numpy as np import lib.utils.kitti_util as kitti_util from lib.utils.box_3d_utils import * from lib.core.config import cfg import lib.utils.anchor_encoder as anchor_encoder ############ Project label_anchors to bev_anchors ############## def project_to_bev(anchors): """ Project...
# @lc app=leetcode id=460 lang=python3 # # [460] LFU Cache # # https://leetcode.com/problems/lfu-cache/description/ # # algorithms # Hard (37.80%) # Likes: 2427 # Dislikes: 168 # Total Accepted: 123.4K # Total Submissions: 326K # Testcase Example: '["LFUCache","put","put","get","put","get","get","put","get","get...
import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import sys from torch.utils.data import DataLoader import argparse import copy sys.path.append("../utils/") import matplotlib.pyplot as plt import numpy as np from models import * from social_utils import * import yaml parse...
from PIL import Image import numpy import sys import operator import json from collections import namedtuple import os.path import argparse allow_transpose = False class Rect(namedtuple("Rect", "x1 y1 x2 y2")): """A 2D rectangle""" def overlaps(self, other): ax1, ay1, ax2, ay2 = self bx1, by1...