text stringlengths 3.07k 22.1k |
|---|
import torch
import numpy as np
import torch.nn.functional as F
from torch import nn, optim
import torch.nn.utils.rnn as rnn_utils
class SentLSTM(nn.Module):
def __init__(self, embedding_dim, hidden_dim, batch_size, bi_direction=True):
super(SentLSTM, self).__init__()
self.hidden_dim = hidden_dim
... |
# Copyright 2020 Curtin University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
"""
Class to construct parabolas from 3 points.
ADW: Need to move all of the plotting stuff
"""
import numpy
import scipy.stats
import scipy.interpolate
############################################################
class Parabola:
def __init__(self, x, y):
"""
INPUTS
x = variable of inte... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = '<NAME>'
import warnings
from random import shuffle
from time import time
import numpy as np
import pandas as pd
import xgboost as xgb
from xgboost.callback import reset_learning_rate
import lightgbm as lgb
from catboost import Pool, CatBoostClassifier
from it... |
import torch
import torch.nn as nn
#==============================<Abstract Classes>==============================#
"""
Class that acts as the base building-blocks of ProgNets.
Includes a module (usually a single layer),
a set of lateral modules, and an activation.
"""
class ProgBlock(nn.Modul... |
# vim: et:ts=4:sw=4:fenc=utf-8
import math
import random
import subprocess
from abc import ABC, abstractmethod
from statistics import median
from PITE.register_allocation import Allocator
# This is the interface that a benchmark runner has to implement to be used in
# a benchmarking server.
class LowLevelEvaluator(A... |
# Copyright © 2017 <NAME>, All rights reserved
# http://github.com/omartinsky/pybor
from yc_helpers import *
from dateutil.relativedelta import relativedelta
from numpy import *
import dateutil.parser
import enum, calendar, datetime
class Tenor:
def __init__(self, s):
try:
assert... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Various tools for calculating statistics
"""
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
from __future__ import absolute_import, division, pri... |
import torch
import torch_geometric #torch_geometric == 2.5
import community
import numpy as np
import networkx
import argparse
from torch_geometric.datasets import TUDataset
from torch_geometric.data import DataLoader
from torch_geometric.data import Batch
from Sign_OPT import *
import torch_geometric.transforms as T
... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import rhinoscriptsyntax as rs
from compas.geometry import distance_point_point
from compas.geometry import closest_point_in_cloud
from compas.geometry import Polyline
from compas_rhino.geometry import RhinoP... |
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import random
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
import scipy
import scipy.spatial.distance
from scipy.stats import spearmanr
import torch
import utils
__author__... |
import os, sys
from os import system
import tensorflow as tf
import numpy as np
np.set_printoptions(threshold=sys.maxsize)
##############################################################################
##############################################################################
## System Paths ##
path ... |
from logging import getLogger
from calendar import monthrange
from collections import OrderedDict
from datetime import date
from datetime import datetime
from dateutil.parser import parse
import ckan.plugins as p
import ckan.logic as logic
from ckan.logic.action.create import user_create as ckan_user_create
import cka... |
#import torch.nn as nn
import torch
from torch.nn import functional as F
#from PIL import Image
import numpy as np
import pandas as pd
#import os
import os.path as osp
import shutil
#import math
def save_checkpoint(state,best_pred, epoch,is_best,checkpoint_path,filename='./checkpoint/checkpoint.pth.tar'):
torch.sa... |
# Copyright (C) 2018 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""This module contains common utils for integration functionality."""
import sqlalchemy as sa
from ggrc import db
from ggrc import settings
from ggrc.models import exceptions
from ggrc.models import all_m... |
"""This module handles all operations involving the user's settings."""
import json
from os import path
from PyQt5.QtWidgets import QWidget
from PyQt5.QtCore import QObject, pyqtSignal
from ui import SettingsTab
import ManageDB
from Constants import *
import GeneralUtils
from GeneralUtils import JsonModel
class Sett... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 25 10:44:24 2017
@author: wroscoe
"""
import time
from threading import Thread
import socket
from donkeycar.parts.controller import JoystickController, PS3JoystickController, PS3Joystick
class Vehicle():
def __init__(self, mem=None):
... |
# coding: utf-8
# import sys,os,os.path
# os.environ['CUDA_VISIBLE_DEVICES']=''
import json
import os
import sys
from collections import Counter
import tqdm
import numpy as np
import tensorflow as tf
from tensorflow.contrib import layers
from tensorflow.python.ops import array_ops
import random
import pickle
import ed... |
import numpy as np
from proteus import Domain, Context, Comm
from proteus.mprans import SpatialTools as st
import proteus.TwoPhaseFlow.TwoPhaseFlowProblem as TpFlow
from proteus import WaveTools as wt
from proteus.Profiling import logEvent
from proteus.mbd import CouplingFSI as fsi
import os
import pychrono
rho_0 = 99... |
__author__ = "<NAME> <<EMAIL>>"
import re
from time import sleep
from unicon.bases.routers.services import BaseService
from unicon.plugins.generic.service_statements import reload_statement_list
from unicon.plugins.generic.service_implementation import ReloadResult
from unicon.eal.dialogs import Dialog
from unicon.c... |
"""LVM based backup workflows and MixIn classes."""
import copy
import os
import gflags
import rdiff_backup_wrapper
FLAGS = gflags.FLAGS
gflags.DEFINE_string(
'snapshot_mount_root', '/tmp',
'root path for creating temporary directories for mounting LVM snapshots')
gflags.DEFINE_string('snapshot_suffix', '-a... |
import numpy as np
import dynet as dy
from xnmt.modelparts.transforms import Linear
from xnmt.persistence import serializable_init, Serializable, Ref
from xnmt.events import register_xnmt_handler, handle_xnmt_event
from xnmt.param_initializers import LeCunUniformInitializer
from xnmt.param_collections import ParamMana... |
# -*- coding: utf-8 -*-
import ast
import json
from django.shortcuts import render, redirect, render_to_response, HttpResponse
from django.core.urlresolvers import reverse
from ..enum.FunctionCode import FuncCode
from ..enum.MessageCode import Info
from ..enum.platform import *
from ..enum.StatusCode import Blueprint
f... |
import numpy as np
import pandas as pd
from mia.estimators import ShadowModelBundle, prepare_attack_data
from sklearn.ensemble import RandomForestClassifier
from sklearn.utils import resample
# depent on tensorflow 1.14
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.layers import Conv1D, A... |
#
# 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... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import math
import LPC_rundef
import rundef
import boot
sys.path.append(os.path.abspath(".."))
from gen import LPC_gencore
from gen import LPC_gendef
from ui import LPC_uidef
from ui import uidef
from ui import uivar
from ui import uilang
from mem impo... |
import os
import sys
import random
import numpy as np
sys.path.insert(1, os.path.join(sys.path[0], '..'))
from h01_data.parse import get_data as get_raw_data
from h02_learn.model import opt_params
from h02_learn.train import convert_to_loader, _run_language, write_csv, get_data
from utils import argparser
from utils i... |
""" Utilities to make and assert transfers. """
import random
import gevent
from raiden.constants import UINT64_MAX
from raiden.message_handler import MessageHandler
from raiden.messages import LockedTransfer, LockExpired
from raiden.tests.utils.factories import make_address
from raiden.transfer import channel, views... |
'''The main interface for using the `rpa_logger` package.
This module contains the `rpa_logger.logger.Logger` class and default
functions it uses for its callback parameters.
'''
from sys import stdout
from textwrap import indent
from threading import Event, Thread
from typing import Callable, Hashable, Tuple, TextIO... |
from __future__ import print_function
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(t... |
# -*- coding: utf-8 -*-
import logging
from flask import request
from flask_restful import Resource
from werkzeug.exceptions import BadRequest
from server import api
from server.exceptions import HTTPBadRequest
from server.models import Users, Products
logger = logging.getLogger(__name__)
def _is_valid_user(user_... |
#!/usr/bin/env python3
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
"""A script to replace deprecated uses of `globs`, `rglobs`, and `zglobs` in BUILD files with a
direct list of files and globs.
Run `python3 fix_deprecated_globs_us... |
# harmonypy - A data alignment algorithm.
# Copyright (C) 2018 <NAME>
# 2019 <NAME> <<EMAIL>>
#
# 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 3 of the License, o... |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from sympy import *
def session2():
a = np.array([1, 2, 3])
b = np.array([4, 5, 6])
c = a + b
print("矩阵加法", c)
d = a - b
print("矩阵减法", d)
e = a * b
print("矩阵乘法", e)
f = np.dot(a, b)
... |
import psycopg2
import sys
from handHud import *
import time
from psycopg2.extensions import AsIs
import copy
from multiprocessing import Pool
import os
def connection():
try:
conn = psycopg2.connect(database="new", user="postgres",
password="<PASSWORD>", host='localhost',
... |
# Copyright 2019 NaplesPU
#
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the fo... |
# Copyright 2021 DeepMind Technologies 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 law or agre... |
import os
import pandas as pd
import numpy as np
import pickle
import argparse
## torch packages
import torch
from transformers import BertTokenizer,AutoTokenizer
import re
## for visualisation
import matplotlib.pyplot as plt
import collections
## custom packages
from extract_lexicon import get_arousal_vec,get_valenc... |
# Copyright 2021 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... |
import os, random, sys, time
import torch
from os import path as osp
from pprint import pprint
import numpy as np
from torch import nn
from torch.backends import cudnn
import utils.loss as loss
from models import get_baseline_model
from utils.meters import AverageMeter
from utils.loss import TripletLoss
from utils.seri... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.gdscript
~~~~~~~~~~~~~~~~~~~~~~
Lexer for GDScript.
:copyright: Copyright 2xxx by The Godot Engine Community
:license: MIT.
modified by <NAME> <<EMAIL>> based on the original python.py pygment
"""
import re
from pygments.lexer import Lexer, RegexL... |
"""Utilities for working with parsers from other applications"""
from stevedore.extension import ExtensionManager
from stevedore.driver import DriverManager
from typing import Iterator, Union, Dict, List
from collections import namedtuple
from copy import deepcopy
from materials_io.adapters.base import BaseAdapter
fr... |
import json
import numpy as np
import os
import pickle
import sklearn.metrics
import time
from chapydette import cp_estimation
def load_features(cruise, features_dir, projection_dim, subsample_num=1, subsample_of=1):
"""
Load features for a cruise.
:param cruise: Cruise to load features for.
:param ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script doing the actual virtual screening of a library of compounds over a previously built Bayesian model.
"""
import argparse
import logging
import numpy as np
import csv
import json
import math
from rdkit import Chem
import common
__author__ = "<NA... |
import os
import tempfile
import numpy as np
from microscopium.screens.cellomics import SPIRAL_CLOCKWISE_RIGHT_25
from microscopium import preprocess as pre
from microscopium import io as mio
import pytest
import warnings
@pytest.fixture
def image_files():
# for clarity we define images as integer arrays in [0, 1... |
from __future__ import print_function
import os
import sys
import pickle
import json
import datetime
from collections import namedtuple
import numpy as np
import sqlite3
from sqlalchemy import create_engine
from sqlalchemy_utils import drop_database
from sqlalchemy.orm import sessionmaker
from sqlalchemy.exc import Int... |
# -*- coding=utf-8 -*-
import os
import pip_shims.shims
import pytest
from vistir.compat import Path
from vistir.contextmanagers import temp_environ
from requirementslib import utils as base_utils
from requirementslib.models import utils
from requirementslib.models.requirements import Requirement
from requirementslib.... |
import numpy as np
# Matrix for converting axial coordinates to pixel coordinates
axial_to_pixel_mat = np.array([[np.sqrt(3), np.sqrt(3) / 2], [0, 3 / 2.]])
# Matrix for converting pixel coordinates to axial coordinates
pixel_to_axial_mat = np.linalg.inv(axial_to_pixel_mat)
# These are the vectors for moving from ... |
'''
Written by <NAME> (<EMAIL>)
Github repository: https://github.com/tmunzer/Mist_library/
'''
#######################################################################################################################################
#######################################################################################... |
import json
import re
import requests
import threading
from flask import current_app as app
ingredLock = threading.RLock()
posLock = threading.RLock()
recipeLock = threading.RLock()
imgDownloadLock = threading.RLock()
processLocker = threading.RLock()
def recipesByIngredients(ingredientsList, maxRecpts='20', ranki... |
import re
import random
import itertools
import math
from collections import defaultdict, deque
from src.utilities import *
from src import channels, users, debuglog, errlog, plog
from src.functions import get_players, get_all_players, get_main_role, get_reveal_role
from src.decorators import command, event_listener
f... |
#! /usr/bin/env python3
#
# MIT License
#
# (C) Copyright 2018-2022 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including ... |
import re
import warnings
from astropy.coordinates import SkyCoord
import astropy.units as u
import numpy as np
from astropy.wcs import WCS, FITSFixedWarning
from astropy.io import fits
def _arange_inclusive(x0, x1, binx):
"""
Return np.arange(x0, x1, binx) except that range is inclusive of x1.
"""
... |
# -*- coding: utf-8 -*-
"""
Created on Fri May 25 16:11:03 2018
@author: kncv078
"""
# NOTES:
# fingerprint files are very large, i should use sparse matrices
# 1 - import libraries
#import os
import time
import math
import random
import pandas as pd
#import numpy as np
from scipy import sparse
#import matplotlib a... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import logging
from collections import Iterable
from django.utils.translation import ugettext_lazy as _
from .errors import ConnectionError
LOG = logging.getLogger(__name__)
__all__ = ['BaseDriver', 'DatabaseStatus', 'DatabaseInfraStatu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Cleaning script for the output of utool profiling
Removes profiled output of code that never ran
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from six.moves import range, cStringIO
import six
import operator
import utool as ut
... |
# coding: utf8
"""Generate Cydia/Sileo depictions (from deb packages) for Debian repos.
"""
import json
import re
from datetime import datetime
from xml.etree import ElementTree as etree
# regexes
RE_DEPENDS = re.compile(r"^([a-z0-9+\-\.]+)(?: *\(([<>=]{1,2}) *(.*)?\))?$")
def dict_to_xml(data: dict, rootname: str ... |
# -*- coding: utf-8 -*-
from future.standard_library import install_aliases
install_aliases()
from past.builtins import basestring
from urllib.request import urlopen
import urllib
import json, os, sys
import datetime, re
from datetime import tzinfo
def json_loader(url):
"""json_loader is to request (JSON) data f... |
"""
This file defines utilities for manipulating the stack in an
RPython-compliant way, intended mostly for use by the Stackless PyPy.
"""
import inspect
from pypy.rlib.objectmodel import we_are_translated
from pypy.rpython.extregistry import ExtRegistryEntry
from pypy.rpython.lltypesystem import rffi, lltype
from py... |
from django import template
from django.conf import settings
from apps.testapp.models import *
#from torchbox.utils import *
register = template.Library()
@register.assignment_tag
def get_popular_tags(model):
return model.get_popular_tags()
# settings value
@register.assignment_tag
def get_googe_maps_key():
... |
#!/usr/bin/env python
"""
Copyright 2017 ARC Centre of Excellence for Climate Systems Science
author: <NAME> <<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/li... |
import os
from pyaedt import aedt_exception_handler
from pyaedt.modeler.GeometryOperators import GeometryOperators
class Part(object):
"""Manages 3D component placement and definition.
Parameters
----------
part_folder : str
Path to the folder with the A3DCOMP files.
part_dict : dict
... |
import numpy as np
import os
from skimage.io import imread
from skimage.transform import resize
from skimage.color import gray2rgb
import pandas as pd
from sklearn.metrics import confusion_matrix
import keras
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D, AveragePooling2D, D... |
#!/usr/bin/env python
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__company__ = "Robotic Beverage Technologies Inc"
__status__ = "Development"
__date__ = "Late Updated: 2020-05-11"
__doc__ = "Class to operate at least 64 servos, 16 relays, and 32 motors at once with latency less then 100 ms"
# Useful docum... |
"""
This handles mapping the filenames in the export
to the corresponding functions and caching the results
"""
import os
import re
from pathlib import Path
from typing import (
Iterator,
Dict,
Callable,
Any,
Optional,
List,
Type,
Tuple,
cast,
)
from collections import defaultdict
... |
#!/usr/bin/env python3
import sys, os, subprocess, psutil
from filelock import filelock
#TODO: Better interface existence checks
if len(sys.argv) < 3:
print("Usage: <intf one> <intf two>")
sys.exit(1)
intone = sys.argv[1]
inttwo = sys.argv[2]
rt_table = "/etc/iproute2/rt_tables"
def check_network_managers():
pi... |
__author__ = '<NAME>'
"""
graph_builder is used by negative_samples_generator.py to get what is needed to build the negative samples.
"""
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import corpus2graph.util as util
import corpus2graph.multi_processing
class NoGraph:
def __init__(sel... |
#!/usr/bin/python3
# lltapes.py - Uses BeautifulSoup and requests to parse and download episodes
# from lovelinetapes.
import re
import sys
import os
import logging
import argparse
# for multi-threading
from queue import Queue
from threading import Thread
import requests
from bs4 import BeautifulSoup
U... |
# ------------------------------------------------------------------------------
# Functions for parsing and rendering inline markup.
# ------------------------------------------------------------------------------
import html
import hashlib
import re
# ---------------------------------------------------------------... |
# -*- coding: utf-8 -*-
"""Parser for OLE Compound Files (OLECF)."""
from __future__ import unicode_literals
import pyolecf
from plaso.lib import specification
from plaso.parsers import interface
from plaso.parsers import manager
import os
import time
from dfdatetime import semantic_time as dfdatetime_semantic_tim... |
"""
Mutation routines
"""
from __future__ import division
import random
from deap import base
from cea.optimization.constants import N_HR, N_HEAT, N_SOLAR, N_COOL, INDICES_CORRESPONDING_TO_DCN, INDICES_CORRESPONDING_TO_DHN
toolbox = base.Toolbox()
def mutFlip(individual, proba, nBuildings):
"""
For all inte... |
# 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"); y... |
"""Translate events from a legacy ``ProtocolContext`` into Protocol Engine commands."""
from collections import defaultdict
from datetime import datetime
from typing import Dict, List, Union
from opentrons.types import MountType, DeckSlotName
from opentrons.commands import types as legacy_command_types
from opentrons... |
# ---
# jupyter:
# jupytext:
# metadata_filter:
# cells:
# additional: all
# notebook:
# additional: all
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.2'
# jupytext_version: 0.8.6
# kernelspec:
# display_name: Pyth... |
from typing import Sequence, Tuple, List, Union, Dict
from opendp._lib import *
from opendp.mod import UnknownTypeException, OpenDPException, Transformation, Measurement
from opendp.typing import RuntimeType
ATOM_MAP = {
'f32': ctypes.c_float,
'f64': ctypes.c_double,
'u8': ctypes.c_uint8,
'u16': ctyp... |
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2020 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify,... |
import re
import unittest
class Porter:
# Helper regex strings.
_vowel = "[аеиоуыэюя]"
_non_vowel = "[^аеиоуыэюя]"
# Word regions.
_re_rv = re.compile(_vowel)
_re_r1 = re.compile(_vowel + _non_vowel)
# Endings.
_re_perfective_gerund = re.compile(
r"(((?P<ignore>[ая])(в|вши|вш... |
#!/usr/bin/env python3
"""Tools to generate a Snakemake-based BIDS app."""
import os
import pathlib
import subprocess
import argparse
import logging
import sys
import yaml
import bids
import snakemake
from snakemake.io import load_configfile
# We define Path here in addition to pathlib to put both variables in globa... |
#
# Copyright (C) 2014-2016 UAVCAN Development Team <uavcan.org>
#
# This software is distributed under the terms of the MIT License.
#
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
from __future__ import division, absolute_import, print_function, unicode_literals
import os
import dronecan
from dronecan.tr... |
# Copyright 2015 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... |
# Copyright 2019 Red Hat
#
# 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/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import pyauto_functional
import pyauto
import webrtc_test_base
class MissingRequiredBinaryException(E... |
import json
import os
import os.path
import cv2
import numpy as np
import torch
import torch.utils.data as data_utl
from tqdm import tqdm
from dataset.vidor import VidOR
from frames import extract_all_frames
def video_to_tensor(pic):
"""Convert a ``numpy.ndarray`` to tensor.
Converts a numpy.ndarray (T x H ... |
"""Utility module; various helper functions are implemented."""
import os as _os
import os.path as _path
import random as _random
import logging as _logging
from importlib import import_module as _import_module
import yaml as _yaml
import tensorflow as _tf
import soundfile as _sf
import utils.hangul as _hangul
CONFI... |
import asyncio
from bs4 import BeautifulSoup
from urllib.parse import urlencode, urljoin
from re import compile as re_compile, IGNORECASE, escape
from mite import MiteError, ensure_fixed_separation
import mite_http
EMBEDDED_URL_REGEX = re_compile("url\(\s*[\"'](.*)[\"']\s*\)", IGNORECASE)
class OptionError(MiteError)... |
#!/usr/bin/python
# encoding: utf-8
import tarsLog
import shutil
import os
import sys
import stat
from tarsUtil import *
log = tarsLog.getLogger()
tarsDeploy = "/usr/local/app/tars"
tarsDeployFrameBasicServerList = ["tarsregistry", "tarsnode", "tarsAdminRegistry", "tarspatch","tarsconfig"]
tarsDeployFrameCommServerList... |
# micropoliszone.py
#
# Micropolis, Unix Version. This game was released for the Unix platform
# in or about 1990 and has been modified for inclusion in the One Laptop
# Per Child program. Copyright (C) 1989 - 2007 Electronic Arts Inc. If
# you need assistance with this program, you may contact:
# http://wiki.lapt... |
#!/usr/bin/env python
#
# Copyright 2019 The Nakama 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 applicabl... |
"""
Figure 3. Heterovalent bispecific
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from .figureCommon import getSetup, subplotLabel, setFontSize, heatmap, cellPopulations, overlapCellPopulation
from valentbind import polyc, polyfc
pairs = [(r"$R_1^{hi}R_2^{lo}$", r"$R_1^{med}R_2^... |
# Copyright 2010-2019 <NAME>, <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 ag... |
"""
Examples
--------
Convert existing jupyter notebook to an airbnb knowledge repo format
- python convert_to_knowledge_repo.py --ml_repo . --knowledge_repo knowledge-repo
Deploying the webapp
- knowledge_repo --repo knowledge-repo deploy
"""
import os
import re
import json
import subprocess
from dateutil import par... |
from abc import ABC
import numpy as np
import gym
import mujoco_py
from gym.envs.registration import register
def change_fetch_model(change_model):
import os
import shutil
gym_folder = os.path.dirname(gym.__file__)
xml_folder = 'envs/robotics/assets/fetch'
full_folder_path = os.path.join(gym_folde... |
# Copyright 2020; <NAME>
# See license for more details
import logging
import threading
import weakref
from requests import ConnectionError
from six import PY3
from six import string_types
from six.moves.urllib.parse import urlparse
from .elements import VoidResource
from .elements import CSSResource
from .elements i... |
# File: main.py
#
# Author: <NAME>
# Date: 2018-11-30
import argparse
import sys
import os
import xlsxwriter
import time
from DoodleParser import DoodleParser
from Solver import Solver
CONFIG_FILE = "config.in"
CONF = dict()
def error(string):
""" Print error message.
Parameters:
-----------
... |
# PyLinuxToolkit
# Copyright (C) 2022 JWCompDev
#
# str_utils.py
# Copyright (C) 2022 JWCompDev <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by
# the Apache Software Foundation; either version 2.0 of the License, or
# (at your... |
import matplotlib.pyplot as plt
import numpy as np
class RefDataType:
def __init__(self,length,steps,coverage,cv,marker,color,label):
self.length = length
self.steps = steps
self.coverage = coverage
self.cv = cv
self.marker = marker
self.color = color
self.label = label
def get_prop(self, prop_str):
... |
# Copyright (C) 2019 Apple 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:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... |
from __future__ import print_function
from __future__ import division
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
import torch.nn.functional as F
import torch.utils.data
import numpy as np
import math
import time
import os
import pickle
import random
import nmslib
import sys
from scipy... |
#!/usr/bin/python
#
# Copyright (c) 2017-2019 NVIDIA CORPORATION. All rights reserved.
# This file is part of the objectio library.
# See the LICENSE file for licensing terms (BSD-style).
#
__all__ = "objopen gopen config".split()
import os
import sys
import time
import subprocess
import yaml
import io
from urllib.pa... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
@author: sharpdeep
@file:model.py
@time: 2016-01-02 00:19
"""
from core import util
from core.status import *
from datetime import datetime
from mongoengine import *
from conf.config import configs
from datetime import datetime
import time
connect(configs.db.name) #连接mon... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.