text stringlengths 3.07k 22.1k |
|---|
from datetime import datetime
from decimal import Decimal
from time import mktime, strftime, strptime, localtime
from faker import Faker
import random
import constantes
def max_number(precision, scale):
"""Devuelve el número máximo que se puede generar con la precisión indicada.
Ejemplo: si precision == 3,... |
#!/bin/python2
from __future__ import print_function
from gensim.parsing.preprocessing import strip_non_alphanum, preprocess_string
from gensim.corpora.dictionary import Dictionary
from keras.models import load_model
import numpy as np
import os
import subprocess
try:
input = raw_input
except NameError:
pass
t... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# 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,... |
from tensorflow.python.ops import math_ops
from tensorflow.python.framework import ops
from tensorflow import keras
from tensorflow.keras import backend as K
import numpy as np
import pickle as pkl
def top3_acc(labels, logits):
return keras.metrics.sparse_top_k_categorical_accuracy(y_true=labels, y_pred=logits, k... |
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
EXAMPLE - CALCULATOR
Simple calculator app.
"""
__all__ = ['main']
import pygame
import pygame_menu
from pygame_menu.examples import create_example_window
from typing import Union, List
class CalculatorApp(object):
"""
Simple calculator app.
"""... |
# _ __
# | |/ /___ ___ _ __ ___ _ _ ®
# | ' </ -_) -_) '_ \/ -_) '_|
# |_|\_\___\___| .__/\___|_|
# |_|
#
# <NAME>
# Contact: <EMAIL>
#
from urllib.parse import urlparse, urlunparse
import logging
import json
from pprint import pformat
from json import JSONDecodeError
from base64 import ... |
import collections
from dataclasses import dataclass, field
import functools
import logging
from pathlib import Path
import re
from typing import Dict
from lupa import LuaError, LuaRuntime
from factoratio.fuel import Fuel
import factoratio.item as item
logger = logging.getLogger('factoratio')
@dataclass
class Proto... |
# Note these functions are similar to, but separate from name/title mungers
# found in the ckanext importer. That one needs to be stable to prevent
# packages changing name on reimport, but these ones can be changed and
# improved.
import re
import os.path
from ckan import model
def munge_name(name):
'''Munges ... |
from unittest import mock
from io import StringIO
from contextlib import contextmanager
from ndopapp.logging import PipeFormatter, record_factory
import unittest
import logging
import json
import os
import copy
class PipeFormatterTest(unittest.TestCase):
@staticmethod
def create_logger(*formatter_args, **fo... |
from __future__ import print_function
import boto3
from boto3.dynamodb.conditions import Key, Attr
from botocore.exceptions import ClientError
import datetime
import decimal
import inflect
import json
import os
import re
import requests
print('Loading function')
debug = os.getenv('DEBUG', 'false')
taco_name = os.get... |
import os
from os import listdir, makedirs
from os.path import join
import pickle
import cv2
import matplotlib.pyplot as plt
import numpy as np
# from moviepy.video.io.ImageSequenceClip import ImageSequenceClip
import src.data.constants as c
import src.data.utils.utils as utils
BLOCK_SIZE = 5
C = 14
DIR = c.RAW_DA... |
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
from dataclasses import dataclass
from datetime import datetime
from pathlib import Path
from sys import exc_info
from ... |
import argparse
import logging
import threading
from pathlib import Path
from typing import Union, Dict
from HPOBenchExperimentUtils import _log as _root_log
from HPOBenchExperimentUtils.core.nameserver import start_nameserver
from HPOBenchExperimentUtils.core.scheduler import Scheduler, Content
from HPOBenchExperimen... |
import sys
from os import path
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import QLabel
from PyQt5.QtWidgets import QMainWindow
from PyQt5.QtWidgets import QStatusBar
from PyQt5.QtWidgets import QToolBar
from PyQt5.QtWidgets import QAction, QCheckBox, QComboBox, QDockWidget, QFileDialog, QGraphicsVi... |
import sys
import csv
import datetime
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from matplotlib.ticker import MultipleLocator, FormatStrFormatter, AutoMinorLocator
import numpy as np
import os
import argparse
import json
kbps = [1410237, 3720740, 696126... |
import os
import importlib
import warnings
import yaml
import requests
from GCR import BaseGenericCatalog
__all__ = ['has_catalog', 'get_catalog_config', 'get_available_catalogs', 'load_catalog']
_CONFIG_DIRNAME = 'catalog_configs'
_GITHUB_URL = 'https://raw.githubusercontent.com/LSSTDESC/gcr-catalogs/master/GCRCata... |
"""
Support for recording details.
Component that records all events and state changes. Allows other components
to query this database.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/recorder/
"""
import logging
import queue
import threading
import tim... |
# used by GameKey
import nhlscrapi.constants as C
from nhlscrapi._tools import build_enum
# used by Game
from nhlscrapi.games.toi import TOI
from nhlscrapi.games.rosters import Rosters
from nhlscrapi.games.playbyplay import PlayByPlay
from nhlscrapi.games.faceoffcomp import FaceOffComparison
from nhlscrapi.games.even... |
import json
from django.conf.urls import patterns, url
from django.contrib import admin
from django.contrib.admin.options import InlineModelAdmin
from django.contrib.admin.util import unquote, get_deleted_objects
from django.core.exceptions import PermissionDenied
from django.db import router
from django.http import H... |
from gui.creator import load_bot_config
from gui.creator import load_building_pos
from gui.creator import write_building_pos, write_bot_config
from gui.creator import button
from tkinter import Label, Frame, Text, Scrollbar, Canvas, LabelFrame, Toplevel, Entry, Button
from tkinter import N, W, END, NSEW, INSERT, LEFT
... |
from typing import Any, ClassVar, Dict, Optional, Tuple, cast
import kornia.augmentation as aug
import numpy as np
import torch
import torch.nn as nn
from kornia.color.hsv import hsv_to_rgb, rgb_to_hsv
from .base import Augmentation
class RandomShift(Augmentation):
"""Random shift augmentation.
References:... |
# -*- coding: utf-8 -*-
r"""
Grid View Adapter for tableaux
**Grid View tableau operations:**
.. csv-table::
:class: contentstable
:widths: 30, 70
:delim: |
:meth:`~TableauGridViewAdapter.compute_cells` | Compute tableau cells as a dictionary { coordinate pair : Integer }
:meth:`~TableauGridViewA... |
import os
import logging
import yaml
import numpy as np
from matplotlib import pyplot as plt
# import pandas as pd
# import scipy
import LCTM.metrics
from kinemparse import decode
from mathtools import utils # , metrics
# from blocks.core import blockassembly
logger = logging.getLogger(__name__)
def eval_metri... |
#!/usr/bin/env python
'''Generate a static version of oldnyc.org consisting entirely of JSON.'''
import chardet
from collections import defaultdict, OrderedDict
import csv
import json
import record
import re
from distutils.dir_util import copy_tree
from shutil import copyfile
import subprocess
import sys
import time
i... |
# Fully connected layer network. Applying pathnorm to it
import tensorflow as tf
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
from NeuralNet import *
from cifar10_input import *
from sklearn.preprocessing import OneHotEncoder
from keras.utils import to_categorical
import pandas as pd
i... |
import os
import re
import numpy as np
import trimesh
def save_mesh(mesh, save_path):
if isinstance(mesh.visual, trimesh.visual.texture.TextureVisuals):
save_path = os.path.join(os.path.dirname(save_path),
os.path.basename(os.path.splitext(save_path)[0]),
... |
# -*- coding: utf-8 -*-
from django import forms
from django.contrib import admin
from django.contrib.admin.utils import flatten_fieldsets
from django.http import HttpResponseRedirect
from django.utils.encoding import force_unicode
from django.utils.translation import ugettext_lazy as _
from boris.services.models.core... |
#!/usr/bin/python
#
# Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
A `SubvolumeSet` maps path subtrees to `Subvolume`s. Therefore, it only
knows how to apply the initial `SendStreamI... |
# Copyright 2020 <NAME>
""" This script computes sentence scores in a batch computation mode with a
PyTorch-trained neural LM.
It is called by steps/pytorchnn/lmrescore_{nbest, lattice}_pytorchnn.sh
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_func... |
'''
Created on 09.01.2017
@author: mort
'''
import ee
from eeMad import chi2cdf
ENL = 4.4
def multbyenl(image):
return ee.Image(image).multiply(ENL)
def log_det_sum(imList,j):
'''return the log of the the determinant of the sum of the first j images in imList'''
imList = ee.List(imList)
nbands = ee... |
# package to encrypt file with AES standard
import pyAesCrypt
# glob is a filename globbing utility, needed to change the file names with regex
# FUNCTIONS
# escape(pathname) - escape all special characters
# glob(pathname, *, recursive=False) - returns a list of path matching a pathname pattern
import glob
# os - ru... |
# 对文件和数据库数据合并载入内存
from pandas import Timedelta, DataFrame, read_csv, to_datetime
from numpy import float32, polyfit, string_
from config import Config, str2array, PARAMS_TABLE_NAME, get_table_name, MINI_EPS, PARAMS_LIST
from sql_mapper import SQLMapper
from multiprocessing import Process
def view_data(data,... |
from .header import *
from .test import TestAgent
'''
Pre-training and Fine-tuning the GPT2
In pre-training stage, GPTModel + lm _head
In Fine-tuning stage, GPTModel + Transformer_matrix + lm_head
'''
class PFGPT2(nn.Module):
def __init__(self, vocab_size, unk_id, sep_id, topk, topp,
config_pat... |
""" Handles fulfillment and slot-filling webhooks coming from Dialogflow """
import logging
import re
from django.conf import settings
from django.core.cache import cache
from django.db.utils import IntegrityError
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.res... |
# Copyright (C) 2020 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
import os
import time
import uuid
import requests
import wrapt
from bw2data import config, projects
from . import geocollections, intersections, topocollections
from .errors import WindowsPathCharacterLimit
from .pandarus import import_from_pandarus, import_xt_from_rasterstats
from .utils import hash_collection
cla... |
# 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... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, unicode_literals
import argparse
import os
import numpy as np
import math
from collections import defaultdict, Counter
import pdb
"""
This script processes an input text file to produce data in binary
format to be used with the autoencoder (bin... |
import random #---------------------------------------------------------------# Preparação
C = []
erro = []
#--------------------------------------------------------------------Crianco matriz---------------------------------------------------------------#
def matriz_borda(nlinhas: int, ncolunas: int) -> list:
M = []
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import Constants
#set(relations.values())
# module for childsumtreelstm
class ChildSumTreeLSTM(nn.Module):
def __init__(self, model_type, rel_vocab, in_dim, mem_dim):
super(ChildSumTreeLSTM, self).__init__()
self.rel_vocab = rel_v... |
#!/usr/bin/python
# Copyright (c) 2016-2018 Dell Inc. or its subsidiaries.
#
# 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 numpy as np
import scipy
from scipy import stats
from networkx.algorithms import bipartite
import scipy.linalg as la
from numpy.linalg import matrix_rank, norm
import community
from community import community_louvain
import pandas as pd
import copy
def ger_matrix_from_poly(model, dataset, poly_m):
# L_m... |
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
#%%
import random
import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow.keras as keras
import seaborn as sns
import numpy as np
import pickle
from sklearn.model_selection import StratifiedKFold
from math import log2, ceil
import sys
sys.path.append("../src/")
from lifelong_dnn import LifeLongDN... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, <NAME> <<EMAIL>>
# SPDX-License-Identifier: MIT
#
""" This is an small ansible module for handling some operations related to a
tang server. """
import os
import filecmp
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._te... |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
__all__ = ['get_drug_target_data', 'LincsClient', 'load_lincs_csv']
import os
import sys
import json
import logging
import requests
from io import StringIO, BytesIO
from indra.util import read_unicode_csv_fileobj
f... |
#!/bin/ipython
# ---LICENSE-BEGIN - DO NOT CHANGE OR MOVE THIS HEADER
# This file is part of the Neurorobotics Platform software
# Copyright (C) 2014,2015,2016,2017 Human Brain Project
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as p... |
import contextlib
import datetime
import logging
import os
import tempfile
import uuid
from pathlib import Path
from typing import Dict, Iterator, List, Optional
from urllib.parse import urlparse, urlunparse
from pkg_resources import get_distribution
from scaraplate.automation.base import ProjectVCS, TemplateVCS
from... |
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 08 2020
@author: Akash
"""
#%%
# importing required libraries
import argparse
import os
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow
import scipy.io
import scipy.misc
import numpy as np
import pandas as pd
import PIL
import cv2... |
# -*- coding: utf-8 -*-
"""
This module contains functions related to Hertz contact theory. As of now, the
equations are limited to elliptical and circular contacts. Equations for line
contacts (cylinder-on-flat or cylinder-on-cylinder) are currently not
implemented.
"""
import copy
import warnings
from math import ... |
# Author: <NAME> <<EMAIL>>
import os
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from eelbrain import Dataset, Factor, Var
from eelbrain._exceptions import DefinitionError
from eelbrain.pipeline import *
from eelbrain.testing import assert_dataobj_equal, TempDir
SUBJECT = 'CheeseMo... |
# PyZX - Python library for quantum circuit rewriting
# and optimization using the ZX-calculus
# Copyright (C) 2018 - <NAME> and <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
... |
import dash_core_components as dcc
import dash_html_components as html
"""
Defining the core view (layout) component for the entire app.
Please do not define any callback logic in this file.
"""
def core_view_html():
"""
Getting the core view component (layout) for the entire app.
Contains the nav bar,... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import os
import functools
import hashlib
from . import utils
from .ext_deps import yaml
DEFAULT_CONFIG_PATH = "~/.opus-cfg"
if 'OPUS_MASTER_CONFIG' in os.environ:
CONFIG_PATH = utils.path_normalise(os.environ['OPUS_MASTER_... |
#!/usr/bin/python3
"""
AUTHOR: <NAME> - <EMAIL>
"""
# Imports
import json
#import logging
import maxminddb
#import re
import redis
import io
from const import META, PORTMAP
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from os import getuid
from sys import exit
#from textwrap import dedent
from t... |
# coding=utf-8
#
# Copyright 2012 keyes.ie
#
# License: http://jkeyes.mit-license.org/
#
""" User module.
>>> from intercom import Intercom
>>> from intercom import User
"""
from . import Intercom
from . import from_timestamp_property
from . import to_timestamp_property
import numbers
class UserId(dict):
""" ... |
from Environments import ChessEnvironment
from collections import defaultdict
from constants import N_ACTIONS
from dummy import generate_action_dict
import numpy as np
import time
from threading import Thread
# TODO: Tidy this up
a2m, m2a = generate_action_dict()
C_PUCT = 2
class MasterNode():
""" A placeholde... |
import os
import cv2
import time
import argparse
import numpy as np
import subprocess as sp
import json
import tensorflow as tf
import serial
import matplotlib.pyplot as plt
import math
from queue import Queue
from threading import Thread
from utils.app_utils import FPS, HLSVideoStream, WebcamVideoStream, draw_boxes_a... |
#!/usr/bin/env python3
"""
strelka_dirstream.py
Command line utility for sending files from a directory to a Strelka cluster
in near real-time. For select source applications (e.g. Bro), this utility
supports parsing metadata embedded in the filename.
If used on a Bro network sensor, then this utility should be paire... |
from __future__ import absolute_import
import inspect
import types
import warnings
import weakref
from functools import partial
from logging import getLogger
from eventlet.event import Event
from nameko.exceptions import IncorrectSignature
_log = getLogger(__name__)
ENTRYPOINT_EXTENSIONS_ATTR = 'nameko_entrypoin... |
#!/usr/bin/python2
# TODO
# - Dont assume WGS84, instead read from input layer.
# - Find a better way to separate different same object type with multiple
# geometry types.
import subprocess
import multiprocessing as mp
from osgeo import osr
from osgeo import ogr
import sys
import fnmatch
import os
import time
import... |
# pylint: disable=not-callable
# pylint: disable=no-member
import torch
import torch.nn as nn
from torch.nn import functional as F
import numpy as np
from torch.optim import Adam
from torch.distributions import Normal
class BackwardModel(nn.Module):
# this is a conditional density model (MDN), modelled after B... |
import os
import time
from tqdm import tqdm
import torch
import math
import numpy as np
from sklearn.utils.class_weight import compute_class_weight
from torch.utils.data import DataLoader, RandomSampler
from torch.nn import DataParallel
from utils.log_utils import log_values, log_values_sl
from utils.data_utils impo... |
# -*- coding: utf-8 -*-
import re
import bs4
import arrow
import requests
from chalice import Chalice
# from flask import Flask, jsonify
app = Chalice(app_name='top40-chalice')
# app = Flask('top40-chalice')
# The return object is a plain dict, unlike Flask, which expects a response
@app.route('/')
def index():
... |
import json
import xnet
import glob
import numpy as np
import matplotlib.pyplot as plt
from igraph import *
from scipy import signal
from read_file import load_data
from itertools import combinations
from collections import defaultdict
def create_nets_by_year():
# CRIA AS REDES POR ANO
file = 'data/plos_one_2019_su... |
#-------------------------------------------------------------------------------
# regmap_analyzer.py
#
# Register map analyzer
#
#
# Copyright (C) 2015, <NAME>
# License: Apache 2.0
#-------------------------------------------------------------------------------
import sys
import os
import csv
sys.path.insert(0, os.... |
# -*- coding: utf-8 -*-
"""
Provide a wrapper and helpers for AWS boto library.
See https://boto3.readthedocs.io/en/latest/ for API details
"""
import logging
import os
import boto3
import re
import toil.provider.base
import toil
from botocore.client import Config
logger = logging.getLogger(__name__)
... |
import argparse
import time
import os
import numpy as np
import pandas as pd
import tqdm
import h5py
from generation.config import DF_DIR, EVENTS_PATH, DETECTORS_PATH, FULL_SIGNALS_DIR, PROCESSING_TIME_NORM_COEF, \
SIGNAL_DIM, SPACAL_DATA_PATH, FRAC_SIGNALS_DIR, H5_DATASET_NAME, POSTPROCESSED_SIGNALS_DIR
def cr... |
"""Linear Predictive Coding analysis and resynthesis for audio."""
import numpy as np
import scipy.signal
def lpcfit(x, p=12, h=128, w=None, overlaps=True):
"""Perform LPC analysis of short-time windows of a waveform.
Args:
x: 1D np.array containing input audio waveform.
p: int, order of LP models to fit... |
# Copyright (c) 2020.
# MIT License
#
# Copyright (c) 2019 YumeNetwork
#
# 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
# ... |
import rematbal.matbal as mb
import numpy as np
from scipy.optimize import fsolve
import pandas as pd
def mbal_inner_calc(dict, P, Pres_calc, We, aquifer_pres, step):
Np, Wp, Gp, N, Wei, pvt_oil_pressure, pvt_oil_Bo, pvt_oil_Bg, pvt_oil_Rs, Rsb, \
Bti, Bgi, Pi, m, Boi, cw, Swi, cf, Rsi, Bw, Winj, Bwinj, Ginj, ... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
# Create your models here.
class UsuarioManager(BaseUserManager):
use_in_migrations = True
def _create_user(self, ra, password, **extra_fields):
if not ra:
raise ValueError('RA precisa ser ... |
"""
LogrotateConfAll - Combiner for logrotate configuration
=======================================================
Combiner for accessing all the logrotate configuration files. It collects all
LogrotateConf generated from each single logrotate configuration file.
There may be multiple logrotate configuration, and th... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 10 16:37:54 2018
Modified on Mon Jul 22
@author: Purnendu Mishra
"""
import cv2
import numpy as np
import pandas as pd
from skimage import io,color
from keras import backend as K
from keras.utils import Sequence, to_categorical
#from keras.prep... |
"""Utility functions for running non- and nested cross-validation of sampling methods
"""
# Authors: <NAME> <->
# License: -
import copy
from sklearn.model_selection import BaseCrossValidator, StratifiedKFold
from sklearn.model_selection._search import BaseSearchCV
from sklearn.pipeline import Pipeline
from .eval_... |
"""
Authors: <NAME>, <NAME> and <NAME>
All rights reserved, 2017.
"""
__all__ = ['filter_bank']
import torch
import numpy as np
import scipy.fftpack as fft
def filter_bank_real(M, N, J, L=8):
"""
Builds in Fourier the Morlet filters used for the scattering transform.
Each single filter is prov... |
"""Spotify to vinyl API function."""
# Standard library imports
import os
import sys
import json
import time
import logging
# Third party imports
import requests
import jellyfish
# define top level module logger
logger = logging.getLogger(__name__)
def discogs_get(url, auth, params=None):
"""Help make GET requ... |
from typing import Optional, Union, Callable
import numpy as np
from caput import memh5
from cora.util.cosmology import Cosmology
from cora.util import units, cubicspline as cs
from draco.core import containers
from ..util.nputil import FloatArrayLike
class InterpolatedFunction(memh5.BasicCont):
"""A containe... |
import os
import sys
import math
import xml.etree.ElementTree as ET
import numpy as np
import torch
import torch.nn.functional as F
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
import utils.quaternion as quat
def chamfer_dist(pc1, pc2):
"""Chamfer distance between two point clouds."""
... |
import os
import string
from abc import (
ABCMeta,
abstractmethod
)
import six
from galaxy.containers.docker_model import DockerVolume
from galaxy.util import (
asbool,
in_directory
)
from . import (
docker_util,
singularity_util
)
from .requirements import (
DEFAULT_CONTAINER_RESOLVE_DEPE... |
import logging
import copy
import json
import pytest
from inspect import getmembers, isfunction
from collections import defaultdict
from tests.common.plugins.sanity_check import constants
from tests.common.plugins.sanity_check import checks
from tests.common.plugins.sanity_check.checks import *
from tests.common.pl... |
# Copyright 2020 The TensorFlow Probability 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 o... |
import operator
import os
import warnings
from functools import reduce
from rbnf.core.Optimize import optimize
from rbnf.core.ParserC import Literal, Atom as _Atom, State
from rbnf.core.Tokenizer import Tokenizer
from rbnf.edsl.core import _FnCodeStr
from rbnf.core import ParserC
from rbnf.edsl import *
from rbnf.edsl.... |
"""Utility functions to invoke git-http-backend
"""
import subprocess
import threading
DEFAULT_CHUNK_SIZE = 0x8000
DEFAULT_MAX_HEADER_SIZE = 0X20000 # No header should ever be this large.
# TODO: expose these sizes to API
CRLF = b'\r\n'
HEADER_END = CRLF * 2
def wsgi_to_git_http_backend(wsgi_environ,
... |
# -*- coding: utf-8 -*-
from datetime import datetime
from nbs.models import db
from nbs.models.misc import TimestampMixin
class ProductCategory(db.Model):
__tablename__ = 'product_category'
id = db.Column(db.Integer, primary_key=True)
#: category name
name = db.Column(db.Unicode, nullable=False)
... |
from rest_framework import status
from rest_framework.authentication import get_authorization_header
from rest_framework.generics import RetrieveUpdateAPIView, CreateAPIView
from rest_framework.permissions import AllowAny, IsAuthenticated, IsAuthenticatedOrReadOnly
from rest_framework.response import Response
from rest... |
#This script runs through all toc files it can find and uses that information to extract the files to a target directory.
#Often the assets are actually stored in cascat archives (the sbtoc knows where to search in the cascat), which is taken care of too.
#The script does not overwrite existing files (mainly because 10... |
import json
import datetime
from decimal import *
from operator import itemgetter
from django.shortcuts import render
from django.views.generic import TemplateView, ListView, DetailView
from django.http import HttpResponse, HttpResponseRedirect
from . import forms
from . import models
from django.core import serializer... |
from repowatcher.dao.repodao import RepoDAO
from repowatcher.dao.categorydao import CategoryDAO
from repowatcher.entity.entityfactory import EntityFactory
import repowatcher.gitcommands as gitcommands
import repowatcher.utils as utils
import repowatcher.commands.list_categories_command as list_categories_command
impo... |
"""Python library to connect deCONZ and Home Assistant to work together."""
from typing import (
Any,
Awaitable,
Callable,
Dict,
Final,
List,
Literal,
Optional,
Tuple,
Union,
)
from .api import APIItems
from .deconz_device import DeconzDevice
from .light import Light
RESOURCE_... |
import pandas as pd
import numpy as np
import scipy as sp
from scipy.special import expit as sigmoid_function
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.style.use('ggplot')
def load_data(location):
""" Given a directory string, returns a pandas dataframe containing hw data."""
# diction... |
# Copyright (c) 2018 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
"""Miscellaneous utility functions."""
import argparse
import logging
import os
from collections.abc import MutableMapping
from contextlib import contextmanager
from functool... |
from __future__ import absolute_import
import pandas as pd
from ...utils.geom_utils import geodataframe_from_dataframe
from ...data import Dataset
from .service import Service
QUOTA_SERVICE = 'isolines'
class Isolines(Service):
"""Time and distance Isoline services using CARTO dataservices.
"""
def __... |
import os
import glob
import re
import click
from collections import Counter, OrderedDict
from datetime import date
from difflib import SequenceMatcher
from operator import itemgetter
from utils import get_data_dir, load_yaml, dump_obj, get_settings, role_is_active
from merge import compare_objects, merge_people, List... |
#from server.djangoapp.models import DealerReview
from django.contrib import auth
from django.http.response import JsonResponse
from djangoapp.models import DealerReview, CarDealer
from django.shortcuts import render
from django.http import HttpResponseRedirect, HttpResponse
from django.contrib.auth.models import User
... |
import json
import pandas as pd
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse, HttpResponseRedirect
# from django.contrib.auth.views import logout as auth_logout
# from django.contrib.auth import views as auth_views
# from django.contrib.auth.views import LogoutView
from djang... |
"""
The MIT License (MIT)
Copyright (c) 2020 <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, mer... |
#!/usr/bin/env python3
import torch
import torch.nn as nn
import torch.nn.functional as F
import learn2learn as l2l
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False... |
#!/usr/bin/env python
"""Provides some common functionality for cop robots.
Much of a cop's functionality is defined by the ``robot`` module, but
this module provides cops with the tools it uses to hunt the robbers,
such as:
* sensors (both human and camera) to collect environment information;
* a fusion_engin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.