text stringlengths 3.07k 22.1k |
|---|
import warnings
import cupy
import numpy as np
from ._cuda_execute import execute
def cuda_backend():
return CUDABackend()
class CUDABackend():
def __init__(self):
self.first_run = True
self.first_image_access = True
pass
def array_type(self):
return (CUDAArray, cupy._co... |
import os
import collections
import pandas as pd
import numpy as np
import random
from .utils import meta_classes_selector, print_to_string_io, \
train_logger, val_logger, numpy_to_tensor, load_config
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils, datasets
from PIL impor... |
#!/usr/bin/env python
# coding: utf8
"""
Python oneliner script usage.
USAGE: python -m spleeter {train,evaluate,separate} ...
Notes:
All critical import involving TF, numpy or Pandas are deported to
command function scope to avoid heavy import on CLI evaluation,
leading to large ... |
import sys
import argparse
import datetime
from operator import itemgetter, attrgetter
from itertools import groupby
from typing import List
from humanfriendly import parse_timespan, format_timespan
import requests
from kubernetes import client, config
def parse_args(argv=sys.argv[1:]):
p = argparse.ArgumentPars... |
import os
import subprocess
import linuxcnc
import psutil
from pyudev.pyqt5 import MonitorObserver
from pyudev import Context, Monitor, Devices
from qtpy.QtCore import Slot, Property, Signal, QFile, QFileInfo, QDir, QIODevice
from qtpy.QtWidgets import QFileSystemModel, QComboBox, QTableView, QMessageBox, \
QAp... |
"""
Here's the link to the original post https://medium.com/mlearning-ai/clustering-using-quantum-kernels-tutorial-dcd90bf6440c
"""
import time
import warnings
import numpy as np
import matplotlib.pyplot as plt
from typing import Optional, Callable, List, Union
from functools import reduce
from itertools import cyc... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 26 15:01:51 2018
# some code adapted from
https://github.com/yburda/iwae/blob/master/download_mnist.py
@author: chin-weihuang
"""
import urllib.request, urllib.parse, urllib.error
import pickle as pickle
import os
import struct
import numpy as np... |
"""
Copyright (c) 2019-2020 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 applicable law or agreed to in w... |
import torch
import torchvision
import numpy as np
import numbers
import ml_metrics
from sklearn.preprocessing import LabelEncoder
from torchvision.transforms.functional import pad
from scipy import linalg
class EarlyStopping:
"""Early stops the training if validation loss doesn't improve after a given patience.""... |
from __future__ import print_function
import csv
import distutils
import shutil
import pandas as pd
import os
import re
from collections import defaultdict
import six
import sys
from Bio import SeqIO
from bracerlib.bracer_func import process_chunk, find_possible_alignments, extract_blast_info
import glob
import pdb... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
import torch.nn as nn
import torch.utils.checkpoint as checkpoint
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
from functools import partial
class GroupNorm(nn.GroupNorm):
def __init__(self, num_channels, n... |
# -*- coding: utf-8 -*-
"""
Neural sentence tagging model to be used to identify sentences that contain evidence spans.
Intended for use in a pipelined approach, where we first tag sentences and then pass those
predicted to contain evidence spans forward for inference.
"""
from random import randint
import numpy as np... |
import pickle as pkl
import gzip
import numpy
import random
import math
import pandas as pd
from datetime import datetime
from datetime import timedelta
from scipy import stats
def delay(j, day):
return (datetime.strptime(j, '%Y-%m-%d') - timedelta(days=day)).strftime('%Y-%m-%d')
class TextIterator:
"""Simp... |
"""
Functionality to render Jinja templates with an add_schema_table hook to generate
schema tables in Markdown.
"""
import re
import os
import traceback
from jinja2 import Environment, FileSystemLoader, select_autoescape, TemplateNotFound
import yaml
import schema205.md.schema_table as schema_table
import schema205.... |
# Copyright 2018 SpiderOak, 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 writi... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import argparse
import ast
from typing import Generator, List, Optional, Sequence, Set, Tuple
import libcst as cst
import libcst.matchers ... |
# greaseweazle/image/ipf.py
#
# Written & released by <NAME> <<EMAIL>>
#
# This is free and unencumbered software released into the public domain.
# See the file COPYING for more details, or visit <http://unlicense.org>.
import os, sys
import platform
import ctypes as ct
from bitarray import bitarray
from greaseweazl... |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import configparser
import json
from dataclasses import dataclass
from enum import Enum
from io import StringIO
from pathlib import PurePath
from textwrap import dedent
from typing import ... |
"""Main module."""
import sys
import itertools
import time
import json
from urllib.parse import urlparse
from .metadata import __version__
from .sites.common import (
SiteDefault,
BaseChatDownloader
)
from .sites import get_all_sites
from .formatting.format import ItemFormatter
from .utils.core import (
... |
# -*- encoding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.contrib.admin.views.decorators import staff_member_required
from django.shortcuts import render, get_object_or_404, redirect
from django.template import loader
from django.urls import reverse
from django.http import HttpRes... |
import json
from random import sample
import os
from sklearn.metrics import precision_recall_curve, average_precision_score, accuracy_score
from api.batch_processing.postprocessing import load_api_results
from data_management.cct_json_utils import CameraTrapJsonUtils
from visualization import visualization_utils
#%... |
from typing import Any, Callable, Optional
from dataclasses import dataclass
from PyQt5 import QtCore, QtWidgets
from esolang_IDE.code_text import CodeText
from esolang_IDE.visualisers import MainVisualiser
import esolang_IDE.interpreters as interpreters
from esolang_IDE.filetypes import FileTypes
from esolang_ID... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
import cv2
import numpy as np
import time
from grabScreen import grab_screen
from statistics import mean
from numpy import ones,vstack
from numpy.linalg import lstsq
from direct_key_inputs import PressKey, ReleaseKey, W, A, S, D
lane_color_r=0
lane_color_g=0
lane_color_b=0
fisrst_time=0
last_pos="w"
def st... |
# Copyright (c) Facebook Inc.
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import matplotlib.pyplot as plt
import re
import sys
import os.path
import argparse
import os, fnmatch
from collections import Counter, OrderedDict
import operator
SHARDS = 0
LOAD = 1
IN_FLIGHTS = 2
COMMITTEE = 3
"""
Parsed raw lo... |
"""
Módulo que faz consulta de dados ao servidor do Movidesk.
Não deve ser usada diretamente.
Exemplo de uso:
>>> from datetime import date, timedelta
>>> from pyvidesk.tickets import Tickets
>>> yesterday = date.today() - timedelta(days=1)
>>> tickets = Tickets(token="<PASSWORD>")
>>> ticket_properties = tickets.ge... |
"""Define fixtures used in web GUI acceptance/behavioral tests.
"""
import os
import re
import sys
from itertools import chain
import subprocess as sp
from py.xml import html
from pytest import fixture, UsageError, skip
from selenium import webdriver
from environment import docker
from tests.utils.utils import set_d... |
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
import pickle
from os import path
# Obtain data from NYT or CT (COVID Tracking project):
def getDailyCountyData(src='NYT'):
if src == 'NYT':
NYT_counties_daily = pd.read_csv(
'https://raw.githubusercontent.com/nytime... |
import requests, json, uuid, pprint, tarfile, os
import prepare_tests
import common_assertions
APBS_HOST = os.getenv('APBS_HOST')
if APBS_HOST is None:
raise EnvironmentError('Environment variable APBS_HOST is not set')
APBS_URL = 'http://%s' % (APBS_HOST)
apbs_adapter = requests.adapters.HTTPAdapter(max_retries=... |
r"""
DC apparent resistivity
=======================
DC apparent resistivity, dipole-dipole configuration.
There are various DC sounding layouts, the most common ones being Schlumberger,
Wenner, pole-pole, pole-dipole, and **dipole-dipole**, at which we have a look
here.
Dipole-dipole layout as shown in figure 8.32 ... |
from rich import print as rprint
from math import floor, pi, e
from typing import List, Dict
# Known:
# Triangular prism, 3 faces
# Colors are assigned counter-clockwise: f1 > f2 > f3
# Six puzzles with predefined formulas
# FACES
f1: List[int] = [] # front
# for the purposes of rotation reference f1 is assumed to a... |
#!/usr/bin/env python3
import json
import time
import math
import argparse
import warnings
import numpy as np
import pandas as pd
import multiprocessing as mp
from tqdm import tqdm
from functools import partial
from itertools import combinations
from sklearn.svm import SVR
from sklearn.linear_model import LarsCV
fro... |
"""empty message
Revision ID: cd<PASSWORD>
Revises:
Create Date: 2021-08-07 23:59:54.287977
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = 'cd4<PASSWORD>'
down_revision = None
branch_labels = None
depends_on = None
def u... |
from pathlib import Path
from sys import platform
from typing import List, Union, Any, Callable
from time import sleep
from abc import ABC, abstractmethod
# ----------------------------------------------------------------------------
# Mocking everything in case we run this for testing or on Linux
if "win" in platfor... |
#!/usr/bin/env python
#
# Copyright 2015 <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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of adp-api-client.
# https://github.com/adplabs/adp-connection-python
# Copyright © 2015-2016 ADP, 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 obta... |
import pandas as pd
from pgmpy.estimators import PC
import matplotlib.pyplot as plt
from matplotlib.patches import ArrowStyle
import networkx as nx
from networkx.drawing.nx_agraph import graphviz_layout
import pingouin
from linearmodels.system import SUR
def graph_DAG(edges,
data_reg,
ti... |
import logging as log
import os
import torch
from torch.utils.tensorboard import SummaryWriter
import slowfast.utils.logging as logging
import slowfast.utils.visualization_utils as vis_utils
from slowfast.utils.misc import get_class_names
logger = logging.get_logger(__name__)
log.getLogger("matplotlib").setLevel(log.... |
import base64
import os
import uuid
import numpy as np
from astropy import units as u
from astropy.io import fits
from astropy.nddata import NDData
from astropy.wcs import WCS
from glue.core.data import Component, Data
try:
from jwst import datamodels
HAS_JWST_ASDF = True
except ImportError:
HAS_JWST_ASDF ... |
"""
This file is the entry point for calling the book summarizer
Create a summary of the book with features defined with command line arguments.
"""
from entity_extraction import find_entities_book, find_entities_chapter, create_sentence
from entity_extraction import save_sorted_entities_book, save_sorted_entities_ch... |
import asyncio
import itertools
import json
import os
import zipfile
from pathlib import Path
from typing import Union, List, Tuple, Coroutine, NamedTuple, Mapping
from uuid import uuid4
from fastapi import UploadFile, HTTPException
from .backward_compatibility import convert_project_to_current_version
from .configur... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import print_function
from PIL import Image
import os
import os.path
import sys
if sys.version_info[0] == 2:
... |
# Copyright 2017 The Bazel 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 applicable la... |
"""
Common tools for running tests
"""
from __future__ import print_function
import functools
import os
import re
import shlex
import shutil
import sys
import tempfile
try:
# Python2
from StringIO import StringIO
except ImportError:
# Python3
from io import StringIO
from subprocess import Popen, PIP... |
# coding=utf-8
"""A lightweight Python wrapper of espeak and mbrola"""
import fnmatch
import io
import logging
import os
import re
import wave
from pathlib import Path
from shlex import quote
from shutil import which
from struct import pack
from subprocess import PIPE, run
from sys import platform
from typing import Li... |
import sys
import os
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
from utils import utils
from utils import plot
def generate_plots(exp, epoch):
plots = dict();
if exp.flags.factorized_representation:
# mnist to mnist: swapping content and style intra mo... |
"""camera.py
This code implements the Camera class, which encapsulates code to
handle IP CAM, USB webcam or the Jetson onboard camera. In
addition, this Camera class is further extended to take a video
file or an image file as input.
"""
import logging
import threading
import subprocess
import numpy as np
import c... |
"""Some functions from R-base
If a function uses DataFrame/TibbleGrouped as first argument, it may be
registered by `register_verb` and should be placed in `./verbs.py`
"""
import itertools
import numpy as np
from pipda import register_func
from ..core.backends import pandas as pd
from ..core.backends.pandas.api.typ... |
import secrets
from flask import Flask, render_template, request, flash, redirect, url_for, sessions
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager, UserMixin, current_user, login_user, logout_user
from flask_wtf import FlaskForm
from flask_wtf.file import FileField
from wtforms import St... |
import os
import sys
from configparser import ConfigParser
import argparse
DNS_SERVER_GROUPS = [ # dns servers that have entries for loginXX.o2.rc.hms.harvard.edu
["172.16.31.10", "172.16.58.3"], # HMS nameservers
["172.16.17.32", "172.16.17.32", "192.168.127.12"], # HU nameservers
]
# test that you can ac... |
from datetime import timedelta
from matplotlib.axes import Axes
from matplotlib.dates import DateFormatter, MinuteLocator, HourLocator, \
DayLocator, SecondLocator, MonthLocator, YearLocator
from matplotlib.patches import Circle, FancyArrowPatch, ConnectionStyle, \
ArrowStyle
from numpy.ma import arange
from pa... |
# Copyright 2007 <NAME>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the foll... |
#!/usr/bin/env python3
"""
Implementation of the Vector Boson Fusion Higgs production
using the hep-flow suite: pdfflow and vegasflow
"""
from argparse import ArgumentParser
import subprocess as sp
from pdfflow.pflow import mkPDF
from pdfflow.configflow import float_me, fone, fzero, DTYPE
from pdfflow.functions import... |
import tempfile
from paramiko import SSHClient, AutoAddPolicy, transport, Transport
from paramiko.ssh_exception import NoValidConnectionsError
from scp import SCPClient, SCPException
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
# Disab... |
import math
from RLUtilities.GameInfo import *
from RLUtilities.LinearAlgebra import dot, cross, norm, normalize
from tiles import ALL_TILES
TO_WALL = 4555
TO_CORNER = 2 * TO_WALL / math.sqrt(3)
TO_CORNER_ROUNDED = 5026
HEIGHT = 2018
GRAVITY = vec3(0, 0, -650)
class DropshotInfo(GameInfo):
def __init__(self, ... |
# -*- coding: utf-8 -*-
import urlparse
import json
import pynux.utils
import boto
from .fetcher import Fetcher
from deepharvest.deepharvest_nuxeo import DeepHarvestNuxeo
STRUCTMAP_S3_BUCKET = 'static.ucldc.cdlib.org/media_json'
NUXEO_MEDIUM_IMAGE_URL_FORMAT = "https://nuxeo.cdlib.org/Nuxeo/nxpicsfile/" \
"default... |
from pathlib import Path
import torch
import lmdb
import os
import glob
import numpy as np
import cv2
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
import math
import random
# import augmenter
PIXEL_OFFSET = 10
PIXELS_PER_METER = 5
def world_to_pixel(x,y,ox,oy,ori_ox, ori... |
"""MyST-NB-Bokeh enables gluing and pasting Bokeh plots when using the MyST-NB Sphinx extension."""
from __future__ import annotations
__author__ = """<NAME>"""
__email__ = "<EMAIL>"
__version__ = "0.5.2"
import json
from textwrap import dedent
from typing import TYPE_CHECKING, Optional, cast
from bokeh.embed impor... |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from django.conf import settings
from django.http import Http404
from django.shortcuts import get_object_or_404, redirect, render
from auth.helpers import check_user_permissions, auth_required
from club.exceptions import AccessDenied, ContentDuplicated, RateLimitException
from common.request import ajax_request
from p... |
# 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 typing import Any, Dict, SupportsInt, Tuple, cast
from unittest import TestCase
from torch.distributed impo... |
from sklearn.neural_network import *
from Reg_Oracle_Fict import *
from Marginal_Reduction import *
from sklearn import svm
from sklearn import neighbors
# USAGE: python Audit.py all 50
# Helper Functions
def get_fp(preds, y):
"""Return the fp rate of preds wrt to true labels y."""
# print('my FP ', np.me... |
#!/usr/bin/env python
"""
mount disk to read data from sdss-hub
May (SJD 58240) - (SJD 58270)
April 58210 -- 58239
mjd 58271 - data with boss, apogee, manga
Examples:
timeTrack.py -a -m1 58268 -m2 58269 -v
timetrack.py -a -m1 58268 -m2 58269
timetrack.py -a -m1 58240 -m2 58270 -v
timetrack.py -b -v
timetrack.py -b -... |
####################################################################################################
# File: schultz.py
# Purpose: Tools for Schultz Prime Contour (SPC) calculation.
#
# Author: <NAME>
#
# Location: NYC, 2021
########################################################################################... |
import re
import contextlib
import json
import math
from numbers import Real
import sentry_sdk
from sentry_sdk.utils import (
capture_internal_exceptions,
Dsn,
logger,
to_base64,
to_string,
from_base64,
)
from sentry_sdk._compat import PY2
from sentry_sdk._types import MYPY
if PY2:
from ... |
import asyncio
import datetime
import hashlib
import logging
import re
import textwrap
import discord
from carim_discord_bot import managed_service, config
from carim_discord_bot.discord_client import client
from carim_discord_bot.managed_service import Message
log = logging.getLogger(__name__)
class PlayerCount(m... |
# Copyright 2020 The Flax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
from odoo import api, models, fields, _
from odoo.exceptions import Warning
from datetime import datetime
import random
class StockPicking(models.Model):
_inherit = 'stock.picking'
barcode = fields.Char(string="Barcode")
transfert_lines = []
@api.onchange('barcode')
def onchange_barcode(self):
... |
from user import Users
from credentials import Credentials
def create_user(username, login_password):
'''
Function to create new user
'''
new_user = Users(username, login_password)
return new_user
def add_user(user):
'''
Function to save user
'''
user.add_user()
def remove_user(us... |
import datetime
import enum
import json
import tempfile
import typing
import fsspec
import pydantic
from .registry import registry
from .serializers import pick_serializer
class Artifact(pydantic.BaseModel):
key: str
serializer: str
load_kwargs: typing.Optional[typing.Dict] = pydantic.Field(default_fact... |
import numpy as np
import copy
class BaseGainModel(object):
def __init__(self, uvd):
"""
Per-antenna complex gain model.
Parameters
----------
uvd : UVData object
UVData object used to define metadata etc.
"""
# Collect information... |
from re import template
from torch.nn.modules.activation import GELU
from transformers import (
AutoModel,
AutoTokenizer
)
import numpy as np
import random
import torch
from torch import nn, utils, optim
from torch.utils.data import DataLoader
from torch.nn import functional as F
import os
from os import path ... |
import json
import logging
import os
import sys
import graypy
from logging.handlers import RotatingFileHandler
from multiprocessing import Pipe
from nanome._internal._network import _Packet
from tblib import pickling_support
pickling_support.install()
logger = logging.getLogger(__name__)
class PipeHandler(logging.... |
import numpy as np
import cv2
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import arm_camera_calibrate
import Calibration
def saveImage(labeled_img1, fname1, labeled_img2, fname2):
# show image for down camera
plt.imshow(cv2.cvtColor(labeled_img1, cv2.COLOR_BGR2RGB))
plt.axis("of... |
# python modules
import copy
import csv
import datetime
import gevent
import gevent.monkey
import json
import os
import random
import string
import subprocess
import sys
import threading
import time
from dateutil.parser import parse
from flask import Flask
from flask import jsonify
from flask import render_template, se... |
# coding=utf-8
"""Authors: <NAME>, <NAME>
Copyright (C) 2015 ACK CYFRONET AGH
This software is released under the MIT license cited in 'LICENSE.txt'
A custom utils library used across docker scripts.
"""
from __future__ import print_function
import argparse
import inspect
import json
import os
import requests
import ... |
import asyncio
import os
import os.path
import shutil
import signal
import subprocess
import sys
import tempfile
import time
from contextlib import suppress
from typing import Any, Dict, List, Optional, Tuple, Union
import aiohttp
import portpicker
from loguru import logger
from sc2 import paths, wsl
from sc2.control... |
import time
import numpy as np
import numpy
import scipy.optimize
from dolo.numeric.processes import DiscretizedIIDProcess
# from dolo.numeric.decision_rules_markov import MarkovDecisionRule, IIDDecisionRule
from dolo.numeric.decision_rule import DecisionRule, ConstantDecisionRule
from dolo.numeric.grids import Grid, C... |
import numpy as np
import autofit as af
from autoconf import conf
from autofit.non_linear.samples import Sample
class MockAnalysis(af.Analysis):
prior_count = 2
def __init__(self):
super().__init__()
self.fit_instances = list()
def log_likelihood_function(self, instance):
... |
# import math
from pathlib import Path
import blobconverter
import numpy as np
import math
from visualizer import initialize_OpenGL, get_vector_direction, get_vector_intersection, start_OpenGL
import cv2
import depthai as dai
p = dai.Pipeline()
left_camera_position = (0.107, -0.038, 0.008)
right_camera_... |
# --------------------------------------------------------
# Caffe @ Dragon
# Copyright(c) 2017 SeetaTech
# Written by <NAME>
# --------------------------------------------------------
import time
from six.moves import range as xrange
import dragon.core.workspace as ws
import dragon.core.mpi as mpi
import dragon.upda... |
# utils
import os
import base64
import datetime
# crypto modules
from cryptography import x509
from cryptography.x509 import *
from cryptography.x509.oid import NameOID
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.pri... |
import os
import re
import types
import urllib.parse
import calendar
import magic
import datetime
import sys
import calendar
from PyPDF2 import PdfFileReader
from xml.parsers.expat import ExpatError
from xml.dom import minidom, Node
from bs4 import BeautifulSoup, NavigableString, Tag
from functools import reduce
def ... |
#import os
import cv2
import random
import re
import logging
from .utils import get_valid_colors, image_resize
from .utils import decode_data_matrix
from .utils import create_label_text
#from .utils import get_seeding_date
from .utils import get_shooting_date
from .utils import get_age
from .utils import get_text_orig... |
import torch
from torch import nn
import torch.nn.functional as F
eps = 1e-7
class VAECriterion(nn.Module):
"""
Here we calculate the VAE loss
VAE loss's math formulation is :
E_{z~Q}[log(P(X|z))]-D[Q(z|X)||P(z)]
which can be transformed into:
||X-X_{reconstructed}||^2/(\sigma)^2 - [<L2norm(u... |
#!/usr/bin/env python
__doc__ = """
Symmetric 3d U-Net implemented in PyTorch
(Optional)
Factorized 3D convolution
Extra residual connections
<NAME> <<EMAIL>>, 2017
Based on an architecture by
<NAME> <<EMAIL>>, 2017
"""
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn import init... |
"""
Includes functions for reading and writing graphs, in a very simple readable format.
loadgraph: reads from files
inputgraph: reads from terminal input / stdin
savegraph: writes to files
printgraph: writes to terminal / stdout
writeDOT: writes in .dot format; can be used for visualiza... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
"""
About: Basic example to test quantum connection with Qontainernet
"""
from itertools import filterfalse
import random
import os
import csv
import math
import numpy as np
import time
import subprocess
from scapy.all import *
from comnetsemu.cli import... |
"""Huskoll.py
The code for this very simple library.
The library contains one main class, which is Device,
and then the subclass Status representing the device status.
The Device represents a physical Huskoll device.
"""
import requests, dateutil.parser, warnings #Import required libaries
from .Exceptions import * #Imp... |
""" Plot frequency-magnitude and recurrence plot from rainfall timeseries """
import os
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib
import matplotlib.pyplot as plt
from datetime import datetime
from plot_utils import initialize_plot_settings
matplotlib.style.use('ggplot')
... |
"""
Copyright (c) 2018, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
# general packages
import os
import argparse
import numpy as np
from collections import defaultdic... |
import asyncio
import json
import logging
import os
import random
from multiprocessing.dummy import Array
from decouple import config
from fastapi import HTTPException, status
from fastapi.encoders import jsonable_encoder
from app.constants import available_app_ids
from app.utils import SSE, call_script, parse_key_va... |
# Copyright 2020 The SQLFlow 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 applicable law o... |
from torch.autograd import Variable
import torch
import torch.optim
import copy
import numpy as np
from scipy.linalg import hadamard
from .helpers import *
dtype = torch.cuda.FloatTensor
#dtype = torch.FloatTensor
from data import transforms as transform
def exp_lr_scheduler(optimizer, epoch, init_lr=0.001, lr_deca... |
import numpy as np
import json
from scipy import stats
from scipy.stats import norm
from frbpa.utils import get_phase, get_cycle, get_params
from frbpa.search import pr3_search, riptide_search, p4j_search
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from scipy.optimize import curve_fit
# Def... |
# coding: utf-8
"""
Geolocataion conversion between WGS84, BD09 and GCJ02.
WGS84 / BD09 / GCJ02 / MapBar 经纬度坐标互转。
- WGS84: GPS coordinates for Google Earth (GPS坐标,谷歌地球使用)
- GCJ02: national coordinate system developed by China (国测局坐标,谷歌中国地图、腾讯地图、高德地图使用)
- BD09: Baidu coordinates (百度坐标系,百度地图使用)
- MapBar: MapBar ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model import default_fields
from frappe.model.document import Document
from frappe.utils ... |
#!/usr/bin/env python2
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2017
# [+] International Business Machines Corp.
#
#
# 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 Lic... |
from django.shortcuts import render
from django.conf import settings
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from common import definitions
from common.selection import SimpleSelection, Selection, SelectionItem
from common.views import AbsReferenceSelection
from commo... |
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import PoseStamped, Pose
from styx_msgs.msg import Lane, Waypoint
from styx_msgs.msg import TrafficLightArray, TrafficLight
from sensor_msgs.msg import Image
from std_msgs.msg import Int32
import math
from copy import deepcopy
'''
This node will publish waypo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.