text stringlengths 3.07k 12.6k |
|---|
'''
Turbulence analysis of incompressible fluids.
'''
import networkx as nx
import numpy as np
import pdb
import os
import shutil
from itertools import count
import colorcet as cc
import random
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm, Normalize
import seaborn as sns
from scipy.spatial.dis... |
#
# Copyright 2018 Analytics Zoo 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 law or agreed to... |
from typing import Optional
import re
from talon.experimental.textarea import (
TextArea,
Span,
DarkThemeLabels,
LightThemeLabels
)
word_matcher = re.compile(r"([^\s]+)(\s*)")
def calculate_text_anchors(text, cursor_position, anchor_labels=None):
"""
Produces an iterator of (anchor, start_wor... |
"""
TODO: This really needs a rewrite, this was copied of working jupyter notebooks to get a working implementation of the recommender
"""
import sqlite3
import pickle
import torch
import numpy as np
import pandas as pd
from functools import partial
from glob import glob
from fastai.collab import *
from fastai.tabul... |
# coding=utf-8
import re
from lxml import etree
from . import exceptions
class Node(object):
"""Node factory."""
def __new__(cls, name, value=None, parent=None, **kwargs):
"""Override create instance.
:param name: name of node.
:param value (optional): `str` text of node.
... |
import abc
import inspect
import typing
from ..handler import Handler, FilterObj
class FilterNotPassed(Exception):
pass
def wrap_async(func):
async def async_wrapper(*args, **kwargs):
return func(*args, **kwargs)
if inspect.isawaitable(func) \
or inspect.iscoroutinefunction(func) \... |
""" Routes of Flask Web Application """
import os
import csv
import threading
import shelve
from pathlib import Path
from flask import render_template, request, jsonify, url_for
from lie_to_me import app, video, basedir
from lie_to_me.process import process_video, process_audio, cleanup_uploads, predict
video_file_nam... |
"""Fix colors of images by stretching their channel histograms to full
range."""
import click
from PIL import Image
import numpy as np
from ..param import COLOR
DEFAULT_LEVEL = 0.01
def _quantiles_iter(img, level):
assert img.mode == "RGB"
assert level > 0 and level < 1
h = img.histogram()
for i i... |
'''
MFEM example 5
See c++ version in the MFEM library for more detail
'''
from mfem import path
import mfem.ser as mfem
from mfem.ser import intArray
from os.path import expanduser, join
import numpy as np
from numpy import sin, cos, exp
#### time.clock deprecated and removed in PY3.8
import time
try:
clo... |
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import FigureCanvas
from skimage import measure
import numpy as np
import napari
def profile_line(viewer):
# get top-most, visible image layer
def get_image_layer():
for layer in viewer.layers:
if isinstance(layer, nap... |
'''
When deleting host, if VR is that host. The VR VM should be migrated to other host, if there is any host has the same L2.
@author: Youyk
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpec... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules import Transformer
class SynPG(nn.Module):
def __init__(self, vocab_size, em_size, word_dropout=0.4, dropout=0.1):
super(SynPG, self).__init__()
self.vocab_size = vocab_size
self.... |
import torch
import torch.distributed as dist
from torch.autograd.function import Function
class SyncBatchNorm(Function):
@staticmethod
def forward(self, input, weight, bias, running_mean, running_var, eps, momentum, process_group, world_size):
input = input.contiguous()
count = torch.empty(... |
# Added generating of new version for each DX Compiler build.
# There are 3 kinds of version:
# 1. **Official build**
# Built by using `hctbuild -official`. The version is based on the current DXIL version, latest official
# release and a number of commits since then. The format is `dxil_major.dxil_minor.release_no.... |
# Copyright 2021 The Brax 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 law or agreed to in wri... |
'''
Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related docu... |
import tensorflow as tf
import numpy as np
import larq as lq
from larq import utils
from copy import deepcopy
@utils.register_keras_custom_object
class XavierLearningRateScaling(tf.keras.optimizers.Optimizer):
"""Optimizer wrapper for Xavier Learning Rate Scaling
Scale the weights learning rates respectivel... |
"""
Replay Parsing
~~~~~~~~~~~~~~
World of Tanks replay parsing and information extraction
"""
import json
import struct
import pickle
from copy import copy
from .constants import WOT_TANKS
def parse_replay(replay_blob):
"""
Parse the replay file and return the extracted information as Pyth... |
"""
Defines the tbmodels command-line interface.
"""
import os
from collections.abc import Iterable
from functools import singledispatch
import click
import bands_inspect as bi
import symmetry_representation as sr
from . import Model
@click.group()
def cli():
pass
def _output_option(**kwargs):
return cli... |
r"""undocumented"""
import torch.nn as nn
import torch
from torch.nn import LayerNorm
import torch.nn.functional as F
from typing import Union, Tuple
from ...core.utils import seq_len_to_mask
import math
from ...modules.encoder.lstm import LSTM
from fastNLP.modules.attention import MultiHeadAttention
from ...embeddings... |
"""Copyright 2020 Google LLC
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
dis... |
from inspect import getfile
from numbers import Number
from os.path import realpath
from pathlib import Path
from typing import Dict, Iterable, AnyStr, Sequence
from typing import Union
from ppb import Vector
from ppb.events import EventMixin
TOP = "top"
BOTTOM = "bottom"
LEFT = "left"
RIGHT = "right"
error_message... |
import os
import json
import time
from datetime import datetime
from django.conf import settings
from django import template
from django.template.loader import get_template
from django.template import TemplateSyntaxError
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.core.serializers... |
import enum
import time
from authlib.integrations.sqla_oauth2.client_mixin import OAuth2ClientMixin
from authlib.integrations.sqla_oauth2.tokens_mixins import TokenMixin
from sqlalchemy import Boolean, Column, Enum, ForeignKey, Index, Integer, String, Text
from sqlalchemy.orm import relationship
from anchore_engine.d... |
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 27 14:27:19 2018
@author: nashere2
"""
import pytest
import numpy as np
import scipy.stats as spstats
from .. import arraymultinomial as am
def multinomial_mean(N, Pis):
N = np.array(N)
am.check(N, Pis)
return N*Pis
def multinomial_var(N, Pis):
N = np... |
from tokens import *
from utils import is_digit, is_alpha
# Scanner
class Scanner():
source = ""
length = 0
start = 0
current = 0
line = 1
column = 1
scanner = Scanner()
# Keywords tokens
keywords = {
"else": TOKEN_ELSE,
"false": TOKEN_FALSE,
"for": TOKEN_FOR... |
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Python
import logging
import os
import signal
import time
from uuid import UUID
from multiprocessing import Process
from multiprocessing import Queue as MPQueue
from Queue import Empty as QueueEmpty
from Queue import Full as QueueFull
from kombu import Conne... |
import os
import re
import time
import requests
from flask import Flask, request
from github import Github
GITHUB_API_URL = 'https://api.github.com/'
app = Flask(__name__)
GITHUB_TOKEN = os.environ['GITHUB_TOKEN']
BLOCK_PATTERN = re.compile('\[#.+\]', flags=re.DOTALL)
ISSUE_PATTERN = re.compile('#[0-9]+')
QUOTES ... |
# David.Clark (a) CIBER-research.eu 2012-12-20
# CIBER Research Ltd.
# version 10 hybrid for both clarity and optimisation, + bug fix.
# this code is online at
# http://code.activestate.com/recipes/576479/
""" Create a digital trie of ipranges(CIDR); for a given ip
determine membership of smallest CIDR (if any... |
import argparse
import logging
import os
import sys
import zipfile
from . import __version__ as current_version
from .lib import extent
from .lib import helpfunctions as hf
logging.basicConfig(level=logging.WARNING)
logger = logging.getLogger("geoextent")
help_description = '''
geoextent is a Python library for extra... |
import io
import os
import numpy as np
import pytest
import asdf
from asdf import compression
from asdf import generic_io
from ..tests import helpers
def _get_large_tree():
np.random.seed(0)
x = np.random.rand(128, 128)
tree = {
'science_data': x,
}
return tree
def _get_sparse_tr... |
# encoding: utf-8
"""Shared DB-API test cases"""
from __future__ import absolute_import
from __future__ import unicode_literals
from builtins import object
from builtins import range
from future.utils import with_metaclass
from avanthive import exc
import abc
import contextlib
import functools
def with_cursor(fn):
... |
from torch import nn
from .base_models import BaseEncoderMaskerDecoder
from asteroid_filterbanks import make_enc_dec
from asteroid_filterbanks.transforms import mag, magreim
from ..masknn import norms, activations
from ..utils.torch_utils import pad_x_to_y
import warnings
class DeMask(BaseEncoderMaskerDecoder):
"... |
"""Requests used to support the namex API
TODO: Fill in a larger description once the API is defined for V1
"""
from flask import request, jsonify, g # _request_ctx_stack
from flask_restplus import Resource, fields, cors
from marshmallow import ValidationError
from app import api, auth_services, oidc
from app.models i... |
#
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# 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,... |
"""Django Views for the termsandconditions module"""
# pylint: disable=E1120,R0901,R0904
from django import VERSION as DJANGO_VERSION
from django.contrib.auth.models import User
from django.db import IntegrityError
from .forms import UserTermsAndConditionsModelForm, EmailTermsForm
from .models import TermsAndConditio... |
import json
import os
import altair as alt
import foursquare
import pandas as pd
import streamlit as st
from datetime import datetime
from typing import List
# @st.cache()
def get_foursquare_data(foursquare_token):
# TODO: move it to another wrapper
# TODO: check the lifecycle of streamlit
cache_filen... |
# Copyright (c) 2020 Sony Corporation. 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 applicabl... |
from flask import render_template,redirect, url_for, request, flash, session, make_response
from werkzeug.security import generate_password_hash, check_password_hash
from app import app
from models import *
global COOKIE_TIME_OUT
COOKIE_TIME_OUT = 1800 #30 minutes timeout
#WELCOME PAGE
@app.route("/")
def base():
... |
from time import time
from PyQt5.QtCore import (
Qt, QTime, QTimer
)
from PyQt5.QtGui import (
QFont, QDoubleValidator, QIntValidator
)
from PyQt5.QtWidgets import (
QApplication, QWidget,
QHBoxLayout, QVBoxLayout,
QGroupBox, QRadioButton,
QPushButton, QLabel, QListWidget, QLineEdit
... |
#!/usr/bin/env python3
#
# Copyright 2021 Spotify AB.
#
# 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 applicabl... |
import math
import torch
import torch.nn as nn
class PositionwiseFeedForward(nn.Module):
""" A two-layer Feed-Forward-Network with residual layer norm.
Args:
size (int): the size of input for the first-layer of the FFN.
hidden_size (int): the hidden layer size of the second-layer
... |
import numpy as np
from functools import partial
import scipy.constants
from lumicks.pylake.force_calibration.detail.power_models import (
sphere_friction_coefficient,
passive_power_spectrum_model,
g_diode,
)
from lumicks.pylake.force_calibration.detail.hydrodynamics import (
passive_power_spectrum_mode... |
#!/usr/bin/env python3
__author__ = '<NAME>'
import argparse
import csv
import os
import pickle
import sys
from multiprocessing import cpu_count
import numpy as np
from gensim.models.word2vec import Word2Vec
from batch_sim.nn_vec import nn_vec
from projlearn import MODELS
parser = argparse.ArgumentParser(descripti... |
"""Module for generating the test results file fed into the perf plugin."""
from __future__ import absolute_import
from __future__ import division
import collections
import datetime
import glob
import json
import os
import re
from buildscripts.resmokelib import config as _config
from buildscripts.resmokelib.testing.... |
"""
This migration script removes the library_id & folder_id fields in the 'request' table and
adds the same to the 'sample' table. This also adds a 'datatx' column to request_type table
to store the sequencer login information. Finally, this adds a 'dataset_files' column to
the sample table.
"""
from __future__ import... |
from typing import Callable, Generator, List, Optional, Union
import pytest
from ..pipeline import Pipeline
from ._meta import _Meta
from ._no_return import _NoReturn
from ._return import _Return
def test_returns():
r = _Return([int, str], _Meta(x=bool))
assert str(r) == "((<class 'int'>, <class 'str'>), {'... |
from __future__ import unicode_literals
import re
from django.db import models
from django.dispatch import receiver
# fs = FTPStorage()
VOICE_PROPERTIES = (
('intelligibility', 'Intelligibility'),
('naturalness', 'Naturalness'),
('overall', 'Overall')
)
QUESTION_TYPE = (
(1, 'DRT'),
(2, 'MRT')... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
from os.path import basename
import io
import sys
import logging
import time
import subprocess
import rpy2
import rpy2.robjects as robjects
import rpy2.robjects.packages as rpackages
from Bio import Phylo, SeqIO
from Scoring... |
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponseRedirect
from django.db import transaction
from django.db.models import Min,Max
from django.core.urlresolvers import reverse
from browseNet.models import Smb, Share, Path
from search.models import File, Host
import ... |
# -*- coding: utf-8 -*-
"""
Tests for various autodetection magics for CSV imports
"""
import codecs
from odoo.tests import common
class ImportCase(common.TransactionCase):
def _make_import(self, contents):
return self.env['base_import.import'].create({
'res_model': 'base_import.tests.models.c... |
__copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
import gzip
from typing import Tuple, Optional
import numpy as np
from jina.executors.indexers import BaseVectorIndexer
class NumpyIndexer(BaseVectorIndexer):
"""An exhaustive vector indexers implemented with n... |
# -*- coding: utf-8 -*-
from collections import deque
from functools import partial
from math import sqrt
from ..errors import ArgumentError, InternalError, ModelError
from .. import compat
__all__ = [
"CALCULATED_AGGREGATIONS",
"calculators_for_aggregates",
"available_calculators",
"aggregate_calcul... |
import itertools
from tempfile import NamedTemporaryFile
import os
from numpy.testing import assert_array_equal
import numpy as np
from ecogdata.expconfig.exp_descr import StimulatedExperiment, ordered_epochs
def _gen_exp(n_cond=2, rep=(), rdims=()):
x = np.arange(100)
e_values = [np.random.choice(x, (i+2)*2... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import repeat
from timm.models.layers import StdConv2dSame
from timm.models.resnetv2 import ResNetV2
from timm.models.vision_transformer import VisionTransformer
from timm.models.vision_transformer_hybrid import HybridEmbed
from x_transforme... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
xmind.core.workbook
~~~~~~~~~~~~~~~~~~~
:mod:``xmind.core.workbook`` implements the command XMind
manipulations.
:copyright:
:license:
"""
__author__ = "<EMAIL> <<NAME>>"
from . import Document
from . import const
from .mixin import Workboo... |
from jinja2 import Template, Environment, FileSystemLoader
from yaml import safe_load
from typing import List
import os
# Some constants
ROOT_DIR = os.path.join("..", "..")
DOCS_DIR = os.path.join(ROOT_DIR, "docs/")
LANG_DIR = os.path.join(ROOT_DIR, "lang/")
SPECIFICATION_FILE = os.path.join(ROOT_DIR, "spec.yaml")
JI... |
from nltk.corpus import wordnet
from nltk.corpus import semcor
import argparse
#debug function to print out the matrix
#taken from https://stackoverflow.com/questions/13214809/pretty-print-2d-python-list
def print_matrix(matrix):
s = [[str(e) for e in row] for row in matrix]
lens = [max(map(len, col)) for col in zi... |
import pytest
import tests.common as common
import nomad
import json
import os
from nomad.api import exceptions
@pytest.fixture
def nomad_setup():
n = nomad.Nomad(host=common.IP, port=common.NOMAD_PORT,token=common.NOMAD_TOKEN, verify=False)
return n
# integration tests requires nomad Vagrant VM or Binary r... |
# video-editor.py
#
# 機能:任意の場所で複数箇所のトリミングをして、自由に結合できる
#
# コマンド一覧
# trim a b (c) : aからbまでトリミング。cという名前で保存する(省略可)
# rename a b : トリミングしたaをbという名前に変更
# concat a b (c) : aの後にbを連結する。cという名前で保存する(省略可)
# del a : aを削除する
# show : トリミングしたファイル一覧
# play a : aを再生
import os
from glob import glob
from subprocess import PI... |
##----------------------------------------------------------------------------##
## eztools/ezdeps/action.py ##
## ##
## This file is distributed under the MIT License. ... |
import sublime_plugin
from ..libs import *
from ..libs.view_helpers import *
from ..libs.reference import *
from .base_command import TypeScriptBaseTextCommand
class TypescriptFindReferencesCommand(TypeScriptBaseTextCommand):
"""Find references command"""
def run(self, text):
check_update_view(self.v... |
""" Ontology builder! Reads a csv file with (minimally) these columns: Label, Code, Parent_Code, Type and outputs an i2b2 ontology file. Filenames are hardcoded right now, should be runtime parameters (TODO!).
This is a recursive ontology builder, which I have not maintained because I needed a version where I could ex... |
## Portions of Code from, copyright 2018 <NAME>
from __future__ import absolute_import, division, print_function
import logging
import colorama
import tqdm
TQDM_SMOOTHING = 0
def create_progressbar(iterable,
desc="",
train=False,
unit="it",
... |
import pytest
import os
import torch
import sys
sys.path.append(".")
import src
#from src import RLRC_dataloader
from src.RLRC_dataloader import (
get_bert_tokenizer, input_data, get_entity_mask, get_BertData, generate_BertData, get_dataloader)
from src.RLRC_Bert_model import RC_BERT
import logging
import pandas a... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
AUTHOR
- <NAME> <<EMAIL>>
- <NAME> <<EMAIL>>
DESCRIPTION
This module provide routines to deal with annotation in TextGrid or HTK label formats
LICENSE
See https://github.com/asuni/wavelet_prosody_toolkit/blob/master/LICENSE.txt
"""
def read_textgrid... |
from discord.ext import commands
import discord
import asyncio
import random
timer = 60
campaign_running = False
@commands.command()
async def beginnerCampaign(ctx):
await ctx.channel.send(f"{timer} SECONDS TO JOIN THE ADVENTURE\n"
f"JOIN USING !joinAdventure")
campaign_running = Tr... |
import io
import os
import sys
import time
import random
import datetime
import numpy as np
import database as db
import mysql.connector
from slackclient import SlackClient
ideal_lunch_time = "15:30"
friday_index_elem = 4
saturday_index_elem = 5
sunday_index_elem = 6
help_text = '''
You can ask me the following:
... |
"""
Module from EPFL-VILAB/XTConsistency
https://github.com/EPFL-VILAB/XTConsistency/blob/master/modules/unet.py
"""
import os, sys, math, random, itertools
import numpy as np
from PIL import Image
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import datasets, transforms, models... |
# Copyright 2020 JD.com, Inc. Galileo 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 a... |
import numpy as np
from scipy.sparse import isspmatrix, csc_matrix, csr_matrix
import sklearn.preprocessing
from .utils import MessagePrinter
import markov_clustering.c_mcl as c_mcl
import cython_sparse as cs
def normalize(matrix):
if isspmatrix(matrix):
assert type(matrix) == csc_matrix, "only csc format... |
from __future__ import unicode_literals
import uuid
import requests
import geocoder
from datetime import datetime, timedelta
from libband import layouts, settings
from libband.notifications import NotificationTypes, Notification
from libband.tiles import WEATHER
from .app import App
PAGE_IDS = [
uuid.UUID("76150e... |
import numpy as np
import cvxpy as cp
import numba
from imhist import imhist
def imhblpce(image):
[h, w] = image.shape
hist_image = imhist(image)
PMFx = hist_image / (h*w)
# CDFx = np.cumsum(PMFx)
r = (PMFx>0) * np.arange(1, 257)
r = r[r>0]
r_inv = np.where(PMFx==0, PMFx, np.ones_like(PMFx... |
"""The :mod:`evaluation` module defines classes to evaluate program CodeBlocks."""
from abc import ABC, abstractmethod
from typing import Sequence, Union, Callable
from collections import defaultdict
import numpy as np
import pandas as pd
from pyshgp.push.interpreter import PushInterpreter, Program
from pyshgp.tap imp... |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from pmdarima.compat.pytest import pytest_warning_messages, pytest_error_str
from pmdarima.arima import _validation as val
from pmdarima.warnings import ModelFitWarning
@pytest.mark.parametrize(
'ic,ooss,expect_error,expect_warning,expected_val', [
... |
import os
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
import math
def region_of_interest_v1(img, vertices):
mask = np.zeros_like(img)
channel_count = img.shape[2]
match_mask_color = (255,) * channel_count
cv2.fillPoly(ma... |
from abc import ABCMeta, abstractmethod, abstractproperty
from typing import Callable, Dict, List, Union
from ppq.core import OperationMeta, TargetPlatform, TensorQuantizationConfig
from ppq.executor.op import (DEFAULT_BACKEND_TABLE, EXTENSION_BACKEND_TABLE,
NXP_BACKEND_TABLE, PPL_DSP_BACK... |
#!/usr/bin/env python3
import numpy as np
import sys
sys.path.append('../../..')
from neml import models, interpolate, elasticity, history
from neml.cp import hucocks, crystallography, sliprules, slipharden, inelasticity, kinematics, singlecrystal, polycrystal
from neml.math import rotations
def make_singlecrystal(... |
# coding: utf-8
# # Test.py
# To predict the vein image based on leaf.
# In[114]:
import os
import sys
import numpy as np
import tensorflow as tf
from PIL import Image, ExifTags
import matplotlib.pyplot as plt
from keras.models import Model, load_model
import keras.backend as K
from keras.initializers import Ini... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from R import *
from DF import *
import Reglas as reglas
import Utils as utils
import json
import time
r = R()
# Funcion para eliminar espacios en blanco de los datos recibidos
def trimData(dfStr):
array = dfStr.split(',')
for i in range(0, len(array)):
array[i] = ar... |
from __future__ import annotations
from time import sleep
import logging
import xarray
import numpy as np
from picamera import PiCamera
import picamera.array
from .utils import sixteen2eight
KEY = "imgs" # handle to write inside the output file
REDGAIN = 1.0
BLUEGAIN = 1.0
ISO = 100
def _outconv(cam, Nimg: int, i... |
import sqlite3
from datetime import datetime
#########################################################################
# Set up Database
#########################################################################
# Source:
# http://sebastianraschka.com/Articles/2014_sqlite_in_python_tutorial.html
sqlite_file = 'bankap... |
# Lint as: python3
# Copyright 2020 The Bazel 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 requir... |
# Copyright (c) 2019 UAVCAN Consortium
# This software is distributed under the terms of the MIT License.
# Author: <NAME> <<EMAIL>>
from __future__ import annotations
import typing
import itertools
import dataclasses
from ._frame import FrameFormat
@dataclasses.dataclass(frozen=True)
class FilterConfiguration:
... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
# 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
# d... |
import logging
from typing import Callable, Union, Any, TYPE_CHECKING, Type
from numbers import Number
import numpy as np
from scipy.interpolate import interp1d # type: ignore
from scipy.integrate import cumulative_trapezoid, trapz # type: ignore
from math_signals.defaults.base_structures import BaseXY, Typ... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
from numpy import sum, asarray, arange, exp
from .go_benchmark import Benchmark
class JennrichSampson(Benchmark):
r"""
Jennrich-Sampson objective function.
This class defines the Jennrich-Sampson [1]_ global optimi... |
from yolo_top import yolov3
import numpy as np
import tensorflow as tf
from config import cfg, ckpt_dir, testset, result_dir, score_threshold
from PIL import Image, ImageDraw, ImageFont
from draw_boxes import draw_boxes
import cv2
import matplotlib.pyplot as plt
import os
import glob
import xml.etree.cElementTree as ET... |
import unittest
from typing import Optional, Tuple, Any
from clvm.SExp import SExp, looks_like_clvm_object, convert_atom_to_bytes
from clvm.CLVMObject import CLVMObject
def validate_sexp(sexp):
validate_stack = [sexp]
while validate_stack:
v = validate_stack.pop()
assert isinstance(v, SExp)
... |
import os
import sys
import random
import math
import numpy as np
import skimage.io
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import pickle
import cv2
from flask import Flask, render_template, jsonify, request, redirect, url_for, flash
# os.chdir("C:/Users/<NAME>/Documents... |
import re
from typing import List, Dict, Union
_DEFAULT_INDEX_ALPHABET = {
0: "[C]",
1: "[Ring1]",
2: "[Ring2]",
3: "[Branch1]",
4: "[=Branch1]",
5: "[#Branch1]",
6: "[Branch2]",
7: "[=Branch2]",
8: "[#Branch2]",
9: "[O]",
10: "[N]",
11: "[=N]",
12: "[=C]",
13: ... |
"""
Randomized smooothing certification. Based on code from
https://github.com/locuslab/smoothing
"""
from math import ceil
import numpy as np
import torch
import torch.nn
import torch.nn.functional as F
from scipy.stats import binom_test, norm
from statsmodels.stats.proportion import proportion_confint
def quick_s... |
from flask.views import MethodView
from flask import make_response, request, jsonify
from flask_jwt_extended import (
create_access_token,
create_refresh_token,
jwt_required,
jwt_refresh_token_required,
get_jwt_identity,
get_raw_jwt,
)
from .model import User, RevokedToken
class Register(Metho... |
'''
Api for planet and tags
'''
from tastypie.exceptions import InvalidFilterError
from tastypie.constants import ALL
import tastypie.fields as fields
from apis.resources.base import BaseResource
from planet.models import Feed, Post
from mks.models import Member
from links.models import Link
from tagging.models import... |
# Copyright 2020 <NAME>
# SPDX-License-Identifier: Apache-2.0
import os.path
import pickle
import typing
import numpy
from .. import data_loading, game_map
from ..rff import RFF
class Header(data_loading.CustomStruct):
version: data_loading.UInt32
tile_count: data_loading.UInt32
tile_start: data_loadin... |
"""
Utility functions for reading/cleaning images and generators
"""
import numpy as np
import keras
import matplotlib.pyplot as plt
import os
import numpy as np
import time
import pandas as pd
import geopandas as gp
import tensorflow as tf
import rtree
import argparse
import glob
import cv2
from keras_retinanet impor... |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2019 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from pymor.core.interfaces import BasicInterface
from pymor.grids.oned import OnedGrid
from pymor... |
#!/usr/bin/python
# -*- coding:utf8 -*-
"""
@author:<NAME>
@time:10/28/18
"""
import re
import os
import codecs
import random
import tempfile
import numpy as np
import subprocess
from NRE.utils.vocab import Vocab
PAD_TOKEN = '<PAD>' # This has a vocab id, which is used to pad the encoder input, decoder inpu... |
"""
Script to create output/js/data-model.js file, using data-model_template.js file as mako template.
Usage (if all input files are ready to go in input/ directory):
> python create_data_model.py
If using from within a python script to create the input variables directly:
> from create_data_model import DataMode... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.