text
stringlengths
6.04k
39.5k
# Copyright (C) 2007-2010 by <NAME> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distrib...
from __future__ import annotations import copy import dataclasses import functools import getpass import json import logging import logging.handlers import os import platform import queue as queue_module import socket import sys import typing import warnings from .utils import get_fully_qualified_domain_name # The s...
import datetime from .core import SimpleField, FieldDescriptor, DatabaseObject, DatabaseObjectField, FieldGroup from .core.enums import DocumentStatus, FieldKind, Language, OnixStyle, OnixStatus, PreviewDisplayMode, PreviewTOCVisible, BookBinding from .core.enums import ProcessingType, DRM, PublicationType from .pric...
#!/usr/bin/python import argparse import collections import copy import os import pexpect from pexpect import popen_spawn import re import signal import shutil from subprocess import check_output import sys import time try: basestring except NameError: basestring = str os.environ['USE_DTLS'] = '0' try: i...
""" Python script to train HRNet + shiftNet for multi frame super resolution (MFSR) Credits: This code is adapted from ElementAI's HighRes-Net: https://github.com/ElementAI/HighRes-net """ import os import gc import json import argparse import datetime from functools import partial from collections import defaultdic...
""" DNN Modules The feed backward will be completed in the batch-wise operation """ import math import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch import Tensor from qtorch.quant import float_quantize from torch.nn import init from .function import * class Conv2d(nn.Modul...
import json import os import re from typing import List import numpy as np import pandas as pd from common import camel_case_to_snake_case, load_institutions, isnumber def convert_initial_to_row(data: dict, rank: int, document_specific=False) -> List: row = [rank, data["name"], data["country"]] if document_...
import os # from sklearn.metrics import log_loss, roc_auc_score import time from librerank.utils import * from librerank.reranker import * from librerank.rl_reranker import * def eval(model, data, l2_reg, batch_size, isrank, metric_scope, _print=False): preds = [] # labels = [] losses = [] data_size...
#!/usr/bin/env python3 # Copyright (c) 2019 <NAME> (@hotenov). Available under the MIT License. """ Python 3.5+ script for parsing the all FREE episodes of Luke's ENGLISH Podcast, available on its archive webpage https://teacherluke.co.uk/archive-of-episodes-1-149/ Prerequisite: Installing of packa...
from flask_login import login_user, current_user, login_required, logout_user from flask import render_template, redirect, request, flash, jsonify from jinja2 import Template, Environment, PackageLoader, select_autoescape from sqlalchemy.sql.expression import func import sqlalchemy.sql import uuid import os from app...
from collections.abc import Callable, Iterable, Mapping from scipy.sparse import csr_matrix, csc_matrix from scipy.sparse.linalg import expm import cupy as cp import math import neuwon.species.voronoi import numba.cuda import numpy as np F = 96485.3321233100184 # Faraday's constant, Coulombs per Mole of electrons R = ...
""" Module for running FaIR """ import logging import multiprocessing from concurrent.futures import ProcessPoolExecutor import numpy as np from scmdata import ScmRun, run_append from ...settings import config from ..utils._parallel_process import _parallel_process from ._compat import fair_scm LOGGER = logging.getL...
import logging import requests from PIL import Image from collections import defaultdict from io import BytesIO from gis_metadata.iso_metadata_parser import IsoParser from gis_metadata.utils import format_xpaths, ParserProperty from parserutils.collections import wrap_value from parserutils.elements import get_remote...
#!/usr/bin/python DOCUMENTATION = ''' --- module: jmsierra.oracle.user short_description: Manage users/schemas in an Oracle database description: - Manage users/schemas in an Oracle database - Can be run locally on the controlmachine or on a remote host version_added: "0.2.0" options: hostname: des...
#!/usr/bin/env python3 '''__main__.py''' # Internal Libraries import os import sys import tempfile # Included Libraries import auto_editor import auto_editor.vanparse as vanparse import auto_editor.utils.func as usefulfunctions from auto_editor.utils.progressbar import ProgressBar from auto_editor.utils.func import ...
""" Copyright (c) 2021, Electric Power Research Institute 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 li...
import os import numpy as np import matplotlib.pyplot as plt import PIL import cv2 import scipy.stats import torch import torch.nn as nn from torch import optim from torch.autograd.variable import Variable import torch.nn.functional as F from skimage.util import montage from time import time import warnings warnings....
#!/usr/bin/env python3 import argparse import glob import json import os import sys import re import traceback import subprocess from typing import Any, Dict, Iterable, List, Optional import colorama import requests import yaml from colorama import Fore, Style UPSTREAM = "https://raw.githubusercontent.com/jedevc/min...
# https://gist.githubusercontent.com/anabranch/48c5c0124ba4e162b2e3/raw/6b1acf8391b15ad3a663beb7e685e6835c964036/tfpdf.py # http://www.cs.duke.edu/courses/spring14/compsci290/assignments/lab02.html from __future__ import division from nltk.tokenize import word_tokenize from scipy.spatial import distance from nltk.stem....
#!/usr/bin/python # convert_rwthasr.py # # 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...
import argparse import os import json import copy import pickle import sys import multiprocessing as mp from pathlib import Path from typing import Dict, List from tqdm import tqdm from collections import defaultdict, Counter import logging logger = logging.getLogger("root") # pylint: disable=invalid-name logger.setL...
import numpy as np import pandas as pd import cvxopt as opt from cvxopt import solvers #, blas from matplotlib import pyplot as plt plt.style.use('seaborn') np.random.seed(9062020) # Cargar y limpiar datos df = pd.read_csv("stocks.csv", sep=",", engine="python") #���Field 1 la columna tiene caracteres extranios df....
import numpy as np import sys, os, json, argparse, glob, itertools, pickle from typing import List from dataclasses import dataclass import matplotlib.pyplot as plt import matplotlib.cm as cm from mpl_toolkits.axes_grid1 import make_axes_locatable from scipy.interpolate import griddata from scipy.interpolate import I...
#!/usr/bin/python ########################################################################## # Copyright (c) 2015, Salesforce.com, Inc. # All rights reserved. # # Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # Redistributions in binary...
import config import classification import config import disassembly import trace import utils memory = config.memory jsr_hooks = {} def add_jsr_hook(addr, hook): assert addr not in jsr_hooks jsr_hooks[addr] = hook def hook_subroutine(addr, name, hook): trace.add_entry(addr, name) add_jsr_hook(addr, ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ requirementz.py Check requirements.txt against installed/latest packages using pip and requirements-parser. Bonus features: Check for duplicate entries Search for entries using regex. Add requirement lines. List requirements or all ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # everything that relates to ProbFuse2006 is in this library. # Enjoy. import os import random import numpy as np from itertools import * import shutil def clean_out_files(output_folder): # make sure tmp/topic_id.txt file are empty before appending, if they exi...
import asyncio import random import typing import discord from .base_day_states import DayState, Challenging, Reporting, Undoable, States, SearchSummary, \ RandomizeSearch, HangSummary, DuelInterface from .errors import VotingNotAllowed, WrongValidVotesNumber, DuplicateVote, WrongVote, DuelDoublePerson, \ Not...
# Copyright 2013-2021 The Salish Sea MEOPAR Contributors # and The University 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...
# -*- coding: utf-8 -*- from enigma import eTimer, getDesktop, gFont, RT_HALIGN_CENTER, RT_VALIGN_CENTER from Components.ActionMap import NumberActionMap from Components.Label import Label from Components.Sources.CanvasSource import CanvasSource from Components.Sources.StaticText import StaticText from Screens.Sc...
import settings from django.db.models import Q from legacy.legacyprojects.models import Project as LegacyProject, Link as LegacyLink, Testimonial as LegacyTestimonial, Need from apps.projects.models import Project, IdeaPhase, FundPhase, ActPhase, ResultsPhase, Link, Testimonial, BudgetLine, PartnerOrganization from .b...
import logging import sys from time import time import numpy as np import itertools as it import csv import torch from torch import nn from torch import optim from torch.utils.data import DataLoader from torch.utils.data.sampler import SubsetRandomSampler from zensols.actioncli import persisted from zensols.dltools imp...
from numpy.core.fromnumeric import take from gi.repository import Gtk, GLib, Gio from matplotlib.backends.backend_gtk3agg import ( FigureCanvasGTK3Agg as FigureCanvas) from matplotlib.figure import Figure import numpy as np import time import threading import serial # from pyfirmata import Arduino, util from steppe...
# _ _ _ _ _ _ _ _ # /\ \ /\ \ _ / /\ /\ \ /\_\/\_\ _ _\ \ /\ \ # / \ \ \ \ \ /_/ / / / \ \ / / / / //\_\/\__ \ \ \ \ # / /\ \ \ \ \ \ \___\/ / /\ \ \ /\ \/ \ \/ / / /_ \...
r"""TELNET negotiation filter This code was adapted from the telnetlib library included with Python 2.7, and is being used under the PSF License agreement included below. All changes to the original telnetlib code are copyright (c) 2019 <NAME>, and licensed under the same terms. =====================================...
# -*- coding: utf-8 -*- """ Created on Wed Apr 28 09:08:29 2021 @author: <NAME> """ from . import multiasset as ma from . import opt_abc as opt import numpy as np import scipy.stats as spst class BsmBasketAsianJu2002(ma.NormBasket): def __init__(self, sigma, cor=None, weight=None, intr=0.0, divr=0.0, is_fwd=Fals...
# This file is part of the Open Data Cube, see https://opendatacube.org for more information # # Copyright (c) 2015-2020 ODC Contributors # SPDX-License-Identifier: Apache-2.0 import math from random import uniform import numpy as np import pytest from affine import Affine from odc.geo import CRS, geom, resyx_, wh_, ...
import numpy as np import pandas as pd from pylab import * import pickle import tensorflow as tf import random import os from sklearn.model_selection import train_test_split import matplotlib.lines as mlines from random import randint from sklearn import preprocessing from sklearn.model_selection import KFol...
import re from collections import defaultdict, Counter from numbers import Number from typing import Optional, List, Dict import numpy as np import torch from allennlp.common import FromParams, Registrable from dataclasses import dataclass, replace from pycocoevalcap.bleu.bleu import Bleu from pycocoevalcap.cider.cid...
# Copyright (c) 2015-2018 by the parties listed in the AUTHORS file. # All rights reserved. Use of this source code is governed by # a BSD-style license that can be found in the LICENSE file. # from memory_profiler import profile from collections import OrderedDict import os from toast_planck.preproc_modules import ...
#!/usr/bin/env python3 from imutils.video import VideoStream import cv2 import argparse import imutils import time import sys import socket import imagezmq from math import acos, pi, cos, asin, sin, sqrt from threading import Thread import robot_controller import asyncio import numpy as np iter_count = 0 dist_1 = 0 ...
import math import os import re import itertools import matplotlib.cbook as cbook import matplotlib.pyplot as plt import numpy as np from matplotlib.backends.backend_pdf import PdfPages from matplotlib.font_manager import FontProperties from scipy import stats plot_markers = ('D', 'o', '^', 's', 'p', 'd', 'h', '8', r...
# copyright 2020 EtlamGit import os import os.path from PIL import Image class Chest: def __init__(self, image_dimension_64): self.scale = image_dimension_64 / 64.0 def scale_it(self, ox, oy, dx, dy): return (int(ox * self.scale), int(oy * self.scale), int(ox * self.scale + dx * self.scale),...
#!/usr/bin/env python3.7 # -*- coding: utf-8 -*- import argparse import asyncio import configparser import os from collections import namedtuple from dataclasses import dataclass, field from datetime import datetime, date, timedelta from typing import List, Tuple, Dict import aiohttp import keyring import pytz @data...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: <NAME> """ from scipy.stats import multivariate_normal, norm import numpy as np #### Generalized Black Scholes Formula def GBlackScholes(CallPutFlag, S, X, T, r, b, v): d_1 = (np.log(S/X) + (b + v**2/2) * T) / (v * T**(1/2)) d_2 = d_1 - v * T**(1/2)...
from __future__ import absolute_import import sublime, sublime_plugin import re, string, os, sys, functools, mmap, pprint, imp, threading from collections import Counter from plistlib import readPlistFromBytes try: from . import vhdl_module from .util import vhdl_util from .util import sublime_util fr...
import re import ast from uni_parser.reserved_names import ReservedNames class XPLANSyntaxError(Exception): pass class StmtError(Exception): pass class ExprError(Exception): pass class CodeBuilder: """ basic code tools """ INDENT_STEP = 4 def __init__(self, indent: int = 0): ...
import time,calendar,os,json,sys,datetime from requests import get from subprocess import Popen,PIPE from math import sqrt,log,exp from scipy.optimize import minimize import numpy as np np.set_printoptions(precision=3,linewidth=120) def datetoday(x): t=time.strptime(x+'UTC','%Y-%m-%d%Z') return calendar.timegm(t)/...
import numpy as np import tensorflow as tf ## TensorFlow helper functions WEIGHT_DECAY_KEY = 'WEIGHT_DECAY' def _relu(x, leakness=0.0, name=None): if leakness > 0.0: name = 'lrelu' if name is None else name return tf.maximum(x, x*leakness, name='lrelu') else: name = 'relu' if name is ...
import numpy as np import os from PIL import Image, ImageDraw from tqdm import tqdm from Detection.AdvancedEAST import cfg from Detection.AdvancedEAST.preprocess import preprocess_single_image,preprocess_no_cfg def point_inside_of_quad(px, py, quad_xy_list, p_min, p_max): if (p_min[0] <= px <= p_max[0]) and (p_min...
# ##### BEGIN GPL LICENSE BLOCK ##### # # 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 2 # of the License, or (at your option) any later version. # # This program is distrib...
# Copyright 2018 the GPflow authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
# 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...
#!/usr/bin/python # vim: set fileencoding=utf-8 : """Extract counts of each Köppen-Geiger/slope/land cover/soil health for each country, for use in Project Drawdown solution models.""" import argparse import math import os.path import pdb import signal import sys import tempfile import osgeo.gdal import osgeo.gdal...
# Import libraries import RPi.GPIO as GPIO import random import ES2EEPROMUtils import os import time # some global variables that need to change as we run the program end_of_game = None # set if the user wins or ends the game # DEFINE THE PINS USED HERE LED_value = [11, 13, 15] #definining the pins of the LED to sho...
#!/usr/bin/env python import datetime import logging import os import re from urllib.parse import urljoin from utils import utils, inspector, admin # https://www.archives.gov/oig/ archive = 2005 # options: # standard since/year options for a year range to fetch from. # # Notes for IG's web team: # - List more tha...
#!/usr/bin/env python from __future__ import absolute_import """Unit tests for M2Crypto.RSA. Copyright (c) 2000 <NAME>. All rights reserved.""" import hashlib import logging import os try: import unittest2 as unittest except ImportError: import unittest from M2Crypto import BIO, RSA, Rand, X509, m2, six fr...
""" Copyright (c) 2018-2020 Intel Corporation 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 wri...
#!/usr/bin/env python import chainer from teras import training from teras.app import App, arg from teras.utils import git, logging from tqdm import tqdm import dataset import eval as eval_module import models import parsers import utils chainer.Variable.__int__ = lambda self: int(self.data) chainer.Variable.__floa...
# Copyright 2021 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
''' Authors: <NAME> Contact: <EMAIL> ''' import logging, time import math import gym from gym import spaces from gym.utils import seeding import numpy as np from py4j.java_gateway import (JavaGateway, GatewayParameters) from subprocess import call, Popen, PIPE import random from py4j.tests.java_gateway_test import ...
import pytest from pytest import approx from barril import units @pytest.fixture def db(): db = units.UnitDatabase.GetSingleton() yield db def testTransmissibility(db): converted = db.Convert("transmissibility", "cp.m3/day/bar", "cp.bbl/day/psi", 1.0) assert approx(converted) == 0.433667315 def t...
import json import logging import os import pytest import threading import time from ocs_ci.framework import config from ocs_ci.ocs import constants, ocp from ocs_ci.ocs.resources import pod from ocs_ci.utility.prometheus import PrometheusAPI from tests import helpers logger = logging.getLogger(__name__) def measu...
# coding=utf-8 # Copyright 2019 The Mesh TensorFlow Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
# Copyright 2018-2021 Streamlit 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...
""" Parsing text file into Experiment instance using strictyaml (github.com/crdoconnor/strictyaml/) The aim here is to make config: * possible to use even for non-programmers * hard to misuse * easy debuggable Hence, the process of parsing config is a bit more complicated than it could be, but it produces more useful...
import sys import numpy from PyQt5.QtWidgets import QApplication, QMessageBox, QSizePolicy from orangewidget import gui from orangewidget.settings import Setting from oasys.widgets import gui as oasysgui, congruence from oasys.widgets.exchange import DataExchangeObject from orangecontrib.xoppy.util.xoppy_xraylib_util ...
""" qgs tensor module ================= This module computes and holds the tensor representing the tendencies of the model's equations. Notes ----- These are computed using the analytical expressions from: * <NAME>., <NAME>. and <NAME>.: *The Modular Arbitrary-Order Ocean-Atmosphere Mode...
# -*- coding: utf-8 -*- """ eve.flaskapp ~~~~~~~~~~~~ This module implements the central WSGI application object as a Flask subclass. :copyright: (c) 2013 by <NAME>. :license: BSD, see LICENSE for more details. """ import eve import sys import os from flask import Flask from werkzeug.routing...
# Lint as: python2, python3 # 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-...
# -*- coding: utf-8 -*- import os import re from .._compat import pjoin from .._globals import IDENTITY, THREAD_LOCAL from .._gae import classobj, gae, ndb, namespace_manager, NDBPolyModel, rdbms from ..objects import Table, Field, Expression, Query from ..helpers.classes import SQLCustomType, SQLALL, \ Reference,...
#!/usr/bin/python3 # -*- coding: utf-8 -*- import re, time, pymongo from utils import load, process_bar as _bar, get_functions as _func from multiprocessing import Process as _mp, Manager from utils.load import _lang, _text import subprocess from threading import Timer from drive.gdrive import GoogleDrive as _gd from ...
import sys, os if '..' not in sys.path: sys.path.append('..') import subprocess import pickle, multiprocessing, copy import pandas as pd import numpy as np from collections import namedtuple, defaultdict import botorch.utils.transforms as transforms import argparse from lib.calibrationFunctions import ( pdict_...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ __author__ = 'AJay' __mtime__ = '2019/4/15 0015' """ # ! /usr/bin/env python # -*- coding: utf-8 -*- import time import threading from datetime import datetime import tkinter as tk import os from db import MongoArticle,MongoUrl,MongoConfig from multiprocessing impor...
## # Copyright (c) 2006-2017 Apple Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
import math import torch import torch.nn as nn import torch.nn.functional as F from .base_model import BaseModel from .resnet_s2d import resnet50 def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, ...
# 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 # distribu...
# -*- coding: utf-8 -*- """ jinja2.ext ~~~~~~~~~~ Jinja extensions allow to add custom tags similar to the way django custom tags work. By default two project extensions exist: an i18n and a cache extension. :copyright: (c) 2017 by the Jinja Team. :license: BSD. """ import re from jinja2...
""" This script reproduces Fig. 1 of Izhikevich (2004). Original implementation references: Izhikevich E.M. (2004) Which Model to Use for Cortical Spiking Neurons? IEEE Transactions on Neural Networks, 15:1063-1070 (special issue on temporal coding) Izhikevich E.M. (2003) Simple Model...
# Developed by BlazinVapin for Redbot. # Inspired by the snail race mini game # STD Library import asyncio import random import os # Discord and Red Utils import discord from discord.ext import commands from __main__ import send_cmd_help from .utils import checks from .utils.dataIO import dataIO anima...
# This is your project's main settings file that can be committed to your # repo. If you need to override a setting locally, use settings_local.py # Django settings file for a project based on the playdoh template. # import * into your settings_local.py import logging import os import socket from django.utils.functio...
# ActivitySim # See full license in LICENSE.txt. from builtins import range import logging import numpy as np import pandas as pd from activitysim.core import logit from activitysim.core import config from activitysim.core import inject from activitysim.core import tracing from activitysim.core import chunk from act...
from abc import ABC from pathlib import Path from collections import defaultdict import random import numpy as np from enum import Enum import torch from torch.utils.data import Dataset, DataLoader import MinkowskiEngine as ME from plyfile import PlyData import lib.transforms as t from lib.dataloader import InfSamp...
# Copyright 2020 The Magenta Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
import numpy as np import cv2 def softmax(x, axis=-1): numerator = np.exp(x - np.max(x, axis=axis, keepdims=True)) return numerator / np.sum(numerator, axis=axis, keepdims=True) def resize(image, width=None, height=None, inter=cv2.INTER_AREA): # initialize the dimensions of the image to be resized and ...
# ws2def.py # Copyright (c) 2012 <NAME> AF_UNSPEC = 0 AF_UNIX = 1 AF_INET = 2 AF_IMPLINK = 3 AF_PUP = 4 AF_CHAOS = 5 AF_NS = 6 AF_IPX = AF_NS AF_ISO = 7 AF_OSI = AF_ISO AF_ECMA = 8 AF_DATAKIT = 9 AF_CCITT = 10 AF_SNA = 11 AF_DECnet = 12 AF_DLI = 13 AF_LAT = 14 AF_HYLINK = 15 AF_APPLETALK = 16 AF_NETBIOS = 17 AF_VOICEV...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function from keras import backend as K from keras import initializers from keras import regularizers, constraints from keras.engine import Layer, InputSpec if K._BACKEND == 'tensorflow': import tensorflow as tf ...
#!/usr/bin/env python # # -*- coding: utf-8 -*- """ __author__ = 'CodeFace' """ import json from PyQt5.QtCore import QRegExp from PyQt5.QtWidgets import (QVBoxLayout, QLabel, QPushButton, QDialog, QGridLayout, QComboBox, QLineEdit, QWidget, QHBoxLayout) from PyQt5.QtGui import QRegExpValida...
# Lint as: python3 # 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 ...
""" Module varn calculates local densities of the 2D system and plots histogram of these local densities. Files are saved according to the active_particles.naming.varN standard. Environment modes ----------------- COMPUTE : bool Compute local densities. DEFAULT: False CHECK : bool Evaluate difference between the p...
"""Re-export of some bazel rules with repository-wide defaults.""" load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") load("@build_bazel_rules_nodejs//:index.bzl", _nodejs_binary = "nodejs_binary", _pkg_npm = "pkg_npm") load("@npm_bazel_jasmine//:index.bzl", _jasmine_node_test = "jasmine_node_test") load("@...
import random BLACK = 0 RED = 1 class NodeRBT(object): def __init__(self, key=None, value=None, color=BLACK): self.key = key self.value = value self.parent = None self.left_child = None self.right_child = None self.color = color self.size_tree...
import os import sqlite3 import time import types from . import common from . import exceptions from . import pushshift from voussoirkit import pathclass from voussoirkit import sqlhelpers from voussoirkit import vlogging log = vlogging.get_logger(__name__) # For backwards compatibility reasons, this list of format...
import os import sys import json from pathlib import Path import warnings import pandas as pd import numpy as np from skimage.io import imsave from skimage import img_as_ubyte import torch from xarray.core.dataset import Dataset from xarray.core.dataarray import DataArray import xarray from typing import Tuple, List im...
#!/usr/bin/env python # # Copyright (c) 2015 10X Genomics, Inc. All rights reserved. # import collections import itertools import json import numpy as np import os import re import sys import tenkit.constants as tk_constants import tenkit.fasta as tk_fasta import tenkit.safe_json as tk_safe_json import tenkit.seq as tk...
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve. # # 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 appl...
# -*- coding: utf-8 -*- import logging import os import pytest from datetime import datetime from datetime import timedelta from dateutil.parser import parse as dt from dateutil.tz import tzutc from unittest import mock from elastalert.util import add_raw_postfix from elastalert.util import build_es_conn_config fro...
import transformers as trans import torch import pytorch_lightning as pl from torch.nn import CrossEntropyLoss, MSELoss from transformers.models.auto.configuration_auto import AutoConfig from transformers import AutoTokenizer from openue.data.utils import get_labels_ner, get_labels_seq, OutputExample from typing import...