text stringlengths 3.07k 22.1k |
|---|
import json
import ssl
from urllib.error import HTTPError, URLError
from urllib.request import urlopen
from bs4 import BeautifulSoup
from selectolax.parser import HTMLParser
from memory_profiler import profile
""" 아주대학교 공지 HTML 옵션
> 보기 옵션
articleLimit= 10 (10개만 불러오기)
article.offset= 0 (시작 index)
> 검색 옵션
srCategory... |
# original code: https://github.com/dyhan0920/PyramidNet-PyTorch/blob/master/train.py
import logging
import os
import shutil
import time
from cv2 import transform
from numpy import mod
import pandas as pd
# import pandas as pd
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as ... |
from threading import Thread
import pat
import patl
import logging
import argparse
import time
from patutils import SEPARATOR, BOX_LENGTH, BASE, USE_SEPARATOR
""" A chat protocol based loosely off IRC
The whole thing works with ASCII256 text
"""
standard_ascii = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0... |
"""Miscellaneous utility functions."""
from functools import reduce
import cv2, os
from PIL import Image
import numpy as np
from matplotlib.colors import rgb_to_hsv, hsv_to_rgb
def compose(*funcs):
"""Compose arbitrarily many functions, evaluated left to right.
Reference: https://mathieularose.com/function-... |
from enum import Enum
import re
class Colour(Enum):
System = '\x1b[0;30;44m'
Normal = '\33[0m'
Important = '\x1b[0;30;41m'
# Functions class contains numerous static methods which endeavour to ecapsulate business logic from main code
# Examples include taking input from user, displaying a message etc
class Fun... |
import pygame
import time
from pygame.constants import MOUSEBUTTONDOWN
# board = [ [ 3, 1, 6, 5, 7, 8, 4, 9, 2 ],
# [ 5, 2, 9, 1, 3, 4, 7, 6, 8 ],
# [ 4, 8, 7, 6, 2, 9, 5, 3, 1 ],
# [ 2, 6, 3, 0, 1, 5, 9, 8, 7 ],
# [ 9, 7, 4, 8, 6, 0, 1, 2, 5 ],
# [ 8, 5, 1, 7, 9, 2, 6, 4... |
import json
import pandas as pd
from pypika import MSSQLQuery as Query
from pypika import Order
from pypika import Table as T
from pypika.analytics import RowNumber
from smseventlog import config as cf
from smseventlog import delta, dt
from smseventlog import functions as f
from smseventlog import getlog
from smseve... |
import re
from django.contrib.gis.geos import GEOSException
from django.core.management.base import BaseCommand
from django.db import InternalError
from leasing.enums import AreaType, PlotType
from leasing.models import Area, Lease
from leasing.models.land_area import PlanUnit, PlanUnitIntendedUse, PlanUnitState, Pla... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bombicka what? Collect bombicka, use bombicka.
"""
# import cProfile, pstats
import random
import time
from math import trunc
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.clock import Clock
from kivy.properties import NumericProperty, Boolea... |
from components import MissingInputModal, MismatchModal, PlotPlaceHolder, DisplayControlCard
from enum import Enum
from operator import itemgetter
from parsers import DatasetStates
import plotly.graph_objects as go
from plotly.colors import diverging
from plotly.colors import sequential
from loaders import DatasetRefer... |
# This is the file that implements a flask server to do inferences. It's the file that you will modify to
# implement the scoring for your own algorithm.
from __future__ import print_function
import os
import cv2
import sys
import time
import uuid
import json
import glob
import boto3
import flask
import errno
import ... |
from __future__ import absolute_import, division, print_function
import copy
import logging
import pytest
import six
import numpy as np
from numpy.testing import (assert_equal, assert_array_almost_equal,
assert_array_equal, assert_raises)
from skbeam.core.fitting.base.parameter_data import ... |
import json
import pandas as pd
import os
# import boto3
import datetime
import pymongo
from airflow.models import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.python_operator import PythonOperator
from airflow.operators.python_operator import BranchPythonOperator
from airflow.ope... |
#!/usr/bin/env python
import os
import numpy as np
import time
import copy
import sys
import ase
import argparse
ang_2_bohr = 1.0/0.52917721067
hart_2_ev = 27.21138602
from cp2k_spm_tools import common, cube, cube_utils, bader_wrapper
from mpi4py import MPI
comm = MPI.COMM_WORLD
mpi_rank = comm.Get_rank()
mpi_siz... |
import json
import time
from threading import Thread
import requests
class HSocket:
"""
Client HSocket that communicates with the remote server HSocket
"""
def __init__(self, host, auto_connect=True): # type: (str, bool) -> None
"""
Initializes the HSocket
:pa... |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright Holders: <NAME>, <NAME>, <NAME>
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function
from itertools import izip, chain
import os
import time
import wea... |
import os
import sys
import zipfile
import py
import pytest
ast = pytest.importorskip("ast")
if sys.platform.startswith("java"):
# XXX should be xfail
pytest.skip("assert rewrite does currently not work on jython")
from _pytest.assertion import util
from _pytest.assertion.rewrite import rewrite_asserts, PYTES... |
import tkinter as tk
import cv2
import numpy as np
import face_recognition
import os
from datetime import datetime
import mysql.connector
from PIL import Image, ImageTk
from time import strftime
def takeattendance(btn):
tablename=btn["text"]
path = 'Image_Dataset'
images = []
classNames... |
"""
Monitor thrash
"""
import logging
import contextlib
import random
import time
import gevent
import json
import math
from teuthology import misc as teuthology
from tasks import ceph_manager
log = logging.getLogger(__name__)
def _get_mons(ctx):
"""
Get monitor names from the context value.
"""
mons ... |
# -*- coding: utf-8 -*-
#
"""
Parse Fortran code to extract points and weight of the Xiao-Gimbutas schemes.
"""
import numpy
# TODO the first two functions could go into a helper and be shared with tri
def _parsed_strings_to_array(strings):
return numpy.array(
"".join(strings).replace("&", "").replace("/",... |
# pylint: disable=missing-docstring, line-too-long, invalid-name, arguments-differ, no-member, pointless-statement, unbalanced-tuple-unpacking
import math
import torch
from e3nn import o3, rs, rsh
from e3nn.linear_mod import KernelLinear
def kernel_geometric(Rs_in, Rs_out, selection_rule=o3.selection_rule_in_out_sh... |
import os
import re
import sys
import html
import json
from collections import defaultdict
from xmi_document import xmi_document
try:
fn = sys.argv[1]
try:
OUTPUT = open(sys.argv[2], "w", encoding='utf-8')
except IndexError as e:
OUTPUT = sys.stdout
except:
print("Usage: python to_po.... |
from netaddr import IPNetwork
from multiprocessing import Process, Lock
from argparse import RawTextHelpFormatter
import sys, netaddr, wmiqueries, psexecqueries, sqlite3, argparse, importlib
def wmiConnect(ipaddr, verbose, lock, database, stout):
global wmiSuccess
global connection
if connection is None and not wmi... |
"""Setup CLI configuration."""
# :license: MIT, see LICENSE for more details.
import webbrowser
import configparser
import json
import os.path
import requests
import click
import SoftLayer
from SoftLayer.CLI.command import SLCommand as SLCommand
from SoftLayer.CLI import config
from SoftLayer.CLI import environment
... |
"""REST API view model serializers for the projectroles app"""
from email.utils import parseaddr
from django.conf import settings
from django.contrib.auth import get_user_model
from rest_framework import exceptions, serializers
from drf_keyed_list import KeyedListSerializer
from projectroles.models import (
Pro... |
import torch.nn as nn
import torch.nn.functional as F
import torch
def weights_init_normal(m):
classname = m.__class__.__name__
if classname.find("Conv") != -1:
torch.nn.init.normal_(m.weight.data, 0.0, 0.02)
if hasattr(m, "bias") and m.bias is not None:
torch.nn.init.constant_(m.b... |
class Cell(object):
__slots__ = ['queen', 'count', 'max_queens', 'closed']
def __init__(self, queen=False, count=0, max_queens=0):
self.queen = queen
self.count = count
self.max_queens = max_queens
self.closed = False
def increment(self):
self.count += 1
def c... |
# -*- coding: utf-8 -*-
"""
For processing citations and bibliographies using the Citation Style
Language (CSL).
>>> STYLE = Style('apa.csl')
>>> REFS = json.loads(open('refs.json').read())
>>> PROCESSED = process_bibliography(STYLE, REFS)
>>> format_bibliography(PROCESSED)
"""
from xml.etree.ElementTree import Eleme... |
import numpy as np
import argparse
import time
from safe_agents.policies import MLP
from open_safety.envs.balance_bot_env import BalanceBotEnv
#from open_safety_gym.envs.kart_env import KartEnv
#from open_safety_gym.envs.hoverboard_env import HoverboardEnv
import skimage
import skimage.io as sio
def get_fitness(ag... |
from lib.elbo_depth import gaussian_log_prob, laplacian_log_prob
from lib.utils.torch_utils import apply_dropout
from tqdm import tqdm
import torch
import numpy as np
import cv2
import matplotlib.pyplot as plt
from time import time
def _compute_runtime_mcd_depth(model, X_test, S=50):
model.eval()
model.apply(apply_... |
import datetime
import json
from django.db import models
from django.contrib.auth import get_user_model
from crum import get_current_user
from django.utils.timezone import utc
import django.core.exceptions as ex
import string
import random
# Create your models here.
max_links = 3
id_length = 20
MAX = 2000
def get... |
import os, sys, math
import torch
import matplotlib.pyplot as plt
def convert_grid2prob(grid, threshold=0.1, temperature=1):
threshold = torch.max(grid) - threshold*(torch.max(grid)-torch.min(grid))
grid[grid>threshold] = torch.tensor(float('inf'))
prob = torch.exp(-temperature*grid) / torch.sum(torch.exp... |
"""
Various features depending on the `ply.lex` module.
They mostly support the definition of lexers.
"""
# all our internally defined decorators are checked and universal
from ..utils.func import universal_decorator
import ply.lex as ply_lex
import warnings
__all__ = [
"context",
"find_column",
... |
from __future__ import absolute_import
import requests
from requests.exceptions import Timeout
from warnings import warn
import configparser
import json
from os import environ, path
from getpass import getpass
import base64
import six
def get_token(username, password=None, token_type='patric', timeout=30):
""" Ge... |
"""Calculate the "steering" table
Calculates the ranges for a given dataset, where it matches the CMIP
distribution for yearly temperature change for a given scenario(s).
For example, if the scenario is 90% (percentile), 2050, it will yield
a year-range for the given input data, where the average of that
year-range m... |
# ad-soyad : <NAME> --- numara : 180401040
print("\n\n")
"""
Bu python kodunda ;
parametre olarak verilen dosyadaki (veriler.txt) verilerin hem hepsini hem de onlu veri grupları
için sırasıyla 1,2,3,4,5,6. dereceden polinoma yakınlaştırarak bu polinomların hata değerlerini, katsayı
değerlerini ve en uy... |
# Copyright 2021 Fedlearn 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 writi... |
from neuroml.nml.nml import parse as nmlparse
from neuroml.nml.nml import parseString as nmlparsestring
import neuroml
from neuroml.utils import add_all_to_document
import os
import sys
import warnings
supressGeneratedsWarnings = True
def print_(text, verbose=True):
if verbose:
prefix = "libNeuroML >>... |
'''
@Author: <NAME>
@Date: 2019-08-16 13:34:15
@LastEditors: <NAME>
@LastEditTime: 2019-08-17 01:49:03
@Description:
'''
import json
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
import torch.utils.data
from ..config import Config
from ..datasets import SSTreebankD... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# ufit, a universal scattering fitting suite
#
# Copyright (c) 2013-2019, <NAME> and contributors. All rights reserved.
# Licensed under a 2-clause BSD license, see LICENSE.
# **************************************... |
# -*- coding: utf-8 -*-
import ply.lex as lex
import ply.yacc as yacc
import math
variables = {}
# _
# | |
# | | _____ _____ _ __
# | | / _ \ \/ / _ \ '__|
# | |___| __/> < __/ |
# \_____/\___/_/\_\___|_|
#
multiplier = {'T': 1e12, 'G': 1e9, 'M': 1e6, 'k': 1e3, 'm': 1e-3, 'u': 1e-... |
import platform
import textwrap
from tkinter import (
Frame,
Label,
Button,
StringVar,
N,
E,
S,
W,
LEFT,
DISABLED,
NORMAL,
)
from numpy import where
import pandas as pd
import requests
from PIL import ImageTk, Image
from utils.consts import Consts
class ImgFrame(Frame):
... |
"""
stringhelpers
~~~~~~~~~~~~~
A set of various string helpers.
:copyright: (c) 2013 by <NAME>.
:license: MIT, see LICENSE for more details.
"""
__version__ = '1.2.1'
import re
import os
import random
def upcase(string):
"""Returns a copy of `string` with all the alphabetic characters con... |
#!/usr/bin/env python3
"""
python implement of red black tree
"""
import collections
class Node(object):
def __init__(self, key):
self.parent = None
self.left = None
self.right = None
self.color = None
self.key = key
class NIL(object):
def __init__(self):
#NIL c... |
"""
Inspired from APEX example at:
https://github.com/NVIDIA/apex/blob/master/examples/imagenet/main_amp.py#L256
and also from Timm loader at:
https://github.com/rwightman/pytorch-image-models/blob/master/timm/data/loader.py
"""
from types import SimpleNamespace
from typing import Callable, List, Opti... |
#
# 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 python
# coding: utf-8
# In[ ]:
get_ipython().run_line_magic('matplotlib', 'inline')
import matplotlib.pyplot as plt
import numpy as np
# In[ ]:
def dfdx(x,f):
#d2y/dx2 = -y
#define :
# y = f[0]
# dy/dx = z
# z = f[1]
y = f[0]
z = f[1]
#return de... |
MIN_KEYS = 2
MAX_KEYS = MIN_KEYS*2 + 1
class Node(object):
def __init__(self):
self.n = 0
self.keys = [None] * MAX_KEYS
self.children = [None] * (MAX_KEYS + 1)
def is_leaf(self):
return self.children[0] is None
def is_full(self):
return self.n >= MAX_KEYS
def ... |
from zlib import crc32
import struct
import json
import time
import numpy
import brownian_sheet
def match_pattern(pattern, roi):
return (
(roi[pattern == 0] == 0).all()
and (roi[pattern == 1] > 0).all()
and (roi[(pattern >= 2) & (pattern <= 4)] >= 0).all()
# 2, 3 or 4: land (i.e.... |
'''
Misc: Contains a set of utility commands for MOPS
Model Operations Processing System. Copyright <NAME> 2009-2010. Licenced under the EUPL.
You may not use this work except in compliance with the Licence. You may obtain a copy of the
Licence at http://ec.europa.eu/idabc/eupl or as attached with this applic... |
import numpy as np
import cv2
from scipy.interpolate import interpn
from scipy.ndimage import zoom
import matplotlib as mpl
mpl.use("Agg")
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
def plot_heatmap_img(batch_segm... |
from __future__ import print_function
# background(0.8)
size(400, 400)
background(None)
import math
debug = 0
r30 = math.radians( 30)
c30 = math.cos( r30 )
# the reptile consists of 3 different segments; each used twice
seg1 = (
( 0.0, 0.0),
( 2.2, 2.2),
( 4.0, 2.2),
( 6.3, -0.5),
( 5.0, -... |
import numpy as np
from sklearn.utils import shuffle
from .kmeanInfer import kmeanInfer
with open("modelFood/modelSettings.txt") as f:
modelSettings = f.readlines()
# print(modelSettings)
use_label_kmean = False if (modelSettings[3].strip().split(":")[1] == "False") else True
seqLen = int(modelSettings[7].st... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
from pathlib import Path
from PIL import Image
from utils import create_patches_overlap
from plipy.ddl import DDLInpainting
def iter_algo(y, D, A, n_iter, L, algo="fista", lambd=0.1):
out = np.zeros((D.sh... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
#!/usr/bin/env python3
# author @danbros
# Pset4 do curso MITx: 6.00.1x (edX)
import random
from typing import Union, Dict, List, Optional
d_si = Dict[str, int]
def loadWords() -> List[str]:
"""Load the file with words.
Returns:
list: list of valid words
"""
print("Loading word list fro... |
'''
App routes and main logic defined here.
Module should be imported in app_context() only because of
the blueprint architecture:
with app.app_context():
from whalet import routes
Functions use SQLAlchemy session object (db variable)
and an instance of custom Abort class which provides handy
abort scenarios if ... |
#!/usr/local/bin/python3
# -*- coding:utf-8 -*-
import __future__
import numpy as np
import os
import errno
import sys
from decimal import Decimal
from shutil import copy2
import numpy as np
def make_sure_path_exists(path):
try:
os.makedirs(path)
except OSError as exception:
if exception.errn... |
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Recipe, Ingredient, Tag
from recipe.serializers import RecipeSerializer, RecipeDetailSerializer
RECIPES_... |
from __future__ import annotations
import io
import struct
from ranges import Range
from ...stream import RangeStream
from .data import COMPRESSIONS, TarData
__all__ = ["TarStream", "TarredFileInfo"]
class TarStream(RangeStream):
"""
As for :class:`~range_streams.stream.RangeStream`, but if ``scan_headers... |
'''
Created on 2 de nov de 2018
@author: <NAME>
'''
import zipfile, os, re, shutil
from uuid import uuid4 as hasher
from datetime import date
import logging
def dessem_source(fn, open_results=False, pmo_date=None):
if os.path.isdir(fn):
return DessemDir(fn, open_results, pmo_date)
if zipf... |
# Copyright 2016 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... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.alert import Alert
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.excep... |
# -*- coding: utf-8 -*-
"""
Este App gerencia um banco de dados sqlite3.
Pode-se usar o modo interativo com python2.
Popula as tabelas do banco de dados com valores randômicos.
Banco de dados: 'db.sqlite3'
Tabelas: 'vendas_brand',
'vendas_customer',
'vendas_product',
... |
import collections
import contextlib
import glob
import os
import subprocess
import sys
import wave
import sox
import webrtcvad
from ekstep_data_pipelines.common.utils import get_logger
Logger = get_logger("Chunking Util")
class ChunkingConversionUtil:
re_chunking_aggressiveness = 3
@staticmethod
def g... |
import errno
import os
import re
import shutil
import zipfile
from distutils import log
from distutils.errors import (
DistutilsInternalError,
DistutilsOptionError,
DistutilsSetupError,
)
from lambda_pkg_resources import LAMBDA_EXCLUDES, DistInstaller, ExcludesWorkingSet
from pkg_resources import WorkingSe... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
"""
This file is used to generate TFRecords using the AI Challenger dataset.
@ Author: <NAME>. <EMAIL>
@ Date created: Jun 04, 2019
@ Last modified: Jun 27, 2019
"""
import numpy as np
import os
import time
from skimage import io, draw
from skimage.transform import resize
from random import shuffle
import tensorflo... |
""" Utilities to make and assert transfers. """
import gevent
from coincurve import PrivateKey
from raiden.messages import (
DirectTransfer,
MediatedTransfer,
Secret,
)
from raiden.raiden_service import (
initiator_init,
mediator_init,
target_init,
)
from raiden.tests.utils.events import must_c... |
from typing import Callable
import gym
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import botbowl
from botbowl.ai.env import EnvConf, BotBowlEnv
from examples.a2c.a2c_env import a2c_scripted_actions
from botbowl.ai.layers import *
# Archit... |
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from copy import copy
from functools import partial
from typing import Optional, List, Callable
from math import pi, sqrt
class CoordinateEncoding(nn.Module):
def __init__(self, proj_matrix, is_trainable=False):
super().__init... |
import numpy as np
import cv2
import imageio
import logging
import os
import requests
from gabriel_server import cognitive_engine
from gabriel_protocol import gabriel_pb2
import object_detection.object_detector as obj
import action_detection.action_detector as act
NUM_INPUT_FRAMES = 32
WIDTH = 640
HEIGHT = 480
OBJ_D... |
from django.shortcuts import render
from django.views import View
from django.views.generic import TemplateView
from app.models import *
from app.publicacoes_com_metadados import *
import re, json
# Lista de Entidades Possíveis
entity_list = [ 'ADV', 'ADVS',
'ADVOGADA', 'ADVOGADO',
'AGR... |
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
from HyperSphere.dummy.plotting.get_data_from_file import get_data
from HyperSphere.test_functions.mnist_weight import mnist_weight_baseline
from HyperSphere.dummy.plotting.plot_color import algorithm_color
def optimum_plot(fun... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
import torch.nn as nn
from utils.torch_helpers import _device
from utils.geometry import (
pixel_grid,
focal_length,
project,
pixels_to_points,
reproject_points,
sample,
)
def select_tensors(x):
"""
... |
"""
<NAME>
Python Version 3.9.7
Compares terminal exon positions of transcripts matched by GffCompare and creates boxplots.
"""
from collections import defaultdict
import numpy as np
import matplotlib.pyplot as plt
def tracking(gfftracking):
"""
Read the data from the GffCompare gffcmp.tracking file and
f... |
import socket
class PyCololight:
COMMAND_PREFIX = "535a30300000000000"
COMMAND_CONFIG = "20000000000000000000000000000000000100000000000000000004010301c"
COMMAND_EFFECT = "23000000000000000000000000000000000100000000000000000004010602ff"
CUSTOM_EFFECT_COLOURS = {
"Breath": {
"decima... |
# Copyright (c) 2014, <NAME>
#
# Released under the MIT license
#
# 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... |
import sys
import plotly.graph_objects as go
import numpy as np
from plotly.subplots import make_subplots
from scipy import interpolate
sys.path += ['src/01_data_processing', 'src/02_modelling', 'src/03_modell_evaluation', 'src/00_utils']
import spectrogram as spec
import train_test_split as splt
import train_model_a... |
import pickle
import pandas as pd
from pyspark.sql import functions as F
from pyspark.sql.functions import pandas_udf, PandasUDFType
from pyspark.sql.types import *
from pyspark.sql.types import StructType
from pyspark.sql.window import Window
def get_orientation_data(ds, wrist, ori=1, is_new_device=False,
... |
from operator import add
import numpy as np
import scipy.linalg as ln
import scipy.sparse as sp
# from pyspark import AccumulatorParam
from sklearn.decomposition import TruncatedSVD
from sklearn.utils.extmath import safe_sparse_dot
from ..base import SparkBroadcasterMixin
from ..rdd import DictRDD
from ..utils.valida... |
import gpflow
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from shgp.data.dataset import BananaDataset
from shgp.data.metadata_reinit import ReinitMetaDataset
from shgp.inducing.initialisation_methods import uniform_subsample, reinitialise_PGPR, h_reinitialise_PGPR
from shgp.utilities.gen... |
# -*- coding:utf-8 -*-
# ------------------------
# written by <NAME>
# 2018-10
# ------------------------
import os
import skimage.io
from skimage.color import rgb2gray
from scipy.io import loadmat
import numpy as np
import cv2
import math
import warnings
import random
import h5py
import scipy
warnings.filterwarnings... |
#!/usr/bin/python
import tools._init_paths
import cPickle
import os
from fast_rcnn.config import cfg
import numpy as np
from datasets.factory import get_imdb
import matplotlib.pyplot as plt
import matplotlib
import cv2
import random
import json
matplotlib.rcParams.update({'figure.max_open_warning':0})
def showImage... |
import logging
import json
import requests
from configparser import ConfigParser
from os import path
import kubernetes
import yaml
from argo.workflows import config
from argo.workflows.client import V1alpha1Api
from flask import Blueprint, jsonify, request
from kubernetes.client.rest import ApiException
from kubernete... |
import numpy as np
import matplotlib.pyplot as plt
from collections import defaultdict
import json, os
import datetime as dt
def extract_occupations_per_bay(data: dict):
form = data['date_format']
gates = []
for k1, v1 in data['bays'].items():
for k2, v2 in v1.items():
gates.append(f'{... |
import copy
import glob
import os
import time
import pickle
import matchingpennies
from collections import deque
import gym
import gym_compete
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from a2c_ppo_acktr import algo, utils
from a2c_ppo_acktr.algo... |
from collections import deque
import random
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
from tensorflow import keras, function
import numpy as np
import pickle
@function
def fast_predict(x, model) -> float:
return model(x, training=False)
def create_piece_dict() -> dict:
piece_encoder = {
"p"... |
from openpyxl import load_workbook
from openpyxl.styles import PatternFill
from pyecharts.charts import Bar, Pie
from pyecharts import options as opts
from pyecharts.options import InitOpts, TitleOpts, ToolboxOpts
from pyecharts.globals import ThemeType
import sys
WARNING_STRING = """
-> 请确保请假考勤按以下格式填写,如:
-> 事假: 事8
->... |
from typing import NamedTuple
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
_DEFAULT_POOLING = "max"
class CustomModel(keras.Model):
"""
An extended model which is needed due to the format of the data;
the `fit` logic stays the same.
"""
def train_step... |
from matplotlib import pyplot as plt
import numpy as np
from tools import FirstDerivative, SecondDerivative, GetA, GetInverseMatrix, GetTransposeMatrix
from functions import fun2, fun1, fun3, fun4, fun5, fun6, fun7, fun8
def judge_a(a):
if a is None:
print("无非负实数步长值!请修改X0的初始值")
return 1
elif a... |
import json
import requests
from time import sleep, time, ctime
import sys
import subprocess
import socket
def fuzzyLookup(key, word_list):
from difflib import SequenceMatcher as sm
max_ratio = 0.
best_match = ""
for ind in range(len(word_list)):
ratio = sm(None,key,word_list[ind]).ratio()
... |
# -*- coding: utf-8 -*-
from os import sys
from os import getenv
import argparse
from foxha import __version__
from .print_format import print_warning
from .query import Query
from .utils import Utils
from . import formatter
from . import connection
# Initializing global constants
CIPHER_SUITE = None
LOGGER = None
CO... |
#!/usr/bin/env python
"""
Build a map of observed markers relative to the camera.
Pipeline
1. Subscribe detected markers pose
2. Subscribe ego pose in time
3. Transform markers local pose to world pose
4. Data association: Identify unique gates by Weighted nearest neighbour (euclidean distance threshold?)
4.5. Correct ... |
from django.db.models import Sum
from djmoney.money import Money
from datetime import timedelta
import json
import re
from .models import get_default_currency, TransactionJournal, Transaction, Account
from .utilities import get_currency
def get_color_code(i):
color_codes = ["98, 181, 229", "134, 188, 37", "152... |
"""VMware vCenter plugin for integration tests."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from . import (
CloudProvider,
CloudEnvironment,
CloudEnvironmentConfig,
)
from ..util import (
find_executable,
display,
ConfigParser,
Appl... |
import os
import argparse
import numpy as np
import glob
import imageio
import scipy.io as sio
from plyfile import PlyElement, PlyData
from parse import parse
from sklearn.neighbors import NearestNeighbors as nnbrs
from scipy.spatial import KDTree
from collections import Counter
from multiprocessing import Pool
import ... |
# -*- coding:utf-8 -*-
import sqlalchemy as sa
from sqlalchemy import orm
from sqlalchemy.ext import declarative
from sqlalchemy.dialects.mysql import VARCHAR
from sqlalchemy.dialects.mysql import TINYINT
from sqlalchemy.dialects.mysql import SMALLINT
from sqlalchemy.dialects.mysql import INTEGER
from sqlalchemy.diale... |
from __future__ import absolute_import, division, print_function, unicode_literals
from collections import OrderedDict
import torch
from torch import nn
from torch.distributions import Distribution
from .lazy import LazyTensor
from .variational import VariationalStrategy
class Module(nn.Module):
def __init__(s... |
import numpy as np
import scipy as scp
import warnings
from nltk.tokenize import sent_tokenize
from mover._preprocessing import Preprocessor
def constraint_matrix_generator(n, m):
"""
Constuct the contraint matrix for the LP defined by Word mover´s Distance
params
-----... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.