text stringlengths 3.07k 22.1k |
|---|
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404, redirect
from django.template import loader
from django.http import HttpResponse
from django import template
from django.views.deco... |
"""
Filename / URL patterns.
"""
import inspect
from dataclasses import dataclass, field, replace
from enum import Enum
from itertools import product
from typing import (
Any,
Callable,
ClassVar,
Dict,
Iterable,
Iterator,
List,
Optional,
Sequence,
Tuple,
Union,
)
class Com... |
# Copyright (c) 2019.
# MIT License
#
# Copyright (c) 2019 YumeNetwork
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... |
"""
Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option... |
from functools import partial
import numpy as np
import pandas as pd
import timeit
import torch
from functorch import pointwise_operator
WRITE_CSV = False
CUDA = False
SIZES = [1, 512, 8192]
NUMBER = [100, 10, 1, 1]
REPEAT = 20
@pointwise_operator
def nnc_add(a, b):
return a + b
@pointwise_operator
def nnc_add... |
import logging
import os
import sys
import time
import traceback
from typing import List, Tuple
import numpy as np
import torch
from torch.utils.tensorboard import SummaryWriter
from torch import nn, optim
from torch.nn import functional as F
from torch import distributions as dist
from src.spn.clipper import Distrib... |
# Cookie was created by Redjumpman for Redbot
# Design credit to discord user Yukirin for commissioning this project
# Standard Library
import asyncio
import os
import random
import time
# Discord and Red
import discord
from .utils import checks
from __main__ import send_cmd_help
from .utils.dataIO impor... |
import numpy as np
import optuna
from optuna.pruners import SuccessiveHalvingPruner, MedianPruner
from optuna.samplers import RandomSampler, TPESampler
from optuna.integration.skopt import SkoptSampler
from stable_baselines import SAC, TD3
from stable_baselines.common.noise import AdaptiveParamNoiseSpec, NormalActionNo... |
import numpy as np
from option import args
import torch
import torch.nn as nn
import math
import os
import torch.nn.functional as F
import matplotlib
matplotlib.use('TKAgg')
import matplotlib.pyplot as plt
from matplotlib import cm
import matplotlib.ticker as ticker
# plt.style.use('ggplot')
import imageio
from data i... |
from __future__ import annotations
import datetime
import json
import operator
from pathlib import Path
from typing import Any, TYPE_CHECKING
import pandas as pd
if TYPE_CHECKING:
from collections.abc import Iterable
TWO_WEEKS = 7 * 2
FOUR_WEEKS = 7 * 4
SIX_WEEKS = 7 * 6
def write_narrative(
path: Path,
... |
"""
Unit Tests for League Models
"""
import pytest
import vcr
from blaseball_mike.models import League, Subleague, Division, Team, Tiebreaker
from .helpers import TestBase, CASSETTE_DIR
class TestLeague(TestBase):
def test_base_compliance(self, league):
self.base_test(league)
@pytest.mark.vcr
de... |
"""Stubs for aiohttp HTTP clients"""
import asyncio
import functools
import logging
import json
from aiohttp import ClientConnectionError, ClientResponse, RequestInfo, streams
from aiohttp import hdrs, CookieJar
from http.cookies import CookieError, Morsel, SimpleCookie
from aiohttp.helpers import strip_auth_from_url
... |
import sys
import os
import json
import unittest
import bs4
import re
sys.path.append(os.path.abspath('../'))
import r2api.converter.ricette_di_max as rm
file_path = os.path.abspath(os.path.dirname(__file__))
path_to_soup1 = os.path.join(file_path, "soups/RMSoup1.html")
path_to_json1 = os.path.join(file_path, "recip... |
#!/usr/bin/env python3
'''Alienvault OTX Worker for the ACT Project
Copyright 2018,2021 the ACT project <<EMAIL>>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all co... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE.txt file in the root directory of this source tree.
import argparse
import json
import os
import os.path
import random
from typing import... |
import json
from datetime import timedelta
from io import BytesIO
from django.contrib import messages
from django.contrib.staticfiles import finders
from django.core.files import File
from django.core.files.storage import default_storage
from django.db import transaction
from django.http import Http404
from django.sho... |
"""
Helper functions for PyTorch forecasting
"""
from contextlib import redirect_stdout
import os
from typing import Callable, List, Tuple, Union
import torch
import torch.nn.functional as F
from torch.nn.utils import rnn
def integer_histogram(
data: torch.LongTensor, min: Union[None, int] = None, max: Union[Non... |
# -*- coding: utf-8 -*-
u"""User state management via an HTTP cookie
: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 pkcollections
from pykern import pk... |
import logging
import boost_histogram as bh
import numpy as np
import pytest
from cabinetry import histo
class ExampleHistograms:
"""a collection of different kinds of histograms"""
@staticmethod
def normal():
bins = [1, 2, 3]
yields = [1.0, 2.0]
stdev = [0.1, 0.2]
retur... |
import sys
import os.path
import xml.etree.ElementTree as ET
def iter_peripherals(tree):
for ptag in tree.iter('peripheral'):
yield ptag
def iter_registers(ptag):
for rtag in ptag.iter('register'):
yield rtag
def iter_fields(rtag):
for ftag in rtag.iter('field'):
yield ftag
d... |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, <NAME>, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import numpy as np
import numbers
import random
import time
def rgb2hsv(rgb, eps=1e-8):
# Reference: https://www.rapidtables.com/convert/color/rgb-to-hsv.html
# Reference: https://github.com/scikit-image/scikit-image/blob/master/sk... |
#
#
# Copyright 2019 Asylo 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... |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2019-present MagicStack Inc. and the EdgeDB 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... |
import streamlit as st
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots
# We need a function which creates the lantent / noise vector for us.
def generate_latent(batch_size=1,
latent_size=10,
dim=2):
"""
G... |
# coding=utf-8
import os
import traceback
import sys
import cv2
import numpy as np
from PIL import Image
from scipy.ndimage.filters import rank_filter
import pytesseract
class Page(object):
def __init__(self, im, page_num, lang=None):
self.healthy = True
self.err = False
self.page_num = ... |
#!/usr/bin/env python
import argparse
import logging
import os
import simplejson as json
import sys
import urllib
import django
from django.conf import settings
from django.utils import timezone
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
sys.path.insert(0, os.getcwd())
django.setup()
import catalog
... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
"""Google Cloud Hierarchical Firewall Generator.
Hierarchical Firewalls (HF) are represented in a SecurityPolicy GCP resouce.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import copy
import re
from typing imp... |
import os, sys
import time
import stat
import string
mglpacks = [
"DejaVu",
"MolKit",
"ViewerFramework",
"Pmv",
"AutoDockTools",
"PyBabel",
"symserv",
"mglutil",
"NetworkEditor",
"Volume",
"Vision",
"PyAutoDock",
"Support",
]
def getTestsDirs(file_list, directory, ... |
'''
Copyright IBM Corp. 1992, 1993 All Rights Reserved
SPDX-License-Identifier: Apache-2.0
'''
import os
from generator import *
from utils import *
from itertools import chain
FILES = [
"log", "rules",
F_EVAL_CW, F_EVAL_SUPPORT, F_EVAL_CONSEQS,
F_TRAIN_CW, F_TRAIN_SUPPORT, F_TRAIN_CONSEQS,
F_TRAIN_... |
'''
Modified from https://github.com/pytorch/vision.git
Copy from https://github.com/Jerry-2017/DoubleBlindImage/blob/master/code/gaussiansmooth/vgg.py
'''
import math
from adder import adder
import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
from torch.autograd import Funct... |
# -*- coding: utf-8 -*-
import re
from datetime import timedelta, datetime
from dateutil.tz import tzlocal
from typing import Union
from django.core.cache import cache
from django.core.cache.utils import make_template_fragment_key
from django.core.validators import RegexValidator
from django.db import models
from djan... |
#! /usr/bin/env python3
__author__ = '<NAME> <<EMAIL>>'
import os
import sys
import socket
import pickle
import select
import signal
import threading
import time
from datetime import datetime
# Local modules
from APIs.logging import Log
from APIs.logging import Color
from APIs.security import *
from Crypto.Random im... |
"""
PaPs Implementation
Author: <NAME> (github/VSainteuf)
License: MIT
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_scatter import scatter_max
from src.backbones.utae import ConvLayer
class PaPs(nn.Module):
def __init__(
self,
encoder,
num_classes=20,... |
# -*- coding: utf-8 -*-
'''
Author: <NAME>
'''
import re
import pickle
from tqdm import tqdm
dictPart = pickle.load(open('your_terminology_path', 'rb'))[0]
def newPred(ls):
new_ls = []
for i in range(len(ls)):
temp = ls[i]
if temp in [4, 5, 6]:
temp = 4
new_ls.append(tem... |
import numpy as np
import numba as nb
import numpy.linalg as la
import math as m
import cv2
INFINITY = 999999.0
@nb.njit(
nb.types.UniTuple(nb.float64, 3)(
nb.float64,
nb.float64,
nb.float64,
nb.float64,
nb.float64,
nb.float64,
nb.float64,
nb.float... |
#!/usr/bin/python3
import argparse
from argparse import RawTextHelpFormatter
import time
import subprocess
import sys
import glob
import os
import shutil
import psutil
import datetime
from xmlrpc.server import SimpleXMLRPCServer
from xmlrpc.server import SimpleXMLRPCRequestHandler
from threading import Thread
import at... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Feldman Cousins algorithm to compute parameter confidence limits."""
import logging
import numpy as np
from scipy.stats import norm, poisson, rankdata
__all__ = [
"fc_find_acceptance_interval_gauss",
"fc_find_acceptance_interval_poisson",
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""saisoku.py
Saisoku is a Python module that helps you build complex pipelines of batch file copying jobs.
See README.md or https://github.com/shirosaidev/saisoku
for more information.
Author: shirosai <<EMAIL>>
Copyright (C) <NAME> 2019
saisoku is released under the Ap... |
"""vmr
Usage:
vmr list
vmr start [--gui] <vm>
vmr stop [--hard] <vm>
vmr reset [--hard] <vm>
vmr suspend [--hard] <vm>
vmr pause <vm>
vmr unpause <vm>
vmr gennetcfg <vm>
vmr -h | --help
Options:
-h --help Show this screen.
"""
import ast
import os
import subprocess
import sys
from docopt impo... |
import collections as col
import math
import os
import dotenv as de
import numpy as np
import pandas as pd
de.load_dotenv(de.find_dotenv(usecwd=True))
import atom3d.datasets.ppi.neighbors as nb
import atom3d.shard.shard as sh
import examples.cnn3d.subgrid_gen as subgrid_gen
import examples.cnn3d.util as util
grid... |
from __future__ import division
import numpy as np
import pandas as pd
cfs_to_taf = 2.29568411 * 10**-5 * 86400 / 1000
taf_to_cfs = 1000 / 86400 * 43560
def water_day(d):
return d - 274 if d >= 274 else d + 91
def max_release(S):
# rule from http://www.usbr.gov/mp/cvp//cvp-cas/docs/Draft_Findings/130814_te... |
r"""
Logging of Sage sessions
.. TODO::
Pressing "control-D" can mess up the I/O sequence because of
a known bug.
You can create a log of your Sage session as a web page and/or as a
latex document. Just type ``log_html()`` to create an HTML log, or
``log_dvi()`` to create a dvi (LaTeX) log. Your complete ses... |
#!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: cloudformation_info
version_added: 1.0.0
short_description:... |
from __future__ import unicode_literals
import hashlib
import hmac
import logging
from django.contrib.sites.models import Site
from django.http.request import HttpRequest
from django.utils.six.moves.urllib.parse import urlencode
from django.utils.six.moves.urllib.request import Request, urlopen
from django.template i... |
#!/usr/bin/env python
from collections import OrderedDict
from Bio import SeqIO
from BCBio import GFF
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.ticker as tck
import mpl_toolkits.axisartist as axisartist
from matplotlib.patches import Rectangle
def check_location_in... |
# version code c2eb1c41017f+
# Please fill out this stencil and submit using the provided submission script.
from resources.matutil import *
from resources.GF2 import one
from resources.vecutil import zero_vec
from resources.echelon import transformation
## 1: (Problem 7.9.2) Recognizing Echelon Form
# Write each ma... |
import dataclasses
import enum
import inspect
import re
import types
import typing
from contextlib import suppress
# noinspection PyProtectedMember
from dataclasses import _FIELDS # type: ignore
import typing_extensions
from mashumaro.core.const import (
PY_36,
PY_37,
PY_37_MIN,
PY_38,
PY_38_MIN... |
from __future__ import absolute_import, print_function
import errno
import json
import os
import re
import shutil
from string import Template
from uuid import uuid4
from six import iteritems, string_types
from . import SDKCommand
from pebble_tool.sdk import SDK_VERSION, sdk_version
from pebble_tool.exceptions import... |
from flask import render_template, request, session, redirect, url_for
from sqlalchemy.exc import IntegrityError
from qa327 import app
from datetime import date
from datetime import datetime
import qa327.backend as bn
from email_validator import validate_email, EmailNotValidError
"""
This file defines the front-end pa... |
from abc import abstractmethod
import scipy.special
import json
import struct
import cext_acv
import warnings
from .py_acv import *
import cyext_acv, cyext_acv_nopa, cyext_acv_cache
from .py_acv import *
from sklearn.utils.validation import check_array
from .utils import rebuild_tree
from distutils.version import Loose... |
import sys
import os
sys.path.append(os.path.abspath("."))
sys.dont_write_bytecode = True
__author__ = "bigfatnoob"
import inspect
import signal
import time
import copy
from analysis.helpers import helper
from analysis.helpers import constants as a_consts
from store import mongo_store
from utils import logger, cach... |
#! /usr/bin/env python
import ConfigParser
import csv
import datetime as dt
import dnsdb_query
import json
import pygeoip
import re
import sys
from netaddr import IPAddress, IPRange, IPSet
from sortedcontainers import SortedDict
from logger import get_logger
logger = get_logger('winnower')
# from http://en.wikipedi... |
from os import system, name
import io
import time
import sys
import math
def convertTime(seconds):
return time.strftime("%H:%M:%S", time.gmtime(seconds))
## function inputs:
## filePath - path of file to be read
## myList - the list to store everything in
def readNStore(filePath,myList):
... |
"""
The module ``snewpy.snowglobes_interface`` contains a low-level Python interface for SNOwGLoBES v1.2.
The class: class: `SNOwGLoBES` manages the input and output files of the SNOwGLoBES application,
and allows running the simulation for one or several setups::
from snewpy.snowglobes_interface import SNOwGLoBE... |
import argparse
import prjxray.db
import simplejson as json
from prjxray.roi import Roi
from prjxray_db_cache import DatabaseCache
# from numpy import array
def map_tile_to_vpr_coord(conn, tile):
"""Converts prjxray tile name into VPR tile coordinates.
It is assumed that this tile should only have one map... |
import collections
import numpy as np
import cv2
import os
from numba import jit
from skimage import measure
import time
from PostProcessSegmentationMask import positive_negative_masks
@jit(nopython=True)
def compute_metrics_gpu(mask_img, gt_img, image_size):
TP, FP, FN, TN = 0, 0, 0, 0
for i in range(image_... |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import json
import sys
import traceback
import warnings
import azureml._common._error_response.error_hierarchy as error_hierarchy... |
"""
Copyright 2021 <NAME>, <NAME>, GlaxoSmithKline plc; <NAME>, University of Oxford; <NAME>, MIT
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
Unl... |
"""Common functionality for synthesis data generation"""
import argparse
from asyncio import Event
import csv
import json
import logging
import os
from tqdm import tqdm
import numpy as np
import ray
from ... import aiger
from .ltl_syn_data import sample_to_csv_row
logger = logging.getLogger(__name__)
logger.setLeve... |
import scipy as sp
import numpy as np
import scipy.io
import scipy.misc
import scipy.ndimage
import os
import os.path
import copy
import re
from datetime import datetime
import shutil
from mango import mpi
from mango.utils._dicom2netcdf import *
logger, rootLogger = mpi.getLoggers(__name__)
class SkullDcmMetaData(... |
import argparse
import json
import math
from typing import Dict, List, Tuple
import matplotlib.pyplot as plt
import numpy as np
from rlo.utils import zip_values
# Dictionary of (time_budget, expression): value
DatasetDict = Dict[Tuple[int, str], float]
def load_dataset(path: str) -> DatasetDict:
with open(pat... |
from inspect import signature
import inspect
from threading import Lock, Event
import itertools
import types
TIMEOUT_EXCEPTION = TimeoutError
BUSY_EXCEPTION = Exception("busy")
def non_thread(timeout=-1):
if timeout is None or (isinstance(timeout, (float, int)) and timeout <= 0):
timeout = -1
else:
... |
"""MQTT helper."""
import asyncio
import inspect
import logging
from json import dumps
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
import attr
from paho.mqtt.client import Client, MQTTMessage # type: ignore
_LOGGER = logging.getLogger(__name__)
# pylint: disable=too-few-public-met... |
import os
import platform
from subprocess import check_call, CalledProcessError
from .console_logger import ColorPrint
from .file_utils import FileUtils
from .project_utils import ProjectUtils
from .state import StateHolder
from .environment_utils import EnvironmentUtils
class AbstractPlanRunner(object):
@static... |
""" Search cell """
import os
import torch
import torch.nn as nn
import numpy as np
from config import SearchConfig
import utils as utils
from models.search_cnn import SearchCNNController
from architect import Architect
import gc
from tensorboardX import SummaryWriter
from loss import calculate_weighted_loss
from model... |
from __future__ import division
import numpy as np
np.random.seed(42)
from tensorflow.examples.tutorials.mnist import input_data
import matplotlib.pyplot as plt
plt.ion()
plt.rcParams['figure.figsize'] = (7,4)
plt.rcParams['figure.autolayout'] = True
from sklearn.preprocessing import StandardScaler
from cwc.data_wra... |
#!/usr/bin/env python
import json
import os.path
from time import time
from pysnap.utils import (encrypt, decrypt, decrypt_story,
make_media_id, request)
MEDIA_IMAGE = 0
MEDIA_VIDEO = 1
MEDIA_VIDEO_NOAUDIO = 2
FRIEND_CONFIRMED = 0
FRIEND_UNCONFIRMED = 1
FRIEND_BLOCKED = 2
PRIVACY_EVERYONE ... |
import socket as socket_module
import struct
from . import socket
from . import check_support
check_support()
flags = socket.flags
def assert_is_socket(s):
if not isinstance(s, socket_module.socket):
raise ValueError("Given value is not a socket.")
SOL_CAN_BASE = socket_module.SOL_CAN_... |
import collections
import math
import os
import time
import json
import socket
from tqdm import tqdm
import numpy as np
import pickle
import random
import torch
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import torch.optim as optim
from transformers import BertForQuestionAnswering, BertToken... |
import ee
from geemap import ee_to_geopandas
import pandas as pd
import boto3
from sklearn.utils import shuffle
def points_to_df(pts_geo):
"""Converts a feature collection into a pandas dataframe
Args:
pts_geo: collection of pixels on an image
Returns:
df_geo: dataframe containing bands ... |
#from big_ol_pile_of_manim_imports import *
from manimlib.imports import *
class underline(Line):
def __init__(self,texto,buff=0.07,**kwargs):
Line.__init__(self,texto.get_corner(DL),texto.get_corner(DR),**kwargs)
self.shift(DOWN*buff)
NEW_BLUE = "#68a8e1"
COLOR_SYMBOL = "#fffab3"
class Thumbnail(... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from typing import Tuple, Optional, List, Union
class Gconv(nn.Module):
r"""
Graph Convolutional Layer which is inspired and developed based on Graph Convolutional Network (GCN).
Inspired by `<NAME>. Semi-Supervise... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 23 13:02:05 2020
@author: patrickmcfarlane
wnba_salaries.py contains the functions
to gather NBA salary information
"""
from requests import get
SALARY_URL = "https://www.spotrac.com/wnba/cap/"
URL_TO_ID_WNBA = {'https://www.spotrac.com/redirec... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = '<NAME>'
__doc__ = r'''
Created on 03-12-2020
'''
import numpy
import numpy
import torch
from matplotlib import pyplot
def one_sample_positive_class_precisions(scores: numpy.array, truths: numpy.array) -> numpy.array:
"""
Referenc... |
# -*- coding: utf-8 -*-
import os
import mxnet as mx
import numpy as np
import cv2
import shutil
def iou(x, ys):
"""
Calculate intersection-over-union overlap
Params:
----------
x : numpy.array
single box [xmin, ymin ,xmax, ymax]
ys : numpy.array
multiple box [[xmin, ymin, xmax... |
# coding: utf-8
# Here goes the imports
import csv
import matplotlib.pyplot as plt
# Let's read the data as a list
print("Reading the document...")
with open("chicago.csv", "r") as file_read:
reader = csv.reader(file_read)
data_list = list(reader)
print("Ok!")
# Let's check how many rows do we have
print("N... |
import torch
import itertools
from . import networks
import torch.nn as nn
import random
import numpy as np
class StyleGAN_G(nn.Module):
"""
This class implements the CycleGAN model, for learning image-to-image translation without paired data.
The model training requires '--dataset_mode unaligned' dataset.... |
import tensorflow as tf
import numpy as np
from keyword import iskeyword
def convert_dtype(lib, dtype):
if lib == 'tf':
if not isinstance(dtype, tf.DType):
dtype = tf.as_dtype(np.dtype(dtype))
elif lib == 'np':
if not isinstance(dtype, np.dtype):
if isinstance(dtype, t... |
# 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... |
from __future__ import annotations
from enum import Enum, IntFlag
from functools import reduce
from numbers import Number
from operator import ior
from queue import PriorityQueue, Queue
from typing import TYPE_CHECKING, Any, Callable, Iterable, Optional
import numpy
from shapely.affinity import translate
from shapely... |
#!/usr/bin/env python
"""AmendmentValidationAdaptor class.
"""
from peyotl.utility import get_logger, doi2url
_LOG = get_logger(__name__)
def create_validation_adaptor(obj, errors, **kwargs):
# just one simple version for now, so one adapter class
return AmendmentValidationAdaptor(obj, errors, **kwargs)
# ... |
import os
import random
import re
from datetime import datetime
import pytest
from invoke.context import Context
import test.test_utils.ec2 as ec2_utils
import test.test_utils.eks as eks_utils
from src.github import GitHubHandler
from test.test_utils import is_pr_context, SKIP_PR_REASON
# Test only runs in regio... |
# -*- coding: utf-8 -*-
from __future__ import print_function as _
from __future__ import division as _
from __future__ import absolute_import as _
def _get_nn_spec(spec):
if spec.WhichOneof('Type') == 'neuralNetwork':
nn_spec = spec.neuralNetwork
elif spec.WhichOneof('Type') == 'neuralNetworkClassifi... |
# standard libs
from collections.abc import Mapping, MutableMapping
from copy import copy
import re
from pprint import pformat
# third party libs
# project imports
class RecursiveDict(MutableMapping):
"""A dictionary that allows recursive and relative access to its contents."""
def __init__(self, *args, **kwar... |
#!/usr/bin/env python
# coding: utf-8
# In[6]:
#!/usr/bin/env python
# coding: utf-8
# In[6]:
import argparse
from six import raise_from
import csv
from PIL import Image
import numpy as np
import os
import cv2
import random
import tensorflow as tf
def parse_args():
parser = argparse.ArgumentParser(descripti... |
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
import os
import sys
import unittest
from sklearn.utils.testing import assert_equal
# noinspection PyProtectedMember
from sklearn.utils.testing import assert_allclose
from sklearn.utils.testing import assert_raises
from skl... |
import math
import cv2
import numpy as np
import time
import copy
class point:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
self.polygon = []
def print(self):
return f"[{self.x}, {self.y}, {self.z}]"
class polygon:
def __init__(self, points, c... |
"""
The MIT License
Copyright (c) 2021 MatNet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... |
"""This module is responsible for creating new internal packages"""
import logging
from cookiecutter_manager.helpers.helper_cookiecutter import \
clone_cookiecutter_template_with_dict
from cookiecutter_manager.models import CookieCutterTemplate
from experiments_manager.consumers import \
send_exp_package_creat... |
# coding: utf-8
# author: <EMAIL>
r"""Train audio model."""
from __future__ import print_function
import sys
sys.path.append('./audio') # audio:Dependencies of training, model and datasets.
import os
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
# get_ipython().run_line... |
# Copyright (C) 2020 <NAME>
# Produced in part from pydicom's codify.py
# 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 ... |
# coding=utf-8
# Copyright 2020 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... |
################################################################################
#
# MIT License
#
# Copyright (c) 2020-2021 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to dea... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
# This file automates the manual fix... |
#!/bin/python3
#
#MIT License
#
#Copyright (c) 2020 https://github.com/todag
#
#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 right... |
from typing import List, Tuple, Set, NamedTuple, Optional
import re
import os
import sys
import shutil
import struct
import logging
import traceback
from enum import Enum
from argparse import ArgumentParser
from fs import FSWorker
from fs_ext4 import FS_CONFIGS_EXT4, FSWorker_EXT4
from fs_btrfs import FS_CONFIGS_BTR... |
# -*- coding: utf-8 -*-
# MIT License
# Copyright (c) 2018-2020 Renondedju
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to... |
from django.shortcuts import render, redirect, get_object_or_404, HttpResponse
from django.db.models import Q
from django.contrib.auth.models import User
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.