content
stringlengths
5
1.05M
# # Pyserini: Reproducible IR research with sparse and dense representations # # 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...
import string class caesar(): def caesar_cipher(user_message, user_shift): alphabet = string.ascii_lowercase shifted_alphabet = alphabet[user_shift:] + alphabet[:user_shift] table = str.maketrans(alphabet, shifted_alphabet) return user_message.translate(table)
from celery import Celery import consumer app_name = 'consumer' # take the celery app name app = Celery(app_name, broker=consumer.redis_url) # produce for i in range(100): a = 1 b = 2 consumer.consume.delay(a, b)
import numpy as np from PIL import Image from matplotlib import pyplot as plt from matplotlib import image as mpimg from scipy import signal from scipy import fftpack import scipy.io class PSNR_calculator: def __init__(self,original_image,fixed_image): self.orig = original_image[:,:,0] self.fixed =...
""" For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ Needs some environment strings in the live server. LIVE -- To know its in the live serv...
# -*- coding: utf-8 -*- import numpy as np import pandas as pd import cross_section_analysis.utils as cs_utils class WaterReferenceLinesOnRaster(): """ Processing of cross-section profiles to find water reference lines on the topography raster within user-specified topography intervals: ...
#1.只负责写视图 import os import datetime from flask import render_template from main import app from models import Curriculum#导入这个表 from flask import redirect#跳转 即Django中的重定向功能 import functools from flask import session from models import * class Calendar: """ 当前类实现日历功能 1、返回列表嵌套列表的日历 2、安装日历格式打印日历 # 如果一...
from kaplot import * import pymedia.audio.acodec as acodec import pymedia.muxer as muxer import sys import wave if False: file = open(sys.argv[1], 'rb') rawdata = file.read() wfile = wave.open('test.wav', 'wb') print muxer.extensions demuxer = muxer.Demuxer('mp3') frames = demuxer.parse(rawdata) decoder = ac...
import numpy as np import pandas as pd import json from itertools import groupby from collections import namedtuple # NodeEdgeIncidence = namedtuple('NodeEdgeIncidence', ['nid', 'role', 'eid','meta']) class NodeEdgeIncidence(object): __slots__ = ("nid", "role", "eid", "meta") def __init__(self, nid, role,...
from copy import deepcopy import csv from enum import Enum import inspect from os.path import join as joinpath from pprint import pprint from sys import version_info from typing import Any, Callable, Dict, List, Optional, Tuple, TYPE_CHECKING, TypeVar, Union import dictdiffer from pandas import DataFrame import string...
from typing import NamedTuple class User(NamedTuple): name: str age: int = 27 user1 = User('Jan') print(user1) print(dir(user1)) # user1.age = 30 # print(user1)
#!/usr/bin/env python # -*- coding: utf-8 -*- """Sample Discourse Relation Classifier Train Train parser for suplementary evaluation Train should take three arguments $inputDataset = the folder of the dataset to parse. The folder structure is the same as in the tar file $inputDataset/parses.json $inputDataset...
# -*- coding: utf-8 -*- """ Demonstrate a simple data-slicing task: given 3D data (displayed at top), select a 2D plane and interpolate data along that plane to generate a slice image (displayed at bottom). """ ## Add path to library (just for examples; you do not need this) import initExample import...
from itertools import combinations from operator import mul f = open("input.txt") d = f.readlines() total = 0 for p in d: sides = [int(n) for n in p.split("x")] combos = list(combinations(sides, 2)) areas = [ mul(*a) for a in combos] areas.sort() total += areas[0] total += sum([2*a for a in are...
# Copyright 2016 Cisco Systems, 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 wr...
import numpy as np a = np.array([0, 0.5, 1.0, 1.5, 2.0]) type(a) a[:2] # Slicing works as for lists # Built in methods a.sum() a.std() a.cumsum() a.max() a.argmax() # Careful with np.max! np.max(2, 0) np.max(-2, 0) # silent fail :) second argument is the axis np.max(0, 2) # fail np.maximum(-2, 0) # Vectorized ope...
import os import sys import logging import configparser import logging import numpy as np configfile_name ="NAAL_config" logger = logging.getLogger(__name__) if sys.platform.startswith('win'): config_dir = os.path.expanduser(os.path.join("~", ".NAAL_FPGA")) else: config_dir ...
import socket import os from dotenv import load_dotenv import redis from flask import Flask, Blueprint, url_for from flask_caching import Cache from flask_login import login_required, LoginManager from flask_migrate import Migrate from flask_sqlalchemy import SQLAlchemy import dash import dash_bootstrap_components as d...
# coding=utf-8 __author__ = "Dimitrios Karkalousos" from abc import ABC import torch from omegaconf import DictConfig, OmegaConf from pytorch_lightning import Trainer from torch.nn import L1Loss from mridc.collections.common.losses.ssim import SSIMLoss from mridc.collections.common.parts.fft import ifft2c from mridc...
"""empty message Revision ID: 073b3a3e8e58 Revises: 60c735df8d2f Create Date: 2019-09-06 08:45:01.107447 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '073b3a3e8e58' down_revision = '60c735df8d2f' branch_labels = None depends_on = None def upgrade(): # ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import subprocess import select import time import json import requests import yaml import sys import os __PRODUCT_ID = "logslack 1.0 (c) 4k1/logslack" def get_value(r, key, default=None): if key in r: if type(r[key]) is int: return int(r[key]) ...
# Generated by Django 2.2.9 on 2020-02-02 18:32 from django.db import migrations class Migration(migrations.Migration): dependencies = [("core", "0027_auto_20200202_1822")] operations = [ migrations.RemoveField(model_name="office", name="req_nominations"), migrations.RemoveField(model_name=...
import ctypes import os import math from typing import Dict, List, cast from abc import ABC, abstractclassmethod import sdl2 from helpers import sdl, draw_texture, texture_from_bmp import config import entities class Component(ABC): """Interface that each component must adhere to. Strictly speaking, components ...
import os import re import time import random import hashlib from multiprocessing import cpu_count from tandems import _tandems try: from urllib.parse import unquote except ImportError: from urlparse import unquote UNK_ID = 0 SQL_RESERVED_WORDS = [] with open("./SQL_reserved_words.txt", "rb") as f: for l...
#!/usr/bin/env python # coding: utf-8 from typing import List from typing import Optional from typing import Union import numpy as np import pandas as pd from dataclasses import dataclass from sklearn import metrics from evidently import ColumnMapping from evidently.analyzers.base_analyzer import Analyzer from eviden...
from django.shortcuts import render, redirect from django.contrib import messages from .forms import EveTimerForm from .models import EveTimer, EveTimerType from datetime import datetime, timedelta from django.utils import timezone from django.contrib.auth.decorators import login_required, permission_required @login_...
#!/usr/bin/env python """ # ============================================================================== # Author: Carlos A. Ruiz Perez # Email: cruizperez3@gatech.edu # Intitution: Georgia Institute of Technology # Version: 1.0.0 # Date: Nov 13, 2020 # Description: Builds the search dat...
from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User class SignUpForm(UserCreationForm): first_name = forms.CharField(max_length=30, required=False, help_text='Optional.') last_name = forms.CharField(max_length=30, required=False, help_tex...
from odc.geo.data import country_geom, data_path, gbox_css, ocean_geojson, ocean_geom def test_ocean_gjson(): g1 = ocean_geojson() g2 = ocean_geojson() assert g1 is g2 assert len(g1["features"]) == 2 def test_ocean_geom(): g = ocean_geom() assert g.crs == "epsg:4326" g = ocean_geom("ep...
import os from hashkernel.bakery import CakeRole from hashstore.bakery.lite import dal from hashstore.bakery.lite.node import ( ServerConfigBase, GlueBase, CakeShardBase, User, UserType, UserState, Permission, Portal, ServerKey, PermissionType as PT) from hashstore.bakery.lite.node.blobs import BlobStore from...
# -*- coding: utf-8 -*- import os, sys import time import pathlib import glob import cv2 import configparser import copy from datetime import datetime, timedelta from matplotlib.lines import Line2D import matplotlib.patches as patches import matplotlib.pyplot as plt import numpy as np #from matplotlib.ba...
#!/usr/bin/python3 import asyncio import random import traceback import aiomas import hashlib import logging import errno from helpers.validator import * from helpers.chordInterval import * from helpers.storage import Storage from helpers.replica import Replica from helpers.messageDefinitions import * from jsonschema ...
from Metodos import pontofixo from prettytable import PrettyTable from mpmath import * import random import matplotlib.pyplot as plt valerror1 = [] valerror2 = [] valerror3 = [] valerrors = [valerror1,valerror2,valerror3] i = 20 val = 2 def f(x): return (x-1)*exp(x-2)**2 - 1 def g1(x): retu...
import logging from typing import Callable, Sequence, Set from . import formats logger = logging.getLogger(__name__) # type aliases FormatterType = Callable[[bool], formats.IFormatter] def negotiate(accepts_headers: Sequence[str]) -> FormatterType: """Negotiate a response format by scanning through a list of A...
import redis redis_db = redis.StrictRedis(host="redis", port=6379, db=0) print(redis_db.keys()) redis_db.set('CT', 'Connecticut') redis_db.set('OH', 'Ohio') print(redis_db.keys()) ctstr = redis_db.get("CT").decode("utf-8") print(ctstr) print( "Good bye!" )
from django.test import TestCase from .models import Category # Create your tests here. # category models test class CategoryTestCase(TestCase): def setUp(self): """ Create a category for testing """ Category.objects.create(name="Test Category") def test_category_name(self): ...
from logging import ERROR, error from os import terminal_size import socket import threading import json HEADER = 1024*4 PORT = 5544 # SERVER = "192.168.1.104" SERVER = "localhost" # socket.gethostbyname(socket.gethostname()) ADDR = (SERVER, PORT) FORMAT = 'utf-8' DISCONNECT_MESSAGE = "!DISCONNECT" server = socket.s...
# Um assassinato aconteceu, e o programa fará 5 perguntas para o usuário. # Se 2 respostas forem positivas, o usuário é considerado: "SUSPEITO" # Se responder entre 3 e 4 respostas positivas: "CÚMPLICE" # 5 respostas positivas, o usuário é considerado como: "ASSASSINO" # Caso o usuário tenha no máximo 1 resposta positi...
from checkpoint.types import ModelVersionStage ANONYMOUS_USERNAME = "Anonymous" CHECKPOINT_REDIRECT_PREFIX = "checkpoint_redirect" CHECKPOINT_REDIRECT_SEPARATOR = ":" NO_VERSION_SENTINAL = "no_version" STAGES_WITH_CHAMPIONS = { ModelVersionStage.STAGING, ModelVersionStage.PRODUCTION, } INJECT_SCRIPT_TEMPL...
import numpy as np import torch import torchvision.transforms as transforms transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5]) ]) def convert_image_to_tensor(image): """convert an image to pytorch tensor Parameters: ---------- ...
import argparse from clusterize import k_means def main(): args = parse_args() dataset = read_dataset(args.dataset) k_means(args.k, dataset, args.i) def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("-dataset", default="normal", choices=["normal", "unbalance"],...
# -*- coding: utf-8 -*- """stem package. Word lemmatization and stemming. API: * PorterStemmer (class): Uses porter algorithm to find word stems. * porter_stem (function): For instant stemming a word using porter algorithm. * RegexStemmer (class): Uses regex pattern to find word stems. * regex_stem (function): For i...
import wave import pyaudio import webrtcvad class AudioRecorder(object): def __init__(self): self.pyaudio = pyaudio.PyAudio() self.format = self.pyaudio.get_format_from_width(width=2) self.channels = 1 self.rate = 16000 self.chunk = 160 self.max_frame_count = 500 ...
# # 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 ...
from typing import Any from typing import Callable from typing import List from typing import Optional from typing import Union import pytest import tornado from graphql import parse from opencensus.trace import execution_context from opencensus.trace import tracer as tracer_module from opencensus.trace.base_exporter ...
import os from distutils.util import strtobool from os.path import join import dj_database_url from configurations import Configuration from corsheaders.defaults import default_headers BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) class Common(Configuration): INSTALLED_APPS = ( ...
import numpy as np from matplotlib import pyplot as plt from os import listdir def exp_moving_average(vec, a): """ Calculates EMA from given vector and alpha parameter. :param vec: input vector :param a: alpha parameter :return: calculated average """ # Create elements multipliers vector. ...
from random import randint class King: def __init__(self, start, size): self.start = start self.size = size self.hole = (randint(0, size-1), randint(0, size-1)) def check(self, a, b): return a >= 0 and b >= 0 and a <= self.size - 1 and b <= self.size - 1 def near(self, wher...
# -*- coding: utf-8 -*- """ Requires Python 3.8 or later """ __author__ = "Jorge Morfinez Mojica (jorge.morfinez.m@gmail.com)" __copyright__ = "Copyright 2021" __license__ = "" __history__ = """ """ __version__ = "1.21.H28.1 ($Rev: 1 $)" import re import time import threading from flask import Blueprint, json, reque...
from rubicon_ml.client import Base class Parameter(Base): """A client parameter. A `parameter` is an input to an `experiment` (model run) that depends on the type of model being used. It affects the model's predictions. For example, if you were using a random forest classifier, 'n_estimators...
# Mirror data from source MSN's to destination MSN on same Mark6 unit # Jan 29, 2017 Lindy Blackburn import argparse import subprocess import stat import os parser = argparse.ArgumentParser(description="mount drives and create commands to copy data from source MSN(s) to destination MSN.") parser.add_argument('source'...
# Generated by Django 2.2.10 on 2020-04-26 14:55 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('pacientes', '0013_consulta_turno'), ] operations = [ migrations.CreateModel( ...
"""Option handling polyfill for Flake8 2.x and 3.x.""" import optparse import os def register(parser, *args, **kwargs): r"""Register an option for the Option Parser provided by Flake8. :param parser: The option parser being used by Flake8 to handle command-line options. :param \*args: Pos...
# -*- coding: utf-8 -*- """ Created on 2018/8/1 @author: xing yan """ from random import shuffle, sample, randint, choice administrative_div_code = ['110101', '110102', '110105', '110106', '110107', '110108', '110109', '110111', '110112', '110113', '110114', '110115', '110116', '110117', '110118', '110119'] surname ...
#! /usr/bin/env python #S.rodney # 2011.05.04 """ Extrapolate the Hsiao SED down to 300 angstroms to allow the W filter to reach out to z=2.5 smoothly in the k-correction tables """ import os from numpy import * from pylab import * sndataroot = os.environ['SNDATA_ROOT'] MINWAVE = 300 # min wavelength for extrap...
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
# === Start Python 2/3 compatibility from __future__ import absolute_import, division, print_function, unicode_literals from future.builtins import * # noqa pylint: disable=W0401, W0614 from future.builtins.disabled import * # noqa pylint: disable=W0401, W0614 # == End Python 2/3 compatibility import mmap import os...
__version__ = "1.5.0" default_app_config = "oauth2_provider.apps.DOTConfig"
import os, requests, json, redis from flask import Flask from openarticlegauge import config, licenses from flask.ext.login import LoginManager, current_user login_manager = LoginManager() def create_app(): app = Flask(__name__) configure_app(app) if app.config['INITIALISE_INDEX']: initialise_index(app) ...
#!/usr/bin/env python3 import logging import sys import tempfile import threading import time import unittest import warnings from os.path import dirname, realpath sys.path.append(dirname(dirname(dirname(realpath(__file__))))) from logger.utils import formats # noqa: E402 from logger.readers.text_file_reader import ...
# This file is part of Indico. # Copyright (C) 2002 - 2021 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from __future__ import unicode_literals from flask import session from indico.core.db import db def ge...
import math import time import copy import random import numpy as np import eugene as eu import pdb #Parent Sensor class VABSensor( object ): def __init__(self, dynamic_range): self._init_value = None self._range = dynamic_range def get_range(self): return self._range ################...
#!/usr/bin/env python3 # _*_ coding: utf-8 _*_ """Numbering formats for converted XML lists. :author: Shay Hill :created: 6/26/2019 I don't want to add non-ascii text to a potentially ascii-only file, so all bullets are '--' and Roman numerals stop at 3999. Doesn't capture formatting like 1.1.1 or b) or (ii). Only t...
import info class subinfo(info.infoclass): def setTargets(self): self.versionInfo.setDefaultValues(gitUrl = "https://invent.kde.org/utilities/ktrip.git") self.description = "Public transport assistant" def setDependencies(self): self.buildDependencies["virtual/base"] = None se...
def Predict(X_user) : # Libs import pandas as pd import numpy as np from sklearn.preprocessing import OneHotEncoder from sklearn.compose import ColumnTransformer from catboost import CatBoostClassifier X_user = np.array(X_user).reshape(1,-1) print(X_user) # Reading the dat...
#!/usr/bin/env python3 def test_prime(test_value): if test_value == 2: return 1 for x in range(2, test_value): if test_value % x == 0: return 0 return 1 def main(): test_value = 179424673 if test_prime(test_value): print(test_value, "is prime.") else: ...
from .color import * from .display import * from .patterns import *
from api import views from django.contrib import admin from django.urls import include, path from rest_framework.routers import DefaultRouter from rest_framework.schemas import get_schema_view from rest_framework.documentation import include_docs_urls router = DefaultRouter() router.register(r'match', views.MatchView...
# Generated by Django 2.1.5 on 2019-01-19 20:13 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('access', '0015_auto_20170416_2044'), ] operations = [ migrations.AddField( model_name='smtpserver', name='password_f...
from earthnet_models_pytorch.setting.en21_data import EarthNet2021DataModule from earthnet_models_pytorch.setting.en22_data import EarthNet2022DataModule from earthnet_models_pytorch.setting.en21x_data import EarthNet2021XDataModule,EarthNet2021XpxDataModule from earthnet_models_pytorch.setting.en21_std_metric import...
#!/usr/bin/env python3 """ This example shows how to generate basic plots and manipulate them with FEA In this case, we'll generate a 4D model and ruse FEA to find all possible 2D and 3D reduced models. We'll then solve for the solution spaces by breaking up each solution and finding the maximum and minimum values in...
#!/usr/bin/env python3 # Intro & methodology: # # 自从几个月前大号被百度永封了就没怎么来hhy,来了也不发贴回贴。今天听说 # 有人统计了五选周期每人的直播次数,就来看了一下,发现受统计方法所限,原 # 贴数据问题很大(例:路人最爱的那位大人分明直播了两次——虽然都是外务要求; # 但原贴说那位大人直播了零次,以致收了很多酸菜,本人心痛不已),所以本人 # 决定小号出山,拿出箱底的数据拨乱反正一下,也顺便提供一点细节。 # # 还是老样子,本人先介绍数据来源、统计方法,指出局限性;然后提供数据,但 # 不多加主观发挥,由读者自行理解。 # # 本人数据来源是每整十分钟爬一次口袋的当...
import multiprocessing import os import random import time import pytest import requests from finetuner.toydata import generate_fashion from finetuner import __default_tag_key__ from jina.helper import random_port os.environ['JINA_LOG_LEVEL'] = 'DEBUG' all_test_losses = ['SiameseLoss', 'TripletLoss'] def _run(fram...
from .Layer import * class Slice(Layer): def __init__(self, model, *args, **kwargs): Layer.__init__(self, model, *args, **kwargs) self.axis = kwargs.get("axis", 1) if "slice_point" in kwargs: self.slice_points = [kwargs["slice_point"]] else: self.slice_points...
class NaturalNumbers: def __init__(self): pass def get_first_n_for(self, n): # Ejemplo """ Obtener los primeros n naturales en una lista con for """ first_n = [] # Se declara una lista donde almacenaremos los numeros for i in range(n): # Se itera sobre range que ...
""" MIT License Copyright (c) 2021 Defxult#8269 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, ...
# Generated by Django 2.2.10 on 2020-04-06 06:28 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('items', '0002_item_whereabouts'), ] operations = [ migrations.AddField( model_name='item', name='sale_type', ...
# Copyright 2021 IBM Corporation # # 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 wri...
import os import shutil import unittest from xbrr.tdnet.client.document_client import DocumentClient from xbrr.edinet.reader.reader import Reader from xbrr.tdnet.reader.doc import Doc import pandas as pd class TestReader(unittest.TestCase): @classmethod def setUpClass(cls): _dir = os.path.join(os.path...
from noise import pnoise2 from time import sleep from threading import Thread import os import color import platform import socket try: from pynput import keyboard except ImportError: keyboard = None # unused ports: 26490-26999 port = 26969 address = "192.168.50.172" s = socket.socket(socket.AF_INET, socket.SOCK_STRE...
expected_output = { "vrf": { "User": { "iid": 4100, "number_of_entries": 2186, "eid": { "0.0.0.0/0": { "uptime": "1w6d", "expire": "never", "via": [ "static-send-map-reques...
import random from environment import TicTacToe, X, O class Agent: def __init__(self, plays=X, episodes=10_000): """ Initialise the agent with all the possible board states in a look up table. Winning states have a value of 1, losing states have -1. All else are 0 """ ...
import random import uuid LOGGED_IN_DATA = { 'host': 'https://app.valohai.com/', 'user': {'id': 'x'}, 'token': 'x', } PROJECT_DATA = { 'id': '000', 'name': 'nyan', 'description': 'nyan', 'owner': 1, 'ctime': '2016-12-16T12:25:52.718310Z', 'mtime': '2017-01-20T14:35:02.196871Z', ...
#!/usr/bin/env python from distutils.core import setup LONG_DESCRIPTION = \ '''Convert DNA structural variants in VCF files into BED format''' setup( name='svdistil', version='0.1.0.0', author='Bernie Pope', author_email='bjpope@unimelb.edu.au', packages=['svdistil'], package_dir={'svdistil'...
import h5py import numpy as np import pandas as pd import lightgbm as lgb class HDFSequence(lgb.Sequence): def __init__(self, hdf_dataset, batch_size): """ Construct a sequence object from HDF5 with required interface. Parameters ---------- hdf_dataset : h5py.Dataset ...
import json from src.main import ReadFile if __name__ == '__main__': path_to_annotell_annotation = 'annotell_1.json' with open(path_to_annotell_annotation, 'r') as content: json_body = json.load(content) result = ReadFile().convert(json_body) print(result)
import httpretty import pytest from h_matchers import Any @pytest.fixture def pyramid_settings(): return { "client_embed_url": "http://hypothes.is/embed.js", "nginx_server": "http://via.hypothes.is", "via_html_url": "https://viahtml.hypothes.is/proxy", "checkmate_url": "http://loca...
#! /usr/bin/env python from metadata_file import MetadataFile import json class FalseJSONMetadataFile(MetadataFile): """A metadata file type for files that claim to be JSON files but aren't """ category_name = 'FALSE_JSON'; def collect_metadata(self): print('not parsing json from %s' % self.path)...
""" # FRACTION TO RECURRING DECIMAL Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating, enclose the repeating part in parentheses. If multiple answers are possible, return any of them. It is guaranteed that the leng...
from youtube_search import YoutubeSearch as YS from config import TOKEN from aiogram import Bot,types,Dispatcher,utils from aiogram.utils import executor from aiogram.types import InputTextMessageContent,InlineQueryResultArticle, ReplyKeyboardMarkup,KeyboardButton import hashlib async def on_startup(_): ...
# do imports import matplotlib.pyplot as plt import logomaker as logomaker # load ARS enrichment matrix ars_df = logomaker.get_example_matrix('ars_enrichment_matrix', print_description=False) # load wild-type ARS1 sequence with logomaker.open_example_datafile('ars_wt_sequence.txt...
"""Portfolio Helper""" __docformat__ = "numpy" from datetime import datetime from dateutil.relativedelta import relativedelta import yfinance as yf import pandas as pd # pylint: disable=too-many-return-statements BENCHMARK_LIST = { "SPDR S&P 500 ETF Trust (SPY)": "SPY", "iShares Core S&P 500 ETF (IVV)": "IVV...
import json from testtools.matchers import raises, Not import falcon.testing as testing import falcon class FaultyResource: def on_get(self, req, resp): status = req.get_header('X-Error-Status') title = req.get_header('X-Error-Title') description = req.get_header('X-Error-Description') ...
from django import forms from .models import AVAILABLE_SLOTS_LEVELS, Spell, Spellbook class SpellbookForm(forms.ModelForm): class Meta: model = Spellbook fields = ['name'] class SpellbookSlotsForm(forms.Form): spellbook_pk = forms.IntegerField(label="spellbook") slot_level_field_names =...
# terrascript/provider/vcd.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:30:19 UTC) # # For imports without namespace, e.g. # # >>> import terrascript.provider.vcd # # instead of # # >>> import terrascript.provider.vmware.vcd # # This is only available for 'official' and 'partner' providers. fr...
import re import jsonschema import json import copy from anchore_engine.services.policy_engine.engine.policy.exceptions import ( RequiredParameterNotSetError, ValidationError, ParameterValidationError, ) from anchore_engine.subsys import logger class InputValidator(object): __validator_description__ ...
from django.http import HttpResponse from django.db.models import Q from apiApp.models import Profile, Comment, Tag, User, Group, Post from apiApp.serializers import ProfileSerializer, CommentSerializer, UserSerializer, TagSerializer, GroupSerializer, PostSerializer from apiApp.permissions import IsOwnerOrReadOnly ...
from bson.objectid import ObjectId from app.models.domain.training_data_set import TrainingDataSet from tests.stubs.models.domain.feature_extraction_data import get_feature_extraction_data_stub_5_1, get_feature_extraction_data_stub_4_2 def get_training_data_set_stub(): return TrainingDataSet( last_modifi...
"""Slack platform for notify component.""" import asyncio import logging import os from urllib.parse import urlparse from aiohttp import BasicAuth, FormData from aiohttp.client_exceptions import ClientError from slack import WebClient from slack.errors import SlackApiError import voluptuous as vol from homeassistant....
from main import notion from commands.run_daily_reset import run_daily_reset from commands.run_update_duration import run_update_duration if notion.UPDATE_DURATION: print("UPDATE_DURATION : ", run_update_duration()) if notion.DAILY_RESET: print("DAILY_REST : ", run_daily_reset())