text
stringlengths
2
999k
import pytest from unittest.mock import MagicMock, patch from datetime import datetime import typing from pydantic.main import BaseModel from robot_server.service.dependencies import get_session_manager from robot_server.service.session.command_execution import CommandExecutor, \ Command from robot_server.servic...
import pickle import sys import numpy as np import pytest from aesara import shared from aesara.compile.ops import ViewOp from aesara.tensor.random.type import RandomStateType, random_state_type # @pytest.mark.skipif( # not config.cxx, reason="G++ not available, so we need to skip this test." # ) def test_view_...
from operator import attrgetter import pyangbind.lib.xpathhelper as xpathhelper from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType from pyangbind.lib.base import PybindBase from d...
from django.db import models from django import forms from django.core.validators import MinLengthValidator, MaxLengthValidator # Create your models here. class Query(models.Model):# {{{ raw_seq = models.CharField(max_length=20000) seqname = models.CharField(max_length=100) submit_date = models.DateTime...
# -*- coding: utf-8 -*- # The MIT License (MIT) - Copyright (c) 2016-2021 Dave Vandenbout. from __future__ import ( # isort:skip absolute_import, division, print_function, unicode_literals, ) import json import os import sys from builtins import open, super from future import standard_library from...
"""Certbot constants.""" import logging import pkg_resources from acme import challenges from certbot.compat import misc from certbot.compat import os SETUPTOOLS_PLUGINS_ENTRY_POINT = "certbot.plugins" """Setuptools entry point group name for plugins.""" OLD_SETUPTOOLS_PLUGINS_ENTRY_POINT = "letsencrypt.plugins" ""...
#!/usr/bin/env python3 import os import re import sys import html import json import argparse import logging import unicodedata import traceback from pathlib import Path ''' text_elements is a dict containing text elements like title, abstract, and body. Writes output in an XML-like format ''' def write_xml(fp, text_e...
from pyrfuniverse.actions import BaseAction from pyrfuniverse.envs import ToborRobotiq85ManipulationEnv import numpy as np class SingleTransport(BaseAction): """ To transfer or convey an object from one place to another. """ def __init__( self, env: ToborRobotiq85ManipulationEn...
#!/usr/bin/env python import sys from setuptools import setup, find_packages needs_pytest = {'pytest', 'test'}.intersection(sys.argv) pytest_runner = ['pytest_runner'] if needs_pytest else [] needs_wheel = {'bdist_wheel'}.intersection(sys.argv) wheel = ['wheel'] if needs_wheel else [] with open('README.rst', 'r') a...
# Copyright 2007 Matt Chaput. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the...
# Copyright The IETF Trust 2016-2019, All Rights Reserved # -*- coding: utf-8 -*- # Autogenerated by the makeresources management command 2016-06-14 04:21 PDT from tastypie.resources import ModelResource from tastypie.fields import ToManyField # pyflakes:ignore from tastypie.constants import ALL, ALL_...
#!/usr/bin/env python """ Provides mock schemas for building intsances of schema_template.py """ __author__ = "jupp" __license__ = "Apache 2.0" __date__ = "25/05/2018" from ingest.template.schema_template import SchemaTemplate from unittest.mock import patch, MagicMock @patch('urllib.request.urlopen') def get_templa...
import pandas as pd from .timeframe import TimeFrame class Electric(object): """Common implementations of methods shared by ElecMeter and MeterGroup. """ def when_on(self, **load_kwargs): """Are the connected appliances appliance is on (True) or off (False)? Uses `self.min_on_power_th...
#!/usr/bin/env python # Copyright 2014-2018 The PySCF Developers. 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 # # U...
# Python - 3.4.3 def find_difference(a, b): return abs(a[0] * a[1] * a[2] - b[0] * b[1] * b[2])
# coding: utf-8 """ NiFi Rest Api The Rest Api provides programmatic access to command and control a NiFi instance in real time. Start and stop processors, monitor queues, query provenance data, and more. Each endpoint below includes a description, ...
#!/usr/bin/python # -*- coding: utf-8 -*- # Python 3 Compatibility imports from __future__ import print_function, unicode_literals # Phantom App imports import phantom.app as phantom from phantom.base_connector import BaseConnector from phantom.action_result import ActionResult # Usage of the consts file is recommen...
# File: platform.py import os, datetime from flask import redirect, render_template, request, url_for, flash, json from flask_classful import FlaskView, route from werkzeug import secure_filename from models import Dayrate, Hourlyrate, Rate, Category, Tag, Offence from forms import DayrateForm, RateForm, TagForm, Cat...
from __future__ import absolute_import from __future__ import print_function from pydataweaver.engines import choose_engine from pydataweaver.lib.scripts import SCRIPT_LIST from pydataweaver.lib.engine_tools import name_matches script_list = SCRIPT_LIST() def download(dataset, path="./", quiet=False, subdir=False, ...
from rdflib.term import URIRef from rdflib.namespace import DefinedNamespace, Namespace class RDF(DefinedNamespace): """ The RDF Concepts Vocabulary (RDF) This is the RDF Schema for the RDF vocabulary terms in the RDF Namespace, defined in RDF 1.1 Concepts. Generated from: http://www.w3.org/1999/02/...
# Copyright 2014 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 unittest from telemetry.internal.platform import android_platform_backend from telemetry.internal.platform.power_monitor import sysfs_power_monitor ...
sum_primes = 0 sum_not_primes = 0 while True: command = input() if command == "stop": break number = int(command) if number < 0: print("Number is negative.") continue is_prime = True for i in range(2, number): if number % i == 0: is_prime = False ...
import tensorflow as tf import sonnet as snt import numpy as np from tensorflow_probability import distributions as tfd from tensorflow_probability import bijectors as tfb from .AbstractGaussian import AbstractGaussian import types class GaussianDiagonalPlusMinusOne(AbstractGaussian): def __init__(self, m...
# Python import os import sys import traceback # Pycompss from pycompss.api.task import task from pycompss.api.parameter import FILE_IN, FILE_OUT # Adapters commons pycompss from biobb_adapters.pycompss.biobb_commons import task_config # Wrapped Biobb from biobb_chemistry.babelm.babel_convert import BabelConvert # Imp...
from __future__ import annotations from enum import Enum from typing import List, Optional from pydantic import AnyUrl, BaseModel from . import models class Pets(BaseModel): __root__: List[models.Pet] class Users(BaseModel): __root__: List[models.User] class Rules(BaseModel): __root__: List[str] ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from nose.tools import * # noqa; PEP8 asserts from webtest_plus import TestApp as WebtestApp # py.test tries to collect `TestApp` import mock import urllib import urlparse import httplib as http from flask import Flask from werkzeug.wrappers import BaseRe...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Mark Maday # Copyright (c) 2015 Mark Maday # # License: MIT # """This module exports the Htmlhint plugin class.""" import sublime from SublimeLinter.lint import NodeLinter, persist class Htmlhint(NodeLinter): ...
# pylint: disable=protected-access, unused-argument # pylint: disable=no-value-for-parameter from unittest import TestCase from radical.entk.execman.base import Base_ResourceManager as Rmgr from radical.entk.exceptions import EnTKError from hypothesis import given import hypothesis.strategies as st try: impo...
from TasksManager.models import Project from django.shortcuts import render def page(req): all_projects = Project.objects.all().order_by('title') vars = {'action': "Display all projects", 'all_projects': all_projects} return render(req, 'en/public/index.html', vars)
import numpy as np import scipy.constants as const from table import ( make_SI, write, ) from uncertainties import ufloat # N1 = 3 #Parameter f+ N2 = 3 #Parameter f0 plot_difwq = 1 # entscheide, ob der differentielle WQ geplottet werden soll (zeitlicher Aufwand von ca. einer Minute) ### Konstanten m_b = 5279...
#!/usr/bin/python # # Copyright 2018-2020 Polyaxon, 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 ...
# This is not actually my code # You can check https://www.youtube.com/playlist?list=PLgCYzUzKIBE_dil025VAJnDjNZHHHR9mW # I used this course to build my account app from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth import authenticate from account.models import A...
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Tcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.test_framework import TcoinTestFramework from test_framework.util import * class Walle...
# adapted from https://github.com/yangheng95/LC-ABSA/blob/c945a94e0f86116c5578245aa9ad36c46c7b9c4a/models/lc_apc/lcf_bert.py # according to import copy from argparse import Namespace from typing import Dict import numpy as np import torch import torch.nn as nn from transformers.modeling_bert import BertPooler, BertSel...
from django.contrib.auth import get_user_model from django.test import TestCase, Client from django.urls import reverse class AdminSiteTests(TestCase): def setUp(self): """Creating admin and spare user for testing""" self.client = Client() self.admin_user = get_user_model().objects.create...
"""initial Revision ID: 85b6ba3b0831 Revises: Create Date: 2020-06-16 13:39:14.009052 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '85b6ba3b0831' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated ...
# -*- coding: utf-8 -*- # @COPYRIGHT_begin # # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland # # 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...
""" Django settings for tutorial project. Generated by 'django-admin startproject' using Django 3.2.4. For more information on this file, see https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ from pathli...
# There is an intersection of two roads. # First road is road A where cars travel from North to South in direction 1 # and from South to North in direction 2. # Second road is road B where cars travel from West to East in direction 3 # and from East to West in direction 4. # There is a traffic light located on each...
import _plotly_utils.basevalidators class CustomdatasrcValidator(_plotly_utils.basevalidators.SrcValidator): def __init__(self, plotly_name="customdatasrc", parent_name="table", **kwargs): super(CustomdatasrcValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_nam...
#!/usr/bin/env python import os from setuptools import setup, find_packages module_dir = os.path.dirname(os.path.abspath(__file__)) if __name__ == "__main__": setup( name='atomate', version='0.9.3', description='atomate has implementations of FireWorks workflows for ' ...
# -*- coding: utf-8 -*- # # =================================================================== # The contents of this file are dedicated to the public domain. To # the extent that dedication to the public domain is not available, # everyone is granted a worldwide, perpetual, royalty-free, # non-exclusive license to e...
# -*- coding: utf-8 -*- __version__ = '1.0.4' default_app_config = 'aldryn_categories.apps.AldrynCategories'
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # ----------------------------------------------------------------------------- # # P A G E B O T # # Copyright (c) 2016+ Buro Petr van Blokland + Claudia Mens # www.pagebot.io # Licensed under MIT conditions # # Supporting DrawBot, www.drawbot.com # ...
__VERSION__="ete2-2.2rev1056" # -*- coding: utf-8 -*- # #START_LICENSE########################################################### # # # This file is part of the Environment for Tree Exploration program # (ETE). http://ete.cgenomics.org # # ETE is free software: you can redistribute it and/or modify it # under the t...
# coding: utf-8 """ validateapi The validation APIs help you validate data. Check if an E-mail address is real. Check if a domain is real. Check up on an IP address, and even where it is located. All this and much more is available in the validation API. # noqa: E501 OpenAPI spec version: v1 Ge...
from allauth.socialaccount.tests import OAuth2TestsMixin from allauth.tests import MockedResponse, TestCase from .provider import StackExchangeProvider class StackExchangeTests(OAuth2TestsMixin, TestCase): provider_id = StackExchangeProvider.id def get_mocked_response(self): return MockedResponse(200...
#! /usr/bin/env python import pyxfoil as px import numpy as np xf = px.session(logfile='sweeptest') Res = np.logspace(5,7,21) #Res = np.logspace(4.5,5,5) nacacodes = range(8,17,1) adders = [0, 2400] xf.naca('0010') xf.set_panels(200) for a in adders: for nacacode in nacacodes: xf.naca('%04d' % (nacacode +...
# -*- coding: utf-8 -*- # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
import os import math import random import functools import numpy as np import paddle from PIL import Image, ImageEnhance random.seed(0) np.random.seed(0) DATA_DIM = 224 THREAD = 8 BUF_SIZE = 102400 DATA_DIR = 'data/ILSVRC2012' img_mean = np.array([0.485, 0.456, 0.406]).reshape((3, 1, 1)) img_std = np.array([0.229...
# +--------------------------------------------------------------------------+ # | Licensed Materials - Property of IBM | # | | # | (C) Copyright IBM Corporation 2008, 2016. | # +-...
# -*- coding: utf-8 -*- model = { 'go ': 0, ' go': 1, ' le': 2, ' a ': 3, 'le ': 4, ' di': 5, 'a g': 6, 'ya ': 7, 'lo ': 8, ' ya': 9, 'a m': 10, 'ka ': 11, ' ka': 12, 'la ': 13, ' t ': 14, 'o y': 15, 'a t': 16, 'a k': 17, 'ba ': 18, 'et ': 19, 'wa ': 20, ' mo': 21, ' e ': 22, 'a b': 23, ' se': ...
# coding: utf-8 """ Pure Storage FlashBlade REST 1.10 Python SDK Pure Storage FlashBlade REST 1.10 Python SDK. Compatible with REST API versions 1.0 - 1.10. Developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/...
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # Author: .direwolf <kururinmiracle@outlook.com> # Licensed under the MIT License. from . import cli if __name__ == '__main__': cli.main()
""" Working with calendars The calendar module contains different classes that you can use to create calendars. A text based calendar """ import calendar # A text based calendar # cal = calendar.TextCalendar(calendar.SUNDAY) # SUNDAY is the first day of the week. == If I want to use Monday instea...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import json import warnings import pulumi import pulumi.runtime from typing import Union from .. import utilities, tables class EventS...
version_info = (0, 1, 1) version = ".".join(map(str, version_info))
""" ASGI config for libsoft project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTI...
import urllib.parse import codecs from solr import SOLR from semex import init_numberbatch, expand_query from utils import print_homework_header, readfile, trec_eval from utils import ROOTPATH, SRCPATH, DATAPATH, TRECPATH, RESULTSPATH # Solr parameters port = "8983" collection = "trec" fileNumber = 100 # Trec parame...
import numpy as np from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt y= np.load('fMRI_PCA.npy', allow_pickle=True) X= np.load('Movie_PCA_1200.npy', allow_pickle=True) x_train,x_test, y_train, y_test = train_test_split(X, y, test_size=0.1) print(x_train.shape, x_test.shape, y_train....
# grab the app and run it from test import app if __name__ == '__main__': app.run(debug=True)
import time import numpy as np from sklearn.preprocessing import OneHotEncoder, MinMaxScaler from sklearn.gaussian_process import GaussianProcess from sklearn.linear_model import Ridge, Lasso from sklearn.svm import NuSVR, SVR import scipy from util import Logger, get_rmse class Linear(): def __init_...
import cv2 import numpy as np import time load_from_disk = True if load_from_disk: penval = np.load('penval.npy') cap = cv2.VideoCapture(0) # Load these 2 images and resize them to the same size. pen_img = cv2.resize(cv2.imread('pen.png',1), (50, 50)) eraser_img = cv2.resize(cv2.imread('eraser.jpg',1), (50, 50))...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('core', '0006_auto_20150619_1219'), ] ...
from os import walk from os.path import dirname, basename from twelve_step.find_imported_packages.find_imported_packages import ( find_imported_packages_in_imports, ) from typing import List, Callable, Tuple from jivago_streams import Stream from twelve_step.find_classes.find_classes import find_classes from twel...
import json import requests from time import sleep from urllib3.exceptions import HTTPError from .exceptions import ErroApiBNMP REGISTROS = 50 DADOS = { 'criterio': { 'orgaoJulgador': { 'uf': 'RJ', 'municipio': '', 'descricao': '', }, 'orgaoJTR': {}, ...
import random import os import logging import json import copy import networkx as nx import numpy as np import torch from torch import mode from torch.optim import Adam, Adagrad, SGD from torch.optim.lr_scheduler import StepLR from torch.utils.data import DataLoader, Dataset import torch.nn as nn import torch.nn.funct...
from sqlalchemy import cast from sqlalchemy import Column from sqlalchemy import exc from sqlalchemy import ForeignKey from sqlalchemy import func from sqlalchemy import Integer from sqlalchemy import MetaData from sqlalchemy import select from sqlalchemy import String from sqlalchemy import Table from sqlalchemy impor...
#!/usr/bin/env python3 # Copyright (c) 2019 The PIVX developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # -*- coding: utf-8 -*- import subprocess from test_framework.messages import CTransaction, CTxIn, CTxOut, COutPoint,...
"""Auto-generated file, do not edit by hand. GI metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_GI = PhoneMetadata(id='GI', country_code=None, international_prefix=None, general_desc=PhoneNumberDesc(national_number_pattern='[158]\\d{2,5}', possible_length=(3,...
from .. import base_ip import os ''' #an example of io_dic of spi_master io ''' #return the class name for query def get_ip_name(): return "SPI_SLAVE_B2B" class SPI_SLAVE_B2B(base_ip.base_ip): ID = "__SPI_SLAVE_B2B" ALT = ["a", "b", "c"] def __init__(self, io_hash): self.dicts = io_hash self.alt = "a"...
''' 题目描述 编写一个函数,计算字符串中含有的不同字符的个数。字符在ACSII码范围内(0~127)。不在范围内的不作统计。 输入描述: 输入N个字符,字符在ACSII码范围内。 输出描述: 输出范围在(0~127)字符的个数。 示例1 输入 abc 输出 3 '''
#!/usr/bin/env python import os import pickle import numpy as np from openquake.hazardlib.gsim import base import openquake.hazardlib.imt as imt from openquake.hazardlib.const import StdDev from shakelib.gmpe.nga_east import NGAEast from shakelib.multigmpe import stuff_context home_dir = os.path.dirname(os.path.ab...
# pylint: disable-all import argparse from animus import EarlyStoppingCallback, IExperiment from animus.torch.callbacks import TorchCheckpointerCallback from apto.utils.report import get_classification_report from catalyst import utils import numpy as np import optuna from sklearn.model_selection import train_test_spl...
from tests.setup import run_all def pytest_sessionstart(session): run_all()
# Copyright 2019 NullConvergence # # 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...
from pettingzoo import AECEnv from pettingzoo.utils.agent_selector import agent_selector from gym import spaces import random import rlcard from rlcard.utils.utils import print_card from rlcard.games.gin_rummy.player import GinRummyPlayer from rlcard.games.gin_rummy.utils import utils from rlcard.games.gin_rummy.utils....
try: import chardet CHARDET_OK = True except: CHARDET_OK = False import json import os import re re_newlines = re.compile( '[\r\n]+' ) re_multiple_spaces = re.compile( r'\s+' ) # want to keep the 'leading space' part here, despite tag.strip() elsewhere, in case of some crazy '- tes...
#! from datetime import date import os from os import listdir, path import shutil import logging logging.basicConfig(level=logging.INFO, format='%(message)s') # # path utils # def this_folder(): return os.path.dirname(os.path.abspath(__file__)) def par_folder(): return path.joi...
import sys import numpy as np import pytest from napari._tests.utils import skip_local_popups @skip_local_popups @pytest.mark.skipif( sys.platform.startswith('win') or sys.platform.startswith('linux'), reason='Currently fails on certain CI due to error on canvas draw.', ) def test_canvas_drawing(make_napari...
#!/usr/bin/env python3 import os import sys import unittest2 sys.path.append(os.path.abspath('..')) os.chdir('..') class TestURLMethods(unittest2.TestCase): def test_is_subdomain(self): from pajbot.modules.linkchecker import is_subdomain self.assertTrue(is_subdomain('pajlada.se', 'pajlada.se'))...
#!/usr/bin/env python3 print("Hello,World!")
default_app_config = 'teams.apps.TeamsConfig'
import yaml import os def parse_config(file): config_file = open(file) config = yaml.load(config_file, Loader=yaml.SafeLoader) for k, v in config.items(): if k in ['libc', 'allocator', 'loader']: v = os.path.abspath(os.path.join(os.path.dirname(config_file.name), v)) config[...
from math import * tri = [[75], [95, 64], [17, 47, 82], [18, 35, 87, 10], [20, 4, 82, 47, 65], [19, 1, 23, 75, 3, 34], [88, 2, 77, 73, 7, 63, 67], [99, 65, 4, 28, 6, 16, 70, 92], [41, 41, 26, 56, 83, 40, 80, 70, 33], [41, 48, 72, 33, 47, 32, 37, 16, 94, 29], [53, 71, 44, 65, 25, 43, 91, 52, 97, 51, 14], [70, 11, 33, 28...
import glob import os import sys import time import urllib.request from pathlib import Path from zipfile import ZipFile import codecs import pytest import nbformat import numpy as np import pandas as pd import papermill as pm import torch import syft as sy from syft import TorchHook from syft.workers.websocket_server...
import dataclasses import pprint from functools import wraps from typing import Any, Dict, List, Optional, Union from sqlalchemy import Text from sqlalchemy.ext.associationproxy import ( ASSOCIATION_PROXY, ColumnAssociationProxyInstance, ) from sqlalchemy.inspection import inspect from sqlalchemy.orm import Ma...
from django.apps import AppConfig class BaseConfig(AppConfig): name = 'base'
### Normal Equation for multivariate regression ### author: Dr. Marko Mitic ### year 2015 ### contact: miticm@gmail.com import numpy as np class NormalEquation: #Main class for NormalEquation def __init__(self, data): ### data is given in several-column format, last column is output self...
class Solution: def decodeString(self, s: str) -> str: stack = [] for c in s: if c == "]": pos = len(stack) - 1 - stack[::-1].index("[") rep = "".join(stack[pos + 1 :]) stack = stack[:pos] count = "" while le...
import os import functools import pandas as pd import networkx as nx from loggers import EmptyLogger class TestData: def __init__(self, logger=None): if logger is None: logger = EmptyLogger() self._logger = logger self._data_dir = os.path.dirname(os.path.realpat...
import itertools as it from collections import defaultdict from typing import Dict, List import numpy as np import pandas as pd import torch from pytorch_lightning.metrics import Metric from sklearn.metrics import accuracy_score, precision_recall_fscore_support from src import utils as sutils from src.postprocessing.t...
# Copyright 2019 The Blueqat Developers # # 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...
"""Data augmentation functionality. Passed as callable transformations to Dataset classes. The data augmentation procedures were interpreted from @weiliu89's SSD paper http://arxiv.org/abs/1512.02325 Ellis Brown, Max deGroot """ import torch import cv2 import numpy as np import random import math from ...
""" The simuran_base_params is used to initialize the the simuran_params file in each recording data session that is a child directory of starting directory. This should contain information about the recording, such as the number electrodes in the recording. """ def setup_signals(): """Set up the signals (such a...
import sys operations = [] counter = 0 stack = [] def execute(statement): global counter if statement in stack: return stack.append(statement) operation = operations[statement][0] argument = int(operations[statement][1]) if operation == "nop": statement += 1 elif operation ...
def average_precision(actual, recommended, k=30): ap_sum = 0 hits = 0 for i in range(k): product_id = recommended[i] if i < len(recommended) else None if product_id is not None and product_id in actual: hits += 1 ap_sum += hits / (i + 1) return ap_sum / k def no...
from typing import Tuple, FrozenSet from pysmt.environment import Environment as PysmtEnv from pysmt.fnode import FNode import pysmt.typing as types from utils import symb_to_next from hint import Hint, Location def transition_system(env: PysmtEnv) -> Tuple[FrozenSet[FNode], FNode, FNode, ...
# Copyright 2016-2020 Blue Marble Analytics 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.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
from operator import attrgetter import pyangbind.lib.xpathhelper as xpathhelper from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType from pyangbind.lib.base import PybindBase from d...