text stringlengths 3.07k 22.1k |
|---|
"""Inverse and source space data processing."""
import os
import os.path as op
import numpy as np
from mne import (read_label, read_labels_from_annot, read_source_spaces, Label,
SourceEstimate, BiHemiLabel, read_surface, read_epochs,
read_cov, read_forward_solution, convert_forward_s... |
import test_v1, time
from vn_test import VNFixture
from vm_test import VMFixture
from policy_test import PolicyFixture
from floating_ip import FloatingIPFixture
from tcutils.commands import ssh, execute_cmd, execute_cmd_out
from tcutils.util import *
from common.base import GenericTestBase
from common.policy.config imp... |
""" Functions to apply models.
"""
import glob
import itertools
import os
import numpy as np
import pandas as pd
from pickle5 import pickle
from scipy.special import softmax
from sklearn.utils import shuffle
from tqdm import tqdm
def MAP_score(source_id, target_labels, prediction):
""" Function to compute the M... |
import math
import time
import logging
import bjointsp.objective as objective
from collections import defaultdict
from bjointsp.heuristic import heuristic
from bjointsp.heuristic import improvement
from bjointsp.heuristic import shortest_paths as sp
from bjointsp.overlay.instance import Instance
# global variables fo... |
#
# Copyright 2014 Quantopian, 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 agreed to in wr... |
#
# Copyright (c) 2015 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2021 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
import numpy as np
import pandas as pd
from pandapower.results_branch import _get_branch_results, _get_branch_results_3ph
from pa... |
import logging
from atlasclient.client import Atlas
from atlasclient.exceptions import BadRequest
from atlasclient.models import Entity, EntityCollection
# default search page size
from atlasclient.utils import parse_table_qualified_name
from flask import current_app as app
from typing import Any, List, Dict, Tuple
f... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2014-2022, <NAME> <EMAIL>
"""
Test the SimulatorInterface class
"""
import unittest
from pathlib impo... |
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from sklearn.preprocessing import scale
from sklearn.model_selection import train_test_split
EPOCH = 50
STEPS = 300
# Set random seed so the result
np.random.seed(666)
train_df = pd.read_csv('train.data', header=None, na_values=' ?')
test_df... |
"""
Internal service API for the distributed session store.
Used to create, delete, and verify user and client session.
"""
import json
import time
import uuid
import random
from datetime import datetime, timedelta
import dateutil.parser
from pytz import timezone
from typing import Any, Optional, Union, Tuple
from ... |
"""Methods used for generating the symmetry group. All of these
methods were adapted to python from their original fortran
implementations which can be found at:
https://github.com/msg-byu/symlib
"""
from copy import deepcopy
import numpy
import math
def get_concs_for_size(size,nspecies,res_concs,nB,concs):
"""Ge... |
# Natural Language Toolkit: Combinatory Categorial Grammar
#
# Copyright (C) 2001-2021 NLTK Project
# Author: <NAME> <<EMAIL>>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
CCG Lexicons
"""
from __future__ import annotations
import re
from collections import defaultdict
from typing impo... |
#! /usr/bin/env python
# coding=utf-8
#================================================================
# Copyright (C) 2019 * Ltd. All rights reserved.
#
# Editor : VIM
# File name : Pix2Pix.py
# Author : YunYang1994
# Created date: 2019-03-09 13:42:33
# Description :
#
#=======================... |
''' Provides several Tkinter widgets:
1) Meter - a progress bar, and
2) SplitButton - a button with additional menu of actions.
3) AnimatedCanvas - a canvas that periodically updates. '''
from base64 import b64encode
import os
import tkinter as TK
DOWN_ARROW = chr(9660)
def extract_contents(paths, outp... |
from cassie.cassiemujoco.cassieUDP import *
from cassie.cassiemujoco.cassiemujoco_ctypes import *
import time
import numpy as np
import torch
import pickle
import platform
from cassie.quaternion_function import *
#import signal
import atexit
import sys
import datetime
"""
We need to include the trajectory library... |
#!/usr/bin/env python
from __future__ import print_function
import collections
import ctypes
import os
import re
import struct
import sys
import frontend
class SlidingRateInfo(object):
def __init__(self, n=32):
self.rate = -1
self.last_update = -1
self.times = collections.deque(maxlen=n)... |
#!/usr/bin/env python
"""Advent of Code Programming Puzzles
2019 Edition - Day 11
Puzzle Solution in Python
"""
import argparse
import logging
import os
import sys
from enum import Enum, IntEnum, auto
from types import SimpleNamespace as sn
from typing import Iterator
log = logging.getLogger(__name__)
class Colo... |
# -*- coding: utf-8 -*-
# Copyright (C) 2012, <NAME>
#
# Visvis is distributed under the terms of the (new) BSD License.
# The full license can be found in 'license.txt'.
import numpy as np
def statistics(data):
""" Get StatData object for the given data.
"""
return StatData(data)
class Stat... |
"""
A specification drawer is for visualizing combinatorial specification object
"""
import json
import os
import tempfile
import threading
import time
import webbrowser
from copy import copy
from typing import TYPE_CHECKING, ClassVar, Dict, List, Tuple
from logzero import logger
from typing_extensions import TypedDic... |
# TODO: (FEAT) support additional apache formats (http://ossec-docs.readthedocs.org/en/latest/log_samples/apache/apache.html) # NOQA
# TODO: (FEAT) maybe consolidate Json and Custom formatters to the same class, to let other custom formatters use them both for each type implemented # NOQA
# TODO: (FEAT) implement Tom... |
#!/usr/bin/env python3
import os
import argparse
import torch
import torchvision
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data
import torchvision.transforms as transforms
from attacks import *
from utils import *
use_cuda = torch.cuda.is... |
from django.contrib.auth.models import AnonymousUser
from django.http.response import HttpResponse
from django.shortcuts import render, redirect
from .models import *
from accounts.models import *
from django.contrib.auth import logout
import string
import random
import math, json
from django.db.models import Q
# Creat... |
import os
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import requests
from bs4 import BeautifulSoup
import pprint
from c0101_retrieve_clinical import retrieve_clinical
from c0201_query_patents import query_patents
def chart_trials():
"""
"""
... |
"""
geolocate wrapper to Geolite2 API.
Programmed by: <NAME>
email: <EMAIL>
"""
import abc
import datetime
import gzip
import os
import shutil
# import subprocess
import tempfile
import geoip2.database as database
import geoip2.webservice as webservice
import maxminddb
import wget
import geolocate.classes.config... |
from os import makedirs
from os.path import join, exists, dirname
from collections import defaultdict
import pickle
from sys import exit
import tempfile
import numpy as np
import caffe
from caffe.proto import caffe_pb2
MIN_LOSS = 1000000
class TrainException(Exception):
pass
def create_solver_params(train_netspe... |
#!/usr/bin/env python3
import http.server, socketserver
import urllib.parse
import os
import signal
PORT = 8000
ALLOWED_EXTENSIONS = ('ukx', 'ut2', 'uax', 'usx', 'u', 'utx')
ASSET_DIRS = ('Animations', 'Maps', 'Sounds', 'StaticMeshes', 'System', 'Textures')
USE_COMPRESSION = True
TEMP_COMPRESSED_DIR = ".redirect"
i... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... |
#!/usr/bin/env python3
#
# Oregano - a lightweight Ergon client
# CashFusion - an advanced coin anonymizer
#
# Copyright (C) 2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software with... |
#-*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2019 hey-yahei
#
# 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, ... |
# coding: utf-8
import os
import numpy as np
import cv2
import torch
import torch.utils.data
class MPIIGazeDataset(torch.utils.data.Dataset):
def __init__(self, subject_id, dataset_dir, if_classifier, additional_ground_truth=None, if_head=False, if_face=False):
limit = 99999999999999999999999999999999... |
#!/usr/bin/env python3
import argparse
import logging
import random
import fnmatch
from collections import Counter
from itertools import groupby, chain
import sys
import functools
from intervaltree import Interval, IntervalTree
logger = logging.getLogger(__name__)
def _fastq_parser(path):
header = seq = ''
... |
#!/usr/bin/env python
import argparse
import json
import math
import os
import shutil
import xml.etree.ElementTree as ET
import numpy as np
import igibson
from igibson.scenes.igibson_indoor_scene import SCENE_SOURCE
from igibson.utils.assets_utils import (
get_3dfront_scene_path,
get_cubicasa_scene_path,
... |
import cv2
import sys
import os
import numpy as np
import matplotlib.pyplot as plt
def cal_hist_point(gt, score, thr_l=0.4, thr_r=0.5):
p = 0
n = 0
gt_len = len(gt)
score_len = len(score)
comp_len = min(gt_len, score_len)
for i in range(0, comp_len):
if score[i] >= thr_l and score[... |
'''
TACO: Multi-sample transcriptome assembly from RNA-Seq
'''
__author__ = "<NAME>, <NAME>, and <NAME>"
__copyright__ = "Copyright 2012-2018"
__credits__ = ["<NAME>", "<NAME>", "<NAME>"]
__license__ = "MIT"
__version__ = "0.7.3"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
def single_n... |
import re
import json
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
from pandaserver.taskbuffer import EventServiceUtils
from pandaserver.dataservice import DataServiceUtils
# constants
TimeOutToken = "<PASSWORD>"
NoJobsToken = "<PASSWORD>"
########### status... |
import os
import pandas as pd
from subprocess import call
import re
benchmarks = ['Celecoxib rediscovery', 'Troglitazone rediscovery', 'Thiothixene rediscovery',
'Aripiprazole similarity', 'Albuterol similarity', 'Mestranol similarity', 'C11H24',
'C9H10N2O2PF2Cl', 'Median molecules 1', 'Me... |
from basic import S, C
from expr import Expr
from sympify import _sympify, sympify
from cache import cacheit
from sympy.utilities.iterables import all
# from add import Add /cyclic/
# from mul import Mul /cyclic/
# from function import Lambda, WildFunction /cyclic/
class AssocOp(Expr):
""" Associative operati... |
# SPDX-License-Identifier: BSD-3-Clause AND Apache-2.0
# Copyright 2018 Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code... |
'''
Created on Nov 27, 2017
@author: fan
'''
import numpy as np
import scipy.stats
import pyfan.amto.array.mesh as mesh
def three_vec_grids(vara_min, vara_max, vara_grid, vara_grid_add=None,
varb_min=None, varb_max=None, varb_grid=None, varb_grid_add=None,
varc_min=None, var... |
## PRE-TRAINED MODELS
# python inference.py anchor-free --model-dir ../models/pretrain_af_basic/ --splits ../splits/tvsum.yml ../splits/summe.yml --cnn default --segment_algo kts --nms-thresh 0.4 --video_name Fire_Domino.mp4
# python inference.py anchor-based --model-dir ../models/pretrain_ab_basic/ --splits ../splits... |
from distutils.version import LooseVersion
from functools import partial
import json
import numpy as np
from pandas import Series
import pyproj
from shapely.geometry import shape, Point
from shapely.geometry.base import BaseGeometry
from shapely.ops import transform
from geopandas.plotting import plot_series
from geo... |
#################################################################################
# Autor: <NAME>
# TRABAJO FIN DE MASTER
# CURSO 2019-2020
# MASTER EN INTERNET DE LAS COSAS
# FACULTAD DE INFORMATICA
# UNIVERSIDAD COMPLUTENSE DE MADRID
#################################################################################
#... |
# coding=latin-1
""" Contests are sets of matches between many agents. Its purpose its to
evaluate each agents in comparison with the others.
Each contests its arranged in a different way.
"""
import collections
import itertools
import random
from _base import match
from _utils import randgen
class Stats()... |
TAB = " "
NEWLINE = "\n"
def generate_converter(bits_precision, colors_list_hex, entity_name="sprite_converter"):
l = []
# Entity declaration
l += ["library IEEE;"]
l += ["use IEEE.std_logic_1164.all;"]
l += ["use IEEE.numeric_std.all;"]
l += [""]
l += ["entity " + entity_name + " is"]... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
from .tests import assert_equal, assert_raises
from ..utils import *
def test_zero_suppression():
""" Test gerber value parser and writer handle zero suppression correctly.
"""
# Default format
fmt = (2, 5)
# Test leading... |
"""
coredis.response.callbacks
--------------------------
"""
# pyright: reportUnnecessaryIsInstance=false
from __future__ import annotations
import datetime
import itertools
from abc import ABC, ABCMeta, abstractmethod
from typing import SupportsFloat, SupportsInt, cast
from coredis.exceptions import ClusterRespons... |
# -*- coding: utf-8 -*-
###########################################################################
## Python code generated with wxFormBuilder (version Mar 13 2019)
## http://www.wxformbuilder.org/
##
## PLEASE DO *NOT* EDIT THIS FILE!
###########################################################################
impor... |
from wobbles.workflow.compute_distribution_function import compute_df
from wobbles.workflow.integrate_single_orbit import integrate_orbit
from wobbles.workflow.subhalos_and_dwarfs import *
from galpy.potential.mwpotentials import PowerSphericalPotentialwCutoff, MiyamotoNagaiPotential
from wobbles.disc import Disc
from ... |
import os
import datetime
import requests as req
import json
import jmespath
import operator
import constants
count = 1
def create_space_name(template="SDD"):
var = datetime.datetime.now()
var = var.isoformat().rsplit('.')[0]
var = var.replace(":", "-")
var = var.replace("@", "-")
var = var.repla... |
# Import central packages
from tensorflow import keras
from tensorflow.python.client import device_lib
import numpy as np
import pandas as pd
# Import basic tools
import os
import re
import time
from datetime import datetime
import pickle
import yaml
import sys
import argparse
# My own functions
import dataset_genera... |
"""Standalone tests of the SIP2 client."""
from nose.tools import (
eq_,
set_trace,
assert_raises,
)
import socket
from api.sip.client import (
CannotReceiveMockSIPClient,
CannotSendMockSIPClient,
MockSIPClient,
)
class TestBasicProtocol(object):
def test_login_message(self):
sip ... |
# -*- coding:uft-8 -*-
import json
from datetime import datetime, timedelta
from os import path
import numpy as np
from netCDF4 import Dataset, date2num
from pandas import read_csv
from yaml import full_load
from .util import create_meta_grp, offset_from_utc
def convert2nc(ctd_path, save_path, time_units, calendar,... |
# Copyright (c) 2015 Tencent Inc.
# All rights reserved.
#
# Author: <NAME> <<EMAIL>>
# Date: November 25, 2015
"""
Implement scala_library, scala_fat_library and scala_test
"""
from __future__ import absolute_import
from blade import build_manager
from blade import build_rules
from blade import config
from blade ... |
# -*- coding: utf-8 -*-
from django.urls import reverse_lazy
from django.shortcuts import redirect
from itertools import chain
from datetime import datetime
from decimal import Decimal
from djangosige.apps.base.custom_views import CustomDetailView, CustomCreateView, CustomListView
from djangosige.apps.es... |
""" Plots for examining the tracking data
Plot functions:
* :py:func:`plot_top_k_waveforms`: Plot the k longest waveforms
* :py:func:`plot_all_tracks`: Plot the traces for whole colonies
* :py:func:`plot_dist_vs_displacement`: Plot the distance vs displacement graph
API Documentation
-----------------
"""
# Import... |
#!/usr/bin/python3
# Stupid Censor
#
# a REVERSABLE image censoring tool
# to reversably mosiac censor jpeg files
# to temporarily remove image details
# not allowed on most websites like
# nudity and/or censored speech, the
# original image can be completely restored
# without any quality loss but can be made
# unre... |
# Unreal Python script
# Attempts to fix various issues in Source engine Datasmith
# imports into Unreal
from collections import Counter, defaultdict, OrderedDict
import unreal
import re
import traceback
import os
import json
import csv
import posixpath
import math
from glob import glob
# This is the S... |
"""XPath 1.0 parser
PLY-based parser to build an AST for an XPath 1.0 expression.
References are to rules in:
http://www.w3.org/TR/1999/REC-xpath-19991116
"""
from . import xpath_lexer
from . import yacc
def parse(s):
return parser.parse(s, lexer = lexer, debug = False)
def pparse(s):
try:
return ... |
# Copyright 2018 IBM Corporation
#
# 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, ... |
import numpy as np
import urllib2
import json
import cPickle
import sys
from time import time, strftime
import logging
import multiprocessing as mp
import os
class ESG_searchdef(object):
'''Interface of search definition (configfiles) and
searchstrings for ESGF REST-API (provided by mksearchstring)'''
de... |
"""A HTTP client module for MicroPython with an API similar to requests."""
import sys
try:
import socket
except ImportError:
import usocket as socket
MICROPY = sys.implementation.name == "micropython"
MAX_READ_SIZE = 4 * 1024
def encode_basic_auth(user, password):
from ubinascii import b2a_base64
... |
from logs import logDecorator as lD
import jsonref
import neuroblu_postgres as nb
import pandas as pd
config = jsonref.load(open('../config/config.json'))
logBase = config['logging']['logBase'] + '.modules.cohort_selection.cohort_selection'
study_config = jsonref.load(open('../config/modules/sample_study_config.json'... |
'''
Given arc, kui index, data dictionary, dranks, slots
Runs DPRIP algorithm and returns slots.
'''
import globals
import random
import copy
TOTAL_SLOTS = 0
TOTAL_REVENUE = 0
DRANK_MEAN = 0
TOTAL_PLACED = 0
IDX = 0
TOP_REVENUE = {}
def calculate_diversification(itemsets):
''' Calculates diversification of item... |
"""
"""
import argparse
import warnings
from os.path import join
import cv2
import matplotlib.pyplot as plt
import model_database_api as api
import numpy as np
import seaborn as sns
from DLBio.helpers import check_mkdir, set_plt_font_size
IM_OUT_FOLDER = join('experiments/new_JOV_result_plots', 'database_results')
DE... |
#!/usr/bin/python
#-*-coding:utf-8-*-
# /**
# * ================================================
# * 作 者:JayGoo
# * 版 本:1.0.1
# * 更新日期:2017/12/29
# * 邮 箱: <EMAIL>
# * ================================================
# */
import os
import sys
import config
import platform
import shutil
def help():
... |
# doodle.py
"""
This module contains the DoodleWindow class which is a window that you
can do simple drawings upon.
"""
import wx # This module uses the new wx namespace
#----------------------------------------------------------------------
class DoodleWindow(wx.Window):
menuColours = { 100 :... |
# Copyright (c) 2018 Foundry.
#
# 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,... |
from dask.distributed import Client, LocalCluster, performance_report
import dask.dataframe as dd
from sklearn.preprocessing import MultiLabelBinarizer
from sklearn.svm import SVC
from sklearn.metrics import f1_score, accuracy_score, recall_score, classification_report
import os, json, pickle, csv
import pandas as pd... |
# -*- coding: utf-8 -*-
"""
Customized Core Keras layers.
for tensorflow backend.
"""
from keras import backend as K
from keras import activations
from keras import initializers
from keras import regularizers
from keras import constraints
from keras.engine.base_layer import InputSpec
from keras.engine.base_layer import... |
import pickle as pickle
import numpy as np
import pandas as pd
import os
import sys
from subprocess import call
import matplotlib
#matplotlib.use('QT5Agg')
import matplotlib.pyplot as plt
from matplotlib.ticker import LinearLocator
import scipy
import json
from sklearn.decomposition import PCA as skPCA
from scipy.spati... |
'''
------------------------------------------------------------------------
Last updated 7/17/2015
Returns the wealth for all ages of a certain percentile.
This py-file calls the following other file(s):
data/wealth/scf2007to2013_wealth_age_all_percentiles.csv
utils.py
This py-file creates t... |
from __future__ import annotations
from datetime import datetime
import numpy as np
import math
import xarray
import scipy.interpolate as interp
from matplotlib.figure import Figure
from matplotlib.axes import Axes
from ..utils import git_meta
from ..read import get_lxs
from .constants import R_EARTH, REF_ALT
from .... |
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
"""Auto diff transformation."""
from enum import Enum
from typing import Iterable, List, Mapping, Optional, Tuple
import popart._internal.ir as _ir
from popart.ir.graph import Graph
from popart.ir.tensor import Tensor
from popart.ir.ops.call import CallInfo
__a... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" bitfieldpy
With great respect to original designer:
A Python3 porting of bitfield nodeJS module(https://github.com/drom/bitfield)
MIT License 2018 (c) <NAME>
"""
import svgwrite
import argparse
import json
from attrdict import AttrDict
from .version import version
d... |
# Copyright (c) 2015 Gamda Software, LLC
#
# See the file LICENSE.txt for copying permission.
from abc import ABCMeta, abstractmethod
from enum import Enum
from gameboard.gameboard import Gameboard, Coordinate, Direction
from gameboard.gameboard import SHIFT_LETTER, SHIFT_SQUARE
class Type(Enum):
PAWN = 0
KNI... |
# _________________________________________________________________________
#
# PyUtilib: A Python utility library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the BSD License.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains ... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2017 <NAME> (plugin.video.netflix)
Copyright (C) 2018 Caphm (original implementation module)
Copyright (C) 2020 <NAME>
MSL requests
SPDX-License-Identifier: MIT
See LICENSES/MIT.md for more information.
"""
import base64
import json
import time
import z... |
"""Test idlelib.query.
Non-gui tests for Query, SectionName, ModuleName, and HelpSource use
dummy versions that extract the non-gui methods and add other needed
attributes. GUI tests create an instance of each class and simulate
entries and button clicks. Subclass tests only target the new code in
the subclass defin... |
"""Helper and utility functions."""
from __future__ import annotations
import os
import platform
import re
import socket
import tempfile
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, TypeVar
import memory_tempfile
import unidecode
# pylint: disable=invalid-name
T = TypeVar("T")
_UNDEF: dict = {... |
# Copyright 2021 The PROST 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 wri... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Convert and infer into Tensor-rt models
License_info:
# ==============================================================================
# ISC License (ISC)
# Copyright 2020 Christian Doppler Laboratory for Embedded Machine Learning
#
# Permission to use, copy, modify, ... |
# Copyright (c) 2016 Civic Knowledge. This file is licensed under the terms of the
# Revised BSD License, included in this distribution as LICENSE
"""Classes to build a Metatab document
"""
import mimetypes
import os
import shutil
from genericpath import exists
from os import makedirs
from os.path import join
def de... |
from symmetry import random_symmetry_predict
from math import sqrt
import numpy as np
import numpy.ma as ma
from numpy.ma.core import MaskedConstant
from conf import conf
from play import (
legal_moves, index2coord, make_play,
coord2index,
)
SIZE = conf['SIZE']
MCTS_BATCH_SIZE = conf['MCTS_BATCH_SIZE']
DIRICHL... |
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 18 15:17:36 2019
@author: lyn
"""
import collections
import math
import sys
import numpy as np
import torch
import torch.nn.functional as F
from utils import real_path, parse_args, load_config, nested_to_cuda
from decoding import crf_model_decoding
def eval_acc(trainer, ... |
#!usr/bin/env python
# -*- coding: utf-8 -*-
# author: kuangdd
# date: 2020/4/13
"""
"""
from pathlib import Path
from functools import partial
from multiprocessing.pool import Pool
from matplotlib import pyplot as plt
from tqdm import tqdm
import collections as clt
import os
import re
import json
import numpy as np
im... |
from typing import List, Tuple, Optional
import torch
import torch.nn.functional as F
from torch import nn
from torch.nn.init import xavier_uniform_
from transformers import XLNetModel, XLNetConfig
from code_transformer.configuration.transformer_lm_encoder import TransformerLMEncoderConfig
from code_transformer.model... |
import numpy as np
import pandas as pd
from datetime import timedelta, datetime
from decimal import Decimal
from tqdm import tqdm
from utils.timer_utils import Timer
from utils.file_utils import write_data_file
#Aim is to conert open-high-low-close (ohlc) data into inputs and output categories for training a model
#Ca... |
# Copyright 2020 Neural Networks and Deep Learning lab, MIPT
#
# 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 numpy as np
import torch
import warnings
import time
from PIL import Image
import random
def noise_matrix(mixing_ratio, num_classes, noise_type, class_to_idx):
if noise_type == 'unif':
return uniform_mix_C(mixing_ratio, num_classes)
elif noise_type == 'flip':
return flip_labels_C(mixing... |
import time
import requests
import logging
import json
from django.conf import settings
from django.utils import timezone
from teslarent.models import Credentials, Vehicle, VehicleData
from teslarent.utils.crypt import decrypt
PRODUCTION_HOST = 'https://owner-api.teslamotors.com'
log = logging.getLogger('teslaapi'... |
from datetime import date, datetime
from decimal import Decimal
from typing import List, Tuple
from zugh.db.connection import ConnectConfigError, connect
from zugh.db.query import execute_commit, execute_fetch, execute_insert
from .base import ExpBase
from .others import As
class QueryBase(ExpBase):
"""abstrac... |
import uuid
from sqlalchemy import *
from sqlalchemy.sql import *
from datetime import datetime
from flask import *
from db_tables import ses,eng,Survey,Interaction,Confirmation,Annotation,Location
from random import randrange
app = Flask(__name__,static_folder="../templates",template_folder="..")
@app.route('/')
def... |
"""
Keeping track of the cluster setup: namespaces, resources (custom and builtin).
The outcome of observation are "insights" -- a description of the cluster setup,
including the "backbone" -- core resources to be used by the operator/framework.
The resource specifications can be partial or even fuzzy (e.g. by catego... |
import unittest
from ..benchmark_functions import Ackley
from ..algorithm_swarm import SwarmAlgorithm, OMOPSO
from ..problem import Problem
from ..individual import Individual
from ..archive import Archive
class TestProblem(Problem):
def set(self):
self.name = 'Test Problem'
self.parameters = [{'n... |
# Copyright 2008 <NAME>, Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
... |
import torch
from models import BaseModel
from models.model_helpers import intervals_to_ray_points
from typing import Tuple
from nerf import models, cast_to_image, SamplePDF, RaySampleInterval
from data.data_helpers import DataBundle
def create_models(cfg) -> Tuple[torch.nn.Module, torch.nn.Module]:
# Initialize... |
import importlib.util
import itertools
import os
import re
from collections import defaultdict
from typing import Optional, IO, Dict, List
import pytest
import numpy as np
from numpy.typing.mypy_plugin import _PRECISION_DICT
try:
from mypy import api
except ImportError:
NO_MYPY = True
else:
NO_MYPY = Fals... |
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, division
from builtins import map, range, object, zip, sorted
from past.builtins import basestring
from numbers import Real
from .base import BaseClass
from .utils import Utils, Tuple
from .iterators import RowIterator, ColIterator
from . ... |
import logging
import sys
import time
from dataclasses import dataclass, astuple
from pathlib import Path
from PIL import Image
from PIL import ImageDraw
from PIL import ImageOps
try:
# Attempt to enable DPI awareness, for platforms that support it.
# Needs to be enabled `before` pyscreenshot is imported.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.