text stringlengths 6.04k 39.5k |
|---|
"""Utility functions used in various parts of the simple_parsing package."""
import argparse
import builtins
import dataclasses
import functools
import json
import re
import warnings
from abc import ABC
from collections import abc as c_abc
from collections import defaultdict
from dataclasses import _MISSING_TYPE, MISSI... |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible 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, or
# (at your option) any later version.
#
# Ansible is distribut... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
import sys
if sys.version[0] == '3':
print("""Universal Petrarch is currently only tested on Python 2. If you
encounter errors with Python 3, try switching to Python 2.
Alternatively, pull requests enabling Pytho... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import idc, idaapi
idaapi.require("pclntbl")
idaapi.require("common")
from common import ADDR_SZ, read_mem
def is_stripped():
'''
Check Binary file if is stripped by find [.go.plt] segment
'''
goplt_seg = common.get_seg([".go.plt", "__go_plt"])
if not g... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
file: plot_2d_matplotlib.py
brief: Python script to visualise transverse intensity profiles of vortex
beams. The program extracts 2d slices (for any given section) of an
HDF5 file generated by the FDTD solver Meep.
author: <NAME>
date: 18.01.2018
... |
"""
NFTSocket -- low level nftables API
See also: pyroute2.nftables
"""
import threading
from pyroute2.netlink import NLM_F_REQUEST
from pyroute2.netlink import NLM_F_DUMP
from pyroute2.netlink import NETLINK_NETFILTER
from pyroute2.netlink import nla
from pyroute2.netlink.nlsocket import NetlinkSocket
from pyroute2.... |
import cv2
import numpy as np
import os
import torch
from facexlib.detection import init_detection_model
from facexlib.utils.misc import imwrite
def get_largest_face(det_faces, h, w):
def get_location(val, length):
if val < 0:
return 0
elif val > length:
return length
... |
"""
Some of the code snippets from open source project:
https://github.com/rohithreddy024/VAE-Text-Generation
"""
import numpy as np
import torch as torch
import os
from src.model.model_vae import VAE
import torch.nn.functional as F
import math
import argparse
from pathlib import Path
from torch.utils.t... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import cv2
import numpy as np
import paddlehub as hub
from paddlehub.common.logger import logger
import time
import math
import os
import copy
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import socket
# parameters for mean filter
POINTS_NUM_LANDMARK = 68
windowlen_1 = 3
queu... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function
import re
import copy
import itertools
from warnings import warn
from astropy import units as u
from astropy import coordinates
from .core import CRTFRegionParserError, CRTFRegionParserWarn... |
from collections.abc import Mapping
from datetime import date, datetime
from operator import itemgetter
import sys, json, logging, time, threading, warnings, functools, platform
import queue
import boto3
import botocore
from botocore.exceptions import ClientError
def _json_serialize_default(o):
"""
A standar... |
import numpy as np
import pandas as pd
class Compound:
'''
Compounds are discrete entitties (molecular species) that can change their quantities based on reaction channels.
To create one:
c = Compound('MoleculeA', 5)
After a simulation, c.n will contain the number of 'MoleculaA' that... |
"""
Container structures for data that should be read or written to disk
"""
from astropy import units as u
from astropy.time import Time
from numpy import nan
import numpy as np
from ..core import Container, Field, Map
from ..instrument import SubarrayDescription
__all__ = [
'InstrumentContainer',
'R0Contai... |
#----------------------------------------------------------------------------
# Classes for new input type `desStarCatalog`; intended for use with Balrog,
# but should be extendable.
#
# Contributors:
# <NAME> (UCSC)
#----------------------------------------------------------------------------
import galsim
import gal... |
#MAIN APP LOOP
import random
import tkinter as tk
from tkinter import ttk
from tkinter import *
from tkinter.ttk import *
from tkinter import messagebox
from dataclasses import make_dataclass
import pickle, time, csv
from PIL import Image, ImageTk
# import matplotlib
# matplotlib.use("TkAgg")
# from matplotlib.backend... |
# Copyright (c) 2020 AIST.
#
# 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, merge, publish, distribute, s... |
from astropy.modeling import models, fitting
from astropy.io import fits
import numpy as np
import matplotlib.pyplot as plt
from photutils import aperture_photometry, CircularAperture, CircularAnnulus
from photutils.geometry import circular_overlap_grid
from photutils.aperture_funcs import get_phot_extents
from matplot... |
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
import random
import numpy as np
PAD, CLS = '[PAD]', '[CLS]'
SEP = '[SEP]'
class Attention(nn.Module):
r"""
Applies an attention mechanism on the output features from the decoder.
.. math::
... |
import math
RAD2DEG = 180.0 / math.pi
DEG2RAD = math.pi / 180
HOUR2SEC = 3600.0
MIN2SEC = 60.0
SEC2MIN = 1 / 60.0
SEC2HOUR = 1 / 3600.0
INV2PI = 0.5 / math.pi
V2PI = 2.0 * math.pi
METER2IN = 0.0254
METER2MILES = 1609.344051499
def db20(x, inverse=True):
"""Convert db20 to decimal and viceversa."""
if inverse... |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2010 California Institute of Technology. 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 th... |
import numpy as np
from mpi4py import MPI as py_mpi
from dolfin import *
try:
from iufl import icompile
from ufl.corealg.traversal import traverse_unique_terminals
from iufl.operators import eigw
except ImportError:
print('iUFL can be obtained from https://github.com/MiroK/ufl-interpreter')
class Dr... |
import json
from django.core.urlresolvers import reverse
from django.db.models import Q
from django.http import HttpResponse, Http404
from django.shortcuts import render, render_to_response, redirect, HttpResponseRedirect
from django.template import RequestContext
from c2g.models import ContentGroup, ContentSection, ... |
# --------------------------------------------------------
# Domain adpatation training
# Copyright (c) 2019 valeo.ai
#
# Written by <NAME>
# --------------------------------------------------------
# --------------------------------------------------------
# Adaptation of FDA to Intra DA
#
#
# Updated by <... |
# Copyright 2020 <NAME>, <NAME>, and <NAME>. All Rights Reserved.
# Copyright 2019 Uber Technologies, 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://... |
#!/usr/bin/env python
import warnings
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
import sys
import os
import argparse
import re
import scanpy as sc
import pandas as pd
import numpy as np
import anndata
import scvelo as sv
GENOME = {'homo_sapiens': 'GRCh38',
'human': 'GRCh38',
... |
import dataclasses
import functools
import json
import os
import pkgutil
import sys
import typing
import urllib.parse
import dacite
import deprecated
import yaml
from model.base import (
ConfigElementNotFoundError,
ModelValidationError,
NamedModelElement,
)
from ci.util import (
existing_dir,
not_... |
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2015, Code for America
# This is open source software, released under a standard 3-clause
# BSD-style license; see the file LICENSE for details.
import os
import datetime
import re
from flask import Flask, render_template, request, abort, redirect, url_for, make_response, ... |
#!/usr/bin/env python
from mayavi import mlab
import sys, numpy as np, re
from ase.data.colors import jmol_colors
from ase.data import atomic_numbers, covalent_radii, chemical_symbols
from ase import Atoms
from tvtk.api import tvtk
from ase.visualize.mlab import plot
from aiida_scripts.charges.io_xsf import read_xsf
... |
"""
3/16/16
Coursera, An Introduction to Interactive Programming in Python (Part 1), Rice University
Mini-project #8 - RiceRocks (Asteroids)
copy code to http://www.codeskulptor.org/
"""
import simplegui, random, math
SCREEN = (800, 600)
started = False
def new_game():
global rock_group, missile_... |
import numpy as np
from math import pi
from numpy.linalg import norm
def circle_point(p, q):
"""
special math operation
:param p: a vector (1,4)
:param q: a vector (1,4)
:return: a vector with shape (1,4)
"""
p_0 = p[0]
p_v = p[1:]
q_0 = q[0]
q_v = q[1:]
result = np.zeros... |
"""download and save the data - @yashbonde"""
import io
import os
import re
import sys
import h5py
import json
import wget
import time
import chess
import pickle
import subprocess
import numpy as np
import multiprocessing
from chess import pgn
from glob import glob
from tqdm import trange
from zipfile import ZipFile
... |
'''PyTorch CUB-200-2011 Training with VGG16 (TRAINED FROM SCRATCH).'''
from __future__ import print_function
import os
# import nni
import time
import torch
import logging
import argparse
import torchvision
import random
from PIL import Image
import torch.nn as nn
import numpy as np
import torch.optim as optim
import t... |
from __future__ import print_function, division, absolute_import
import torch.nn as nn
import torch
from torch.utils import model_zoo
import math
from collections import OrderedDict
from anchors import Anchors
import losses
from utils import BBoxTransform, ClipBoxes
from model import PyramidFeatures,ClassificationM... |
import warnings
from scipy.interpolate import interp1d
import glob
import pandas as pd
import numpy as np
from string import Template
import seaborn as sns
from itertools import cycle
import argparse
import matplotlib.pyplot as plt
import matplotlib as mpl
import matplotlib.ticker as tick
import matplotlib.ticker as mt... |
#!/usr/bin/python3
############################################################
#
# Originally created by <NAME>, March 1, 2016
# while at the Lawrence J. Ellison Institute for Transformative
# Medicine of USC (University of Southern California).
#
# Copyright 2017, <NAME>, Opto-Knowledge Systems, Inc. (OKSI)
#
# Redis... |
import numpy as np
from sn_metrics.sn_snr_metric import SNSNRMetric
from sn_metrics.sn_cadence_metric import SNCadenceMetric
from sn_metrics.sn_obsrate_metric import SNObsRateMetric
from sn_metrics.sn_nsn_metric import SNNSNMetric
from sn_metrics.sn_sl_metric import SLSNMetric
from sn_tools.sn_cadence_tools import Refe... |
##############################################################################
#
# Computes means over specified time periods:
#
# #############################################################################
import os
import numpy as np
from netCDF4 import Dataset
import cftime
import copy
import sys
from . import C... |
"""
Sphinx plugins for Django documentation.
"""
import json
import os
import re
from docutils import nodes
from docutils.parsers.rst import Directive, directives
from docutils.statemachine import ViewList
from sphinx import addnodes
from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.directives import ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
__metaclass__ = type
ANSIBLE_METADATA = {
"metadata_version": "1.1",
"status": ["preview"],
"supported_by": "certified",
}
DOCU... |
# ------------------------- Imports ------------------------ #
import json
import click
from mltrace import (
set_address,
get_recent_run_ids,
get_component_run_information,
get_component_information,
get_history,
web_trace,
flag_output_id,
unflag_output_id,
review_flagged_outputs,... |
#-*- coding: utf-8 -*-
'''
Created on 2016. 11. 19
Updated on 2016. 01. 09
'''
from __future__ import print_function
import os
import sys
sys.path.append(os.getcwd()) # add the executed path to system PATH
import copy
import re
import subprocess
from xml.etree import ElementTree
from utils import PrettyStringBuilder... |
import enum
import json
from mc_automation_tools import common
from mc_automation_tools.models import structs
class JobStatus(enum.Enum):
"""
Types of job statuses
"""
Completed = 'Completed'
Failed = 'Failed'
InProgress = 'In-Progress'
Pending = 'Pending'
class EnvironmentTypes(enum.En... |
import json
import logging
import socket
import boto3
from fabric2 import Connection
from invoke.exceptions import UnexpectedExit, CommandTimedOut
from paramiko.ssh_exception import SSHException, ChannelException, NoValidConnectionsError
from botocore.exceptions import ClientError, WaiterError
from datetime import dat... |
import json
import uuid
from datetime import datetime, timedelta
from unittest.mock import patch
import pytz
from sana_pchr.api.base import SynchronizedFieldsPreparer, SynchronizedResource
from sana_pchr.models import *
from sana_pchr.models.medication import *
from sana_pchr.models.base import SynchronizedModel
from... |
"""
Module views, responding to routed URLs
"""
# pylint: disable=R0914
# - Can't modify number of views - can we refactor to class?
from datetime import date, datetime, timedelta
from os import path
from typing import List, Tuple
from dateutil.parser import parse as parse_date
from django.core.exceptions import Permi... |
#
# Copyright 2018-2022 Elyra Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
import json
import uuid
from decimal import Decimal
from urlparse import parse_qs
from django.conf import settings
from django.core import mail
from django.core.urlresolvers import reverse
from django.http import HttpRequest
import jwt
from mock import patch
from nose.tools import eq_, ok_
import amo
import mkt
from... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script can be used to compare two RMG-generated kinetics models. To use,
pass the
"""
import os
import math
import numpy
import os.path
import logging
import argparse
from rmgpy.chemkin import loadChemkinFile
from rmgpy.rmg.model import ReactionModel
from rmgpy... |
# Copyright (c) 2005-2006, <NAME>
# Copyright (c) 2007, Linden Research, Inc.
# Copyright (c) 2009-2010 <NAME>
# Copyright (c) 2010 <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 wi... |
#!/usr/bin/env python3
from slickrpc import Proxy
import time
import sys
import datetime
import os
import json
import re
import platform
import threading
import calendar
# set your log directory here, make sure the directory exists. All exports and failed imports will be logged here.
# without this funds can be lost... |
# Copyright 2015 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... |
import sys
import pynusmv
import string
import re
import os.path
from os import path
from pynusmv.model import *
from pynusmv.fsm import BddTrans
from pynusmv.fsm import BddEnc
from pynusmv.fsm import BddFsm
from pynusmv.fsm import SymbTable
from pynusmv import prop
from pynusmv.mc import check_ct... |
# para evitar ese "error" del modelo debemos instalar la siguiente libreria
# pip install pylint-django
from django.shortcuts import render
from .models import ProductoModel, AlmacenModel, ProductoAlmacenModel, CabeceraVentaModel, DetalleVentaModel
# https://www.django-rest-framework.org/api-guide/generic-views/
from r... |
import logging
import os
from random import randint
import re
import string
from ast import Str
from types import SimpleNamespace
def path_escape(fpath):
return fpath.replace('/','_')
def flatten(S):
if S == []:
return S
if isinstance(S[0], list):
return flatten(S[0]) + flatten(S[1:])
... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
python3 setup.py build_ext --inplace
"""
from setuptools import setup, Command, find_packages
from setuptools.extension import Extension
from setuptools.command.test import test as TestCommand
from setuptools.command.sdist import sdist as SDistCommand
from setuptools.... |
# -*- coding: utf-8 -*-
# from __future__ import print_function, division
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import argparse
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
from torch.autograd import Variable
import torch.backends.cu... |
from uncertainties.umath import acos, radians, degrees, sin, cos, log
import astropy.constants as c
import astropy.units as u
import numpy as np
rsun = c.R_sun.to( u.km).value
def P_to_aR(P,R,M,format='days'):
"""
function to convert period to scaled semi-major axis.
Parameters:
----------
P:... |
'''
Cartpole - Task 1 | D3QN | v2
RL: D3QN model
We will try D3QN
D3QN: Dueling Double Deep Q Network
agent will use 2 networks
> online network (Q): returns Q values for left and right | action with higher Q is chosen
( essentially the DQN network )
> target network: (see replay function)
based on the p... |
#!/usr/bin/env python3
import argparse
import sys
SRC_A = 0x0000
SRC_PTR = 0x1000
DST_NOP = 0x0000
DST_A = 0x0020
DST_D = 0x0010
DST_PTR = 0x0008
OP_LABEL = -1
OP_COMMENT = -2
OP_EQU = -3
OP_ORG = -4
OP_LDA = 0x0000 # LDA xxxx
OP_LDZ = 0x8A00 # 0 LDZ A, D, @A
OP_LDO = 0x8FC... |
import warnings
import numpy as np
import pandas as pd
import networkx as nx
import scipy.stats
import scipy as sp
import joblib
from scipy.special import betainc
import collections
import purpleml
from purpleml.utils.misc import handle_nans, rankcolumns
CorrelationResult = collections.namedtuple("Correlation", ["st... |
###############################################################################
#
# Functions and classes for loading and processing data.
#
###############################################################################
#
# This file is part of InvestOps Tutorials:
#
# https://github.com/Hvass-Labs/InvestOps-Tutorials... |
# -*- coding: utf-8 -*-
r"""PROXIMAL OPERATORS.
Defines proximal operators to be fed to ModOpt algorithm that are
specific to MCCD(or rather, not currently in ``modopt.opt.proximity``).
: Authors: <NAME> <<EMAIL>>,
<NAME> <github @MorganSchmitz>
"""
from __future__ import absolute_import, print_function... |
# This example is provided only for explanatory and educational purposes. The
# underlying APIs may change and this tutorial may break.
# Compiling FX models to NNC (Neural Network Compiler)
######################################################
# The goal of this file is to demonstrate an end to end example of using ... |
# Modified by <NAME>
# This file trains the baseline actor critic methods
# Modified from https://github.com/ikostrikov/pytorch-a2c-ppo-acktr
import argparse
import yaml
import json
import csv
from pprint import pprint
import click
import shutil
import copy
import glob
import os
import time
import pdb
import random
... |
from flask import request, g, current_app as app, json
from flask_restplus import Namespace, Resource, fields
from auth import basicauth
from database import db
from database.models import User, Board, Subscription
import os, random, string
from datetime import datetime, timedelta
import pyqrcode
""" logger """
impor... |
#------------------------------------------------------------------------------------------#
# This file is part of Pyccel which is released under MIT License. See the LICENSE file or #
# go to https://github.com/pyccel/pyccel/blob/master/LICENSE for full license details. #
#----------------------------------------... |
# Copyright (c) 2016 <NAME> <<EMAIL>>
#
# 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, merge, publis... |
import numpy as np
import pandas as pd
from anndata import AnnData
import scipy.spatial as spatial
from numba.typed import List
from numba import njit, jit
from stlearn.tools.microenv.cci.het_helpers import (
edge_core,
get_between_spot_edge_array,
get_data_for_counting,
add_unique_edges,
get_neigh... |
import re
import numpy as np
import pandas as pd
import sqlalchemy as sa
import sqlalchemy.orm
import sqlalchemy.ext.hybrid
import sqlalchemy.ext.declarative
from sqlalchemy.dialects import postgresql
from opencell.database import utils
from opencell.database.models import Base, enums, mixins
import logging
logger =... |
# Intent is to perform a high level sky subtraction using PCA decomposition of spectra from offset sky frames
# By <NAME> June 2019 major update Nov 2019
# PhD student @ Swinburne university
# Works on Ubuntu 18.04 LTS
# Thanks go to Dr <NAME> for advice on the best way to structure the code
#########################... |
import inspect
from copy import deepcopy
from typing import List, Optional, Dict, Any, Iterable
from uuid import uuid4
from mldag.core import MLDagBase, NodeBase, NodeConnection, getcallargs_inverse
from mldag.display import display
from mldag.exceptions import MldagException
from mldag.utils import ReturnParameter
_... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import datetime as DT
import traceback
import re
import shutil
from dataclasses import dataclass, field
from pathlib import Path
from urllib.parse import urljoin
from typing import List, Union, Optional, Tuple
import requests
from bs4 import Be... |
from __future__ import absolute_import
import glob
import json
import logging
import os
import shutil
import subprocess
import time
import fasteners
import tempfile
import tarfile
from contextlib import contextmanager, suppress
from celery import Celery, signature
from celery.task import task
from celery.signals im... |
import copy
import itertools
import math
import random
import sys
#####################
## UTILITY SECTION ##
#####################
def randseq(n):
seq = ''
for i in range(n):
seq += random.choice('ACGT')
return seq
def get_filepointer(filename):
fp = None
if filename.endswith('.gz'): fp = gzip.open(filena... |
import asyncio
import functools
import io
import logging
import os
import shutil
import sys
import warnings
from importlib import import_module
from pathlib import Path
from textwrap import dedent
from typing import Any, List, Optional, Sequence, Tuple, Union, cast
import aiohttp
import click
from aiodocker.exceptions... |
from unittest import TestCase
from main2lib import *
class TestMarketInfo(TestCase):
listresult = [[20220112, 79500, 79600, 78600, 78900, 11000502, 0.0, 0.51],
[20220113, 79300, 79300, 77900, 77900, 13889401, -1.27, 0.26]]
# ["날짜", "시가", "고가", "저가", "오늘종가", "거래량", "오늘증가율", "다음날고가증가율"]
d... |
"""Merge constrained primitives as property constraints."""
import collections
from typing import Tuple, Optional, List, Mapping, MutableMapping, Sequence
from icontract import ensure
from aas_core_codegen import intermediate
from aas_core_codegen.common import Error
from aas_core_codegen.infer_for_schema import (
... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2020 <NAME> <<EMAIL>>
#
# Distributed under terms of the MIT license.
import networkx as nx
import numpy as np
import os
import pandas as pd
import requests
import sys
import tkinter as tk
import webbrowser
import matplotlib.pyplot as plt
... |
"""
The records module defines the Record class, which gathers and stores
information about an individual simulation or analysis run.
Classes
-------
Record - gathers and stores information about an individual simulation or
analysis run.
Can be instantiated directly, but more usually created by the
... |
import glob
import os
import time
from copy import deepcopy
from functools import reduce
from math import gcd
from operator import iadd
import numpy as np
import torch
from tensorboardX import SummaryWriter
from prl.typing import AgentABC, HistoryABC, EnvironmentABC, AgentCallbackABC
from prl.utils import (
timei... |
import numpy as np
import pandas as pd
import pytest
from samplics.categorical import Tabulation
birthcat = pd.read_csv(
"./tests/categorical/birthcat.csv", dtype={"agecat": "string", "birthcat": "category"}
)
region = birthcat["region"]
age_cat = birthcat["agecat"]
birth_cat = birthcat["birthcat"]
pop = birthc... |
import os, cv2
import argparse
import numpy as np
import matplotlib.pyplot as plt
from src.saliency.mlnet import MLNet
import torch
from torchvision import transforms
from src.data_transform import ProcessImages, ProcessFixations
from src.TorchFovea import TorchFovea
def read_frames_from_videos(root_path, vid_name, s... |
import io
import torch
from torch import nn
from torch.utils.data import DataLoader, Sampler
from torch.optim import Adam
import argparse
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from typing import List, Iterable, Callable, Tuple
import numpy as np
import time
from PIL import Image
from ... |
import datetime
import json
import math
import re
import urllib.parse
import urllib.request
from decimal import *
from typing import *
import binance
import numpy as np
import pandas as pd
import requests
from binance.client import Client
from dotmap import DotMap
from config import configData
import log
from db impo... |
from __future__ import print_function, division
import logging
import sys
import numpy as np
import sklearn.linear_model
from .yatsm import YATSM
from ..accel import try_jit
from ..errors import TSLengthException
from ..masking import smooth_mask, multitemp_mask
from ..regression.diagnostics import rmse
# Setup
lo... |
#
# Copyright 2014-2018 <NAME> <<EMAIL>>
#
# This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
#
import ptyprocess
import select
import sys
import struct
import fcntl
import os
import codecs
import array
import threading
import json
import subprocess
import time
LOG_FINE =... |
# Copyright (c) 2011 Tencent Inc.
# All rights reserved.
#
# Author: Michaelpeng <<EMAIL>>
# Date: October 20, 2011
"""
This is the blade module which mainly holds the global database and
do the coordination work between classes.
"""
from __future__ import absolute_import
from __future__ import print_function
imp... |
#!/usr/bin/env python3
# -*- encoding: 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 Apach... |
#!/usr/bin/python3
import math
import sys
import re
from collections import deque
################ MOLECULE INFO CLASS ###########################
# Some basic info about system from ORCA's output. Mainly good to
# determine Fermi vacuum
class MolInfo:
def __init__ (self,n_elec=0,mult=0,dim=0,found_seg=False):
... |
import torch
import torch.nn as nn
import model.ops as ops
from model.common import ModuleGrouper
import torch.nn.functional as F
from model.CSConv2D import CSConv2D
def make_model(args, parent=False):
return Net(args)
class Block(nn.Module):
def __init__(self,
in_channels, out_channels,
... |
#!/usr/bin/env python
# encoding: utf-8
from os.path import abspath, expanduser, join as pjoin
import os, sys
from importlib import import_module
import numpy as np
import cv2
import time
import rospy
from tf import TransformListener, Exception as TFException
from tf.transformations import quaternion_about_axis
from... |
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Conv2d, Module, Linear, BatchNorm2d, ReLU
from torch.nn.modules.utils import _pair
from arcface.utils import l2_norm
class ChannelAttention(nn.Module):
def __init__(self, in_planes, ratio=16):
super(ChannelA... |
#!/bin/python
import logging
from shapely.geometry import Polygon
from arch_parser.models.house import House
from arch_parser.models.object import ObjectAnnotation
from arch_parser.models.wall import Wall
from arch_parser.parser import parse_house_json_file
from arch_parser.serializer import serialize_scene_json
from... |
"""
Main JNITrace python script to inject the JNITracing javascript into a target
process.
"""
import argparse
import binascii
import json
import frida
import hexdump
from pkg_resources import resource_string
from pkg_resources import require
from colorama import Fore, Style, init
__version__ = require("jnitrace"... |
#!/usr/bin/env python
from __future__ import absolute_import, print_function
import functools
import logging
import time
import pykka
from . import computenode as cnode
from . import status
from .computenode import dispatch
from .config import actor_class
class _ComputeNodeRecord(object):
def __init__(self, ac... |
import os
import importlib
import argparse
import sys
import pathlib
import pickle
import numpy as np
from time import strftime
from shutil import copyfile
import gzip
import torch
import utilities
from utilities import log, _loss_fn, _distillation_loss, _compute_root_loss
from utilities_hybrid import HybridDataset a... |
#!/usr/bin/env python
import os
import sys
import datetime
import requests
import termplotlib as tpl
from collections import OrderedDict
from millify import millify
from colorama import Fore, Back, Style
def convert_to_float(value):
try:
return float(value)
except ValueError:
return 0.0
def... |
# 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... |
import os
import json
import copy
import logging
import collections
import datetime
from abc import ABCMeta, abstractmethod
import six
import openpype
from .constants import (
GLOBAL_SETTINGS_KEY,
SYSTEM_SETTINGS_KEY,
PROJECT_SETTINGS_KEY,
PROJECT_ANATOMY_KEY,
LOCAL_SETTING_KEY,
M_OVERRIDEN_KEY
... |
import time
import pandas as pd
import copy
import numpy as np
from shapely import affinity
from shapely.geometry import Polygon
import geopandas as gpd
def cal_arc(p1, p2, degree=False):
dx, dy = p2[0] - p1[0], p2[1] - p1[1]
arc = np.pi - np.arctan2(dy, dx)
return arc / np.pi * 180 if degree else arc
def... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.