text
stringlengths
3.07k
22.1k
from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, AutoConfig, ) from transformers.optimization import get_linear_schedule_with_warmup import argparse import json import gzip import torch from torch.utils.data import TensorDataset, DataLoader from torch.optim import SGD, AdamW, Ad...
"""Contains common utility functions.""" # 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/LIC...
from itertools import product from django.test.testcases import TestCase from server.models import Figure, Game from .mixins import ChessCaseMixin class TestKing(TestCase, ChessCaseMixin): combo = product(range(3), range(3, 6)) wrong_poses = {*product(range(8), range(8))} - set(combo) def setup_class(sel...
#!/usr/bin/python3 # <NAME> # Demonstrates OpenGL Texture Coordinate Generation # <EMAIL> # # based on Texgen.cpp # OpenGL SuperBible # Program by <NAME>. from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * from PIL import Image import time ESCAPE = b'\033' import sys ...
import time def _clamp(value, limits): lower, upper = limits if value is None: return None elif (upper is not None) and (value > upper): return upper elif (lower is not None) and (value < lower): return lower return value try: scale = 1e9 def _to_s(): ret...
# importing libraries import cv2 import dlib import numpy as np # path for predictor PREDICTOR_PATH = "shape_predictor_68_face_landmarks.dat" predictor = dlib.shape_predictor(PREDICTOR_PATH) face_cascade = cv2.CascadeClassifier('Haarcascades/haarcascade_frontalface_default.xml') detector = dlib.get_frontal_face_detect...
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8 import unittest from mock import Mock, patch from datawinners.project import helper from datawinners.project.models import delete_datasenders_from_project from mangrove.datastore.database import DatabaseManager from mangrove.errors.MangroveException import FormModelDoesNot...
# -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Provides interfaces to various commands provided by diffusion toolkit """ import os import re from ...utils.filemanip import fname_presuffix, split_filename, copyfile from ..base...
from sympy import poly from sympy import Matrix from sympy import Rational import sympy as sy import numpy as np import fractions from copy import deepcopy import math from utils import get_only_poly_equation class ConstantPoly: """ for some reason sympy won't allow constant polynomials so I created this...
from collections import defaultdict import logging import json from typing import DefaultDict, Dict, Generator, List, NamedTuple, Optional, Text, Tuple from rasa.core.featurizers.tracker_featurizers import MaxHistoryTrackerFeaturizer from rasa.shared.core.constants import ( ACTION_LISTEN_NAME, PREVIOUS_ACTION,...
# # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER # # Copyright (c) 2015 Juniper Networks, Inc. # All rights reserved. # # Use is subject to license terms. # # 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...
# coding=utf-8 # Copyright 2021 The Google Research 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 (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
# Debido al aumento en la obesidad en los niños una empresa contra los dulces llamada SInoMelaSeMeLasInvento S.A. quiere poner una ley para que los niños no puedan salir a pedir dulces en Halloween. # Los defensores de los dulces desean demostrarle a la empresa SInoMelaSeMeLasInvento S.A. que los niños no comen tantos ...
from pyvmodule.ast import ASTNode __all__ = ['expr_value_calc_funcs','expr_value_prop_funcs'] def calc_bitwise_xor(expr): x = int(expr.rhs) if x<0:raise ValueError('Bit reduction of infinite width value.') i = 1 while i<=x: x = x^(x>>i) i<<=1 return x&1 def calc_bitwise_and...
import graphene from django.contrib.contenttypes.models import ContentType from django.dispatch import receiver from graphene_django.types import DjangoObjectType from graphql.execution.base import ResolveInfo # graphql_jwt from graphql_jwt.decorators import login_required from rx.subjects import Subject from wagtail....
# # Support for graphs # # Developer(s): <NAME>, https://fursin.net # from . import config from . import comm from . import obj import ck.kernel as ck import json import os import copy meta_template={ "meta": { "scenario": "universal", "scenario_uid": "3bf7371412455a8f", "viz_engine": "ck_beta...
from __future__ import absolute_import, division, print_function, unicode_literals import copy import json import logging from collections import OrderedDict from . import ( fbnet_builder as mbuilder, fbnet_modeldef as modeldef, ) import torch.nn as nn from . import fpn as fpn_module from maskrcnn_benchmark.m...
import os import sys import compound import networkx as nx import json import calculate_penalties import requests from unsaturated_monosaccharides import unsaturated_carb_17 from linear_substructures import type_linear_structures_generic from rings_substructures import find_xylos_rings from find_fragments import find...
# coding=utf-8 # Created by <NAME> on 2016/3/25. # from string import upper import ply.yacc as yacc from nodes import * import lexer # Get the token map. tokens = lexer.tokens precedence = ( ('left', 'OR'), ('left', 'AND'), ('nonassoc', 'LE', 'LE', 'GE', 'GT', 'EQ', 'NE'), # Nonassociative operators ) ...
import os,time,cv2, sys, math import bchlib import tensorflow as tf import argparse import numpy as np import tensorflow.contrib.image from tensorflow.python.saved_model import tag_constants from tensorflow.python.saved_model import signature_constants parser = argparse.ArgumentParser() parser.add_argument('--detector...
import re import sublime from sublime_plugin import EventListener, TextCommand, WindowCommand from ..runtime import enqueue_on_worker from ..git_command import GitCommand from ..ui_mixins.quick_panel import PanelCommandMixin from ..ui_mixins.quick_panel import show_stash_panel from ..ui_mixins.input_panel import show...
""" Author: <NAME> Date: 05/10/2022 """ from functools import partial import argparse import numpy as np import os import torch import datetime import logging from pathlib import Path from dataset.ScanObjectNNDataLoader import ScanObjectNNDataLoader from modules.ptaug_utils import transform_point_cloud, scale_point_...
import os from jinja2 import Template from typing import Dict, Any def get_email_content(role: str, data: str) -> Dict[str, Any]: """Gets email content as per defined role Args: role (str): alpha, beta, contributor data (dict): data to be sent Returns: Dict[str, Any]: [description...
import logging import multiprocessing import os import psutil import re import signal import subprocess import sys from patroni import PATRONI_ENV_PREFIX, KUBERNETES_ENV_PREFIX # avoid spawning the resource tracker process if sys.version_info >= (3, 8): # pragma: no cover import multiprocessing.resource_tracker ...
import warnings import functools import torch from xitorch import LinearOperator from typing import Union, Optional, Tuple, Sequence from xitorch._utils.bcast import get_bcasted_dims from xitorch._utils.tensor import tallqr, to_fortran_order from xitorch.debug.modes import is_debug_enabled from xitorch._utils.e...
from scipy.io import netcdf import numpy as np import numpy.matlib basedir = '/marconi_scratch/userexternal/dstonge0/stella/rad_test/krook/krook1c_alt/' basedir = '/marconi_work/FUA34_MULTEI/stonge0_FUA34/rad_test/2nd_deriv/rho_scan2/r0.001ky/' basedir = '/marconi_work/FUA34_MULTEI/stonge0_FUA34/rad_test/fg_drive/0...
# ##### 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...
# 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 from ... import _utilities, _tables from...
#!/usr/bin/env python3 # -*- Coding: UTF-8 -*- # --------------------------------------------------------------------------- # Open Asset Import Library (ASSIMP) # --------------------------------------------------------------------------- # # Copyright (c) 2006-2018, ASSIMP Development Team # # All rights reserved. #...
def endPoints (skel): ## #Function returns boolen array that contains True values in the coordinates that fit as the endpoint of the fibers. #arguments: #- ‘skel’: array with skeletonized fibers #function returns: #- 'endp': boolen array that contains True values in the coordinate...
import numpy as np import math from numpy.fft import fft, ifft from ModulationPy import QAMModem import matplotlib.pyplot as plt import scipy from scipy import special, interpolate, signal import time tic = time.time() # Configuraçoes iniciais N = 131072 # Numero de subportadoras Mod = 16 ...
""" 提醒系统 这个文件在决定引入 redis 之前写就,所以目前为止是只与SQL数据库相关的 Notification 这个类直接对应用户的提醒界面数据,用户与 Notification 对象是一对多的 UserNotifLastInfo 记录了多个用户最后的时间点,与用户是一对一的 提醒记录不主动写入,只当有必要的时候(例如用户上线后)才进行获取,以节省资源。 而方式就是通过 UserNotifLastInfo 中的数据去查询对应的表,并生成 Notification 记录 """ import time from typing import Dict from peewee import * from playhou...
import csv # to process CSV file import cv2 # to read images and flip them import numpy as np # to generate numpy arrays import random # to generate random numbers in order to filter out some training data def readCSV(filename): """ Process CSV file filename - Name of the CSV file which stores training da...
import numpy as np import cv2 import pdb import math from geometry import * class MapPoint(): def __init__(self, pos, descriptor): pos = np.array(pos).reshape(-1,1) if len(pos) == 3: pos = homogenize_vectors(pos) self.pos = pos # Should be a homogeneous 4x1 column vector self.descriptor = descriptor def...
import io import os import sys from datetime import datetime import matplotlib.pyplot as plt from PIL import Image from github import Github, GithubException import constants import notify_chat import utils ballerina_bot_token = os.environ[constants.ENV_BALLERINA_BOT_TOKEN] README_FILE = "README.md" github = Githu...
import numpy as np from .. import base from river.utils.skmultiflow_utils import check_random_state class LED(base.SyntheticDataset): """ LED stream generator. This data source originates from the CART book [^1]. An implementation in C was donated to the UCI [^2] machine learning repository by <NAME>. ...
# dagparser.py - parser and generator for concise description of DAGs # # Copyright 2010 <NAME> <<EMAIL>> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. import re, string import util from i18n import _ def parsedag(desc): ''...
# coding: utf-8 # Copyright 2009 <NAME> # # 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...
#!/usr/bin/env python # Copyright 2018 Division of Medical Image Computing, German Cancer Research Center (DKFZ). # # 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...
import struct import ctypes import logging import functools import idc import idaapi from idaapi import clr_abits, set_abits, netnode, set_node_info from lighthouse.util import * from lighthouse.util.disassembler import disassembler from lighthouse.util.disassembler.ida_api import map_line2citem, map_line2node, lex_c...
from .exceptions import ConfigurationError, GrammarError, assert_config from .utils import get_regexp_width, Serialize from .parsers.grammar_analysis import GrammarAnalyzer from .lexer import LexerThread, TraditionalLexer, ContextualLexer, Lexer, Token, TerminalDef from .parsers import earley, xearley, cyk from .parser...
""" Helper functions """ from typing import Tuple import numpy as np import pybullet as p import cv2 from scipy import interpolate # https://sashat.me/2017/01/11/list-of-20-simple-distinct-colors/ RGB_COLOR_255 = [(230, 25, 75), # red (60, 180, 75), # green (255, 225, 25), # yellow...
# -*- coding: utf-8 -*- ''' ------------------------------------------------------------------------------------------------- This code accompanies the paper titled "Human injury-based safety decision of automated vehicles" Author: <NAME>, ***, Corresponding author: <NAME> (<EMAIL>) ------------------------------------...
# _____ ______ _____ # / ____/ /\ | ____ | __ \ # | | / \ | |__ | |__) | Caer - Modern Computer Vision # | | / /\ \ | __| | _ / Languages: Python, C, C++ # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer # \_____\/_/ \_ \______ |_| \_\ # Licensed ...
''' Module for loading data from the Pangeo CMIP6n intake catalogue (usng the intake-esm loader) created by NCAR. ''' import functools try: import iris except ModuleNotFoundError: iris = None # ReadTheDocs can't import iris import numpy try: import intake except ModuleNotFoundError: intake = Non...
#!/usr/bin/env python # -*- coding: utf-8 -*- # from bisect import bisect # type K decades from https://srdata.nist.gov/its90/download/type_k.tab DEGREES_C = list(range(-270, 1380, 10)) MILLIVOLTS = [-6.458, -6.441, -6.404, -6.344, -6.262, -6.158, -6.035, -5.891, -5.730, -5.550, -5.354, -5.141, -4.913, -4.66...
""" @author: <NAME> (andreww(at)email(dot)sc(dot)edu) Script used to generate optimization-based whitebox attacks and test them against """ import argparse import numpy as np import pandas as pd import os import time from matplotlib import pyplot as plt import scipy.io from utils.model import load_pool, load_len...
""" Copyright 2020 The OneFlow Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
# # 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...
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ Run GMAP/GSNAP commands. GMAP/GSNAP manual: <http://research-pub.gene.com/gmap/src/README> """ import os.path as op import sys import logging from jcvi.formats.sam import get_prefix from jcvi.apps.base import OptionParser, ActionDispatcher, need_update, sh, \ ...
import graphene from graphene import resolve_only_args, relay from graphene.contrib.django import DjangoNode, DjangoConnectionField from graphql_relay.node.node import from_global_id from graphql.core.type import ( GraphQLArgument, GraphQLString, GraphQLInt, GraphQLFloat, GraphQLBoolean, GraphQL...
import json import logging import mimetypes import os import sys import time from abc import ABC, abstractmethod from typing import Optional import requests import telegram from telegram import ChatAction from telegram.ext import CallbackContext from telegram.ext import Updater, MessageHandler, Filters mimetypes.init...
""" Support for TOON thermostat. Only the rooted version. configuration.yaml climate: - platform: toon_climate name: TOON Thermostat host: <IP_ADDRESS> port: 10080 scan_interval: 10 """ import logging import json import requests import voluptuous as vol from typing import Any, Dict, List, Optional ...
"""Module to test the main napp file.""" from unittest import TestCase from unittest.mock import Mock, patch from kytos.core.events import KytosEvent from tests.integration.helpers import (get_controller_mock, get_interface_mock, get_switch_mock) LINK_DATA = { "active": Fals...
#!/usr/bin/python3 import logging import os import sys from colorsys import hsv_to_rgb import mp2 try: import cPickle as pickle except ImportError: # Python 3.x import pickle import colorlog import numpy as np from PIL import Image logger = logging.getLogger() logger.setLevel(colorlog.colorlog.logging.DEB...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Author: <NAME> from inspect import getmembers from pprint import pprint from ansible.module_utils.basic import AnsibleModule DOCUMENTATION = ''' --- module: bind_cat_zones short_description: Bind Zone Catalogs update description: - Create add new zone to the Zone ...
# -*- coding: utf-8 -*- ''' Debian Package builder system .. versionadded:: Beryllium This system allows for all of the components to build debs safely in chrooted environments. This also provides a function to generate debian repositories This module impliments the pkgbuild interface ''' # import python libs from ...
# --------------------- # Flask App for Slack OAuth flow # --------------------- # pip3 install flask from flask import Flask, request, make_response app = Flask(__name__) app.debug = True import logging import os from uuid import uuid4 from slack_sdk import WebClient client_id = os.environ["SLACK_TEST_CLIENT_ID"] ...
from load_data import LoadData from preprocess_data import PreprocessData from model_data import CNNClassificationModel from sklearn.metrics import accuracy_score from sklearn.utils import shuffle import pandas as pd import time import datetime import sys import numpy as np import torch import argparse import os import...
import gzip import sys import matplotlib.pyplot as plt import numpy as np import numpy.linalg as linalg import rmsd import cheminfo import rdkit.Chem as Chem import rdkit.Chem.AllChem as AllChem def center_of_mass(atoms, coordinates): total_mass = np.sum(atoms) X = coordinates[:,0] Y = coordinates[:,...
import json import argparse from typing import List, Dict import glob import os import pathlib import pdb import subprocess from io import StringIO import torch from spacy.tokenizer import Tokenizer from spacy.lang.en import English import logging from tqdm import tqdm from matplotlib import pyplot as plt impor...
# Copyright 2014 Intel # # 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...
#! /usr/bin/env python # -*- coding: utf-8 -*- """Decode the trained multi-task CTC outputs (TIMIT corpus).""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from os.path import join, abspath import sys import tensorflow as tf import yaml import argparse ...
from dearpygui.core import * from dearpygui.simple import * from dearpygui.demo import show_demo import docker import threading import time import webbrowser import requests import json import os import psycopg2 from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT # noinspection PyUnresolvedReferences from psycop...
# 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. """Forked from https://github.com/pytorch/fairseq/blob/master/examples/truncated_bptt/truncated_bptt_lm_task.py """ import logging import os f...
# A simple script that uses blender to render views of a single object by rotation the camera around it. # Also produces depth map at the same time. # # Example: # blender template.blend --background --python render_blender.py -- --output_folder /tmp /data/shapenet/ShapeNetCore.v2/02958343/1a0bc9ab92c915167ae33d94243...
from django.core.exceptions import ValidationError from django.db import transaction from django.db.models.fields.related import ManyToManyField, ForeignKey from rest_framework import serializers, validators from rest_framework.fields import CharField from django.contrib.auth import get_user_model from . import models...
from __future__ import absolute_import, division, print_function import sys import os import pandas as pd import gzip import datashape from datashape import Option, string from collections import Iterator from into.backends.csv import (CSV, append, convert, resource, csv_to_DataFrame, CSV_to_chunks_of_datafra...
import os import json import torch import numpy as np from torch.utils.data import Dataset import random def uniform_sample(input_feature, sample_len): input_len = input_feature.shape[0] assert sample_len > 0, "WRONG SAMPLE_LEN {}, THIS PARAM MUST BE GREATER THAN 0.".format(sample_len) if sam...
# kytten/frame.py # Copyrighted (C) 2009 by Conrad "Lynx" Wong # Classes which wrap one Widget. # Wrapper: a base class for Widgets which contain one other Widget. # Frame: positions its contained Widget within a graphic, which it stretches # to cover the Widget's area, or the space within which it is c...
""" .. module:: taxi_env :synopsis: Provides gym environment wrappers for the underlying taxi simulator. """ import sys from contextlib import closing from six import StringIO import numpy as np import gym import json from gym import error, spaces, utils from gym.utils import seeding from domains.gym_craft.simulato...
""" Miscellaneous matrix functions """ # **************************************************************************** # Copyright (C) 2008 <NAME> <<EMAIL>> # # Distributed under the terms of the GNU General Public License (GPL) # # This code is distributed in the hope that it will be useful, # but WITHOU...
# -*- coding: utf-8 -*- # File: imagenet_utils.py import cv2 import numpy as np import tqdm import multiprocessing import tensorflow as tf from abc import abstractmethod from tensorpack import ModelDesc from tensorpack.input_source import QueueInput, StagingInput from tensorpack.dataflow import ( imgaug, dataset...
# Lint as: python3 # Copyright 2020 DeepMind Technologies Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
import os from nose.tools import assert_raises, assert_true, assert_equal import numpy as np from numpy.testing import (assert_array_equal, assert_array_almost_equal, assert_array_less) from mne.transforms import apply_trans, rotation, translation, scaling from mne.coreg import (fit_matched...
# This file is part of Buildbot. Buildbot 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, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without eve...
# 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 use ...
# Copyright 2020 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
""" map """ from __future__ import absolute_import, division, print_function, unicode_literals import logging from PySide import QtGui, QtCore from PySide.QtCore import Qt import numpy from mcedit2.command import SimpleRevisionCommand from mcedit2.ui.import_map import Ui_importMapDialog from mcedit2.ui.panels.map i...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. """ Semantic Machines\N{TRADE MARK SIGN} software. Calculates statistical significance for predictions from two experiments. """ import argparse import csv import json from typing import Callable, List, Optional, Tuple import numpy as np impor...
import argparse import logging import sys import matplotlib.pyplot as plt import numpy as np import torch import torchvision import torch.nn.functional as F from torch.utils.tensorboard import SummaryWriter from utils import data import models, utils import pandas as pd from laspy.file import File from pickle import...
# Copyright 2013 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
#!/usr/bin/env python3 r""" This module provides functions which are useful for running plug-ins. """ import sys import os import glob import gen_print as gp import gen_misc as gm # Some help text that is common to more than one program. plug_in_dir_paths_help_text = \ 'This is a colon-separated list of plug-in...
import json import os import sys from random import randint import pygame from pygame import * WIN_WIDTH = 1280 # Ширина создаваемого окна WIN_HEIGHT = 720 # Высота DISPLAY = (WIN_WIDTH, WIN_HEIGHT) # Группируем ширину и высоту в одну переменную BACKGROUND_COLOR = "#000000" def load_image(name, colorkey=None): ...
from collections import deque from instance import * import sys class SchedFile(): def __init__(self, fname: str, sched_time: int, server: int): self.fname = fname self.sched_time = sched_time self.server = server class Solution(): def __init__(self, nservers): self.nservers = nservers self.compSteps = [[...
#!/usr/bin/env python # @Author # <NAME> # <EMAIL> # August 2018 """ Create a HDF5 file for processing by the Set Covering Machine code. """ import argparse import h5py # as h import gc import logging import numpy as np import pandas as pd from progressbar import Bar, Percentage, ProgressBar, Timer import sys fro...
""" Based on the sampler from lenstronomy (https://github.com/sibirrer/lenstronomy) @authors: <NAME>, <NAME>, <NAME> """ from copy import copy from math import floor import math import numpy as np class ParticleSwarmOptimizer(object): """ Optimizer using a swarm of particles :param func: A funct...
""" docstring """ import h5py import lineid_plot import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib.collections import PolyCollection def pseudo_voigt(x_data, amplitude, center, sigma, fraction): """ Function that calculates a pseudo-voigt distribution...
from django.shortcuts import get_object_or_404, redirect, render, render_to_response from extra_views import InlineFormSet, CreateWithInlinesView, ModelFormSetView, UpdateWithInlinesView from django.forms import Textarea, MultipleChoiceField from django.db.models import Q from django.core.urlresolvers import reverse fr...
# -*- coding: utf-8 -*- # MinIO Python Library for Amazon S3 Compatible Cloud Storage, # (C) 2015 MinIO, 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/lic...
# coding: utf-8 # ## 1 Import Pakages # In[2]: import requests,time,os,csv,re,logging from bs4 import BeautifulSoup import numpy as np import traceback from multiprocessing import Pool # ## 2 功能模块 # ### 2.1 `requests` 获取html # In[3]: def get_html(url): try: r=requests.get(url,timeout=16) ...
from __future__ import print_function """ The functions implemented here are standard benchmarks from literature. """ __author__ = '<NAME>, <EMAIL>' from scipy import power, exp, cos, sqrt, rand, sin, floor, dot, ones, sign, randn, prod from scipy.linalg import orth from math import pi from random import shuffle fr...
# selenium from selenium import webdriver from selenium.common.exceptions import WebDriverException from selenium.webdriver import DesiredCapabilities from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.proxy import Proxy, ProxyType from selenium.webdriver.common.keys import Keys from s...
#!/usr/bin/env python3 # Copyright 2019 IBM Corp. # # 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 requir...
from .unittest_tools import unittest from quantlib.time.calendar import ( Following, ModifiedFollowing, ModifiedPreceding, Preceding, holiday_list ) from quantlib.time.calendars.target import TARGET from quantlib.time.calendars.united_kingdom import UnitedKingdom, EXCHANGE from quantlib.time.calendars.united_s...
from collections import namedtuple # we don't have data to evaluate the function, so this just looks up the # minimum possible value the function could return. KNOWN_FUNCS = { 'mz_calculate_path_major_route': 8, 'mz_get_min_zoom_highway_level_gate': 14, 'tz_looks_like_service_area': 13, 'tz_looks_like...
import abc import dataclasses import numpy as np import pytest import torch from falkon.kernels import * from falkon.options import FalkonOptions from falkon.tests.conftest import memory_checker from falkon.tests.naive_kernels import * from falkon.tests.gen_random import gen_random from falkon.utils import decide_cud...
############################################################################## # NATS-Bench: Benchmarking NAS Algorithms for Architecture Topology and Size # ############################################################################## # Copyright (c) <NAME> [GitHub D-X-Y], 2020.08 # #########...
# 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 # distributed under t...