content
stringlengths
5
1.05M
#!/usr/bin/env python """deque.py: Deque implementation""" __author__ = 'rohitsinha' class Deque: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def addFront(self, item): self.items.append(item) def addRear(self, item): self.items.in...
import numpy as np from keras.models import Sequential from keras.layers import Dense, Activation from keras.layers import Dropout from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix, classification_report import pandas as pd import seaborn as sns import matplotlib.pyplot a...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class TradeComplainQueryResponse(object): def __init__(self): self._complain_event_id = None self._complain_reason = None self._content = None self._gmt_create = None ...
# import modules import sys import pygame # define color white (red, green, blue) (0-255) WHITE = (255, 255, 255) # is the game finished? finished = False # initialize pygame pygame.init() # set our display as fullscreen game_display = pygame.display.set_mode((0, 0), pygame.FULLSCREEN) # set the background color as...
#!/usr/bin/python3 # booksales.py: show how to use LAST_INSERT_ID(expr) import mysql.connector import cookbook conn = cookbook.connect() try: #@ _UPDATE_COUNTER_ cursor = conn.cursor() cursor.execute(''' INSERT INTO booksales (title,copies) VALUES('The Greater Trumps',LAST_INSER...
import unittest from python_oop.testing.lab.List.extended_list import IntegerList class IntegerListTest(unittest.TestCase): def test_integers_add_when_integer(self): integer_list = IntegerList() internal_list = integer_list.add(1) self.assertEqual([1], internal_list) def test_intege...
import os import identifiers_api from create_identifiers.lib import utils from create_identifiers.lib import arguments from create_identifiers.regulondb_multigenomic import multigenomic_identifiers def run(input_path, **kwargs): """ :param paths: :param kwargs: :return: """ utils.verify_pa...
def test_service_properties(test_servicer_tls_config): assert isinstance(test_servicer_tls_config.hostport, str) assert test_servicer_tls_config.use_server_ssl is True assert test_servicer_tls_config.ssl_server_credentials is not None assert test_servicer_tls_config.ssl_channel_credentials is not None
from flask import Blueprint, jsonify, request, Response from project import db from project.api.models import Todo, User todo_blueprint = Blueprint( "todos", __name__ ) @todo_blueprint.route("/api/todos") def get_todos(): response = [] todos = db.session.query(Todo).all() for todo in todos: ...
import factory import factory.fuzzy from django.contrib.gis.geos import MultiPolygon, Point, Polygon from factory.random import randgen from munigeo.models import Address, Municipality, Street from .models import ContractZone class ContractZoneFactory(factory.django.DjangoModelFactory): name = factory.Faker("bs"...
def create_identity(user, sp_mapping): identity = {} for user_attr, out_attr in sp_mapping.items(): if hasattr(user, user_attr): identity[out_attr] = getattr(user, user_attr) return identity
__author__ = 'erik + jc + benni' import numpy as np class Coordinate(object): """ Coordinate is a base class for everything which has a position. """ def __init__(self, id, x, y, z): """ :param id: id of this object :param x: x coordinate :param y: y coordinate ...
import math import math as m {} x = int(input(int(input()))) print(x)
#-*- coding:utf-8 -*- from flask import Flask,render_template,request import MySQLdb,sys import base64 reload(sys) sys.setdefaultencoding("utf-8") MYSQL_HOST = '127.0.0.1' MYSQL_USER = 'root' MYSQL_PASS = 'root' MYSQL_DB = 'bot' app = Flask(__name__) @app.route('/view') def view(): conn = MySQLdb.connect(MYSQL_...
""" Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. SPDX-License-Identifier: Apache-2.0 OR MIT """ """ C13751579: Asset Picker UI/UX """ import os import sys from PySide2 import QtWidgets, QtTest, QtCore from ...
from .cli import Cli, CommandGroup from .utils import Option
# -*- coding: utf-8 -*- from __future__ import absolute_import from aiida.orm import RemoteData, FolderData, SinglefileData, Dict from aiida_quantumespresso.calculations.namelists import NamelistsCalculation class Pw2wannier90Calculation(NamelistsCalculation): """ pw2wannier90.x code of the Quantum ESPRESSO d...
"""AssKeyValueMapping definition.""" from collections.abc import Iterable from typing import Any from ass_parser.ass_sections.ass_base_section import AssBaseSection from ass_parser.errors import CorruptAssLineError from ass_parser.observable_mapping_mixin import ObservableMappingMixin class AssKeyValueMapping(Observ...
import os import numpy as np from lib.datasets.dataset_utils import filter_mot_gt_boxes import cv2 import pandas mot_dir = '/home/liuqk/Dataset/MOT' mot = { 'MOT17': { 'train': ['MOT17-13', 'MOT17-11', 'MOT17-10', 'MOT17-09', 'MOT17-05', 'MOT17-04', 'MOT17-02'], 'test': ['MOT17-01', 'MOT17-03', 'M...
from ward import test from users.tests.api import admin_graphql_client from users.tests.factories import user_factory from users.tests.session import db @test("unlogged cannot fetch me") async def _( admin_graphql_client=admin_graphql_client, db=db, user_factory=user_factory ): user = await user_factory(emai...
import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv("http://fbug-store.herokuapp.com/csv") SENSOR_1_ID = "200040001047373333353132" SENSOR_2_ID = "35005c000d51363034323832" SENSOR_3_ID = "2d0049000d51363034323832" WINDOW = 40 df.timestamp = pd.to_datetime(df.timestamp) sensor_1_time = df[df.device...
# Copyright (c) 2018-2022 The CYBAVO developers # All Rights Reserved. # NOTICE: All information contained herein is, and remains # the property of CYBAVO and its suppliers, # if any. The intellectual and technical concepts contained # herein are proprietary to CYBAVO # Dissemination of this information or reproduction...
# # Code by Alexander Pruss and under the MIT license # from mineturtle import * t = Turtle() t.turtle(None) t.pendelay(0) t.angle(0) # align to grid def face(): t.startface() for i in range(4): t.go(20) t.yaw(90) t.endface() t.penblock(block.GLASS) for i in range(2): face() t...
import os import random import pymongo import datetime import seaborn as sns import matplotlib as plt from discord.ext import commands from discord import File from pandas import DataFrame from discord import Embed from dotenv import load_dotenv mongo_client = pymongo.MongoClient("mongodb://localhost:27017/") db = mo...
# -*- coding: utf-8 -*- from collections import defaultdict import re from nltk import tree from swda import CorpusReader from tree_pos_map import TreeMapCorpus from tree_pos_map import POSMapCorpus possibleMistranscription = [("its", "it's"), ("Its", "It's"), (...
from django import forms from .models import Userm,Neighborhood,Business,Post class NewProfileForm(forms.ModelForm): class Meta: model = Userm exclude = ['user'] class PostForm(forms.ModelForm): class Meta: model = Post exclude = ['author','post_date']
from diagrams import Cluster, Diagram, Edge from diagrams.aws.analytics import KinesisDataStreams, KinesisDataFirehose from diagrams.aws.compute import Lambda from diagrams.aws.database import DDB from diagrams.aws.integration import Eventbridge, SQS from diagrams.aws.mobile import Amplify from diagrams.aws.network im...
class WrongfulError(Exception): """定义异常,此类为传入字符不合法异常,无法正常转换为数字时间""" def __init__(self,err='Unknown error.'): Exception.__init__(self,err)
class CIL_Node: pass class ProgramCil(CIL_Node): def __init__(self, types, data, code): self.types = types self.data = data self.code = code class TypeCil(CIL_Node): def __init__(self, idx, attributes=[], methods=[]): self.id = idx self.attributes = attributes ...
class Node(object): def __init__(self, val, left, right, next): self.val = val self.left = left self.right = right self.next = next class Solution(object): def connect(self, root): """ :type root: Node :rtype: Node """ if not root: ...
#! /usr/bin/env python # encoding: utf-8 from aoc2017.day_14 import hash_grid_2 def test_hash_grid_2_1(): input_ = "flqrgnkx" output = 1242 assert hash_grid_2(input_) == output
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities fro...
from datetime import datetime from typing import Any, Dict, List, Optional import pydantic from python_on_whales.utils import DockerCamelModel class ObjectVersion(DockerCamelModel): index: int class NamedResourceSpec(DockerCamelModel): kind: str value: str class DiscreteResourceSpec(DockerCamelModel...
from random import randint from celery_tasks.sms.tasks import send_sms_code from django.shortcuts import render, redirect from django import http from django.views import View import re, json, logging from django.contrib.auth import login, authenticate, logout, mixins from django.core.paginator import Paginator, EmptyP...
quote = """ Alright, but apart from the Sanitation, the Medicine, Education, Wine, Public Order, Irrigation, Roads, the Fresh-Water System, and Public Health, what have the Romans ever done for us? """ for c in quote: if c.isupper(): print(c)
def showMenu(): output = "" output += "---------------------------------------\n" output += "| |\n" output += "| |> |--| |--| /\ /\ |\n" output += "| |> |__| |__| / \/ \ |\n" output += "| |...
""" This script is equivalent of the jupyter notebook example_locust_dataset.ipynb but in a standard python script. """ from tridesclous import * import pyqtgraph as pg from matplotlib import pyplot import time from pprint import pprint dirname = 'tridesclous_olfactory_bulb' def initialize_catalogueconstructor():...
from django.db import models # Create your models here. class Link(models.Model): chave = models.SlugField(verbose_name="Identificação Rede",max_length=100,unique=True) descricao = models.CharField(verbose_name='Descrição',max_length=100) url = models.URLField(max_length=200,null=False,blank=False) cri...
"""AppArmor control for host.""" from __future__ import annotations import logging from pathlib import Path import shutil from awesomeversion import AwesomeVersion from ..coresys import CoreSys, CoreSysAttributes from ..exceptions import DBusError, HostAppArmorError from ..resolution.const import UnsupportedReason f...
# wemos_flash.py Test flash chips with ESP8266 host # Released under the MIT License (MIT). See LICENSE. # Copyright (c) 2020 Peter Hinch import uos from machine import SPI, Pin from flash_spi import FLASH cspins = (Pin(5, Pin.OUT, value=1), Pin(14, Pin.OUT, value=1)) spi=SPI(-1, baudrate=20_000_000, sck=Pin(4), mi...
from vrepper.lib.vrepConst import sim_jointfloatparam_velocity, simx_opmode_buffer, simx_opmode_streaming from vrepper.utils import check_ret, blocking import numpy as np class vrepobject(): def __init__(self, env, handle, is_joint=True): self.env = env self.handle = handle self.is_joint = ...
#!/usr/bin/python2.7 def fib(n): """ TODO """ result = [] a, b = 0, 1 while a < n: result.append(a) a, b = b, a + b return result f = fib print (f.__doc__) print f(100)
from __future__ import absolute_import, unicode_literals, print_function, division import sys import os import datetime import json from pytest import raises from flexmock import flexmock from .helper import json_data, json_str sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) impor...
from typing import Any, Dict, List, Text import regex import re import rasa.shared.utils.io from rasa.shared.constants import DOCS_URL_COMPONENTS from rasa.nlu.tokenizers.tokenizer import Token, Tokenizer from rasa.shared.nlu.training_data.message import Message class WhitespaceTokenizer(Tokenizer): defaults =...
from .vika import Vika __all__ = (Vika, )
"""User Profile""" from django.db import models from django.utils.translation import gettext_lazy as _ from src.apps.core.models import BaseAuditableModel from src.apps.user.models import User class UserProfile(BaseAuditableModel): """User profile model""" GENDER = ( ('M', 'Male'), ('F', 'F...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'mainWindows.ui' # # Created by: PyQt5 UI code generator 5.13.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets import cv2 as cv import matplotlib.pyplot as plt import numpy as np import m...
from unittest import TestCase from utilities import getDictValue class Test_Utilities(TestCase): def setUp(self): self.fixture = {'posts': {'comments': [{'text': 'smartidea'}]}} def tearDown(self): self.fixture = None def test_get_dict_value(self): out = getDictValue(self.fixture...
from django.contrib import messages from django.test import TestCase from django.urls import reverse from bookclubs.forms import LogInForm from bookclubs.models import User from bookclubs.tests.helpers import LogInTester, reverse_with_next class LogInViewTestCase(TestCase, LogInTester): """Tests for the log in v...
import sys import tkinter as tk import tkinter.font as tk_font from tkinter import messagebox def beep(): print("\a", end="") sys.stdout.flush() class BoardValues(): """ Board values.""" none = 0 loss = 1 draw = 2 unknown = 3 win = 4 class SkillLevels(): ""...
from django.db import models # Create your models here. class Task(models.Model): task_name = models.CharField(max_length= 200) task_desc = models.CharField(max_length= 200) date_created = models.DateTimeField(auto_now=True) completed = models.BooleanField(default=False) image = models.ImageField...
""" Module used for initializing plots to draw histograms. """ import numpy as np import matplotlib.pyplot as plt import const def init_bar_plot(): """ Initialize histogram stacked bar plot. """ _fig, axis = plt.subplots() axis.set_title('Stacked bar plot histogram (BGR)') axis.set_xlabel('Bin...
from flask import Flask, send_from_directory def loader(app: Flask): """ This function is to create multiple static files based on the ``STATICFILES`` configuration. """ staticfiles = app.config.get("STATICFILES", []) for static in staticfiles: path, endpoint, static_folder = st...
from .. import core from .mixin import ArrayMixin class NumpyArray(ArrayMixin, core.NumpyArray): """An underlying numpy array. .. versionadded:: (cfdm) 1.7.0 """ def __getitem__(self, indices): """Returns a subspace of the array as a numpy array. x.__getitem__(indices) <==> x[indic...
import pytest from backend.blockchain.blockchain import Blockchain from backend.blockchain.block import GENESIS_DATA @pytest.fixture def blockchain(): return Blockchain() @pytest.fixture def foo_chain(blockchain): for i in range(3): blockchain.add_block(i) return blockchain def test_blockchai...
# -*- coding: utf-8 -*- import os import pytest from Bio.Seq import Seq import numpy as numpy from neoRNA.io.mut_count_io import MutCountIO parametrize = pytest.mark.parametrize class TestMutRateIO(object): fileDir = os.path.dirname(os.path.realpath('__file__')) __EXAMPLE_FILENAME = 'tests/io/example_file...
import pytest import requests def test_swagger(): model_endpoint = 'http://localhost:5000/swagger.json' r = requests.get(url=model_endpoint) assert r.status_code == 200 assert r.headers['Content-Type'] == 'application/json' json = r.json() assert 'swagger' in json assert json.get('info'...
# -*- coding: utf-8 -*- import os import sys import argparse # env sys.path.append('/usr/lib/python2.7/dist-packages/') sys.path.append('/usr/lib/python2.7/') sys.path.append('/usr/local/lib/python2.7/dist-packages/') sys.path.append('/data2/django_1.8/') sys.path.append('/data2/django_projects/') sys.path.append('/da...
#! /usr/bin/env python3 ''' Problem 33 - Project Euler http://projecteuler.net/index.php?section=problems&id=033 ''' from math import gcd from fractions import Fraction from functools import reduce from operator import mul def is_digit_cancelling_fraction_pair(i, j): i_s = str(i) j_s = str(j) for s in i_s...
# -*- coding: utf-8 -*- r""" Finite State Machines, Automata, Transducers This module adds support for finite state machines, automata and transducers. See classes :class:`Automaton` and :class:`Transducer` (or the more general class :class:`FiniteStateMachine`) and the :ref:`examples <finite_state_machine_examples>` ...
from django.contrib import admin from . import models class LibraryAdmin(admin.ModelAdmin): search_fields = ( "owner", "name", "repository__owner", "repository__name", "repository__remote_id", ) admin.site.register(models.Library, LibraryAdmin)
from avatar.models import Avatar from django.shortcuts import render from rest_framework import status from rest_framework.decorators import permission_classes, api_view from rest_framework.permissions import IsAuthenticatedOrReadOnly from rest_framework import viewsets from rest_framework.views import APIView from ava...
def SubsequenceLength(string): seen = {} maximum_length = 0 start = 0 for end in range(len(string)): if string[end] in seen: start = max(start, seen[string[end]] + 1) seen[string[end]] = end maximum_length = max(maximum_length, end-start + 1) return maximum...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('umibukela', '0019_auto_20170124_1252'), ] operations = [ migrations.AlterField( model_name='cycleresultset', ...
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import tempfile import unittest import md5_check class TestMd5Check(unittest.TestCase): def testCallAndRecordIfStale(self): input_strings = ['string...
import os import shutil from time import sleep from cerium import AndroidDriver from watchdog.events import FileSystemEventHandler from watchdog.observers import Observer from constants import DIR_CHOOSE, DIRECTORY, POSITION from quizzes import insert_db from utils import choose_parsing, confirm_question, question_pa...
import time def get_next_array(the_str): j = 0 k = -1 next_array = [-1] + [0] * (len(the_str)-1) while j < len(the_str) - 1: if k == -1 or the_str[j] == the_str[k]: j += 1 k += 1 next_array[j] = k else: k = next_array[k] return next_a...
''' Test script for GrFNN, plotting the entrainment for a sin wave of changing frequency. @author T. Kaplan ''' import numpy as np import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt import time from gfnn import FrequencyType, FrequencyDist, ZParams, GrFNN from plot import spectro_plot # Constr...
#!/usr/bin/env python # encoding: utf-8 from flask import render_template from .. import demo @demo.app_errorhandler(404) def page_not_found(e): return "page not found" @demo.app_errorhandler(500) def internal_server_error(e): return "internal server error"
# -*- coding: utf-8 -*- """SuperDARN data support for grdex files(Alpha Level!) Parameters ---------- platform : string 'superdarn' name : string 'grdex' tag : string 'north' or 'south' for Northern/Southern hemisphere data Note ---- Requires davitpy and davitpy to load SuperDARN files. Uses environment v...
def load(h): return ({'abbr': 192, 'code': 192, 'title': 'Medical meteorological products'}, {'abbr': 193, 'code': 193, 'title': 'Diagnostic meteorological products'}, {'abbr': 194, 'code': 194, 'title': 'Analyse error products'}, {'abbr': 195, 'code': 195, ...
"""dobbyproject URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-...
from app import app, db from flask import render_template @app.errorhandler(404) def error_404(error): return render_template('errors/404.html'), 404 @app.errorhandler(500) def error_500(error): db.session.remove() return render_template('errors/500.html'), 500 @app.errorhandler(413) def error_413(err...
from spec import Spec, skip, eq_, raises from invoke.tasks import task, Task from invoke.loader import Loader from _utils import support # # NOTE: Most Task tests use @task as it's the primary interface and is a very # thin wrapper around Task itself. This way we don't have to write 2x tests for # both Task and @ta...
from typing import Tuple import math def normal_approximation_to_binomial(n: int, p: float) -> Tuple[float, float]: mu = p * n sigma = math.sqrt(p * (1 - p) * n) return mu, sigma from lesson5 import normal_cdf normal_probability_below = normal_cdf def normal_probability_above(lo: float, ...
FILE_TYPE_OPTIONS = {} USAGE_RIGHT_OPTIONS = {} ASPECT_RATIO_OPTIONS = {'tall': 't', 'square': 's', 'wide': 'w', 'panoramic': 'xw'} IMAGE_SIZE_OPTIONS = {'any': '', 'icon': 'i', 'medium': 'm', 'large': 'l', 'exactly': 'ex', '400x300+': 'qsvga', '640x480+': 'vga', ...
# -*- coding: utf-8 -*- class Link(object): def __init__(self, link): self.url = link['url'] self.id = link['id'] def __str__(self): return '\t\tId: {0} \n\t\tUrl: {1}'.format(self.id, self.url)
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, 'nacl_scons_dir': '../../third_party/native_client/googleclient/native_client/scons-out', }, 'includes...
""" Executors that run trials in their environment. """ from powerlift.executors.azure_ci import AzureContainerInstance from powerlift.executors.docker import InsecureDocker from powerlift.executors.localmachine import LocalMachine
import sys from abc import ABC, abstractmethod from typing import TYPE_CHECKING, List, Dict, Any import logging log = logging.getLogger(__name__) import pygame from pygame.event import Event if TYPE_CHECKING: from src.scene import Scene, GameScene class EventName(str): pass class Observer(ABC): @abst...
import uvicore from uvicore.console import command, argument, option from uvicore.support.dumper import dd, dump @command() @option('--raw', is_flag=True, help='Show output without prettyprinter') def bindings(raw: bool = False): """List all Ioc Bindings""" if not raw: uvicore.log.header("List of all ...
import argparse from .create import get_data_create_parser, execute_data_create_tool from .inspect import get_data_inspect_parser, execute_data_inspect_tool from .lint import get_data_lint_parser, execute_data_lint_tool # Dictionary of functions which execute their respective tool TOOLS = { 'create': execute_data...
from math import pi from re import I import sys import time import os.path as osp import argparse import torch import torch.nn as nn import numpy as np import torchreid from torchreid.utils import ( Logger, check_isfile, set_random_seed, collect_env_info, resume_from_checkpoint, load_pretrained_weights, comput...
import ConfigParser import duo_web as duo from contextlib import closing from flask import Flask, request, session, redirect, url_for, render_template, flash # config DEBUG = True # create flask application app = Flask(__name__) app.config.from_object(__name__) # config parser def grab_keys(filename='duo.conf'): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Train 3072-7800-512 Gaussian-Bernoulli-Multinomial DBM with pre-training on CIFAR-10, augmented (x10) using shifts by 1 pixel in all directions and horizontal mirroring. Gaussian RBM is initialized from 26 small RBMs trained on patches 8x8 of images, as in [1]. Multino...
# Copyright 2017 Bo Shao. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
from applications.config.appconfig import AppConfig class ObjectUpdateStatus(object): ObjStatusList = list() gqlClient = None def __init__(self, client, vision_workspace_name): self.ObjStatusList.clear() self.gqlClient = client self.vision_workspace_name = vision_workspace_name ...
""" Test access_policies """ from copy import deepcopy from os import environ from unittest import TestCase from uuid import uuid4 from archivist.archivist import Archivist # pylint: disable=fixme # pylint: disable=missing-docstring # pylint: disable=unused-variable DISPLAY_NAME = "AccessPolicy display name" PROPS ...
import torch from torch.autograd import Variable from torch import optim from torch import nn import torch.nn.functional as F import numpy as np from agents.Agent import Agent from .config import DDPG_CONFIG import basenets import copy from utils import databuffer import os from collections import deque fr...
from flask import Flask, request, json from flask_cors import CORS from bs4 import BeautifulSoup import requests import base64 from PIL import Image import numpy as np import io import re from eval import evaluate from locateWord import find_word import os app = Flask(__name__) CORS(app) links = "" words = "" imgArra...
import os,sys # change the path accoring to the test folder in system #sys.path.append('/home/ubuntu/setup/src/fogflow/test/UnitTest/v1') from datetime import datetime import copy import json import requests import time import pytest import data_ngsi10 import sys # change it by broker ip and port brokerIp="http://loca...
import math def IR(spot:list, m=1): """ IR(): A function to calculate Single Effective Interest Rate from an array of spot rates. :param spot: An array/List of Spot rates :type spot: list :param m: Frequency of Interest Calculation (eg: 2 for Semi-annually), defaults to 1. :type m: float ...
import mongoengine from models.base_event import BaseEvent from models.user import * class BaseChannel(Document): # Ownership and Managers created_by = ReferenceField('User', required=True) owner = ReferenceField('User', default=created_by) moderators = ListField(ReferenceField('User'), default=[]) ...
# 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, software # distributed under t...
from shape import Shape from color import Color from location import Location from random import randint def create_questions(shape, color, location, image_id): shape_name = shape.name.lower() color_name = color.name.lower() location_name = location.name.lower() questions = [ (f'what shape is in the image...
# Generated by Django 3.0.6 on 2021-07-14 21:46 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('evaluation', '0003_auto_20210714_1450'), ] operations = [ migrations.AlterField( model_name='test_assign', name='don...
# -------------------------------------------------------- # Original Code # https://github.com/VITA-Group/UAV-NDFT # Pytorch multi-GPU Faster R-CNN # Licensed under The MIT License [see LICENSE for details] # Written by Jiasen Lu, Jianwei Yang, based on code from Ross Girshick # # Modified by Chaehyeon Lee # --------...
"""jxgl.cqu.edu.cn 网址的路由 """ import logging import re import time from typing import List, Union, Dict, Optional from hashlib import md5 from bs4 import BeautifulSoup from requests import Session from ..model import Course, ExperimentCourse, Exam from . import HOST, HEADERS __all__ = ("Route", "Parsed", "Jxgl") cl...
"""Module containing the ticket for flights serializers""" from rest_framework import serializers from ticket.models import Ticket from flight.serializers import FlightDetailSerializer class TicketSerializer(serializers.ModelSerializer): """Class to handle the serializing and deserializing of ticket data""" ...
from collections import Counter from unittest import mock, TestCase import numpy as np from ngs_tools import sequence from . import mixins class TestSequence(mixins.TestMixin, TestCase): def test_alignment_to_cigar(self): self.assertEqual('4D', sequence.alignment_to_cigar('ACGT', '----')) self...