text
stringlengths
3.07k
22.1k
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
from qiskit import IBMQ, QuantumCircuit, ClassicalRegister, QuantumRegister, execute import numpy as np import matplotlib.pyplot as plt import math import matplotlib.ticker as tick template = np.array([4, 0, 2, 0, 0, 1, 0, 4, 1, 0, 4, 0, 0, 4, 0, 2]).reshape(4, 4) print(template) print(template[0]) print(template[0][...
""" Process xml pieces by pieces to dict ready to be inserted in DB. """ import logging from datetime import datetime from distutils.util import strtobool from typing import Dict, List, Optional, Generator, Any from uuid import UUID, uuid4 import lxml.etree as ET from lxml.etree import _Element from sqlalchemy import ...
#!/usr/bin/env python3 # filename: yaml-to-xls.py # Document baseline in Microsoft Excel format import io import glob import os import yaml import xlwt import types import collections import plistlib import argparse from xlwt import Workbook from string import Template from itertools import groupby from uuid import uu...
"""FieldGroup classes for processing multiple fields.""" from typing import Callable, Iterable from functools import partial from .fields import BaseField, Field, FieldDict, NestedField, NumberField from .utils import bind_attrs class FieldGroup(BaseField): """Process multiple fields of the data, after all sing...
# -*- coding: utf-8 -*- # Copyright 2021 Tampere University and VTT Technical Research Centre of Finland # This software was developed as a part of the ProCemPlus project: https://www.senecc.fi/projects/procemplus # This source code is licensed under the MIT license. See LICENSE in the repository root directory. # Auth...
import numpy as np import integrator import gravity from ephemerides import ephemerides import csv import time from plot import plotter, anim_plotter import math class body_differentials(integrator.differential_equation): def __init__(self, masses, *args, **kwargs): super().__init__() if len(masses...
import contextlib import logging import os import random import re import string from collections import defaultdict import deepmatcher as dm import numpy as np import pandas as pd from scipy.sparse import csr_matrix from models.ermodel import ERModel def wrapdm_mojito(model, ignore_columns=['label', 'id']): de...
import wx import os from angledlg import AngleDlg from toconfigdlg import ToConfigDlg colInfo = [ ("", wx.LIST_FORMAT_RIGHT, 20 if os.name == 'nt' else 30), ("Index", wx.LIST_FORMAT_RIGHT, 40), ("Normal", wx.LIST_FORMAT_RIGHT, 60), ("Reverse", wx.LIST_FORMAT_RIGHT, 60), ("Initial", wx.LIST_FORMAT_RIGHT, 60), ("...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Obslog handler This library provides methods to: - download the raw obslog.txt from the archive - parse the raw obslog.txt - extract the relevant obslog data for a particular Obs-ID - output a csv file for the requested Obs-ID with the original header info plus (P,Q) c...
import datetime from decimal import Decimal from django_extensions.db.fields import AutoSlugField from django.conf import settings from django.contrib.postgres.fields import HStoreField from django.core.exceptions import ValidationError from django.core.validators import MinValueValidator from django.db import models f...
# # Module 3. Simple exercises including I/O ( Input/Output ) # # Simple exercises to use I/O functins and the `re` module. # Documentation for input and output in python can be found in the following link. # http://docs.python.org/2/tutorial/inputoutput.html # import re, time, random from functools import reduce from ...
#!/usr/bin/env python ''' mrt2bgpdump.py - a script to convert MRT format to bgpdump format. Copyright (C) 2016 greenHippo, LLC. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apac...
import re import uuid import html import datetime from urllib.parse import urlparse from typing import Optional, Callable, List, Dict, Any, NamedTuple from .types import Hash import iqs_client # type aliases Row = Dict[str, Any] Rewriters = Dict[str, Callable[[Any], str]] # connector-specific extensions may add cus...
""" Copyright 2013, 2014 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in w...
#!/usr/bin/python import sys import re import csv import traceback import operator import argparse import gotolong.cutil.cutil from gotolong.database.database import * from gotolong.trendlyne.trendlyne import * from gotolong.fratio.fratio import * from gotolong.isin.isin import * class Gfundareco(Fratio, Trendlyn...
#!/usr/bin/env python3 from transport.transport_tcp import TransportTCP from transport.transport_serial import TransportSerial from protocol.communicator import Communicator from protocol.defs.defs2x6.defs2x6 import * from protocol.wrapper import * import time import json from json import JSONEncoder from cmd import Cm...
import os import pandas as pd __author__ = '<NAME>' __maintainer__ = '<NAME>' __email__ = '<EMAIL>' class Dataset: def __init__(self, filename): self.name = filename self.format = filename[filename.index('.', -7):] self.path = os.path.join(os.getcwd(), 'data', self.name) if se...
from re import findall, search, split import matplotlib.pyplot as plt import matplotlib.ticker as ticker from itertools import cycle @ticker.FuncFormatter def default_major_formatter(x, pos): if x >= 1_000: return f'{x/1000:.0f}k' else: return f'{x:.0f}' def sec_major_formatter(x, pos): ...
#!/usr/bin/env python """ Written by: <NAME> Copyright 2019 Creative Collisions Technology, LLC GravityServer.py MIT License This is the main entry point into the Gravity Web Server. This starts both the HTTP and the HTTPS server. """ import argparse import base64 import json import os import signal import socke...
import asyncio import functools import os import signal import ssl import sys import uvloop from gunicorn.workers.base import Worker from uvicorn.protocols.http import H11Protocol, HttpToolsProtocol try: import trio import trio_protocol except ImportError: trio = None trio_protocol = None class Uvi...
# -*- coding: utf-8 -*- # Python 3.6.3 import requests from bs4 import BeautifulSoup import re import time import mysql_util import json import os from multiprocessing.dummy import Pool # 股票详情URL列表 STOCK_URL_LIST = [] # 股票信息对象列表 STOCK_INFO_LIST = [] # 获取HTML页面内容 def get_html_text(url): user_agent = "Mozilla/5....
####################### # <NAME> yz2729 # # <NAME> sgd63 # # 12/15/2021 # ####################### import os import cv2 import dlib import sys import time import numpy as np from parameters import * from datetime import datetime from scipy.spatial import distance from imutils import face_utils as face from...
#!/usr/bin/env python # -*- coding:utf-8 -*- """ Implement Github operation """ from __future__ import print_function, division, unicode_literals from tornado import gen from .enumeration import StatusState class GithubEntity(object): """A object represents the entity of Github.""" def __init__(self, client...
import os import math import random import operator import re from collections import Counter # K = 10 # 设定类别数量(簇) WCSS = 0.0 # 初始化wcss new_WCSS = 1 # 初始化 threshold = 1e-6 # 认为不变动的阈值 0.000001 ITER_MAX = 30 # 设定最大迭代次数 file_path = 'F://八斗学院//视频//14期正式课//00-data//data' # 数据路径 label_dict = {'business': 0, 'yule': ...
from __future__ import print_function import logging logger = logging.getLogger(__name__) from pprint import pprint import json import os from mykrobe.utils import check_args from mykrobe.typing import CoverageParser from mykrobe.typing import Genotyper from mykrobe.predict import TBPredictor from mykrobe.predict impo...
# coding=utf-8 # 1 - Import library import math import time import pyglet import cocos from cocos.director import director from cocos.text import * from cocos.layer import Layer from cocos.sprite import Sprite from cocos.actions.interval_actions import MoveBy, MoveTo, RotateTo, Bezier from cocos.actions.instant_action...
import pygame import random import sys pygame.init() # Initialize variables version = 1.0 display_width = 800 display_heigth = 600 resources_path = 'resources/' black = (0,0,0) white = (255,255,255) red = (200,0,0) green = (0,200,0) blue = (0,0,200) bright_red = (255,0,0) bright_green = (0,255,0) bright_blue = (0,0,...
# -*- coding: utf-8 -*- """ Created on Fri Oct 18 14:46:31 2019 @author: William """ # Standard library imports import os import os.path import re import csv import time from collections import defaultdict, OrderedDict from contextlib import contextmanager # Third-party imports import biom from Bio import Phylo from...
# Copyright Contributors to the fossdriver project. # SPDX-License-Identifier: BSD-3-Clause OR MIT import json import logging from mimetypes import MimeTypes import os import requests from requests_toolbelt.multipart.encoder import MultipartEncoder import time import urllib import io import sys from version_parser imp...
def codegen(program): output = "" for statement in program: output += genTree(statement) + "\n" return output builtIns = {"LENGTH", "LEFT", "RIGHT", "RND", "RANDOMBETWEEN"} builtInTypes = {"STRING": "str", "INTEGER": "int", "BOOLEAN": "bool", "BOOL": "bool", "CHAR": "str"} typesNoInit = {"str", "in...
############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # TH...
from __future__ import print_function import os import numpy as np from keras.models import Model from keras.layers import Input, concatenate, Conv2D, MaxPooling2D, Conv2DTranspose, Dropout from keras.optimizers import Adam from keras.callbacks import ModelCheckpoint,ReduceLROnPlateau,EarlyStopping, CSVLogger from ker...
from pyqtgraph import ROI from pyqtgraph import QtGui from pyqtgraph import QtCore from pyqtgraph import TextItem from pyqtgraph import LayoutWidget from .utils import delete_content from .utils import get_bigger_bbox from .color import JChooseColor from .color import setup_color from .remove_item import JRemoveItem...
import argparse import os import numpy as np import torch import torch.nn as nn import utils.evaluator_finetuning as eu import few_shot_segmentor_pretrained as fs from settings import Settings from solver_pretrained import Solver from utils.evaluator import binarize_label from utils.data_utils import ImdbData import ...
# -*- coding: utf-8 -*- import pytest import tesults import sys import configparser import toml import os import time from _pytest.runner import runtestprotocol # The data variable holds test results and tesults target information, at the end of test run it is uploaded to tesults for reporting. data = { 'target': ...
from abc import abstractmethod from scipy.linalg import cho_solve import numpy as np from scem.data_utils.data_generators.Base import DataGenerator from scem.data_utils.density import log_gaussian_pdf_isotropic, log_gaussian_pdf, \ sample_gaussian from scem.data_utils.mathematics import qmult, log_sum_exp, hypercu...
from fastai import layers import torch import torch.nn as nn def mlp(inp_size,hidden_size,outp_size,device): l1 = nn.Linear(inp_size,hidden_size) l2 = nn.ReLU() l3 = nn.Linear(hidden_size,outp_size) return nn.Sequential(l1,l2,l3).to(device) def get_reslike_block(nfs,sz): return nn.Sequential( ...
from motor import frameworks from motor.frameworks.asyncio import pymongo_class_wrapper from ..database import claim_collection, insurance_data, claim_image_collection, users_collection from bson.objectid import ObjectId from fastapi.exceptions import HTTPException def claim_helper(claim, user) -> dict: data = { ...
# -*- encoding:utf-8 -*- """选股因子参数以及选择图形可视化""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import ipywidgets as widgets import numpy as np from ..PickStockBu.ABuPickRegressAngMinMax import AbuPickRegressAngMinMax from ..PickStockBu.ABuPickStockDemo imp...
# Copyright (c) 2017 FlashX, LLC # # 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, distrib...
# Dedicated to the public domain under CC0: https://creativecommons.org/publicdomain/zero/1.0/. import re from typing import Container, Dict, FrozenSet, List, Match, NoReturn, Set, Tuple, Type from pithy.buffer import Buffer from pithy.io import * from pithy.iterable import OnHeadless, fan_by_key_fn, group_by_heads f...
from conans.paths import (BUILD_INFO_GCC, BUILD_INFO_CMAKE, BUILD_INFO, BUILD_INFO_VISUAL_STUDIO, BUILD_INFO_XCODE) from conans.util.files import save import os class Generator(object): def __init__(self, build_info): self._build_info = build_info @property def content(...
"""Top-level model classes. Author: <NAME> (<EMAIL>) """ import layers import sample_layers import torch import torch.nn as nn import torch.nn.functional as F from util import myprint import yaml from args import get_train_args, get_test_args # args = get_train_args() args = get_test_args() use_char_embed = ar...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: mwu """ from __future__ import absolute_import from ._nx2gt import nx2gt import graph_tool.all as gt import seaborn as sns import pandas as pd import numpy as np from pyvis.network import Network import matplotlib.pyplot as plt from sklearn import preprocess...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Train an encoder-decoder model for neural conversation Copyright (c) 2017 <NAME> (<EMAIL>) This software is released under the MIT License. http://opensource.org/licenses/mit-license.php """ import argparse import math import sys import time import random i...
# coding: utf-8 # # Plotting Functions in Azure Machine Learning Package for Forecasting (AMLPF) # In this notebook, we go over the plotting functions in AMLPF for visualizing and analyzing forecasting results. The following functions are covered. # 1. Plot aggregated error distribution. # 2. Plot error density func...
from django.contrib.staticfiles.testing import StaticLiveServerTestCase from django.contrib.auth.models import User from selenium import webdriver from selenium.common.exceptions import (WebDriverException, NoSuchElementException) from selenium.webdriver.common.keys import Keys from dynamic_schemas.models import ...
""" PySCes interface code for systems biology modeling and SBML model markup. This toolbox assumes you have PySCes installed. <NAME>, 2012 """ from __future__ import division, absolute_import from PyDSTool import Generator from PyDSTool.common import args, remain from PyDSTool.common import _seq_types, _num_types i...
""" GUI to assist in the setup and running of an Opentrons OT-2. <NAME> University of North Carolina at Chapel Hill Lineberger Comprehensive Cancer Center 450 West Drive Chapel Hill, NC 27599-7295 Copyright 2021 """ import datetime import io import shutil import sys import os import socket import Tool_Box from Templ...
# coding=utf-8 # @Time: 2021/8/17 # @Author: em0ty # 通过Deamonset对集群内所有node均创建一个挂载根目录的pod,通过chroot实现在node上的信息收集 import os import time import argparse import json # 命令列表,需要执行的命令在这里添加。 cmds = [ "ifconfig", "ls -al", "mount", "cat ~/.bash_history", "env", "whoami", "cat /etc/passwd", "ps -...
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch import einsum import pytorch_lightning as pl from utils import exists, default, SupConLoss, Siren, plot_islands_agreement from einops import rearrange, repeat from einops.layers.torch import Rearrange TOKEN_ATTEND_SELF_VAL...
import cv2 import json import numpy as np import os import pandas as pd from sklearn.model_selection import train_test_split import shutil def get_lists(path, years_list): ''' parameters: path: path to directory containing the folders corresponding to each year (for each year, the corresponding cyclone fo...
#!/usr/bin/env python3 ''' paramiko some conmands to several workers''' # standard library modules import argparse import datetime from concurrent import futures import json import logging import os import subprocess import sys import time import paramiko from eventTiming import eventTiming logger = logging.getLog...
# -*- coding: utf-8 -*- """ @created: Aug 13 2020 @modified: Oct 30 220 @author: <NAME> CentraleSupelec MICS laboratory 9 rue <NAME>, Gif-Sur-Yvette, 91190 France Functions for manually parsing VCF files. """ import os import numpy as np import pandas as pd import re from ._util import load_vcf DataFra...
import keras.backend as K from .. import backend def tobbox(centroids, sides): '''To Bonding box Convert a cube coordinates to the form like [x1,x2,y1,y2,z1,z2] Args: centroids : Tensor, the centroids of cube with shape (N,3). sides : Respective side length, could be a int value ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """twitter.py - authenticate and retrieve tweets from Twitter using Tweepy. See README.md or https://github.com/nicholasadamou/stockmine for more information. Copyright (C) <NAME> 2019 stockmine is released under the Apache 2.0 license. See LICENSE for the full license te...
"""Utility plotting functions""" import itertools import os.path import matplotlib.pyplot as plt import numpy as np from silicone.stats import rolling_window_find_quantiles def _plot_emission_correlations_quantile_rolling_windows( emms_df, output_dir, years, x_gas="Emissions|CO2", quantiles=None...
# -*- coding: utf-8 -*- import random, os, re, configparser, codecs, datetime, time from mongoengine import * from models import Room, Deck from language_cards import app, pool, log, TIME_TO_LIVE, RECONNECTION_TIME """ Database using """ def room_exists(room_id): if Room.objects(Q(name=room_id)).first() is no...
from __future__ import print_function, division from collections import OrderedDict import torch import torch.nn as nn from deepself.models.nn_models.nn_utils import initialize_weights supported_rnns = { 'lstm': nn.LSTM, 'rnn': nn.RNN, 'gru': nn.GRU } from dataclasses import dataclass from deepself.ut...
import logging import time from enum import Enum from typing import IO, AnyStr, Dict, List, Optional import requests import typer from bs4 import BeautifulSoup from colorama import Fore, Style, init from pydantic import BaseModel, FilePath, HttpUrl, ValidationError from requests.models import Response __v...
"""Convert the dataset into format understood by label studio""" import json import argparse from pathlib import Path from typing import Dict, List, Mapping, Generator, Optional, Union from copy import deepcopy import itertools import re import logging from .reader import DatasetReader from .types import (Sample, Sing...
from django.conf import settings from django.core.cache import cache from channels import Channel, Group from channels.sessions import channel_session, enforce_ordering from channels.auth import http_session_user, channel_session_user, channel_session_user_from_http from channels.handler import AsgiHandler, AsgiReques...
#!/usr/bin/env python3 # md_nvt_lj_le.py #------------------------------------------------------------------------------------------------# # This software was written in 2016/17 # # by <NAME> <<EMAIL>>/<<EMAIL>> # # and <NAME> <<EMAIL>> ...
#!/usr/bin/env python3.8 # Copyright 2021 The Fuchsia Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Build packages.archive.tgz.""" import argparse import filecmp import json import os import subprocess import sys from typing impo...
#!/usr/bin/env python3 import json import socket from email.utils import parsedate_to_datetime from locale import LC_ALL, setlocale from urllib.parse import urlencode from urllib.request import urlopen from xml.etree import ElementTree from flask import (Flask, abort, current_app, flash, jsonify, make_response, ...
"""People Counter.""" """ Copyright (c) 2018 Intel Corporation. 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, modif...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ main launcher panel for all available apps from felapps Author: <NAME> Created: Oct. 8, 2015 """ import wx import time from ...utils import miscutils from ...utils import funutils from ...utils import resutils from .. import cornalyzer from .. import dataworkshop fr...
# Copyright 2019-present Kensho Technologies, LLC. from dataclasses import dataclass from typing import AbstractSet, Dict, Set, Tuple, Union import warnings import six from sqlalchemy import Table from ...schema import INBOUND_EDGE_FIELD_PREFIX, OUTBOUND_EDGE_FIELD_PREFIX from ...schema.schema_info import CompositeJo...
# 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 ncc.data.summarization.language_pair_dataset import LanguagePairDataset # from .translation import load_langpair_dataset, ...
# AutoTransform # Large scale, component based code modification library # # Licensed under the MIT License <http://opensource.org/licenses/MIT> # SPDX-License-Identifier: MIT # Copyright (c) 2022-present <NAME> <http://github.com/nathro> # @black_format """Utility methods for getting user input for AutoTransform."""...
__source__ = 'https://leetcode.com/problems/k-similar-strings/' # Time: O() # Space: O() # # Description: Leetcode # 854. K-Similar Strings # # Strings A and B are K-similar (for some non-negative integer K) if we can swap the positions of two letters in A exactly K times so that the resulting string equals B. # # Giv...
import pandas as pd import os import pymorphy2 from sklearn.preprocessing import MinMaxScaler from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer import numpy as np import pickle PATH = 'models/' with open(os.path.join(PATH, 'tfidf.pkl'), 'rb') as f: tfidf = pickle.load(f) tim...
# -*- coding: utf-8 -*- """ This program uses Yelp"s Fusion API to: (1) Query for a specific business --->>> GET https://api.yelp.com/v3/businesses/search using the criteira: "categories", "location", "name" in the query string, and (2) Once the page url is extracted for a business, scrape the reivews and ratings ...
import Chinese_bboxdetect as bboxdetect import Chinese_OCR_new as orc import os from PIL import Image import cv2 import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from pylab import mpl mpl.rcParams['font.sans-serif'] = ['FangSong'] # 指定默认字体 mpl.rcParams['axes.unicode_minus'] = False # 解决保存图像是负...
# Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) 2020, <NAME> (@e-bug). # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import sys import json from volta.volta.datasets.flickr30ke_ablation_dataset import FlickrVis4...
### MDP Value Iteration and Policy Iteration ### Reference: https://web.stanford.edu/class/cs234/assignment1/index.html ### Name : <NAME> import numpy as np np.set_printoptions(precision=3) """ For policy_evaluation, policy_improvement, policy_iteration and value_iteration, the parameters P, nS, nA, gamma are define...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # no...
import numpy as np import pandas as pd import scanpy.api as sc import anndata import bbknn import os from scipy import sparse import pickle from multiprocessing import Pool from sklearn.metrics import auc, roc_curve import sys from read_pickle_data import * sc.settings.verbosity = 3 # verbosity: errors (0), warnings ...
# Copyright 2021 RangiLyu. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
# -*- coding: utf-8 -*- ''' * @license * Copyright <NAME>. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at * https://github.com/BrunoMeyer/heart-segmentation/blob/master/LICENSE ''' import sys from collections import defaultdict imp...
from problem1 import * import numpy as np import sys from sklearn.datasets import make_classification ''' Unit test 1: This file includes unit tests for problem1.py. You could test the correctness of your code by typing `nosetests -v test2.py` in the terminal. ''' #------------------------------------------...
#!/usr/bin/env python # coding: utf-8 # In[1]: # import spark liriaries from pyspark.context import SparkContext from pyspark.sql.context import SQLContext from pyspark.sql.session import SparkSession from pyspark.sql.functions import regexp_extract from pyspark.sql.functions import col from pyspark.sql.functions im...
# --- built in --- # --- 3rd party --- import numpy as np import torch from scipy import stats as sp_stats from parameterized import parameterized # --- my module --- from rlchemy.lib.prob import distribs as rl_distribs from rlchemy.lib import utils as rl_utils from test.utils import TestCase TEST_SEED = ...
from flask import request, jsonify, g, url_for from flask_restplus import abort, Resource, fields, Namespace, marshal_with from flask_restplus import marshal from sqlalchemy import desc from app.models.company import Company from app.models.resource import ResourceMeta from app.models.telecom import Telecom from app.mo...
from typing import * from itertools import * from copy import copy import logging class Clause: __slots__ = ('undef', 'defined', 'i_') # undef: Set[int] # defined: Set[int] # i_: int def __init__(self, undef: Iterable[int], defined: Iterable[int], i_: int): self.undef = set(undef) ...
# Orrery as a desktop background # Using Skyfield # https://rhodesmill.org/skyfield # pip install skyfield import skyfield.api as skyfieldAPI import math from PIL import Image, ImageDraw import sys import subprocess from abc import ABCMeta, abstractmethod # from datetime import timedelta, time ts = skyfieldAPI.loa...
# -*- coding: utf-8 -*- """ Created on 21-5-11 @author: zjs (01376022) Full inference script to run on onnxruntime and tensorRT! # TODO (zjs): Make it more flexible, currently run *SOLOv2 light R34* successfully on coco model with static input shape # TODO (zjs): Remove torch op in preprocess and postprocess ``` de...
__doc__ = """ A quick-and-dirty script for converting a README.rml file with BBCode-like syntax to README.rst and README.md """ NONE = 0 TEXT = 2**0 BOLD = 2**1 ITALIC = 2**2 URL = 2**3 CODE = 2**4 LIST = 2**5 SEPARATOR = 2**6 FOOTNOTE = 2**7 HYPERLINK = 2**8 TITLE = 2**9 SUBTITLE = 2**10 SECTION1 = 2**11 SECTION2 = 2...
# -*- coding:utf-8 -*- import tkinter as tk import os import time import copy import CnnNet # 定义窗口 top = tk.Tk() top.title("机器博弈大作业") top.geometry('300x300') # max game rounds max_gameRound = 300000 # 定义地图尺寸 mapsize = 3 # 元素尺寸 pixsize = 60 # 连子个数 winSet = 3 # 空白编号 backcode = 0 # 白棋 whitecode = 1 # 黑棋 blackcode = ...
#!/usr/bin/env python # test_person.py """Tests for `person` package.""" # pylint: disable=redefined-outer-name import pytest from person import person from person.person import NotGermanParty, Party names = [ ["<NAME>", "Boeselager"], ["<NAME>.", "Pimpernell"], ["<NAME>", "<NAME>"], ] def equivalent_n...
# This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. # # Copyright 2009-2019 DataONE # # Licensed under the Apache License, Version 2.0 (the "License"); # you ma...
from enum import unique from mimetypes import init from .models import Game from .forms import AddGame from django.http import HttpResponseRedirect, HttpResponse from django.shortcuts import get_object_or_404, render from django.urls import reverse, reverse_lazy from django.views import generic from django.utils impor...
# -*- coding: utf-8 -*- """ Created on Wed Mar 17 11:09:49 2021 Team: SORA <NAME> <NAME> <NAME> <NAME> """ #import required libraries import os #need this library to change file locations import argparse #need argparse library to take inputs from the commandline import datetime #date time library, n...
import calendar import csv import locale import re from collections import defaultdict from datetime import datetime, timedelta, date class Parser: parsers = {} def __init__(self, *, date_col=None, reason_col=None, value_col=None, account=None, locale=None, encoding='utf-8', reason_regexes=N...
from string import ascii_letters, digits, Template from datetime import datetime, timezone from flask import g, current_app from src.rq import task_queue, prepare_task, run_task from src.http import telegram from src.i18n import gettext from src.blueprints._common.utils import get_current_iso_datetime from src.bluepr...
""" The ``export`` submodule hosts all classes related to sheet export such as **DWG** and **PDF**. For example sending the currently active sheet to a PDF printer in the network works as follows:: exporter = revitron.PDFExporter(printerAddress, printerPath) exporter.printSheet(revitron.ACTIVE_VIEW, 'A0', ...
#!/usr/bin/env python # - coding: utf-8 - # Copyright (C) 2014 <NAME> <<EMAIL>> """Exploring symmetry. Feel free to add more handles!""" import math import random from collections import defaultdict from gi.repository import Gtk as gtk from gi.repository import GObject as gobject from gi.repository import Pango as pa...
import os import errno from morenines.index import Index from morenines.ignores import Ignores from morenines.exceptions import PathError, RepositoryError, NoEffectWarning NAMES = { 'mn_dir': '.morenines', 'index': 'index', 'ignore': 'ignore', 'new_index': 'new_index', 'index_archive_dir': 'inde...
import pygame import random import os import pickle import Button # Starts game pygame.init() # Centers the game window os.environ['SDL_VIDEO_CENTERED'] = '1' # Color definitions white = (255,255,255) black = (0,0,0) red = (255, 0, 0) lightRed = (249, 52, 52) green = (0, 155, 0) lightGreen = (74, 196, 74) # Game...