text stringlengths 3.07k 12.6k |
|---|
import os
import subprocess
import pandas as pd
import copy
import yaml
import copy
from .factories.mysql import MySqlFactory
from .factories.pandas import PandasFactory
from .factories.postgres import PostgresFactory
from .factories.spark import SparkFactory
from .factories.sqlserver import SqlServerFactory
root_url... |
"""
@Author : liujianhan
@Date : 2018/5/26 下午2:05
@Project : action_class_v1
@FileName : demo.py
@Description : 多进程视频实时识别demo
"""
import os
import time
from multiprocessing import Queue, Process
import cv2
# from action_class_v1.service import inference, load_model
from action_class.... |
#
# 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 us... |
#! /usr/bin/env python
import dash
from dash import html, dcc, Output, Input, State, ALL
import dash_bootstrap_components as dbc
from dash_component_template import ComponentTemplate
from .utils import parse_triggered_prop_ids
from .collapsecontent import CollapseContent
from .shareddatastore import SharedDataStore
... |
import logging
from fcntl import ioctl
import v4l2
class V4L2Ctrls:
def __init__(self, device, fd):
self.device = device
self.fd = fd
self.get_device_cap()
self.get_device_controls()
def setup_v4l2_ctrls(self, params):
for k, v in params.items():
if k in [... |
import openpyxl
from openpyxl import Workbook
from openpyxl.cell.cell import Cell
from pandas import DataFrame
from xl_transform.common import row
def extract_data_frame(
source,
sheet_name,
header_list=None,
start_row_idx=1,
start_col_idx=1,
data_row_direction=row,
... |
#!/usr/bin/env python3
import pygame
import sys
from enum import Enum
from pygame.locals import *
class App:
WIDTH = 400
HEIGHT = 400
TITLE = "First-time with Pygame by CSaratakij"
def __init__(self):
self.__game = Game(App.TITLE, App.WIDTH, App.HEIGHT)
def start(self):
self.... |
import re
from collections import OrderedDict
def _replace_end(string, end, new_end):
if string == end:
return new_end
if string.endswith('.' + end):
return string[:-len('.' + end)] + '.' + new_end
return string
def zip_th_tf_parameters(torch_module, tf_module, permute_torch=False):
... |
import os
import time
from html import escape
from urllib.parse import quote
from . import ENC, HTML_DOC
from ._bar import make_html_navbar
HTML_TITLE = b'10.42.0.1:%s'
HTML_HEAD = b'<style>%s</style>'
HTML_BODY = (b'%s<p id="LS_info">'
b'total: %d item(s), '
b'total size: %s (%d, file only)</p>'
... |
import json
from django.contrib import admin
from django.urls import path
#from rest_framework import status
#from rest_framework.response import Response
from django.http import JsonResponse
from ninja import (NinjaAPI, Schema)
from pydantic_models import (ProductBasic, ProductPost,
ProductUpdate, CategoryPost,... |
import numpy as np
from qgomoku.core.board import Board, BoardTransform, Player
from qgomoku.core.game_record import GameRecord
from qgomoku.util import utils
# FeatureBoard classes serve to rapidly prepare feature sets after move and unmove sequences
# Similar to ThoughtBoard, but does not calculate game wins/losse... |
# Copyright (c) 2020 PaddlePaddle 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 applic... |
import components
from dash import no_update
import loaders
from operator import itemgetter
from utils import callback_utils, cache_utils, compress_data, decompress_data
def check_sequence_mismatch(session_id, cache, seq_length):
mismatched = []
if cache.hexists(session_id, cache_utils.CacheKeys.CONTACT_MAP.... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
#
# S K E T C H A P P 2 P Y
#
# Copyright (c) 2016+ <NAME> + <NAME>
# www.pagebot.io
# Licensed under MIT conditions
#
# Supporting DrawBot, www.drawbot.com
# Supporting Flat, xxyxyz.org/... |
"""
Helper functions which obtain forces and energies
corresponding to atoms in structures. These functions automatically
cast atoms into their respective atomic environments.
"""
import numpy as np
from flare.gp import GaussianProcess
from flare.struc import Structure
from copy import deepcopy
from flare.predict impor... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import torch
import open3d
import logging
from tensorboardX import SummaryWriter
import cuda.emd.emd_module as emd
from cuda.chamfer_distance import ChamferDistanceMean
logger = logging.getLogger()
##### type conversion #####
def v... |
#
# Created by <NAME> (<EMAIL>) 04/2019
# Last updated: 04/16/20
#
# Contains code to calculate distance matrices for spherical,
# ring like, and cylindrical geometries.
# Also include code to calculate the EMD between two particle
# physics collider events.
#
# Dependencies: POT library
#
#########################... |
import torch
def append_bias_ones(tensor):
"""Appends vector of ones to last dimension of tensor.
For examples, if the input is of shape [4, 6], then the outputs has shape
[4, 7] where the slice [:, -1] is a tensor of all ones.
"""
shape = list(tensor.shape[:-1]) + [1]
return torch.cat([tenso... |
# -*- coding: future_fstrings -*-
import datetime
import requests
import logging
import os
import json
import hashlib
class Voting(object):
def __init__(self, room, question, *answers, mode='multi'):
self.question = question
self.answers = answers
self.votes = dict()
self.mode =... |
from .data_dicts import LANGUAGE_DISTANCES
from typing import Dict, Tuple
TagTriple = Tuple[str, str, str]
_DISTANCE_CACHE: Dict[Tuple[TagTriple, TagTriple], int] = {}
DEFAULT_LANGUAGE_DISTANCE = LANGUAGE_DISTANCES["*"]["*"]
DEFAULT_SCRIPT_DISTANCE = LANGUAGE_DISTANCES["*_*"]["*_*"]
DEFAULT_TERRITORY_DISTANCE = 4
#... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import os.path as osp
from collections import defaultdict
from typing import Any, Dict, List, Optional, Set
i... |
from django.template import loader, Context, RequestContext
from django.http import HttpResponse
import json
import os
import urllib2
def get_local_JSON(filename, sort_key=None):
json_data = open(
os.path.join(os.path.dirname(__file__), 'data/' + filename))
data1 = json.load(json_data, "utf-8")
if... |
#! /usr/bin/env python3.6
"""
This file contains configuration to prune MobileNet on the Imagenet dataset.
"""
from functools import partial
import tensorflow as tf
from nnet import quantization
from nnet.datasets import imagenet_data
from nnet.models.mobilenet import mobilenet_v1
from nnet.preprocessing import inc... |
"""Slack User Sensor."""
import datetime
import logging
import voluptuous as vol
from homeassistant.const import CONF_ID, CONF_TOKEN, CONF_NAME
from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.... |
import discord
import requests
from urllib.request import urlopen, Request
import urllib
import urllib.request
from urllib import parse
from bs4 import BeautifulSoup
from discord.ext import commands
import json
import pandas
import geocoder
import re
import time
import datetime
class COVID19(commands.Co... |
# -*- coding: utf-8 -*-
from pkg_resources import resource_stream # pylint: disable-msg=E0611
import colander
import deform
from hem.db import get_session
from horus import interfaces
from horus.schemas import email_exists, unique_email
from pyramid.settings import asbool
from pyramid.session import check_csrf_token
... |
"""Vehicle rig finalizer script.
This script has functions that take the results of the previous
steps of the rigging process and puts them together.
This tool makes sure that the controllers are correctly
parented in the outliner.
"""
from maya import cmds
import os
import webbrowser
import dataNodeManager
reload(d... |
#!/usr/bin/env python
# Copyright 2019 Cloudbase Solutions Srl
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... |
#------------------------------ data_batcher.py file -----------------------------------#
"""
This file contains classes that help in training/testing neural networks. It defines two
classes: BatchGenerator and Batch. The latter contains a mini-batch of data that is
presented to the neural network for training, whi... |
#!/usr/bin/env python3
"""The evaluation script for UCCA layer 1."""
from argparse import ArgumentParser
from itertools import repeat
from ucca import evaluation, constructions, ioutil
def main(args):
guessed, ref, ref_yield_tags = [None if x is None else ioutil.read_files_and_dirs((x,))
... |
import numpy as np
import numpy.fft as npfft
import dask
from dask.array.core import Array
from dask.utils import raises
import dask.array as da
from dask.array.fft import fft, ifft, rfft, irfft, hfft, ihfft
def mismatch_err(mismatch_type, got, expected):
return '%s mismatch, got %s, expected %s' % (mismatch_typ... |
"""
Doc string
"""
import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import interpolate, signal
from scipy.stats import zscore
import nibabel as nb
from tftb.processing import smoothed_pseudo_wigner_ville as spwvd
frequency_bands = {
"vlf": ["Very low frequency", (0... |
from django import forms
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.forms import ModelChoiceField, IntegerField
from django.utils.translation import gettext_lazy as _
from make_queue.fields import MachineTypeField, MachineTy... |
import datetime
import json
from flask import Flask, jsonify, render_template, request
from flask_caching import Cache
from channel_distribution import ChannelDistribution
from scan_summary import ScanSummary
from track_channel import TrackChannels
config = {
"CACHE_TYPE": "simple",
"CACHE_DEFAULT_TIMEOUT": ... |
#!/usr/bin/python3
from __future__ import print_function
import sys
import os
import re
import json
import argparse
import signal
import shutil
from .tools import unique
def snp_dict_load(dict_path, verb=1):
""" Read JSON dictionary from file. """
if os.path.exists(dict_path):
try:
with... |
"""supervisr core tasks"""
import json
import time
from decimal import Decimal
from logging import getLogger
from celery import Task
from celery.result import AsyncResult
from django.conf import settings
from supervisr.core.celery import CELERY_APP
from supervisr.core.signals import StatisticType, on_set_statistic
L... |
import os, sys
import pandas as pd
import time
import numpy as np
from scoring.Descriptors.AminoAcid20 import AminoAcid20
from scoring.Descriptors.DSSP34 import DSSP34
from scoring.Descriptors.RDKit2D147 import RDKit2D147
from scoring.Descriptors.RDKit3D11 import RDKit3D11
from scoring.Descriptors.PaDEL92 import PaDEL... |
import sys
from typing import List
import numpy as np
from nobos_commons.augmentations.joint_augmenter import JointAugmenter
from nobos_commons.data_structures.dimension import ImageSize
from nobos_commons.data_structures.human import Human
# TODO: Combine this cropped version with the normal version (which doesn'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
from djcelery import celery
import os
import datetime
import sys
import configparser
import rabbitpy
import multiprocessing
import json
import time
project_path = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(project_path, ... |
import ankidmpy.util as util
from collections import defaultdict
import shutil
import os.path
def build(decks, src_dir, build_dir, lang):
glbals = dict(deck=util.getJson(os.path.join(src_dir, 'deck.json')),
config=util.getJson(os.path.join(src_dir, 'config.json')),
model=util.g... |
import difflib
import json
import requests
from mock import Mock
from .checking import *
DESIRED_STRINGS = ["username", "not found", "пользователь", "profile", "lastname", "firstname", "biography",
"birthday", "репутация", "информация", "e-mail"]
RATIO = 0.6
TOP_FEATURES = 5
URL_RE = re.compile(r... |
import tkinter as tk
import data
from coin import Coin
from polycoin import PolyCoin
from circlecoin import CircleCoin
from rectcoin import RectCoin
from metallurgy import Metallurgy
from PIL import Image, ImageTk
S = data.DE
class CoinDesigner(tk.Frame):
def __init__(self, screen, coin=None):
super().__... |
#!/usr/bin/env python
import sys
import getopt
import codecs
import os
from lxml import etree
import tempfile
from subprocess import Popen,PIPE
import shutil
import glob
import logging
from convert_penn_to_kaf import convert_penn_to_kaf_with_numtokens
try:
from libs.KafNafParserPy import *
except:
from KafNa... |
"""Tools to generate dummy GTFS feeds."""
import datetime
from math import radians, cos, sin, asin, sqrt
from collections import namedtuple, defaultdict
from o2g.osm.models import Agency
# Represents dummy GTFS data
DummyData = namedtuple('DummyData',
['calendar', 'stop_times', 'trips', 'frequ... |
import random
from flask import render_template, redirect, flash, url_for, request, jsonify
from flask_login import login_user, logout_user, current_user, login_required
from sqlalchemy import desc
from app import app, db, login_manager, forms
from app.models import User, Game, GameMove
from app.decorators import not_i... |
#!/usr/bin/env python3
# This file is Copyright (c) 2019 <NAME> <<EMAIL>>
# This file is Copyright (c) 2019 msloniewski <<EMAIL>>
# This file is Copyright (c) 2019 <NAME> <<EMAIL>>
# License: BSD
import argparse
from migen import *
from litex_boards.platforms import c10lprefkit
from litex.soc.integration.soc_core ... |
#!/usr/bin/env python
# coding: utf-8
"""
plotting.py: This python module contains functions to plot results obtained from the index_calc.py module.
"""
__author__ = "<NAME>"
__email__ = "<EMAIL>, <EMAIL>"
__date__ = "17-03-2022"
__version__ = "1.2"
import numpy as np
import matplotlib.pyplot as plt
import pandas a... |
import warnings
import re
import gzip
import bz2
import lzma
import datetime as dt
import numpy as np
from astropy.time import Time, TimeDelta
def parse_str(input_string, metadata):
"""Parse string input.
Args:
input_string (str): String to parse.
metadata (MetaDataSection): Metadata correspo... |
# Copyright 2015 Twitter, Inc and other contributors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
"""The WaveBlocks Project
Plot the timestep versus the norm for
many different simulation setups. This
scripts compares packet to packet data.
@author: <NAME>
@copyright: Copyright (C) 2010, 2011 <NAME>
@license: Modified BSD License
"""
from numpy import array, diff, log
from scipy.linalg import norm
from matplotli... |
# coding: utf-8
# Google
# -------
# https://developers.google.com/maps/documentation/javascript/maptypes
# https://developers.google.com/maps/documentation/javascript/examples/map-coordinates
#
# Stack overflow
# ----------------
# https://stackoverflow.com/questions/12507274/how-to-get-bounds-of-a-google-static-ma... |
#Imports
from multiprocessing import Process, freeze_support
from PIL import ImageGrab
from pathlib import Path
from numpy import number
from pynput.keyboard import Key, Listener
from cryptography.fernet import Fernet
from scipy.io.wavfile import write
import sounddevice as sd
from requests import get
import getpas... |
import argparse
# import safety_gym
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
import time
from safety_gym.envs.engine import Engine
from PIL import Image
from imageio import imwrite
from envs import GoalEnv
from utils.dataset import *
import o... |
import os
import music21 as m21
def create_midi_file_from_stream(song, directory, file_name):
"""
Creates a midi file in a defined directory
Args:
song (Music21 Stream): the song to be created as .mid
directory (str): desired directory
file_name (str): file name + ext... |
"""
Copyright (c) 2018-present, Facebook, Inc.
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. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
import unittest
from concur... |
"""
data hash pandas / numpy objects
"""
import numpy as np
from pandas import _hash, Series, factorize, Categorical, Index
from pandas.lib import is_bool_array
from pandas.types.generic import ABCIndexClass, ABCSeries, ABCDataFrame
from pandas.types.common import (is_categorical_dtype, is_numeric_dtype,
... |
from flask import g
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField, FormField, TextAreaField, FileField
from wtforms.validators import ValidationError, DataRequired, Email, EqualTo, Length, Regexp, Optional
from models import User, Password, Posts
from wtforms.... |
import os
import click
import logging
import numpy as np
import geopandas as gpd
import xarray as xr
from datetime import datetime, timedelta
def convert_time(date, time):
_format = "%Y-%m-%d %H%M"
datetime_str = datetime.strptime(f"{date} {time}", _format)
return datetime_str
def partition_frp_to_hour(... |
#------------------------------------------------------------------------------
# Copyright (c) 2009 <NAME>
#
# 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, includin... |
# -*- coding: utf-8 -*-
"""``jsonutils`` aims to provide various helpers for working with
JSON. Currently it focuses on providing a reliable and intuitive means
of working with `JSON Lines`_-formatted files.
.. _JSON Lines: http://jsonlines.org/
"""
from __future__ import print_function
import os
import json
DEFA... |
#########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... |
# 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... |
"""
based on "Building powerful image classification models using very little data" blog, FC, Keras author
"""
import logging
# from keras.preprocessing.image import ImageDataGenerator
import matplotlib
matplotlib.use('Agg') # Force matplotlib to not use any Xwindows backend.
import numpy as np
import pandas as pd
fr... |
import logging
from subprocess import check_output
import pytest
import requests
import retrying
from pkgpanda.build import load_json
from test_util.marathon import get_test_app, get_test_app_in_docker
def lb_enabled():
config = load_json('/opt/mesosphere/etc/expanded.config.json')
return config['enable_l... |
import matplotlib
matplotlib.use('Agg')
import numpy as np
import skfuzzy as fuzz
import matplotlib.pyplot as plt
import Adafruit_DHT
import RPi.GPIO as GPIO
import time
print('initialization...')
### initialization GPIO
relay_pin = 26
GPIO.setmode(GPIO.BCM)
GPIO.setup(relay_pin, GPIO.OUT)
sensor = Adafruit_DHT.D... |
#!/usr/bin/env python
"""
Pool a group of mrna normal assays.
* Configuration parameters:
- The ones required by intogen.data.entity.EntityServer
- repositories.assay: The path to the repository where the assay data files are
- repositories.data: (optional) The path to the repository where data files are written. De... |
from __future__ import print_function
import argparse
import torch
import math
import numpy as np
from torch.nn import init
import torch.nn as nn
from PIL import Image
import torch.nn.functional as F
import torch.optim as optim
from torch.nn import init
import random
from torchvision import datasets, transforms
from nu... |
import torch.nn as nn
import torch
##############################
# Discriminator
##############################
class Discriminator(nn.Module):
def __init__(self, in_channels):
super().__init__()
self.layer1 = nn.Sequential(
nn.Conv2d(in_channels * 2, 64, kernel_size=4, stride=... |
# Copyright 2016 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
#!/usr/bin/env python
#
# Copyright (c) 2018 - present. Boling Consulting Solutions (bcsw.net)
#
# 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
# ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
#--------------------------------------------------Base Module--------------------------------------------------#
class DepthwiseSeparableConv(nn.Module):
def __init__(self, input_dim, out_dim, kernel_size, conv_dim=1, padding=0, bias... |
import os
from collections import defaultdict
import stanza
from tqdm import tqdm
from e2e_EL_evaluate.utils.check_xml_anno import check_xml_anno
from e2e_EL_evaluate.utils.gen_anno_from_xml import gen_anno_from_xml
# stanza.version == 1.2
TOKENIZER = stanza.Pipeline(lang='en', processors='tokenize')
"""
# OUTPUT o... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
##############################################
# Institut Villebon, UE 3.1
# Projet : mon_via_navigo
# Auteur : C.Lavrat, <NAME>, <NAME>
# Date de creation : 01/01/16
# Date de derniere modification : 01/01/16
##############################################
#-------------... |
from matplotlib.pyplot import imshow
import numpy as np
import cv2
from keras.layers import Input, Dense, Flatten, Reshape, Conv2D, MaxPooling2D, UpSampling2D
from keras.models import Model
from keras.preprocessing.image import img_to_array
from tensorflow.keras.models import Sequential
from keras.models import model_f... |
"""RunMany settings module. Contains classes and functions for loading and handling the Settings object."""
import json
import pathlib
import platform
from itertools import chain
from typing import Any, Dict, List, Optional, cast
from runmany.util import JsonLike, print_err, set_show_errors
PLATFORMS = {'windows': '... |
import renderapi
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
import json
import numpy as np
import glob
import os
import re
import warnings
import datetime
from em_stitch.utils.utils import src_from_xy
from em_stitch.plots.schemas import LensQuiverSchema
from argschema import Ar... |
import time
from collections import deque
class Reader:
def __init__(self, filename):
self.filename = filename
def transform_grid(self, grid):
new_grid = []
for row in grid:
line = row.replace("0", " ")
line = line.replace("1", "#")
line = line.repl... |
import os, sys, os.path
import re, traceback
import argparse, base64, json
import runpy
def resolve_path(st, sources, path):
path = os.path.split(path)
fname = path[1]
path = path[0]
name = st[0].strip()
if len(name) == 0:
return
if not name.lower().endswith(".js"):
name ... |
# Copyright 2019 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# Copyright 2019 The FastEstimator 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 appl... |
import torch
import torch.nn as nn
import math
class NonlinearMLP(nn.Module):
def __init__(self, in_feature, out_feature, activation=None, bias=True):
super(NonlinearMLP, self).__init__()
if activation is None:
self.activation = lambda x: x
else:
assert callable(ac... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:
'''EfficientNet in PyTorch.
Paper: "EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks".
'''
from easyai.base_name.block_name import NormalizationType, ActivationType
from easyai.base_name.backbone_name import BackboneName
from easyai.model.b... |
import logging
import pathlib
from django.conf import settings as conf_settings
from django.contrib import messages
from django.core.cache import cache
from django.db import connection
from django.http import FileResponse
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.shortcuts imp... |
import importlib
import os
import click
from click.exceptions import Abort
from stable_baselines_model_based_rl.cli.context import CliContext
from stable_baselines_model_based_rl.dynamic_model_trainer.training import \
build_and_train_dynamic_model
from stable_baselines_model_based_rl.sampler import gym_sampler
f... |
import json
import logging
import numpy as np
import argparse
logger = logging.getLogger(__name__)
def count_paragraphs(file_path):
with open(file_path) as dataset_file:
dataset_json = json.load(dataset_file)
dataset = dataset_json['data']
logger.info("Reading and counting examples the da... |
import time
from typing import List, Tuple, Union, Any, Callable, Dict
import numpy as np
from mushroom_rl.algorithms.value import QLearning
from mushroom_rl.core import Core, Environment, Agent
from mushroom_rl.policy import EpsGreedy
from mushroom_rl.utils.dataset import compute_J
from mushroom_rl.utils.parameters i... |
import logging
import urllib
import base64
from google.appengine.api import urlfetch
import webapp2
from google.appengine.ext.webapp import util
import json as simplejson
from model import get_current_youtify_user_model
from activities import create_flattr_activity
try:
import config
except ImportError:
import ... |
import json
import torch
from torch.utils.data import DataLoader
import random
import os
import argparse
import time
from pathlib import Path
import sys
# Import models
path = os.path.dirname(os.path.abspath(__file__))
path = Path(path)
src_path = path.parent
print("Add models path to sys paths - ", src_path)
sys.path... |
from __future__ import absolute_import
import re
from ansible.errors import AnsibleFilterError
class DbUtils:
'''
Utility methods for database connection configuration.
- convert JDBC connection strings to Perl DBI for Oracle and
Postgres
'''
def jdbc2oracleDbi(self, jdbc):
if re.match(r'.... |
import aiocontextvars
from confr.utils import import_python_object
class Conf:
def __init__(
self,
conf_dicts,
overrides=None,
strict=False,
verbose=True,
):
self.c_singletons = {}
self.c_original = {}
self.overrides_dicts = aiocontextvars.... |
from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404
from django.shortcuts import render_to_response
from formtools.wizard.views import SessionWizardView
from boh.models import Person, EngagementRequest, EngagementRequestSubscription
from . import forms, models
def show_person_form... |
import time
import pickle
import os
import numpy as np
import utils
import wrapper
from stable_baselines3 import PPO
from stable_baselines3.common.vec_env import DummyVecEnv, SubprocVecEnv, VecEnv, VecNormalize, util
def fname(train):
if isinstance(train, list):
fname = '-'.join(str(x) for x in train)
... |
# /usr/bin/env python3
# -*- coding: utf-8 -*-
import urllib.request
import urllib.parse
import json
import re
# 爬取代理ip
def get_ip_address():
url = 'http://31f.cn/'
head = {}
head[
'User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.... |
import argparse
import glob
import os
import re
import shutil
import tempfile
from docker import Client
from parser import Parser
image = "cvm-dockerhub02.cern.ch:5000/slc6"
tag = "cvmfs"
tmpdir = tempfile.mkdtemp(prefix="comparison.", dir="/tmp")
class GitRepository:
def __init__(self, url, branch, name):
... |
#!/software/anaconda3.6/bin/python
from EBLSST import LSSTEBworker, BreivikGalaxy
import multiprocessing, logging
import csv
import argparse
import numpy as np
def define_args(parser):
parser.add_argument("-n", "--n_cores", type=int, help="Number of cores [0]")
parser.add_argument("-c", "--n_bin", type=int, he... |
import os
import random
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
import torchvision
from tqdm.auto import tqdm
save_dir = "./results"
class TrackLosses(object):
def __init__(self, name):
self.reset()
self.name = name
def update(self, x):
se... |
import os
import sys
from dataclasses import dataclass
from pathlib import Path
import pygame
import pygame_gui
from .asset_loader import FontAssetConfig, FontAssetLoader, ImageAssetConfig, ImageAssetLoader
from .mode import CHANGE_MODE_EVENT, GameMode, Mode, MainMenuMode
from .utils import draw_text
@dataclass
clas... |
from __future__ import absolute_import, unicode_literals
from django.test import TestCase
from django.utils.unittest import skipIf
from django_pg import models
from django_pg.models.fields.uuid import UUIDAdapter, UUIDField
from django.test.utils import override_settings
from django_pg.utils.south import south_installe... |
# media_bundler/templatetags/bundler_tags.py
"""
Template tags for the django media bundler.
"""
from django import template
from django.template import Variable
from media_bundler import bundler
from media_bundler.conf import bundler_settings
register = template.Library()
def context_set_default(context, key, de... |
#!/usr/bin/env python
#####################################################################################################################################################################
# xView2 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.