text stringlengths 3.07k 12.6k |
|---|
import ia256utilities.filesystem as fs
import arisulolstats.constants as constants
import arisulolstats.lolstats.data as data
class Processing:
def __init__(self, db, profile, summoners):
data = {}
data["summonerTab"] = generate_summoner_tab(db, profile, summoners)
data["matchesTab"] = ge... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Eny command"""
from __future__ import print_function
import argparse
import glob
import collections
import sys
import re
import serial
import threading
__version__ = '0.5.0'
Eny = collections.namedtuple('Eny', 'id cumulated')
RESULT_CODE = {
'00': 'Success',
... |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 21 20:31:09 2018
Algoritmo en python del ejercicio creado en:
A Novel Numerical Approach to the MCLP Based Resilent Supply Chain Optimization
<NAME>, <NAME>, <NAME>, <NAME>
5. Application to the optimal design of a resilent supply chain management
system
@autho... |
# 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
# distributed under the... |
from burpexportreplay import burpexport, multiprocessor
import socket, ssl, time
import re, base64
import multiprocessing
def resendItems(items, threads=1, host = False, port = False, proxy_host = False, proxy_port = False):
jobs = []
for item in items:
args = {"item": item, "host": host, "port": port,... |
"""
@author: <NAME> <<EMAIL>>
"""
import torch
import torch.nn as nn
from torchvision.models.resnet import resnet50
# from torchvision.models.mobilenet import mobilenet_v2, InvertedResidual
from torchvision.models.mobilenet import mobilenet_v2
class Base(nn.Module):
def __init__(self):
super().__init__()
... |
from detectron2.evaluation import COCOEvaluator, inference_on_dataset,print_csv_format
import os.path
import json
import cv2
import numpy as np
from detectron2 import model_zoo
from detectron2.engine import DefaultPredictor
from detectron2.config import get_cfg
from detectron2.utils.visualizer import Visualizer
from de... |
#!/usr/bin/env python3
#******************************************************************************
# (C) 2018, <NAME>, Austria *
# *
# The Space Python Library is free software; you can redistribut... |
"""Visualize per-timestep accuracy.
Author: <NAME> (<EMAIL>)
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
import os
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import pandas as pd
import seaborn as ... |
"""Caching decorator, took as is from pylons"""
import tg, inspect, time
from tg.support.converters import asbool
from tg.support import NoDefault, EmptyContext
from tg._compat import im_func, im_class
from functools import wraps
class cached_property(object):
"""
Works like python @property but the decorated ... |
from __future__ import absolute_import, division, print_function
import pytest
pymysql = pytest.importorskip('pymysql')
import subprocess
ps = subprocess.Popen("ps aux | grep '[m]ysql'",shell=True, stdout=subprocess.PIPE)
output = ps.stdout.read()
num_processes = len(output.splitlines())
pytestmark = pytest.mark.skip... |
import json
import logging
import os
from arranger.conf import ArrangeMode, DuplicateAction
from arranger.duplicate_handler import duplicate_droper, duplicate_mover, duplicate_skiper, duplicate_handle_counter
from arranger.file_op import FileCopier, FileMover
from analysor.others import SkipAnalysor
from analysor.anal... |
#!/usr/bin/env python3
import argparse
import json
from pathlib import Path
import logging
from logging import config
import yaml
import cv2
from pydicom.dataset import Dataset, FileDataset
from constants import DicomConstants, JsonConstants, PngConstants
DEFAULT_OUTPUT_DIR = Path(__file__).parent / Path("output")
#... |
#!user/bin/env python
# -*- coding:utf-8 -*-
from dataset import vocab_num, my_collate
from dataset_val import KgDatasetVal
from dataset import KgDataset
import torch
import argparse
from torch.utils.data import DataLoader
import torch.optim as optim
import torch.nn as nn
import os
import random
import torc... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import sublime, sublime_plugin
import platform
import glob as globmodule
import os, sys, subprocess, codecs, webbrowser,... |
"""Splitgraph mount handler for Socrata datasets"""
import json
import logging
from copy import deepcopy
from typing import Optional, Dict, List
from psycopg2.sql import SQL, Identifier
from splitgraph.core.types import TableInfo, MountError
from splitgraph.exceptions import RepositoryNotFoundError
from splitgraph.ho... |
import numpy as np
from abc import ABC, abstractmethod, abstractproperty
from subclass_register import SubclassRegister
from sklearn.utils import check_random_state
time_factor_register = SubclassRegister('time component')
@time_factor_register.link_base
class BaseTimeComponent(ABC):
@abstractmethod
def ini... |
#!/usr/env/bin python3
from argparse import ArgumentParser
import ast
import json
import os
import shutil
import subprocess
import sys
import pandas as pd
from janus.kaggle.utils import CollectImports
def has_kaggle_cli():
ret = subprocess.call(["kaggle", "--help"], stdout=subprocess.DEVNULL)
return ret == ... |
# main.py
#
# MIT License
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy... |
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 21 21:30:06 2019
@author: Jenkins
"""
import os
import time
import numpy as np
import pandas as pd
import multiprocessing as mp
#from ts_lda import ts_lda
from ord_ts_lda import ts_lda
from openpyxl import Workbook
def ord_doc_word(data):
doc_... |
import collections
import chainer
import numpy as np
import onnx
from typing import List, Mapping
from chainer_compiler.ch2o import env
from chainer_compiler.ch2o import utils
def _is_float_value(v):
# The latter is for numpy-like things.
return isinstance(v, float) or int(v) != v
class Value(object):
... |
import collections
import dataclasses
import functools
import heapq
import itertools
import operator
from typing import ( # noqa
Callable, Dict, FrozenSet, Iterator, List, Optional, Set, Tuple)
from haversine import haversine
from . import iteration
from . import places
from .log import log
Cost = float
Place... |
# coding: utf-8
#
# Copyright 2020 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 requi... |
from relogic.logickit.dataflow import DataFlow, Example, Feature, MiniBatch
from typing import List, Dict, Tuple
import torch
from relogic.logickit.utils import create_tensor
from relogic.logickit.tokenizer.tokenization import BertTokenizer
class DependencyParsingExample(Example):
"""DependencyParsingExample
""... |
"""
To generate permuation lists of genesets of fixed sizes.
Tier 1: resembling the real BTM_Plus, but in size of ~50 genes.
Tier 2: shuffling real BTM_Plus in slices.
Tier 3: random draw of genes not in BTM_Plus
>>> B2[0]
{'src': ['Xcell_naive B-cells_BLUEPRINT_2', 'Xcell_naive B-cells_HPCA_1', 'Xcell_naive B-cells_... |
import logging
import os
import numpy as np
bigrams_pool = []
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'bigrams_new.txt'), 'r') as f:
for line in f:
bigrams_pool.append(line.split())
def build_phoc(words,
phoc_unigrams,
unigram_levels,
... |
import pipelines
import argparse
from colorama import init as init_colorama
from colorama import Fore
from timeit import default_timer as timer
from definitions import TRAIN_PATH
from data.preprocessor import Options
from data.loaders import load_and_clean_data
from sklearn import metrics
from sklearn.model_select... |
""" Some code borrowed from https://github.com/tkipf/pygcn."""
from __future__ import division
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
from utils.net_util import norm_col_init, weights_init
import scipy.sparse as sp
import numpy as np
from datasets.glove... |
import argparse
import pandas as pd
from openpyxl import load_workbook
from openpyxl.styles import *
from openpyxl.utils import get_column_letter
def parse_args():
"""
parse input args
"""
parser = argparse.ArgumentParser()
parser.add_argument("--new_excel", type=str, default="./benchmark_model_e... |
import os
import sys
import multiprocessing
from .env import (IS_ARM, IS_DARWIN, IS_LINUX, IS_PPC, IS_WINDOWS,
check_env_flag, check_negative_env_flag,
hotpatch_build_env_vars)
hotpatch_build_env_vars()
from .build import (BUILD_BINARY, BUILD_CAFFE2_OPS, BUILD_TEST, USE_FBGEMM,
... |
import re
from .abstractpathtool import AbstractPathTool
from cadnano2.data.dnasequences import sequences
from cadnano2.ui.dialogs.ui_addseq import Ui_AddSeqDialog
from cadnano2.views import styles
import cadnano2.util as util
util.qtWrapImport('QtCore', globals(), ['Qt', 'QObject', 'QPointF',
... |
#!/usr/bin/env python3
"""
`wrapsync2` is a wrapper script for `rsync` and a Python rewrite of [wrapsync][wrapsync]. Its main purpose is to
simplify `rsync`'ing common directories.
`rsync` works with files and directories alike. The key to correctly synchronise is to recognise that the source is
directly transported ... |
""" Two1 command to join various zerotier networks """
# standard python imports
import logging
import os
import platform
import subprocess
import sys
# 3rd party imports
import click
from tabulate import tabulate
# two1 imports
from two1.commands.util import decorators
from two1.commands.util import uxstring
from tw... |
from datetime import timedelta
from django.contrib import admin
from django.contrib import messages
from django.contrib.admin.options import IncorrectLookupParameters
from django.core.exceptions import ValidationError
from django.db.models import Sum
from django.utils.translation import gettext_lazy as _
from core.ad... |
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... |
from .utils import BaseDB, SolanaIxSignInfo, NeonTxResultInfo, NeonTxInfo, str_fmt_object
from .blocks_db import SolanaBlockDBInfo
class NeonTxDBInfo:
def __init__(self, neon_tx=NeonTxInfo(), neon_res=NeonTxResultInfo(), block=SolanaBlockDBInfo(), used_ixs=[]):
self.neon_tx = neon_tx
self.neon_res... |
import petab.C as ptc
from PySide6 import QtWidgets, QtCore, QtGui
from PySide6.QtCore import (QAbstractTableModel, QModelIndex, Qt)
from PySide6.QtGui import QColor
class PetabTableModel(QAbstractTableModel):
"""PEtab data table model."""
def __init__(self, df=None):
QAbstractTableModel.__init__(sel... |
"""
SC101 Baby Names Project
Adapted from <NAME>'s Baby Names assignment by
<NAME>.
This program can show the curves of the babyname's ranking trend.
"""
import tkinter
import babynames
import babygraphicsgui as gui
FILENAMES = [
'data/full/baby-1900.txt', 'data/full/baby-1910.txt',
'data/full/baby-1920.txt'... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
"""Reference from https://github.com/jchen42703/CapsNetsLASeg/blob/master/capsnets_laseg/models/capsnets.py#L165"""
class Length(nn.Module):
"""Computes the length of output vector:
... |
from messari import Messari
from datetime import date
import json
DEFAULT_CURRENCY = "USD"
EXCHANGE_ALIAS = {"coinbase_pro": "coinbase", } # TODO: add more known aliases
def get_trading_volume(crypto_exchange, token_pair, start_date, end_date, duration, api_key=None):
messari = Messari(key=api_key)
market_k... |
# Licensed under Apache License Version 2.0 - see LICENSE
import pickle
import pytest
import iteration_utilities
from iteration_utilities import nth
import helper_funcs as _hf
from helper_cls import T, toT
def test_nth_repr1():
x = nth(2)
r = repr(x)
assert 'nth' in r
assert '2' in r
def test_nt... |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PROGRAMMER: <NAME>
# DATE CREATED: 3.1.20
# REVISED DATE:
#
##
# Imports python modules
import argparse, os
import torch
from torch import nn
from torch import... |
# -*- coding: utf-8 -*-
from malib.backend.datapool.offline_dataset_server import Episode
import random
from typing import List
import numpy as np
from gym import spaces
from pettingzoo.utils import wrappers
from pettingzoo.utils.env import AECEnv
from open_spiel.python.rl_environment import Environment as OPEN_SPIEL... |
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import itertools
import os
from dataclasses import dataclass
from pathlib import PurePath
from typing import Iterable, Optional, Tuple, Type
from pants.core.target_types import FilesSourc... |
import numpy as np
import matplotlib.pyplot as plt
import pickle
import os
from mpl_toolkits.mplot3d import Axes3D
def freq_plot(sim_name, moving_avg, lines):
file = open(sim_name + '.obj', 'rb')
data = pickle.load(file)
flux_freqs = np.asarray(data['flux_freqs'])
disk_refl_flux = np.asarray(data['dis... |
# -*- coding: utf-8 -*-
# Copyright 2011 Google 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
#
# Unless require... |
# Copyright 2014
# The Cloudscaling Group, 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 ... |
#!/usr/bin/env python
#
# Copyright 2020 Espressif Systems (Shanghai) PTE LTD
#
# 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 req... |
from matplotlib.patches import Polygon
import matplotlib.pyplot as plt
import numpy as np
import random
from exercise1 import check_for_triangle
from exercise1 import plot_2D_points
def remove_duplicates(lst):
return [item for item in (set(tuple(i) for i in lst))]
# select a point from avaliable points (for... |
#!/usr/bin/env python3
"""
.. codeauthor:: <NAME> <<EMAIL>>
"""
import logging
from argparse import ArgumentParser, Namespace, RawDescriptionHelpFormatter
from logging import Logger
from textwrap import dedent
from typing import AbstractSet
from .__version__ import __version__
from ._const import BUILD_CACHE_DIRS, I... |
from copy import deepcopy
from collections import deque
import time
import numpy as np
class Node:
def __init__(self, parent, grid):
self.parent = parent
self.grid = grid
def print_answer(p1, p2):
initial_to_middle = []
while p1:
initial_to_middle.insert(0, p1.grid)
... |
import copy
import logging
import lib.const as C
import lib.visit as v
from .. import util
from ..meta import class_nonce, register_class, class_lookup
from ..meta.program import Program
from ..meta.clazz import Clazz
from ..meta.method import Method
from ..meta.field import Field
from ..meta.statement import Stateme... |
"""
Module that manages the parsing of a Yambo o- file(s).
"""
import numpy as np
# Specifies the name of the columns of the o- files for various type of runs. There are
# two distint dictionaries depending if the ExtendOut option has been activated or not.
# The rt outputs are not modified by the extendOut option
r... |
"""This script uploads image builder action to the desired github repo
As well as uploading the most recent verion of the script it alos
uploads secrets that are needed to run the script.
"""
import configparser
from pathlib import Path, PosixPath, WindowsPath
import sys
from typing import Union
import json
imp... |
"""Miscellaneous plots for multi-arm bandit validation"""
from collections import namedtuple
import numpy as np
from numpy_ml.bandits import (
MultinomialBandit,
BernoulliBandit,
ShortestPathBandit,
ContextualLinearBandit,
)
from numpy_ml.bandits.trainer import BanditTrainer
from numpy_ml.bandits.pol... |
# -*- coding: utf-8 -*-
from rdkit.Chem import AllChem
from rdkit import Chem
from rdkit.Chem import MACCSkeys
from .CalcuDescriptors import CalcuDescriptors
from .AdjacentTensor import AdjacentTensor
from .Fingerprint import Fingerprint
from .VertexMatrix import VertexMatrix
from .Atom_Bond import Atom, Bond
import nu... |
# -*- coding: utf-8 -*-
from collections import OrderedDict
import copy
import logging
from django.core.exceptions import ImproperlyConfigured
from django.utils.functional import curry
from six import iteritems, string_types
from ereports.engine.cache import DatasourceCacheManager, DummyCacheManager
from ereports.engin... |
import numpy as np
import keras
import h5py
from numpy.random import randint
def one_hot_index(index, classes):
'One-hot encoding'
return np.array([int(i==index) for i in range(classes)])
def log_standardize(spec, path_norm='data/dataset_props_log.h5'):
'Apply log operation to the spectrogram and normali... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time : 2020/11/5 4:55 PM
@Author : Caroline
@File : deep cross network 模型实现
@Description : 使用cross network代替DeepFM中的FM,实现更深层次的特征交叉
"""
import pandas as pd
from sklearn.preprocessing import LabelEncoder, MinMaxScaler, StandardScaler
import tensorflow a... |
import multiprocessing
import math
import cv2 as cv
import keras.backend as K
import numpy as np
from tensorflow.python.client import device_lib
from config import epsilon, epsilon_sqr
from config import img_cols
from config import img_rows
from config import unknown_code
# overall loss: weighted summation of the tw... |
import importlib
import pathlib
import subprocess
from django.core.checks.security.base import SECRET_KEY_INSECURE_PREFIX
from django.core.management.utils import get_random_secret_key
from kureta.exceptions import (
InitializeBoostrapException,
InitializeDatabaseException,
InitializeFixturesException,
... |
# utility functions for pgmpy library
# authors: murphyk@, Drishttii@
#!pip install pgmpy
#!pip install graphviz
import superimport
import pgmpy
import numpy as np
import itertools
from graphviz import Digraph
def get_state_names(model, name):
state_names = dict()
cpd = model.get_cpds(name)
state_names = cpd.... |
# Standard Library
from uuid import UUID
# 3rd Party
from flask import Blueprint, current_app, g, jsonify, make_response, request, url_for
# Fastlane
from fastlane.helpers import loads
from fastlane.models import JobExecution, Task
bp = Blueprint("enqueue", __name__) # pylint: disable=invalid-name
def get_details... |
#!/usr/bin/env python3
"""Tools developed by OpenStreetCam to help contributors."""
import logging
import os
from argparse import ArgumentParser, RawTextHelpFormatter, SUPPRESS, Namespace
from login_controller import LoginController
from osc_api_config import OSCAPISubDomain
from osc_uploader import OSCUploadManager
f... |
# -*- coding: utf-8 -*-
import yaml
import traceback
from copy import deepcopy
from haproxysessionmon.errors import *
import logging
logger = logging.getLogger(__name__)
__all__ = [
"load_haproxysessionmon_config",
"load_haproxysessionmon_config_from_file",
"CONFIG_DEFAULTS",
"CONFIG_BACKEND_TYPE_GEL... |
import json
from functools import partial
from loguru import logger
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.spinner import Spinner
from kivy.metrics import dp
from kivy.core.window import Window
from kivy.proper... |
######################################################################
#
# File: b2sdk/v0/sync.py
#
# Copyright 2019 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
import logging
from b2sdk.v1.except... |
# import dependencies
import numpy as np
import datetime as dt
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from flask import Flask, jsonify
# Formating from app.py in activity "10-ins_flask_with_ORM"
##################... |
import os
import re
import sys
import webbrowser
from typing import Optional, Union
from kivy import Logger
from kivy.uix.gridlayout import GridLayout
from kivy.uix.image import AsyncImage
from kivy.uix.label import Label
from kivy.uix.popup import Popup
import assets
import core.caches
import util
from uix.layouts i... |
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search
import numpy as np
##Connect with elasticsearch client
es = Elasticsearch(['localhost'],port=9200)
##Some initial variables
label_fields = ["title"]
fields = ["title","cast","country","description"]
weight_fields =["title^2","cast^... |
import FreeCAD as App
from FreeCAD import Placement, Vector, Rotation, ActiveDocument
import Part
import math
def trig(x, y, angle, distance):
theta = math.radians(angle+90)
x = x + (math.sin(theta) * distance)
y = y + (math.cos(theta) * distance)
return (x,y)
def getEmptyLayers():
layers = {}
layers['bases'... |
# python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... |
import mysql.connector
from datetime import datetime, time
import dateparser
import pendulum
import string
import dateutil
from dateutil import *
from robot.libraries.DateTime import convert_time
# function to return a tuple from the pendulum object type
def from_pendulum_to_tupple(date):
print("date: {}".format(d... |
# Copyright 2017,2018,2019,2020,2021 Sony Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
from typing import Set, Callable, List, Tuple, Dict
from expanded_checklist.checklist.editor import Editor
import regex as re
import src.config as cfg
from src.utils import get_name_from_path, get_file_paths
from lemminflect import getInflection
import os
import logging
from munch import Munch
import csv
from itertoo... |
"""
This code is adapted from the source code used in the paper
'Style Change Detection with Feed-forward Neural Networks (2019)'
Title: PAN_2019
Authors: <NAME>, <NAME>, and <NAME>
Date: Jul 2, 2019
Availability: https://github.com/chzuo/PAN_2019
"""
import json
from nltk.tokenize import word_tokenize, sent_tokenize... |
#! /usr/bin/env python3
__author__ = '<NAME>'
__date__ = '2019/08/18'
import argparse
import numpy as np
from scipy import stats
import sys
import astropy.table
from astropy.table import Table, Column
from join_catalogues import write_table
import multiprocessing as mp
def calc_stats_table(filename, ndof=None, sta... |
import numpy as np
import scipy.linalg as scla
from scipy.spatial import ConvexHull
import sys
import toml
import lib.shape_gallery as shape_gallery
import lib.Smooth_Closed_Surface_Quadrature_RBF as quadlib
import lib.periphery as periphery
import lib.quaternion as quaternion
import lib.kernels as kernels
if len(sys... |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2019] EMBL-European Bioinformatics Institute
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... |
import argparse
import copy
import math
import operator
import os
from collections import deque
import numpy as np
import pandas as pd
from scipy import stats
def read_data(fname):
with open(os.path.join(os.path.dirname(__file__), "../data/{}".format(fname))) as f:
content = f.readlines()
content = [... |
#!/usr/bin/env python
#!/usr/bin/env python
# Script to convert a CoNLL 2002-flavored BIO-formatted entity-tagged
# file into BioNLP ST-flavored standoff and a reconstruction of the
# original text.
import codecs
import os
import re
import sys
import utils
INPUT_ENCODING = "UTF-8"
OUTPUT_ENCODING = "UTF-8"
def q... |
#!/usr/bin/env python3
"""
chr_tool: Convert between PNG and CHR formats.
"""
import argparse
import logging
import os
from PIL import Image
from PIL.PngImagePlugin import PngImageFile
def indexes_from_image(image: PngImageFile, sprite_idx: int) -> list:
assert(0 <= sprite_idx <= 255)
sprite_x = (sprite_idx ... |
from geometry_msgs.msg import Pose as ROSPose
from geometry_msgs.msg import PoseStamped as ROSPoseStamped
from std_msgs.msg import Header
from Context import Pose as ContextPose
from Context import ConfigurationWrapper as ContextConfiguration
from MethodTypes import Trajectory as ContextTrajectory
from MethodTypes impo... |
#!/usr/bin/python3
import argparse
import codecs
from glob import glob
import os.path
import re
import string
import subprocess
import sys
TEMPLATES_PATH = 'frontend/templates'
JS_TEMPLATES_PATH = 'frontend/www/js/omegaup'
PSEUDOLOC = 'pseudo'
LINE_RE = re.compile(r'\s+=\s+')
VALUE_RE = re.compile('^"([^"]|\\")*"$')
... |
#
# Copyright (c) 2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
import torch
import torch.nn.functional as F
from torch import nn
from torch.nn import Linear
from torch.nn import BatchNorm1d
from torch_geometric.nn import GCNConv, GATConv, GlobalAttention
from torch_geometric.nn import global_add_pool, global_mean_pool
from torch_geometric.data import DataLoader
n_features = 29
... |
"""Avg dew point at temperature."""
from collections import OrderedDict
import datetime
from pandas.io.sql import read_sql
from metpy.units import units
import metpy.calc as mcalc
from pyiem.network import Table as NetworkTable
from pyiem.util import get_autoplot_context, get_dbconn
from pyiem.plot.use_agg import plt
... |
import torch
import argparse, json, glob, os
import scipy
import numpy as np
import matplotlib.pyplot as plt
from IPython.core.display import display, HTML
from ipywidgets import interact, widgets, fixed
def plotf2(r, img1, ttl, sz):
plt.title(ttl+' {}'.format(r))
plt.imshow(img1[r][...,0:3], cmap="gray", vmi... |
# --------------------------------------------------------------------------
# Illusoft Collada 1.4 plugin for Blender
# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Copyright (C) 2006: Illusoft - <EMAIL>
#
# This program is free software; you can ... |
from __future__ import print_function
import csv
import distutils
import shutil
import pandas as pd
import os
import re
from collections import defaultdict
import six
import sys
from Bio import SeqIO
from tracerlib.tracer_func import process_chunk, find_possible_alignments
from tracerlib.core import Invar_cell
impo... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import itertools
from ard_gsm.mol import Connection
from config.limits import connection_limits
class ConnectionError(Exception):
"""
For any invalid connection changes that occur in MolGraph.
"""
pass
class DrivingCoords(object):
def __init__(self,... |
"""
Last: 5069
Script with simple UI for creating gaplines data
Run: python WordClassDM.py --index 0
Controls:
setting gaplines - click and drag
saving gaplines - 's' key
reseting gaplines - 'r' key
skip to next img - 'n' key
delete last line - 'd' key
"""
import cv2
import os
import numpy as... |
'''
训练svm
'''
import cv2
import numpy as np
from numpy.linalg import norm
import sys
import os
import json
SZ = SZ = 20
PROVINCE_START = 1000
provinces = [
"zh_cuan",
"川",
"zh_e",
"鄂",
"zh_gan",
"赣",
"zh_gan1",
"甘",
"zh_gui",
"贵",
"zh_gui1",
"桂",
"zh_hei",
"黑",... |
import sys
import torch.nn as nn
from typing import Union
from torchvision import models
from dffml.base import config, field
from dffml.util.entrypoint import entrypoint
from .utils import create_layer
from .pytorch_base import PyTorchModelConfig, PyTorchModelContext, PyTorchModel
class LayersNotFound(Exception):
... |
# coding:utf-8
"""
@author : linkin
@email : <EMAIL>
@date : 2018-10-04
"""
import random
import logging
import json
from flask import Flask
from components.dbhelper import Database
from config.DBsettings import _TABLE
from config.DBsettings import _DB_SETTINGS
logger ... |
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import torch
import time
from torch import nn
from torch.utils.data import DataLoader
from torchvision.transforms import ToTensor, Compose
import torchvision.models as models
import pathlib
from pathlib import P... |
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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... |
import numpy as np
import pretty_midi
from math import floor, log2
import fastdtw
# from librosa.sequence import dtw
import librosa.display
from .dlnco.DLNCO import dlnco
import os
import essentia.standard as esst
from .. import cdist
from .. import utils
# hack to let fastdtw accept float32
def _my_prep_inputs(x, y,... |
from fastai.collab import *
from flask import Flask, request
import requests
import os.path
path = ''
export_file_url = 'https://www.dropbox.com/s/vj7cl45po1t86o8/cf1_books.pkl?dl=1'
export_file_name = 'cf1_books.pkl'
def down_load_file(filename, url):
"""
Download an URL to a file
"""
with open(fi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.