text stringlengths 3.07k 12.6k |
|---|
# -*- coding: utf-8 -*
'''
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
* @licence The MIT License (MIT)
* @author PengKaixing(<EMAIL>)
* @version V0.1
* @date 2021-05-17
* @get from https://www.dfrobot.com
* @url https://github.com/dfrobot/... |
"""
Reads the PyWPS configuration file
"""
# Author: <NAME>
#
# License:
#
# Web Processing Service implementation
# Copyright (C) 2015 PyWPS Development Team, represented by <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated document... |
# Copyright (c) 2021 - present / Neuralmagic, 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... |
"""Sphinx configuration."""
import datetime
import os
import pathlib
import re
import sys
from typing import List, Match
import emoji
import importlib_metadata
from dotenv import find_dotenv, load_dotenv
from sphinx.application import Sphinx
# Load user-specific env vars (e.g. secrets) from a `.env` file
load_dotenv(... |
import pygame
from sys import exit
from random import randint, choice
class Player(pygame.sprite.Sprite):
def __init__(self):
super().__init__()
player_walk_1 = pygame.image.load('graphics/player/player_walk_1.png').convert_alpha()
player_walk_2 = pygame.image.load('graphics/player/player_w... |
# Importing the Kratos Library
import KratosMultiphysics as KM
# CoSimulation imports
import KratosMultiphysics.CoSimulationApplication.factories.io_factory as io_factory
from KratosMultiphysics.CoSimulationApplication.coupling_interface_data import CouplingInterfaceData
import KratosMultiphysics.CoSimulationApplicati... |
# pylint: disable=W0622,W0614,W0401
from __future__ import absolute_import, division, print_function
from builtins import *
# pylint: enable=W0622,W0614,W0401
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import matplotlib.patches as mpl_patches
import pandas as pd
import seaborn as sns
im... |
# File under the MIT license, see https://github.com/adefossez/julius/LICENSE for details.
# Author: adefossez, 2020
"""
FIR windowed sinc lowpass filters.
"""
import math
from typing import Sequence, Optional
import torch
from torch.nn import functional as F
from .core import sinc
from .fftconv import fft_conv1d
fr... |
import os
import uuid
import json
from hashlib import sha256
from struct import unpack
from itertools import takewhile, islice, count
from collections import defaultdict
from time import time
import urllib
from random import Random
import urllib.request
import logging
logger = logging.getLogger(__name__)
def ensure_d... |
import os
import argparse
import datetime
def launch_training(**kwargs):
# Launch training
train.train(**kwargs)
def launch_eval(**kwargs):
# Launch training
eval.eval(**kwargs)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Train model')
parser.add_argument('m... |
#import MeCab
import openpyxl
import pprint
import itertools
from Emotions import *
#from Split_word_full import *
from Xlsx_operation import *
from Parsing import *
#from Parsing_adj_not import *
#xlsxファイル読み取り
wb = openpyxl.load_workbook('origin_dic_emo.xlsx')
sheet = wb['感情分類']
sheet1 = wb['作業者A']
... |
# This file is part of NEORL.
# Copyright (c) 2021 Exelon Corporation and MIT Nuclear Science and Engineering
# NEORL is free software: you can redistribute it and/or modify
# it under the terms of the MIT LICENSE
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED... |
import pytest
import json
import time
from itertools import islice
from cbpro.authenticated_client import AuthenticatedClient
@pytest.fixture(scope='module')
def dc():
"""Dummy client for testing."""
return AuthenticatedClient('test', 'test', 'test')
@pytest.mark.usefixtures('dc')
class TestAuthenticatedCli... |
# Copyright The PyTorch Lightning team.
#
# 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 i... |
#!/usr/bin/env python
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
#!/usr/bin/env python
"""
This example calculates the Ricci tensor from the metric and does this
on the example of Schwarzschild solution.
If you want to derive this by hand, follow the wiki page here:
https://en.wikipedia.org/wiki/Deriving_the_Schwarzschild_solution
Also read the above wiki and follow the referenc... |
import json
import logging
import os
import random
import time
import timeit
from urllib import parse as urlparse
import v2.utils.utils as utils
from v2.lib.exceptions import EventRecordDataError
log = logging.getLogger()
def start_kafka_broker_consumer(topic_name, event_record_path):
"""
start kafka consum... |
import configparser
import snoohelper.utils as utils
import snoohelper.utils.reddit
from snoohelper.reddit.bot import SnooHelperBot
from .slack import IncomingWebhook
import os
class SlackTeam:
"""
Represents a Slack Team and contains all the data related to it - such as authentication tokens, enabled modules... |
# Copyright 2018 The TensorFlow 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 app... |
"""
Common reusable code for tests and tests for pybitmessage process.
"""
import os
import signal
import subprocess # nosec
import sys
import tempfile
import time
import unittest
import psutil
from .common import cleanup, put_signal_file, skip_python3
skip_python3()
class TestProcessProto(unittest.TestCase):
... |
"""
Implement logic relating to wrapping (box) and unwrapping (unbox) instances
of jitclasses for use inside the python interpreter.
"""
from __future__ import print_function, absolute_import
from numba import types, cgutils
from numba.pythonapi import box, unbox, NativeValue
from numba.runtime.nrt import MemInfo
from ... |
def europepmc(self, query, size, synonym=True, externalfile=True, fulltext=True, **kwargs):
import requests
import xmltodict
import lxml.etree
import logging
import lxml
import os
import json
size = int(size)
content = [[]]
nextCursorMark = ['*', ]
morepapers = True
numbe... |
from bytemaps import sys
from bytemaps import Dataset
from bytemaps import Verify
class SSMIaveraged(Dataset):
""" Read averaged SSMI bytemaps. """
"""
Public data:
filename = name of data file
missing = fill value used for missing data;
if None, then fill with... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import logging
import sys
import threading
import ray.cloudpickle as cloudpickle
from ray.tune import TuneError
from ray.tune.suggest import BasicVariantGenerator
from ray.utils import binary_to_he... |
# Copyright (c) ZenML GmbH 2021. 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 applica... |
from pypy.interpreter.error import OperationError
from pypy.interpreter.pyparser import future, parser, pytokenizer, pygram, error
from pypy.interpreter.astcompiler import consts
def recode_to_utf8(space, bytes, encoding):
w_text = space.call_method(space.newbytes(bytes), "decode",
s... |
# -*- coding: utf-8 -*-
import unittest
from unittest import skip
from gender_bender import gender_bend
from gender_bender.gender_tools import _copy_case
class TestFlipGender(unittest.TestCase):
def test_flip_back_and_forth(self):
text = 'himself did not know herself.'
result = gender_bend(text)... |
from __future__ import absolute_import
from tempfile import NamedTemporaryFile
from django.conf import settings
from django.http import HttpResponse
from django.template.response import TemplateResponse
from django.views.generic import TemplateView
from django.utils.encoding import smart_text
from .utils import (con... |
import inspect
import hmac
import hashlib
import json
import boto3
import requests
import sys
import time
import inspect
from urllib.parse import parse_qs
route_list = []
SLACK_SIGNING_SECRET = ""
SLACK_AUTHENTICATE_REQUEST = True
def get_route(full_command, routes):
command = full_command.split()[0].lower()[
... |
import math
import numpy as np
import os
import torch
from textattack.constraints import Constraint
from textattack.shared import utils
class SentenceEncoder(Constraint):
"""
Constraint using cosine similarity between sentence encodings of x and
x_adv.
Args:
threshold (:obj:`float`,... |
#!/usr/bin/python3
## Copyright (C) 2017-2018 Free Software Foundation, Inc.
## This file is part of GNU Emacs.
## GNU Emacs 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 of the License... |
# Copyright (c) 2020 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... |
"""
ARCHES - a program developed to inventory and manage immovable cultural heritage.
Copyright (C) 2013 <NAME> and World Monuments Fund
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either ... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
'''
Create PSF
Gotta run marx bash script first
First must approximate Photon Flux using ideal PSF -- needed for ChaRT input...
INPUTS:
chandra_dir -- full path to data directory (e.g. '/home/user/Documents/Data')
evt_file -- name of event file without extension (e.g. 'acisf#####_repro_evt2')
region --... |
""" Contains the library classes that store the parameters u_t, theta"""
import numpy as np
import torch
from torch.autograd import grad
from itertools import combinations
from functools import reduce
from .deepmod import Library
from typing import Tuple
from ..utils.types import TensorList
# ==================== Lib... |
#!/usr/bin/env python3
import hashlib
from itertools import count
from json import dumps
from os import makedirs
from os.path import exists
from requests import get, put
import vang.artifactory.mirror_config as config
from vang.artifactory.diff_repos import diff, get_repo_content
from vang.core.core import pmap_unord... |
import os,sys,time,requests,json
from bs4 import BeautifulSoup as bs
from time import sleep
from concurrent.futures import ThreadPoolExecutor
b="\033[94m"
c="\033[96m"
g="\033[92m"
r="\033[91m"
p="\033[1;97m"
d="\033[00m"
dn=f"{d}[{g}√{d}]{p}"
er=f"{d}[{r}!{d}]{p}"
pr=f"{d}[{c}*{d}]{p}"
url="https://mangaid.click/"
ses... |
#!/usr/bin/python
# Copyright (c) 2020, Sine Nomine Associates
# BSD 2-Clause License
ANSIBLE_METADATA = {
'metadata_version': '1.1.',
'status': ['preview'],
'supported_by': 'community',
}
DOCUMENTATION = r"""
---
module: virt_up
short_description: Create instances on libvirt hypervisor with virt-builde... |
# Copyright 2017 The Rudders 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... |
# Copyright 2019 The TensorFlow 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 applicab... |
from confess import app
from confess.utils import *
from confess.constants import *
from confess.models.user import *
from confess.models.post import *
from confess.models.vote import *
from confess.models.comment import *
from confess.controllers.comment import get_comment_dict
import os
import json
from flask impo... |
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_sequence, pad_packed_sequence, pack_padded_sequence, PackedSequence
from stanza.models.common.packed_lstm import PackedLSTM
from stanza.models.common.utils import tensor_unsort, unsort
from stanza.models.common.dropout import SequenceUnitDropout
fr... |
import re
import os
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from scrapy import log
import csv, codecs, cStringIO
from productloader import l... |
import os
import re
import time
from collections import Counter
from datetime import datetime
from shutil import copyfile
from stat import ST_MTIME
from photo_workflow import exif
from photo_workflow.utils.logging_photo import logger
from photo_workflow.helpers import conf
class ExifData:
pass
class Photo:
""... |
from sage.matrix.constructor import matrix
from sage.matrix.matrix import is_Matrix
from sage.rings.arith import legendre_symbol
from sage.rings.integer_ring import ZZ
def is_triangular_number(n):
"""
Determines if the integer n is a triangular number.
(I.e. determine if n = a*(a+1)/2 for some natural num... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2015-2016 <NAME>
# All rights reserved.
# -----------------------------------------------------------------------------
"""
Implementation of boids using pyafai and simcx.
"""
from __future__ impor... |
import scipy.io
import torch
torch.backends.cudnn.benchmark=True
import numpy as np
#import time
import os
import sys
from utils import save_result
base = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../')
sys.path.append(base)
#######################################################################
# E... |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import re
from builtins import open
from subprocess import PIPE, Popen
from tex... |
import datetime
import logging
import sys
import types
import pkg_resources
import six
import zodbpickle
from zodbupdate import utils
logger = logging.getLogger('zodbupdate')
try:
import builtins # noqa: F401, unused import
except ImportError:
# Python 2
import __builtin__
# NB: this class _must_... |
# Copyright 2019 <NAME> <<EMAIL>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed... |
import json
from io import BytesIO
from PIL import Image
def file_to_dict(file_name):
with open(file_name) as json_file:
data = json.load(json_file)
return data
def get_flex(flex_title):
return file_to_dict('flex.json')[flex_title]
def get_rich(rich_title):
return file_to_dict('rich.json')[ri... |
from datetime import datetime, timedelta
from multiprocessing.connection import Client, Listener
from multiprocessing import Process, Pipe
from collections import deque
from math import nan
import argparse
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import matplotlib
def server(conn, seri... |
"""Add new fields and tables for encrypted tokens
Revision ID: <KEY>
Revises: 5248ddf35167
Create Date: 2019-08-19 15:59:36.269155
"""
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "5248ddf35167"
from alembic import op as original_op
from data.migrations.progress import ProgressWrapper... |
import os
from docutils.core import publish_doctree
full_name_lut = {
'a35t': 'Arty 35T',
'a100t': 'Arty 100T',
'nexys4ddr': 'Nexys 4 DDR',
'basys3': 'Basys 3',
'eos_s3': 'EOS S3',
'zybo': 'Zybo Z7',
'nexys_video': 'Nexys Video',
}
families = ('xc7', 'eos-s3')
inlines = ('literal', 'strong'... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import copy
from pytorch_nst.config import device, content_layers_default, style_layers_default
class ContentLoss(nn.Module):
''' Calculate mse loss between two feature maps from the same layer'''
def __init__(self... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
from copy import deepcopy
from unittest import mock
import tensorflow as tf
def test_safe(func):
"""
Isolate tests
"""
def func_wrapper(*args):
with tf.Graph().as_default():
result = func(*args)
print('Tests Passed')
return result
return func_wrapper
def _ass... |
# -------------------------------------------------------------------
# Copyright 2021 http-spammer 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:... |
import os
import random
import socket
try:
from http import client as httplib
except ImportError: # Py 2
import httplib
HOST = ('127.0.0.1', 9000)
class Fail(Exception):
pass
def dispatcher(environ, start_response):
return dispatcher.app(environ, start_response)
def still_alive(sock):
prev_tim... |
"""
run this with ./manage.py test website
see http://www.djangoproject.com/documentation/testing/ for details
"""
from __future__ import unicode_literals
import mock
from django.conf import settings
from django.template.loader import render_to_string
from django.test import TestCase
from django.test.utils import over... |
"""Contains the DelayManager and DelayManagerRegistry base classes."""
import uuid
from functools import partial
from typing import Any, Callable, Dict, Set
from mpf.core.mpf_controller import MpfController
MYPY = False
if MYPY: # pragma: no cover
from mpf.core.machine import MachineController
__api__ = ['De... |
# Copyright 2019 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
import socket
import select
import multiprocessing
import json
import sys
import os
import fileDriver
def treatText(fileData): #Remove pontuações e carcateres que poderiam atrapalhar a comparação das palavras e quebrar as frases em listas de palavras.
remove = ['.',',',':',';','!','?','"','/','|','(',')','[',']',... |
#!/usr/bin/env python
# Copyright 2016 The Kubernetes 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 appli... |
import glob
import os
import os.path
import pkgutil
import sys
import tempfile
__all__ = ["version", "bootstrap"]
# pip currently requires ssl support, so we try to provide a nicer
# error message when that is missing (http://bugs.python.org/issue19744)
_MISSING_SSL_MESSAGE = ("pip requires SSL/TLS")
try:
impor... |
# -*- coding: utf-8 -*-
# Copyright (C) 1999-2015 Mag. <NAME>. All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. <EMAIL>
# ****************************************************************************
#
# This module is licensed under the terms of the BSD 3-Clause License
# <http://www.c-tanzer.at/license/b... |
#! /usr/bin/python
#-*- coding: utf-8 -*-
from __future__ import print_function
import sys, os
import argparse
import datetime
from pybern.products.codeerp import get_erp, list_products
from pybern.products.formats.erp import Erp
import pybern.products.fileutils.decompress as dc
import pybern.products.fileutils.compre... |
# (c) <NAME>. GPL licensed, see LICENSE.rst.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
import numpy as np
from six.moves import range
class BaseFilter(object):
def filter(self, nparray_dict):
raise NotImpl... |
"""
Copyright 2020 Zakru
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, publish,
distribute, sublicense, ... |
import logging
log = logging.getLogger(__name__)
from functools import partial
import datetime as dt
import os.path
from pathlib import Path
import subprocess
from atom.api import Atom, Bool, Enum, List, Typed, Str
import enaml
from enaml.qt.qt_application import QtApplication
with enaml.imports():
from enaml.st... |
# Copyright 2021 AlQuraishi Laboratory
# Copyright 2021 DeepMind Technologies Limited
#
# 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
#
# U... |
import copy
import re
from day import Day
from utils.timer import Timer
rx_units = r''
rx_groups = re.compile(
r'(?P<unit_count>\d+) units.+?(?P<hit_points>\d+) hit[^(\n]+'
r'(?:\((?P<modifiers>[^)]+)\))? '
r'with.+?(?P<attack_damage>\d+) (?P<damage_type>.+) damage at initiative (?P<initiative>\d+)'
)
r... |
from . import io_with_cpp as io
from . import gpu
import matplotlib.pylab as pylab
from subprocess import Popen, PIPE
import sys
from os import path
from platform import system
def get_barnes_hut_executable(exe_dir=None):
"""
Finds the directory that the Barnes_Hut.exe file would be in if this was installed... |
from . import FixtureTest
def count_matching(features, props):
num_matches = 0
for f in features:
f_props = f['properties']
match = True
for k, v in props.iteritems():
got_v = f_props.get(k)
if got_v != v:
match = False
if match:
... |
#!/usr/bin/env python3
''' This generates some graphs from the csv data output by dat_to_csv.py '''
import sys, os, csv, yaml
import matplotlib.pyplot as plt
from overlaps import count_overlaps, pairwise_overlap_time, pairwise_time_sans_longs, time_any_overlaps, any_overlaps_sans_longs
config = yaml.safe_load(open('c... |
# STD python packages
import os
from pathlib import Path
from typing import List
# Third party packages
# Local imports
excluded_files = ["CommonServerPython.py", "demistomock.py", "CommonServerUserPython.py", "conftest.py", "venv"]
def get_python_exec(py_num: float) -> str:
""" Get python executable
Args:... |
import datetime
from django.contrib.redirects.models import Redirect
from django.test import TestCase
from django.utils.safestring import SafeString
from .models import Release, create_releases_up_to_1_5
from .templatetags.release_notes import get_latest_micro_release, release_notes
class LegacyURLsTests(TestCase):... |
__author__ = 'leif'
import re
import abc
import sys
import math
import collections
class DifferenceHelper(object):
"""
Abstract difference class.
Contains helper methods for setting up - the difference() method is abstract.
"""
def __init__(self, stopword_file=None, vocab_file=None):
self.v... |
# ============================================================================
#
# Copyright (C) 2007-2016 Conceptive Engineering bvba.
# www.conceptive.be / <EMAIL>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
... |
import numpy as np
from sklearn import datasets
import matplotlib.pyplot as plot
class helpers:
def sigmoid(x):
return 1 / (1 + np.exp(-np.array(x)))
def softmax(x):
return np.exp(x) / np.sum(np.exp(x))
def dataset(n, m):
np.random.seed(0)
x, y = datasets.make_moons(n + m... |
import json
from dataclasses import dataclass
from json.encoder import JSONEncoder
from typing import List, Dict, Set, Optional
from whacked4.dehacked import table, entries, entry
from whacked4.dehacked.action import Action
from whacked4.dehacked.entry import Entry
from whacked4.dehacked.table import Table, ThingFlag... |
import dotenv
import pytest
import logging
import boto3
import os
import requests
from bs4 import BeautifulSoup
dotenv.load_dotenv()
logger = logging.getLogger()
logger.setLevel(logging.INFO)
from gather.src.lambda_gather.utils import (
clean_description,
clean_dictionary_word,
delete_dynamodb_by_key,
... |
import json
import requests
from .utils import pretty_json
class Request:
def __init__(self, event):
self.__event = event
self.__resource = event.resource
self._headers = self.__resource.get_initial_headers()
self._parameters = self.__resource.get_initial_parameters()
self... |
from __future__ import print_function
# Python version of SNOBFIT v2.1 "snobfit.m" MATLAB version by <NAME>.
#
# Modified and redistributed with permission.
# Original copyright and license notice:
#
# Copyright (c) 2003-2008, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or... |
import numpy as np
median_object_size_map = {
'Cyclist': (1.76, 1.75, 0.6),
'Van': (4.98, 2.13, 1.88),
'Tram': (14.66, 3.61, 2.6),
'Car': (3.88, 1.5, 1.63),
'Misc': (2.52, 1.65, 1.51),
'Pedestrian': (0.88, 1.77, 0.65),
'Truck': (10.81, 3.34, 2.63),
'Person_sitting': (0.75, 1.26, 0.59),
... |
import numpy as np
import itertools
import loter.tree as tree
from sklearn.cluster import KMeans
def init_data(data, inita, inith):
data["A"] = inita(data["A"], data["G"]).astype(np.float32)
data["H"] = inith(data["H"], data["G"])
return data
def init_a_rand(A, G, randomstate=None,dtype=np.int):
"""I... |
import numpy as np
from .RPN_to_eq import RPN_to_eq
from scipy.optimize import fsolve
from sympy import lambdify, N
import torch
import copy
import torch.nn as nn
import torch.nn.functional as F
from .get_pareto import Point, ParetoSet
from .S_get_expr_complexity import get_expr_complexity
from . import test_points
imp... |
import torch
import torch.nn as nn
from torch.autograd import Function
from ...utils import common_utils
from . import roiaware_pool3d_cuda
def points_in_boxes_cpu(points, boxes):
"""
Args:
points: (num_points, 3)
boxes: [x, y, z, dx, dy, dz, heading], (x, y, z) is the box center, each box DO... |
# Copyright 2018 CNRS - Airbus SAS
# Author: <NAME> and <NAME>
#
# 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 and... |
from django.shortcuts import render_to_response, get_object_or_404
from django.http import JsonResponse, HttpResponseRedirect
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.views.decorators.csrf import csrf_exempt
from django.db.models import Avg
from django.db impor... |
import tensorflow as tf
import numpy as np
import os
from modules.utils import tensor_to_image, load_img, create_folder, clip_0_1
from modules.vgg19 import preprocess_input, VGG19
from modules.forward import feed_forward
def vgg_layers(layer_names):
vgg = VGG19(include_top = False, weights = 'imagenet')
vgg.t... |
import os
import logging
import polib
import json
from django.conf import settings
from django.utils.translation import get_language, to_locale, gettext
from django.views.i18n import get_formats
from django.core.files.storage import default_storage
from easy_cache import invalidate_cache_prefix
from easy_thumbnails.fil... |
# -*- coding: utf-8 -*-
"""
author: zengbin93
email: <EMAIL>
create_dt: 2021/11/14 12:39
describe: 从任意周期K线开始合成更高周期K线的工具类
"""
from datetime import datetime, timedelta
from typing import List
from ..objects import RawBar, Freq
def freq_end_time(dt: datetime, freq: Freq) -> datetime:
"""获取 dt 对应的K线周期结束时间
:param... |
# python 3.8.5
# Imports here
import os
import torch # 1.7.0
from torch import nn
from torch import optim
from torchvision import models
# Set PyTorch random seed to aid bugfixing
torch.manual_seed(42);
def build_model(arch, hidden_units):
''' Configures a pre... |
# Copyright (c) 2020 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... |
#pydescrip version 0.2
import tkinter as tk
import tkinter.messagebox
version = 'pydescrip version 0.2 BETA'
textBoxWidth = 80
requiredLength = 51 #overall length must be over 50
HTML = 'Nothing generated yet!'
tdStyle = ' style ="border-style: none; color: gray;"'
descriptionText = ''
tableL = []
tableR = ... |
import logging
import os
from typing import List
import absl
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import tensorflow_transform as tft
from tfx.components.trainer.executor import TrainerFnArgs
from tfx_bsl.tfxio import dataset_options
class LSTMAutoencoderModel(keras... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# converter_utilities.py
import keyword
import unicodedata
def is_valid_name(name: str) -> bool:
"""
check if the variable name is valid
use when str.isidentifier() can't be trusted
"""
name = str(name).strip() # condition the given name
if not ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.