text stringlengths 6.04k 39.5k |
|---|
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import prince
from sklearn.decomposition import PCA, SparsePCA
from sklearn.manifold import TSNE
from matplotlib.ticker import MaxNLocator
import seaborn as sns
from IPython.core.display import display
from sklearn.covariance import GraphicalLassoCV... |
"""
Test type checking validations
"""
from ubiquiti_config_generator import type_checker
def test_is_string_boolean():
"""
.
"""
assert not type_checker.is_string_boolean("true"), "String true isn't boolean"
assert not type_checker.is_string_boolean("false"), "String false isn't boolean"
asse... |
import logging
from datetime import datetime
import boto
from sqlalchemy import insert, literal, not_, func, text, update, cast, String, or_, desc
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.orm.exc import NoResultFound
from dart.context.locator import injectable
from dart.model.exception import D... |
import logging
import ctypes
from typing import Any, Union, Optional, List, Tuple, Dict, Iterable
import gi
from gi.repository import GLib
import os
import functools
Fields = dict
FieldsType = Dict[str, Any]
class Logger:
"""
Class that contains the state (and methods) used to
accept logs from GLib and ... |
from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from torch.nn import Parameter, ReLU, Tanh, BatchNorm2d, ConvTranspose2d, Conv2d, Sequential, Sigmoid
from torch.nn import LSTM, BatchNorm1d, Linear, Parameter
from .filtering import atan2, wiener
fr... |
import torch
from tqdm import tqdm
import torch.nn.functional as F
from lista_stop.common.consts import DEVICE
from lista_stop.common.utils import max_onehot
import math
def MyMSE(x_hat, x):
return torch.sum((x_hat - x) ** 2, dim=-1).view(-1)
class ListaModelMLE:
def __init__(self, args, lista_net, optimiz... |
#!/usr/bin/env python
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Vte', '2.91')
from gi.repository import Gtk, Gdk, Pango, Vte, GLib, GdkPixbuf
from signal import signal, SIGHUP
import traceback
import dbus
import festival
import yaml
import re
from enum import Enum
from typing import List, AnyStr... |
"""
Weighted graphical model:
A graphical model (GraphModel) augmented with an elimination order and weights (temperatures) for each Xi
Corresponds to an inference problem, Phi_w = \log [ ... \wsum_{x_i} ... \exp[ \sum_r \theta_r(X_r) ] ... ]
Always maintains factors in log form (theta_r)
Constructor takes factors, o... |
import os
import warnings
from typing import Tuple, List
import matplotlib.pyplot as plt
import numpy as np
import tifffile
from PIL import Image
from dask import delayed
from scipy import ndimage, sparse
# from IPython.display import display, Image
from sklearn.decomposition import PCA
from cidan.LSSC.functions.embe... |
#!/usr/bin/env python3
import json
import sys
import os
(_, fn) = sys.argv
## Coq can produce very deep JSON data structures..
sys.setrecursionlimit(10000)
## XXX hack for now
import_prefix = 'codegen/'
extra_mods = {
'FS': ['Nat',],
'Compare_dec': ['Nat',],
}
extra_imports = {
'Word': ['... |
#!/usr/bin/python2
from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import uhd
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from time import sleep
from threading import Thread
from datetime import datetime
from sigmf.sigmffile import S... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import Colormap
from sklearn.multiclass import OneVsRestClassifier
from sklearn.svm import SVC
from sklearn.linear_model import LinearRegression
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_auc_score
from sk... |
class Node:
def __init__(self,data):
self.left=None
self.right=None
self.data=data
def preOrder(root):
if(root!=None):
print(root.data,end=" ")
preOrder(root.left)
preOrder(root.right)
def postOrder(root):
if(root!=None):
postOrder(root.lef... |
# Copyright (c) 2020-2021 <NAME>.
# Licensed under the MIT License.
"""Unit tests for matrices."""
import pyray
from .test_pyray import TestPyray
class TestMatrices(TestPyray):
"""Test case for matrices."""
def test_4x4_matrix(self):
"""Test constructing and inspecting a 4x4 matrix."""
m = ... |
import datetime
import logging
import requests
from aprsd import messaging, plugin, plugin_utils, trace
import aprsd_repeat_plugins
LOG = logging.getLogger("APRSD")
API_KEY_HEADER = "X-Api-Key"
# Copied over from haminfo.utils
# create from
# http://www.arrl.org/band-plan
FREQ_BAND_PLAN = {
"160m": {"desc": "... |
import numpy as np
import pathlib
import attr
import typing as tp
import nptyping as npt
import abc
import scann
from scipy.special import softmax
if tp.TYPE_CHECKING:
import os # noqa
PathLike = tp.Union[str, "os.PathLike[str]"]
NUM_LEAVES_TO_SEARCH = 300
PRE_REORDER_NUM_NEIGHBOURS = 250
default_rng = np.ra... |
#!/usr/bin/python
import datetime
import decimal
import hashlib
import json
import time
import traceback
import types
import uuid
import random
import string
import copy
from enum import Enum
import pytz
import psycopg2
from von_pipeline.config import config
PIPELINE_SYSTEM_TYPE = 'PPL'
CORP_BATCH_SIZE = 3000
# ... |
import os
import json
import requests
import datetime
from django.contrib.auth import logout, authenticate, login
from django.core.mail import EmailMessage
from django.contrib.auth.hashers import check_password
from django.contrib.auth.mixins import LoginRequiredMixin, AccessMixin
from django.http import HttpResponseRe... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# 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 appli... |
import random
import time
import simpy
import logging
import copy
import json
import numpy as np
import pandas as pd
from transactions import Transaction
from blocks import Block
from network_state_graph import network_creator, csv_loader
from monitor import creater_logger
# Time Frame= 1:10ms
MINING_TIME = 2
BLOCKSIZ... |
import sys
import pickle
import os
import itertools
from tqdm import tqdm
import networkx as nx
import numpy as np
script_dir = os.path.dirname(os.path.realpath(__file__))
if __name__ == "__main__":
sys.path.append(os.path.join(script_dir, '..', '..'))
from rnaglib.config.graph_keys import GRAPH_KEYS, TOOL, DEFA... |
# -*- coding: utf-8 -*-
"""Classes and functions for finding and reading files."""
import datetime
from glob import glob
import json
import os
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
from typing import Sequence
from typing import Set
from typing import Tuple
fr... |
# ****** Account Storage ******
# *******************************
# ****** Importing Modules ******
import hashlib
import os
import sqlite3
from contextlib import contextmanager
from tkinter import *
from tkinter import messagebox
# ****** Welcome Window ******
root = Tk()
root.geometry('300x130')
root.title('Welcom... |
"""Attention combination strategies.
This modules implements attention combination strategies for multi-encoder
scenario when we may want to combine the hidden states of the encoders in
more complicated fashion.
Currently there are two attention combination strategies flat and hierarchical
(see paper `Attention Combi... |
#!/usr/bin/env mayapy
#
# Copyright 2021 Autodesk
#
# 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... |
# coding=utf-8
# 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
# distr... |
import cs_vqe as c
import numpy as np
import scipy as sp
from scipy.optimize import minimize_scalar
from scipy.sparse import coo_matrix
import itertools
from functools import reduce
import random
from datetime import datetime
from datetime import timedelta
from copy import deepcopy
import quchem.Misc_functions.conv... |
from typing import Optional, List, Union, Tuple
import warnings
from dataclasses import dataclass
from collections import namedtuple
from collections.abc import Iterable
from numbers import Real, Integral
import numpy as np
import tensorflow as tf
from gpflow import default_float, default_jitter, Parameter, set_train... |
"""
Seed job data for Mayo microbiome report sample data.
"""
import os
import pandas as pd
from biom.table import Table as BiomTable
import nest_py.core.jobs.box_downloads as box_downloads
from nest_py.omix.jobs.seed_data import SeedFlavorData
TAXA_URL = 'https://uofi.box.com/shared/static/49gifn6o35jvajcsrmghrjy5d... |
"""
Module for data preprocessing.
Prepare & visualize raw data for further analysis.
"""
from pathlib import Path
def label_context():
"""
Add a tag to a file name (e.g., _Dir, _Undir) to differentiate between different contexts.
Files for each context should be stored in /Dir or /Undir folder.
""... |
import matplotlib
import os
import sys
# Make sure we do not open windows to show images
# TODO We need to make this call somewhere else...
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
import csv
import json
import glob
import numpy as np
# local imports
from self_driving.edit_distance_polyline import _cal... |
# Filename: dataclasses.py
# pylint: disable=W0232,C0103,C0111
# vim:set ts=4 sts=4 sw=4 et syntax=python:
"""
Dataclasses for internal use. Heavily based on Numpy arrays.
"""
import itertools
import numpy as np
from numpy.lib import recfunctions as rfn
from .dataclass_templates import TEMPLATES
from .logger import g... |
"""functions for cross validated ridge regression"""
from __future__ import print_function
import functools
import numpy as np
import scipy
from glabtools.cluster import cmap
from .. import npfast
from .. import utils
from . import ridge
from . import solvers
def cv_ridge(Xtrain=None, Ytrain=None, Xtest=None, Yt... |
#!/usr/bin/env python3
import unittest
import numpy as np
from scipy import signal
import analysis
import simulate_behavior as sim_behav
import simulate_experiments as sim_exp
from analysis_methods import shuff_time, alternatives, utils
np.random.seed(0) # Make sure the randomization tests are reproducible
class T... |
import shutil
import time
import tempfile
import os
import json
from random import getrandbits
from collections import namedtuple
import numpy as np
from tvm import nd
from tvm.error import TVMError
from tvm.autotvm.measure.measure import MeasureResult, MeasureErrorNo, Builder
from tvm.autotvm.measure.measure_methods... |
import argparse
import json
import numpy as np
import sys
import os
import time
sys.path.append('../')
from utils.progressbar import ProgressBar
from utils.common import init_logger, logger, seed_everything
from torch.nn.utils.rnn import pad_sequence
from torch.utils.data import Dataset, DataLoader
from transformers ... |
#!/usr/bin/env python3
# Copyright (c) 2017 Anki, 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 in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
#!/usr/bin/python
import sys, time, os, pdb, argparse, pickle, subprocess, glob, cv2
import numpy as np
from shutil import rmtree
import scenedetect
from scenedetect.video_manager import VideoManager
from scenedetect.scene_manager import SceneManager
from scenedetect.frame_timecode import FrameTimecode
from scenedetec... |
#!/usr/bin/env python3
import numpy as np
import os
import pickle
from astropy.io import fits
from .align_images import AlignImages
from .inject_images import InjectCompanion
from .my_warnings import warnings
from .subtract_images import SubtractImages
from .visualize_images import VisualizeImages
KR_INJECT_DOCSTR =... |
from _ast import List
from collections import deque
from copy import deepcopy, copy
from math import copysign
from platform import version
from typing import Iterable, Dict, Set
from typing import Tuple, Any
class DSU:
def __init__(self, unions: Iterable[Tuple[Any]] = None, items: Iterable[Any] = None):
s... |
# -*- coding: utf-8 -*-
# pylint: disable-msg=C0103
"""
Module that contains utility functions to the graphical representation of
results.
"""
__author__ = "<NAME>"
__date__ = "$30-nov-2011 18:01:49$"
import kardioml.segmentation.teijeiro.knowledge.observables as o
import kardioml.segmentation.teijeiro.knowledge.abst... |
import argparse
import cv2
import numpy as np
import torch
from models.with_mobilenet import PoseEstimationWithMobileNet
from modules.keypoints import extract_keypoints, group_keypoints
from modules.load_state import load_state
from modules.pose import Pose, track_poses
from val import normalize, pad_width
def infe... |
#Naive Machine Translation and LSH
nltk.download('stopwords')
nltk.download('twitter_samples')
import pdb
import pickle
import string
import time
import gensim
import matplotlib.pyplot as plt
import nltk
import numpy as np
import scipy
import sklearn
from gensim.models import KeyedVectors
from nltk.corpus import st... |
# Copyright 2019 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import typing
import warnings
import numpy as np
from tifffile import lazyattr
Spacing = typing.Tuple[typing.Union[float, int], ...]
_DEF = object()
def minimal_dtype(val: int):
"""
Calculate minimal type to handle value in array
:param val:
:return: minimal dtype to handle given value
:rtype:... |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import cProfile
import pstats
from collections import namedtuple
from itertools import combinations, product, islice
import numpy as np
from examples.pybullet.pr2_belief.problems import BeliefState
from examples.pybullet.utils.pybullet_tool... |
import argparse
import torch.multiprocessing as mp
import math
import sys
import time
import os
import torch
import torch.distributed as dist
import torch.nn as nn
from torch.distributed.nn import RemoteModule
from torch.utils.data import DataLoader
import torch.distributed.rpc as rpc
from torch.distributed.optim impo... |
"""
Get calibration parameters for given trip(s)
Tested with Python 3.x
"""
import argparse
import os
import math
import sys
import numpy as np
from numpy.linalg import norm
from statsmodels.tsa.api import SimpleExpSmoothing
import matplotlib.pyplot as plt
import bisect
import utils
import constants
debug = True ... |
# standard imports
from typing import Union, List, Iterator, Any
from abc import abstractmethod
from pathlib import Path
import os
import sys
import logging
import time
import datetime
import threading
# third party imports
import numpy as np
# toolbox imports
from .image import Image, Imagelike, ImageDisplay, ImageO... |
#!/usr/bin/env python3
"""Module containing the BindingSite class and the command line interface."""
import argparse
from biobb_common.generic.biobb_object import BiobbObject
from biobb_common.configuration import settings
from biobb_common.tools import file_utils as fu
from biobb_common.tools.file_utils import launc... |
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %% [markdown]
# Imports
# %%
import pennylane as qml
from pennylane import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import matplotlib.pyplot as plt
from PIL import Image
from IPython.dis... |
"""
Utilities for data augmentation
"""
import sys
from collections import defaultdict
import json
import copy
import re
import random
from .fix_label import fix_general_label_error
EXPERIMENT_DOMAINS = ["none", "hotel", "train", "restaurant", "attraction", "taxi"]
DOMAIN_INDICES = dict()
for domain in EXPERIMENT_DOM... |
#keep full resolution range image
import numpy as np
import pickle as pkl
from pdb import set_trace
import os
from kitti_utils import Calibration
from pathlib import Path
import matplotlib.pyplot as plt
import tqdm
import collections
import argparse
from queue import Queue
from threading import Thread
def parse_args(... |
import os
from itertools import combinations
from lxml import etree
from queue import Queue
import math
import matplotlib.pyplot as plt
from opendrive2lanelet.opendriveparser.elements.roadPlanView import PlanView
def plot_polygon(poly):
plt.plot(*poly.exterior.xy)
def all_different_pairs(iterable):
"s -> (... |
# -*- coding: utf-8 -*-
'''
Functional tests.
.. versionadded:: 0.1.0
'''
import unittest
import os
import shutil
from pyramid import testing
from webtest import TestApp
import crabpy_pyramid
from crabpy_pyramid import main
def as_bool(value):
'''
Cast a textual value from a config file to a boolean.
W... |
#!/usr/bin/env python
"""
COSMO TECHNICAL TESTSUITE
This module implements the Test baseclass which can be used to setup, run and
evaluate a single test.
"""
# built-in modules
import os, sys, copy, math, re, glob
# private modules
from ts_error import StopError, SkipError
from ts_utilities import dir_path, status_... |
import jsonlines
import pandas as pd
import numpy as np
from collections import Counter
from .triplet_utils import TripletUtils
def get_relations_and_relation_occurrence_counts_in_dataset(dataset):
r = []
for ds in dataset:
ids = get_rels_in_sample(ds)
r.extend(ids)
c = Counter(r)
... |
import torch
from torch import nn
from typing import Callable, Optional, Tuple, Union
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
from mi_module_zoo.relationalmultiheadattention import RelationalMultiheadAttention
from mi_module_zoo.utils.activation import get_act... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Collapsible accordion widget similar to Maya Attribute Editor
"""
from __future__ import print_function, division, absolute_import
import logging
from Qt.QtCore import Qt, Signal, QPoint, QRect, QMimeData, QEvent
from Qt.QtWidgets import QApplication, QWidget, QGro... |
# Copyright 2017 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... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import datetime
from haul.core import *
def put(t):
print('HAULWriter_bas:\t' + str(t))
PAT_INFIX = [
'+', '-', '/', '*', '%',
'&', 'and', 'or', '|', '||', '^'
'>', '<', '==', '>=', '<=',
]
DIALECT_GW = 0
DIALECT_MS = 1
class HAULWriter_bas(HA... |
# -*- coding: utf-8 -*-
# test_od_reading.py
from __future__ import annotations
import time
import numpy as np
import pytest
from pioreactor.background_jobs.od_reading import ADCReader
from pioreactor.background_jobs.od_reading import ODReader
from pioreactor.background_jobs.od_reading import start_od_reading
from p... |
# -*- coding: UTF-8 -*-
"""
Tencent is pleased to support the open source community by making GAutomator available.
Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain ... |
from typing import (
List, Optional, Sequence, Dict, Tuple, Any,
Generator, ClassVar, Callable, Union,
)
from enum import Enum
import os
from dataclasses import dataclass
from html.parser import HTMLParser
from collections import defaultdict
import json
from abc import ABCMeta, abstractmethod
try:
import ... |
import unittest
import datetime
import logging
from io import BytesIO
from tkp.testutil.decorators import requires_database
import tkp.db
from tkp.db.orm import DataSet, Image
from tkp.db.database import Database
from tkp.db.orm import ExtractedSource
from tkp.testutil import db_subs
from tkp.db.generic import columns_... |
import glob
import os
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element
import json
import random
START_BOUNDING_BOX_ID = 0
START_IMAGE_ID = 0
# PRE_DEFINE_CATEGORIES = {"DaoXianYiWu": 0, "DiaoChe": 1, "ShiGongJiXie": 2, "TaDiao": 3, "YanHuo":4}
# PRE_DEFINE_CATEGORIES = {"GanTa": 0}
PRE_DE... |
import os
import sys
import numpy as np
import numpy.ma as ma
import netCDF4
from netCDF4 import Dataset
#----------------------------------------------
def oiv2(lat, lon):
dlat = 0.25
dlon = 0.25
firstlat = -89.875
firstlon = 0.125
if (lon < 0):
lon += 360.
j = round( (lat - firstlat)/dlat )
i = rou... |
# coding: utf-8
#
import datetime
import hashlib
import logging
import os
import shutil
import tarfile
import humanize
import progress.bar
import requests
from logzero import logger, setup_logger
from retry import retry
from uiautomator2.version import (__apk_version__, __atx_agent_version__,
... |
'''
Gita manages multiple git repos. It has two functionalities
1. display the status of multiple repos side by side
2. delegate git commands/aliases from any working directory
Examples:
gita ls
gita fetch
gita stat myrepo2
gita super myrepo1 commit -am 'add some cool feature'
For bash auto com... |
#!python3
"""
Python 3 wrapper for identifying objects in images
Requires DLL compilation
Both the GPU and no-GPU version should be compiled; the no-GPU version should be renamed "yolo_cpp_dll_nogpu.dll".
On a GPU system, you can force CPU evaluation by any of:
- Set global variable DARKNET_FORCE_CPU to True
- Set ... |
"""Mobject representing highlighted source code listings."""
__all__ = [
"Code",
"hilite_me",
"insert_line_numbers_in_html",
]
import html
import os
from ...constants import *
from ...mobject.geometry import Dot, RoundedRectangle
from ...mobject.shape_matchers import SurroundingRectangle
from ...mobject.s... |
# Copyright (C) 2019-2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
import os
import tempfile
import shutil
import zipfile
import io
import itertools
from abc import ABC, abstractmethod
import av
import numpy as np
from pyunpack import Archive
from PIL import Image, ImageFile
# fixes: "OSError:broken data s... |
import io
import os
from pyverilog.vparser.parser import parse
import pyverilog.vparser.ast as ast
from pyverilog.ast_code_generator.codegen import ASTCodeGenerator, ConvertVisitor
def add_scheduling_signals(bsc_vdir, out_dir):
"""
Stand-alone function for adding scheduling signals to a directory of bsc-genera... |
import pytest
import pandas as pd
import numpy as np
from iguanas.rules import ConvertProcessedConditionsToGeneral, ReturnMappings
@pytest.fixture
def _data():
X_orig = pd.DataFrame(
{
'A': np.array([-1, 1, np.nan, 2] * 250),
'country': ['GB', 'US', 'FR', np.nan] * 250,
... |
# Platform-specific build configurations.
load("@protobuf_archive//:protobuf.bzl", "proto_gen")
load("@protobuf_archive//:protobuf.bzl", "py_proto_library")
load("//tensorflow:tensorflow.bzl", "if_not_mobile")
load("//tensorflow:tensorflow.bzl", "if_not_windows")
load("//tensorflow/core:platform/default/build_config_r... |
import os
import random
import re
import pandas
dic=[]
with open('amount_v1v2.dic', 'r', encoding='utf-8') as f:
lines = f.readlines()
dic.extend([l.strip() for l in lines])
print(len(dic))
regdic = []
for word in dic:
if '_' in word:
word = word.replace('_',r'[_\d]?',10**10)
# r = re.com... |
# -*- coding: utf-8 -*- #
# Copyright 2015 Google 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 a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
# -*- coding: utf-8 -*-
"""Utility module."""
from __future__ import division
import sys
import math
import numpy
from .pycm_param import *
from warnings import warn
def list_check_equal(input_list):
"""
Check equality of the input list items.
:param input_list: input list
:type input_list: list
... |
from abc import ABCMeta, abstractmethod
from dataclasses import dataclass
from typing import List, Optional, Set, Union, Tuple, Any, IO, TextIO
import uuid
import sys
import time
import atexit
from distutils.spawn import find_executable
import cryptol
from cryptol import cryptoltypes
from . import connection
from arg... |
from typing import Any, Dict, Tuple, List, Callable, Optional, Union
from collections import defaultdict
import torch
from torch.fx import (
GraphModule,
Proxy,
map_arg
)
from torch.fx.graph import (
Graph,
Node,
)
from torch.fx.node import Argument
from .quantization_types import Pattern
from ..qco... |
#########################################################################
#
# aster.py - This file is part of the Spectral Python (SPy) package.
#
# Copyright (C) 2010 <NAME>
#
# Spectral Python is free software; you can redistribute it and/
# or modify it under the terms of the GNU General Public License
# a... |
#
# Copyright (c) 2006-2013, Prometheus Research, LLC
#
"""
:mod:`htsql.core.tr.term`
=========================
This module declares term nodes.
"""
from ..util import (listof, dictof, tupleof, maybe,
Clonable, Printable, Hashable)
from ..domain import BooleanDomain
from ..error import point
fr... |
## copied from nonlinear_transform_gen.py
''' A class for the distribution of a non-linear monotonic transformation of a continuous random variable
simplest usage:
example: create log-gamma distribution, i.e. y = log(x),
where x is gamma distributed (also available in scipy.stats)
loggammaexpg = Tra... |
"""
Tests for normal_form_game.py
"""
import numpy as np
from numpy.testing import assert_array_equal
from nose.tools import eq_, ok_, raises
from quantecon.game_theory import (
Player, NormalFormGame, pure2mixed, best_response_2p
)
# Player #
LP_METHODS = [None, 'simplex', 'interior-point']
class TestPlayer... |
import contextlib
import functools
import os
import re
import glob
import time
from datetime import datetime
import typing
import attr
import click
import pendulum
import psutil
from plotman import chia, madmax
def job_phases_for_tmpdir(d: str, all_jobs: typing.List["Job"]) -> typing.List["Phase"]:
'''Return ph... |
# -*- coding: utf-8 -*-
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Spyder Language Server Protocol Client implementation.
This client implements the calls and procedures required to
communicate with a v3.0 Language Server Protoco... |
'''
Created on Oct 17, 2010
@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.
'''
from collections import defaultdict
from arelle import XbrlConst
from arelle.ModelDtsObject import ModelConcept
import os
emptySet = set()
def checkFilingDimensions(val, drsELRs):
f... |
# coding: utf-8
"""
Minimal python RPC implementation in a single file based on the JSON-RPC 2.0 specs from
http://www.jsonrpc.org/specification and LSP specs from https://microsoft.github.io/language-server-protocol/specification.
"""
__author__ = "firststef"
__email__ = ""
__copyright__ = ""
__credits__ = ["<NAME>"... |
# Copyright 2020 Google Research. 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... |
#!/usr/bin/env python
# Copyright 2017 Palo Alto Networks, 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... |
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, 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
#
# Unles... |
from benchmark import Benchmark
from invocation import Invocation
from execution import Execution
from utility import *
from shutil import copyfile
import sys, importlib
import tmptool
loaded = False
def assert_loaded():
if not loaded:
copyfile("tool.py", os.path.join(sys.path[0], "tmptool.py"))
im... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
r"""Utility functions."""
import json
import math
import os
from urllib.parse import urlparse
import urllib.request
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
import torch
import torch.nn.functional as F
EPSILON_DO... |
import numpy as np
import tensorflow as tf
from tqdm import tqdm
import logging
logging.basicConfig(level=logging.INFO)
def ln(inputs, epsilon = 1e-8, scope="ln"):
'''Applies layer normalization. See https://arxiv.org/abs/1607.06450.
inputs: A tensor with 2 or more dimensions, where the first dimension has ... |
"""Convert BDD100K to COCO format."""
import argparse
import json
import os
from functools import partial
from multiprocessing import Pool
from typing import Dict, List, Tuple
import numpy as np
from PIL import Image
from scalabel.common.parallel import NPROC
from scalabel.common.typing import NDArrayI32
from scalabe... |
#
# BaseImage.py -- Abstraction of an generic data image.
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import numpy as np
import logging
from ginga.misc import Bunch, Callback
from ginga import trcalc, AutoCuts
class ImageError(Exception):
pass
... |
import time
from absl import flags
import erdos
from leaderboard.autoagents.autonomous_agent import Track
import pylot.flags
import pylot.component_creator # noqa: I100
import pylot.operator_creator
import pylot.perception.messages
import pylot.utils
from pylot.drivers.sensor_setup import LidarSetup, RGBCameraSetu... |
# -*- coding: utf-8 -*-
#
# Copyright (c) The PyAMF Project.
# See LICENSE.txt for details.
"""
Provides the pure Python version of L{BufferedByteStream}.
Do not reference directly, use L{miniamf.util.BufferedByteStream} instead.
@since: 0.6
"""
from __future__ import absolute_import
import struct
import six
def... |
import importlib
import logging
import os
import signal
import sys
import threading
import time
import pexpect
import pexpect.fdpexpect
import serial
import subprocess
from pexpect.exceptions import TIMEOUT, EOF
from .config import PHRTOS_PROJECT_DIR, DEVICE_SERIAL, DEVICE_SERIAL_USB, rootfs
from .tools.color import... |
import itertools
import numpy as np
import os
import tensorflow as tf
import tensorflow_probability as tfp
import time
import rpy2.robjects as ro
from sklearn.metrics import roc_auc_score
from sklearn.metrics import average_precision_score
import scipy.sparse as sp
distributions = tfp.distributions
flags = tf.app.fla... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.