text stringlengths 3.07k 22.1k |
|---|
# encoding: utf-8
from nose.tools import (
assert_raises,
assert_raises_regexp,
eq_,
set_trace,
)
from psycopg2.extras import NumericRange
from sqlalchemy.exc import IntegrityError
from .. import DatabaseTest
from ...classifier import Classifier
from ...model import (
create,
get_one,
get_on... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... |
from logging import getLogger
logger = getLogger("jobs.utils")
TIMEOUT_CALLS = 60
class Subway():
"""Simple code that allows extending things by .attr.ing them"""
def __init__(self, _url, _session, version):
self._url = _url.rstrip('/')
self._session = _session
def __repr__(self):
return f"<Subway... |
#!/usr/bin/python
from enum import Enum
class InputFileStyle(Enum):
Default = 0
Legacy = 1
def main():
from sys import argv
ret, input_file_name, input_file_style, work_directory = \
parse_command_line_options(argv)
if 0 != ret:
exit(ret)
#print("InputFile: \"%s\"" % input_fil... |
#!/usr/bin/env python
import os
import glob
from optparse import OptionParser
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from rompy import rompy, plot_utils, utils, extract_utils
def surface_map(... |
from django.conf import settings
from rest_framework import serializers
from hashids import Hashids
from pprint import pprint
from textwrap import wrap
import json
# --------------------------------------------------------------------------------------
# ------------------
# Common Serializer Fields
class Serializer_... |
"""
Performs an incremental backup of the AiiDA repository for the last N days.
Instead of the existing script at aiida.common.additions.backup_script,
it tars two levels down. At most, 65536 tarfiles will be made.
TODO: Use `tar -tf ` to inspect existing tar, and only, update only if new files
are present. Or app... |
import pandas as pd
import numpy as np
from sklearn import tree
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split
from matplotlib import pyplot as plt
import seaborn as sns
import graphviz
import pydotplus
import io
from scipy import misc
from skle... |
#!/usr/bin/env python
# coding: utf-8
import pandas as pd
import numpy as np
import tarfile
import io
import os
# for reading and displaying images
from skimage import io
from skimage.io import imread
import matplotlib.pyplot as plt
# for creating validation set
from sklearn.model_selection import train_test_split
imp... |
import asyncio
import concurrent.futures
import math
from heatclient.client import Client as HeatClient
from heatclient import exc as heat_exc
import keystoneauth1
import openstack
import structlog
from .healthcheck import CloudStatus, StackStatus
HEAT_VERSION = 1
# TODO: sleep(x - (end - start))
UPDATE_FREQUENCY = ... |
# Copyright 2016 NEC Corporation. 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 ... |
# coding: utf-8
import pysinsy
import os
import sys
from glob import glob
from os.path import join, basename, exists, expanduser, splitext
from nnmnkwii.io import hts
from scipy.io import wavfile
import librosa
import soundfile as sf
from tqdm import tqdm
import numpy as np
from util import fix_offset, trim_sil_and_pau... |
""" (LS GAN) https://arxiv.org/abs/1611.04076
Least Squares GAN
The output of LSGAN's D is unbounded unless passed through an activation
function. In this implementation, we include a sigmoid activation function as
this empirically improves visualizations for binary MNIST.
Tackles the vanishing gradients problem asso... |
"""
Copyright (c) 2020, Battelle Memorial Institute
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and... |
'''
This script test MSS/MSI on 3 cases: on tiles
1.low+middle
2.low
3.middle
'''
import scipy.stats
import torch
import torchvision
import PIL
import json
import os
import numpy
import time
import scipy
import random
import staintools
import threading
import scipy
from sklearn import metrics
torch.set_prin... |
from __future__ import print_function
from __future__ import division
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
import math
from torchreid.losses.cross_entropy_loss import CrossEntropyLoss
class FaceLoss(nn.Module):
def __init__(self, out_features, use_gpu, ... |
import numpy as np
import tensorflow as tf
from enum import Enum
class EnumWithNames(Enum):
"""
The Enum classes that inherit from the EnumWithNames will get the get_names
method to return an array of strings representing all possible enum values.
"""
@classmethod
def get_names(cl... |
import json
import logging
import os
import pickle
import sys
osp = os.path
import numpy as np
import tensorflow as tf
import ray
from ray import tune
from rlfd import (agents, metrics, policies, env_manager, drivers, shapings)
from rlfd.utils.util import set_global_seeds
def get_env_constructor_and_config(params)... |
"""
Handlers for lambada commands
"""
import argparse
import json
import os
import shutil
import subprocess
import sys
import tempfile
from typing import Dict
import boto3
from simiotics.client import client_from_env
AWSLambdaTrustedEntity = """
{
"Version": "2012-10-17",
"Statement": [
{
"S... |
from __future__ import absolute_import
from __future__ import print_function
import atexit
import subprocess
import os
import psutil
import sys
import time
from datetime import datetime
from .nbsr import NonBlockingStreamReader as NBSR
mswindows = (sys.platform == "win32")
def terminate_process(proc):
"""
... |
import mdpopups
import sublime
import sublime_plugin
import webbrowser
import os
from html import escape
from .code_actions import actions_manager, run_code_action_or_command
from .code_actions import CodeActionOrCommand
from .core.configurations import is_supported_syntax
from .core.popups import popups
from .core.pro... |
# Tools for creating a BigStitcher/BigDataViewer .xml/h5 project file
# from Leica Matrix Screener .ome.tiff output
#
# <NAME> @ Monash dot Edu
# Sep/Oct 2019
# License BSD-3
import pathlib
import tifffolder
import pandas as pd
import numpy as np
import tifffile
import re
import h5py
from typing import Tuple, Union, L... |
# importing libraries
from PySide2.QtWidgets import QMainWindow, QApplication, QDesktopWidget, QAction, QFileDialog, QInputDialog, QColorDialog
from PySide2.QtGui import Qt, QImage, QIcon, QPainter, QPen
from PySide2.QtCore import QPoint
import sys
import os
# create function that returns resources when compiled with... |
import datetime
def create_token_list():
return {}
def token_list(tset={}, *tokens):
for t in tokens:
k, v = list(t.items())[0]
tset[k] = v
return tset
def token_list_item(key, *evaluations):
return {key: evaluations}
def evaluate_token(evaluate, tokens, key, args):
for func in t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: bboxtool.py
# Author: <NAME> <<EMAIL>>
import numpy as np
import src.utils.utils as utils
SMALL_NUM = 1e-6
def inverse_sigmoid(x):
return np.log(x / (1 - x + SMALL_NUM) + SMALL_NUM)
def xyxy2yolotcoord(xyxy_bbox, anchor, stride, cxy):
"""... |
"""
Routines for training.
"""
# This file is part of a Viola Jones example.
# Copyright (c) 2020 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the “Software”), to deal in the
# Software without restriction, incl... |
import ctypes
import ctypes.util
import os
import typing as T
from screeninfo.common import Monitor, ScreenInfoError
from screeninfo.util import load_library
libdrm = load_library("drm")
class DrmBase(ctypes.Structure):
fd = None
needs_free = False
class DrmModeRes(DrmBase):
_fields_ = [
("cou... |
# Core functions for image processing
# Add to function names when implementing new functions:
from runenv import saved_vars, saved_macros, env_vars
import cv2
import numpy as np
import os
from hiphoperrors import hiphop_error, file_error
from termcolor import colored
import colorama
###### FILE OPERATIONS ######
... |
import numpy as np
import matplotlib.pyplot as plt
from utils.unit_conversions import db_to_lin
from utils import constants
from .aoa import make_gain_functions
def crlb(snr, M, g, g_dot, psi_samples, psi_true):
"""
Computes the CRLB for a directional antenna with amplitude measurements taken at a series of a... |
import torch
import data_utils
import numpy as np
from torchvision.utils import save_image
import os
import shutil
from inception_score import inception_score
from fdiv import *
import pandas as pd
import wandb
# Sample images and measure p (likelihood) on this images by RealNVP:
# TODO : Print timing for each step i... |
from typing import Callable, Optional, Tuple
import torch as th
from collections import OrderedDict
from stable_baselines3.common.distributions import (Distribution, make_proba_distribution,
DiagGaussianDistribution, StateDependentNoiseDistribution)
class Multimoda... |
""" oracle_attn2d """
import contextlib
import torch
import torch.nn as nn
from fairseq import utils
from fairseq.models import (
FairseqEncoderDecoderModel,
FairseqEncoder, FairseqIncrementalDecoder,
register_model, register_model_architecture,
)
from examples.pervasive.modules import (
build_convn... |
"""Calculate spectral function due to bubble diagram."""
# Copyright (C) 2020 <NAME>
# All rights reserved.
#
# This file is part of phono3py.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of s... |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2017 SML
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy... |
#!/usr/bin/env python
#
# Copyright 2007, The Android Open Source Project
#
# 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... |
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
import copy
from bll.common import util
from tests import util as test_util
from bll.common.util import scrub_passwords
from simplejson import loads
from bll.api.request import BllRequest
from pecan import conf
FTI = {
... |
import time
from datetime import datetime
from os import getenv
try:
from unittest.mock import patch, MagicMock
except ImportError:
# py27 support
from mock import patch, MagicMock
import pytest
from cub import User, config
from cub.models import (
Country, CubObject, Group, Lead, Member, Message, Or... |
import re
import traceback
import subprocess
from serviceDB import ServiceDB
class NeadmServiceWrapper:
_service_list_cmd = ['/opt/nedge/neadm/neadm', 'service', 'list']
# _status_cmd = ['/opt/nedge/neadm/fake-neadm-status.sh']
_service_list_header = re.compile("^.*TYPE.*NAME.*SERVERID.*STATUS.*$")
#... |
import os
import numpy as np
import pandas as pd
import binascii
import warnings
import tempfile
from math import ceil
from multiprocessing import cpu_count, sharedctypes
from multiprocessing.pool import Pool
from sklearn.metrics import r2_score
from deepimpute.net import Net
from deepimpute.normalizer import Normaliz... |
import json
import getpass
import shortuuid # type: ignore
from datetime import datetime
from functools import lru_cache
from collections import defaultdict
from typing import Any, Dict, Generator, Generic, List, Optional, Set, Tuple, Union
from followthemoney.types import registry
from nomenklatura.entity import CE
... |
import numpy as np
import time
import torch
import torch.nn as nn
def move_data_to_device(x, device):
if 'float' in str(x.dtype):
x = torch.Tensor(x)
elif 'int' in str(x.dtype):
x = torch.LongTensor(x)
else:
return x
return x.to(device)
def do_mixup(x, mixup_lambda):
"""... |
# -*- coding: utf-8 -*-
import os
import numpy
import yaml
from box import BoundingBox
class TemplateBuilding(object):
"""
Main class that represents a template for any building
using an yaml file.
"""
TEMPLATES_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "templates")
... |
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import scipy.ndimage.filters
from ..signal import signal_interpolate
def complexity_coarsegraining(
signal, scale=2, method="nonoverlapping", force=False, show=False, **kwargs
):
"""**Coarse-graining of a signal**
The goal of coa... |
# Copyright 2022 Accenture Global Solutions Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
import numpy as np
from util.solution_util import *
from logging import debug, info, error
import logging
logging.basicConfig(level=logging.ERROR)
class Permutation:
def ConstructRandomOracle(size: int):
# construct random
rmax = int(size ** np.log2(size))
oracle = np.random.randint(low=0... |
# Copyright 2018 PerfKitBenchmarker 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 appli... |
import os
import sys
import re
import datetime
from random import randint
try:
from SimpleHTTPServer import SimpleHTTPRequestHandler as Handler
from SocketServer import TCPServer as Server
from SocketServer import ThreadingMixIn
except ImportError:
from http.server import SimpleHTTPRequestHandler as Handler
f... |
#-*- coding:utf-8 -*-
import tensorflow as tf
from utils.utils_tool import logger
from tensorflow.contrib import slim
tf.app.flags.DEFINE_integer('text_scale', 512, '')
from nets.resnet import resnet_v1
FLAGS = tf.app.flags.FLAGS
#TODO:bilinear or nearest_neighbor?
def unpool(inputs, rate):
# 上采样 分别 2,4,8倍
... |
import os
import yaml
import re
from sslib.fs_helpers import *
from sslib.rel import REL, RELSection, RELRelocation, RELRelocationType
ORIGINAL_FREE_SPACE_RAM_ADDRESS = 0x806782C0
ORIGINAL_DOL_SIZE = 0x57A680
def split_pointer_into_high_and_low_half_for_hardcoding(pointer):
high_halfword = (pointer & 0xFFFF0000... |
#!/usr/bin/env python3
import argparse
import logging
import requests as requests
hostname_dev = 'http://localhost:9000'
hostname_prod = 'https://cspinetta-minesweeper-api.herokuapp.com'
api_hostname = hostname_prod
user_action_new = 'new'
user_action_details = 'details'
user_action_delete = 'delete'
game_action_rev... |
import requests
import pandas as pd
import os
import re
schema_url = 'https://stat-xplore.dwp.gov.uk/webapi/rest/v1/schema'
def get_full_schema(schema_headers, types_to_include = ["FOLDER","DATABASE","MEASURE","FIELD"], check_cache = False, schema_filename = 'schema.csv'):
'''Get the schema information of all el... |
# Hotspot 2.0 filtering tests
# Copyright (c) 2015, Intel Deutschland GmbH
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import hostapd
import hwsim_utils
import socket
import subprocess
import binascii
from utils import HwsimSkip, require_under_vm
import os
im... |
# Copyright 2021 Johns Hopkins University. 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 appli... |
""" Module containing tennis court plotting functions"""
from matplotlib import colors
from matplotlib.patches import PathPatch
from matplotlib.text import TextPath
from matplotlib.transforms import Affine2D
import mpl_toolkits.mplot3d.art3d as art3d
import matplotlib.font_manager as fm
def plot_court_3d(a... |
from __future__ import print_function
import argparse
import os
import random
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
from torch.autograd import Variable
import torch.nn.functional as F
import numpy as np
import... |
import json
import logging
import nltk
import os
import pickle
import random
import re
import time
from flask import Flask, request, jsonify
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
from deeppavlov import build_model
from common.fact_retrieval import topic_titles, find_topic_titles... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 ICON Foundation
#
# 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 r... |
'''
* 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... |
# -----------------------------------------------------------------------------
# sly: lex.py
#
# Copyright (C) 2016 - 2018
# <NAME> (Dabeaz LLC)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
... |
# Copyright 2019 Xilinx 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 writing, ... |
"""
Control
-------
for manageing control confguration in the ATM
"""
# from atm.io import control_file
import os
try:
from .cohorts import find_canon_name
except(ImportError):
from cohorts import find_canon_name
try:
from .grids.ice_grid import ICE_TYPES
except(ImportError):
from grids.ice_grid im... |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# flake8: noqa
import datetime
import collections
from sqlalchemy import and_
from sqlalchemy import not_
from sqlalchemy import or_
from ggrc.models.custom_attribute_value import CustomAttributeValue
from... |
#
# 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
# distributed under... |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Table Reader Classes of spreadsheet, wiki, and wdc tables in JSON format
@in: path of a one-table/multi-table file
@out: strings, positions, and formats as needed by the tokenzier
"""
import json
# %% General reader class
class Reader(object):
... |
import os
import base64
import logging
import face_recognition
import numpy as np
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUpdate
from flask import Fl... |
"""
Author: <NAME>
Copyright (c) 2019, <NAME>
All rights reserved.
Loads different resnet models
"""
'''
file: Resnet.py
date: 2018_05_02
author: zhangxiong(<EMAIL>)
mark: copied from pytorch source code
'''
import torch.nn as nn
import torch.nn.functional as F
import torch
from torch.nn.param... |
# Copyright 2013 by Rackspace Hosting, 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 t... |
# -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, 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 requir... |
# coding: utf-8
# In[1]:
""" Ingest MAPSPAM 2010 data into earthengine
-------------------------------------------------------------------------------
Author: <NAME>
Date: 20190617
Kernel: python36
Docker: rutgerhofste/gisdocker:ubuntu16.04
"""
TESTING = 0
SCRIPT_NAME = "Y2019M06D17_RH_Ingest_MAPSPAM_EE_V01"
OUTP... |
from flask import Flask, render_template, request
import datetime
import sqlite3
import base64
app = Flask(__name__)
# ajax更新
@app.route('/ajax1')
def ajax1():
with open('./static/images/word.png', 'rb') as img:
img_stream = img.read()
zfh = base64.b64encode(img_stream).decode()
return zfh
@... |
import logging
import graphgym.register as register
import networkx as nx
import numpy as np
import torch
import torch.nn as nn
from deepsnap.graph import Graph
from graphgym.config import cfg
from graphgym.contrib.transform.identity import compute_identity
# NOTE this import must be present to correctly register mod... |
'''红色交通锥的识别
为了保证图像处理算法在树莓派上的实时性, 用颜色阈值来检测
'''
import math
import cv2
import numpy as np
from cv_camera import Camera
from config import *
class TrafficConeDetect:
'''交通锥检测'''
# 图像缩放因子
IMG_SCALE_FACTOR = 0.2
def __init__(self, cam):
self.cam = cam
def find_contours(self, img_bin):
... |
#! /usr/bin/env python
import inspect
import pyaml
import textwrap
import numpy as np
import math
from wrapt import ObjectProxy
# from astropy.modeling import Model
__all__ = [
'pformat_paths', 'pformat_list', 'pformat_dict', 'pformat_obj',
'pformat_yaml', 'pformat_fancy_index', 'model_to_dict',
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import argparse
import logging as log
import re
import sys
from timeit import default_timer
from typing import Union
import numpy as np
from arg_parser import parse_args
from file_options im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
__contact__ = "gambrosio[at]uma.es"
__copyright__ = "Copyright 2021, <NAME>"
__date__ = "2021/02/22"
__license__ = "MIT"
import os
import datetime as dt
import time
import re
import hashlib
import tarfile
import io
import sys
import requests
from tqd... |
"""
Created on Wednesday Jan 16 2019
@author: <NAME>
@github: https://github.com/s3yyy3d-m
"""
import numpy as np
import os
import random
import argparse
import pandas as pd
from training.dqn_agent import Agent
from training.brain import Brain
# from dqn_agent import Agent
import glob
import gym
N_AGENT = 5
MAX_TIMES... |
import sys
import os
import mxnet as mx
# import symbol_octconv as sym
import mxnet.symbol as sym
import symbol_utils
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from config import config
def Act(data, act_type, name):
#ignore param act_type, set it in this function
if act_type=='prelu':
... |
import cv2
import numpy as np
import matplotlib.pyplot as plt
# Step1. 构造VideoCapture对象
def white_balance(frame):
(B,G,R) = cv2.split(frame)
aB = cv2.mean(B)[0]
aG = cv2.mean(G)[0]
aR = cv2.mean(R)[0]
aA = (aB + aG + aR)/3
kB = aA/aB+1
kG = aA/aG+1
kR = aA/aR+1
B = cv2.addWeighted(B,... |
# import os
#
# root = 'G:\潼南农房数据清理\原始数据\ftpfjyj'
# # path = os.path.join(root, 'part_A_final', 'train_data', 'images')
# pathnames = []
# for (dirpath, dirnames, filenames) in os.walk(root):
# for dirnames in dirnames:
# pathnames += [os.path.join(dirpath, dirnames)]
#
# print(pathnames)
#
i... |
import ast
IMPORT_ERROR_MESSAGE = "module cannot be imported because it is not in the list of whitelisted modules."
FUNCTION_BUILTIN_ERROR_MESSAGE = "function cannot be called because it is not in the list of whitelisted builtins."
FUNCTION_MODULE_ERROR_MESSAGE = "function cannot be called because it is not in the lis... |
# classification into (no cancer / cancer)
import argparse
import os
import time
from datetime import datetime
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torchnet
import torchvision.models as models
import torchvision.transforms as transforms
import yaml
from munch import Munch
fro... |
from django.db.models.sql import compiler
from datetime import datetime
REV_ODIR = {
'ASC': 'DESC',
'DESC': 'ASC'
}
SQL_SERVER_8_LIMIT_QUERY = \
"""SELECT *
FROM (
SELECT TOP %(limit)s *
FROM (
%(orig_sql)s
ORDER BY %(ord)s
) AS %(table)s
ORDER BY %(rev_ord)s
) AS %(table)s
O... |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os.path
import re
import subprocess
from textwrap import dedent
import pytest
from pex.common import safe_open
from pex.pex import PEX
from pex.pex_bootstrapper import ensure_venv... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import time
import threading
import glob
import serial
from serial.tools.list_ports import comports
from . import ... |
from soc_modules.helpers import getval
from dateutil import parser
import json
import datetime
import math
import numpy
class FWFiltering:
def __init__(self):
pass
@staticmethod
def filtering_legal_admin_activity_on_fortigate(_selfParams, event_list: list):
"""Из массива со скорелированным... |
import json
import logging
import os
import re
import shutil
import subprocess
from core.result_types import ResultType
import core.utility as util
# Output files
HYDRA_OUTPUT_DIR = "hydra_output"
HYDRA_TEXT_OUTPUT = "hydra_output.txt"
HYDRA_JSON_OUTPUT = "hydra_output.json"
HYDRA_TARGETS_FILE = "targets.txt"
TIMEOUT... |
#!/usr/bin/env python
# Copyright (c) 2017 The WebRTC 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 in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All ... |
"""Vizio SmartCast API commands and class for individual item settings."""
from typing import Any, Dict, Optional, Union
from pyvizio.api._protocol import (
ACTION_MODIFY,
ENDPOINT,
ITEM_CNAME,
PATH_MODEL,
ResponseKey,
)
from pyvizio.api.base import CommandBase, InfoCommandBase
from pyvizio.helper... |
"""dem_tiler.handlers.app: handle request for dem-tiler endpoints."""
import json
import os
import urllib.parse
from io import BytesIO
from tempfile import TemporaryDirectory
from typing import Any, Tuple, Union
import mercantile
import quantized_mesh_encoder
import rasterio
from boto3.session import Session as boto3... |
# Copyright 2019-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
import argparse
import os
import pytest
import tempfile
from collections import OrderedDict
from plastron.commands.importcommand import Command, RepoChangeset
from plastron.exceptions import FailureException, NoValidationRulesetException
from plastron.jobs import ConfigMissingError, Row
from plastron.models.umd import ... |
import unittest
import sys
sys.path.append('../')
from emmet import expand
def field(index: int, placeholder: str, **kwargs):
if placeholder:
return '${%d:%s}' % (index, placeholder)
return '${%d}' % index
class TestExpandMarkup(unittest.TestCase):
def test_basic(self):
self.assertEqual... |
# coding=utf-8
# Copyright (c) 2019 Alibaba PAI team.
#
# 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 ... |
import inspect
import logging
import pandas as pd
from starlette.responses import JSONResponse
from sqlalchemy import create_engine
from fastapi import APIRouter, Depends, status, Request
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel
from time import time
from datetime import datetime as ... |
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 AND MIT
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/debian-inspector for support or download.
# See https://aboutcode.org for more information about nexB OSS projec... |
""" Tests for the module "dcm2bidsphysio.py" """
import sys
import re
import math
import pytest
from bidsphysio.dcm2bids import dcm2bidsphysio as d2bp
from bidsphysio.base.bidsphysio import PhysioData
from bidsphysio.base.utils import (check_bidsphysio_outputs,
get_physio_TRs)
... |
import sys
import traceback
from typing import Any, Dict, Iterable, Union
from gym import spaces
import numpy
from plangym.core import GymEnvironment, wrap_callable
from plangym.parallel import BatchEnv, ExternalProcess
from plangym.utils import resize_frame
try:
import retro
except ModuleNotFoundError:
prin... |
# Copyright The PyTorch Lightning team.
#
# 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 i... |
import logging
import numpy as np
import copy
logger = logging.getLogger(__name__)
def map_resource_to_index(resource, rf, min_t, max_t):
max_rungs = int(np.log(max_t / min_t) / np.log(rf) + 1)
index = int(np.round(np.log(resource * max_t / min_t) / np.log(rf)))
index = max(min(index, max_rungs - 1), 0)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.