text
stringlengths
3.07k
22.1k
import os import time from logging import getLogger from uuid import uuid4 import random import weakref import gc import pytest from easypy.bunch import Bunch from easypy.caching import timecache, PersistentCache, cached_property, locking_cache from easypy.units import DAY from easypy.resilience import resilient _lo...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: <NAME> <<EMAIL>> # Copyright: (c) 2018, <NAME> <<EMAIL>> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = { ...
import distutils import os import platform import sys import tempfile import warnings from distutils import ccompiler from distutils.command.build_ext import build_ext from distutils.errors import CompileError, LinkError from distutils.sysconfig import customize_compiler from os.path import join import setuptools from...
# ============================================================================ # Copyright 2021. # # # Author: <NAME> # Contact: <EMAIL>, <EMAIL> # # # 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 ma...
from django.shortcuts import render, get_object_or_404, redirect from django.http import JsonResponse from django.contrib.auth.decorators import login_required from django.urls import reverse from fayvad.general import * import calendar from datetime import * from .models import * from .forms import * # Position Objec...
import math from rlbot.agents.base_agent import BaseAgent, SimpleControllerState from rlbot.utils.structures.game_data_struct import GameTickPacket from rlbot.utils.structures.quick_chats import QuickChats from random import * import winsound from vectors import Vector2 from vectors import Vector3 from kick_ball impor...
""" Make Twisted use M2Crypto for SSL Copyright (c) 2004-2007 Open Source Applications Foundation. All rights reserved. FIXME THIS HAS NOT BEEN FINISHED. NEITHER PEP484 NOR PORT PYTHON3 HAS BEEN FINISHED. THE FURTHER WORK WILL BE DONE WHEN THE STATUS OF TWISTED IN THE PYTHON 3 (AND ASYNCIO) WORLD WILL BE CLEAR. """ ...
# storing current game state, check valid moves, keep move log import numpy as np class GameState(): def __init__(self): self.dimension = 8 self.board = np.zeros([self.dimension, self.dimension]) # 0 is empty space , -1 is black , 1 is red for i in range(2): for j in ra...
import asyncio import logging import os from pykeybasebot import Bot, Source, chat1 import sqlite3 from json import load as config_loader from terminaltables import AsciiTable from random import choice from uuid import uuid4 with open('config.json','r') as f: config = config_loader(f) cwd = os.path.dirname(os.pat...
""" THIS IS DEPRECATED MODULE. USE grab.proxy MODULE INSTEAD. Module to work with proxy list. Usage: pl = ProxyList('var/proxy.txt', 'socks5') g = Grab() server, userpwd = pl.get_random() g.setup(proxy=server, userpwd=userpwd) Or you can do even simplier: g = Grab() g.setup(proxylist=('var/...
import torch.nn as nn import math import torch.utils.model_zoo as model_zoo import numpy as np import torch from torch.nn.parameter import Parameter from torch.autograd import Variable # resnet_conv1_pre_alpha_0.3 alpha = 0.3 __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152'...
import pytest import tensorflow as tf import numpy as np from scipy.ndimage.measurements import mean as label_mean from skimage.segmentation import relabel_sequential as sk_relabel_sequential from rdcnet.losses.embedding_loss import InstanceEmbeddingLossBase, SpatialInstanceEmbeddingLossBase, InstanceMeanIoUEmbeddingL...
import subprocess import os import argparse from argparse import RawDescriptionHelpFormatter import filecmp import json import binascii # Start of our unit test # -- main() ------------------------------------------------------------------- # # The entry point to this script. # # Note: It is called at the end of this ...
""" Copyright 2016 (c) <NAME> Released under the Apache 2 License """ import json, pdb, re, time import HTMLParser import sqlite3 as sql import requests import gspread from oauth2client.client import SignedJwtAssertionCredentials ### global variables ### hparse = HTMLParser.HTMLParser() ### gather authentication in...
from __future__ import print_function, absolute_import from collections import defaultdict import types as pytypes import weakref from numba import types from numba.typeconv import Conversion, rules from . import templates from .typeof import typeof, Purpose # Initialize declarations from . import ( builtins, cm...
from logging import getLogger from django.conf import settings from django.contrib.auth.models import User from django.contrib.postgres.fields import JSONField from django.core.exceptions import ValidationError from django.core.validators import RegexValidator from django.db import models from django.urls import rever...
#!/usr/bin/env python # # InitializeXMLGuide.py # # This script will parse the Git commits on the current branch and initializes # an XML migration guide document with the apropriate content. from __future__ import print_function import os.path import sys import subprocess import datetime #############...
#written by W.Jabi for ecaade 2021 workshop - to be run on blender/topologic. import bpy from bpy.props import EnumProperty, FloatProperty from sverchok.node_tree import SverchCustomTreeNode from sverchok.data_structure import updateNode, list_match_func, list_match_modes import topologic import time #import sys #sys...
import matplotlib.pyplot as pyplot import numpy as np import pandas as pd import ipywidgets as widgets import techminer.core.dashboard as dash from techminer.core import ( Dashboard, Network, TF_matrix, add_counters_to_axis, corpus_filter, exclude_terms, sort_by_axis, ) from techminer.core....
#!/usr/bin/env python3 import json import os import shutil import signal import tempfile import unittest from unittest import mock from torch.distributed.elastic.multiprocessing.errors import ( ChildFailedError, ProcessFailure, record, ) from torch.distributed.elastic.multiprocessing.errors.error_handler i...
# Copyright The PyTorch Lightning 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 i...
import sys sys.path[0] = sys.path[0][:-len("scripts/")] # hacky way to treat it as root directory import random import torch import torch.nn as nn import torch.nn.functional as F import torchvision as tv from src.neural_blocks import ( SkipConnMLP, FourierEncoder ) from src.utils import ( fat_sigmoid ) from tqdm impor...
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt import json import frappe from frappe.utils.nestedset import get_root_of from erpnext.accounts.doctype.pos_invoice.pos_invoice import get_stock_availability from erpnext.accounts.doctype.po...
#! /usr/bin/env python import os import subprocess import svgwrite import math import shutil ######################################################################################################################## def ensure_requisite_folders(path): folder = os.path.split(path)[0] if len(folder) and not os.pat...
# Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
""" Pulls data from: https://www.divvybikes.com/system-data https://s3.amazonaws.com/divvy-data/tripdata """ from io import BytesIO import os import re import requests from zipfile import ZipFile from typing import List from lxml import html import pandas as pd from .stations_feed import StationsFeed STN_DT_FORM = ...
#!/usr/bin/python3 # Author: Dr. <NAME>, aka DrPlantabyte # Copyright 2021 <NAME> # Permission granted to use and redistribute this code in accordance with the Creative Commons (CC BY 4.0) License: # https://creativecommons.org/licenses/by/4.0/ from subprocess import call, Popen, PIPE, STDOUT import os, sys, re from os...
import csv import datetime import glob import json import os import pickle import sys limit = 1e10 if len(sys.argv) > 1: limit = int(sys.argv[1]) print(f'only generating data for last {limit} days') DAILY_REPORTS_DIR = ( 'inputs/COVID-19/csse_covid_19_data/csse_covid_19_daily_reports' ) NUMCOLS = ('confi...
"""Tests for AmazonRow.""" from datetime import datetime import pytest from tests.testlibraries.instance_resource import InstanceResource from zaimcsvconverter.inputcsvformats.amazon_201911 import ( Amazon201911DiscountRow, Amazon201911PaymentRow, Amazon201911RowData, Amazon201911RowFactory, Amazo...
import os import sys import time import traceback from unittest import TestResult, _TextTestResult from unittest.result import failfast from jinja2 import Template DEFAULT_TEMPLATE = os.path.join(os.path.dirname(__file__), "template", "report_template.html") def load_template(templa...
# Copyright 2013 - Red Hat, 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 writ...
import copy import os import tempfile from unittest import TestCase import numpy as np from transition_sampling.engines.cp2k import CP2KInputsHandler CUR_DIR = os.path.dirname(__file__) TEST_INPUT = os.path.join(CUR_DIR, "test_data/test_cp2k.inp") TEST_OUTPUT = os.path.join(CUR_DIR, "test_data/test_cp2k_warnings.out...
import argparse import itertools import plyvel import struct import sys import time import typing import rlp from eth_utils import toolz from eth.rlp.accounts import Account from eth.rlp.headers import BlockHeader from trie.constants import ( NODE_TYPE_BLANK, NODE_TYPE_BRANCH, NODE_TYPE_EXTENSION, NO...
import os import mock import pytest import yaml import paasta_tools.config_utils as config_utils from paasta_tools.utils import AUTO_SOACONFIG_SUBDIR @pytest.fixture(autouse=True) def mock_subprocess(): with mock.patch( "paasta_tools.config_utils.subprocess", autospec=True ) as mock_subprocess: ...
""" Author: <NAME> This file is dedicated to any external processing modules for spacy documents. There are modules that should be a part of the spacy pipeline, but that cannot be added to the pipeline while following desirable SE principles """ from src.lib.helpers import intersectSpan, getSentences, intersectSpa...
import argparse import copy import json import logging import os import numpy as np import torch import transformers from data import get_data from evaluate import EVAL_FUNC_MAP from model import MODEL_CLASS_MAP from tqdm import tqdm logging.basicConfig( format="%(asctime)s - %(levelname)s - %(name)s - %(messag...
# SPDX-License-Identifier: BSD-3-Clause AND Apache-2.0 # Copyright 2018 Regents of the University of California # 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...
import json import os import smtplib import traceback from email import encoders from email.mime.application import MIMEApplication from email.mime.multipart import MIMEBase, MIMEMultipart from email.mime.text import MIMEText from random import randrange, randint from flask import Blueprint from flask import current_a...
# -*- coding: utf-8 -*- from core.models.database import JobPeewee as JobDataModel from core.models.database import TaskPeewee as TaskDataModel from core.task import Task from datetime import datetime from core.core import Core from core.exception import SelfUpgradeException import urllib from core.log_message import L...
import pygame import pygame.locals import os from random import randrange, random try: pygame.init() print("O modulo pygame foi inicializado com sucesso") except: print("O modulo pygame não foi inicializado com sucesso") altura = 490 largura = 310 relogio = pygame.time.Clock() fundo = pygame.display.set_m...
import json import logging import os import re import sys import time import requests def get_logger(name): log_file = os.getenv('DISKU_LOG_FILE') if log_file: log_handler = logging.FileHandler(log_file) else: log_handler = logging.StreamHandler(sys.stdout) log_handler.setFormatter(lo...
# lconfig parsing and more import os import string from pprint import pformat from collections import OrderedDict from collections.abc import MutableMapping, Mapping from json import dumps, loads import inspect from typing import List, Dict, Iterable, Optional, Callable, Any, Iterator, Union __all__ = ["LConfig", "LCo...
import pygame import random import time # Bricks Size 4x8 -> 32x64 # Player size 4x16 -> 32x128 # Screen set pygame.init() screen_size = (1280, 720) screen = pygame.display.set_mode(screen_size) screen_bg = pygame.image.load("assets/atari_screen.png") screen_bg_pause = pygame.image.load("assets/Start_screen.png") game...
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. # This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Apache License v2.0 # See LICENSE.TXT for details. from ansi...
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # Copyright 2020 Huawei Technologies Co., Ltd # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same ...
import json from datetime import date, timedelta from django import forms from django.contrib.contenttypes.models import ContentType from django.utils.translation import ugettext as _ from django.utils.translation import ugettext_lazy as _lazy from kitsune.products.models import Topic from kitsune.questions.events im...
#!/usr/bin/env python3 # Gantt-chart rendering script # Reads a YAML schedule description, parses it and outputs a chart. # <NAME>, 2015 # <EMAIL> # Public domain, or whatever license you like better. Just don't blame me if # it's terrible. import calendar import yaml import datetime import dateutil.parser def inde...
# November 2021 # simple FPS aim trainer """ TODO optimizations """ from __future__ import annotations from win_info import GetClientPosition import json import neat import pyautogui import pygame as pg from math import sqrt from time import sleep from random import randint from typing import Callab...
import warnings import pygments from pygments.formatters.terminal256 import Terminal256Formatter from qiskit import QuantumRegister from qiskit.circuit import Gate, Instruction from qiskit.circuit.quantumcircuit import QuantumCircuit, HAS_PYGMENTS from qiskit.exceptions import MissingOptionalLibraryError from qiskit.q...
"""Tests for the backend API.""" from uuid import UUID, uuid1 import pytest from httpx import URL from metador.config import conf from metador.dataset import Dataset from metador.orcid import get_auth, init_auth from metador.orcid.mock import MOCK_TOKEN from metador.profile import Profile @pytest.fixture def auth_c...
# <NAME> # Institute for Systems Biology # April 6 2017 # <EMAIL> import sys import numpy as np from copy import copy, deepcopy import multiprocessing as mp from numpy.random import shuffle, random, normal from math import log, sqrt, exp, pi import itertools as it from scipy.stats import gaussian_kde from scipy.stats...
# -*- coding: utf-8 -*- """Base class for all event stream to SPADL converters. A converter should extend the 'EventDataLoader' class to (down)load event stream data and implement 'convert_to_actions' to convert the events to the SPADL format. """ import json from abc import ABC, abstractmethod from typing import Any...
"""Scripts to perform fitting different least square methods to resampled data.""" import numpy as np from regression_analysis.utils import sampling, findStat, stochastic_gradient_descent from sklearn import linear_model from sklearn.model_selection import train_test_split def poly_powers2D(order): """ Determ...
import re from urllib.parse import urlparse, urlencode import validators from validators.utils import ValidationFailure from modules.data import get_models from modules.organizations.utils import get_organization_id_for_email from shared_helpers import config from shared_helpers.encoding import convert_entity_to_dict...
#!/usr/bin/env python3 # ------------------------------------------------------------------------------ # stress test scopez_server # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ # Imports # --------------...
from __future__ import print_function from functools import reduce import json import os import re import tarfile import tempfile import numpy as np np.random.seed(1337) # for reproducibility ''' 300D Model - Train / Test (epochs) =-=-= Batch size = 512 Fixed GloVe - 300D SumRNN + Translate + 3 MLP (1.2 million para...
# encoding: utf-8 # This file is part of CycloneDX Python Lib # # 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 applic...
from math import log10, log import re def do_search(db, q, object_type, limit): """ Search for objects (profiles, tables, topics) matching query q. Return a list, because it's easier to work with than a SQLAlchemy ResultProxy object (notably, the latter does not support indexing). """ if object_t...
import cv2 from PIL import Image import numpy as np import pretty_midi import sys chord_progress = { # Example in C Major '1645': [0, 9, 5, 7], # C Am F G (Folk) '1564': [0, 7, 9, 5], # C G Am F (Pop-Punk Progression) '1563': [0, 7, 9, 4], # C G Am Em (My original song progressive) '6415': [0, -...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** 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...
from __future__ import division from __future__ import print_function from __future__ import absolute_import import os import json import argparse import collections import _pickle as pickle #from tqdm import tqdm from nltk.tokenize.stanford import StanfordTokenizer def process_a(q, phase): counts = {} for r...
from model import create_model nn4_small2_pretrained = create_model() nn4_small2_pretrained.load_weights('weights/nn4.small2.v1.h5') import pickle import time import numpy as np import os.path import warnings warnings.filterwarnings("ignore") class IdentityMetadata(): def __init__(self, base, name, file): #...
# -*- coding: utf-8 -*- import copy import warnings from collections import Mapping, MutableSequence from datetime import datetime from decimal import Decimal import six from simplemodels import PYTHON_VERSION from simplemodels.exceptions import FieldError, FieldRequiredError, ImmutableFieldError, \ ModelNotFound...
from pprint import pprint import operator import itertools from boltons.typeutils import make_sentinel from .core import T, glom, GlomError, format_invocation, bbrepr, UnregisteredTarget, MODE from .grouping import GROUP, target_iter, ACC_TREE, CUR_AGG _MISSING = make_sentinel('_MISSING') try: basestring excep...
import json import typing as _t from .encoding import want_bytes from .exc import BadPayload from .exc import BadSignature from .signer import _make_keys_list from .signer import Signer _t_str_bytes = _t.Union[str, bytes] _t_opt_str_bytes = _t.Optional[_t_str_bytes] _t_kwargs = _t.Dict[str, _t.Any] _t_opt_kwargs = _t...
# -*- coding: utf-8 -*- """ thriftpy.parser ~~~~~~~~~~~~~~~ Thrift parser using ply """ from __future__ import absolute_import import itertools import os import os.path import sys import types from .model import IdentifierValue from .parser import parse from ..thrift import gen_init, TException, TPaylo...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # king_phisher/job.py # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of...
import nltk import pandas as pd import re import sys import os import logging import urllib.request from nltk import tokenize from .configs import * from azureml.logging import get_azureml_logger def download_file_from_blob(filename): logger = logging.getLogger(__name__) # Define the path of the shared fol...
#! /usr/bin/env python # coding=utf-8 #================================================================ # Copyright (C) 2019 * Ltd. All rights reserved. # # Editor : VIM # File name : MonodepthNetwork.py # Author : YunYang1994 # Created date: 2019-11-01 23:57:18 # Description : # #==============...
#!/usr/bin/python3 # Command line args import sys, getopt # XML from lxml import etree as ET # GUI from tkinter import * from tkinter import ttk from tkinter import font from tkinter.filedialog import asksaveasfilename from tkinter import messagebox # Styling style_h1 = {'padx': 15, 'pady': 15, 'sticky' : "w"} style_...
#!/usr/bin/env python3 ''' MLDisasm disassembler model. Based on https://blog.keras.io/a-ten-minute-introduction-to-sequence-to-sequence-learning-in-keras.html ''' import inspect import numpy as np import tensorflow as tf import tensorflow.keras as keras from mldisasm.constants import START_TOKEN, STOP_TOKE...
from Queue import Queue from abc import ABCMeta, abstractmethod from functools import partial from threading import Thread import unittest import os import uuid import sys from bd2k.util.fnmatch import fnmatch try: # Note that subprocess isn't thread-safe so subprocess is actually required. I'm just putting #...
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modif...
""" PaletteCommandBase.py ========================================================= Python module for creating an HTML Palette based command ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2019 by <NAME>. :license: Apache 2.0, see LICENSE for more details. """ import traceback from urllib.pa...
#!/usr/bin/env python3 """Extract information from a .pkp file. usage: pkpextract.py [-h] [--stats STATS] [--outdir OUTDIR] [--write_unzipped] [--nopdf] [--nopython] [inputFiles ...] pkpextract.py filename.pkp generate filename.py and filename.pdf in the directory specified by --outdir, which defaults to ".", unl...
""" Module cpymadtools.correctors ----------------------------- Created on 2021.10.16 :author: <NAME> (<EMAIL>) A module with functions to perform MAD-X correctors-related operations and manipulations with a cpymad.madx.Madx object, mainly for LHC and HLLHC machines. """ from typing import Dict, List, Sequence from ...
# For finer grain control, you can write your own input pipeline using tf.data: tf.data.Dataset.list_files import numpy as np import os import PIL import PIL.Image import tensorflow as tf import pathlib import glob import matplotlib.pyplot as plt class_names = None IMG_height = 180 IMG_width = 180 BATCH_SIZE = 32 ONE...
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY ...
import sys import os import re import argparse import pandas as pd from numpy import nan if sys.version_info[0] < 3: from StringIO import StringIO else: from io import StringIO from modules.parent_parser import PARENT_PARSER from modules.tsv_constants import * from modules.scaffold_constants import * from mo...
from __future__ import division, print_function import yaml import tempfile import os, re import logging import numpy as np import subprocess import time import multiprocessing from .batch import write_slurm_script, get_job_status class KwargDict(dict): def cmd_str(self, skip=["filters"]): if skip is Non...
''' Displays a progress meter and an ETA calculation based upon either a user supplied number (out of a total) or based upon a file and it's size. In the case of a file, the position information is calculated from the tell() method. The ETA is calculated by taking the average of the last 50 ETA calculations so that t...
""" Overfit and underfit --- As always, the code in this example will use the tf.keras API, which you can learn more about in the TensorFlow Keras guide. In both of the previous examples—classifying text and predicting fuel efficiency — we saw that the accuracy of our model on the validation data would peak after train...
from enum import Enum import json import os import time import logging from fotahubclient.json_encode_decode import PascalCaseJSONEncoder, PascalCasedObjectArrayJSONDecoder class ArtifactKind(Enum): operating_system = 'OperatingSystem' application = 'Application' firmware = 'Firmware' def __str__(sel...
# Copyright 2021 Accenture Global Solutions Limited # # 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 ...
1 # !/usr/bin/env python3 # -*- coding: utf-8 -*- import cv2 import os import numpy as np import dlib import sklearn.decomposition import pickle import mappings import copy # Emotion tags in ascending order emotions = ['neutral', 'anger', 'contempt', 'disgust', 'fear', 'happiness', 'sadness', 'surprise'] ...
""" Create time-bounded SQL queries for interval calculations like availability. """ import os import mds import pandas def parse_db_env(): """ Gets the database configuration out of the Environment. Fails if any values are missing. Returns dict { user, password, db, host, port } """ try: ...
import numpy as np import numpy.linalg as la import cv2 from os import makedirs from os.path import join, isdir, isfile from pak.util.download import download from pak.util.unzip import unzip from math import ceil, floor from mvpose.geometry.camera import AffineCamera from mvpose.algorithm.candidate_selection import pr...
import math from hexagon import * import numpy as np import random class Move: def __init__(self, fromCell, toCell, resources): """ :type fromCell: CellId :type toCell: CellId :type resources: int """ self.fromCell = fromCell self.toCell = toCell self.resources = resources class Pl...
import sys, os curr_path = os.getcwd() if os.path.basename(curr_path) not in sys.path: sys.path.append(os.path.dirname(os.getcwd())) from time import sleep from threading import Lock import numpy as np from scipy.spatial.transform import Rotation from carla_msgs.msg import CarlaStatus from sensor_msgs.msg import ...
import unittest from .. import TEST_DTYPES from pytorch_metric_learning.utils import accuracy_calculator import numpy as np class TestCalculateAccuracies(unittest.TestCase): def test_accuracy_calculator(self): query_labels = np.array([1, 1, 2, 3, 4]) knn_labels1 = np.array([[0, 1, 1, 2...
import os import numpy as np import torch import torchvision from torch.utils.data import random_split from URSABench import util from URSABench.util import DatasetFromSubset c10_classes = np.array([ [0, 1, 2, 8, 9], [3, 4, 5, 6, 7] ], dtype=np.int32) def camvid_loaders(path, batch_size, num_workers, trans...
import torch import torch.nn as nn import numpy as np def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class BasicBlock(nn.Module): expansion = 1 def __ini...
import os import time from datetime import datetime import math import glob import gym import tensorflow as tf import numpy as np import config as c import deepdrive from gym_deepdrive.envs.deepdrive_gym_env import Action from tensorflow_agent.net import Net from utils import save_hdf5, download import logs log = lo...
try: from StringIO import StringIO as BytesIO except ImportError: from io import BytesIO import gc import hashlib import json import mimetypes import os import re import time try: from urllib import quote as urllib_quote except ImportError: # python3 from urllib.parse import quote as urllib_quote ...
# 학습용 import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow import keras # 전적 검색용 import requests from urllib import parse # 기타 import sys # 전역변수 ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ """ TOTAL_MATCH_COUNT = 가져올 총 전적의 개수 DEVELOPMENTAPIKEY = 롤 API에...
from __future__ import unicode_literals import functools import inspect from collections import defaultdict from django.contrib.contenttypes import fields as ct_fields from django.contrib.contenttypes import models as ct_models from django.db import models from django.db.models import Sum from django.utils import six...
#!/usr/bin/python import tkinter as tk from math import pi as π, sqrt, degrees, radians, sin, cos, tan, log10 as Log def SIN(x): return eval(f'{sin(radians(x)):.3f}') def COS(x): return eval(f'{cos(radians(x)):.3f}') def TAN(x): return eval(f'{tan(radians(x)):.3f}') '''add degre/radian radial button...
""" denclue.py @author: mgarrett """ import numpy as np from sklearn.base import BaseEstimator, ClusterMixin import networkx as nx def _hill_climb(x_t, X, W=None, h=0.1, eps=1e-7): """ This function climbs the 'hill' of the kernel density function and finds the 'peak', which represents the density attract...
""" slowMotionVideo.py This demonstrates how to create videos using the Pixelink API. Specifically, this applocation will create videos that play back normal motion, to slow motion. This application showcases how to use: - PxLApi.getEncodedClip - PxLApi.formatClip NOTE: This application assumes t...
# Copyright 2013-2017 Lionheart Software 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...