text stringlengths 3.07k 22.1k |
|---|
import cv2
import mediapipe as mp
import numpy as np
import pandas as pd
mp_drawing = mp.solutions.drawing_utils
mp_pose = mp.solutions.pose
def calculate_angle(a,b,c):
a = np.array(a) # First
b = np.array(b) # Mid
c = np.array(c) # End
radians = np.arctan2(c[1]-b[1], c[0]-b[0]) - np.arctan2(a[1]-... |
import numpy as np
from paddle import fluid
class MaskedMultiHeadAttention(object):
def __init__(self, model_dim, num_heads, dropout=0.0):
assert model_dim % num_heads == 0
self.model_dim = model_dim
self.num_heads = num_heads
self.per_head_dim = model_dim // num_heads
self... |
import numpy as np
import pandas as pd
import sklearn
import xgboost
import pickle
#Import mode function:
from scipy.stats import mode
#Read files:
train = pd.read_csv("train.csv")
df = train.copy()
# Handling Missing values
#We found two variables with missing values – Item_Weight and Outlet_Size
#### Replacing th... |
import ast
import json
import math
import re
import sys
import traceback
from six import string_types
##############################################################################################################
# This is a JSON parser that isn't as strict as the normal json libraries.
# I can't believe a library fo... |
import torch
import torch.nn as nn
import math
# wildcard import for legacy reasons
if __name__ == '__main__':
import sys
sys.path.append("..")
from models.blocks import *
from models.wide_resnet import compression, group_lowrank
# only used in the first convolution, which we do not substitute by convention
... |
import unittest
from numpy import max, abs, ones, zeros, copy, sum, sqrt, hstack
from cantera import Solution, one_atm, gas_constant
import numpy as np
from spitfire import ChemicalMechanismSpec
from os.path import join, abspath
from subprocess import getoutput
test_mech_directory = abspath(join('tests', 'test_mechani... |
import numpy as np
import pandas as pd
# -----------------------------------
# Regression
# -----------------------------------
# rmse
from sklearn.metrics import mean_squared_error
# y_true are the true values、y_pred are the predictions
y_true = [1.0, 1.5, 2.0, 1.2, 1.8]
y_pred = [0.8, 1.5, 1.8, 1.3, 3.0]
rmse = n... |
from typing import Tuple, Union, Iterable, List, Callable, Dict, Optional
import os
import warnings
import numpy as np
from nnuncert.models._network import MakeNet
from nnuncert.models._model_base import BaseModel
from nnuncert.models._pred_base import BasePredKDE
from nnuncert.models.dnnc._dnnc import DNNCRidgeIWLS... |
"""Utils for Pfam family classification experiments."""
import os
import jax
import jax.numpy as jnp
import numpy as np
import tensorflow as tf
import pandas as pd
import matplotlib.pyplot as plt
import scipy.stats
import sklearn.metrics as metrics
from sklearn.neighbors import KNeighborsClassifier as knn
from... |
from typing import Callable
from typing import List
from typing import Optional
from typing import Sequence
from optuna._experimental import experimental
from optuna.study import Study
from optuna.trial import FrozenTrial
from optuna.visualization._pareto_front import _get_pareto_front_info
from optuna.visualization._... |
import predict
import render
from info import Field, Ball
from moves import AimCone
from plans import DodgePlan
from rlmath import *
class Carry:
def __init__(self):
self.is_dribbling = False
self.flick_timer = 0
# Constants
self.extra_utility_bias = 0.2
self.wait_before_f... |
import json
import random
from datetime import date, datetime
import pandas as pd
from faker import Faker
from neomodel import db
from connect import *
from model import *
from model import _Neodash_Dashboard
from utils import read_resource, read_csv
# Specify Neo4J url for neomodel
db.set_connection(f"bolt://{neo4j... |
import pytest
from abnf.parser import *
def test_empty_literal():
parser = Literal('')
assert parser
def test_literal():
parser = Literal('moof')
source = 'moof'
node, start = parser.parse(source, 0)
assert node.value == 'moof'
@pytest.mark.parametrize("value", [None, 47, ('a', 'b', 'c'), (1,... |
"""
This module contains the application models. These are classes to be used by
the Django ORM to provide a programming interface between the database and
the Django application.
The application models are:
* App - It encapsulates information about appplication setting options.
* Search - It encapsulates info... |
#!/usr/bin/env python
# -*- coding:utf8 -*-
# ================================================================================
# Copyright 2022 Alibaba Inc. All Rights Reserved.
#
# History:
# 2022.03.01. Be created by xingzhang.rxz. Used for language identification.
# 2018.04.27. Be created by jiangshi.lxq. Forked an... |
# -*- coding: utf-8 -*-
# @Author: Bao
# @Date: 2021-12-11 08:47:12
# @Last Modified by: dorihp
# @Last Modified time: 2022-01-07 14:19:15
import json
import time
import cv2
import numpy as np
from onvif import ONVIFCamera
class Detector():
def __init__(self, cfg, weights, classes, input_size):
... |
import ipcalc
import yaml
#this function writes the beginning of the VagrantFile
def BeginVagrantFile(f):
f.write('# webserver and a host you can access the webserver from your browser with ip address 10.0.0.50 or from the host \n')
f.write('# -*- mode: ruby -*-\n')
f.write('# vi: set ft=ruby :\n')
f... |
#!/usr/bin/env python3
import torch
import os
import dgl
import torch.utils.data
import numpy as np
import networkx as nx
from glob import glob
import dgl.function as fn
from torch import nn, optim
from torch.nn import functional as F
from torch.utils.data import DataLoader, Dataset
# changed configuration to this in... |
# -*- coding: utf-8 -*-
import pygame
from pygame.locals import *
import sys, random
BLACK = ( 0, 0, 0)
GREEN = ( 0, 255, 0)
WHITE = (255, 255, 255)
GRAY = (100, 100, 100)
NAVYBLUE = ( 60, 60, 100)
RED = (255, 0, 0)
BLUE = ( 0, 0, 255)
YELLOW = (255, 255, 0)
ORANGE = (255, 1... |
import argparse
import logging
import sys
import os
from resources.config import Config
class Singleton(type):
def __init__(self, *args, **kwargs):
self.__instance = None
super().__init__(*args, **kwargs)
def __call__(self, *args, **kwargs):
if self.__instance is None:
se... |
import csv
import os
import numpy as np
from foods3 import util
from gurobipy import *
county_size = 3109
def optimize_gurobi(supply_code, supply_corn, demand_code, demand_corn, dist_mat):
env = Env("gurobi_spatial_lca.log")
model = Model("lp_for_spatiallca")
var = []
# add constraint for corn prod... |
import json
import argparse
import string
import calendar
import re
from datetime import date
def remove_punctuation(text):
exclude = set(string.punctuation)
return ''.join(ch for ch in text if ch not in exclude)
def cleanup_documents(documents):
dashCharacters = ["-", "\u00ad", "\u2010", "\u2011", "\u2012", "\u20... |
import random
# AI algorithm for two-player games which is for "Hard" option here.
def minimax(predictive_cells, playing_player, play_decide, action):
# Checking for win.
if check(playing_player, predictive_cells):
return 10
# Checking for lose i.e opposition's win.
elif check('O' if playing_p... |
## File for training and evaluation of model
import os
import time
from tqdm import tqdm
import torch
import math
import numpy as np
from torch.utils.data import DataLoader
from torch.nn import DataParallel
from nets.attention_model import set_decode_type
from utils.log_utils import log_values
from utils import move_... |
#
# Copyright (c) 2022 TUM Department of Electrical and Computer Engineering.
#
# This file is part of MLonMCU.
# See https://github.com/tum-ei-eda/mlonmcu.git for further info.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You m... |
import numpy as np
from rvs import Dolly
from math_utils import *
from plot_utils import *
def Pr_Xnk_leq_x(X, n, k, x):
# log(INFO, "x= {}".format(x) )
cdf = 0
for i in range(k, n+1):
cdf += binom_(n, i) * X.cdf(x)**i * X.tail(x)**(n-i)
return cdf
def EXnk(X, n, k, m=1):
if k == 0:
return 0
i... |
#!/usr/bin/env -S python3 -u
"""
Usage: wayland_proxy_parse_xml.py [regex_filter] [regex_ignore] < wayland_proxy.dump
All arguments are optional. If called without arguments everything is logged.
To do some live debugging use something like
./wayland_proxy.py some_app with_some args 2>/dev/null | ./wayland_prox... |
#!/usr/bin/python3
'''
NAME
freshdns - Boost DNS lookup speed by writing records into hosts
SYNOPSYS
freshdns --help
DESCRIPTION
NOTE: Run this script as root. Python >= 3.6 is required.
This script can be used to (1) configure your resolv.conf via terminal
version of dialog; (2) maintain a static looku... |
# coding: utf-8
"""
Tests of the U.S. 1976 Standard Atmosphere implementation. All of them are
validated against the `standard`_.
.. _`standard`: http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19770009539_1977009539.pdf
"""
from __future__ import division, absolute_import
import numpy as np
from numpy.testin... |
import asyncio
import functools
import json
import os
import string
import escapism
from jupyterhub.proxy import Proxy
from jupyterhub.utils import exponential_backoff
from kubernetes_asyncio import client
from traitlets import Unicode
from .clients import load_config
from .clients import shared_client
from .objects ... |
from __future__ import annotations
from typing import TYPE_CHECKING, AsyncIterator, Callable, Generic, ItemsView, Optional, Union, Type, Tuple, List, Dict, Any, Mapping, Sequence
import importlib
import inspect
import sqlalchemy
from sqlalchemy import sql
from subway.models import Model
from subway.app import Applica... |
#!/bin/env python3
#!/opt/local/bin/python3.3
# Copyright (c) 2015-2016 <NAME>, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
import sys, os, shutil
from os.path import join as jp
import subprocess, time, resource
from . import notifications
from .singleton_script import sing... |
# -*- coding: utf-8 -*-
"""
Copyright 2013 <NAME> (AutonomyLab, Simon Fraser University)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless requi... |
import pygame
from pygame.locals import *
import sys
import random
from copy import deepcopy
CELL_WIDTH = 32
CELL = (CELL_WIDTH, CELL_WIDTH)
DISPLAY_WIDTH = 510
DISPLAY_HEIGHT = 610
DISPLAY = (DISPLAY_WIDTH, DISPLAY_HEIGHT)
OFFSET = (20, 50)
SHAPES = [['1111'], ['11', '11'],
['010', '111'], ['110', '011'],
... |
def write_moment1_hybrid(
cube, rms=None, channel_correlation=None,
outfile=None, errorfile=None,
overwrite=True, unit=None,
return_products=True,
strict_vfield=None,
broad_vfield=None,
broad_signal=None,
vfield_prior=None,
vfield_prior_res=None,
... |
#!/usr/bin/env python
# --------------------------------------------------------
# Tensorflow Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>, based on code from <NAME>
# --------------------------------------------------------
"""
Demo script showing detections in sample i... |
#! /usr/bin/env python
#! coding:utf-8
from pathlib import Path
import matplotlib.pyplot as plt
from torch import log
from tqdm import tqdm
import torch
import torch.nn as nn
import argparse
import torch.optim as optim
from torch.optim.lr_scheduler import ReduceLROnPlateau
from sklearn.metrics import confusion_matrix
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Puzzle Solver for Advent of Code 2015 Day 6
Author: <NAME>
Copyright: MIT license
Description (https://adventofcode.com/2015/day/6):
--- Day 6: Probably a Fire Hazard ---
Because your neighbors keep defeating you in the holiday house decorating
contest year after ... |
# Derived from code found at:
# https://github.com/laserson/dsq
# Copyright 2013 Cloudera 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/LICEN... |
from PIL import Image, ImageEnhance, ImageFilter
from datetime import datetime
import pytesseract
import argparse
import cv2
import os
import glob
import pandas as pd
import numpy as np
import string
import random
import math
def strip_punc(s): return s.translate(
str.maketrans('', '', string.punctuation))
def ... |
"""
Defines the base API for the property estimator task calculation backend.
"""
import re
from enum import Enum
from propertyestimator import unit
class ComputeResources:
"""An object which stores how many of each type of computational resource
(threads or gpu's) is available to a calculation worker.
... |
import json
import sqlite3
import docker
import datetime
from flask import render_template, Flask,request
from web.models.models import Drolex
from sqlite3 import Error
from web.database import workdir
from web import app
removed_containers = []
def docker_client():
clientdoc = docker.APIClient(
base_url=... |
#!/usr/bin/env python
"""
MetaWIBELE: abundance_smoothing module
Zero values were additively smoothed by half the smallest non-zero measurement on a per-sample basis and log transform
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of th... |
import networkx as nx
from networkx.algorithms import isomorphism
from networkx.algorithms.approximation import ramsey
import re
import os
import csv
import matplotlib.pyplot as plt
import sys
from networkx.algorithms.traversal.depth_first_search import dfs_tree
from sklearn.cluster import AgglomerativeCluster... |
"""
Path tracking simulation with pure pursuit steering and PID speed control.
author: <NAME> (@Atsushi_twi)
<NAME> (@Gjacquenot)
modified by: <NAME> (@tkortz)
Original source: https://github.com/AtsushiSakai/PythonRobotics/blob/master/PathTracking/pure_pursuit/pure_pursuit.py
"""
import numpy as np
import... |
#------------------------------------------------------------------------------
# Copyright (C) 2009 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including... |
import pandas as pd
import numpy as np
import os
from sklearn import preprocessing
from sklearn.ensemble import RandomForestRegressor
from fbprophet import Prophet
DATA_URL = "https://raw.githubusercontent.com/OxCGRT/covid-policy-tracker/master/data/OxCGRT_latest.csv"
ROOT_DIR = os.path.dirname(os.path.abspath(__file... |
from __future__ import unicode_literals
from django.db import models
from django.utils import timezone
from datetime import datetime
from jsonfield import JSONField
from django.db.models.signals import post_save
from django.dispatch import receiver
from tasks import eval, anon
from django.db import transaction
from dja... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
"""
HTMLElement class used in DOM representation.
"""
# Imports =====================================================================
from ..quoter import escape, unescape
from ..specialdict import SpecialDict
from .shared import NONP... |
import random
def get_location_type(location, board_width):
"""
Returns the type of location passed, according to the width of the board
provided.
"Corner" returns 3.
"Edge" returns 2.
Otherwise returns 1.
"""
corners = (0, board_width - 1)
if location[0] in corners and location[1] in corners:
return 3
i... |
import logging as log
import os, sys, time
import tensorflow as tf
import numpy as np
import reader
flags = tf.app.flags
flags.DEFINE_float('learning_rate', 0.1, 'Initial learning rate.')
flags.DEFINE_integer('max_epochs', 10, 'Maximum number of epochs.')
flags.DEFINE_integer('hidden_dim', 128, 'RNN hidden state siz... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Date: 2015-08-02 18:38:54
# @Last Modified by: <NAME>
# @Last Modified time: 2015-09-28 20:06:48
from django.db import models
# Create your models here.
from datetime import date
import datetime
from django.core.exceptions import ValidationError
fr... |
import gym
import robo_gym
import math
import numpy as np
import pytest
ur_models = [pytest.param('ur3', marks=pytest.mark.nightly), \
pytest.param('ur3e', marks=pytest.mark.nightly), \
pytest.param('ur5', marks=pytest.mark.commit), \
pytest.param('ur5e', marks=pytest.mark.night... |
from homeassistant.const import (
ENERGY_KILO_WATT_HOUR,
ENERGY_WATT_HOUR,
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_POWER,
DEVICE_CLASS_TEMPERATURE,
TEMP_CELSIUS,
POWER_WATT,
)
from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
)
from homeassistant.components.integration.sen... |
from __future__ import print_function
import sys
sys.path = [p for p in sys.path if p.startswith('/')]
__name__ = '__bubble__'
sys.modules[__name__] = sys.modules.pop('__main__')
def debug(msg):
print(msg, file=sys.stderr)
# Reshuffle fds so that we can't break our transport by printing to stdout
import os
infd ... |
import math
import numpy as np
from sklearn.neighbors import KernelDensity
from scipy.signal import argrelextrema
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components
# --------------- Filter line segments with major orientation ---------------
def get_orientation(line)... |
from functools import partial
import numpy as np
import torch
from torch import nn
from counterfactualms.arch.layers import Conv2d, ConvTranspose2d
class HierarchicalEncoder(nn.Module):
def __init__(self, num_convolutions=3, filters=(16,32,64,128,256), latent_dim=100,
input_size=(1,128,128), us... |
""" Pipe-Soil Interaction module """
from math import pi, sin, tan, exp, sqrt, radians
import numpy as np
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
from uhb import general
#########
# GENERAL
#########
def cot(a):
return 1 / tan(a)
def calculate_soil_weight(gamma, D, H):
ret... |
# pylint: disable=C0103,C0111,W0614
from __future__ import print_function
import ida_idaapi
from ida_hexrays import *
from collections import defaultdict
class CEmotetCFF(optblock_t):
def __init__(self):
optblock_t.__init__(self)
self.isOptimize = False
def FindDispatchReg(self, mba):
... |
# MIT License
#
# Copyright (c) 2019 Qumulo
#
# 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, modify, merge, publi... |
import copy
import enum
import logging
from datetime import datetime
import discord
from collections import deque
from functools import total_ordering
from typing import Dict, List, Tuple
from kaztron.driver.stats import MeanVarianceAccumulator
from kaztron.utils.datetime import utctimestamp
logger = logging.getLogg... |
import math
import shahienetal.FluidProperties as FluidProperties
seperator=FluidProperties.Seperator(14.7,60)
def Flow_regime(Nfr, laml, L1, L2, L3, L4):
regime=0
if (((laml <= 0.01) and (Nfr <= L1)) or ((laml >= 0.01) and (Nfr < L2))):
regime = 1
# Regime 2 - Transition flow
if ((laml >= 0... |
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2012-2020 iSolver Software Solutions (C) 2021 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
from __future__ import division, absolute_import, print_function
from builtins import str
#from past.builti... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Example for Petrophysical-Joint-Inversion.
The presented classes are basic versions for demonstration purposes and
without any further syntactic sugar or any input or probability checks.
More advanced version can be find in the pygimli library itself.
"""
import nump... |
from ._utils import normalize_name
from ._expression import expression_from_ast
from .errors import ShakespeareRuntimeError, ShakespeareParseError
from tatsu.ast import AST
class Operation:
def __init__(self, ast_node: AST):
self.ast_node = ast_node
self._setup(ast_node)
def _setup(self, ast_... |
from __future__ import division
import numpy as np
import logging
logger = logging.getLogger(__name__)
__all__ = ['tmvtnorm_sample', 'tmvtnorm_rpy2', 'tmvtnorm_emcee']
def importr_tryhard(packname):
"""
Load R package. If package cannot be loaded then install. If you have problems with this function, try mak... |
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 24 15:53:51 2016
@author: jdorvinen
"""
import numpy as np
def kriebel_dean(w_cm, B, D, W, m, S, T_d, H_b, gamma=0.78):
'''Calculates storm erosion based on the method presented in,
<NAME>., and <NAME>., 'Convolution method for time-dependent
beach-profile ... |
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
import tensorflow as tf
from ccgnet import experiment as exp
from ccgnet.finetune import *
from ccgnet import layers
from ccgnet.layers import *
import numpy as np
import time
import random
from sklearn.metrics import bal... |
"""Special utility functions to use PyGithub with Streamlit."""
import streamlit as st
import functools
import os
import tempfile
import math
import time
import datetime
import shutil
import re
import urllib.parse
from datetime import datetime
from github import Github
from github import NamedUser
from github import C... |
import numpy as np
from math import factorial
from numpy.ma import masked_array
import scipy
from scipy.special import factorial
import scipy.stats as stat
import pdb
#Define Zernike radial polynomials
def rnm(n,m,rho):
"""
Return an array with the zernike Rnm polynomial calculated at rho points.
**ARGUM... |
#!/usr/bin/python3
# Copyright (c) 2015 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, p... |
# -*- coding: utf-8 -*-
import functools, inspect ,logging , os, asyncio,unittest
from urllib import parse
from aiohttp import web
from exception import APIError
def get(path):
'''
Define decorator @get('/path')
:param path:
:return:
'''
def decorator(func):
@functools.wraps(func... |
#!/usr/bin/env python3
#
# Copyright 2018 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.
"""Deploys and runs a test package on a Fuchsia target."""
import argparse
import os
import shutil
import sys
import tempfile
impo... |
import os
import csv
import argparse
import sqlite3
from sqlite3 import Error
# Database Connection
def database_connection(dbfile):
connection = None
try:
connection = sqlite3.connect(dbfile)
except Error as exception:
print(exception)
return connection
def fetch_sql(connection, sq... |
"""
Some convenience classes/functions for querying Horizons
Helps with tests of accuracy in various functions
"""
# import standard packages
# -----------------------------------------------------------------------------
import numpy as np
# import third-party packages
# ---------------------------------------------... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import argparse
import csv
import numpy as np
from keras.models import Model
from keras.layers import Flatten, Input, Dense, Dropout
from keras.layers import Conv1D, MaxPooling1D
from keras.models import load_model
from keras.callba... |
import numpy as np
from numpy import inf
import time
import random
def GS_static(graph, eps, alpha, seed, method ) :
# initial distribution
N = graph.A.shape[0]
y = np.zeros([N,1]); y[seed,0] = 1;
# extract operator and coefficients
if method == 'PageRank':
rho = (1-alpha)
psi = alpha;
OP = graph.P.T
g... |
import os
import unittest
from tempfile import mkstemp
from clips import Environment, Symbol, InstanceName
from clips import CLIPSError, ClassDefaultMode, LoggingRouter
DEFCLASSES = [
"""
(defclass AbstractClass (is-a USER)
(role abstract))
""",
"""(defclass InheritClass (is-a AbstractClass))""... |
#-- coding: utf-8 --
import gc
import pandas as pd
from keras.layers import *
from keras.models import *
from keras.optimizers import *
from keras.utils import multi_gpu_model
from keras.applications.inception_resnet_v2 import preprocess_input
import inception_v4
from tqdm import tqdm
from dataset import *
from config... |
# Copyright 2017 Mycroft AI 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 writin... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from flask import Flask, request, render_template, redirect, url_for, Response
from logging.handlers import RotatingFileHandler
from time import strftime
import traceback
import logging
from flask_bootstrap import Bootstrap
import serve
import sys
import json
#UPLOAD_FOLDER = ... |
"""
calcs a timesheet json array
"""
import json
import csv
from copy import deepcopy
from datetime import datetime
from tabulate import tabulate
def group_items(time_sheet):
"""
group items
"""
def get_work_time_objs_via_item_num(time_sheet, item_num):
"""
returns a li... |
# -*- coding: utf-8 -*-
"""
Catch-up TV & More
Copyright (C) 2019 SylvainCecchetto
This file is part of Catch-up TV & More.
Catch-up TV & More 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 Foundat... |
from datetime import datetime, timedelta
from secrets import randbelow
from typing import Dict
from twitchbot import (
Arena,
ARENA_DEFAULT_ENTRY_FEE,
Command,
Message,
set_currency_name,
get_currency_name,
set_balance,
get_balance,
session,
get_balance_from_msg,
add_balance... |
# © 2020 [<NAME>](mailto:<EMAIL>)
from datetime import datetime
import inspect
import multiprocessing
import os
from pathlib import Path
import sys
import argparse
from .flows.flow import Flow, SimFlow, SynthFlow
from .utils import camelcase_to_snakecase, load_class
import coloredlogs
import logging
import pkg_resourc... |
# Core logic for representing a set of course preferences and a schedule.
# Provided under the terms of the MIT License, as stated in LICENSE.txt.
import re, os
# Helper functions for tabulating conflicts:
# A library function not available in Python 2.6:
def cmp_to_key(mycmp):
'Convert a cmp= function into a ke... |
import torch
import json
import numpy as np
import pandas as pd
from copy import deepcopy
from typing import Union, List, Tuple, Dict
from omegaconf import DictConfig
from dataset.carla_helper import MapHelper
from dataset.exception import FailedProcessing
from dataset.utils import (
distance, rotate_vector, get_... |
import sys
import rlp
from rlp.sedes import CountableList, binary
from rlp.utils import decode_hex, ascii_chr
from ethereum.utils import encode_hex
from ethereum import opcodes
from ethereum import utils
from ethereum.specials import specials as default_specials
from ethereum import bloom
from ethereum import vm as vm
... |
import os
import struct
import sys
import pytest
from bonsai.active_directory.acl import ACL
from bonsai.active_directory.sid import SID
from conftest import get_config
from bonsai import LDAPClient
from bonsai.active_directory import SecurityDescriptor
@pytest.fixture
def client():
""" Create a client with aut... |
from PyQt5.QtGui import QMatrix4x4, QVector3D
import math
__all__ = ['ortho_look_at', 'isometric_projection', 'sphere2cart', 'cart2sphere']
def isometric_projection() -> QMatrix4x4:
"""
Return the isometric perspective projection matrix
:return:
"""
return ortho_look_at(1, 1, 1,
... |
import time
from pkg_resources import resource_filename
from typing import Dict, Union, List, Tuple, Optional, NamedTuple, Set, Iterable, Sequence
import dtale
import dtale.views
import dtale.global_state
from autoplot.extensions.autoplot_display import AutoplotDisplay
from autoplot.extensions.toast import Toast, Toa... |
#-----------------------------------------------------------------------------
"""
Cortex A53 Debug Components
Note 1: The "cortex a53" name is probably overly specific here.
Maybe it should be armv8 or aarch64 or something....
Note 2: I'm supporting the bcm49408 chip which Broadcom calls a "B53" and
says is derived... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... |
from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404
from activity.models import Activity
from playexo.models import Answer
from datetime import date
@login_req... |
import sqlalchemy as sa
from sqlalchemy.orm import relationship, backref, object_session
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.ext.declarative import declarative_base
from storm.database import mptt
Model = declarative_base()
class Location(mptt.MPTTBase, Model):
"""
... |
import matplotlib.pyplot as plt
import random
import os
import numpy as np
import tensorflow as tf
import logging
from load_data import load_train_data, load_data_by_id, load_entity_by_id, \
load_candidates_by_id, load_mention_entity_prior2, load_entity_emb, load_voting_eid_by_doc, \
get_embeddi... |
import warnings
import pandas as pd
import numpy as np
import tensorflow as tf
from tensorflow import math as tfm
import anndata
from .utils import print_func
from .utils.float_limits import check_range_exp
# Preprocessing functionalities
def preprocess(adata,
prepro_func='none',
transf... |
# Copyright (c) 2017. Mount Sinai School of Medicine
#
# 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 o... |
#!/usr/bin/env python
# Copyright (c) 2015-2018 by the parties listed in the AUTHORS file.
# All rights reserved. Use of this source code is governed by
# a BSD-style license that can be found in the LICENSE file.
import argparse
import datetime
import os
import re
import sys
import traceback
import numpy as np
fr... |
#!/usr/bin/env python3
#
# This file is part of GreatFET
from __future__ import print_function
import argparse
import errno
import sys
import time
import os
import array
import tempfile
import threading
# Temporary?
import usb
from zipfile import ZipFile
import greatfet
from greatfet import GreatFET
from greatfet... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.