text stringlengths 3.07k 22.1k |
|---|
import random as rnd
# PART 1 - Program Welcome #
#
def DisplayWelcome():
print("This is a game of memory! Do you think you have what it takes?! ")
print("Please choose a difficulty level from the following: ")
# giveNums will make the randomised questions.
def giveNums(numberOfQuestions, difficulty):
outNums = ... |
import sqlite3
import re
from urllib import parse
import hashlib
def url_pas(data):
return(parse.quote(data).replace('/','%2F'))
def sha224(data):
return(hashlib.sha224(bytes(data, 'utf-8')).hexdigest())
def link(conn, title, data, num, category, backlink):
curs = conn.cursor()
data = data.replace('... |
import os
import platform
import tempfile
import time
from pathlib import Path
from test.conftest import TEST_REF, conan_create_and_upload
from typing import List
from conan_app_launcher.core.conan import (ConanApi, ConanCleanup,
_create_key_value_pair_list)
from co... |
import os
import numpy as np
import pandas as pd
from openpyxl import load_workbook
import plotly.io as pio
from src.visualization.visualize import plot_lines, save_lorenz_curve
from src.data.utils import load_cpi
from src.env import project_dir, data_dir
from src.dictionary import translate, region2ko, unit2ko
def ... |
"""
prepare pathway name and pathway time for pathway-probability evaluation
"""
import os
import sys
from copy import deepcopy
import numpy as np
import pandas as pd
import parse_spe_reaction_info as psri
import parse_pattern as pp
def prepare_pathway_name(
data_dir, top_n=5, flag="", end_s_idx=None, species... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# Copyright (c) 2013 <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 writing, softw... |
# -*- coding: utf-8 -*-
from typing import List, Tuple, Union
import matplotlib as mpl
from matplotlib.figure import Figure
from matplotlib.axes import Subplot
import matplotlib.pyplot as plt
from numpy import ndarray
from .extend import ExtendDict
from .color import PLOT_COLORS
# DEFAULT PARAMETERS
class PlotProp... |
"""Data store backend for S3"""
from typing import Iterable, Dict, Tuple, List, Set, Optional, Any
import datetime
import hashlib
import io
import re
import boto3
from botocore.config import Config # type: ignore
from .config import S3EnvConfig
from ..data_store_util import wide
from ...api.data_store import Confi... |
#!/usr/bin/env python3
from shutil import copyfile
from math import isclose
#################################################
# running settings
#################################################
# executable of the NAMD binary
namd_binary = "namd2"
# number of process
num_processes = 16
# use single-node GPU
use_singl... |
import socket
import logging
import sys
import requests
import time
import threading
from emoji import demojize
from datetime import datetime
"""
Please read the Readme.md before running!
"""
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s — %(message)s',
datefmt='... |
import os
import numpy as np
import pandas as pd
from util import DATA_DIR, DOWNLOAD_DIR, load_data, reduce_dataset, keystrokes2events, events2keystrokes
GREYC_NISLAB_DATASET_URL = 'http://www.epaymentbiometrics.ensicaen.fr/wp-content/uploads/2015/04/greyc-nislab-keystroke-benchmark-dataset.xls'
CITEFA_DATASET_URL = ... |
# -*- coding: utf-8 -*-
from odoo import models, fields, api,tools,_
from datetime import datetime, timedelta
from odoo.exceptions import UserError
# Cap Nhat Trang Thai chuyen dich kho (daft)
class Update_Invoice_Out(models.Model):
_inherit = "stock.picking"
# cap nhat trang thai hoa don
# class Update_Invoice... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script for generating mock BeGaze test data
"""
import pandas as pd
import numpy as np
import random
import string
import exrex
import re
pd.set_option('display.max_rows', 50)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
from pypsych.... |
import abc
from functools import partial, singledispatch
from typing import Dict, List, Optional, Type, Union
import aesara.tensor as at
from aesara.gradient import jacobian
from aesara.graph.basic import Node, Variable
from aesara.graph.features import AlreadyThere, Feature
from aesara.graph.fg import FunctionGraph
f... |
from webapp import app, db
from celery import Celery
from celery.schedules import crontab #periodic tasks
from celery.task.control import inspect
from bot.main import InstagramBot
from webapp.models import Abonnenten,Abonniert,Source,Statistiken,Targets_done,Targets_raw,Counter,Tasks,Taskstatus
import datetime
impo... |
"""
Roughly a UI component for classes
"""
import builtins
import inspect
import sys
from collections import deque
from typing import Any, Callable, Dict, List, Optional, Union, cast
from pydoc_fork import settings
from pydoc_fork.inspector.custom_types import TypeLike
from pydoc_fork.inspector.utils import (
_spl... |
# -*- coding: utf-8 -*-
import cv2
from __init__ import Square, predictor, detector, vfps, size
from facefrontal import facefrontal, warp_mapping
import numpy as np
padw = 95
detw = 130
def getGaussianPyr(img, layers):
g = img.astype(np.float64)
pyramid = [g]
for i in range(layers):
... |
import os
import shutil
import sys
import tempfile
import traceback
from html import escape
from pathlib import Path
from typing import List
from flask import request, Response, url_for
from werkzeug.utils import secure_filename
import click_web
import subprocess
from .input_fields import separator
logger = None
... |
""""Kitchen environment."""
# Add Kitchen assets adept_envs/ folder to the python path.
import sys
import os
parent_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(parent_dir, "kitchen_assets/adept_envs"))
import time
import numpy as np
import mujoco_py
import copy
from adept_envs.frank... |
# %% [markdown]
# #
import csv
import itertools
import os
import time
from pathlib import Path
import colorcet as cc
import matplotlib.colors as mplc
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
import textdistance
from joblib import Parallel, delay... |
import sys
sys.path.append('../')
def ImportAriesByScenario(scenarioName, start_date, end_date, Area, CorpID = ['ALL']):
from Model import BPXDatabase as bpxdb
from Model import QueryFile as qf
import pandas as pd
#Create ODS and EDW objects
Success = True
Messages = []
combined... |
# Copyright 2018 German Aerospace Center (DLR)
#
# 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 agre... |
import torch
import torch.nn as nn
from onmt.Models import EncoderBase, RNNDecoderBase, NMTModel
def multimodal_model_class_by_key(key):
d = {
'hsm': HiddenStateMergeLayerMMM,
'fvtl': FirstViewThenListenMMM,
'gm': GeneratorMergeMMM,
'fvtl+gm': FirstViewThenListenFinallyViewMMM
... |
# ==========================
# Module: Diagnostic Plots
# Author: <NAME>
# Last Modified: 06 Jan 2022
# ==========================
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import statsmodels.api as sm
import statsmodels.tsa.api as smt
import warnings
from .utils impo... |
import os
import cv2
import pickle
import imutils
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.metrics import precision_recall_fscore_support as prfs
from tensorflow.keras.optimizers import Adam, SGD
from tensorflo... |
# hello
from mypkg.db_settings import session
from prompt_toolkit.application import Application
from prompt_toolkit.layout import HSplit, VSplit, Layout, DummyControl, Window
from prompt_toolkit.widgets import Label, TextArea, Frame
from prompt_toolkit.styles import Style
from prompt_toolkit.key_binding import K... |
#!/usr/bin/env python
"""
Wgetter is another command line download utility written completely in python.
It is based on python-wget (https://bitbucket.org/techtonik/python-wget/src) with some improvements.
It works on python >= 2.6 or python >=3.0 Runs on Windows or Linux or Mac
API Usage:
>>> import wgetter
>>> fil... |
# -*- coding: utf-8 -*-
"""
ENERPIWEB - CLI methods:
- Install configuration & CRON task for web resources generation
- Uninstall CRON task
- Run Flask server
"""
import argparse
import os
import sys
from enerpi.base import BASE_PATH, DATA_PATH, CONFIG, log, check_resource_files, NGINX_CONFIG_FILE, UWSGI_CONFIG_FILE
... |
from enum import Enum, auto
from ..geometry import Position, Vector, Size
from ..events import handlers
from .core import Align, ZOrder
from . import toolkit
from . import basic
from . import containers
from . import decorations
from . import renderers
class UIWidget:
def __init__(self, default_colors, *args,... |
from base64 import b64encode, b64decode
from bs4 import BeautifulSoup as soup
from bz2 import BZ2File
from collections import Counter, OrderedDict
from copy import deepcopy
from datetime import datetime as dt, timedelta
try:
from etk.extractors.date_extractor import DateExtractor
except OSError:
from s... |
import numpy as np
from RecSysFramework.Recommender.MatrixFactorization.MatrixFactorization_Cython import BPR_NNMF, BPRMF, FUNK_NNMF, FunkSVD
from RecSysFramework.Recommender.MatrixFactorization.PureSVD import PureSVD
from RecSysFramework.Recommender.KNN.ItemKNNCFRecommender import ItemKNNCF
from RecSysFramework.Recomm... |
#!/usr/bin/env python
#
# $Id$
#
# Copyright (c) 2009, <NAME>, <NAME>'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""OSX platform implementation."""
import errno
import os
import sys
import _psutil_osx
import _psutil_posix
from psutil i... |
import datetime
import json
import sys
import numpy as np
import pandas as pd
from bld.project_paths import project_paths_join as ppj
from src.utilities.format_utils import _add_categorical_variables
#####################################################
# PARAMETERS
#################################################... |
"""A script to measure the keyword incorporation metrics of stories and storylines"""
import argparse
from itertools import combinations
import numpy as np
import re
import sys
def read_w2v(w2v_path, word2index, n_dims=300, unk_token="unk"):
"""takes tokens from files and returns word vectors
:param w2v_path... |
import tensorflow as tf
from tensorflow.contrib import slim
from tensorflow import keras
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_integer('image_height', 28, 'the height of image')
tf.app.flags.DEFINE_integer('image_width', 28, 'the width of image')
tf.app.flags.DEFINE_integer('batch_size', 128, 'Number of image... |
"""Provides unit tests to verify that the biconnected components algorithms are functioning correctly."""
import unittest
from ..pygraph import (UndirectedGraph, find_biconnected_components, find_articulation_vertices, merge_graphs,
build_triangle_graph, build_square_graph, build_diamond_graph,
... |
#!/usr/bin/env python
####################################################################################################
# NAME
# <NAME> - contain HTML utility functions
#
# SYNOPSIS
# <NAME>
#
# AUTHOR
# Written by <NAME> (<EMAIL>).
#
# COPYRIGHT
# Copyright © 2013-2021 <NAME> <https://barras.io>.
# T... |
from datetime import datetime
from pathlib import PosixPath
from typing import List, Tuple, Any, Optional, Dict
from dateutil.tz import tzutc
from blurr.core.store_key import Key, KeyType
from blurr.runner.spark_runner import SparkRunner, get_spark_session
def execute_runner(stream_bts_file: str,
... |
import torch.nn.functional as F
from util.util import compute_tensor_iu
def get_new_iou_hook(values, size):
return 'iou/new_iou_%s'%size, values['iou/new_i_%s'%size]/values['iou/new_u_%s'%size]
def get_orig_iou_hook(values):
return 'iou/orig_iou', values['iou/orig_i']/values['iou/orig_u']
def get_iou_gain(v... |
from abc import abstractmethod
import torch
class TensorTree:
"""
Generalised version of tensor. As like as tensor, it represents an object of some data type,
but also stores information about it's structure. Every layer of tree stores tensor, which
values represent one layer of data structure and li... |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import datetime
import os
import traceback
import uuid
from google.appengine.api import datastore_errors
from google.appengine.api import taskqueue
from goo... |
import argparse
import copy
import glob
import json
import os
from .core import GTAB
dir_path = os.path.dirname(os.path.abspath(__file__))
# --- UTILITY METHODS ---
class GroupedAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
group, dest = self.dest.split('.'... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# (c)2021 .direwolf <<EMAIL>>
# Licensed under the MIT License.
from typing import Callable, Iterable, List, Literal
from arcfutil.aff.note.notegroup import TimingGroup
from ..note import Arc
from ..note import NoteGroup
from ..note import SceneControl
from ..note import... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Count, F, Q
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.fun... |
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 24 15:43:00 2022
@author: hiro7
"""
from scipy import integrate
import matplotlib.pyplot as plt
import numpy as np
from numpy import sin,cos,tan
import os
import skrf as rf
import numpy as np
import scipy as sp
from numpy import real, log10, sum, absolut... |
import tensorflow as tf
from official.transformer.model import attention_layer, ffn_layer, transformer, model_utils, model_params
from tensor2tensor.models.research import universal_transformer, universal_transformer_util
from tensor2tensor.models import transformer as t2t_transformer
def create(params, transformer_p... |
import random
import argparse
import sys
import os
import json
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')))
from common.pytorch.ner.model import Tagger
def lines(path):
w... |
from contextlib import contextmanager, ExitStack
from itertools import chain
from ..errors import *
from .state import State
from .core import Context, Object, BoundObject, Scope, Type
from .stats import Stats
from .util import inScope, checkCompatibility
from .links import Link
# Python Predefines
ForwardObject = N... |
import warnings
import numpy as np
from .utils import *
from .exceptions import NotEvaluatedError, NotSupposedToHappenError
class TreeNode:
"""Decision tree node
We would not want to define another node in the constructor
so the API requires you to set the left and right
node attributes manually.
... |
# -*- coding: utf-8 -*-
"""
Visualization tools for showing the results of a pyshield calculation run.
A heatmap is shown on top of the floor plan. Isocontours specified in the
config file are shown as well.
Last Updated 05-02-2016
"""
import pyshield as ps
import numpy as np
import pyshield
import yaml
... |
import tweepy, sys, os
from datetime import datetime
from time import tzname
from math import *
from random import randint, choice, seed
from PIL import Image, ImageDraw, ImageFont
# The PolyFriends Bot
# Find the bot at https://twitter.com/PolyFriendsBot!
# Created by <NAME> 2020
# Files
KEYS_PATH = "keys.txt... |
from pathlib import Path
import pickle
from typing import Optional
from matplotlib import cm
import matplotlib.pyplot as plt
import numpy as np
import matplotlib as mpl
def jitter(x):
return x + np.random.normal(scale=0.13, size=(len(x),))
def feature_scale(arr):
mini, maxi = arr.min(), arr.max()
return... |
import asyncio
import importlib
import json
import logging
import os
import pprint
import re
import sys
import time
import docker
import netaddr
import netifaces
import sh
import tornado.httpclient
from wotemu.enums import Labels
_CGROUP_PATH = "/proc/self/cgroup"
_STACK_NAMESPACE = "com.docker.stack.namespace"
_CID... |
import numpy as np
from numba import jit
def fitness_complexity_calculation(m, iterations, samples):
"""Returns fitness and complexity at different iteration stages for a given matrix m. m is intended to be of shape [n_countries,n_products], i.e. Fitness will be computed on the rows and Complexity on the columns ... |
"""Code adopted from https://github.com/yangyanli/PointCNN"""
import math
import tensorflow as tf
import pc.configuration.config as cfg
import pc.model.base as base
import pc.model.point_cnn_patch as patch
import pc.model.point_cnn_util as pf
import pc.model.sampling.sampling as sampling
def xconv(pts, fts, qrs, ta... |
"""UCF24 Dataset Classes
Original author: <NAME> for VOC dataset
https://github.com/fmassa/vision/blob/voc_dataset/torchvision/datasets/voc.py
Updated by: <NAME>, <NAME> for VOC dataset
Updated by <NAME> for ucf101-24 dataset
"""
import os, pdb
import torch
import torch.utils.data as data
import cv2, pickle
import n... |
# ############################################################################################### #
# #
# Implements the RNSB score calculation as presented in [1]. #
# ... |
#!/usr/bin/env python3
"""
Utility functions and class for sql-extract
"""
import sys
import io
import os
import re
import csv
import openpyxl
import logging
import argparse
from profpy.db import get_cx_oracle_connection
from cx_Oracle import DatabaseError
class SqlExtractHandler(object):
"""
Helper class tha... |
#!/usr/bin/env python3
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This... |
import optuna
import pandas as pd
import numpy as np
from scipy.stats import rankdata
import pandas_ta as pta
from finta import TA as fta
import talib as tta
import re
import warnings
import pareto
warnings.filterwarnings("ignore")
from timeit import default_timer as timer
def col_name(function, study_best_params):
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
1-Dimensional Dynamic Neural Field
References
----------
<NAME>., <NAME>., & <NAME>. (2015).
A Biologically Plausible Computational Theory for Value Integration and Action Selection
in Decisions with Competing Alternatives.
PLoS Computational Biology, 11(3), e1004104... |
import numpy as np
import pytest
from psyneulink.core.components.functions.transferfunctions import Linear
from psyneulink.core.components.mechanisms.processing.transfermechanism import TransferMechanism
from psyneulink.core.components.process import Process
from psyneulink.core.components.system import System
from ps... |
# Copyright 2020 The Private Cardinality Estimation Framework 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 b... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import torch
import torch.nn.functional
from torch import nn
from typing import List, Dict, Tuple
from ..utils import build_stack_conv_layers, random_init_weights
from ..builder import HEADS, build_loss
from ...core import P... |
"""
@date: 2021/7/20
@description: reference https://www.redblobgames.com/articles/visibility/
"""
import math
import numpy as np
from functools import cmp_to_key as ctk
from PIL import Image
class Point:
def __init__(self, x: float, y: float):
self.x = x
self.y = y
class EndPoint(Point):
de... |
import asyncio
import json
import logging
import signal
import sqlite3
import time
from asyncio import Queue, QueueFull
from collections import defaultdict
from json import JSONDecodeError
import aiohttp
import httpx
import requests
import typing
logger = logging.getLogger() # 不加名称设置root logger
logger.setLevel(loggi... |
# Copyright 2016 PerfKitBenchmarker 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 appli... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
def func_conv_deform(x, loc_layer, k, s, layers_act_num, offset_file = '', activated = False):
# print(layers_act_num)
if offset_file == '':
offset_file = './OFFSETS/offset_'+str(int(x.shape[3]/s))+'_'+str(int(x.shape... |
"""Get details from World Bank etc
"""
import json, glob, os
import logging
import pandas as pd
import world_bank_data as wb
import netCDF4 as nc
countrymasks = os.path.dirname(__file__)
country_data_path = os.path.join(countrymasks, 'country_data')
datasets = os.path.join(countrymasks, 'datasets')
class Variable:
... |
import os
import numpy as np
from numpy.testing import TestCase, assert_array_almost_equal, \
assert_almost_equal
from parameterized import parameterized
from ..rebidding import (
MultistageAuctionData, MultistageIsNonCompetitive,
RefinedMultistageData, RefinedMultistageIsNonCompetitive,
RefinedMultist... |
# This file is part of LiteDRAM.
#
# Copyright (c) 2021 Antmicro <www.antmicro.com>
# SPDX-License-Identifier: BSD-2-Clause
import re
import enum
from migen import *
@enum.unique
class BankOrganization(enum.IntEnum):
"""Internal organization (architecture) of banks as set in MR[3]"""
BG = 0b00 # 4 banks, 4... |
# Authors: <NAME> <<EMAIL>>
# + All contributors to <https://github.com/smarie/python-azureml-client>
#
# License: 3-clause BSD, <https://github.com/smarie/python-azureml-client/blob/master/LICENSE>
import sys
from contextlib import contextmanager
from inspect import getmembers, isroutine
from logging import g... |
'''
Contains all the classes to process a raster and prepare it for webdisplay
Contains:
RasterTiler - creates raster tiles
RasterLayerProcessor - processes raster files
@author: livia
'''
try:
from osgeo import gdal
except ImportError:
import gdal
import subprocess
import osr, math
import numpy as n... |
import sys
import time
import attr
import numpy as np
import tqdm
from .utils import stat_str
class FFSampler:
pass
@attr.s
class FFInterface:
order = attr.ib(type=float)
states = attr.ib(factory=list)
log10_rate = attr.ib(0.0)
s_up = attr.ib(0)
s_down = attr.ib(0)
s_timeout = attr.ib(... |
#this algo only looks at the stocks in the biopharmcatalyst.com table and makes a trading decision based on the data in it
import otherfxns as o
algo = o.os.path.basename(__file__).split('.')[0] #name of the algo based on the file name
def init(configFile):
global c
#set the multi config file
c = o.configpars... |
def warn(*args, **kwargs):
pass
import warnings
warnings.warn = warn
import torch
import torch.nn as nn
from torchvision import transforms
import sys
sys.path.append('/opt/cocoapi/PythonAPI')
from pycocotools.coco import COCO
from data_loader import get_loader
from data_loader_val import get_loader_val
from model ... |
from cwbot.modules.BaseDungeonModule import BaseDungeonModule
from cwbot.common.exceptions import FatalError
from cwbot.util.textProcessing import intOrFloatToString
from cwbot.common.kmailContainer import Kmail
from collections import defaultdict
import re
import random
import copy
def _nameKey(x):
re... |
import os
import json
import boto3
import sys
import datetime
import hashlib
import secrets
import time
table_name = os.environ['DDB_TABLE']
ddb_client = boto3.client('dynamodb')
ses_client = boto3.client('ses')
sns_client = boto3.client('sns')
sender = os.environ['SENDER']
unsubscribe_url = os.environ['UNSUBSCRIBE_U... |
""" Siamese Backbone for feature extractor """
from torch import nn
import torch.nn.functional as F
from util.misc import *
from .position_encoding import build_position_encoding
from .cbam import CBAM
# down & up sampling mode
downsampling_mode = 'nearest'
upsampling_mode = 'bilinear'
# resnet structure
resnet_out_... |
# Written by <NAME>
# <EMAIL>
"""
A low level implementation of the Met-Aromatic algorithm. I wrote this mainly
as an alternative to the more high level Pandas/BioPython implementation
of the algorithm. Here I mostly use built in libraries. This script would
be well suited for use in large mining jobs as the ma... |
# -*- coding: utf-8 -*-
import os
from utils.tools import tools
import cv2
import numpy as np
from copy import deepcopy
import torch
import warnings # ignore warnings
import torch.nn.functional as F
import torch.optim as optim
from dataset.kitti_dataset import kitti_train, kitti_flow
from model.upflow import UPFlow_ne... |
#!/usr/bin/env python
# coding: utf-8
# # NAPARI visualization of UNet Training Data
#
# You can use this notebook to view, modified and save out training data for UNet models
#
# Labels:
# + 0 - background
# + 1 - GFP/Phase
# + 2 - RFP
#
#
# Extra key bindings:
# + 'w' - calculate weightmap
# + 's' - save labels
# + ... |
import astropy.units as u
from astropy.io import fits
from astropy.table import Table
import numpy as np
from astropy.coordinates.angle_utilities import angular_separation
from irf.collection_area import collection_area
from irf.energy_dispersion import energy_migration
from irf.gadf.hdus import add_meta_information_to... |
import asyncio
import audioop
import datetime
import functools
import inspect
import shlex
import socket
import struct
import subprocess
import threading
import time
from websockets import ConnectionClosed
from darkPy import opus, helpers
from darkPy.channel import ChannelType
from darkPy.gateway import VoiceGateway
... |
"""
Geogrophic Index
----------------
"""
from typing import Any, Dict, Iterable, List, Optional, Tuple
import json
import numpy
import xarray
from . import lock
from . import storage
from . import converter
from .. import geodetic
from ..core import geohash
class GeoHash:
"""Geogrophic index based on GeoHash enc... |
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.db.models import Count
from django.shortcuts import redirect, get_object_or_404, resolve_url
from django.contrib import messages
from django.utils.decorators import method_decorator
from django.view... |
# Copyright 2016 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 required by applicable law or a... |
# Copyright 2015 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 required by applicable law or a... |
from functools import partial
from os import environ
from string import Template
from constrictor.dpkg import LINK_PATH_KEY
PARENT_KEY = "parent"
DEB_CONSTRICTOR_KEY = "deb_constrictor"
IGNORE_PATHS_KEY = "ignore_paths"
VARIABLES_KEY = "variables"
ENVIRONMENT_VARIABLES_KEY = "environment_variables"
EXTRA_CONTROL_FIEL... |
# -*- coding: utf-8 -*-
'''
Created on 2017-07-18
@author: <NAME>
'''
import bkt
import bkt.library.excel.helpers as xllib
import bkt.library.excel.constants as xlcon
import bkt.dotnet as dotnet
F = dotnet.import_forms() #required to copy text to clipboard
D = dotnet.import_drawing() #required for sizes
calc_history... |
from app import db
from flask_login import LoginManager, UserMixin
from datetime import date, datetime
from flask_restful import Resource, Api, abort, reqparse
class User(UserMixin, db.Model):
user_id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(100), unique=True)
password = db... |
#! python3
'''
* East UPS Room
* Fire Pump Room
* Loading Dock Area
* Mechanical Room
'''
print('Start next file, \'page_04\'')
# imports
from openpyxl import load_workbook
from openpyxl.styles import Alignment, Border, Side, NamedStyle, Font, PatternFill
wb = load_workbook(filename = 'Plymouth_Daily_Rounds.xlsx')
shee... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import os
import mido
from mido import Message, MidiFile, MidiTrack, tempo2bpm
from pynput import keyboard
key_dict = {
# c4
"a4+":22, "b4-":22, "b4": 23,
# c3
"c3": 24, "c3+": 25, "d3-": 25, "d3": 26, "d3+": 27, "e3-": 27, "e3"... |
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
# in order to run the
# sudo pip3 install rpi_ws281x adafruit-circuitpython-neopixel
# Simple test for NeoPixels on Raspberry Pi
# https://learn.adafruit.com/adafruit-neopixel-uberguide/python-circuitpython
import time
import... |
from boto3 import client
from json import dumps
from os import environ
'''
Coding notes:
1) If the source language is the same target language, a JSON is also stored
using the original transcription text.
2) AWS translate_text() allows 5000 bytes per request, so original
transcription must be split in case its... |
#!/usr/bin/python3
import miio
import miio.exceptions
import miio.airhumidifier
import paho.mqtt.client
import urllib.parse
import sys
import yaml
import argparse
import os
import json
import copy
import typing
import datetime
_parser = argparse.ArgumentParser("Bridge python-miio xiaomi device to mqtt")
_parser.add_a... |
#!/home/wiseman/anaconda3/bin/python
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2019 University of Southampton
# All Rights Reserved.
# 12/05/2018
##############################################################################
__author__ = "<... |
# import word_emo.framework.reference_methods.embedding_transformer
import itertools
import tensorflow as tf
import numpy as np
import pandas as pd
import scipy.stats as st
from numpy.linalg import svd
import naacl.framework.util as util
from sklearn.model_selection import KFold
class Densifier():
def __ini... |
from glob import glob, iglob
from nltk.corpus import stopwords
from typing import List, Iterable, Text, Container, Tuple, Optional, Dict
import numpy as np
import os
import pandas as pd
from argparse import ArgumentTypeError
# Type aliases for filter_texts function
Token = Text
Tokens_str = Token
Tokens = List[Token]
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.