text stringlengths 6.04k 39.5k |
|---|
"""
Admin models for Character app
"""
from django.contrib import admin
from django.forms import ModelForm
from django.utils.safestring import mark_safe
from .models import (Roster, RosterEntry, Photo, SearchTag, FlashbackPost, Flashback,
FlashbackInvolvement, Story, Chapter, Episode, StoryEmit,
... |
from os.path import expanduser, join
import sys
print(sys.path)
#sys.path.remove('/usr/local/lib/python3.7/site-packages')
sys.path.append('/usr/local/.pyenv/versions/3.6.0/lib/python3.6/site-packages')
sys.path.append('/Users/kazuya_yufune/.pyenv/versions/3.6.0/lib/python3.6/site-packages')
from nnmnkwii.datase... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
import warnings
from contextlib import contextmanager
from .version_utils import tf_later_than
try:
import cv2
except ImportError:
cv2 = None
__middles__... |
#
# Handler library for Linux IaaS
#
# Copyright 2014 Microsoft 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 requi... |
import datetime
import json
import logging
import pytz
from antlr4 import InputStream, CommonTokenStream, ParseTreeVisitor, Token
from antlr4.error.Errors import ParseCancellationException, NoViableAltException
from antlr4.error.ErrorStrategy import BailErrorStrategy
from decimal import Decimal
from enum import Enum
f... |
"""
Django-Select2 Widgets.
These components are responsible for rendering
the necessary HTML data markups. Since this whole
package is to render choices using Select2 JavaScript
library, hence these components are meant to be used
with choice fields.
Widgets are generally of two types:
1. **Light** --
They ... |
from __future__ import absolute_import, division, print_function
import socket
import docker
import logging
import os
import time
import tempfile
from ..container_manager import (
create_model_container_label, parse_model_container_label,
ContainerManager, CLIPPER_DOCKER_LABEL, CLIPPER_MODEL_CONTAINER_LABEL,
... |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
# Copyright (c) Facebook, Inc. and its affiliates.
import collections
import json
import logging
import os
import warnings
from ast import literal_eval
import demjson
import torch
from mmf.common.registry import registry
from mmf.utils.env import import_user_module
from mmf.utils.file_io import PathManager
from mmf.ut... |
from wtforms import fields, validators
from sqlalchemy import Boolean, Column
from flask.ext.admin import form
from flask.ext.admin.form import Select2Field
from flask.ext.admin.model.form import (converts, ModelConverterBase,
InlineFormAdmin, InlineModelConverterBase,
... |
from __future__ import absolute_import, division, print_function
import os
from cctbx import sgtbx
from dxtbx.model import Crystal
from dxtbx.model.experiment_list import ExperimentListFactory
from iotbx.xds import integrate_hkl, spot_xds
from libtbx.phil import parse
from rstbx.cftbx.coordinate_frame_helpers import ... |
from django.conf import settings
from django.db.models.query import QuerySet
from django.test import Client, TestCase, LiveServerTestCase
from selenium.common.exceptions import WebDriverException, TimeoutException, NoSuchElementException, StaleElementReferenceException
from selenium import webdriver
from selenium.web... |
import sys
if sys.platform == 'win32':
from ._ftd3xx_win32 import *
elif sys.platform == 'linux':
from ._ftd3xx_linux import *
import ctypes as c
import threading
import time
from .defines import *
msgs = [
'FT_OK',
'FT_INVALID_HANDLE',
'FT_DEVICE_NOT_FOUND',
'FT_DEVICE_NOT_OPENED',
'FT_IO_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from email.parser import BytesParser
from email.utils import make_msgid
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
from email.header import decode_header
from .helpers import FileBaseMem
from .helpers import Kitten... |
from .ircc_c_types import IrccCTypes
from ..ir_codegen import IrccExpression
from motor_typing import TYPE_CHECKING
class IrccCExpression(IrccExpression):
_PREC_CONSTANT = 0
_PREC_VARIABLE = 0
_PREC_CAST = 1
_PREC_ACCESS = 1
_PREC_SUBSCRIPT = 1
_PREC_CALL = 1
_PREC_ADDRESSOF = 2
_PREC_... |
import os
from pathlib import Path
from datetime import datetime
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import Column, Integer, String, Boolean, DateTime, Float, ForeignKey
from summit_errors import send_processor_email
Base = declarative_base(... |
import os
import logging
import configparser
import shutil
import subprocess
import re
import time
def config_logger(workspace):
logger = logging.getLogger('root')
logger.setLevel(logging.INFO)
fmt = logging.Formatter('[%(asctime)s]%(filename)s:%(lineno)d:[%(levelname)s]: %(message)s')
file_handler = ... |
import asyncio
import json
import logging
import websockets as ws
from .client import Client
class ReconnectingWebsocket:
STREAM_URL = 'wss://stream.binance.com:9443/'
MAX_RECONNECTS = 3
MIN_RECONNECT_WAIT = 0.1
def __init__(self, loop, path, coro, prefix='ws/'):
self._loop = loop
s... |
# utility functions
import contextlib
import datetime
import gzip
import io
import os
import pyramid.request
import re
import tempfile
from dcicutils.misc_utils import check_true, VirtualApp, count_if, identity
from io import BytesIO
from pyramid.httpexceptions import HTTPUnprocessableEntity, HTTPForbidden, HTTPServe... |
"""Transforms relate to tokenization/subword."""
from onmt.utils.logging import logger
from onmt.transforms import register_transform
from .transform import Transform, ObservableStats
class TokenizerTransform(Transform):
"""Tokenizer transform abstract class."""
def __init__(self, opts):
"""Initializ... |
from typing import Optional, Sequence, Mapping
import logging
from sortedcontainers import SortedDict
from PySide2.QtWidgets import QWidget, QHBoxLayout, QGraphicsScene, QGraphicsView, QGraphicsItem, QGraphicsRectItem, \
QGraphicsPolygonItem, QGraphicsLineItem
from PySide2.QtGui import QBrush, QPen, QPolygonF
from... |
# Copyright 2014 The Oppia 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 ... |
import enum, datetime
from scrimmage import app, db
from .helpers import get_student_info
class AdminSetting(db.Model):
__tablename__ = 'settings'
id = db.Column(db.Integer, primary_key=True)
key = db.Column(db.String(128), unique=True, index=True)
value = db.Column(db.String(128), index=True)
def __init__... |
"""
This module defines a class for running knoweng's spreadsheet preprocess jobs.
"""
import csv
from enum import Enum
import logging
import os
from time import sleep
import yaml
from nest_py.knoweng.jobs.pipeline_job import PipelineJob
import nest_py.knoweng.data_types.files as files
PipelineType = Enum('PipelineT... |
import collections
import os
import sys
import numpy
try:
from PIL import Image
available = True
except ImportError as e:
available = False
_import_error = e
import chainer
from chainer.dataset.convert import concat_examples
from chainer.dataset import download
from chainer import function
from chaine... |
"""
TeX File Functions for PuMA
"""
import os
import numpy as np
def write_multimonth_tex_var_file(reportRange,Total_Usage,meanMonthly_Usage_per_Area,Fuel_per_Day,Total_Cost,Fuel_Cost_per_Day,Neighbor_mean_monthlyUsage_per_Area,Prog_Usage,Stove_ID,InT_Ave,annualCost, flagValue,daysMonitored,NeighborhoodSize,highMonth... |
import glob
import json
import logging
import matplotlib.patheffects as path_effects
import numpy as np
import os
import pandas as pd
import re
import matplotlib as mpl
mpl.use('Agg')
from os.path import basename
from matplotlib import pyplot as plt
from shutil import copyfile
# Configure logging
logging.basicConfi... |
"""
Generate model classes from Kubernetes swagger.
"""
import os.path
import pprint
import yaml
BASE_DIRECTORY = os.path.abspath('../KubeClient/Models')
ROOT_NAMESPACE = 'KubeClient.Models'
IGNORE_MODELS = [
'io.k8s.apimachinery.pkg.apis.meta.v1.DeleteOptions',
'io.k8s.apimachinery.pkg.apis.meta.v1.Time',
... |
# Author: <NAME>
# Email: <EMAIL>
from pathlib import Path
import time
from uuid import uuid1
import ipywidgets as ipyw
from ipyevents import Event
from traitlets import Unicode, Int, link, observe
from typing import Union, List
CSS = ipyw.HTML(
"""
<style>
.better-tree-btn {
background: ... |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""URL endpoint to add new histograms to the datastore."""
import json
import logging
import re
import sys
from google.appengine.ext import ndb
# TODO(eak... |
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP.
from flask import current_app, Blueprint, request, json, redirect, render_template
import os
from urllib.parse import quote
from jinja2 import Template, Environment, meta
ztp = Blueprint('ztp', __name__)
from datetime import datetime
ALLOWED... |
from __future__ import division
import re
from collections.abc import Callable
from fnmatch import fnmatchcase
from functools import partial
from itertools import chain
from typing import Any, Dict, Generator, NoReturn, Optional, Tuple, Union
from joblib import Parallel, delayed
from .picker import CherryPicker
__a... |
import random, math, gym
import numpy as np
import keras
import keras.optimizers as Kopt
from keras.layers import Convolution2D
from keras.layers import Dense, Flatten, Input
from keras.models import Model
from keras import backend as K
import pickle
import os
models_path = ""
data_path = ""
RBG_mode = True
Conv_folde... |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Team 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-... |
#!/usr/bin/python3
# File: slurm_status.py
#
# Author: <NAME> (<EMAIL>)
# <NAME> (<EMAIL>)
#
# Copyright (c) University of Nebraska-Lincoln. 2012
# University of Wisconsin-Madison. 2016
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file e... |
#
# Copyright (c) 2006-2019, RT-Thread Development Team
#
# SPDX-License-Identifier: Apache-2.0
#
# Change Logs:
# Date Author Notes
# 2019-03-21 Bernard the first version
# 2019-04-15 armink fix project update error
#
import glob
import xml.etree.ElementTree as etree
from xml.etree.... |
from .custom_control import FileSelectorCombo, DirSelectorCombo, ListBoxCombo, TextBoxCombo, CheckBoxGrid, GPAModelCheckBoxGrid
from wx.lib import masked
from wx.lib.masked import NumCtrl
from wx.lib.intctrl import IntCtrl
import wx.lib.intctrl
import pkg_resources as p
class GenericClass(wx.ScrolledWindow):
... |
import re
import string
def remove_cleantext(text):
'''Make text lowercase, remove text in square brackets,remove links,remove punctuation
and remove words containing numbers.'''
text = str(text).lower() # Lower
text = re.sub('\[.*?\]', '', text) # SquareBracket
text = re.sub('https?://\S+|www\.\S+... |
#!/usr/bin/python
# Copyright: (c) 2018, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see LICENSE-GPLv3.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0 (see LICENSE-APACHE2.txt or http://www.apache.org/licenses/LICENSE-2.0)
from __future__ import absolute_import, division, print_function... |
# -*- coding: utf-8 -*-
"""
heroku3.api
~~~~~~~~~~
This module provides the basic API interface for Heroku.
"""
import json
import sys
from pprint import pprint # noqa
import requests
from requests.exceptions import HTTPError
from .helpers import is_collection
from .models import Plan, RateLimit
from .models.acco... |
# from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import time
import datetime
import numpy as np
import tensorflow as tf
#from tf.nn import rnn, rnn_cell
import codecs
import collections
import random
from collections import Counter
import ... |
# utils/update_checkout.py - Utility to update local checkouts --*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.tx... |
"""
Author: <NAME>: <EMAIL>
Version: 0.1
Description: Utility functions for evaluations (used in 1_eval.py)
"""
import os
from os.path import dirname, abspath
import torch as th
import torch.utils.data
from utils.utils import tsne
import numpy as np
import seaborn as sns
import pandas as pd
import matplotlib.pyplot... |
from collections import OrderedDict
from torch import nn
from torch.nn import AvgPool2d, Linear, ModuleList
from cnn.MixedFilter import MixedConv, MixedConvWithReLU, Block
from cnn.MixedLayer import MixedLayer
from cnn.models import BaseNet
# init layers creation functions
def createMixedConvWithReLU(bitwidths, in_... |
import csv
import json
import sys
import logging
import re
import os
from hashlib import sha256
from collections import defaultdict
from http.server import BaseHTTPRequestHandler, HTTPServer
from io import StringIO
import umsg
import boto3
import azure.core.exceptions
import botocore.exceptions
from azure.storage.blob... |
from typing import List, Tuple, Union
import numpy as np
import copy
import math
import sys
sys.path.extend("../../")
from onpolicy.envs.highway.highway_env import utils
from onpolicy.envs.highway.highway_env.road.road import Road, LaneIndex, Route
from onpolicy.envs.highway.highway_env.types import Vector
from onpoli... |
################################################################################
# Usage: python make_vectorize_i.py
#
# This progrmm generates file vectorize.i by creating a macro that defines the
# inline code for the signature of each SWIG interface to a CSPICE function.
#
# The generated file consists of the follow... |
# -*- coding: utf-8 -*-
import configparser
import random
import sys
import time
try:
from importlib.metadata import version
except ImportError:
# We're running a Python < 3.8
from importlib_metadata import version
from pathlib import Path
from threading import Thread
from urllib.parse import urlparse
impo... |
import tensorflow as tf
import numpy as np
from dl_playground.networks.layers.mlp import MLP, MLPWithBatchNorm
from dl_playground.networks.layers.weight_sharing import (
MLPWithTransposedWeights,
CNNWithTransposedWeights,
)
from dl_playground.networks.layers import cnn
from dl_playground.networks.layers.interf... |
import random
import time
import os
import datetime
#searches for available flights based off the dst, src, and date inputed by
#the user. Returns information regarding the flight, including fare type, and
#layover time, if any.
def search(connection, choosen_flight):
acode = acodes(connection)
values = dates()... |
#!/usr/bin/env python3
from testUtils import Utils
import testUtils
import time
from Cluster import Cluster
from WalletMgr import WalletMgr
from Node import BlockType
from Node import Node
from TestHelper import AppArgs
from TestHelper import TestHelper
import decimal
import math
import re
import signal
############... |
"""WISDEM Monopile API"""
__author__ = ["<NAME>"]
__copyright__ = "Copyright 2020, National Renewable Energy Laboratory"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
import openmdao.api as om
from wisdem.orbit import ProjectManager
class Orbit(om.Group):
def initialize(self):
self.options.declare("f... |
# ************************************************
# |docname| - Provide feedback for student answers
# ************************************************
#
# Imports
# =======
# These are listed in the order prescribed by `PEP 8
# <http://www.python.org/dev/peps/pep-0008/#imports>`_.
#
# Standard library
# -------------... |
from flask import request, flash, redirect, url_for, abort, current_app, jsonify
from flask_login import current_user, login_required
import sqlalchemy.exc
from sqlalchemy import func, distinct, text
from typing import List
from app import db
from app.models import CorpusUser, ControlLists, ControlListsUser, WordTok... |
from typing import List, Union
from pandas import DataFrame
from .utilities import *
from .visualize import *
from itertools import product
from .constants import *
class Clusterer:
"""Meta class for shared methods for both AutoClusterer and MultiAutoClusterer.
"""
def pick_best_labels(self, method: Opt... |
import re
import warnings
import ast
import json
from pathlib import Path
import urllib.parse
from os import environ
from functools import partial
from django.core.exceptions import ImproperlyConfigured
def _cast(value):
# Safely evaluate an expression node or a string containing a Python
# literal or contain... |
""" This module is responsible for converting between Galaxy's tool
input description and the CWL description for a job json. """
import collections
import json
import logging
import os
from six import string_types
from galaxy.exceptions import RequestParameterInvalidException
from galaxy.util import safe_makedirs, ... |
#####################################################################
# #
# toolpalette.py #
# #
# Copyright 2013, Monash University ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""transforms.py -- This module contains parameter transformations that may be
useful to transform from parameters that are easier to _sample_ in to the
parameters required for building SED models.
They can be used as ``"depends_on"`` entries in parameter specifications.
... |
# Copyright 2018, The TensorFlow 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 t... |
#!/usr/bin/env python
#
# rastrea2r windows client
import os
# import winreg
import glob
import hashlib
import platform
import psutil # New multiplatform library
import shutil
import subprocess
import sys
import yara
import zipfile
from argparse import ArgumentParser
from mimetypes import MimeTypes
from requests ... |
from numpy import delete
import streamlit as st
def maintain(layout_data=None):
"""
Renders the 'Lab' page.
Parameters
----------
layout_data: config data for rendering page.
"""
user = st.sidebar.text_input('Username')
passwd = st.sidebar.text_input('Password', type='password')
... |
'''editor.py'''
# Included libraries
from usefulFunctions import sep
# Internal libraries
import os
import platform
from shutil import move, rmtree
from urllib.parse import quote
def formatXML(base: int, *args: str) -> str:
r = ''
for line in args:
r += ('\t' * base) + line + '\n'
return r
def... |
#!/usr/bin/env python
from skimage.color import rgb2gray, rgb2grey
from scipy.ndimage.filters import gaussian_filter
from scipy import fftpack as fp
from skimage.io import imread, imsave
from scipy.misc import toimage
import numpy as np
import sys
###########################################################
# IMAGE ... |
import os
import unittest
from httprunner import exceptions, loader, validator
class TestFileLoader(unittest.TestCase):
def test_load_yaml_file_file_format_error(self):
yaml_tmp_file = "tests/data/tmp.yml"
# create empty yaml file
with open(yaml_tmp_file, 'w') as f:
f.write(... |
# Copyright 2017 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 or agreed to in wri... |
from ast import FunctionType
from types import AsyncGeneratorType, CoroutineType, GeneratorType
from typing import (
AsyncGenerator,
List,
Dict,
Callable,
Coroutine,
Generator,
Any,
Optional,
Tuple,
)
import discord
from acrossword import Ranker
import random
import asyncio
import co... |
import numpy as np
from PIL import Image
import cv2
import math
import skimage.measure
from .constants import *
def load_video(filename, every_n_frames=None, specific_frames=None, to_rgb=True, rescale=None, inc_pil=False, max_frames=None):
"""Loads a video.
Called by:
1) The finding faces algorithm where... |
#!/usr/bin/python
# Copyright (c) 2018, Red Hat, 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.apache.org/licenses/LICENSE-2.0
#... |
# 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 not u... |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Contains the transformation functions for getting from ICRS/HCRS to CIRS and
anything in between (currently that means GCRS)
"""
import numpy as np
from astropy import units as u
from astropy.coordinates.baseframe import frame... |
# <NAME> ickst001
# Clarifications:
# Ante is required
# Always reshuffle when dealing
# no betting before discard
# ai is dealer
# announce what ai is doing
# betting always goes Human -> computer -> h -> c
# only 4 rounds of betting as above ^^^^^^
# everyone reveals cards every time
# game ends when either player ... |
#!/usr/bin/env python
import rospy
import numpy as np
import tf
import utilities as util
from sensor_msgs.msg import JointState, Imu
from std_msgs.msg import Float64MultiArray, Int8
import T_computations as t
import J_computations as j
import time
# GLOBAL VARIABLES
pub_err = rospy.Publisher('Data_for_errors', Float... |
import torch
import torch.utils.data as data
import random, os, re, ast, time
import numpy as np
import collections
import dgl
from dgl.data.utils import save_graphs, load_graphs
from nltk.corpus import stopwords
from utils.torch_utils import get_positions
from utils.config import config
from utils import constant
st... |
from nmigen.compat import *
from nmigen.compat.genlib.cdc import MultiReg
__all__ = ["UART"]
class UARTBus(Module):
"""
UART bus.
Provides synchronization.
"""
def __init__(self, pads):
self.has_rx = hasattr(pads, "rx_t")
if self.has_rx:
self.rx_t = pads.rx_t
... |
#
# Copyright 2018-2021 Elyra 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 writ... |
import functools
print = functools.partial(print, flush=True)
import numpy as np
import nltk # For tokenize
from tqdm import tqdm # Progress bar
import pickle # Saving the data
import math # For float comparison
import os # Checking file existance
import random
import string, copy
from nltk.tokenize import word_to... |
# -*- coding: utf-8 -*-
""" EvaluatorSparseMultiPlayers class to wrap and run the simulations, for the multi-players case with sparse activated players.
Lots of plotting methods, to have various visualizations. See documentation.
.. warning:: FIXME this environment is not as up-to-date as :class:`Environment.Evaluator... |
"""
1. 能够统一生成词典、训练词向量,并保存这些中间文件至 /tmp 文件夹
2. 能够提供查询数据库、分词、查词典、查词向量、查ontology 数据交换的接口
3. 个人信息返回
"""
import sys
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(BASE_DIR, '..'))
import tensorflow as tf
import os,json, pickle, time
from sklearn.manifold import TSNE
import matp... |
import ast
import nested_dict as nd
import matplotlib.pyplot as plt
import numpy as np
import json
import seaborn as sns
import networkx as nx
import populate_graph as pg
import sys
# USAGE: python3 results.py <demo100 | demo500 | demo1000 | erdos500 | erdos1000 | snapshot> <file | results/results.json>
# Example: py... |
"""Various major components."""
# pylint: disable=no-member
import torch
import torch.nn as nn
from stackgan.utils.blocks import (
UpsamplingBlock, Conv2dCongruent, JoinBlock,
ResidualBlock, DownsamplingBlock, ChannelReducingBlock
)
class ConditioningAugmentation(nn.Module):
"""Conditioning Augmentation... |
import logging
import os
import sys
import time
def init_logging(logger_name, log_file, stdout=False):
formatter = logging.Formatter('%(asctime)s [%(levelname)s] %(module)s: %(message)s',
datefmt='%m/%d/%Y %H:%M:%S' )
print('Making log output file: %s' % log_file)
pr... |
##########################################################################
#
# Copyright (c) 2016, Image Engine Design 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:
#
# * Redistrib... |
import cv2
from PyQt5.QtWidgets import QWidget, QApplication
from PyQt5.QtCore import QPoint, Qt, QThread, pyqtSignal
from PyQt5.QtGui import QImage, QPainter
from ultimatelabeling.models import StateListener, FrameMode
from ultimatelabeling.utils import draw_detection
from ultimatelabeling.models import KeyboardListen... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import os
import numpy as np
import gym
import torch
from utils import helpers as utl
import matplotlib.pyplot as plt
from torchkit import pytorch_utils as ptu
from environments.make_env import make_env
def get_model_path(folder, model_name="encoder", iteration=None):
"""
:param folder:
:param model_name... |
from functools import reduce
from addict import Dict
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.distributions as td
from ctt.models.modules import EntityMasker
from ctt.utils import typed_sum_pool
def get_class(key):
KEY_CLASS_MAPPING = {
"infectiousness": Infectious... |
# -*- coding: utf-8 -*-
import json
import httplib as http
from dateutil.parser import parse as parse_date
import itertools
from flask import request
from modularodm import Q
from modularodm.exceptions import NoResultsFound, ValidationValueError
from framework import status
from framework.exceptions import HTTPError,... |
from common.util.math import norm, getAngle, getLength, horizontal, Line
from scipy.spatial import distance as dist
import numpy as np
import collections
import cv2 as cv
# Some math helper methods to find the properties of the contours
def getMidPoint(pts):
moment = cv.moments(pts)
midPtX = int(moment['m10'] ... |
# This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 <NAME> and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
# We use __getitem__ side effects, which pylint doesn't like.... |
#
# 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, software
# ... |
# -*- coding: utf-8 -*-
# © <NAME>
"""
This module can be run indepenently from the `usrv` package. It contains all
the utilities to launch a json server (ie, you get and send json) from python
lib or python WGSI (highly recommended in production mode).
* to run server from python:
```bash
$ python srv.py... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Graph utilities."""
import logging
import sys
from os import path
from time import time
from glob import glob
from six.moves import range, zip, zip_longest
from six import iterkeys
from collections import defaultdict, Iterable
from multiprocessing import cpu_count
impo... |
import enum
import itertools
import logging
import re
from contextlib import contextmanager
from dataclasses import dataclass, field
from functools import lru_cache
from pathlib import Path, PurePath
from test.utils import GraphHelper, get_unique_plugins
from typing import (
IO,
Callable,
Dict,
Generato... |
from concurrent import futures
import logging
import os
import json
import uuid
from datetime import datetime
import faiss
import pickle
import numpy as np
import requests
import sys
import time
from google.protobuf import descriptor
from google.protobuf import any_pb2
import grpc
from grpc_reflection.v1alpha import r... |
import os
import os.path as osp
import sys
import cv2
import glob
import json
import time
import matplotlib.pyplot as plt
import numpy as np
import torch
import torchvision.transforms.functional as TF
from tqdm import tqdm
from shutil import get_terminal_size
from basicsr.metrics import calculate_psnr, calculate_ssim
... |
"""Heat integration case study.
This is example 1 of the Yee & Grossmann, 1990 paper "Simultaneous optimization
models for heat integration--II".
DOI: 10.1016/0098-1354(90)85010-8
This file provides common modeling elements.
"""
from __future__ import division
from pyomo.environ import (
ConcreteModel, Constrai... |
#!/usr/bin/python3
import sys
import re
import math
import random
import copy
print(sys.argv)
i_net = sys.argv[1]
i_directed = sys.argv[2]
i_nof_subgraphs = int(sys.argv[3])
i_nof_nodes = int(sys.argv[4])
i_perc_edges = float(sys.argv[5])
i_o_prefix = sys.argv[6]
if i_directed == 'false':
i_directed = False
els... |
# Tests a gait recognizer CNN
# This version uses a custom DataGenerator
__author__ = '<NAME>'
__copyright__ = 'February 2021'
import os
import sys
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import numpy as np
import os.path as osp
from os.path import expanduser
import pathlib
maindir = pathlib.Path(__file__).pare... |
# Copyright 2021 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,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.