text stringlengths 3.07k 22.1k |
|---|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import warnings
from distutils.version import LooseVersion
from .pycompat import OrderedDict, zip, dask_array_type
from .common import full_like
from .combine import concat
from .ops import (... |
# =========================================================================
# (c) Copyright 2019
# All rights reserved
# Programs written by <NAME>
# Department of Computer Science
# New Jersey Institute of Technology
# University Heights, Newark, NJ 07102, USA
#
# Permission to use, copy, modify, and dis... |
# ######################################################################
# Copyright (c) 2014, Brookhaven Science Associates, Brookhaven #
# National Laboratory. All rights reserved. #
# #
# Redistribution and use in ... |
# code was taken from here:
# https://github.com/pkucmus/micropython-pms7003/
#
# MIT License
#
# Copyright (c) 2018 <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 restricti... |
import sys
import os
import json
from os import path, mkdir, listdir, rename, environ, rmdir
class OrganiseDesktop():
"""
Contains desktop organisation helper functions
"""
extensions = {}
separator = '/'
desktopdir = ''
Alldesktopdir = None
def __init__(self, extensions):
... |
#!/usr/bin/env python3
"""Classifier-free guidance sampling from a diffusion model."""
import argparse
from pathlib import Path
from PIL import Image
import torch
from torch import nn
from torch.nn import functional as F
from torchvision import transforms
from torchvision.transforms import functional as TF
from tqdm... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
"""
Working with PSID in python
@author : <NAME> <<EMAIL>>
@date : 2015-02-04 09:02:56
use the read_csv option `usecols` to only keep what we need
"""
import re
import os
import gc
import os.path
import zipfile
import requests
import lxml.html
import numpy as np
import pandas as pd
# ----------- #
# Downloading ... |
# Copyright 2018 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... |
# Copyright 2015-2016 Stanford 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 ... |
# Copyright 2014 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.
"""Utility file for pretty printing xml file.
The function PrettyPrintXml will be used for formatting both histograms.xml
and actions.xml.
"""
import sys
i... |
# 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
import os
import random
import time
from types import SimpleNamespace
import numpy as np
import torch
import torch.nn.function... |
import time
import pytest
from helpers.cluster import ClickHouseCluster
from helpers.test_tools import TSV
cluster = ClickHouseCluster(__file__)
zero = cluster.add_instance("zero", user_configs=["configs/users.d/settings.xml"],
macros={"cluster": "anime", "shard": "0", "replica": "zero"},... |
# -*- coding: utf-8 -*-
from typing import Dict, Any, Callable, Union, Tuple
import os
import logging
import click
import colorclass
from .exceptions import NotCallableError
logger = logging.getLogger(__name__)
def _return_input(value: Any) -> Any:
"""Helper to return the input. This can be used as a valid c... |
import os
import sys
sys.path.append('..')
from beepose.utils.util import NumpyEncoder, rotate_bound2,distance_point,distance_line_point, read_json,save_json, dets2boxes,boxes2dets,non_max_suppression_slow
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import json
import glob,os
import pyl... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2020, <NAME> <<EMAIL>>
# Copyright: (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
DOCUMENTATION =... |
#!/usr/bin/python3
import operator
import sys, os
import json
sys.path.append(os.getcwd())
sys.path.append("..")
import log
import log.logger
import traceback
import datetime
import sqlalchemy
import stmanage
import requests
import comm
import comm.error
import comm.result
import comm.values
from comm.result import res... |
import os
import subprocess
import sys
import time
from concurrent.futures.process import ProcessPoolExecutor
from pathlib import Path
import click
import networkx as nx
from tqdm import tqdm
from pipeline.dag import Scheduler
from pipeline.exceptions import TaskError
from pipeline.hashing import compare_hashes_of_ta... |
import sys,os,pickle,argparse
import numpy as np
from models import *
from sklearn.model_selection import KFold
#deprecated
#from sklearn.cross_validation import KFold
from scrape import *
import argparse
from torch.multiprocessing import Pool
from random import shuffle
def fit(X,Y,model,criterion= nn.NLLLoss(),epochs... |
import itertools
import numpy as np
import torch
from torchvision.utils import make_grid
import plac
from pathlib import Path
from .data.loader import encode_batch_of_pairs, load_processed_train_batch
from .utils.plot import plt, cm, sns
from .utils.loading import load_model_skeleton
CMAPS = {
"velocity": cm.vi... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from dataclasses import dataclass, field
from enum import Enum
from typing import Any, Dict, List, Optional
import cloudpickle # type: ignore
import hydra
import omegaconf
import pkg_resources
import ray
from hydra.core.config_store import ConfigS... |
import random
class Adventurer:
"""
The adventurer has a finite carry capacity. They cannot carry more than their carry_weight. They also contain
a coin_purse to keep all of their different coins that sum up to a total value.
"""
def __init__(self, carry_weight):
self.carry_weight = car... |
import csv
import json
import time
import itertools
from datetime import timedelta
from django import http
from django.core.exceptions import PermissionDenied
from django.core.files.storage import get_storage_class
from django.db.transaction import non_atomic_requests
from django.utils.cache import add_never_cache_he... |
import datetime
import json
import threading
import uuid
from collections import defaultdict
from copy import deepcopy
from dictdiffer import diff
from inspect import signature
from threading import Lock
from pathlib import Path
from tzlocal import get_localzone
from .logger import logger
from .settings import CACHE_... |
import attr
import datetime
from ._abc import ThreadABC
from . import _user
from .._common import attrs_default
from .. import _util, _session, _graphql, _models
from typing import Sequence, Iterable, Set, Mapping
@attrs_default
class Group(ThreadABC):
"""Represents a Facebook group. Implements `ThreadABC`.
... |
import csv
import copy
import json
import logging
import random
from collections import defaultdict
import torch
from torch.nn.utils.rnn import pad_sequence
MAX_CONTEXT_LEN = 50
logger = logging.getLogger(__name__)
def pad_squeeze_sequence(sequence, *args, **kwargs):
"""Squeezes fake batch dimension added by... |
# Flexbuffer decoder in python
import struct
from typing import Any, List, Optional
from enum import IntEnum
#
# Some constants from flexbuffer.h
#
# These are used in the lower 2 bits of a type field to determine the size of
# the elements (and or size field) of the item pointed to (e.g. vector).
class BitWidth(Int... |
"""Application logic for the SMS credit transfer service.
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file ... |
from torch.utils.data import SequentialSampler, DataLoader
from tqdm import tqdm
from seqeval.metrics import f1_score, classification_report
import torch
import torch.nn.functional as F
def parseLabels(string):
return string.split(",")
def str2bool(v):
if isinstance(v, bool):
return v
if v.lower(... |
import functools
from math import log2, ceil
import torch
import torch.nn as nn
from torch.autograd import Function
from torch.nn import functional as F
import numpy as np
from .switch_norm import SwitchNorm1d, SwitchNorm2d, SwitchNorm3d
###############################################################################... |
"""
Encapsulates the functionality for representing
and operating on the chess environment.
"""
import copy
import enum
from logging import getLogger
import chess.pgn
import numpy as np
logger = getLogger(__name__)
# noinspection PyArgumentList
Winner = enum.Enum("Winner", "black white draw")
# input planes
# noins... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
def get_jenv():
import frappe
if not getattr(frappe.local, 'jenv', None):
from jinja2 import Environment, DebugUndefined
# frappe will be loaded last, so app templates wil... |
"""
User Interface part of nuqql
"""
import curses
import curses.ascii
import datetime
import logging
from typing import TYPE_CHECKING, Any, Callable, Optional
import nuqql.config
import nuqql.conversation
if TYPE_CHECKING:
# pylint: disable=cyclic-import
from nuqql.buddy import Buddy # noqa
logger = logg... |
"""The routes accepted by the RESTful API
This is the module that contains the routes accepted
by the API.
the app's cache and configuration. Also, it includes
the clients used by other modules like the database
client and the storage client. Generally, this includes
all the global (shared) objects (Singleton pattern... |
# To gradually migrate to mypy we aren't setting these globally yet
# mypy: disallow_untyped_defs=True
# mypy: disallow_untyped_calls=True
import argparse
import code
import collections
import logging
import sys
import curtsies
import curtsies.events
import curtsies.input
import curtsies.window
from . import args as... |
"""Xiaomi aqara magic cube device."""
import logging
from zigpy.profiles import zha
from zigpy.zcl.clusters.general import (
AnalogInput,
Groups,
Identify,
MultistateInput,
Ota,
Scenes,
)
from .. import LUMI, BasicCluster, PowerConfigurationCluster, XiaomiCustomDevice
from ... import CustomClu... |
# Copyright (c) 2009, 2010, 2011 Nicira, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
"""
A module to handle metrics
"""
import copy
import json
import numbers
from functools import partial
from typing import Any, Dict
import numpy as np
from utils import pairwise
def format_time(seconds):
""" Format time in h:mm:ss.ss format """
hour = 60 * 60
hours = int(seconds // hour)
minutes = ... |
#!/usr/bin/env python3
import os
import pathlib
import shutil
import subprocess
import zipfile
from typing import Tuple
import PIL.Image
import PIL.ImageFile
import PIL.ImageFilter
import eyed3
import rarfile
from apefind.util import script
log = script.get_logger()
def parse_args(args=None, namespace=None):
... |
#!/usr/bin/python
# Copyright 2017 the V8 project 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 argparse
import math
import multiprocessing
import os
import random
import subprocess
import sys
import tempfile
# Configuration.... |
import os
import re
import textwrap
from pathlib import Path
import moderngl
import numpy as np
from .. import config
from ..utils import opengl
from ..utils.simple_functions import get_parameters
SHADER_FOLDER = Path(__file__).parent / "shaders"
shader_program_cache: dict = {}
file_path_to_code_map: dict = {}
__al... |
#! /usr/bin/python3
import argparse
import logging
def d(x1, y1, x2, y2):
"""Manhattan distance between (x1,y1) and (x2,y2)"""
return abs(x2 - x1) + abs(y2 - y1)
class Score(object):
def __init__(self):
self.raw_score = 0
self.bonus_score = 0 # points obtained from bonus
self.t... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from empiricaldist import Pmf
from scipy.stats import gaussian_kde
from scipy.stats import binom
from scipy.stats import gamma
from scipy.stats import poisson
def values(series):
"""Make a series of values and the number of times they appear... |
"""
buzzword explorer: helpers and utilities
"""
import json
import os
from django.conf import settings
import pandas as pd
from buzz.constants import SHORT_TO_COL_NAME, SHORT_TO_LONG_NAME
from buzz.corpus import Corpus
from explore.models import Corpus as CorpusModel
from compare.models import PDF
from .strings imp... |
# Copyright 2019 TerraPower, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
# Script này xử lý dữ liệu địa chỉ trong file "address_thongtincongty_toan-quoc.csv"
# Dữ liệu địa chỉ sẽ phân ra các trường thôn xóm đường, phường xã, quận huyện, tỉnh tp
import os
from collections import defaultdict
data_path = os.path.join(os.path.dirname(__file__), '../data')
def get_provinces_districts_wards():
... |
from collections import Counter
from copy import copy
import json
import numpy as np
import re
import logging
from stanza.models.common.utils import ud_scores, harmonic_mean
from stanza.utils.conll import CoNLL
from stanza.models.common.doc import *
logger = logging.getLogger('stanza')
def load_mwt_dict(filename):
... |
""" Function to create the Rocket
The rocket_builder.py file contains the build function to
build the Rocket. Moreover, it contains the preprocess
and postprocess functions that will be added to the model.
"""
from __future__ import division
import json
import types
import os
import cv2
import numpy as np
import PIL
... |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import argparse, glob, json
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.offsetbox import *
from matplotlib.patches import *
from PIL import Image
def load_results(path):
res = []
skip_count = 0... |
# -*- coding: utf-8 -*-
#
#
# module for calculating geometry parameters and magnetic aspect
# angle of radar targets monitored by KAIRA VHF at Kilpisjärvi - Finland.
#
# use aspect_elaz or aspect_txty to calculate aspect angles of targets
# specified by (el,az) or (tx,ty) angles
#
# Created by <NAME> on 11/29/08.
# ... |
"""
This file creates a GUI that provides a front-end for the MatPy program.
"""
"""Ignores all warnings (Remove this to debug)"""
import warnings
warnings.filterwarnings("ignore")
"""Tkinter for GUI"""
import Tkinter as tk
from Tkinter import Entry
import tkFileDialog
from Tkinter import N, S, E, W
"""Library for g... |
from parlaparser import settings
from parlaparser.utils.parladata_api import ParladataApi
from collections import defaultdict
from datetime import datetime
import logging
import editdistance
class NoneError(Exception):
pass
class DataStorage(object):
people = {}
organizations = {}
votes = {}
m... |
"""
Module with utilities
Author: <NAME>
Email: <EMAIL>
"""
from ..tools import geometry
import os
import shutil
import subprocess
import contextlib
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem
import re
import logging
logger = logging.getLogger(__name__)
def translateToceroZcoord(mo... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2011 <NAME>
# Copyright (C) 2011 Nicira, Inc
# Copyright 2011 OpenStack LLC.
# 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
# ... |
import operator
VALID_STYLES = ['JACoW_Abstract_Heading',
'JACoW_Author List',
'JACoW_Body Text Indent',
'JACoW_Bulleted List',
'JACoW_Numbered list',
'JACoW_Paper Title',
'JACoW_Reference #10 onwards',
'JA... |
# This script produces custom wrappers for XGBoost and Lasagne modules (to generate sklearn-like interface)
# The implementation of Lasagne (with some custom adjustments) is adapted from <NAME>'s solution
# to Kaggle's Otto Product Classification Challenge which can be found here https://github.com/ahara/kaggle_otto
#... |
"""Environment wrapper class for logging episodes.
This can be used to record data from a subject playing the task. See
../../moog_demos/restore_logged_data.py for an example of how to read log files.
Note: This logger records everything about the environment, which can be a lot
of data (depending on the task). If yo... |
import torch
import torch.nn as nn
from torch.distributions.logistic_normal import LogisticNormal
from models.base_model import BaseModel
from models.input_encoders import get_input_encoder
import utils as u
class ConvolutionalVAE(BaseModel):
def __init__(
self,
input_width,
input_height,
... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 07 11:51:55 2015
@author: agirard
"""
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
# Embed font type in PDF
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
##############################################... |
#!/usr/bin/python3
# Importing modules
print("[PROGRAM] Importing modules...")
import subprocess
import sys
import os
import platform
import json
import stat
import time
from multiprocessing import Process
# These variables are used to see what libraries are or aren't installed
cv2_error = False
pygui_error = False
... |
import sys
import os
import numpy as np
import cv2
import torch
from model import *
from scipy.ndimage.filters import gaussian_filter
from loss import kldiv, cc, nss
import argparse
from torch.utils.data import DataLoader
from dataloader import DHF1KDataset
from utils import *
import time
from tqdm import tqdm
from to... |
#!/usr/bin/env python
# -*- coding: utf-8; mode: python; -*-
"""Module providing access to third party resources.
Attributes:
LCSI (dict): mapping from verb to a set of classes
BROWN_CLUSTERS (dict): mapping from word to a set of
Brown clusters
CONNS (set): set of explcit connectives
CONNTOK2CONN (defaul... |
import numpy as np
import pandas as pd
import optuna
import sklearn.ensemble as ensemble
import sklearn.metrics as metrics
from sklearn.model_selection import train_test_split
from itertools import chain
int_dtype_list = ['int8', 'int16', 'int32',
'int64', 'uint8', 'uint16', 'uint32', 'uint64']
float... |
""" PyPackGen Main Module
"""
import os
import jinja2
def create_readme(package_name):
"""Creates the README.md for the package
"""
template_contents = '''# {{ package_name }}
## Overview
The {{ package_name }} does this. Fill this part out to give more information
about what it is supposed to do.
##... |
#!/usr/bin/python2.5
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
#
# agent/adapters/aigents/__init__.py - adapter integrating different sub-services of Aigents web service,
# such as RSS feeding, social graph discovery, summarizing text extraction by pattern and entity attribution
#
# Copyright (c) 2017 SingularityNET
#
# Distributed under the MIT software license, see LICENSE file.... |
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework_swagger import renderers
from rest_framework.schemas import SchemaGenerator
from urllib.parse import urljoin
import yaml
import coreapi
from rest_framework.decorato... |
# Lint as: python3
# Copyright 2020 The TensorFlow Probability 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 ... |
from datetime import timedelta
import sys
import pytest
try:
import shapely
import shapely.geometry
SHAPELY_TYPES = (
shapely.geometry.GeometryCollection,
shapely.geometry.LineString,
shapely.geometry.LinearRing,
shapely.geometry.MultiPolygon,
shapely.geometry.Poin... |
"""
app.py
A simple WebRTC Call control server that shows the basics of
getting a video call up and running between a browser and an outbound PSTN call
@copyright Bandwidth INC
"""
import configparser
import json
from bandwidth.bandwidth_client import BandwidthClient
from bandwidth.exceptions.api_exception import ... |
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Some code is from https://github.com/princeton-vl/pose-ae-train/blob/454d4ba113bbb9775d4dc259ef5e6c07c2ceed54/utils/group.py
# Written by <NAME> (<EMAIL>)
# Modified by <NAME> (... |
# Author: <NAME>
# See the LICENSE file for legal information regarding use of this file.
"""Classes for reading/writing binary data (such as TLS records)."""
from __future__ import division
import sys
import struct
from struct import pack
from .compat import bytes_to_int
class DecodeError(SyntaxError):
"""Exc... |
#@title 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... |
# Copyright 2018 The TensorFlow Probability 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 o... |
import json
import requests
# Auth data
customer_token = None
api_token = None
# Account info
customer_tokens = None
retention = None
subdomain = None
volume_limit = None
# Exception related stuff
class LogglyError(Exception):
'''
Base exception with no function outside of identifying the error as one from
... |
#from Python
import time
import csv
import os
import math
import numpy as np
import sys
from shutil import copyfile
#from Pytorch
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torchvision import datasets
from torchvision import transforms... |
# coding=utf-8
# pynput
# Copyright (C) 2015-2017 <NAME>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# Th... |
# -*- coding:utf-8 -*-
from __future__ import division
import os
import pty
import time
from collections import defaultdict
from contextlib import contextmanager
from subprocess import PIPE, Popen, call
from threading import Lock, Thread
from django.db import DEFAULT_DB_ALIAS, connections
from django.utils import six... |
"""
CPC V2
======
"""
import math
from argparse import ArgumentParser
from typing import Optional
import torch
from pytorch_lightning import LightningModule, Trainer, seed_everything
from pytorch_lightning.utilities import rank_zero_warn
from torch import optim as optim
from pl_bolts.datamodules.stl10_datamodule impo... |
import itertools as it
import logging
import queue
import socket
import warnings
from typing import BinaryIO, Dict, List, Tuple
from ._base_connection import BaseBrokerConnection
from .protocol.constants import ApiKey
from .protocol.request import Request, Response
from .protocol.serializers import SUPPORTED_API_VERSI... |
# MODULE: TypeRig / Core / Point (Object)
# -----------------------------------------------------------
# (C) <NAME>, 2017-2021 (http://www.kateliev.com)
# (C) Karandash Type Foundry (http://www.karandash.eu)
#------------------------------------------------------------
# www.typerig.com
# No warranties. By using t... |
#!/usr/bin/env python3
from enum import Enum
from typing import Any, Tuple, Union
import numpy as np
import torch
from torch import Tensor
from captum.log import log_usage
from ..._utils.common import (
ExpansionTypes,
_expand_additional_forward_args,
_expand_target,
_format_additional_forward_args,
... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
from onnxruntime.capi.onnxruntime_inference_collection import OrtValue
f... |
import numpy as np
from collections import defaultdict
import random
import os
'''
code book:
circle: 0
rect: 1
tri: 2
ellipse: 3
star: 4
loop: 5
red: 6
green: 7
blue: 8
yellow: 9
cyan: 10
magenta: 11
large: 12
small: 13
upper_left: 14
upper_right: 15
lower_left: 16
lower_right: 17
'''
def get_combination(samples, ... |
import pandas as pd
import numpy as np
import geopandas as gpd
import math
import pyproj
from math import sqrt
from shapely.geometry import LineString, Point, Polygon, mapping
from shapely.ops import unary_union, transform, nearest_points
from shapely.affinity import scale
from functools import partial
pd.set_option("... |
from __future__ import print_function
from scipy.interpolate import interp1d
import numpy as np
import math
from aeropy.airfoil_module import CST
def taper_function(eta, shape = 'linear', points = {'eta':[0,1], 'chord':[1,.7]}):
"""Calculate chord along span of the wing.
- If linear, taper function... |
from datetime import timedelta
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Series,
)
import pandas._testing as tm
from pandas.core.indexes.timedeltas import timedelta_range
def test_asfreq_bug():
df = DataFrame(data=[1, 3], index=[timedelta(), time... |
# coding:utf-8
import os
from app.common.get_pressed_pos import getPressedPos
from app.common.model_utils import testModel
from PyQt5.QtCore import QFile, QPoint, Qt, pyqtSignal
from PyQt5.QtGui import (QBrush, QColor, QFont, QFontMetrics, QMouseEvent,
QPainter, QPen, QPixmap, QPolygon)
from P... |
import asyncio
import os
import signal
import time
from dataclasses import dataclass, field
from typing import Any, List, Optional
import gevent
import gevent.util
import structlog
from gevent._tracer import GreenletTracer
from gevent.hub import Hub
from raiden.exceptions import RaidenUnrecoverableError
LIBEV_LOW_PR... |
# import the necessary packages
#from picamera.array import PiRGBArray
#from picamera import PiCamera
import time
import math
import datetime
import cv2
# place a prompt on the displayed image
def prompt_on_image(txt):
global image
cv2.putText(image, txt, (10, 35),
cv2.FONT_HERSHEY_SIMPLEX, 0.35, (0, 0, 25... |
# kalo gak tau cara gunain nya gak usah pake ya asw
# kalo ada yang error fix sendiri aja :v
# only marshal or zlib base64 from https://github.com/Dumai-991/
#open scored
import os
import re
import sys
try: import uncompyle6
except: os.system("python -m pip install uncompyle6")
########################################... |
import torch
from torchvision import transforms
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
from utils.utils import *
import json
import cv2
import copy
import numpy as np
import os
from tool.darknet2pytorch import *
from tqdm import tqdm
from skimage import measure
from argparse import ArgumentPa... |
''' Functions relating to HDR mode '''
import numpy as np
import astropy.units as u
import astropy.constants as cr
from astropy.modeling.blackbody import FLAM
from astropy.convolution import convolve_fft, Gaussian2DKernel
# Set telescope details
epd = 75 * u.cm
area = np.pi * (0.5*epd)**2
reflectivity = 0.9
mirrors = ... |
import argparse
import collections
import os
import os.path
import re
import sys
INDENT = 2
LINE_WRAP_CHARS = ', '
NON_NAME_PATTERN = re.compile(r'[^A-Za-z0-9_]')
SCALE_SIZE_PATTERN = re.compile(r'@[0-9]+')
Entry = collections.namedtuple('Entry', ['name', 'data', 'cname'])
STRUCT_DECL = '''struct {0} {{
{1}{0}(const c... |
from datetime import timedelta
from functools import partial
from uuid import uuid4
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import UserManager as DjangoUserManager
from django.db import models, transaction
from django.db.models import F, Q
fr... |
# -*- coding: utf-8 -*-
################################################################################
# Copyright (c) 2017 McAfee Inc. - All Rights Reserved.
################################################################################
from __future__ import absolute_import
import logging
from dxlclient import R... |
# 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 u... |
"""
utilities for model management in tf/keras
"""
# python imports
import itertools
from tempfile import NamedTemporaryFile
# third party imports
import numpy as np
from tqdm import tqdm_notebook as tqdm
import tensorflow as tf
from tensorflow import keras
import tensorflow.keras.backend as K
import tensorflow.keras... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
#CARD
#SUIT,RANK,VALUE
#Creating a value of dictionaries
import random
suits = ('Hearts', 'Diamonds', 'Spades', 'Clubs')
ranks = ('Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Jack', 'Queen', 'King', 'Ace')
values = {'Two':2, 'Three':3, 'Four'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.