text stringlengths 3.07k 22.1k |
|---|
from abc import ABCMeta, abstractmethod
from time import time
import numpy as np
from copy import deepcopy, copy
from .kpp import KPP, KPPExtension
from .separation import YCliqueSeparator, YZCliqueSeparator, ZCliqueSeparator, ProjectedCliqueSeparator
from .graph import decompose_graph
class KPPAlgorithmResults:
d... |
from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
import hyptorch.nn as hypnn
class NetRegular(nn.Module):
def __init__(self, args):
super(NetRegular, self).__... |
import os
import sys
import processing
import uploader
import json
import shutil
from tqdm import tqdm
import csv
import exif_read
from . import ipc
def map_images_to_sequences(destination_mapping, total_files):
unique_sequence_uuids = []
sequence_counter = 0
for image in tqdm(total_files, desc="Reading s... |
from flask import send_from_directory, jsonify, request
from app import app, benches, testStatusController, ledController
from app.controller.psController import PsRequest
from app.controller.ledController import LedRequest
from app.controller.testStatusController import TestStatusRequest, TYPE_GET, TYPE_SET
from app.... |
import sys
import urllib3
import certifi
import re
import os
import random
import time
from json import loads
import socket
from urllib3.contrib.socks import SOCKSProxyManager
from bs4 import BeautifulSoup
from tqdm import tqdm
import asyncio
import aiohttp
import sqlite3
# setup colored output
from colorama import i... |
import geopandas as gpd
import networkx as nx
import pandas as pd
import shapely
from shapely.ops import cascaded_union
from syspy.spatial import polygons, spatial
from syspy.syspy_utils import neighbors, pandas_utils, syscolors
from tqdm import tqdm
def compute_coverage_layer(layer, buffer, extensive_cols=[]):
"... |
import torch
# torch.manual_seed(0)
import torch.nn as nn
from modelZoo.resNet import ResNet, Bottleneck, BasicBlock
from modelZoo.DyanOF import creatRealDictionary
from utils import generateGridPoles, gridRing,fista
import numpy as np
def load_preTrained_model(pretrained, newModel):
'load pretrained resnet-X to s... |
import asyncio
import json
import logging
import random
from contextlib import suppress
import pmdefaults as PM
try:
import aiohttp
from aiohttp import web
except ImportError as e:
web = None
logging.warning("aiohttp in required to start the REST interface, but it is not installed")
try:
resthelp... |
import gc
import pandas as pd
from qlknn.dataset.filtering import *
def filter_megarun1():
dim = 9
gen = 4
filter_num = 10
root_dir = '.'
basename = ''.join(['gen', str(gen), '_', str(dim), 'D_nions0_flat'])
store_name = basename + '.h5.1'
input, data, const = load_from_store(store_name... |
"""Demonstrates all CloudRF APIs.
To build an application, you may use these CloudRFNetwork, CloudRFArea, CloudRFPath, CloudRFMesh and CloudRFInterference classes.
"""
import datetime
import json
import pystache
import re
import requests
import time
from pathlib import Path
class CloudRFAPI:
"""Clo... |
# Copyright 2020 The Trieste Contributors
#
# 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... |
import datetime
from django import forms
from django.forms import fields
from django.conf import settings
from django.core.cache import cache
from django.db.models import Min, Max
from core import models
from core.utils.utils import fulltext_range
# min and max year set in utils.py
DAY_CHOICES = [(i, i) for i in ran... |
import numpy as np
import torch
from torch import nn
from torch import optim
from torchvision import datasets, transforms, models
from PIL import ImageFile
import argparse
import os
import json
# DONE: Import dependencies for Debugging andd Profiling
# ====================================#
# 1. Import SMDebug framew... |
#
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019 Intel 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 app... |
#!/usr/bin/env python
# (C) Copyright 2017 IBM Corp.
# (C) Copyright 2017 Inova Development Inc.
# 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.apach... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author: romanshen
@file: prep_utils.py
@time: 2021/05/06
@contact: <EMAIL>
"""
import json
import os
import glob
import random
import re
from nltk import sent_tokenize
class Lang:
def __init__(self, name):
self.name = name
self.word2index = {... |
import collections
from abc import ABC
from typing import Tuple, List, Dict
import numpy as np
class StepInformationProvider(ABC):
"""
This class calculates certain values which are used frequently in reward generators.
A single instance of this class can be shared between a set of (sub)generators
to... |
from scapy.fields import *
from scapy.packet import *
from scapy.all import *
from scapy.layers.inet6 import IP6Field
import ctypes
import collections
from eth_scapy_someip import SOMEIP
class _SDPacketBase(Packet):
""" base class to be used among all SD Packet definitions."""
# use this dictionary to set def... |
""" Bundles various floors together """
from lightsweeper.lsfloor import LSFloor
from lightsweeper.lsemulate import LSPygameFloor
from lightsweeper.lsemulate import LSASCIIFloor
from lightsweeper.lsemulate import BadEmulator
from lightsweeper.lsconfig import LSFloorConfig
from lightsweeper import Shapes
from lightswe... |
import torch
import torch.nn as nn
import torch.nn.functional as F
def unfold1d(x, kernel_size, padding_l, pad_value=0):
'''
unfold T x B x C to T x B x C x K
:param x: [src_len, batch_size, hid_dim]
:param kernel_size:
:param padding_l:
:param pad_value:
:return:
'''
if kernel_size... |
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 26 20:59:52 2020
@author: <NAME>
"""
import os
import torch
import numpy as np
import math
def preprocess(image):
# [0, 1] => [-1, 1]
return image * 2 - 1
def deprocess(image):
# [-1, 1] => [0, 1]
return (image + 1) / 2
#Log a tenso... |
"""
@author: <NAME>
@since: 21/08/2016
@modified:
How it works: using a minheap (priority queue) we can just repeatedly graph the min element and when we are done
it will be in sorted order!
1. Put everything in a heap
- O(n log n) in standard heapify
... |
import datetime
from typing import Iterable, Dict, Any, Union, List, Optional
from django.conf import settings
from django.contrib.auth.models import User
from django.utils import timezone
from django.utils.timezone import now
from rest_framework.response import Response
from rest_framework.views import APIView
from ... |
# Copyright 1999-2018 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
#!/usr/bin/env python
import os
import logging
import argparse
from keras.callbacks import ModelCheckpoint, ReduceLROnPlateau, TensorBoard, Callback
from keras.layers import Input, GlobalAveragePooling2D, add, AveragePooling2D, Dense, Dropout
from keras.layers.advanced_activations import LeakyReLU
from keras.models i... |
__author__ = 'pvde'
"""
Module that takes a CPP and filters it for a particular or an anonymous viewer,
taking into account the "allowed" and "denied" authorization attributes.
If the viewer is not authorized for the CPP at CPP level, no view is available.
Otherwise a view is available that is a copy of the CPP, with... |
"""
CapsuleNet 的模型类
"""
import tensorflow as tf
import numpy as np
def capsules_generator(X):
"""
胶囊(向量神经元)生成器
:param X: 输入 [?, 256, 256, 1]
:return: 胶囊合集 [?, 107648, 22, 16]
"""
print('11111111111', X.get_shape().as_list())
# X = tf.reshape(X, [-1, 28, 28])
# X = tf.expand_dims(X, axi... |
# -*- coding: utf-8 -*-
# Copyright 2021 Google 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 ... |
import argparse
import sys
import random
import csv
import ujson
import re
import pandas as pd
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
import wordvecdata as wvd
from sklearn.metrics import average_precision_score
import pdb
COLUMNS = ["node1", "node2", ... |
from torch.nn import functional as F
from torch import nn
import torch
class _Scorer(nn.Module):
def __init__(self, n_classes, soft=False, apply_softmax=True, skip_first_class=True, smooth=1e-7):
super(_Scorer, self).__init__()
self.register_buffer('eye', torch.eye(n_classes))
self.soft = ... |
from typing import Tuple
import os
from .planercnn.config import Config as _Config
def update_attrs(obj, kwargs):
for key, value in kwargs.items():
if hasattr(obj, key):
setattr(obj, key, value)
class YoloV3Options:
data: str
epochs: int
batch_size: int
img_size: Tuple[int,... |
from kivy.properties import ObjectProperty, StringProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.event import EventDispatcher
from kivy.lang.builder import Builder
from kivy.uix.popup import Popup
from kivy.metrics import dp
from uix.confirmation_dialog import ConfirmationDialog
from utils.utils import (... |
#from spiops import data as data
from spiops.utils.time import cal2et
from spiops.utils.time import et_to_datetime
import matplotlib.pyplot as plt
import matplotlib as mpl
import spiceypy
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from bokeh.plotting import figure, output_file, output_notebook, show
fro... |
import numpy as np
import rospy
import time
import sys
import pymap3d as pm
import numba as nb
from lib_ta_py.controller_2D_TA import Controller
from pkg_ta.msg import Control
from pkg_ta.msg import State_EKF_2D
from sensor_msgs.msg import NavSatFix
from sensor_msgs.msg import Imu
yawc_compass = - np.pi/2
# Reference ... |
# A Bug in the ADC perhaps? This is an incompletely-explored specimin.
# simple
import array
from machine import Pin
from pyb import Timer, rng, ADC, DAC, LED, Switch
from time import sleep, ticks_ms, ticks_diff
import micropython
def hv(signal, harmonic):
length = len(signal)
return sum(signal[i]*signal[(ha... |
# coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
# Copyright 2020 Iguazio
#
# 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, softwa... |
# ===============================================================================
# Copyright 2016 <NAME>
#
# 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/LI... |
# frappeviz.py
import argparse
import os
import sys
from sys import modules
import json
frappe_app_modules = []
def is_frappe_app_folder(path_to_app):
"""Check if a modules.txt file exists within a python module (folder) that shares exactly
the same name as the frappe app dir supplied
"""
global frap... |
##############################################################################
# Copyright (c) 2016 Intel 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.... |
import os
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
import numpy as np
from scipy.signal import argrelextrema
from sklearn.metrics import f1_score, precision_recall_curve
import matplotlib.pyplot as plt
import glob
i... |
from typing import Union, Tuple, Iterable
import os
import torch
import numpy as np
import logging
from .models.models import GANModel, ReturnsModel
from .models.losses import LossCompose, WeightedLSLoss
from .utils import get_scheduler_from_config, get_optimizer_from_config, to_numpy
from .data_loader import Finance... |
# 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... |
import os
import sys
import argparse
import torch
import numpy as np
from random import shuffle
from collections import OrderedDict
from dataloaders.datasetGen import SplitGen, PermutedGen
from utils.utils import factory
import random
def run(args):
if not os.path.exists('outputs'):
os.mkdir('outputs')
... |
import pytest
from py_meta_utils import (McsArgs, MetaOption, AbstractMetaOption, MetaOptionsFactory,
EnsureProtectedMembers, Singleton, deep_getattr)
class TestMcsArgs:
def test_module_and_qualname_properties(self):
mcs_args = McsArgs(type, 'Test', (), {})
assert mcs_a... |
import torch
import torch.nn as nn
class ConvBlock(nn.Module):
"""
Small unit block consists of [convolution layer - normalization layer - non linearity layer]
"""
def __init__(self, in_dim, out_dim, k=4, s=2, p=1, norm=True, non_linear='leaky_relu'):
super(ConvBlock, self).__init__()
... |
import numpy as np
from scipy.io.idl import readsav
from scipy.interpolate import interp1d
from harps_hacks import read_harps
import h5py
import math
from astropy.io import fits
import shutil
import glob
import os
def dimensions(instrument):
if instrument == 'HARPS':
M = 4096 # pixels per order
R =... |
"""This is a plotting script for one particular configuration specified via command
line argument. It can be called like this:
`python plot_eigvals_vivit_vs_fb.py --config_str fmnist_2c2d_sgd`
`run_plot_eigvals_vivit_vs_fb.py` automatically calls this script for all
configurations.
This script consists of 3 steps:
... |
# -*- coding: utf-8 -*-
"""
Teslameter
Open Source Initiative OSI - The MIT License
http://www.opensource.org/licenses/mit-license.php
Copyright 2017 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), t... |
import copy
import matplotlib as mpl
import matplotlib.pylab as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import numpy as np
from ..import extractroi
CM_PHASE = "viridis"
CM_PHASE_ERROR = copy.copy(plt.get_cmap("seismic"))
CM_PHASE_ERROR.set_over("#37FF32")
CM_PHASE_ERROR.set_under("#05C500")
CM_I... |
#!/usr/bin/python3
# -*-coding: utf-8-*-
# file: app.py
from flask import *
from flask_mail import *
import os
# import Crawler
import cv2
import time
import requests
from serial import Serial, SerialException
from flask_cors import CORS
try:
from . import Distance
except Exception as e:
print("Distance libr... |
#!/usr/bin/env python3
# pylint: disable=invalid-name,missing-docstring
import os
import json
import sys
import traceback
from argparse import ArgumentParser
from Logger import Logger
from constants import constants
from CommandUtils import CommandUtils
from SpecData import SPECS
def main():
usage = "Usage: %pro... |
"""
for 3x3 uniform-random hex, over all permutations,
compute probability that game ends after k moves
answer:
move 1: 0
move 2: 0
move 3: 0
move 4: 0
move 5: 2/21
move 6: 2/21
move 7: 5/21
move 8: 5/21
move 9: 7/21 = 1/3
"""
import numpy as np
import copy
from collections import deque
from itertools impo... |
# Copyright (C) 2019 TU Dresden
# Licensed under the ISC license (see LICENSE.txt)
#
# Author: <NAME>
import numpy as np
from mocasin.design_centering.volume import *
import mocasin.design_centering.sample as sample
import mocasin.util.random_distributions.discrete_random as rd
import matplotlib.pyplot as plt
impor... |
import argparse
import time
from tornado import ioloop, httpclient
from elasticsearch import Elasticsearch
from datetime import datetime, timedelta
import subprocess
import logging
import json
import copy
import uuid
p_uid = uuid.uuid4().hex
num_reqs = 0 # global variable to keep track of how many requests has bee... |
from .__core__ import PyotCore, PyotStatic
from datetime import datetime, timedelta
from typing import List, Iterator
# PYOT STATIC OBJECTS
class MatchInfoData(PyotStatic):
id: str
map_id: str
duration: timedelta
creation: datetime
provisioning_flow_id: str
is_completed: bool
custom_game_... |
from radical.entk import Pipeline, Stage, Task
from radical.entk import states
from radical.entk.exceptions import *
import pytest
from hypothesis import given
import hypothesis.strategies as st
def test_task_initialization():
"""
**Purpose**: Test if the task attributes have, thus expect, the correct data ty... |
#!/usr/bin/env python
#coding=utf8
'''
Created on 2016/9/23
@author: cloudy
@description:
'''
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect
from ..models import Record,AssessmentLine,AssessmentLineLevel,AssessmentLineDetail
i... |
import tensorflow as tf
import os
import pdb
relu = tf.nn.relu
elu = tf.nn.elu
normal = tf.distributions.Normal
kldv = tf.distributions.kl_divergence
class Network(object):
def __init__(self, name):
self.name = name
self.eps = 1e-3
def dense(self, x, units, name='dense', reuse=None):
... |
#!/usr/bin/python3
# Developed by <NAME> from Hackerdom team, <EMAIL>
"""Creates vm instance for a team"""
import sys
import json
import time
import os
import traceback
import do_api
from cloud_common import ( # get_cloud_ip, take_cloud_ip,
log_progress,
call_unitl... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import numpy as np
import tensorflow as tf
from evaluate import evaluate
from utils import get_data, tf_melspectogram
from shallow_nn import shallow_nn
from deep_nn import deep_nn
from sh... |
import math
# Get the new x value of point pt (x, y) rotated about reference point
# refpt (x, y) by degrees clockwise
def rotatex(pt, refpt, deg):
return (refpt[0] + (math.cos(math.radians(deg)) * (pt[0] - refpt[0]))
+ (math.sin(math.radians(deg)) * (pt[1] - refpt[1])))
# Get the new y value of point pt (x,... |
#!/usr/bin/env python3
# coding: utf-8
try:
from . import contants
except ImportError:
import constants
import re
import logging
import shutil
import tempfile
import unicodedata
import datetime
import csv
import sys
from pathlib import Path
from humanfriendly import prompts
import textwrap
from ... |
import time
import pandas as pd
import numpy as np
###############################################################################
############################ Requirements #####################################
# #1 Popular times of travel:
# - Most common month to travel
# - Most common day of week
# - Most ... |
import logging
from dataclasses import dataclass, field
import click
from .click_common import command
from .miot_device import DeviceStatus as DeviceStatusContainer
from .miot_device import MiotDevice, MiotMapping
from .dreame_const import *
from random import randint
_LOGGER = logging.getLogger(__name__)
class D... |
#!/usr/bin/env python3
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
# Copyright (c) 2020 <NAME> <<EMAIL>>
# Copyright (c) 2020-21 gatecat <<EMAIL>>
#
# SPDX-License-Identifier: BSD-2-Clause
import os
import argparse
from migen import *
from migen.genlib.resetsync import AsyncResetSy... |
import multiprocessing
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
manager = multiprocessing.Manager()
stock_info = manager.list()
stocks_to_buy = manager.list()
flags = manager.list()
def calculate_what_to_buy(local_stocks_to_buy):
# waiting to retrieve the ... |
"""
This module extends and defines Torndo RequestHandlers.
Classes:
* MainHandler - this is the main RequestHandler subclass, that is mapped to
all URIs and serves as a dispatcher handler.
* DefaultHandler - this class serves all the URIs that are not defined
within ... |
from __future__ import print_function
import sys
import time
import traceback
import json
import csv
def get_full_class_name(obj):
module = obj.__class__.__module__
if module is None or module == str.__class__.__module__: # type: ignore
return obj.__class__.__name__
return module + '.' + obj.__c... |
# -*- coding: utf-8 -*-
"""Train and track model on MLFlow.
Usage
-----
To be used as part of scheduled Continuous Training workflow.
"""
import os
import pickle
import re
import json
from datetime import datetime as dt
from datetime import date, timedelta
import datetime
from sklearn.model_selection import train_te... |
import pathlib
import astropy.table as at
import astropy.units as u
from matplotlib.path import Path
import numpy as np
from pyia import GaiaData
from .config import (apogee_parent_filename, galah_parent_filename,
cache_path, plot_path)
class Dataset:
_id_column = None
_radial_velocity_... |
import os
import hashlib
import zipfile
import simplejson as json
from hmac import compare_digest
from fcntl import flock, LOCK_EX, LOCK_NB
from magic import Magic
from time import sleep
from datetime import datetime
from pytz import timezone
from rfc6266 import build_header
from requests import Session
from shutil imp... |
import sys
import time
import collections
import numpy as np
from collections import OrderedDict
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
s... |
from collections import Counter, OrderedDict
from contextlib import contextmanager
import json
import logging
import time
import pytest
class JSONReporter(object):
def __init__(self, config=None):
self.config = config
self.start_time = None
self.tests = OrderedDict()
self.collecto... |
# created by <NAME>, <EMAIL>
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from smtplib import SMTPException
from django.contrib.auth.models import User
from django import forms
from django.contrib.sites.shortcuts import get_current_site
from django.forms.utils import ErrorList
from ... |
# noinspection PyUnusedLocal
# skus = unicode string
from abc import ABC, abstractmethod
from dataclasses import dataclass
from enum import Enum, auto
from typing import Generator, List, Dict, Tuple
class Product(Enum):
A = 50
B = 30
C = 20
D = 15
E = 40
F = 10
G = 20
H = 10
I = 35... |
import logging
from . import FinishAfter, CompositeExtension
from .training import TrackTheBest
from .predicates import OnLogRecord
logger = logging.getLogger(__name__)
class FinishIfNoImprovementAfter(FinishAfter):
"""Stop after improvements have ceased for a given period.
Parameters
----------
n... |
# Copyright 2022 The Cirq Developers
#
# 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 agreed to in ... |
#!python
import sys
import os
import os.path
import shutil
import subprocess
import threading
database_dir = "database"
pipelines_dir = "pipelines"
status_log_file = ""
sql_dir = os.path.join(database_dir, "SQL")
sql_init_file = os.path.join(pipelines_dir, "sql_init_table.sql")
sql_log_file = os.path.join(database_d... |
import pytest
import ray
import time
import numpy as np
from gym import spaces
from pytest_mock import MockerFixture
from malib import settings
from malib.utils import logger
from malib.utils.typing import (
List,
Dict,
Status,
TaskDescription,
TaskRequest,
TaskType,
TrainingDescription,
... |
# ***************************************************************************
# mintsXU4
# ---------------------------------
# Written by: <NAME>
# - for -
# Mints: Multi-scale Integrated Sensing and Simulation
# &
# TRECIS: Texas Research and Education Cyberinfrastructure Services (TRECIS) NSF Award #... |
# -*- coding: utf-8 -*-
"""Helper functions for controller operation.
URL definition and browser redirection are defined here.
"""
import re
import warnings
from webob.exc import status_map
import tg
from tg._compat import string_type, url_encode, unicode_text, bytes_
from tg.exceptions import HTTPFound
from tg.req... |
# -*- coding: utf-8 -*-
import sys
import random
from collections import Counter
import numpy as np
import cmath
from qlazy.error import *
from qlazy.config import *
from qlazy.util import *
from qulacs import QuantumState
from qulacs import QuantumCircuit
from qulacs.gate import Identity, X, Y, Z
from qulacs.gate im... |
from __future__ import absolute_import, division, print_function
import glob
import os
import platform
import random
import re
import threading
import time
from contextlib import contextmanager
from sys import executable as python
from textwrap import dedent
import stbt_rig
from stbt_rig import (
file_lock, named... |
"""
Module containing all the routines to process input settings, from the dict-like configuration. Those routines are
intended for internal use only, and are implicitly exported by the ``process_settings`` function.
Each of the function with a @parameter decorator are registered in the private module level {__paramete... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2012 <NAME>
#
# 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 re... |
GLOBAL_DISCOUNT_PRODUCT = ('E', 'B', 'N', 'M', 'R', 'Q', 'S','T','X','Y','Z')
class Discount(object):
def __init__(self, discount_purchase=None, discount_receive=None, ref_skus="", occurence=0, free=False):
self.discount_purchase = discount_purchase
self.discount_receive = discount_receive... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import os, sys, random, time, math
import tensorflow as tf
import cv2
sys.path.append(os.path.realpath('./datasets'))
import mask_rcnn_coco as coco
sys.path.append(os.path.realpath('./Mask_... |
# Change the following to True to get a much more comprehensive set of tests
# to run, albeit, which take considerably longer.
full_tests = False
def test(fmt, *args):
print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<')
test("{}-{}", 1, [4, 5])
test("{0}-{1}", 1, [4, 5])
test("{1}-{0}", 1, [4, 5])
test("... |
# Copyright 2019 Xanadu Quantum Technologies 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 agre... |
import logging
import reversion
from ariadne import (
MutationType,
ObjectType,
QueryType,
convert_kwargs_to_snake_case,
snake_case_fallback_resolvers,
)
from dateutil.parser import isoparse
from django.db import transaction
from django.db.models import Q
from django.utils.translation import gettex... |
'''Users and groups.
'''
from utils import *
from enums import *
class IUser(Cached):
'''Represents a Skype user.
'''
def __repr__(self):
return '<%s with Handle=%s>' % (Cached.__repr__(self)[1:-1], repr(self.Handle))
def _Init(self, Handle, Skype):
self._Skype = Skype
self.... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author <NAME>
##
## @copyright 2017, <NAME>, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys
import os
import copy
import inspect
import fnmatch
import re
import difflib
# Local import
from . import tools
from . import debug
from . import ... |
#! /usr/bin/env python
"""Calculations of the tropopause."""
import numpy as np
import xarray as xr
from .constants import GRAV_EARTH, R_D
from .names import LAT_STR, LEV_STR
from .nb_utils import apply_maybe_groupby
from .interp import drop_nans_and_interp
def z_from_hypso(temp, p_sfc=1000., p_top=0.1, p_str=LEV_S... |
# encoding: utf-8
"""Gherkin step implementations for text-related features."""
from __future__ import absolute_import, division, print_function, unicode_literals
from behave import given, when, then
from pptx import Presentation
from pptx.enum.text import PP_ALIGN
from pptx.util import Emu
from helper... |
'''
Functions that help visualize results
'''
import os
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
import numpy as np
from . import config
__all__ = ['plotter',
'segment_plotter',
'plot_poincare',
'plot_breathing']
def plotter(working_data, measures, sho... |
import sys
sys.path.append('..')
from utils import *
class Cascade:
# --------------------------
# Initiate Cascade
# --------------------------
def __init__(self, root_tweet_id, cascade_path, label=None):
self.file_id = root_tweet_id # For label.txt
self.root_tweet_id = root_tw... |
import os
import numpy as np
import sys
import inspect
import functools
from collections import defaultdict
#pylint:disable=no-member,too-many-function-args
class Device: CPU, GPU = 0, 1
DEFAULT_DEVICE = Device.CPU if os.environ.get('GPU', 0) !=1 else Device.GPU
try:
import pyopencl as cl
# TODO: move this... |
import copy
import itertools
from typing import Any
from typing import Iterator
from typing import List
from typing import Union
import numpy as np
import pycocotools.mask as mask_utils
import torch
from tkdet.layers.roi_align import ROIAlign
from .boxes import Boxes
__all__ = ["BitMasks", "PolygonMasks", "rasterize... |
from tkinter import *
from tkinter import filedialog
from tkinter import ttk
from threading import Thread
from . import parse
from . import thumbnail
from . import filter
class GUI:
def __init__(self, master):
"""Define user interface's objects."""
# Define all variables
self.image_list = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.