text stringlengths 3.07k 22.1k |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
"""
(c) 2018 <NAME>
Python Job Manager Server API
:author: <NAME>
"""
from flask import Flask, request, Response, render_template, url_for, redirect, flash, jsonify
from werkzeug.utils import secure_filename
from functools import wraps
impor... |
import abc
from . import hamiltonian_dynamics_context
import numpy as np
import sympy as sp
import vorpy.symbolic
class Base(hamiltonian_dynamics_context.HamiltonianDynamicsContext):
@classmethod
def configuration_space_dimension (cls):
return 3
@classmethod
def K (cls, qp):
# If qp is... |
# primitive collision detection helper
import math
import numpy as np
import basis.data_adapter as da
from panda3d.core import NodePath, CollisionNode, CollisionTraverser, CollisionHandlerQueue, BitMask32
from panda3d.core import CollisionBox, CollisionSphere, CollisionPolygon, GeomVertexReader
def gen_box_cdnp(pdnp,... |
# -*- coding: utf-8 -*-
import datetime
from copy import deepcopy
import pytest
from mock import Mock
from six import add_metaclass
from bravado_core.content_type import APP_JSON
from bravado_core.model import Model
from bravado_core.model import ModelMeta
from bravado_core.response import IncomingResponse
from brava... |
try:
from Tkinter import Tk, Canvas, Toplevel, LAST
#import TKinter as tk
except ModuleNotFoundError:
from tkinter import Tk, Canvas, Toplevel, LAST
#import tkinter as tk
import numpy as np
from collections import namedtuple
from ..utils import get_pairs, get_delta, INF
Box = namedtuple('Box', ['low... |
# -*- coding: utf-8 -*-
#
# oxml.py
#
# Copyright (C) 2012, 2013 <NAME> <EMAIL>
#
# This module is part of python-pptx and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
Classes that directly manipulate Open XML and provide direct object-oriented
access to the XML elements.... |
"""
Alignment of sequences
"""
from Bio import SeqIO, pairwise2
from Bio.Seq import reverse_complement
import edlib
from interval import interval
import numpy as np
import sys
# increase the max number of alignments that pairwise2 will return (default is 1000, which is insufficient when alignment is complex)
pairwise... |
import json
from decimal import Decimal
from django.dispatch import receiver
from django.utils import formats
from django.utils.translation import ugettext_lazy as _
from i18nfield.strings import LazyI18nString
from pretix.base.models import Event, ItemVariation, LogEntry
from pretix.base.signals import logentry_disp... |
# 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 use ... |
"""
CPOL Level 1b update products.
@title: update_cpol1b
@author: <NAME> <<EMAIL>>
@copyright: <NAME> (2017-)
@institution: Bureau of Meteorology and Monash University
"""
import os
import glob
import copy
import uuid
import argparse
import datetime
import warnings
import traceback
import pyart
import cftime
import n... |
# -*- coding: utf-8 -*-
# login.py
# part of logintools
# A CGI Authentication and user account system
# Copyright (C) 2004/2005 <NAME>
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# Released subject to the BSD License
# Please see http://www.voidspace.org.uk/documents/BSD-LICENSE.txt
# Scripts maintained at http:/... |
from __future__ import print_function
from cloudmesh_client.shell.command import command, PluginCommand, CloudPluginCommand
from cloudmesh_client.shell.console import Console
from cloudmesh_client.common.dotdict import dotdict
from cloudmesh_client.default import Default
from pprint import pprint
from cloudmesh_client.... |
#########
from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件
import network # Wi-Fi功能所在库
import ujson
##################
from driver import I2C,GPIO,TIMER
import utime
from ssd1306 import SSD1306_I2C
import ir
import time
temptimerObj = 0
time_dict = {}
#########
# 物联网平台连接标志位
iot_connected = Fa... |
#!/usr/bin/env python3
#from PyQt5.QtCore import QThread
#from PyQt5.QtWidgets import QApplication, QLabel, QWidget, QPushButton, QVBoxself.layout. QMessageBox
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import serial
import time
BG_COLOR = '#555555'
FG_COLOR = '#FFFFFF'
MENU_B... |
import os
import cv2
import numpy as np
import torch
import torchvision
torch.set_printoptions(linewidth=320, precision=5, profile="long")
np.set_printoptions(
linewidth=320, formatter={"float_kind": "{:11.5g}".format}
) # format short g, %precision=5
cv2.setNumThreads(0) # prevent OpenCV from multithreading (i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
-----------------------------------------------------------------------------
Copyright (C) 2006-2017 University of Dundee. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public Lice... |
# Author: <NAME>
# E-mail: <EMAIL>
# Created: May 07, 2020
# Updated: Jul 22, 2021
"""Predicting allele-specific expression by integrating RNA-seq read counts
and haplotypes.
Note:
The package is an allele-specific expression analysis tool using the output
from ASEReadCounter.
"""
import pdb
import argparse
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from envs.config import Config
from torchvision import models
class VGG16(nn.Module):
def __init__(self, num_classes, is_flow=False, input_size=224, pretrained=True):
super(VGG16, self).__init__()
self.features =... |
import collections
import logging
import queue
import random
log = logging.getLogger(__name__)
log.info("Interchange task dispatch started")
def naive_interchange_task_dispatch(
interesting_managers,
pending_task_queue,
ready_manager_queue,
scheduler_mode="hard",
cold_routing=False,
):
"""
... |
import os
import io
import base64
#TODO: select version by param
from azure.datalake.storage.v2018_11_09_poc import DataLakeStorageClient
from azure.datalake.storage.v2018_11_09_poc import VERSION
from msrestazure.azure_active_directory import AADTokenCredentials
from azure.identity import ClientSecretCredential, Man... |
import copy
import pytest
import sys
import numpy as np
from opentrons.config import (CONFIG,
robot_configs,
advanced_settings as advs)
from opentrons.deck_calibration import dc_main
from opentrons.deck_calibration.dc_main import get_calibration_points
from o... |
"""Utility functions for implementing and testing out ALO for c-lasso.
"""
import numpy as np
import scipy.linalg
def solve_cls(X, y, C):
"""Solve the constrained least-squares problem.
This currently uses a very naive method based on explicit inversion.
A better method would use a Cholesky decompositio... |
# -*- coding: utf-8 -*-
"""
UC#02: Main critics
Extract the main critics from the customers (top negative opinions)
"""
import pandas as pd
import requests, json, re, sys
import numpy as np
from wordcloud import WordCloud # pip3 install wordcloud
import matplotlib.pyplot as plt
from matplotlib import colors
class Di... |
# -*- coding: utf-8 -*-
import common_setup
from kivy.app import runTouchApp
from kivy.lang import Builder
from kivy.uix.widget import Widget
from kivy.properties import (
NumericProperty, ListProperty, ReferenceListProperty, ObjectProperty,
)
Builder.load_string('''
<TrafficLight>:
_light_offset_x: self.sp... |
#!/usr/bin/env python
#
# Author: <NAME>
# License: BSD 2-clause
# Last Change: Wed Oct 06, 2021 at 03:31 PM +0200
from datetime import datetime
from re import match, sub, search
from glob import glob
from pathlib import Path
from os.path import basename
from sys import exit as sys_exit
##################
# Files ... |
#!/usr/bin/env python
import os.path as op
import sys
import logging
from argparse import ArgumentParser
from cPickle import load, dump
from pbcore.io.FastaIO import FastaReader, FastaWriter
from pbtranscript.ice.ProbModel import ProbFromModel, ProbFromFastq
import pbtranscript.ice.IceIterative as ice
from pbtranscript... |
#!/usr/bin/env python
# coding: utf-8
import os
import sys
import re
import copy
import json
import mock
import importlib
import pytest
import hubblestack.syspaths
import hubblestack.config
import hubblestack.daemon
import logging
log = logging.getLogger(__name__)
def intentionally_changed_value_filter(key_name, val... |
# waifu2x
import sys
import os
from os import path
import math
import torch
import argparse
import csv
from torchvision.transforms import functional as TF
from .. transforms import functional as NF
from .. logger import logger
from .. utils import ImageLoader
from tqdm import tqdm
import time
def load_files(txt):
... |
"""Contains an implementation of genetic programming for symbolic regression.
Author: <NAME>
Author: <NAME>
"""
import numpy as np
from ._program import _Program
from .fitness import mean_squared_error, _Fitness
from .functions import add, subtract, multiply, divide, _Function
class SymbolicRegressor:
"""A clas... |
import warnings
warnings.simplefilter(action="ignore", category=FutureWarning)
import osmnx as ox
import pandas as pd
import numpy as np
import geopandas as gpd
import networkx as nx
import math
from math import sqrt
import ast
import functools
from shapely.geometry import Point, LineString
pd.set_option("display.pre... |
import importlib
import logging
import os
import sys
from sys import modules as sys_modules
import django
from ufs_tools import get_folder
from ufs_tools.tuple_tools import remove_duplicated_keep_order
log = logging.getLogger(__name__)
# class SettingStorageInf(object):
# pass
class BaseSettingsHolder(object)... |
import pandas as pd
import numpy as np
import math
from os import listdir, walk, makedirs, environ
from os.path import isfile, join, exists, basename, isdir
import re
import logging
import data_patterns
import click
import sys
import datetime
DECIMALS = 0
RULES_PATH = join('solvency2-rules')
INSTANCES_DATA_PATH = join... |
import os, uuid, csv
import config_reader
from pathlib import Path
from psycopg2.extras import execute_values, register_default_json, register_default_jsonb
from subset_utils import columns_joined, columns_tupled, schema_name, table_name, fully_qualified_table, redact_relationships, quoter
register_default_json(loads=... |
"""Script to generate symbolic dynamics of 3D Double Ball Balancer
Derivation of the rigid multi-body dynamics using the Projected Newton-Euler method.
"""
import argparse
import pickle
from sympy import symbols, Matrix, simplify, solve, diff, eye, diag, zeros, cse, pi, exp, Max
from sympy.matrices.dense import rot_a... |
from torch.utils.data import Dataset, DataLoader
import cv2, glob, torch, os, random
import numpy as np
import torchvision.transforms as transforms
import scipy.io as sio
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
def worker_init(w... |
# encoding: UTF-8
"""
# Functions for rules engine
#
# Copyright (c) 2015, Translation Exchange, Inc.
# 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 ... |
"""
Testing TNDS population.
"""
import datetime
from importlib.resources import open_binary
import os
import lxml.etree as et
import pytest
from nextbus import db, models
from nextbus.populate.utils import (
collect_xml_data, populate_database, xslt_func, xslt_transform
)
from nextbus.populate.tnds import (
... |
# 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 app... |
# file: caching.py
# Full article: http://docs.sqlalchemy.org/en/latest/_modules/examples/dogpile_caching/caching_query.html
import functools
import hashlib
from sqlalchemy.orm.query import Query
from sqlalchemy import event
from sqlalchemy.orm.interfaces import MapperOption
from sqlalchemy.orm.attributes im... |
import pickle
import pandas
import numpy
import random
from sklearn.preprocessing import StandardScaler
class DotDict():
pass
class Diabetes:
def __init__(self, patient):
self.df = pandas.DataFrame(columns=['Pregnancies_1', 'Pregnancies_2', 'Pregnancies_3', 'Pregnancies_4',
... |
from __future__ import print_function
import subprocess, os
import shlex,time
if os.path.isfile("/usr/bin/openssl"):
OPENSSL="/usr/bin/openssl"
else:
OPENSSL="/usr/local/ssl/bin/openssl"
PRINTF="/usr/bin/printf"
MKDIR="/bin/mkdir"
TOUCH="/bin/touch"
RM="/bin/rm"
CP="/bin/cp"
ECHO="/bin/echo"
CAT="/bin/cat"
CH... |
import numpy as np
from scipy import sparse
import scipy.linalg as la
from cortex.polyutils import Surface
from scipy.sparse.linalg import LinearOperator
import scipy.sparse.linalg as sparsela
from thr import THR, THR_ROWS
from base import SymMatrixApprox, MeshKLazy
from sampling import RandomSampling, FarthestSamplin... |
import json
import logging
import time
from threading import Event, Thread
from queue import Queue
from concurrent.futures import Future, wait, FIRST_COMPLETED, ALL_COMPLETED
# NOTE: The following block is needed only when sphinx is parsing this file
# in order to generate the documentation. It's not really use... |
#!/usr/bin/env python
# Initial Date: December 2019
# Author: <NAME>
# Copyright (c) <NAME>, Arizona Board of Regents
# All rights reserved.
import rospy
import sys, getopt
import numpy as np
import glob
import os
from geometry_msgs.msg import Twist, Pose, Point, Vector3
from std_msgs.msg import Float64
from nav_msgs... |
import os
import time
import random
import ast
import json
import argparse
import numpy as np
import tensorflow as tf
from style_enc_model import Style_Enc_Model
from data import CHN_Style_DataLoader
from model_utils import save_model, reset_graph
NPZ_DIR = "../WriteLikeYouData/npz_relative_dist/CASIA_rdp4.0"
assert... |
from functools import partial
from warnings import warn
import numpy as np
from kernelmethods import config as cfg
from kernelmethods.base import BaseKernelFunction, KernelMatrix, KernelSet
from kernelmethods.config import KernelMethodsException, KernelMethodsWarning
from kernelmethods.numeric_kernels import (Gaussian... |
import os
import time
import requests
import json
import random
import socket
import struct
import sys
class User(object):
userId = None
userName = None
videoCount = None
roomId = None
def __init__(self, userId, secUid, userName, videoCount, roomId):
self.userId = userId
self.secUid = secU... |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... |
import os, contextlib, subprocess, logging, time, sys
from datetime import datetime as DateTime
from craftrun.screen import ScreenSession
@contextlib.contextmanager
def in_dir(path):
restore_to = os.getcwd()
try:
logging.info("chdir {0!r}".format(path))
os.chdir(path)
yield
finally:... |
#!/usr/bin/env python
"""
:Author: Ji Research Group/Stanford Genome Technology Center
:Contact: <EMAIL>
:Creation date: 02/10/2020
:Description:
This script counts exons for a given gene, in each long-read transcript.
Revisions:
5/19/2020: Modify for situation where exons to compare do not start at 1
8/24/2020:... |
import os
import base64
import traceback
from flask import render_template
from flask import redirect
from flask import url_for
from flask import request
from flask import session
from magic import Magic
from app import app
from app.sandi.demo import SandiWorkflow
@app.before_first_request
def initServer():
"... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
def get_children(module):
child = list(module.children())
if len(child) == 0:
return [module]
children = []
for ch in child:
grand_ch = get_children(ch)
children+=grand_ch
return children
... |
from requests_html import HTML
from Class.base import Base
import json, time, sys, os, re
import tldextract, requests
tags = ['datacenters','data-centers','datacenter','looking-glass','looking','lg','speedtest','icmp','ping']
lookingRegex = re.compile("([\w\d.-]+)?(lg|looking)([\w\d-]+)?(\.[\w\d-]+)(\.[\w\d.]+)")
ipRe... |
import numpy as np
import keras
from sklearn import metrics
from mlxtend.evaluate import confusion_matrix
from sklearn.metrics import roc_auc_score, precision_recall_curve, auc
# one is agitation and zero is not-agitation
# here positive is agitation and negative is not-agitation
def decision(y_pred, thresh=0.5):
... |
import numpy as np
import torch
from torch.utils.data import Dataset
import os
import pandas as pd
import urllib.request
import shutil
import ssl
import bz2
from ftplib import FTP
import gzip
import scipy
import scipy.io
class BinaryDataset(Dataset):
urls = {
'titanic': 'ftp://ftp.cs.toronto.edu/pub/neuron... |
"""
Code that handle spark configuration
"""
import datetime
import os
import shutil
import time
from subprocess import call
from typing import List
import azure.batch.models as batchmodels
from aztk.node_scripts.core import config
from aztk.node_scripts.install import pick_master
batch_client = config.batch_cli... |
#!/usr/bin/env python
#
import os
import time
import numpy as np
import pandas as pd
import argparse
from joblib import Parallel, delayed
class FoldX:
def __init__(self, exe=""):
if exe:
self.exe = exe
else:
self.exe = os.popen("which foldx").read().replace("\n", "")
... |
skip_training = False
import time
import numpy as np
import matplotlib.pyplot as plt
import torch
import torchvision
import torchvision.transforms as transforms
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision.utils as utils
data_dir = "."
if torch.cuda.is_availa... |
# -*- coding: utf-8 -*-
import os
import os.path
import re
import sys
import string
from django.apps.registry import apps
from django.core.management.base import BaseCommand, CommandError
from python_translate.extractors import base as extractors
from python_translate import operations
from python_translate.translat... |
from collections import namedtuple
import datetime
import math
import os
import sys
from typing import Any, Dict, List
from github.InputFileContent import InputFileContent
import requests
from github import Github
TOP_LANGUAGES_COUNT = 10
WIDTH_JUSTIFICATION_SEPARATOR = ":"
RECENT_STATS_SEPARATOR = " + "
TOTAL_XP_TIT... |
# Copyright 2017 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... |
__author__ = "<NAME>"
__copyright__ = "Copyright 2017, <NAME>"
__email__ = "<EMAIL>"
__license__ = "MIT"
import contextlib
import datetime
from itertools import chain
import os
import sys
import time
import threading
from snakemake.exceptions import WorkflowError
try:
import psutil
except ImportError:
raise ... |
#!/usr/bin/env python3
import xxhash
import os
from flask import Flask, redirect
from flask import request
from flask import jsonify
#print(xxhash.xxh64('xxhash').hexdigest())
#print(xxhash.xxh64('xxhash', seed=20141025).hexdigest())
app = Flask(__name__)
key = "default"
split = 4
numMaxT = 10000000
version = "1.0"
... |
from eth2spec.phase0 import spec as spec_phase0
from eth2spec.phase1 import spec as spec_phase1
from eth2spec.utils import bls
from .helpers.genesis import create_genesis_state
from .utils import vector_test, with_meta_tags
from random import Random
from typing import Any, Callable, NewType, Sequence, TypedDict, Pro... |
import autograd.numpy as anp
from autograd.tracer import getval
from abc import abstractmethod
from ..constants import INITIAL_COVARIANCE_SCALE, INITIAL_INVERSE_BANDWIDTHS, \
DEFAULT_ENCODING, INVERSE_BANDWIDTHS_LOWER_BOUND, \
INVERSE_BANDWIDTHS_UPPER_BOUND, COVARIANCE_SCALE_LOWER_BOUND, \
COVARIANCE_SCALE... |
import numpy as np
import pytest
from is_integer_ufunc import is_integer
def get_dtypes(label, bits):
return [getattr(np, name) for n in bits if hasattr(np, name := f'{label}{n}')]
float_dtypes = get_dtypes('float', [16, 32, 64, 80, 96, 128, 256])
cplx_dtypes = get_dtypes('complex', [64, 128, 160, 192, 256, 512... |
# Copyright 2020 Cortex Labs, 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... |
import logging
import os
import posixpath
import sys
from androidemu.config import WRITE_FSTAT_TIMES
from androidemu.cpu.syscall_handlers import SyscallHandlers
from androidemu.utils import memory_helpers
from androidemu.vfs import file_helpers
logger = logging.getLogger(__name__)
from androidemu.java.helpers.native_... |
import os, copy, json, datetime, math
import numpy as np
import collections.abc
def _get_base_schedule():
return {'type':'CONST', 'start':0.0,
'min':float('-inf'), 'max':float('inf'), 'step':0, 'offset':0,
'base':2.0, 'scale':1.0}
def setup_constant_schedule(*, start, **kwargs):
d = _get_base_schedule... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import tensorflow.contrib.slim as slim
import tensorflow as tf
from libs.networks.mobilenet import mobilenet_v2
from libs.networks.mobilenet.mobilenet import training_scope
from libs.networks.mobilenet.mobilenet_v2 import op
from... |
"""Converters are responsible from translating types between Python and C#"""
import datetime as dt
import logging
from clr import System, GetClrType
from . import datatypes, utils
logger = logging.getLogger(__name__)
class ValueConverter(object):
"""
Handle conversions between C# values and Python values... |
from __future__ import absolute_import
from django.contrib import messages
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse, reverse_lazy
from django.db.models import Q
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_... |
#!/usr/bin/env python
# coding: utf-8 -*-
# pylint: disable=bare-except
#
# GNU General Public License v3.0+
#
# Copyright 2019 Arista Networks AS-EMEA
#
# 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 Li... |
# -*- coding: utf-8 -*-
"""
.. codeauthor:: <NAME> <<EMAIL>
"""
import argparse as ap
from collections import OrderedDict
import json
import os
import shutil
import numpy as np
from PIL import Image
from tqdm import tqdm
import cv2
from cityscapes import CityscapesBase
RGB_DIR = 'leftImg8bit'
PARAMETERS_RAW_DIR = '... |
import matplotlib.pyplot as plt
import torch
import numpy as np
from torch import nn
from torch import optim
import torch.nn.functional as F
from torchvision import datasets, transforms, models
from collections import OrderedDict
import PIL
from PIL import Image
import torchvision.models as models
from torch import t... |
### This script combines position data from multiple cameras.
### It also corrects frame time offset errors in PosLog.csv files
### It also removes bad position data lines
### Use as follows:
### import CombineTrackingData as combPos
### combPos.combdata(Path-To-Recording-Folder)
### By <NAME>, May 2017, UCL
from it... |
# *****************************************************************************
# Copyright (c) 2018, NVIDIA CORPORATION. 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... |
"""
This module contains a list of predefined commonly used constant unitaries, and functions for generating commonly used unitaries.
Attributes:
cnot : Constant `CNOT` unitary
sqrt_cnot : Constant square root of `CNOT` unitary
swap : Constant 2 qubit swap unitary
toffoli : Constant toffoli unitary
... |
# -*- coding: utf-8 -*-
"""
Unfortunate Maps Catalogue Webscraper - Webscraping Functions.
@author: iamflowting
@created-on: 24/12/20
@last-updated: 07/01/21
"""
import requests
from bs4 import BeautifulSoup
import json
from PIL import Image
# %% HTML Web Scraper
def umc_web_scraper(map_id):
"""Get static cop... |
#!/usr/local/bin/python
'''
Analysis of coverage and insert size for a single genomic interval
BEGIN COPYRIGHT NOTICE
insertSizeAnalysisSingle code -- (c) 2017 <NAME> -- ICR -- www.icr.ac.uk
Copyright 2017 <NAME> Licensed under the
Educational Community License, Version 2.0 (the "License"); you... |
#!/usr/bin/env python3
"""import raster by year"""
import sys
import os
from urllib.parse import urlparse
import glob
import subprocess
import argparse
from functools import reduce
# finn preproc codes
sys.path = sys.path + ['../code_anaconda']
import downloader
import rst_import
import polygon_import
from af_import... |
"""Utility functions used by various web helpers.
This module contains support functions used by other helpers, and functions for
URL manipulation. Most of these helpers predate the 0.6 reorganization; they
would have been put in other subpackages if they have been created later.
"""
import cgi
import copy
import sys
... |
import torch
import torch.nn as nn
import numpy as np
from collections import OrderedDict
from deeplodocus.flags import DEEP_MODULE_MODELS
from deeplodocus.utils.generic_utils import get_module
from deeplodocus.utils.notification import Notification
from deeplodocus.flags import DEEP_MSG_MODEL_CHECK_CHANNELS
from dee... |
'''Makes the ChestX-ray14 dataset more usable by augmenting it.
- Separate the diseases into indicator (true/false) columns
- Bin the ages into MeSH age groups
- Mark images as either training or test
See more details about the dataset in the data folder.
'''
import pandas as pd
import os
# To read from the local di... |
# ------------------------------------------------------------------------------
# MIT License
#
# Copyright (c) 2019-2021 ThatRedKite
#
# 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 with... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from common.Utilities import error_exit
from ast import ASTGenerator
import Generator
import Extractor
import Emitter
import Logger
import Oracle
import Solver
def map_variable(var_map_a, var_map_b):
Logger.trace(__name__ + ":" + sys._getframe().f_code.... |
import argparse
import imageio
import numpy as np
import os
import subprocess
import scipy.io.wavfile
import speechpy
from tqdm import tqdm
def cost(a, b):
# Euclidean distance
return np.linalg.norm(a - b)
def fix_numbers(y_to_x):
new_y_to_x = np.array(y_to_x).astype(float)
start_idx = -1
for i... |
from collections import OrderedDict
import torch
import torch.nn as nn
import numpy as np
import logging
import colorama
from typing import Union, Optional
import os
import copy
LOG_COLORS = {
logging.ERROR: colorama.Fore.RED,
logging.WARNING: colorama.Fore.YELLOW,
logging.INFO: colorama.Fore.GREEN,
l... |
#!/usr/bin/python
import io
import cgi
import sys
import urllib
import requests
try:
import SocketServer
import SimpleHTTPServer
except:
import socketserver as SocketServer
import http.server as SimpleHTTPServer
sys.path.append("hlss_core")
import hlss_core.hlss_manager
sys.path.append("assets")
import assets.req... |
#!/usr/bin/env python
# coding:utf-8
"""
This module is a collection of utility functions used mainly by the rest_route
module and which are placed here to keep the rest_route module as clean as
possible.
"""
# -- Standard lib ------------------------------------------------------------
import configparser
import ht... |
from self_py_fun.CNNMultiDataloader import *
from self_py_fun.CNNMultiTrain import *
from self_py_fun.CNNMultiModel import *
from self_py_fun.ExistMLFun import *
import self_py_fun.GlobalEEG as gc
sns.set_context('notebook')
# ----------------------------------------------
if gc.local_use:
DATA_DIC = '/Users/niubi... |
import nextcord
from nextcord.ext import commands
import uuid
from ..tools.Embeds import embeds
import os
import asyncio
from ..tools.Athena import Athena
class Dropdown(nextcord.ui.Select):
"""
Creates UI for folder selection
"""
def __init__(self, roles):
options = [
... |
import tensorflow as tf
from vgg19 import vgg_19
class SRGanGenerator:
"""SRGAN Generator Model from Ledig et. al. 2017
Reference: https://arxiv.org/pdf/1609.04802.pdf
"""
def __init__(self, discriminator, training, content_loss='mse', use_gan=True, learning_rate=1e-4, num_blocks=16, num_upsamples=2):
s... |
"""Embedding utils."""
from typing import Any, Callable, Dict, Optional
import flax.linen as nn
import jax
from jax.nn import initializers
import jax.numpy as jnp
from scenic.projects.layout_denoise.layers import common
class TokenEmbedding(nn.Module):
"""Creates learned embeddings for text.
Attributes:
hid... |
import configparser
from pathlib import Path
from typing import (
Dict,
Mapping,
NamedTuple,
NewType,
Optional,
Sequence,
Tuple,
TypeVar,
)
import afancontrol.filters
from afancontrol.arduino import ArduinoConnection, ArduinoName
from afancontrol.configparser import ConfigParserSection,... |
"""Common Shell Utilities."""
import os
import sys
from subprocess import Popen, PIPE
from multiprocessing import Process
from threading import Thread
from ..core.meta import MetaMixin
from ..core.exc import FrameworkError
def exec_cmd(cmd_args, *args, **kw):
"""
Execute a shell call using Subprocess. All a... |
#!/usr/bin/env python
"""
@file cutRoutes.py
@author <NAME>
@author <NAME>
@author <NAME>
@date 2017-04-11
@version $Id$
Cut down routes from a large scenario to a sub-scenario optionally using exitTimes
Output can be a route file or a tripfile.
SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
Cop... |
import itertools
from dsl import Dsl
class StringDsl(Dsl):
def __init__(self, supportExtraConstants=False, fewOps=False, progs=[]):
# note: because we don't support overloading, we name
# SubstituteI instead of overloading Substitute, and
# FindI instead of overloading Find`
FewOp... |
import os
from zipfile import ZipFile
from time import strftime
import logging
from pathlib import Path
from bs4 import BeautifulSoup
import jsonpickle
from triple_agent.reports.external_reports.player_reports.action_tests import (
player_at_reports,
)
from triple_agent.reports.external_reports.player_reports.spy... |
import uuid
from datetime import timedelta
from decimal import Decimal
from django.db import models
from django.db.models import Sum
from django.utils import timezone
from django.urls import reverse
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from django.db import transaction... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.