text
stringlengths
3.07k
12.6k
# !/user/bin/env python # -*- coding:utf-8 -*- import sys import requests import time import ssl from urllib import parse import urllib3 urllib3.disable_warnings() ssl._create_default_https_context = ssl._create_unverified_context req = requests.Session() class leftQuery(object): def __init__(self): self....
from django.http.response import HttpResponseRedirect from django.shortcuts import get_object_or_404, redirect, render from django.contrib.auth.decorators import login_required from .models import * from hoodapp.forms import * from hoodapp.models import Profile def index(request): hood = NeighborHood.objects.al...
import numpy as np from scipy.optimize import minimize from os import path import matplotlib.pyplot as plt import sys from MCPM import utils from MCPM.cpmfitsource import CpmFitSource def fun_3(inputs, cpm_source, t_E): """3-parameter function for optimisation; t_E - fixed""" t_0 = inputs[0] u_0 = in...
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt """Tests for coverage.numbits""" import json import sqlite3 from hypothesis import example, given, settings from hypothesis.strategies import sets, integers from...
#!/usr/bin/env python3 import itertools import os import sys import tempfile import tokenize from typing import IO, Iterable, List, NamedTuple, Optional, Tuple, cast import black __version__ = "1.3.0" SINGLE_INDENT = " " * 4 class WrapInfo(NamedTuple): """Describes the changes made when wrapping text.""" ...
from __future__ import print_function import itertools import numpy as np import numba.unittest_support as unittest from numba import types, jit, typeof from .support import MemoryLeakMixin, TestCase, tag def getitem_usecase(a, b): return a[b] def setitem_usecase(a, idx, b): a[idx] = b class TestFancyIn...
import h5py as h5 import feather import pandas as pd import numpy as np import os correlation_files = os.listdir("correlation_folder") for i in range(0, len(correlation_files)): print(i) correlation = pd.read_feather("correlation_folder/"+correlation_files[i]) f = h5.File("h5/"+correlation_files[i].replac...
from __future__ import unicode_literals import datetime from dateutil.parser import parse from django.utils.six import string_types from django.utils.timezone import pytz def now_by_tz(tz='US/Central', ignoretz=True): """Gets the current datetime object by timezone. :param tz: is the timezone to get the da...
import torch import torch.nn.functional as F def compas_robustness_loss(x, aggregates, concepts, relevances): """Computes Robustness Loss for the Compas data Formulated by Alvarez-Melis & Jaakkola (2018) [https://papers.nips.cc/paper/8003-towards-robust-interpretability-with-self-explaining-neural-ne...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from math import ceil from typing import Optional, Tuple, Type, cast from ax.core.parameter import Choi...
import re import pytest import responses from quickbuild import QBError DASHBOARDS_XML = r"""<?xml version="1.0" encoding="UTF-8"?> <list> <com.pmease.quickbuild.model.Dashboard> <id>1</id> <user>1</user> <name>Default</name> <description>System default dashboard</description> <primary>false</...
import sys from PIL import Image import argparse import os import numpy as np import torch import cv2 torch.set_printoptions(sci_mode=False, precision=4) np.set_printoptions(suppress=True, precision=4) def save_matrix(filename, mat, print_stats=False): import matplotlib.pyplot as plt # corr = F.avg_pool2d(co...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 30 16:23:35 2020 @author: elizabeth_mckenzie """ import numpy as np from scipy.ndimage.interpolation import rotate as ndrotate import tensorflow as tf from skimage.transform import resize import matplotlib.pyplot as plt order = 0 # input_shape = (...
#!/usr/bin/env python # coding: utf-8 from __future__ import print_function, unicode_literals, with_statement import argparse import contextlib import requests import sys import csv import matplotlib # Anti-Grain Geometry (AGG) backend so PyGeoIpMap can be used 'headless' matplotlib.use('Agg') import matplotlib.pyplot...
import copy import logging import dask import numpy as np import xarray as xr from numcodecs.compat import ensure_ndarray from xarray.backends.zarr import ( DIMENSION_KEY, encode_zarr_attr_value, encode_zarr_variable, extract_zarr_variable_encoding, ) from zarr.meta import encode_fill_value from zarr.s...
# # SPDX-License-Identifier: MIT # import os from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import get_bb_var, get_bb_vars, bitbake class ManifestEntry: '''A manifest item of a collection able to list missing packages''' def __init__(self, entry): self.file = entry ...
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
import numpy as np import torch import torch.nn as nn from rlpyt.utils.tensor import infer_leading_dims, restore_leading_dims from rlpyt.models.mlp import MlpModel from rlpyt.models.conv2d import Conv2dModel import torch.nn.functional as F def init(module, weight_init, bias_init, gain=1): weight_init(module.weig...
# -*- coding: utf-8 -*- # # Copyright 2018 Amazon.com, Inc. or its affiliates. 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. # A copy of the License is located at # # http://aws.amazon.com/apache2.0/ # # or i...
import os import requests import subprocess from ruamel.yaml import YAML from .base import Migrator YAML = YAML() def _get_num_builds(appveyor_name): HEADERS = {"Authorization": "Bearer " + os.environ['APPVEYOR_TOKEN']} r = requests.get( "https://ci.appveyor.com/api/projects/conda-forge/" ...
import itertools import numpy as np import torch from ..math import complex_mult, conj_complex_mult def get_interpob(model): """Retrieves the interpolation dictionary from model. Different nufft objects use different interpolation objects. This function only extracts the minimum amount necessary for sp...
# Modifications Copyright 2016-2017 Reddit, Inc. # # Copyright 2013-2016 DataStax, 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 # # Unle...
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import copy import numpy as np import torch from lottery.branch import base import models.registry from pruning.mask import Mask from...
import os import fnmatch import re import glob __author__ = "<NAME>" __license__ = "MIT" __email__ = "<EMAIL>" class Project: """ This classes is used to mine a cloned repository and extract matches between tests and classes under test """ def __init__(self, project, include_pattern, exclude_pa...
""" ckwg +31 Copyright 2017 by Kitware, Inc. 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 list of conditions and the ...
import numpy as np import theano.tensor as tt from . import Hypers, ones from ...libs.tensors import tt_to_num class Metric(Hypers): def __call__(self, x1, x2): return tt.abs_(x1 - x2) def gram(self, x1, x2): #try: return (self(x1[:, self.dims].dimshuffle([0, 'x', 1]), x2[:, self.dims...
import torch import torch.nn as nn import numpy as np import random from torch import optim from rl_network import * class Agent: """ 학습 에이전트 네트워크 모델을 받고, 학습을 수행함 """ def __init__(self, num_states, num_actions, network_type, learning_rate, use_rnn=False, gamma=0.99, capa...
""" Union and Intersection of Two Linked Lists Your task for this problem is to fill out the union and intersection functions. The union of two sets A and B is the set of elements which are in A, in B, or in both A and B. The intersection of two sets A and B, denoted by A ∩ B, is the set of all objects that are members...
# The dataset code has been adapted from: # https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html # from https://github.com/pytorch/tutorials # which has been distributed under the following license: ################################################################################ # BSD 3-Clause License #...
""" Requires python 2.7 and torch==0.3.1 and pycaffe (CPU is sufficient). """ from collections import OrderedDict import caffe import torch import torch.nn as nn from torch.autograd import Variable from torchvision import models from resnet_caffe import ResNetCaffe, convert_batchnorm, load_resnet50 from utils import ...
import os import shutil import pathlib import stat def mkdir_p(path, exist_ok=True): """ Creates the directory and paths leading up to it like unix mkdir -p . Defaults to exist_ok so if it exists were not throwing fatal errors https://docs.python.org/3.7/library/os.html#os.makedirs """ if not ...
import os import random import libvirt from lxml import etree from twisted.python import log import util import domains def handler(ctxt, err): global errno errno = err libvirt.registerErrorHandler(handler, 'pllm') # taken from virtinst/_util.py (python-virtinst), GPLv2+ def fetch_all_guests(conn): "...
# -*- coding: UTF-8 -*- """ @author: auhjin @file:views.py @time:2021/06/17 """ import json import random import re from datetime import datetime from flask import request, current_app, make_response, jsonify, session from info import redis_store, constants, db from info.constants import IMAGE_CODE_REDIS_EXPIRES # fro...
from misc import dp, bot from features.mainFunctions import getCurrentTime from resources.links import foxLogoPreview from aiogram.types import \ InlineQuery, inline_keyboard, \ InlineQueryResultArticle, ChosenInlineResult, \ InputTextMessageContent, Cal...
import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks.early_stopping import EarlyStopping from sklearn.model_selection import train_test_split from torch import nn from torch.nn import functional as F from transformers import BertTokenizer, BertConfig, BertModel class BertTex...
import pandas as pd import requests import re import os from yaml import safe_load, dump from bs4 import BeautifulSoup as bs import random import numpy as np def get_mapping_dicts(path_to_yaml, url): """ Loads dictionaries for the gap filling and mapping of column names from locally stored .yaml files. Re...
#!/usr/bin/env python # -*- coding: utf-8 -*- # 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 Licens...
#-*- coding:utf-8 -*- import torch from torchvision import transforms import cv2 from PIL import Image, ImageOps import numpy as np import pickle from torchvision.datasets import VisionDataset from torchvision.datasets.folder import default_loader,make_dataset,IMG_EXTENSIONS from pycocotools.coco import COCO import os ...
#!/usr/bin/env python3 # coding=utf-8 import sys import os import json from urllib.parse import urlencode from urllib.request import urlopen, Request, URLError, HTTPError from argparse import ArgumentParser BASE_URL = "https://api.nature.global" BASE_PATH = os.path.dirname(os.path.abspath(__file__)) TOKE...
import ctypes import ipaddress import io class SpopDataTypes: NULL = 0 BOOL = 1 INT32 = 2 UINT32 = 3 INT64 = 4 UINT64 = 5 IPV4 = 6 IPV6 = 7 STRING = 8 BINARY = 9 SINGLE_BYTE_MAX = 0xF0 MIDDLE_BYTE_MASK = 0x80 TERMINAL_BYTE_MASK = 0x00 def __is_middle_byte(byte: int) -> boo...
import os import subprocess import uuid import pytest from traitlets.config import Config from dask_gateway import Gateway from dask_gateway.auth import BasicAuth, JupyterHubAuth from dask_gateway_server.utils import random_port from .utils import temp_gateway try: import kerberos del kerberos skip = n...
import torch import torch.nn as nn import torch.nn.functional as F import logging from typing import Iterator import time import json from seq2seq.helpers import sequence_accuracy from seq2seq.ReaSCAN_dataset import ReaSCANDataset import pdb device = torch.device("cuda" if torch.cuda.is_available() else "cpu") logger ...
# ##### 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...
#!/usr/bin/python # Copyright: (c) 2017, Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'metadata_version': '1.1'} DOCUMENTATION = ''' --- modul...
import wave import struct # Morse unit time in samples (assuming 48000hz sample rate in input file) # 0.10s: 4800 (Slowest, most reliable) # 0.05s: 2400 (Default - Best for NFM transmission) # 0.02s: 960 # 0.01s: 480 (Fastest, least reliable) UNIT_TIME = 2400 # Value at which an amplitude is considered ON or OFF. (10...
""" Terminology original_view: the view in the regular editor, without it's own window markdown_view: the markdown view, in the special window preview_view: the preview view, in the special window original_window: the regular window preview_window: the window with the markdown file and the preview """ import time impo...
import plotly.graph_objects as go from pcutils.kitti_util import compute_box_3d from PIL import Image import numpy as np ptc_layout_config={ 'title': { 'text': 'test vis LiDAR', 'font': { 'size': 20, 'color': 'rgb(150,150,150)', }, 'xanchor': 'left', ...
import torch import torch.nn as nn from .base import KGLossBase class SigmoidLoss(nn.Module): r""" Pairwise loss function. :math:`x_p` is the predition score of positive examples, and :math:`x_n` is the predition score of negative examples. .. math:: \text{loss}(x_p, x_n) = -{\sum_i log \frac...
# 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...
import torch import numpy as np from core import predict def sigmoid_threshold(tensor, threshold=0.5): """Applies the sigmoid function to the tensor and thresholds the values out_tensor = sigmoid(tensor) > threshold Arguments: tensor (torch.Tensor): the tensor to threshold. threshold (sc...
#!/usr/bin/env python3 """ Test """ from __future__ import print_function import sys import random import logging import time # external modules from colorama import Fore, Style, init from pyVmomi import vim, vmodl # custom modules from cephops import CephOps from config import Config from utils import _setup_logging, ...
from dragonfly import Function, Repeat, Dictation, Choice, MappingRule from castervoice.lib.actions import Key, Text from castervoice.lib.ctrl.mgr.rule_details import RuleDetails from castervoice.lib.merge.additions import IntegerRefST from castervoice.lib.merge.state.short import R def capitalize(text): output ...
# -*- coding:utf-8 -*- import pytest # node-semver/test/index.js cands = [ ['1.2.3', 'v1.2.3', True], ['1.2.3', '=1.2.3', True], ['1.2.3', 'v 1.2.3', True], ['1.2.3', '= 1.2.3', True], ['1.2.3', ' v1.2.3', True], ['1.2.3', ' =1.2.3', True], ['1.2.3', ' v 1.2.3', True], ['1.2.3', ' = 1.2...
import copy from .gotypes import Player class Move(): def __init__(self, point=None, is_pass=False, is_resign=False): assert (point is not None) ^ is_pass ^ is_resign self.point = point self.is_play = (self.point is not None) self.is_pass = is_pass self.is_resign = is_resign...
import os import imageio import numpy as np import torch from scipy.spatial.distance import pdist from src.parser.visualize import parser from src.utils.bvh_export import save_generated_motion from src.utils.get_model_and_data import get_model_and_data from src.visualize.anim import plot_3d_motion class VisualizeLa...
# Copyright 2020 Huawei Technologies Co., Ltd # # 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...
#!/usr/bin/python from __future__ import print_function from bcc import BPF from bcc.containers import filter_by_containers from bcc.utils import ArgString, printb import bcc.utils as utils import argparse import re import time import pwd from collections import defaultdict from time import strftime def parse_uid(use...
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import torch import torch.nn as nn import torch.nn.functional as F from crlapi.core import CLModel from crlapi.sl.clmodel...
# Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
"""Arithmetic Coding Functions for doing compression using arithmetic coding. http://en.wikipedia.org/wiki/Arithmetic_coding The functions and classes all need predictive models; see model.py """ import math import itertools from seq_predict import CTW def grouper(n, iterable, fillvalue=None): args = [iter(ite...
import discord import os from discord.ext import commands import requests from requests.api import get import pycountry import datetime from datetime import date import json import newsapi from newsapi import NewsApiClient # covid = Covid() list_cont = [] class News(commands.Cog): def __init__(self,client): ...
"""Forward and back projector for PET data reconstruction""" __author__ = "<NAME>" __copyright__ = "Copyright 2018" #------------------------------------------------------------------------------ import numpy as np import sys import os import logging import petprj from niftypet.nipet.img import mmrimg from nif...
from functools import partial from django.db import models from model_utils.managers import InheritanceManager from coberturas_medicas.models import Cobertura from core.models import Persona, Profesional from dj_utils.mixins import ShowInfoMixin from dj_utils.models import BaseModel, uploadTenantFilename class Pac...
"""Linkedlist implementation.""" class Node(object): """Node class.""" def __init__(self, initdata=None): """Initialization.""" self.data = initdata self.next = None def getData(self): """Get node's data.""" return self.data def setData(self, data): "...
from typing import Union from collections import deque import json from src.blueprints._common.utils import ( convert_iso_datetime, bytes_to_human_decimal ) from src.blueprints.telegram_bot._common.telegram_interface import ( Message as TelegramMessage ) from src.blueprints.telegram_bot.webhook.dispatcher_...
from utility import * import subprocess import sys import os import threading import time ssh_privkey_file = os.getenv("SSH_PRIVKEY_FILE", "daala.pem") binaries = { 'daala':['examples/encoder_example','examples/dump_video'], 'x264': ['x264'], 'x264-rt': ['x264'], 'x265': ['build/linux/x265'], 'x26...
"""Module for interacting with the Comet Observations Database (COBS).""" from io import StringIO import re from pathlib import Path from appdirs import user_cache_dir from astropy.time import Time import mechanize import numpy as np import pandas as pd from . import PACKAGEDIR, log # Where to store COBS data? CACH...
# Copyright (c) 2014-present PlatformIO <<EMAIL>> # # 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 ag...
# ---------------------------------------------------------------------------- # Copyright 2016 Nervana Systems 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.o...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ############################################################################## # # # GhIDA: Ghidra decompiler for IDA Pro # # ...
import numpy as np from scipy.spatial import distance from Quaternions import Quaternions import Animation import AnimationStructure def constrain(positions, constraints): """ Constrain animation positions given a number of VerletParticles constrains Parameters ---------- ...
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, <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 = {'metadata_version': '1.1', ...
import os from glob import glob import time import json from PIL import Image import pandas as pd import numpy as np import torchvision as tv from rsp.data import bilinear_upsample, BANDS from tifffile import imread as tiffread from d3m.container import DataFrame as d3m_DataFrame from d3m.metadata import base as metad...
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( int_or_none, ) class ZingMp3BaseIE(InfoExtractor): _VALID_URL_TMPL = r'https?://(?:mp3\.zing|zingmp3)\.vn/(?:%s)/[^/]+/(?P<id>\w+)\.html' _GEO_COUNTRIES = ['VN'] def _extract_item(self, it...
import os import math import mantle as mantle import magma as m def run_cmd(cmd): res = os.system(cmd) assert(res == 0) def power_log(x): return 2**(math.ceil(math.log(x, 2))) def equals_cmp(a, b, width): eqC = mantle.EQ(width) m.wire(eqC.I0, a) m.wire(eqC.I1, b) ...
"ICECREAM" import bottle from distutils.util import strtobool from sqlalchemy.orm import Session from ICECREAM.file_handler import upload from ICECREAM.paginator import Paginate from ICECREAM.validators import validate_data from app_user.messages import ACTIVATED_MSG, DEACTIVATED_MSG, DELETE_IMG, PASSWORD_CHANGED, OLD_...
import scipy as sp import scipy.linalg as la ''' The Newton's lab in applications needed an overloaded newtons method function When I found that python didn't have function overloading, this is what I came up with. I don't really like it though ''' def newtonsMethod( *args): f = None df = None x0 = None tol = Non...
# Copyright (c) 2017, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. from mixbox import entities, fields, idgen from cybox import Unicode import cybox.bindings.cybox_core as core_binding from cybox.common import MeasureSource, ObjectProperties, StructuredText from cybox.core import ...
# utility functions such as statistics import skimage.io as io import json import argparse import numpy as np import os def get_subset_stats(json_path): """ Calculate the statistics of subset dataset Args: json_path: A path to subset json file """ with open(json_path) as json_f...
#------------------Bombermans Team---------------------------------# #Author : B3mB4m #Concat : <EMAIL> #Project : https://github.com/b3mb4m/Shellsploit #LICENSE : https://github.com/b3mb4m/Shellsploit/blob/master/LICENSE #------------------------------------------------------------------# from re import findall ...
import subprocess import os import argparse import time from operator import add DATA_LOC='/home/boubin/Images/' CUBE_LOC='/home/boubin/SoftwarePilot/DistributedRL/Data/' def consoleLog(string): print("#################################################") print("##############DRL Controller:") print(string) print("...
from typing import List from spacy.lang import char_classes from spacy.symbols import ORTH from spacy.tokenizer import Tokenizer from spacy.util import compile_prefix_regex, compile_infix_regex, compile_suffix_regex from spacy.language import Language def remove_new_lines(text: str) -> str: """Used to preprocess ...
import bitmath import ipaddress import re from ipaddress import AddressValueError from insights.parsers.installed_rpms import InstalledRpm from kerlescan.constants import SYSTEM_ID_KEY from kerlescan.constants import SYSTEM_PROFILE_STRINGS, SYSTEM_PROFILE_INTEGERS from kerlescan.constants import SYSTEM_PROFILE_BOOLEA...
# Copyright 2019 Huawei Technologies Co., Ltd # # 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...
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 import boto3 import requests import json import time GAME_NAME = '<REPLACE_WITH_YOUR_GAME_NAME>' REGION = '<REPLACE_WITH_YOUR_REGION>' USER_POOL_NAME = GAME_NAME + 'UserPool' USER_POOL_CLIENT_NAME = GAME_NAME + 'Use...
"""plotlib.py: Module is used to plotting tools""" __author__ = "<NAME>." __copyright__ = "" __credits__ = [] __license__ = "MIT" __version__ = "1.0." __maintainer__ = "<NAME>." __email__ = "<EMAIL>" __status__ = "Research" import matplotlib as mpl import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as ...
import json import logging.config import os import re from string import Template from jans.pycloudlib import get_manager from jans.pycloudlib.persistence import render_couchbase_properties from jans.pycloudlib.persistence import render_base_properties from jans.pycloudlib.persistence import render_hybrid_properties f...
import os from functools import partial from pathlib import Path from typing import Dict, Optional, Union from bw_tools.common.bw_api_tool import BWAPITool from bw_tools.common.bw_node_selection import remove_dot_nodes from bw_tools.modules.bw_settings.bw_settings import BWModuleSettings from bw_tools.modules.bw_strai...
import os, sys import numpy as np from math import sqrt # testing without install #sys.path.insert(0, '../build/lib.macosx-10.9-x86_64-3.8') import poppunk_refine # Original PopPUNK function (with some improvements) def withinBoundary(dists, x_max, y_max, slope=2): boundary_test = np.ones((dists.shape[0])) fo...
import torch from torch.utils.data import Dataset from random import choice from pytorch_pretrained_bert import BertTokenizer, BertModel max_len = 400 device = "cuda:0" # bert_path = './pretrain/bert-base-chinese/' # tokenizer = BertTokenizer.from_pretrained(bert_path + 'vocab.txt') # BERT = BertModel.from_pretrained(...
from collections import namedtuple import tensorflow as tf import tensorflow_addons as tfa AugmentationConfig = namedtuple('AugmentationConfig', [ 'angle_range', 'offset_range', 'scale_range', 'brightness_max_delta', 'contrast_min', 'contrast_max', 'hue_max_delta', 'saturation_min', ...
# coding=utf-8 # Copyright 2020 The Ravens 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...
#!/usr/bin/env python # Generic code for a classifier # # Subscribes to a feature vector (custom_msgs/Float32MultiArray) and a label (custom_msgs/String) # Uses upcoming feature data to fit a classifier to predict the label # Interface with topic command (Start/Stop learning) import rospy import numpy as np import si...
import argparse from GeneralTools.architectures import get_mnist_architectures, cifar_default def parse_run_args(): parser = argparse.ArgumentParser() parser.add_argument('--filename', '-file', type=str, default=None) parser.add_argument('--dataset', '-data', type=str, default='mnist') parser.add_argument('...
""" --- Day 21: RPG Simulator 20XX --- <NAME> got a new video game for Christmas. It's an RPG, and he's stuck on a boss. He needs to know what equipment to buy at the shop. He hands you the controller. In this game, the player (you) and the enemy (the boss) take turns attacking. The player always goes first. Each att...
#!/usr/bin/env python from utils import utils, inspector from bs4 import BeautifulSoup from datetime import datetime import re import logging # oldest year: 1979 def run(options): crawl_index(SEMIANNUAL_REPORTS_URL, options) crawl_index(AUDIT_REPORTS_URL, options, True) crawl_index(PEER_REVIEW_REPORTS_URL, opt...
import random import torch as t from py.data.XYDataset import XYDataset from py.util.Config import dtype, device, en_stops from nltk.tokenize import word_tokenize import numpy as np def genericDescriptionClassifier(description, embedding): some_generic_descriptions = ['work', 'success', 'test', 'filter', ...
import cPickle as pkl import gzip import os import re import sys import numpy import math import random from binary_tree import BinaryTree def convert_ptb_to_tree(line): index = 0 tree = None line = line.rstrip() stack = [] parts = line.split() for p_i, p in enumerate(parts): # openin...
## This file is adopted from DVE's github repo: https://github.com/jamt9000/DVE import torch.nn.functional as F import torch.nn as nn import time import torch from PIL import Image import numpy as np from pointcloud_utils import pointcloud_vis import pointnet3.sinkhorn_approximate as sinkFunc def save_data_as_image(f...
import os import calendar from flask import request, session from flask_session import Session from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker from datetime import datetime from helpers import convertSQLToDict # Create engine object to manage connections to DB, and scoped ...