text stringlengths 3.07k 22.1k |
|---|
import operator
from collections import defaultdict
from itertools import groupby
from operator import itemgetter
from functools import reduce
from django.db.models import Q
from mi.models import (
HVCGroup,
SectorTeam,
Target,
)
from mi.utils import sort_campaigns_by
from mi.views.base_view import BaseWi... |
import re
import os.path
import copy
import logging
import urllib.parse
from werkzeug.utils import cached_property
logger = logging.getLogger(__name__)
route_re = re.compile(r'%((?P<qual>[\w\d]+):)?(?P<var>\+)?(?P<name>\w+)%')
route_esc_re = re.compile(r'\\%((?P<qual>[\w\d]+)\\:)?(?P<var>\\\+)?(?P<name>\w+)\\%')
ug... |
from __future__ import absolute_import
from __future__ import division
import os.path
import numpy as np
from nipype.interfaces.base import (
TraitedSpec, BaseInterface, File, traits, isdefined)
try:
import matplotlib.pyplot as plt
except ImportError:
plt = None
import nibabel as nib
from nianalysis.excepti... |
import asyncio
import pathlib
import sys
import tempfile
import time
from collections import Counter
from dataclasses import dataclass, field
from http import HTTPStatus
import logging
from typing import AsyncContextManager, Awaitable, Callable, List, Optional, Tuple
import aiohttp
import docker
import pandas as pd
f... |
import os
from gateoverflow.state import state as s
from gateoverflow import constants
from gateoverflow.logger import d
from gateoverflow import queries as q
from gateoverflow.helpers import readable_date, open_link, uncrawled_metadata_count, crawl_metadata, prettify_table, print_title, ask, latest_version_check, askP... |
import xarray as xr
import pandas as pd
import numpy as np
import string
from .exchange.containers import FileType
class CCHDOAccessorBase:
def __init__(self, xarray_obj):
self._obj = xarray_obj
class MatlabAccessor(CCHDOAccessorBase):
def savemat(self, fname):
"""Experimental Matlab .mat d... |
from openlocationcode import openlocationcode as olc
from TileArea import TileArea
from OpenGeoTile import OpenGeoTile, TileSize
import pytest
CODE_ALPHABET = olc.CODE_ALPHABET_
BASE_20_SET = {x+y for x in CODE_ALPHABET for y in CODE_ALPHABET}
BASE_20_BORDER_SET = {x for x in BASE_20_SET if x[0] in ['2', 'X'] or x[1] ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals, print_function, division
import sys
import logging
import time
import codecs
import operator
import pymorphy2
from pymorphy2.cache import lru_cache, memoized_with_single_argument
from pymorphy2.utils import get_mem... |
#!/usr/bin/env python
import argparse
import json
import logging
import os
import sys
## how to test ## uncomment "testing" functions, run python with garbage -b -l values with real json input, then:
# $ while read line ; do a=(${line}) && echo python ~/gdc_bam_library_exomekit_docker/gdc_bam_library_exomekit_docker/... |
import io, sys
from collections import namedtuple, Mapping, Iterable
from json import JSONEncoder
import marshmallow
import marshmallow_dataclass
import requests
import base64
from datetime import date, datetime
from enum import Enum
from pyrolysis.common.support import keep
application = namedtuple('mimetype', ['p... |
# Import Libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from os import listdir
import wfdb # PyPi package for loading ecg and annotations
from sklearn.model_selection import train_test_split
# Sample code for working with this dataset found at https://towardsdatascience.com/detectin... |
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
#
# Code generated. DO NOT EDIT!
# template file: justice_py_sdk_codegen/__main__.py
# justice-platform-service (4.10.0)
# pylint: disabl... |
# Gera Stdins dos diversos textos com reaproveitamente do codigo de A0
# Le Pasta Inputs -> Gera e guarda em Outputs
# #### BIBLIOTECAS ####
import sys
import msvcrt
from io import StringIO
import random
# #### CONSTANTES ####
CMD_IN_LINHAS = "LINHAS"
CMD_OUT_NULO = "-1"
CMD_IN_ASSOC = "ASSOC"
CMD_OUT_NAOENCONTRADA... |
""" pyramid_webpack """
import fnmatch
import posixpath
import re
import time
from io import StringIO
import json
import six
from pkg_resources import resource_string
from pyramid.decorator import reify
from pyramid.settings import asbool, aslist
__version__ = '0.1.3'
SENTINEL = object()
@six.python_2_unicode_co... |
"""
Commands
Commands describe the input the account can do to the game.
"""
from evennia.commands.command import Command as BaseCommand
from evennia.utils import ansi
# from evennia import default_cmds
class Command(BaseCommand):
"""
Inherit from this if you want to create your own command styles
fro... |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 25 23:47:10 2020
Relational clustering of images using EMD distance
@author: jpeeples
"""
import pdb
import numpy as np
import time
from skimage.measure import regionprops
from skimage import color
from itertools import combinations
from Utils.EMD_Clustering import Generat... |
import time
import zlib
import logging
import pprint
from django.template import Context
from django.shortcuts import render
from django.views.generic import View, DetailView
from django.db import connection
from django.conf import settings
from django.utils import timezone
from django.core.cache import cache
from dja... |
"""Trainer class."""
import pickle
import time
from functools import partial
from pathlib import Path
from typing import Any, Callable, Deque, List, NamedTuple
import haiku as hk
import jax
import jax.numpy as jnp
import numpy as np
import optax
from jax.numpy import ndarray
from tqdm.auto import tqdm
class Trainer... |
import numpy as np
import scipy.signal
from gym.spaces import Box, Discrete, Tuple
import copy
import torch
import torch.nn as nn
from torch.distributions.normal import Normal
from torch.distributions.categorical import Categorical
def tuple_space_dim(obs, action=False):
'''
Extract observaiton/action dimensi... |
import tkinter as tk
from tkinter import ttk
import matplotlib.pyplot as plt
import os
from mdtools.plotting_class import FilePlotting
LARGE_FONT = ("Verdana", 10)
class MDAnalysis(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
tk.Tk.wm_title(self, "Analysis of... |
import numpy as np
import math
import argparse
import time
import yaml
import sys
import torch
import torch.nn as nn
import torch.distributed as dist
import torch.optim
from torch.autograd import Variable
from torch.utils.data import DataLoader
from torch.distributed import broadcast
import torchvision.transforms as tr... |
#
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 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 app... |
from dataclasses import asdict, dataclass, field
from typing import Any, AnyStr, ClassVar, Dict, List, Optional, Union
from freshchat.client.client import FreshChatClient
@dataclass
class User:
"""
Class which represents a freshchat user. A user can be an external user or an
agent
"""
id: Option... |
''' Extractor classes based on pre-trained models. '''
import numpy as np
import pandas as pd
from pliers.extractors.image import ImageExtractor
from pliers.extractors.base import Extractor, ExtractorResult
from pliers.filters.image import ImageResizingFilter
from pliers.stimuli import ImageStim, TextStim
from pliers... |
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
import os, sys
sys.path.append("stylegan3")
import torch
import numpy as np
from numpy.linalg import norm
from stylegan3 import dnnlib
from stylegan3.legacy import load_network_pkl
from scipy import interpolate
from tqdm import tqdm
import librosa
import warnings
import ffmpeg
import click
import ast
from util.geomet... |
import json
import os
import socket
from typing import List, Optional
from abejacli import config
from abejacli.config import RESERVED_ENV_VAR, RUN_LOCAL_COMMAND_V1
from abejacli.docker.utils import get_home_path
# ==========================
# Environment Variable Keys
# ==========================
SERVICE_TYPE_HTTP =... |
#imports
import arcade
import random
import math
import os
import timeit
import threading
import time
from tkinter import *
from tkinter.ttk import *
import tkinter as tk
# Set up the constants
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
SCREEN_GAME_Height = 300
SCREEN_GAME_Width = 400
SCREEN_TITLE = "CS 230 Final Proje... |
#!/usr/bin/env python
# CREATED:2013-08-22 12:20:01 by <NAME> <<EMAIL>>
'''Music segmentation using timbre, pitch, repetition and time.
If run as a program, usage is:
./segmenter.py AUDIO.mp3 OUTPUT.lab
'''
import argparse
import logging
import sys
import numpy as np
import scipy.signal
import scipy.linalg
i... |
######################################################################
# NotesToType.py : a script which turns notes detected by the
# microphone into keyboard output.
# Dependencies: numpy, pyaudio, pyautogui, audioop
# The default configuration for notes are:
# C4 -> COPY (CTRL + C)
# D4 -> PASTE (CTRL + V)
#... |
import cv2
import numpy as np
import copy
#events = [i for i in dir(cv2) if 'EVENT' in i]
#print (events)
def put_text(image,txt,x0=50,y0=50):
h,w=image.shape[:2]
# font
font = cv2.FONT_HERSHEY_SIMPLEX
# fontScale
fontScale = int(h/500)
# org
org = (x0, y0+2*fontScale)
# Bl... |
# <NAME>
# PSM d18O Ice Core
# ARCHIVE SUB-MODEL
# Modified 01/26/2015 <<EMAIL>>
# Modified 11/18/2015 <<EMAIL>>
# =======================================================================================
def diffusivity(rho,T=250,P=0.9,rho_d=822,b=1.3):
'''
DOCSTRING: Function 'diffusivity'
Description: C... |
import random
import csv
from collections import defaultdict, OrderedDict
import copy
import os
import io
import pandas as pd
import torch
import torchtext as tt
import codecs
from models.model import UNK_IDX, PAD_IDX, START_IDX, EOS_IDX
class AttributeField(tt.data.RawField):
def __init__(self, name, mappingdict... |
## Creado por: <NAME> <NAME> y <NAME>
## 14 de Abril del 2020
## Sistemas Operativos, Proyecto 2
import threading
import sys
import random
import time
## Lista de parentescos y diccionario que nos permite identificar
parentescos = ['👨 Papá','👩🦱 Mamá','👶 Bebe','👦 Niño','👧 Niña','👱♀️ Adolescente','🧑 Joven'... |
import os
import sublime
from sublime_plugin import WindowCommand, TextCommand
from ..git_command import GitCommand
from ...common import util
COMMIT_HELP_TEXT_EXTRA = """##
## You may also reference or close a GitHub issue with this commit. To do so,
## type `#` followed by the `tab` key. You will be shown a lis... |
# Built in
import json
import sqlite3
import threading
import time
from urllib3.util.url import parse_url
# Third party
from bottle import route, run, template, static_file, request
import requests
# First party
from website import Site
# The home page route
@route('/', method='GET')
def index():
return template('v... |
"""
Contém as seguintes classes para utilizar os recursos (Imagens e Configd)
* Recurso -> Guarda todos os recursos em seus atributos
* GeradorRecursos -> Serve para mudar as imagens
"""
import cv2
import numpy
import pygame
from Class.PecasXadrez import nome_pecas
def all_configs(jogo: str) -> list:
""... |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... |
"""
This program is part of MOLDIS: The bigdata analytics platform. Accompanying manuscript
and the complementary web interface can be accessed at : https://moldis.tifrh.res.in/data/bodipy
Python Requirements:
numpy, scipy, scikit-learn, QML
System Requirements:
MOPAC, Obabel, write permission in running directory
Lice... |
import torch
import numpy as np
import lmdb
from PIL import Image
import re
import io
import random
import skimage.io
import skimage.transform
import skimage.color
import skimage
from torch.utils.data import Dataset
from torch.utils.data.sampler import Sampler
class JDXTopViewPerson(Dataset):
def __init__(self... |
import logging;
from urllib.parse import urlencode
from django.db import connections
from django.shortcuts import render
from django.template import loader
from django.db.models import F
from rest_framework import viewsets
from rest_framework.views import APIView
from rest_framework.decorators import api_view
from rest... |
import os
import time
import json
import torch
import argparse
import numpy as np
import torch.nn as nn
from tqdm import tqdm
from dataset import DataSet
from itertools import product
from gnn import HierarchicalGNN
from torch.nn import functional as F
from sklearn.metrics import precision_score, recall_score, f1_score... |
from __clrclasses__.Autodesk.AutoCAD.DatabaseServices import Entity as _n_0_t_0
from __clrclasses__.Autodesk.AutoCAD.DatabaseServices import ObjectId as _n_0_t_1
from __clrclasses__.Autodesk.AutoCAD.DatabaseServices import DBObject as _n_0_t_2
from __clrclasses__.Autodesk.AutoCAD.DatabaseServices import OpenMode as _n_... |
#!/bin/env python
#### filter regions by support and mean/variance distribution ####
#### libraries
import pybedtools as bedtools
import os
import time
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import warnings
warnings.filterwarnings("ignore")
# utility functions
... |
#! /usr/bin/python3
# -*- coding: utf-8 -*-
#--------------------------------------------------------------------------------------------------
# Script to extract features of words
#
# Usage:
# extract_union_features.py data_prefix phrasedbm
# (It prints the result on the standard output.)
#
# Example
# ./extrac... |
"""Various interoperable units classes and some related helper functions."""
class Unit:
"""An immutable graphical distance with a unit.
Unit objects enable easy conversion from one unit to another and
convenient operations between them.
Common operators (`+`, `-`, `/`, etc.) are supported between t... |
import logging
from pathlib import Path
import altair as alt
import pandas as pd
import requests
import streamlit as st
import streamlit.components.v1 as components
st.set_page_config(layout="wide")
st.title("Bundes-Notbremse Ampel")
pd.set_option('precision', 2)
def is_covid_file_up_to_date():
covid_path = Path... |
"""Sensor Random Data Generator
This script generates random sensor data based on the configuration file.
Output can be sent to the screen, a CVS file, or an MQTT topic.
"""
import os
import sys
import argparse
import yaml
import random
import time
from datetime import datetime
from datetime import timedelta
from abc... |
import msgpack
import redis
import base64
import os
import sqlite3
import sys
from redis_support_py3.construct_data_handlers_py3 import Generate_Handlers
#
# DB_CONNECTIONS hash key for store data base file locations
#
#
#
class Construct_RPC_Server(object):
def __init__(self,rpc_queue_handle... |
from parse import parse
from example_domains.negotiation.negotiation_state import NegotiationState
system_utterance = dict()
system_selection = dict()
user_utterance = dict()
user_selection = dict()
def negotiation_initial_turn():
negotiation_state = NegotiationState()
return negotiation_state.initial_turn
... |
import logging
import sys
import os
from .metabase import MetabaseClient
from .parsers.dbt_folder import DbtFolderReader
from .parsers.dbt_manifest import DbtManifestReader
from typing import Mapping, Iterable, List, Union
__version__ = "0.8.0"
def export(
mb_host: str,
mb_user: str,
mb_password: str,
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import grad
import torchvision
from torchvision import models, datasets, transforms
from utils import label_to_onehot
def weights_init(m):
if hasattr(m, "weight"):
m.weight.data.uniform_(-0.5, 0.5)
if hasattr(m, "bi... |
from operator import attrgetter
import warnings
from collections.abc import Sequence
import typing as t
import astropy.units as u
# from astropy.units import equivalencies
__all__ = ['make_properties']
# TODO: work out case when '.' in key when setting value, so we have to look
# inside a different object whether th... |
"""Upgrade command for handling breaking changes when updating ACA-PY versions."""
import asyncio
import yaml
from configargparse import ArgumentParser
from packaging import version as package_version
from typing import Callable, Sequence, Optional
from ..core.profile import Profile
from ..config import argparse as ... |
import numpy as np
import time
from ray.rllib.policy.policy import Policy, LEARNER_STATS_KEY, ACTION_PROB, \
ACTION_LOGP
from ray.rllib.policy.sample_batch import SampleBatch
from ray.rllib.utils.annotations import override, DeveloperAPI
from ray.rllib.utils.framework import try_import_torch
from ray.rllib.utils.s... |
""" Test numerical errors introduced by writing then reading images
Test arrays with a range of numerical values, integer and floating point.
"""
import numpy as np
from ..py3k import BytesIO
from .. import Nifti1Image
from ..spatialimages import HeaderDataError
from ..arraywriters import ScalingError
from ..casting... |
import json
import math
class Pose:
HOLD = "HOLD"
TURN_RIGHT = "TURN_RIGHT"
TURN_LEFT = "TURN_LEFT"
THROTTLE_UP = "THROTTLE_UP"
THROTTLE_DOWN = "THROTTLE_DOWN"
FORWARD = "FORWARD"
class Point:
def __init__(self, x, y, acc, index, desc):
self.x = x
self.y = y
self.... |
#!/usr/bin/env python3
# Copyright 2013-present Barefoot Networks, 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 b... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import argparse
import torch
fro... |
"""This module contains the general information for FabricVsanEp ManagedObject."""
from ...ucscentralmo import ManagedObject
from ...ucscentralcoremeta import UcsCentralVersion, MoPropertyMeta, MoMeta
from ...ucscentralmeta import VersionMeta
class FabricVsanEpConsts():
IF_ROLE_DIAG = "diag"
IF_ROLE_FCOE_NAS... |
#!/usr/bin/env python
"""An implementation of an in-memory data store for testing."""
from __future__ import print_function
import sys
import threading
import time
from future.utils import iteritems
from grr_response_core.lib import rdfvalue
from grr_response_core.lib import utils
from grr_response_server import af... |
import numpy as np
import mcubes
import sys
import os
def read_matrix(filepath):
"""
Read matrix, i.e. from a text file containing one vector.
:param filepath: file to read
:type filepath: str
:return: sdf values
:rtype: numpy.ndarray
"""
values = []
with open(filepath, 'r') as f:... |
import asyncio
import functools
import sys
from typing import (
Any,
AsyncIterator,
Awaitable,
Callable,
Coroutine,
Optional,
Set,
TypeVar,
cast,
)
from async_generator import asynccontextmanager
from trio import MultiError
from ._utils import get_task_name
from .abc import Manager... |
# -*- coding: utf-8 -*-
#This script get videos from Zoom and makes the backup into a vimeo account using pull approach
import os
import sys
import requests
import csv
import json
import os.path
import time
from os import path
from datetime import date
from datetime import timedelta
from time import time
from time imp... |
# -*- coding: utf-8 -*-
"""
:author: <NAME> (李辉)
:url: http://greyli.com
:copyright: © 2018 <NAME> <<EMAIL>>
:license: MIT, see LICENSE for more details.
"""
import logging
import os
from logging.handlers import SMTPHandler, RotatingFileHandler
import click
from flask import Flask, render_template, req... |
import collections
import os
import numpy as np
class Question:
"""Question class holding information about a single question.
Attributes:
question (str): The text of the question.
xling_id (str): An id that identifies the same QA pair across different
languages.
uid (str): A unique... |
# -*- coding: utf-8 -*-
from os import path, listdir, mkdir
import numpy as np
np.random.seed(1)
import random
random.seed(1)
import timeit
import cv2
from skimage.color import label2rgb
from tqdm import tqdm
from multiprocessing import Pool
import multiprocessing
import lightgbm as lgb
from train_classifi... |
"""Test zwave to ozw migration."""
from unittest.mock import patch
import pytest
from openpeerpower.components.ozw.websocket_api import ID, TYPE
from openpeerpower.helpers import device_registry as dr, entity_registry as er
from .common import setup_ozw
from tests.common import MockConfigEntry, mock_device_registry... |
"""Airnut Platform"""
import logging
import datetime
import json
import select
import voluptuous as vol
from socket import socket, AF_INET, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant import c... |
import datetime
import operator
from flask import request
from flask_peewee.forms import BaseModelConverter
from flask_peewee._compat import reduce
from peewee import *
from wtforms import fields
from wtforms import form
from wtforms import validators
from wtforms import widgets
class QueryFilter(object):
"""
... |
"""
Provide an interface to enable:
1) Download and installation of pretrained models
2) Check if models are installed
3) If all systems go, have user input source sound for voice, text to be spoken, and it should create and return a sound
-Do we need to save it as a wav, or can we just return the raw audio data t... |
import math
from typing import List, Dict, Iterable, Optional, Tuple, Sequence, Union
from warnings import warn
import torch
from torch import Tensor, nn, jit
from typing_extensions import Final
from torchcast.internals.utils import get_owned_kwarg, is_near_zero
from torchcast.process.base import Process
def num_o... |
import pytest
import pytz
import re
from datetime import datetime, timedelta
from uuid import uuid4
from django.core.files.uploadedfile import SimpleUploadedFile
from django.conf import settings
from django.utils import timezone
from django.urls import reverse
from freezegun import freeze_time
import requests
import r... |
# coding:utf-8
#kerasでGrad-CAM 自分で作ったモデルで
#https://qiita.com/haru1977/items/45269d790a0ad62604b3
import pandas as pd
import numpy as np
import cv2
from keras import backend as K
from keras.preprocessing.image import array_to_img, img_to_array, load_img
from keras.models import load_model
from keras.datasets import ci... |
# utility.py
from sklearn.metrics import silhouette_score
from scipy.spatial.distance import cdist
from sklearn.cluster import KMeans
import re
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as stats
from scipy.cluster.hierarchy import dendrogram
from sc... |
# Locking mechanism to ensure no two compilations occur simultaneously
# in the same compilation directory (which can cause crashes).
import atexit
import os
import socket # only used for gethostname()
import time
import logging
from contextlib import contextmanager
import numpy as np
from theano import config
ra... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Shell-runner (PowerShell, bash, etc) component"""
from __future__ import print_function
from __future__ import absolute_import
import os
import tempfile
import json
import subprocess
import shlex
import logging
import pkg_resources
from string import Template
from cir... |
import copy
import unittest
from collections.abc import Mapping, MutableMapping
from scrapy.http import Request
from scrapy.utils.datatypes import CaselessDict, LocalCache, LocalWeakReferencedCache, SequenceExclude
from scrapy.utils.python import garbage_collect
__doctests__ = ['scrapy.utils.datatypes']
class Case... |
# -*- coding: utf-8 -*-
"""
Generate gold profile
"""
# This code is a part of coolisf library: https://github.com/letuananh/intsem.fx
# :copyright: (c) 2014 <NAME> <<EMAIL>>
# :license: MIT, see LICENSE for more details.
import os
import datetime
import gzip
import logging
from lxml import etree
from texttaglib.c... |
# Copyright 2017 the GPflow 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 writi... |
import datetime
import logging
import os
import re
import time
from typing import Dict, Set, List
import yaml
from webapp import common, contacts_reader, mappings, project_reader, rg_reader, vo_reader
from webapp.contacts_reader import ContactsData
from webapp.topology import Topology, Downtime
from webapp.vos_data i... |
# -*- coding: utf-8 -*-
# Copyright 2012-2021 CERN
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
"""
动作选择
"""
import sys
import copy
from pyAudioAnalysis.audioBasicIO import read_audio_file, stereo_to_mono
import os
import pandas as pd
from random import sample, randint
import re
from pyAudioAnalysis.MidTermFeatures import mid_feature_extraction, beat_extraction
from pydub import AudioSegment
from plan2dance.P... |
from inspect import unwrap
from django.db.models import fields
import graphene
from graphene_django import DjangoObjectType
from chat.models import profile,ChatGroup,ChatMessage,GroupChatMessage,ChatUserRole
import graphql_jwt
from django.contrib.auth import get_user_model,models
from chat.utils import validate_... |
""" Classes and routines for generating 3D objects
"""
import math
import numpy as np
from scipy.spatial import ConvexHull
from copy import deepcopy
# If you have placed the other modules in another directory, this can be useful to add that location to the path
#import os, sys; sys.path.append(os.path.dirname(__file__... |
# Natural Language Toolkit: Text Segmentation Metrics
#
# Copyright (C) 2001-2013 NLTK Project
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Text Segmentation Metrics
1. Windowdiff
Pevzner, L., and Hears... |
"""
Sends the request to ElasticSearch.
TODO: Implement a higher-level search API.
"""
import os
from copy import deepcopy
from itertools import filterfalse, tee
from aws_requests_auth.boto_utils import BotoAWSRequestsAuth
from elasticsearch import Elasticsearch, RequestsHttpConnection
from t4_lambda_shared.decorato... |
import os
import cv2
import numpy as np
import sys
import pickle
from optparse import OptionParser
import time
from keras_frcnn import config
import keras_frcnn.resnet as nn
from keras import backend as K
from keras.layers import Input
from keras.models import Model
from keras_frcnn import roi_helpers
from keras_frcnn ... |
#
# Copyright (c) 2000 <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions a... |
from __future__ import print_function, absolute_import, unicode_literals
from uliweb.i18n import gettext_lazy as _
from uliweb.utils._compat import string_types
__all__ = ['Layout', 'TableLayout', 'CSSLayout',
'BootstrapLayout', 'BootstrapTableLayout']
from uliweb.core.html import Buf, Tag, Div
def min_times(nu... |
import re
import json
import random
from .splitters import split_into_sentences
from .chain import Chain, BEGIN
from unidecode import unidecode
DEFAULT_MAX_OVERLAP_RATIO = 0.7
DEFAULT_MAX_OVERLAP_TOTAL = 15
DEFAULT_TRIES = 10
class ParamError(Exception):
pass
class Text:
reject_pat = re.compile(r"(^')|('$... |
"""An example of training PCL against OpenAI Gym Envs.
This script is an example of training a PCL agent against OpenAI Gym envs.
Both discrete and continuous action spaces are supported.
To solve CartPole-v0, run:
python train_pcl_gym.py
To solve InvertedPendulum-v1, run:
python train_pcl_gym.py --env Inver... |
# 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... |
import xlrd
import xlsxwriter
import json
import copy
import yaml
import sys
from pathlib import Path
class Excel:
def __init__(self, file_name, mode='r'):
if mode == 'r':
self.workbook = xlrd.open_workbook(file_name)
elif mode == 'w':
self.workbook = xlsxwriter.Workbook(fi... |
import math
import numpy as np
from .gazebo_env import GazeboEnv
import logging
logger = logging.getLogger("gymfc")
class GoToPositionEnv(GazeboEnv):
def __init__(self, **kwargs):
self.max_sim_time = kwargs["max_sim_time"]
self.obs = None
self.observation_history = []
self.memory_... |
# Copied from TensorFlow Addon repo
import tensorflow as tf
class DecoupledWeightDecayExtension:
"""This class allows to extend optimizers with decoupled weight decay.
It implements the decoupled weight decay described by Loshchilov & Hutter
(https://arxiv.org/pdf/1711.05101.pdf), in which the weight dec... |
try:
import smbus
except:
print('Try sudo apt-get install python-smbus')
from time import sleep
# Models
MODEL_02BA = 0
MODEL_30BA = 1
# Oversampling options
OSR_256 = 0
OSR_512 = 1
OSR_1024 = 2
OSR_2048 = 3
OSR_4096 = 4
OSR_8192 = 5
# kg/m^3 convenience
DENSITY_FRESHWATER = 997
DENSITY_SALTWATER = 10... |
from datetime import timedelta
from urllib.parse import parse_qsl, urlparse
from django.apps import apps
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import models, transaction
from django.urls import reverse
from django.utils import timezone
from django.utils... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from configparser import ConfigParser
import requests
import json
import argparse
import sys
import os
import fnmatch
__author__ = "BinCrafters"
__license__ = "MIT"
__version__ = '0.1.1'
def travis_token(filename):... |
#!/usr/bin/env python
"""
NAME:
sparser.py
SYNOPSIS:
sparser.py [options] filename
DESCRIPTION:
The sparser.py script is a Specified PARSER. It is unique (as far as I can
tell) because it doesn't care about the delimiter(s). The user specifies
what is expected, and the order, for ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.