text stringlengths 6.04k 39.5k |
|---|
"""
Wildqat is an open source Python framework for QUBO.
"""
import numpy as np
def pauli(qubo):
"""
Convert to pauli operators of universal gate model.
Requires blueqat.
"""
from blueqat.pauli import qubo_bit
h = 0.0
assert all(len(q) == len(qubo) for q in qubo)
for i in range(len(qubo)):
h += qubo_bit(i) ... |
import pandas as pd
import matplotlib.pyplot as plt
from src.utils.identification.PI_Identifier import PI_Identifier
from src.utils.solution_processing import *
from differentiation.spectral_derivative import compute_spectral_derivative
from filtering.SpectralFilter import SpectralFilter
from tools import halve, mirror... |
import abc
import enum
import utils
class GradientDescents(enum.Enum):
GradientDescent = 1,
MiniBatchGradientDescent = 2,
StochasticGradientDescent = 3
class Neuron:
def __init__(
self) -> None:
super().__init__()
self.layer = None
self.input = None
self.output = None
self.delta = None
cla... |
# specialized for only 4 models
# use file to sync
from copy import deepcopy
import queue
import time
import os
import traceback
import random
import torch
import numpy as np
from src.utils.utils import timer
import torch.multiprocessing as mp
import threading
from torch.multiprocessing import Pipe
from metadl.api.ap... |
import datetime
import traceback
import requests
import re
import time
import math
import json
class BuildAnalyzer:
def __init__(self, build):
self.commit_sha = build['commit']['sha']
self.branch = build['branch']['name']
self.author = build['commit']['author']['name']
self.build_... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import shutil
import s... |
"""
The module, which contains all the classes which are directly concerned with the search action.
This includes the classes SearchResult, SearchBatch, SearchOptions and the batching strategies
"""
import os
import csv
import json
import datetime
from collections import deque
from typing import Tuple, Type, List, Un... |
# -*- coding: utf-8 -*-
u"""Common execution template.
:copyright: Copyright (c) 2015 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkcompat
from pykern import pkio
from pykern impor... |
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
from torch.autograd import Variable
from layers import *
from .peleenet import *
#import config as cfg
class SSD(nn.Module):
"""Single Shot Multibox Architecture
The network is composed of a base PeleeNet... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# File : dnn_based.py
# Environment : Python 3.5.2
# OpenCV 3.4.5
# TensorFlow 1.13.0-rc2
"""
DNN Based Lane Segmentation
"""
import cv2
import os
import os.path as ops
import math
import matplotlib.image as mpimg
import matplotlib.pyplot as... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from beartype import beartype
from PyMieSim.Tools.LPModes import GetFarFieldLP
from PyMieSim.bin.LMTScatterer import Experiment as Binding
from PyMieSim.Tools import Config
from PyMieSim.Tools.ErrorM... |
"""
!/usr/bin/env python3
-*- coding: utf-8 -*-
----------------------------------------------------------------------
Copyright 2021 CFS Engineering
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... |
# Copyright 2019 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 agreed to... |
from luna.common.Neo4jConnection import Neo4jConnection
from luna.common.Node import Node, CONTAINER_TYPES
from luna.common.config import ConfigSet
import os, socket, pathlib, logging, shutil
from minio import Minio
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor, as_completed
logger = logging... |
"""Base class for models."""
from __future__ import print_function
import time
import abc
import six
import tensorflow as tf
from opennmt.utils import decay
from opennmt.utils.misc import add_dict_to_collection, item_or_tuple
def learning_rate_decay_fn(decay_type,
decay_rate,
... |
# -*- coding: UTF-8 -*-
# **********************************************************************************#
# File: Report file
# **********************************************************************************#
import pandas as pd
from copy import deepcopy, copy
from . risk_metrics import *
from .. utils.datet... |
import sys
import os
import math
import matplotlib.pyplot as plt
import numpy as np
import scipy.integrate
from scipy.fftpack import fft
from scipy.signal import butter, lfilter, freqz
#For Gaussian Fitting
from scipy.optimize import curve_fit
from numpy import exp, linspace, random
import SBCcode
from SBCcode.Tools im... |
# <NAME>
# Stanford Summer Research Program - Funded by Amgen Foundation
# Created July 11, 2017
# The purpose of this code is to create a neural network that performs binary classification on MRI images with and without motion artifacts
# Artifacts have been introduced into images using mr-artifacts-v1.py, imported ... |
# import packages
import numpy as np
import cv2
def rgb_select(img, r_thresh, g_thresh, b_thresh):
b_channel = img[:,:,0]
g_channel = img[:,:,1]
r_channel = img[:,:,2]
r_binary = np.zeros_like(r_channel)
r_binary[(r_channel > r_thresh[0]) & (r_channel <= r_thresh[1])] = 1
g_binary = np.zeros_l... |
""" This file contains different utility functions that are not connected
in anyway to the networks presented in the tutorials, but rather help in
processing the outputs into a more understandable way.
For example ``tile_raster_images`` helps in generating a easy to grasp
image from a set of samples or weights.
"""
fr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
import matplotlib.pyplot as plt
import numpy as np
from plot import plot_complex_region, plot_simple_region, plot_uniform_region
from utils import intercept
"""
Method of Characteristics implementation to design a nozzle for shock free flowflow
"""
# Constant... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torchvision.transforms as transforms
import torchvision.models as models
import torch.backends.cudnn as cudnn
from models.base_blocks import *
class BasicRFB(nn.Module):
def __init__(self, in_planes, out_... |
# -*- coding: utf-8 -*-
# Author: <NAME>
# Copyright: Stateoftheart AI PBC 2021.
'''Hugging Face's Library wrapper.
Model information taken from:
Dataset information taken from:
'''
SOURCE_METADATA = {
'name': 'huggingface',
'original_name': 'Hugging Face',
'url': 'https://huggingface.co/'
}
MODELS = {
... |
# CS422 - Data Analytics
# <NAME> & <NAME>
# 2/22/2017
"K-Nearest-Neighbors Classifier with test data"
import csv
import math
import operator
import copy
import sys
#offset values by a small amount to avoid division by 0
EPSI = sys.float_info.epsilon
#functions
#main function
def main():
"main function"
BUP... |
import requests
import json
import pandas as pd
import numpy as np
import sys
import logging
from pathlib import Path
logging.basicConfig(filename='logging_for_get_access_control_list.log',level=logging.INFO)
"""
This python script is used to get the permissions of the Permission Template and output it as a csv file.
... |
import sys
import torch
import torch.nn as nn
from torch import optim
from torch.autograd import Variable
import numpy as np
import matplotlib.pyplot as plt
from ToyProblems.LSTM_PolicyGradient import Net
from library_review.PyTorch_LSTM_Sample import init_weights
from itertools import combinations
from curve import Hi... |
import functools
import gc
import json
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import bmm
def read_data(path, chunksize=None):
data_reader = pd.read_csv(path, chunksize=10)
data_columns = data_reader.get_chunk().columns
polyline_converters = {col_name: json.loads for col_n... |
"""
Module for lattice models
"""
from argparse import Namespace
import subprocess
import math
import torch
import pytorch_lightning as pl
import lattice.markov_solvers
from lattice.markov_solvers import find_particle_position
import lattice.nets
import lattice.potentials
try:
git_commit = subprocess.check_out... |
#!/usr/bin/env python
'''
Generates the Standard Product Enumeration Report
'''
from __future__ import print_function
from builtins import range
import re
import os
import json
import shutil
import urllib3
import hashlib
import datetime
import requests
from openpyxl import Workbook
import dateutil.parser
from hysds.ce... |
#!/usr/bin/env python
from __future__ import print_function ##Allow Python 3.X printing for Python 2
import os, re, sys
import requests
# Example of python queries to the Ensembl REST endpoints
# Your usage of the data returned by the REST service is
# subject to same conditions as laid out on the Ensembl website.
#... |
# TODO that would make IPython integration better
# - show output other times then when enter was pressed
# - support proper exit to allow IPython to cleanup (e.g. temp files created with %edit)
# - support Ctrl-D (Ctrl-Z on Windows)
# - use IPython (numbered) prompts in PyDev
# - better integration of IPython and PyDe... |
"""Download handlers for http and https schemes"""
import ipaddress
import logging
import re
import warnings
from contextlib import suppress
from io import BytesIO
from time import time
from urllib.parse import urldefrag, urlunparse
from twisted.internet import defer, protocol, ssl
from twisted.internet.endpoints imp... |
import argparse
import os
import logging
import sys
import itertools
import numpy as np
import torch
from torch.utils.data import DataLoader, ConcatDataset
from torch.optim.lr_scheduler import CosineAnnealingLR, MultiStepLR
from tensorboardX import SummaryWriter
from vision.transforms.transforms import ToAbsoluteCoor... |
#!/usr/bin/env python
# Train CIFAR10 with PyTorch.
# based on: https://github.com/kuangliu/pytorch-cifar
# extract_features_and_evaltainer: zhaoyafei (https://github.com/walkoncross, <EMAIL>)
from __future__ import print_function
import os
import os.path as osp
import argparse
import time
import sys
# import json
fr... |
import datetime
import hashlib
import os
import pathlib
import re
import urllib.request
import re
from io import BytesIO
from typing import Optional, List, Tuple
from urllib.parse import urlparse, parse_qsl, ParseResult
import imagehash
import requests
import telegram
from PIL import Image
from pytils.numeral import g... |
import logging
import math
import sys
from typing import Any, Generator, Optional, Tuple
import determined as det
from determined import _generic, tensorboard, workload
from determined.common import check, constants
from determined.experimental import client
WorkloadStreamElem = Tuple[workload.Workload, workload.Resp... |
# coding: utf-8
from dataclasses import dataclass
from datetime import datetime
from typing import List
from transitions import Machine
from .enum import Mark, Direction, Freq, Operate
from .utils.ta import RSQ
@dataclass
class Tick:
symbol: str
name: str = ""
price: float = 0
vol: float = 0
@datacl... |
from datetime import datetime, timedelta
from decimal import Decimal
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from django_etuovi.enums import (
Condition,
Country,
HoldingType,
ItemGroup,
LinkType,
RealtyGroup,
RealtyImageType,
RealtyOption,... |
# MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2020
#
# 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
# r... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Ve... |
# -*- coding: utf-8 -*-
"""
Building and simulating spiking neural networks using
`pyNN <http://neuralensemble.org/docs/PyNN/>`_.
@author: rbodo
"""
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import os
import sys
import time
import warnings
import numpy ... |
import json
import os
import sys
import uuid
from ctypes import (
addressof, byref, c_buffer, c_char_p, c_double, c_int, c_void_p, string_at,
)
from django.contrib.gis.gdal.driver import Driver
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.gdal.prototypes import raster as capi
fro... |
import json
import os
import tarfile
import time
import subprocess
from contextlib import closing
from datetime import datetime
import requests
def get_dict_from_file(file_name):
with open(file_name, 'r', encoding='utf-8') as f:
json_info = json.load(f)
return json_info
def serving_connect(serving_... |
"""
Support for Z-Wave.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zwave/
"""
import logging
import os.path
import time
from pprint import pprint
import voluptuous as vol
from homeassistant.helpers import discovery
from homeassistant.const import ... |
#!/usr/bin/env python3
import warnings
from abc import abstractmethod
from copy import deepcopy
import torch
from torch.nn import ModuleList
from .. import settings
from ..constraints import Positive
from ..lazy import LazyEvaluatedKernelTensor, ZeroLazyTensor, delazify, lazify
from ..models import exact_prediction_... |
# TODO Non-Linear Regressions can be used
# TODO Further decomposition of the two_fold parameters i.e.
# the delta method for further two_fold detail
"""
Author: <NAME>
This class implements Oaxaca-Blinder Decomposition. It returns
a OaxacaResults Class:
OaxacaBlinder:
Two-Fold (two_fold)
Three-Fold (three_fold)
Oax... |
"""Hyperion config flow."""
from __future__ import annotations
import asyncio
from contextlib import suppress
import logging
from typing import Any
from urllib.parse import urlparse
from hyperion import client, const
import voluptuous as vol
from homeassistant.components.ssdp import ATTR_SSDP_LOCATION, ATTR_UPNP_SER... |
"""
Models and managers for generic tagging.
"""
# Python 2.3 compatibility
try:
set
except NameError:
from sets import Set as set
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import connection, models
from django.db.models.query impo... |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
import binascii
import copy
import os
import re
import time
from datetime import datetime
from datetime import timedelta
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import a... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2012-2016 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from pathlib import Path
import os
import sys
import time
import cv2
import numpy as np
import pandas as pd
from cova.dnn import infer, metrics
from cova.motion import object_crop as crop
from cova.motion.motion_detector import merge_overlapping_boxes, re... |
# Copyright 2016 MongoDB, 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, so... |
#!/usr/bin/env python3
import subprocess
import sys
import os
import distutils.spawn
import copy
import shutil
import multiprocessing
import argparse
basePath = os.path.dirname(os.path.realpath(__file__))
def extract_versions_from_installed_folder(folder, version, arch):
files = [x.decode("utf-8").strip() for x... |
from __future__ import absolute_import
from typing import Any, Optional, Tuple, List, Set, Iterable, Mapping, Callable, Dict
from django.utils.translation import ugettext as _
from django.conf import settings
from django.db import transaction
from django.http import HttpRequest, HttpResponse
from zerver.lib.request i... |
#!/usr/bin/env python
"""
epub object to create an epub ebook
"""
from lxml import etree as ET
# import lxml.builder as builder
from lxml import html as HT
# from lxml.etree import Element
import os
import zipfile
import htmlentitydefs
import re
# import logging
def valid_filename(strname):
"""
create a va... |
# coding=utf-8
# Copyright 2019 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
from __future__ import absolute_import, unicode_literals
__version__ = '0.40'
__license__ = 'MIT'
import re
import os
import sys
import time
import logging
import marshal
import tempfile
import threading
from math import log
from hashlib import md5
from ._compat import *
from . import finalseg
if os.name == 'nt':
... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import intelliflow.api_ext as flow
from intelliflow.api_ext import *
from intelliflow.core.platform.compute_targets.email import EMAIL
from intelliflow.core.platform.constructs import BatchCompute as BatchComputeDrive... |
# Copyright 2018 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 applicab... |
# Copyright 2018 BLEMUNDSBURY AI 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 law or agreed to ... |
#!/usr/bin/env python
from __future__ import print_function
"""
This script parses each "meta" file and extracts the
information needed to deduce build and src dependencies.
It works much the same as the original shell script, but is
*much* more efficient.
The parsing work is handled by the class MetaFile.
We only ... |
import re
from functools import lru_cache
from typing import Dict, Iterable, Optional, Tuple, Union
import dateutil.parser as dp
import requests
from pydantic import validator
from requests.models import HTTPBasicAuth, HTTPError
from sqllineage.runner import LineageRunner
import datahub.emitter.mce_builder as builder... |
#-------------------------------------------------------------
# Name: Import ArcGIS Server Users
# Purpose: Imports a list of users provided in a CSV file to ArcGIS server, assigning to
# roles and setting default password.
# Author: <NAME> (<EMAIL>)
# Date Created: 15/05/2014
# Last U... |
"""
Defines various Select widgets which allow choosing one or more items
from a list of options.
"""
from __future__ import absolute_import, division, unicode_literals
import re
from collections import OrderedDict
import param
from bokeh.models.widgets import (
AutocompleteInput as _BkAutocompleteInput, Checkb... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
#*** License Agreement ***
#
# High Energy Physics Deep Learning Convolutional Neural Network Benchmark
# (HEPCNNB) Copyright (c) 2017, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy). All rights ... |
"""
File Name: resultdisp/process.py
Author: <NAME>
Created: November 2019 (Refactored April 2020)
Description: Processes model results for visualization
Uses methods:
- hists: Processes a model histories for each scenario into results histories by comparing the states over time in each scenari... |
from typing import Any, ClassVar, Dict, List, Optional, Type, Union
from commonmark.blocks import Parser
from . import box
from ._loop import loop_first
from ._stack import Stack
from .console import Console, ConsoleOptions, JustifyMethod, RenderResult
from .containers import Renderables
from .jupyter import JupyterM... |
"""A Python API for the MiniSat_ and MiniCard_ constraint solvers.
.. _MiniSat: http://minisat.se/
.. _MiniCard: http://git.io/minicard
Classes:
Solver
An abstract base class for the other classes.
SubsetMixin
A mixin class adding 'subset' functionality to Solver subclasses.
:class:`MinisatSolver`
... |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright SAS Institute
#
# 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 b... |
import torch
from nltk import sent_tokenize, word_tokenize
from collections import defaultdict
import json
import pandas as pd
import pickle
from nltk.tag.perceptron import PerceptronTagger
from nltk.stem.porter import *
from transformers import BertTokenizer, GPT2Tokenizer
from lemmagen3 import Lemmatizer
import Latvi... |
import html
import os
import pathlib
import shutil
from collections import OrderedDict
from scripts.html_parts import *
from scripts.ilapfuncs import logfunc
from scripts.version_info import aleapp_version, aleapp_contributors
def get_icon_name(category, artifact):
''' Returns the icon name from the feathericons ... |
import sys
import threading
from PyQt5.QtWidgets import *
from PyQt5.QAxContainer import *
import pythoncom
import datetime
from pykiwoom import parser
import pandas as pd
import time
import logging
import multiprocessing as mp
from .manager import *
logging.basicConfig(filename="log.txt", level=logging.ERROR)
class... |
# Copyright 2020 The FedLearner 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... |
import re
import logging
import mimetypes
import json
import requests
from bs4 import BeautifulSoup
_logger = logging.getLogger(__name__)
class BaseMIMEParser(object):
"""
BaseMIMEParser can be sub-classed to define custom handlers for determining
the MIME type of external urls.
"""
pattern = re... |
"""Client"""
from __future__ import annotations
from datetime import datetime
import json
import logging
import random
from gpsoauth import perform_master_login, perform_oauth
import grpc
from zeroconf import Zeroconf
from .const import (
ACCESS_TOKEN_APP_NAME,
ACCESS_TOKEN_CLIENT_SIGNATURE,
ACCESS_TOKEN... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
import struct
import datetime
import io
import os
import os.path
import sys
if sys.platform == 'darwin':
from . import osx
try:
long
except NameError:
long = int
from .utils import mac_epoch
ALIAS_KIND_F... |
# 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 os
import sys
import struct
import argparse
from collections import defaultdict
from jitlog import constants as const, merge_point
PY3 = sys.version_info[0] >= 3
class FlatOp(object):
def __init__(self, opnum, opname, args, result,
descr=None, descr_number=None, failargs=None):
sel... |
# epydoc -- Marked-up Representations for Python Values
#
# Copyright (C) 2005 <NAME>
# Author: <NAME> <<EMAIL>>
# URL: <http://epydoc.sf.net>
#
# $Id: apidoc.py 1448 2007-02-11 00:05:34Z dvarrazzo $
"""
Syntax highlighter for Python values. Currently provides special
colorization support for:
- lists, tuples, set... |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
import pyte... |
# -*- coding: utf-8 -*-
##############
##### Python sever interacting with javascript client
##############
# See dyadic_interaction.js for a summary of the communication channel - we are using
# json-encoded dictionaries to send messages back and forth between server and client.
# Each message from the server to th... |
# https://pytorch.org/docs/stable/torch.html#math-operations
import math
import torch
class PointwiseOpsModule(torch.nn.Module):
def __init__(self):
super(PointwiseOpsModule, self).__init__()
def forward(self):
return self.pointwise_ops()
def pointwise_ops(self):
a = torch.rand... |
import csv
import io
import os
import sys
import threading
import uuid
from collections import defaultdict
from enum import Enum
from itertools import groupby
import yaml
from dotenv import load_dotenv
from flask import Flask, jsonify, make_response, redirect, render_template,\
request, send_file, url_for
from fla... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
=Get Players' Data=
Scrapes all of the players' urls to get individual data from each one.
"""
import externals.WebScrapper.selenium_func as sel
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""Python package for analysis of RIXS spectra.
Galdino"""
# standard libraries
import matplotlib.pyplot as plt
from pathlib import Path
import numpy as np
import copy
from matplotlib.transforms import Bbox
import warnings
# backpack
#import brixs
from . import arrayma... |
# Copyright 2017 Yahoo Inc.
# Licensed under the terms of the Apache 2.0 license.
# Please see LICENSE file in the project root for terms.
"""This module extends the TensorFlowOnSpark API to support Spark ML Pipelines.
It provides a TFEstimator class to fit a TFModel using TensorFlow. The TFEstimator will actually sp... |
import pandas as pd
import pyons
from pyons.base import Singleton
from . import pyradise
class VehicleInfoRecord(object):
def __init__(self):
self.vehicle_id = None
self.created_at = None
self.destroyed_at = None
self.direction = None
self.lane = None
self.front_ta... |
from __future__ import division, print_function, absolute_import
import argparse
from pybedtools import BedTool
import pyBigWig
import pandas as pd
import numpy as np
import pdb
import csv
import sys
from .classification_label_protocols import *
from .regression_label_protocols import *
import gzip
import os
#from ... |
"""
Type definition for model parameters
"""
from pydantic import BaseModel, Extra, root_validator, validator
from pydantic.dataclasses import dataclass
from datetime import date
from typing import Any, Dict, List, Optional, Union
from autumn.models.covid_19.constants import COVID_BASE_DATETIME, VACCINATION_STRATA, G... |
import py
import os, sys, subprocess
from os.path import join, dirname
import pypy
from pypy.interpreter import gateway
from pypy.interpreter.error import OperationError
from pypy.tool.ann_override import PyPyAnnotatorPolicy
from rpython.config.config import to_optparse, make_dict, SUPPRESS_USAGE
from rpython.config.... |
# Copyright 2015, 2016 OpenMarket 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 agreed to in ... |
# Copyright 2016-2018 CERN for the benefit of the ATLAS collaboration.
#
# 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... |
from pathlib import Path
import cv2
import numpy as np
import torch
from scipy.spatial.ckdtree import cKDTree as kdtree
splits = {
"train": [1, 2, 0, 3, 4, 5, 6, 7, 9, 10],
"val": [8],
"test": [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21],
}
def _transorm_train(depth, refl, labels_image, labels, py, px, ... |
import pygame
import pygine.globals
from enum import IntEnum
from pygine.base import PygineObject
from pygine.draw import draw_image
from pygine.sounds import load_sound_paths
from pygine.utilities import Timer
SPRITE_SHEET = None
TEXT_SHEET = None
def load_content():
global SPRITE_SHEET
global TEXT_SHEET
... |
import numpy as np
import os
from typing import Tuple
import io
import tvm
import tvm.relay
import time
import cv2
import torch
import torchvision
import torch.onnx
from PIL import Image, ImageOps
import onnx
import tvm.contrib.graph_runtime as graph_runtime
from mobilenet_v2_tsm import MobileNetV2
SOFTMAX_THRES = 0
H... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
""" Unit test of bace3/common.py """
from bace3.common import itail, iadvance, ipadnone, irepeat_call, iroundrobin, ipartition, ipowerset
from bace3.common import irandom_select, irandom_product, irandom_permutation, irandom_combination
from bace3.common import ifirst_true,... |
#!/usr/bin/env python
"""A script to convert Wordpress XML dumps to plain text/markdown files."""
import argparse
import codecs
import datetime
import logging
import markdown
import os.path
import re
import sys
import time
import traceback
from xml.etree.ElementTree import XMLParser
#from . import html2text
import htm... |
# Copyright 2021 <NAME> and the PyHopper 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
import json
import os
import re
import sys
import requests
import string
import numpy as np
from colorama import Fore
from tokenizers import BertWordPieceTokenizer
from tqdm import tqdm
from transformers import BertTokenizer, BertForQuestionAnswering
import torch
from torch.utils.data import TensorDataset, DataLoader,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.