text
stringlengths
1
927k
from django.urls import path from take_home.users.views import user_detail_view, user_redirect_view, user_update_view app_name = "users" urlpatterns = [ path("~redirect/", view=user_redirect_view, name="redirect"), path("~update/", view=user_update_view, name="update"), path("<str:username>/", view=user_d...
# Generated by Django 2.2.5 on 2019-09-13 19:52 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] ope...
# -*- coding: utf-8 -*- # @Author: Jie # @Date: 2017-06-14 17:34:32 # @Last Modified by: Jie Yang, Contact: jieynlp@gmail.com # @Last Modified time: 2019-01-25 20:25:59 from __future__ import print_function from __future__ import absolute_import import argparse import sys import os import torch os.chdir(sys.pat...
from argparse import ArgumentParser from matplotlib import pyplot as plt from greengraph.Graph import Graph ''' This class implements the command line interface. ''' def runModule(): parser = ArgumentParser(description='Generates a graph that displays the number of green pixels per step between two geographical l...
# Generated by Django 3.2.4 on 2021-07-02 02:26 import django.core.validators from django.db import migrations, models import django.db.models.deletion import django.utils.timezone import model_utils.fields class Migration(migrations.Migration): initial = True dependencies = [ ('producto', '0003_al...
""" Module that manages the parsing of a Yambo o- file(s). """ import numpy as np # Specifies the name of the columns of the o- files for various type of runs. There are # two distint dictionaries depending if the ExtendOut option has been activated or not. # The rt outputs are not modified by the extendOut option r...
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and rel...
from itertools import product from textsearch import TextSearch import json import pkgutil json_open = pkgutil.get_data("contractions", "data/contractions_dict.json") contractions_dict = json.loads(json_open.decode("utf-8")) json_open = pkgutil.get_data("contractions", "data/leftovers_dict.json") leftovers_dict = js...
""" Tests for the authorization resource side of the authorization code grant flow. """ from txoauth2 import GrantTypes from tests import MockRequest from tests.unit.testGrant import Abstract class TestAuthorizationCodeGrant(Abstract.SharedGrantTest): """ Test the authorization resource part of the Authoriz...
# coding: utf-8 # (C) Copyright IBM Corp. 2015, 2021. # # 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 la...
''' Attitude discipline for CADRE ''' import numpy as np from openmdao.lib.datatypes.api import Float, Array from openmdao.main.api import Component from CADRE.kinematics import computepositionrotd, computepositionrotdjacobian # Allow non-standard variable names for scientific calc # pylint: disable-msg=C0103 cla...
import json import logging from pip._internal.models.direct_url import ( DIRECT_URL_METADATA_NAME, ArchiveInfo, DirectUrl, DirectUrlValidationError, DirInfo, VcsInfo, ) from pip._internal.utils.typing import MYPY_CHECK_RUNNING from pip._internal.vcs import vcs if MYPY_CHECK_RUNNING: from t...
import setuptools with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setuptools.setup( name="hsbalance", version="0.5.4", author="Maged M.Eltorkoman", author_email="newmaged@gmail.com", description="Python tools for Practical Modeling and Solving High Speed Rotor...
from django.contrib import admin from django.contrib.auth import admin as auth_admin from django.contrib.auth import get_user_model from django.utils.translation import gettext_lazy as _ from clockio.users.forms import UserAdminChangeForm, UserAdminCreationForm User = get_user_model() @admin.register(User) class Us...
#!/usr/bin/env python3 #----------------------------------------------------------------------------------------------------------------------# # # # Tuplex: Blazing...
# coding: utf-8 import pprint import re import six class IssueRequestV4: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is ...
# (C) Copyright IBM Corp. 2019, 2020. # # 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...
from itertools import chain, combinations from collections import defaultdict from functools import partial import warnings import multiprocess as mp import numpy as np import pandas as pd from scipy.signal import fftconvolve from scipy.interpolate import interp1d from cooler.tools import partition import cooler im...
#!/usr/bin/env python3 import time import colorsys import ioexpander as io print("""pwm.py Demonstrates running a common-cathode RGB LED, or trio of LEDs wired between each PWM pin and Ground. You must wire your Red, Green and Blue LEDs or LED elements to pins 1, 3 and 5. Press Ctrl+C to exit. """) PIN_RED = 1 P...
from poetry_polylith_plugin.components.projects.constants import dir_name from poetry_polylith_plugin.components.projects.create import create_project from poetry_polylith_plugin.components.projects.get import get_project_names __all__ = ["create_project", "get_project_names", "dir_name"]
# coding: utf-8 """ Adobe Target Delivery API No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 i...
# Authors: Matti Hämäläinen <msh@nmr.mgh.harvard.edu> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Martin Luessi <mluessi@nmr.mgh.harvard.edu> # # License: BSD (3-clause) # The computations in this code were primarily derived from Matti Hämäläinen's # C code. from time import time from copy ...
class Solution: def getNoZeroIntegers(self, n: int) -> List[int]: for i in range(0, n + 1): if str(i).count('0') == str(n - i).count('0') == 0: return [i, n - i]
# The following funtion is a thin wrapper around iter_entry_points. The reason it # is in this separate file is that when making the Mac app, py2app doesn't # support entry points, so we replace this function with a version that has the # entry points we want hardcoded. If this function was in glue/main.py, the # refer...
import re import subprocess import tempfile import time from pathlib import Path from typing import Any, List import docker import docker.errors import pytest import yaml from tests import command as cmd from tests import config as conf from tests.filetree import FileTree @pytest.mark.slow # type: ignore @pytest.m...
import numpy as np import torch CONST = 100000.0 def calc_dist(p, q): return np.sqrt(((p[1] - q[1])**2)+((p[0] - q[0]) **2)) * CONST def get_ref_reward(pointset): if isinstance(pointset, torch.cuda.FloatTensor) or isinstance(pointset, torch.FloatTensor): pointset = pointset.detach().numpy() num...
import logging import sys import cmd from interface.card import NotProvisioned, AlreadyProvisioned from interface import card, bank import os import json import argparse from Crypto.Cipher import AES from Crypto import Random import random newTamp = "" log = logging.getLogger('') log.setLevel(logging.DEBUG) log_format ...
from __future__ import unicode_literals from fontTools.feaLib import ast from fontTools.feaLib.parser import Parser from fontTools.feaLib.lexer import IncludingLexer, Lexer import silfont.feax_lexer as feax_lexer from fontTools.feaLib.error import FeatureLibError import silfont.feax_ast as astx import io, re, math impo...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
import Queue from class_objectProcessorQueue import ObjectProcessorQueue from multiqueue import MultiQueue workerQueue = Queue.Queue() UISignalQueue = Queue.Queue() addressGeneratorQueue = Queue.Queue() # receiveDataThreads dump objects they hear on the network into this queue to be processed. objectProcessorQueue = ...
# @Author ZhangGJ # @Date 2020/12/30 18:14 filename = '../../resources/programming.txt' with open(filename, 'w') as file_object: file_object.write("I love programming.\n") file_object.write("I love creating new games.\n")
""" Provides XML parsing support. """ import datetime import decimal from django.conf import settings from rest_framework.exceptions import ParseError from rest_framework.parsers import BaseParser from .compat import etree import re _parser = re.compile(r""" # A numeric string consists of: # \s* (?P<si...
# -*- coding: utf-8 -*- from ogs5py import OGS model = OGS( task_root='eq_root', task_id='eq', output_dir='out', ) model.msh.read_file('eq.msh') model.gli.read_file('eq.gli') model.pcs.add_block( main_key='PROCESS', PCS_TYPE='GROUNDWATER_FLOW', NUM_TYPE='NEW', ELEMENT_MATRIX_OUTPUT=0, ) mod...
# # Basic Single Particle Model (SPM) # import pybamm from .base_lithium_ion_model import BaseModel class BasicSPM(BaseModel): """Single Particle Model (SPM) model of a lithium-ion battery, from [2]_. This class differs from the :class:`pybamm.lithium_ion.SPM` model class in that it shows the whole model...
# -*- coding: utf-8 -*-# ''' # Name: Base_MNIST # Description: # Author: super # Date: 2020/6/19 ''' from matplotlib import pyplot as plt import numpy as np from Base import * from ExtendedDataReader.MnistImageDataReader import * def load_data(): dataReader = MnistImageDataReader(mode="tim...
import numpy as np import cv2 import sys import math import matplotlib.pyplot as plt def fxy(pt1,pts2,weights): K = np.zeros([pts2.shape[0],1]) for i in range(pts2.shape[0]): K[i] = U(np.linalg.norm((pts2[i]-pt1),ord =2)+sys.float_info.epsilon) f = weights[-1] + weights[-3]*pt1[0] +weights[-2]*pt1[...
from typing import Any, Dict, List, Literal from asgiref.sync import sync_to_async from botocore.exceptions import ClientError from cloudaux import CloudAux from cloudaux.aws.decorators import paginated from cloudaux.aws.sts import boto3_cached_conn from consoleme.config import config from consoleme.exceptions.except...
from django.shortcuts import redirect from django.http import HttpResponseRedirect from django.urls import reverse def get_post_response(view_name: str): return HttpResponseRedirect(reverse(viewname=view_name)) def redirect_view(request): return redirect("/hangman/")
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ecosystem_game.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise...
import logging from homeassistant.components.lovelace.dashboard import LovelaceYAML from homeassistant.components.lovelace import _register_panel from .const import DOMAIN _LOGGER = logging.getLogger(__name__) def load_dashboard(hass, config_entry): #_LOGGER.warning(config_entry.options) #_LOGGER.warning(c...
from typing import Optional from typing import Type import torch from scipy.sparse import coo_matrix from .indexing import SizeType from .indexing import unroll_index def torch_coo_to_scipy_coo(m: torch.sparse.FloatTensor) -> coo_matrix: """Convert torch :class:`torch.sparse.FloatTensor` tensor to. :class:...
# Copyright 2020 Huawei Technologies Co., Ltd # # 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...
# -*- coding: utf-8 -*- from setuptools import find_packages, setup REQUIREMENTS = [ 'grpcio', 'google-api-core' ] CLASSIFIERS = [ 'Intended Audience :: Developers', 'Operating System :: OS Independent', 'Programming Language :: Python :: 3.7', 'Topic :: Communications', 'Topic :: Softwar...
import datetime from sqlalchemy import Column, Integer, String, DateTime, Boolean, ForeignKey, Text from sqlalchemy.orm import relationship from sqlalchemy.sql import expression, func, text from werkzeug.security import check_password_hash, generate_password_hash from sqlalchemy.sql import and_ from flask import ren...
import glob import os import fitz import PIL as P import io import numpy as np import turicreate as tc import pandas as pd def load_paths(path): """ Loads pdf and tiff files from the root folder as a 1-D list. ----------------------------------------------------------- :param path: str, path of ...
from django.test import TestCase from django.contrib.auth import get_user_model from django.urls import reverse from django.test import Client class AdminSiteTests(TestCase): def setUp(self): self.client = Client() self.admin_user = get_user_model().objects.create_superuser( email='ad...
n=int(input("enter year\n")) if(n%400==0 and n%100==0): print("leap year") elif(n%4==0 and n%100!=0): print("leap year") else: print("not leap year")
__license__ = ''' Copyright 2010 Jake Wharton py-video-downloader is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. py-video-downloade...
import inspect import pytest import spidertools.common.reflection as reflection @pytest.mark.parametrize("package", ["command_lang", "common", "discord", "math", "twitch", "webserver"]) def test_docs(package): result = reflection.get_undoced(f"spidertools.{package}") assert len(result) is 0, f"Missing documen...
from mk2.plugins import Plugin from mk2.events import Hook class Save(Plugin): warn_message = Plugin.Property(default="WARNING: saving map in {delay}.") message = Plugin.Property(default="MAP IS SAVING.") def setup(self): self.register(self.save, Hook, public=True, name='save', doc='save...
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
from cockatiel.utils.filenames import generate_filename, get_hash_from_name def test_filename_checksum(): assert generate_filename('foo/bar/baz.html', 'abcdefghijk12345', 13) == 'foo/bar/baz_13_abcdefghijk12345.html' assert generate_filename('foo/bar/baz', 'abcdefghijk12345', 13) == 'foo/bar/baz_13_abcdefghij...
import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np import matplotlib.ticker from matplotlib.ticker import FormatStrFormatter def reset_plots(): plt.close('all') fontsize = 20 legsize = 15 plt.rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) plt.rc('text', use...
# urlpath.py # 0.1.0 # 2005/08/20 # Functions that handle url paths. # Part of Pythonutils # http://www.voidspace.org.uk/python/pythonutils.html # Copyright Michael Foord, 2004 & 2005. # Released subject to the BSD License # Please see http://www.voidspace.org.uk/python/license.shtml # For information about bugfixe...
from contextlib import ExitStack import threading from typing import List from ibapi import client from ibapi import account_summary_tags from ibapi import contract from ibapi import order from rx import operators as _ from rx.subject import ReplaySubject from ibrx.mess import message_wrapper from ibrx.mess.message i...
"""dsch backend for in-memory data storage. This backend stores all data in memory and cannot directly save to disk. For temporary data that does not have to be stored, the in-memory backend provides a clean way of data with dsch, without littering the workspace with temporary files. Also, it can be used to collect an...
from channels.routing import ProtocolTypeRouter, URLRouter from channels.auth import AuthMiddlewareStack from echo import routing as echo_routing application = ProtocolTypeRouter({ 'websocket': AuthMiddlewareStack( URLRouter( echo_routing.websocket_urlpatterns ) ) })
# Copyright (c) 2020 Pavel Vavruska # 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, d...
# 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...
"""API for Home Connect bound to HASS OAuth.""" from asyncio import run_coroutine_threadsafe import logging import homeconnect from homeconnect.api import HomeConnectError from homeassistant import config_entries, core from homeassistant.const import DEVICE_CLASS_TIMESTAMP, TIME_SECONDS, UNIT_PERCENTAGE from homeass...
import logging as logme class user: type = "user" def __init__(self): pass def inf(ur, _type): logme.debug(__name__+':inf') try: group = ur.find("div", "user-actions btn-group not-following ") if group == None: group = ur.find("div", "user-actions btn-group not-fol...
#!/usr/bin/env python3 # license removed for brevity #策略 機械手臂 四點來回跑 import rospy import os import numpy as np from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import math import enum import Hiwin_RT605_Arm_Command as ArmTask ##----Arm state----------- Arm_state_flag = 0 Strategy...
"""Convenience wrappers for connecting to AWS S3 and Redshift""" __version__ = '0.2.3' # Boto3 function from ._boto import boto_get_creds from ._boto import boto_create_session # Redshift functions from ._redshift import redshift_get_conn from ._redshift import read_sql from ._redshift import redshift_execute_sql # ...
from dataclasses import dataclass import collections import typing import sqlite3 import os import cyvcf2 import numpy as np import torch VERBOSE = True def set_verbose(b: bool): global VERBOSE VERBOSE = b @dataclass class VCFChunk: chunk_id: int chrom: str start: int end: int @class...
# Copyright (c) OpenMMLab. All rights reserved. import os import os.path as osp import tempfile from argparse import ArgumentParser import mmcv from mmtrack.apis import inference_vid, init_model def main(): parser = ArgumentParser() parser.add_argument('config', help='Config file') parser.add_argument('...
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # author: bigfoolliu """ 罗马数字包含以下七种字符: I, V, X, L,C,D 和 M。 字符 数值 I 1 V 5 X 10 L 50 C 100 D 500 M 1000 例如, 罗马数字 2 写做 II ,即为两个并列的 1。12 写做 XII ,即为 X + II 。 27 写做  XXVII, 即为 XX + V +...
""" * Copyright (c) 2021 Anthony Beaucamp. * * This software is provided 'as-is', without any express or implied warranty. * In no event will the authors be held liable for any damages arising from * the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including ...
from models import train_models from data import FARM_LIST def main(): models = train_models(FARM_LIST) return models if __name__ == '__main__': main()
import sys import os sys.path.append( os.path.join( os.getcwd(), '..' ) ) from sprites import Animation s = ["right foot", "left foot", "turn around", "sit down!"] a = Animation(s1) print (len(a) == 4) print (a.current() == "right foot") a.next() print (a.current() == 1)
r""" Congruence Subgroup `\Gamma(N)` """ ################################################################################ # # Copyright (C) 2009, The Sage Group -- http://www.sagemath.org/ # # Distributed under the terms of the GNU General Public License (GPL) # # The full text of the GPL is available at: # # ...
#!/usr/bin/env python3 # Copyright 2017-2019, The Johns Hopkins University Applied Physics Laboratory LLC # All rights reserved. # Distributed under the terms of the Apache 2.0 License. # # Export a translation dictionary # # usage: export.py lang # # It writes the file [lang].tsv to the current directory. # The file...
#!/usr/bin/env python3 -u #!/usr/bin/env python3 -u # 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. import torch from fairseq import checkpoint_utils, options, progress_bar, utils def mai...
from datetime import datetime, timezone from functools import wraps from flask import jsonify from sqlalchemy.orm.exc import NoResultFound from flask_jwt_extended import decode_token, verify_jwt_in_request, get_jwt_identity from app.models import TokenBlacklist, User from app import db from .exceptions import Token...
import unittest, test.support from test.script_helper import assert_python_ok, assert_python_failure import sys, io, os import struct import subprocess import textwrap import warnings import operator import codecs # count the number of test runs, used to create unique # strings to intern in test_intern() numruns = 0 ...
#PYTHONPATH=../:../../:../../../src:../../../../futile/src python CoapMeasurements.py from coap import CoapClient from coapy.coapy import options from time import sleep from timeit import timeit, repeat from random import randrange import threading """Config Constants""" #SERVER_HOST = "coap://10.147.65.150" SERVER_H...
"""SSDIR encoder.""" from copy import deepcopy from typing import List, Optional, Tuple import torch import torch.nn as nn from pytorch_ssd.modeling.model import SSD from pytorch_ssdir.modeling.depth import DepthEncoder from pytorch_ssdir.modeling.present import PresentEncoder from pytorch_ssdir.modeling.what import ...
''' ======================================================================== File Name: setup.py Author: Jason Li Description: Input setup file (50 nm Au sphere) Usage: ======================================================================== ''' #------------------------...
#!/usr/bin/env python """ Example of ttree usage to generate recursive tree of directories. It could be useful to implement Directory Tree data structure 2016 samuelsh """ import ttree import random from hashlib import blake2b from string import digits, ascii_letters MAX_FILES_PER_DIR = 10 def get_random_string(l...
from django.db.models import Q from typing import Optional from usaspending_api.references.constants import DOD_ARMED_FORCES_CGAC, DOD_ARMED_FORCES_TAS_CGAC_FREC from usaspending_api.references.models.cgac import CGAC from usaspending_api.references.models.frec import FREC def dod_tas_agency_filter(field_name=None, f...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Account.property' db.add_column(u'prop_management_account', 'property', ...
from sklearn import tree from digoie.core.ml.classifier.mla.base import MLAlgorithm class MLDecisionTree(MLAlgorithm): # ML_NAME = DECISION_TREE def __init__(self, training_dataset, training_label): super(MLDecisionTree, self).__init__(training_dataset, training_label) def generate(self): ...
#Import required libraries import os import pandas as pd from tensorflow import keras import matplotlib.pyplot as plt #Github: https://github.com/sujitmandal #This programe is create by Sujit Mandal """ Github: https://github.com/sujitmandal Pypi : https://pypi.org/user/sujitmandal/ LinkedIn : https://www.linkedin.com...
from setuptools import setup from setuptools import find_packages from setuptools.command.test import test as TestCommand import sys version = '0.33.0.dev0' # Remember to update local-oldest-requirements.txt when changing the minimum # acme/certbot version. install_requires = [ 'acme>=0.29.0', 'certbot>=0.33...
# Generated by Django 3.1.7 on 2021-04-06 15:35 import curriculum.models from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_US...
import numpy as np from lenstronomy.PointSource.point_source import PointSource import itertools from copy import deepcopy class LensedQuasar(object): def __init__(self, x_image, y_image, mag, t_arrival=None): """ Data class for a quadruply-imaged quasar :param x_image: x image positions...
from django.core.exceptions import ImproperlyConfigured from django.conf import settings from django.forms.utils import flatatt import logging import os import os.path import posixpath from ..util import crc32, getdefaultattr from ..util import log from .base import BaseProvider ######################################...
''' Individual stages of the pipeline implemented as functions from input files to output files. The run_stage function knows everything about submitting jobs and, given the state parameter, has full access to the state of the pipeline, such as config, options, DRMAA and the logger. ''' from utils import safe_make_di...
from ..utils import Object class UpdateMessageMentionRead(Object): """ A message with an unread mention was read Attributes: ID (:obj:`str`): ``UpdateMessageMentionRead`` Args: chat_id (:obj:`int`): Chat identifier message_id (:obj:`int`): Message id...
"""Data Plans module.""" try: from urllib.parse import urljoin # python 3 except ImportError: from urlparse import urljoin # python 2 import requests from furl import furl class DataPlans(object): """DataPlans class. The Data Plans endpoints return pricing and descriptions for the different da...
import _plotly_utils.basevalidators class DensitymapboxValidator(_plotly_utils.basevalidators.CompoundArrayValidator): def __init__( self, plotly_name="densitymapbox", parent_name="layout.template.data", **kwargs ): super(DensitymapboxValidator, self).__init__( plotly_name=plotly_n...
"""Test parsing arguments. Test target: - :py:meth:`lmp.script.gen_txt.parse_args`. """ import lmp.infer import lmp.script.gen_txt from lmp.infer import Top1Infer, TopKInfer, TopPInfer def test_top_1_parse_results(ckpt: int, exp_name: str, max_seq_len: int, seed: int) -> None: """Must correctly parse all argument...
# Copyright 2017 StreamSets Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
import os import re import datetime from easygui_labcuro import fileopenbox, diropenbox, enterbox, msgbox def inputstuff(title, msg_fileopenbox, file_type, file_extension, msg_enterbox): now = (str(datetime.datetime.now())[0:4] + str(datetime.datetime.now())[5:7] + str(datetime.datetime.now())[8:10] + ...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import division from __future__ import print_function import abc import pandas as pd from ..log import get_module_logger class Expression(abc.ABC): """Expression base class""" def __str__(self): return type(s...
#!/usr/bin/env python3 # Copyright (c) 2019-2020 The JDCOIN developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.authproxy import JSONRPCException from test_framework.test_framework import JdCoinTestFrame...
#!/usr/bin/env python # -*- coding: utf-8 -*- # File: cifar-convnet.py # Author: Yuxin Wu import tensorflow as tf import argparse import os from tensorpack import * from tensorpack.tfutils.summary import * from tensorpack.dataflow import dataset from tensorpack.utils.gpu import get_num_gpu """ A small convnet model f...
import pytest from django.contrib.auth import get_user_model from .models import Category @pytest.fixture(autouse=True) def tenants(): User = get_user_model() User.objects.create(username='John') User.objects.create(username='Mary') return User.objects.all() @pytest.fixture(autouse=True) def categ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from workalendar.core import WesternCalendar, ChristianMixin from workalendar.registry import iso_register @iso_register('LU') class Luxembourg(WesternCalendar, ChristianMixin): name = 'Luxembourg' include_easter_monday = True include_ascens...
import gym import sys import cube_gym import time from common.multiprocessing_env import SubprocVecEnv import tensorflow as tf import matplotlib.pyplot as plt import matplotlib.animation as animation from a2c import ActorCritic from policy import * def env_fn(): env = gym.make('cube-x3-v0') env.unwrapped._ref...
# Manacher's Algorithm class Manacher(): def __init__(self, s: str) -> None: self.s = s def coustruct(self) -> list: i, j = 0, 0 res = [0] * len(self.s) while i < len(self.s): while i - j >= 0 and i + j < len(self.s) and self.s[i - j] == self.s[i + j]: j += 1 res[i] = j k = 1 while i - k >= 0 ...