text stringlengths 6.04k 39.5k |
|---|
'''
Created on 12 Sep 2017
@author: lia
'''
import random
import struct
from IPy import IP
from . import gtp_v2_commons
'''
8 7 6 5 4 3 2 1 Octets
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type = xxx (decimal) | 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-... |
from src.lib import *
from copy import deepcopy
from scipy.signal import decimate
def read_data(date, instrument, time_step):
path = os.path.join(PRICE_FLD, date, instrument+'.csv')
if not os.path.exists(path):
print('no such file: '+path)
return None
df_raw = pd.read_csv(path, parse_dates=['time'], index_col=... |
# author: <NAME>
# Licence: see, LICENSE
# No warranties, use it on your own risk
# purpose: load data from data directory
from modules.detector.tf_detector.research.object_detection.protos.string_int_label_map_pb2 import StringIntLabelMap, StringIntLabelMapItem
from modules.detector.tf_detector.research.object_detect... |
from django.shortcuts import render
import json
import csv
from django.http import Http404, HttpResponseRedirect, HttpResponse
from datetime import date
from data.models import *
def AD_date_to_BD_str(dateObj): # change AD to BD as string(ค.ศ. -> พ.ศ.) date -> d/m/Y (str)
# import pdb; pdb.set_trace()
if isin... |
"""
Some generic utilities for Experiment Design.
-- <EMAIL>
"""
# pylint: disable=invalid-name
# pylint: disable=unbalanced-tuple-unpacking
from argparse import Namespace
import numpy as np
# Local imports
from .cp_domain_utils import sample_from_cp_domain
from ..utils.general_utils import map_to_bounds, flatten... |
import climnet.utils.general_utils as gut
from tqdm import tqdm
import pandas as pd
import itertools
from importlib import reload
import climnet.utils.statistic_utils as sut
import xarray as xr
import numpy as np
import copy
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May',
'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov... |
# _*_ coding: utf_8 _*_
from enum import Enum
# Context sites for the 2 types of endpoints
mSite = 'https://members.iracing.com/membersite/member'
mStats = 'https://members.iracing.com/memberstats/member'
# IRACING SERVICE URLS
URL_LOGIN = 'https://members.iracing.com/membersite/login.jsp'
URL_LOGIN2 = 'https://memb... |
import time
from machine import Pin, UART, PWM, ADC
COMMAND_PARSE = b'\n'
# Orion 8-10in alt az replacement for bad control board
# DC motors and shaft IR encoders
# for raspberry pi pico to control factory drives and encoders
# az drive uses 0.000624 deg/count at shaft encoder
# alt drive uses 0.00073 deg/count at ... |
import cv2
from PIL import Image, ImageDraw
import numpy as np
import traceback
import math
from scipy import ndimage
class PuzzlePiece:
def __init__(self, contour):
self.contour = contour
self.contourDims = self.getXYMinAndWidthHeight()
self.sharpCorners = None
self.corners = Non... |
"""crs.py: RESQML coordinate reference system module."""
version = '5th July 2021'
import logging
log = logging.getLogger(__name__)
log.debug('crs.py version ' + version)
import math as maths
import uuid
import warnings
from typing import Dict, List, Optional, Tuple, Union
import numpy as np
import resqpy.model a... |
##############################################################################
# Copyright 2018 <NAME> and Zapata Computing, 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
#
#... |
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
# 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/LICEN... |
#!/usr/bin/env python
#
# icell8.utils.py: utility functions for handling ICELL8 data
# Copyright (C) University of Manchester 2017-2021 <NAME>
#
"""
icell8.utils.py
Utility classes and functions for processing the outputs from the ICELL8
single-cell platform.
Classes:
- ICell8WellList: class representing I... |
'''
Copyright (C) University of Science and Technology of China.
Licensed under the MIT License.
'''
import torch
import torch.nn as nn
import functools
from torch.autograd import Variable
import numpy as np
import torch.nn.functional as F
from models.networks.base_network import BaseNetwork
# feature encoder
class En... |
#! /usr/bin/env python
# set Android specific options
import os
import re
from copy import deepcopy
from waflib import Context, Errors, Logs, Options, Configure
def _get_android_arch(arch):
archs = {
'armv7a': 'arm',
'amd64': 'x86_64',
'mipsel': 'mips',
'mips64el': '... |
import os
import math
from collections import OrderedDict
import numpy as np
import torch
import tensorflow as tf
from transformer_pb2 import Transformer
from transformers import BartForConditionalGeneration
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
""" key是proto参数的值,value是一个强大的表达式,每个&&分割tensor name的匹配路径或表达式,每个匹配
路... |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#get_ipython().run_line_magic('matplotlib', 'inline')
import pickle, json, re, time
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoade... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: <NAME>
"""
Use insertion/deletion instead of the phrase table approach
"""
from __future__ import unicode_literals
import argparse
import codecs
import os
import random
import re
import sys
from collections import defaultdict
# hack for python2/3 compatibility
f... |
import sys
from skimage import io
from collections import OrderedDict
from data_preprocessing.rimes_data_preprocessing.rimes_line_information import RimesLineInformation
__author__ = "Dublin City University"
__copyright__ = "Copyright 2019, Dublin City University"
__credits__ = ["<NAME>"]
__license__ = "Dublin City Un... |
import argparse
import itertools
from dps import cfg
from dps.datasets import (
GridEmnistObjectDetectionDataset, EmnistObjectDetectionDataset,
VisualArithmeticDataset)
from dps.datasets.base import Environment
from dps.datasets.shapes import ShapesDataset, BlueXAboveRedCircle, SetThreeAttr
from dps.datasets.c... |
"""
stanCode Breakout Project
Adapted from <NAME>'s Breakout by
<NAME>, <NAME>, <NAME>,
and <NAME>.
File: extension/breakoutgraphics.py
Name: Ryan
This is my breakoutgraphics extension class. My OOP learning outcome.
"""
from functools import reduce
from campy.graphics.gcolor import GColor
from campy.graphics.gwind... |
import asyncio
import logging
from dataclasses import dataclass
from itertools import islice
from typing import AsyncIterator, Callable, Dict, Iterable, Iterator, List, Optional
from typing import Tuple as TupleType
from typing import Type, TypeVar, Union
import grpc
import grpc.aio
from async_generator import asyncco... |
import unittest
from r2c_isg.apis import api_map
from r2c_isg.loaders import Loader
from r2c_isg.loaders.web import webloader_map
from r2c_isg.structures import Dataset
from r2c_isg.structures.projects import PypiProject
from r2c_isg.structures.projects import project_map as registry_map
from tqdm import tqdm
from py... |
# Imports
import time
import json
# Setup logging.
try:
import logging
logger = logging.getLogger(__name__)
except:
try:
import logger
except:
class Logger(object):
level = 'INFO'
@classmethod
def debug(cls, text):
if cls.level == 'DE... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Copyright (c) 2021 PaddlePaddle 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/l... |
#!/usr/bin/env python
"""
Created by: <NAME> (2017)
Description: Functions for assigning genome properties.
"""
import pandas as pd
from pygenprop.evidence import Evidence
from pygenprop.functional_element import FunctionalElement
from pygenprop.genome_property import GenomeProperty
from pygenprop.step import Step
... |
from collections import deque
from copy import deepcopy
from itertools import product
import attr
from attr.validators import instance_of
from click import style
from utensor_cgen.ir import (MetaOperationInfo, OperationInfo, uTensorGraph,
uTensorGraphView)
from utensor_cgen.logger import ... |
#!/usr/bin/python3
# *_*coding:utf-8 *_*
import os
import sys
import subprocess
import traceback
from datetime import datetime
from pathlib import Path
import rich
from tqdm import tqdm
from rich.progress import track
from rich.console import Console
from os.path import dirname, abspath, join, basename, splitext
from... |
#!venv/bin/python3
import argparse
import itertools
import logging
import re
import sys
import time
from concurrent import futures
from concurrent.futures import Future
from concurrent.futures.thread import ThreadPoolExecutor
from datetime import datetime, timedelta
from typing import List, Pattern, AnyStr, Optional, ... |
# -*- coding: utf-8 -*-
#
# Copyright 2018-2020 Data61, CSIRO
#
# 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 applicabl... |
import os
from PIL import Image
from scipy.ndimage.filters import gaussian_filter
import cv2
import shutil # To copy the file
import sys
import numpy as np
import torch
from torchvision import transforms
from torch.utils.data import Dataset
import torch.nn.functional as F
import torchvision
from tqdm import tqdm
... |
import tensorflow as tf
import numpy as np
import math
def one_hot_matrix(labels, C):
"""
Creates a matrix where the i-th row corresponds to the ith class number and the jth column
corresponds to the jth training example. So if example j had a label i. Then entry (i,j)
... |
import h5py
import numpy as np
import multiprocessing as mp
from ..XpcsAna.xpcsmethods import mat2evt
from ..misc.progressbar import progress
from . import EdfMethods as edf
from . import CbfMethods as cbf
def get_case(detector):
"""select the way data are read
"""
if detector in ['id10_eiger_single_edf',... |
import hashlib
import matplotlib.pyplot as plt
from scipy import signal
from functools import wraps
from pudzu.charts import *
logger.setLevel(logging.INFO)
# naive gravity calculation that's fast enough because numpy
np.seterr(divide='ignore', invalid='ignore')
def force_components(rows, cols, linear=False):
... |
"""
##############################################################################
#
# Implementation of the 2D population evolution
#
# AUTHOR: Maciej_Bak
# AFFILIATION: University_of_Basel
# AFFILIATION: Swiss_Institute_of_Bioinformatics
# CONTACT: <EMAIL>
# CREATED: 13-08-2020
# LICENSE: MIT
#
########... |
# -*- coding: utf-8 -*-
'''
Subversion Fileserver Backend
After enabling this backend, branches, and tags in a remote subversion
repository are exposed to salt as different environments. This feature is
managed by the :conf_master:`fileserver_backend` option in the salt master
config.
This backend assumes a standard ... |
"""Functions that help define SQLAlchemy models."""
import re
from datetime import datetime
from typing import List, Tuple, Union
from warnings import warn
from sqlalchemy import Table, Column, ForeignKey, Sequence
from sqlalchemy.orm import backref as _backref, class_mapper, ColumnProperty
from sqlalchemy.orm.attrib... |
import argparse
import os
import sys
import cv2
import pickle
import numpy as np
import util_cal
import util_pipe
import util_lane
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from collections import deque
from moviepy.editor import VideoFileClip
from settings import PERSPECTIVE_FILE_... |
import os
from jacowvalidator.docutils.styles import check_style_detail, VALID_STYLES, VALID_NON_JACOW_STYLES
from jacowvalidator.docutils.page import get_text, check_title_case
from jacowvalidator.docutils.margins import check_sections
from jacowvalidator.docutils.styles import check_jacow_styles
from jacowvalidator.d... |
"""
PhaseSpace generation routines
The output momenta has always the structure (E, px, py, pz)
When a complete set of momenta is output the structure is (n_events, n_particles, n_dim)
"""
from .config import float_me, int_me, DTYPE, run_eager
import numpy as np
import copy
import tensorflow as tf
import... |
#!/usr/bin/env python
"""cflib.vcf
==============
This module provides functions to read, write and access vcf files.
Objects
-------
Classes:
- :class:`NucBase`, store a nucleotide base
- :class:`VCFStream`, a variant call format (VCF) stream object
- :class:`VCFSeq`, a VCF file sequence object
Exception Cla... |
import time
import numpy as np
import pandas as pd
from scipy.sparse import issparse
from sklearn.decomposition import PCA
from typing import Tuple
from anndata import AnnData
import logging
logger = logging.getLogger("sccloud")
def qc_metrics(
data: AnnData,
mito_prefix: str = "MT-",
min_genes: int =... |
import numpy as np
import torch
import utils_basic
# import kornia
# import multiprocess_flag
import hyperparams as hyp
'''
Using these references to generate rotations:
https://torchgeometry.readthedocs.io/en/latest/warp_affine.html
https://bitbucket.org/adamharley/discovery/src/d55d58e556ee9c66fead01cdf4deef424263... |
# Copyright 2019 PrivateStorage.io, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
#!/usr/bin/env python
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# 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 limi... |
import torch
from torch.jit import script, trace
import torch.nn as nn
from torch import optim
import torch.nn.functional as F
import csv
import random
import re
import os
import unicodedata
import codecs
from io import open
import itertools
import math
import numpy as np
from scipy.spatial import distance
from loss i... |
import numpy as np
# Local modules
from constants import DEFAULT_N0, DEFAULT_N1, DEFAULT_N2, NO_INTERSECTION
from normal_map import NormalMap
import utils
class Object:
"""
Represent a generic object inside the scene that has a specific position,
material and intersect function.
Attributes:
p... |
import os
import math
import cv2
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element, SubElement, ElementTree
from xml.dom import minidom
import shutil
import numpy as np
def is_exist_dir(dir):
if not os.path.exists(dir):
os.makedirs(dir)
def prettify(elem):
"""Return a pret... |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import numpy as np
from typing import Dict
import fvcore.nn.weight_init as weight_init
import torch
import torch.nn as nn
from torch.nn import functional as F
from detectron2.layers import Conv2d, ShapeSpec, get_norm
from d... |
import os
#from sqlite3.dbapi2 import Date
import sys
import random
# pip install pyqt5-tools
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from matplotlib.pyplot import get
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
from init import *
from agent import Mqtt_client
impo... |
"""
Basic plotting functions to operate on gridded netCDF output by pyglider https://github.com/c-proof/pyglider
Based on work by <NAME> and <NAME> https://github.com/ESiddle/basestation_plotting
"""
import sys
import os
import logging
import json
import gsw
import pandas as pd
import xarray as xr
from cmocean import c... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
# --------------------------------------------------------------------------
# Licensed under the MIT license.
# See License.txt in the project root for further license information.
# --------------------------------------------------------------------------
############################################################... |
#!/usr/bin/env python3
# Plot results from proximity-based calib experiments (multiple trials)
#
# <NAME>
# April 15, 2021
import sys
import os
import pickle
import numpy as np
import scipy.stats
import matplotlib.pyplot as pl
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_sp... |
import sys
import _thread
#from types import ClassType
from weakref import WeakValueDictionary
from webware.MiscUtils import NoDefault
from webware.MiscUtils.Funcs import safeDescription
from .ObjectKey import ObjectKey
from MiddleKit.Core.ModelUser import ModelUser
from MiddleKit.Core.Klass import Klass as BaseKlass... |
r"""
Morphisms of chain complexes
AUTHORS:
- <NAME> <<EMAIL>> (2009.06)
- <NAME> (2012-08-18): Made all simplicial complexes immutable to
work with the homset cache.
This module implements morphisms of chain complexes. The input is a dictionary
whose keys are in the grading group of the chain complex and whose va... |
###############################################################################
# Copyright 2020 UChicago Argonne, LLC.
# (c.f. AUTHORS, LICENSE)
# SPDX-License-Identifier: BSD-3-Clause
##############################################################################
import os
import sys
import ctypes
import time
import ... |
#!/usr/bin/env python
# Copyright (c) 2017 The Khronos Group 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 ap... |
# Licensed under an MIT open source license - see LICENSE
from __future__ import print_function, absolute_import, division
from warnings import warn
import numpy as np
import numpy.fft as fft
from scipy.interpolate import LSQUnivariateSpline, interp1d
from astropy.modeling import fitting, models
from astropy.modeling ... |
#####################################################
# Copyright (c) <NAME> [GitHub D-X-Y], 2020.08 #
##############################################################################
# NATS-Bench: Benchmarking NAS algorithms for Architecture Topology and Size #
###########################################################... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2012 New Dream Network, LLC (DreamHost)
#
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# 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
#
# ... |
from collections import OrderedDict
from typing import Union, Optional, Sequence, Iterator, Dict, Tuple, Type, Collection, Callable
from warnings import warn
import torch
import numpy as np
from sklearn.model_selection import StratifiedShuffleSplit
from ..utils import validate_1d_like, validate_tensors, validate_grou... |
import collections
import copy
import json
import unittest
try:
import yaml
skip_yaml = False
except ImportError:
skip_yaml = True
import marshmallow_objects as marshmallow
class A(marshmallow.Model):
test_field = marshmallow.fields.Str(missing='test_value', allow_none=False)
tag_field = marshm... |
from collections import OrderedDict
import os
import itertools
import re
import numpy as np
from copy import deepcopy
from collections import Iterable
from scipy.spatial.distance import cdist
from chargetools import constants, grids
from chargetools.exceptions import InputError
from chargetools.utils.utils import in... |
import copy as cp
import numpy as np
from scipy import optimize
from scipy import sparse
import time
import matplotlib.pyplot as plt
from sklearn import svm, datasets
from sklearn.metrics import roc_curve, auc ###计算roc和auc
from sklearn import cross_validation
import matplotlib as mpl
mpl.rcParams['font.sans-serif'] ... |
import copy
import datetime as dt
import os
import pathlib
import pickle
import sys
import warnings
import pandas as pd
import pytest
import wrfhydropy
sys.path.insert(0, str(pathlib.Path(__file__).parent))
from utilities import print_diffs, wait_job
EXCLUDE_VARS_CHAN_ONLY = [
'stc1',
'smc1',
'sh2ox1',
... |
import os
import h5py
import pandas as pd
import spacy
import torch
from torch.nn.utils.rnn import pad_sequence
from torch.utils.data.dataset import Dataset
from torchtext import data
import numpy as np
def load_multimodal_features_from_h5(feat_h5_video, feat_h5_audio, feature_names_list,
... |
# Copyright (c) 2019 <NAME>
# https://github.com/grzracz
# Files available under MIT license
from threading import Thread
from queue import Queue, LifoQueue as Stack
from datetime import datetime
from re import compile
from sys import argv
import os.path
STARTING_TIME = datetime.now()
def matching_tag(tag):
... |
import sys
from urllib.request import urlopen
import json
import re
import datetime
import uuid
from bs4 import BeautifulSoup
quick_access = {} # access contestants throughout
class Game(object):
def __init__(self, link, season):
self.link = link
self.html = self.get_html()
self.season = ... |
"""
Module to handle the various file-trees in the GUI
"""
import gtk, gobject, guiutils, plugins, os, sys, operator, logging, string
from ordereddict import OrderedDict
from copy import copy
class FileViewGUI(guiutils.SubGUI):
def __init__(self, dynamic, title = "", popupGUI = None):
guiutils.SubGUI.__i... |
#!/usr/bin/env python
import datetime
from datetime import timedelta
import json
import os
import random
import string
import httplib2
from flask import (
Flask, Response, jsonify, make_response, render_template, request, session)
from oauth2client.client import flow_from_clientsecrets, FlowExchangeError
from ... |
#!/usr/bin/env python3
'''
This software was created by United States Government employees at
The Center for Cybersecurity and Cyber Operations (C3O)
at the Naval Postgraduate School NPS. Please note that within the
United States, copyright protection is not available for any works
created by United States Govern... |
# -*- coding: utf-8 -*-
'''
#-------------------------------------------------------------------------------
# NATIONAL UNIVERSITY OF SINGAPORE - NUS
# SINGAPORE INSTITUTE FOR NEUROTECHNOLOGY - SINAPSE
# Singapore
# URL: http://www.sinapseinstitute.org
#------------------------------------------------------------------... |
from typing import List, Dict, Pattern, Optional
from collections import namedtuple
from decimal import Decimal, getcontext
import copy
import regex
from recognizers_text.utilities import RegExpUtility
from recognizers_text.culture import Culture
from recognizers_text.extractor import ExtractResult
from recognizers_te... |
# This file contains DGL distributed kvstore APIs.
from ..network import _create_sender, _create_receiver
from ..network import _finalize_sender, _finalize_receiver
from ..network import _network_wait, _add_receiver_addr
from ..network import _receiver_wait, _sender_connect
from ..network import _send_kv_msg, _recv_kv_... |
# import sys
from pathlib import Path
# from collections import namedtuple
# from datetime import datetime
import decimal
# import os
# import multiprocessing
# from functools import partial
# from itertools import repeat
import numpy as np
import pandas as pd
import scipy
# from scipy.stats import linregress
imp... |
from direct.gui.DirectGui import *
from pandac.PandaModules import *
from direct.task.Task import Task
from direct.fsm import ClassicFSM
from direct.fsm import State
from direct.directnotify import DirectNotifyGlobal
from otp.otpbase import OTPLocalizer
from otp.otpbase import OTPGlobals
from otp.uberdog.RejectCode imp... |
# -*- coding: utf-8 -*-
"""
The PokerTH protocol consisting of messages and replies with respect to the
current state in the communication.
"""
from __future__ import print_function, absolute_import, division
from twisted.internet import reactor
from twisted.python import log
from twisted.internet.protocol import Prot... |
"""Functions shared between different beamformer types."""
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
from copy import deepcopy
import numpy as np
from scipy import linalg
from ..cov import Covariance, make_ad_hoc_cov
from ..forward.forward import... |
#!/usr/bin/env python3
import datetime
import docker
import fasteners
import git
import hashlib
import json
import logging
import math
import os
import re
import requests
import sys
logging.basicConfig(
level = logging.INFO, format = '[%(asctime)s] %(levelname)s: %(message)s')
# Set parallel jobs based on both C... |
import arabic_reshaper
import itertools
import math
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import seaborn as sns
import sys
import warnings
from bidi.algorithm import get_display
from matplotlib import rc
from matplotlib.backends import backend_gtk3
from iran_stock import get... |
import asyncio
import time
import traceback
from datetime import datetime, timedelta
from typing import Dict, List, Optional, Tuple, Union
from discord import Activity, Game, Intents, TextChannel, VoiceChannel
from discord.ext.commands import BadArgument, Bot, Cog
from discord_slash import SlashCommand, SlashContext, ... |
#!/usr/bin/python
#***************************************************************************
# Copyright 2015 IBM
#
# 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.a... |
"""
Loader, model, utility fns related to the classifier
"""
import pickle
import os
import numpy as np
from torch.utils.data import Dataset
import torch.nn as nn
import torch
import random
from sklearn import metrics
import pandas as pd
#################################################
def adjust_learning_rate(optim... |
import numpy as np
from glob import glob
from .helper_functions import print_msg
from . import const
from . import conv
class Halo:
'''
A simple struct to hold info about a single halo
'''
def __init__(self):
self.pos = [0.0, 0.0, 0.0] # Position in grid points
self.pos_cm = [0.0, 0.0, 0.0] # Center of mass p... |
from absl import flags
import numpy as np
import scipy.sparse
import scipy.sparse.linalg
import tensorflow as tf
import tensorflow_probability as tfp
import tqdm
flags.DEFINE_bool('disable_svd_compute_cache', False,
'If set, disables the cache (i.e. can recompute subexpressions')
FLAGS = flags.FLAG... |
# -*- coding: utf-8 -*-
"""
.. module:: clustering
:synopsis: The main Clustering class
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import copy
from collections import defaultdict
import numpy as np
import networkx as nx
from clusim.dag import Dendrogram
class Clustering(object):
"""
Base class for cluster... |
import base64
import datetime
import re
import string
import urllib.parse as urlparse
from io import BytesIO
from typing import Union
from unittest import mock
import urllib.parse
import arrow
import pytest
from azure.storage.blob import BlobClient, BlobProperties, ContainerClient, BlobPrefix
from keg_storage import ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: keycloak_identity_provider
short_description: Allows administra... |
#!/usr/bin/env python
#
# Copyright 2017-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 ... |
import numpy as np
import matplotlib.pyplot as plt
from random import random
from numba import njit
import random as rand
class Toric_code():
nbr_eq_classes = 16
def __init__(self, size):
self.system_size = size
self.qubit_matrix = np.zeros((2, self.system_size, self.system_size), dtype=np.ui... |
#!/bin/env/python
#! -*- coding: utf-8 -*-
"""
This module is intended to help with the use of SBB.Time_quadratures.time_quadratures
Last update
-----------
This use to be a class and is now a module
Todos :
Bugs :
"""
import numpy
from SBB.Time_quadratures.time_quadratures import TimeQuad_uint64_t
from SBB.U... |
# coding: utf-8
#from google.colab import drive
import torch
import torch.nn as nn
import numpy as np
import matplotlib.pyplot as plt
import torchvision
from torchvision import transforms
from torch.utils.data import DataLoader
from torch.autograd import grad as torch_grad
# *Python Machine Learning, PyTorch Editi... |
import sys, time, os, json
import numpy as np
import matplotlib.pylab as plt
import tensorflow as tf
import keras.backend as K
from PIL import Image, ImageOps
from keras.models import *
from keras.layers import *
from keras.layers.merge import _Merge
from keras.optimizers import *
from google.colab import dri... |
#!/usr/bin/env python3
import os
from os import path as op
import sys
import hashlib
def gen_hash(template):
return '{0}-{1}'.format(
hashlib.sha1(template.encode("utf-8")).hexdigest(),
hashlib.md5(os.urandom(16)).hexdigest())
import logging
rand_hash = gen_hash(sys.argv[1])
hist_fn = op.a... |
"""Experiment to check the validation of generative BT
on two sequential tasks.
"""
import numpy as np
import pickle
# from joblib import Parallel, delayed
from mdp import GridMDPModfySeq, GridMDPModfy, orientations, dictmax, create_policy
from ltl2btrevised import (
Globally, Finally, Negation, Next, PropCondi... |
# -*- coding: utf-8 -*-
"""Core functionality
License: See LICENSE file.
"""
import base64
import binascii
import datetime as dt
import logging
import os
import shutil
import sqlite3
import uuid
from typing import List
from .__version__ import __version__
from .addressbook import Addressbook
from .addressbook imp... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__AUTHOR__ = '<NAME>'
__VERSION__ = 6
'''
Name: minimon.py
Author: <NAME> / https://github.com/bruno-sf
Released at: Jan 2019
Purpose: Check if a service/host is up (green), down(red) and shows when status changes(yellow).
License: This project is licensed under the MIT Li... |
import traceback
import argparse
import sys
import os
import csv
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torchvision import datasets, transforms
import vgg
from torch.utils.data import DataLoader
from torch.optim import SGD, Adam
from hype... |
from os import path, mkdir
from time import time
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
from scipy.spatial import Delaunay
from scipy.interpolate import LinearNDInterpolator as LinNDInterp
class vtu_reader():
"""Class to read vtu data format into numpy arrays.
:arg direct... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.