text
stringlengths
1
927k
from gwa_maid import bcrypt, fernet from gwa_maid.models import User from cryptography.fernet import InvalidToken def tokenize(id, password): password_crypt = fernet.encrypt(password.encode('utf-8')).decode('utf-8') token = f'{id}:{password_crypt}' return token def get_user_from_token(token): token...
from src.helpers.variant_helpers.variant_title.canonical_transcript_title import get_canonical_transcript_title from src.helpers.variant_helpers.variant_title.MANE_transcript_title import get_MANE_transcript_title def preferred_title_for(variant, effective_ensembl_vep_transcripts: list, gene_source_from_clinvar_varia...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "cedc53254a5d2e04e79cc0e7bf5a8c71fafa295e" LLVM_SHA256 = "7457f8395f59342567b742409c953aad9b74dd7603df72e5e557fa6c4afa8088" tf_http_archive( ...
#! /usr/bin/env python2 # # This file is part of khmer, http://github.com/ged-lab/khmer/, and is # Copyright (C) Michigan State University, 2009-2013. It is licensed under # the three-clause BSD license; see doc/LICENSE.txt. # Contact: khmer-project@idyll.org # import sys import screed.fasta import os import khmer from...
#!/usr/bin/env python ############################################################################### # $Id$ # # Project: GDAL/OGR Test Suite # Purpose: Test ISIS3 formats. # Author: Frank Warmerdam <warmerdam@pobox.com> # ############################################################################### # Copyright (...
from django.conf import settings from django.contrib.auth.decorators import login_required from django.db import transaction from django.http import HttpResponse, JsonResponse from django.shortcuts import redirect, render from social_django.models import UserSocialAuth from .models import UserProfile, Project, Molecule...
from datetime import ( datetime, ) from zipfile import ( ZipFile, ) import pandas as pd import pickle as pk def question_rating_calc( tournament_name: dict, question_rating: list, dataset: dict, ) -> pd.DataFrame: tournament_rating = {} questions_count = 0 for tournament in dataset...
from tabulate import tabulate import re from cesium.features.graphs import (feature_categories, dask_feature_graph, extra_feature_docs) def feature_graph_to_rst_table(graph, category_name): """Convert feature graph to Sphinx-compatible ReST table.""" header = [category_name...
"""Global configuration state and functions for management """ import os from contextlib import contextmanager as contextmanager _global_config = { 'assume_finite': bool(os.environ.get('SKLEARN_ASSUME_FINITE', False)), 'working_memory': int(os.environ.get('SKLEARN_WORKING_MEMORY', 1024)), 'print_changed_on...
# # @lc app=leetcode id=6 lang=python3 # # [6] ZigZag Conversion # # https://leetcode.com/problems/zigzag-conversion/description/ # # algorithms # Medium (30.76%) # Total Accepted: 290.4K # Total Submissions: 943.9K # Testcase Example: '"PAYPALISHIRING"\n3' # # The string "PAYPALISHIRING" is written in a zigzag pat...
""" ASGI config for d_party 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/4.0/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault("DJANGO_SETTI...
from exam_22aug.project.appliances.appliance import Appliance class TV(Appliance): def __init__(self): super().__init__(cost=1.5)
# Python3 # 有限制修改區域 def getPoints(answers, p): questionPoints = lambda i, ans: (i + 1) if ans else -p res = 0 for i, ans in enumerate(answers): res += questionPoints(i, ans) return res
from abc import ABC from typing import Any, Dict, Optional from core.commons import log_objects from core.exceptions.db_not_found_exception import DbNotFoundException from core.exceptions.payload_exception import PayloadException from core.objects.dbs_credentials import DBSCredentials from core.services.dbs import DBS...
"""Desktop Automator initial setup logic.""" import shutil from contextlib import suppress from desktopautomator.const import DATA_DIR, DEFAULT_CONFIG_DIR def pre_setup() -> None: """Do initial setup if needed.""" with suppress(FileExistsError): shutil.copytree(f"{DATA_DIR}/initial_config/", DEFAULT...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 10 12:50:59 2020 @author: Luke """ #============================================================================== # SUMMARY #============================================================================== # 18 May 2020 # plots detection and attr...
"""helpers.py Provides general helper functions for use with other modules. """ def read_only(fn): """Decorator used to make a class function read only. Args: fn: Class function used to return a read only value. Raises: TypeError if the function argument enounters a "set" operation. ...
# GENERATED BY KOMAND SDK - DO NOT EDIT from .action import DeleteMalware
import dataclasses import logging import time from collections import Counter from typing import Optional from hddcoin.protocols.protocol_message_types import ProtocolMessageTypes from hddcoin.server.outbound_message import Message log = logging.getLogger(__name__) @dataclasses.dataclass(frozen=True) class RLSettin...
import pytest from django.urls import reverse from soduko.users.models import User pytestmark = pytest.mark.django_db class TestUserAdmin: def test_changelist(self, admin_client): url = reverse("admin:users_user_changelist") response = admin_client.get(url) assert response.status_code ==...
from django.contrib import admin from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.utils.translation import gettext as _ from core import models class UserAdmin(BaseUserAdmin): ordering = ['id'] list_display = ['email', 'name'] fieldsets = ( (None, {'fields': ('email', '...
# Copyright 2015 Red Hat, 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 agre...
#!/usr/bin/env python import os import sys if __name__ == '__main__': os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'kube101.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are ...
import argparse import functools import numpy as np import torch from utils.reader import load_audio from utils.utility import add_arguments, print_arguments parser = argparse.ArgumentParser(description=__doc__) add_arg = functools.partial(add_arguments, argparser=parser) add_arg('audio_path1', str, 'audio_d...
import os import shutil from function import Fn fn = Fn() def move_file(src, dest): src = fn.smart_path(src, file = __file__) dest = fn.smart_path(dest, file = __file__) src_files = os.listdir(src) for file_name in src_files: full_file_name = os.path.join(src, file_name) if os.path.isf...
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) # ---------------------------------------------------------------------------- from spack import * import os import subpr...
from __future__ import print_function import os.path import CoolProp import subprocess import sys web_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) root_dir = os.path.abspath(os.path.join(web_dir, '..')) fluids_path = os.path.join(web_dir,'fluid_properties','fluids') plots_path = os.path.join(we...
# Copyright 2020, Kay Hayen, mailto:kay.hayen@gmail.com # # Python test originally created or extracted from other peoples work. The # parts from me are licensed as below. It is at least Free Software where # it's copied from other people. In these cases, that will normally be # indicated. # # L...
from django.db.models import TextChoices from django.utils.translation import gettext as _ class EntryDetailEnum(TextChoices): CELL='موبایل',_('موبایل') TEL='تلفن',_('تلفن') EMAIL='ایمیل',_('ایمیل') ADDRESS='آدرس',_('آدرس') NOTE='یادداشت',_('یادداشت')
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
from ._abstract import AbstractScraper class BowlOfDelicious(AbstractScraper): @classmethod def host(cls): return "bowlofdelicious.com" def title(self): return self.schema.title() def total_time(self): return self.schema.total_time() def yields(self): return self...
''' metrics Contact: adalca@csail.mit.edu ''' # imports import numpy as np def dice(vol1, vol2, labels=None, nargout=1): ''' Dice [1] volume overlap metric The default is to *not* return a measure for the background layer (label = 0) [1] Dice, Lee R. "Measures of the amount of ecologic associatio...
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# coding: utf-8 # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
#!/usr/bin/env python # encoding: utf-8 """ @version: v1.0 @author: W_H_J @license: Apache Licence @contact: 415900617@qq.com @software: PyCharm @file: alipayTestOne.py @time: @describe: """ import sys import os from redisgraph import Graph from config.redisContent import RedisContent sys.path.append(os...
''' ResNet-based model to map an image from pixel space to a features space. Need to be pretrained on the dataset. if isometric_map = True, there is an extra step (elf.classifier_1 = nn.Linear(512, 32*32*3)) to increase the dimension of the feature map from 512 to 32*32*3. This selection is for desity-ratio estimation...
from django.http import HttpResponse from django.utils.encoding import force_str from form_designer.contrib.exporters import FormLogExporterBase try: import xlwt except ImportError: # pragma: no cover XLWT_INSTALLED = False else: # pragma: no cover XLWT_INSTALLED = True class XlsExporter(FormLogExport...
''' test plugins ''' from datetime import date import pytest from tenable.io.plugins import PluginIterator from ..checker import check @pytest.mark.vcr() def test_families(api): '''test to get the plugin families''' families = api.plugins.families() assert isinstance(families, list) for family in fami...
MODEL_CATEGORY_MAPPING = { "header": 'index,' 'model_id,' 'fine_grained_class,' 'coarse_grained_class,' 'empty_struct_obj,' 'nyuv2_40class,' 'wnsynsetid,' 'wnsynsetkey', "coarse": { 'ATM': 'ATM', 'a...
# -*- coding: utf-8 -*- """ @author: abhilash """ #importing the required libraries import cv2 import face_recognition #loading the image to detect image_to_detect = cv2.imread('images/testing/trump-modi.jpg') #detect all faces in the image #arguments are image,no_of_times_to_upsample, model all_face_locations = fac...
# Based on LIVE-185 import boto3 import netaddr VPC_NETMASK_BITS = '11111111.11111111.11100000.00000000' # 19 bits SUBNET_BITS = 23 # 4 bits for subnet, max 16 subnets DEFAULT_FIRST_CIDR = netaddr.IPNetwork('10.10.0.0/19') # because third parties eg elemental might claim '10.0.0.0' networks entirely for itself.. def ...
# -*- coding: UTF-8 -*- """PyBoss Homework Solution.""" # Import required packages import csv import os # Files to load and output (Remember to change these) file_to_load = os.path.join("raw_data", "employee_data.csv") file_to_output = os.path.join("analysis", "employee_data_reformatted.csv") # Dictionary of states ...
from pymongo import MongoClient from bson.objectid import ObjectId import configparser config = configparser.ConfigParser() config.read('config.ini', encoding='utf-8-sig') mongoIP = config['DEFAULT']['mongoIP'] mongoPort = int(config['DEFAULT']['mongoPort']) mongoDB = config['DEFAULT']['mongoDB'] article_collection =...
import unittest import orca import os.path as path from setup.settings import * from pandas.util.testing import * def _create_odf_csv(data, dfsDatabase): # call function default_session() to get session object s = orca.default_session() dolphindb_script = """ login("admin", "123456") ...
# datetime from datetime import datetime print(datetime.now()) # 2018-10-25 12:15:26.557139 # setting date format from datetime import datetime date_time_str0 = '8-10-2018 11:52:40' date_time_str1 = 'Jun 28 2018 7:40AM' date_time_str2 = 'September 18, 2017, 22:19:55' date_time_str3 = 'Sun,05/12/99,12:30PM' date_ti...
import sys def convert(x): return 1 if x == "H" else 0 a, b = sys.stdin.readline().split() a = convert(a) b = convert(b) def main(): ans = "D" if a ^ b else "H" print(ans) if __name__ == "__main__": main()
import socket from urlparse import urlparse import pytest import mock from util import UpnpPunch as upnp @pytest.fixture def mock_socket(): mock_socket = mock.MagicMock() mock_socket.recv = mock.MagicMock(return_value='Hello') mock_socket.bind = mock.MagicMock() mock_socket.send_to = mock.MagicMock(...
""" Utility functions for tensorflow. """ import tensorflow as tf from tensorflow.python.framework import ops from tensorflow.python.framework import tensor_shape from tensorflow.python.framework import tensor_util from tensorflow.python.ops import math_ops from tensorflow.python.ops import random_ops from tensorflow....
#!/usr/bin/env python # Copyright (c) 2017-2021 F5 Networks, 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 appl...
import os import sys import snap filename = "example.paj" output = open(filename, "w") output.write("""*Vertices 9 1 "1" 0.3034 0.7561 2 "2" 0.4565 0.6039 3 "3" 0.4887 0.8188 *Arcs 1 2 1 1 3 1 2 3 1 """) output.close() print("Directed grap...
# # This source file is part of the EdgeDB open source project. # # Copyright 2016-present MagicStack Inc. and the EdgeDB authors. # # 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...
""" Copyright (c) 2022 Huawei Technologies Co.,Ltd. openGauss is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W...
# mysql/base.py # Copyright (C) 2005-2021 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: https://www.opensource.org/licenses/mit-license.php r""" .. dialect:: mysql :name: MySQL / MariaDB :full_support: 5.6, 5.7, 8.0 ...
from simulator import * import numpy as np ''' Notes : Use the env variable and its helper functions to 1. get the points for a set of player ids 2. get the cost for a set of player ids ''' profiles = [{'cols': ['stats.minutes'], 'order': [False], 'prob_dist': [0, 0, 0, 0, 0, 0, 0, 0...
from __future__ import unicode_literals import datetime import decimal from collections import defaultdict from django.contrib.auth import get_permission_codename from django.core.exceptions import FieldDoesNotExist from django.core.urlresolvers import NoReverseMatch, reverse from django.db import models from django....
######################################################################################################## # SEC-00: PREFACE ######################################################################################################## """ Title: pylightxl Developed by: pydpiper Version: 1.53 License: MIT Copyright (c) 2019 V...
""" Output channel that sends emails. Relies on Mandrill to actually send mails. """ import settings import pprint from twisted.python import log import mandrill import requests from htmlmin import minify from httpd_site import env from channel import OutputChannel from constants import OUTPUT_CHANNEL_EMAIL import sen...
from rwanda.locations import Rwanda a = Rwanda() def provinces(): return a.provinces()
from unittest.mock import patch import numpy as np import pandas as pd import pytest from pytest import importorskip from evalml.model_family import ModelFamily from evalml.pipelines.components import ARIMARegressor from evalml.problem_types import ProblemTypes sktime_arima = importorskip( "sktime.forecasting.ar...
import os import re import hashlib import sys import gzip try: from urllib2 import urlopen, Request except ImportError: from urllib.request import urlopen, Request registry = { "psi-ms.obo": "https://raw.githubusercontent.com/HUPO-PSI/psi-ms-CV/master/psi-ms.obo", "unit.obo": "http://ontologies.berke...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import tqdm import jax.numpy as jnp from jax import random from jax import vmap, jit from exojax.spec import rtransfer as rt from exojax.spec import planck, moldb, contdb, response, molinfo from exojax.spec.lpf import xsmatri...
"""Import required metrics.""" from .classification_eval_metrics import ( WeightedCrossEntropyMetric, FocalMetric, F1_Score_Binary, ) __all__ = [ "WeightedCrossEntropyMetric", "FocalMetric", "F1_Score_Binary" ]
from collections import OrderedDict import torch import torchvision from catalyst import utils from catalyst.dl import ConfigExperiment class CIFAR10(torchvision.datasets.CIFAR10): """`CIFAR10 <https://www.cs.toronto.edu/~kriz/cifar.html>`_ Dataset.""" def __getitem__(self, index: int): """Fetch a ...
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright 2017, Battelle Memorial Institute. # # 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...
# Copyright 2018 Open Source Robotics Foundation, 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...
def jogo(c,a): if a == c[i]: return "GAME OVER" elif int(c[i]) - int(c[i]) > a: return "GAME OVER" else: return "YOU WIN" a, b = input().split() c = input().split() a = int(a) b = int(b) for i in range(b): if jogo(c,a) == "GAME OVER": break print(jogo(c,a))
""" This script contains useful generic functions """ import re import pkgutil import random import string from typing import List from typing import Union from typing import Optional from deeplodocus.utils.flags.ext import * from deeplodocus.utils.flags.notif import * from deeplodocus.utils.flags.dtype import * from ...
"""Collection of basic functions used throughout imgaug.""" from __future__ import print_function, division, absolute_import import math import numbers import sys import os import json import types import functools # collections.abc exists since 3.3 and is expected to be used for 3.8+ try: from collections.abc imp...
import numpy as np arr = np.array(input().split()) arr = arr.astype(int) c = s = 0 for i in range(len(arr)): for j in range(len(arr)): if(arr[i]==arr[j] and i!=j): c = 0 break else: c = arr[i] s = s+c c = 0 print(s)
# 核心思路 # 利用bk作为单调栈,如果遍历时ch小于bk栈顶元素,则不断弹出 # 直到1)弹出次数已经达到k上限 2)栈空 # 结束遍历后如果k有余且栈不为空,继续弹栈 # 栈低保存最后数的高位,栈顶为低位,因此保证栈从上到下单调递减 # 可以令最后结果最小 class Solution(object): def removeKdigits(self, num, k): """ :type num: str :type k: int :rtype: str """ bk = [] for c in num: ...
import cvxpy as cvx import numpy as np def convex_diploid(lhs, ncs, pi_robust): n = len(lhs) w = cvx.Variable(n) print('building objective. . .') f = ((1-pi_robust) * np.asarray(lhs) + pi_robust) / np.asarray(ncs) print(f.shape) for i in range(f.shape[0]): print(np.sum(np.log(f[i,:]))) ...
from tkinter import * import mysql.connector import csv from tkinter import ttk # Funções # Função do botão de limpar campos def limpar_campos(): primeiro_nome_entry.delete(0, END) sobrenome_entry.delete(0, END) endereco_1_entry.delete(0, END) endereco_2_entry.delete(0, END) cidade_entry.delete(0,...
# -*- coding: utf-8 -*- # # Copyright 2018 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
from django.test import TestCase from tests.test_app.models import ( NaturalKeyParent, NaturalKeyChild, ModelWithSingleUniqueField, ModelWithExtraField, ModelWithConstraint ) from django.db.utils import IntegrityError # Tests for natural key models class NaturalKeyTestCase(TestCase): def test_naturalkey_...
""" Know more, visit my Python tutorial page: https://morvanzhou.github.io/tutorials/ My Youtube Channel: https://www.youtube.com/user/MorvanZhou Dependencies: tensorflow: 1.1.0 """ import tensorflow as tf var = tf.Variable(0) # our first variable in the "global_variable" set add_operation = tf.add(var, 1) update...
# Given a linked list, rotate the list to the right by k places, where k is non-negative. # Example 1: # Input: 1->2->3->4->5->NULL, k = 2 # Output: 4->5->1->2->3->NULL # Explanation: # rotate 1 steps to the right: 5->1->2->3->4->NULL # rotate 2 steps to the right: 4->5->1->2->3->NULL # Example 2: # Input: 0->1->2->...
from django.apps import AppConfig class PlaypalConfig(AppConfig): name = 'api'
# -*- coding: utf-8 -*- """ Created on Tue Apr 15 22:52:11 2014 @author: spatchcock """ import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation # Advection - diffusion - Decay - production # # Differential equation # # dC/dt = D(d^2C/dx^2) - w(dC/dx) - uC + Ra(x) # # Difference ...
"""This module contains tools for making meteograms."""
# -*- coding: utf-8 -*- # Copyright 2018 The Blueoil Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unles...
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import copy import sqlite3 from logbook import Logger from config import base_settings as bs from entity.models import Patents...
# pylint: disable=g-bad-file-header # Copyright 2021 DeepMind Technologies Limited. 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/...
# Owner(s): ["oncall: distributed"] import copy import os import sys import tempfile import threading import time import unittest from datetime import timedelta from itertools import product from sys import platform import torch import torch.distributed as dist if not dist.is_available(): print("distributed pack...
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-10-10 18:25 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('experiments', '0067_auto_20171009_1650'), ] operations = [ migrations.AddFi...
# # This source file is part of the EdgeDB open source project. # # Copyright 2016-present MagicStack Inc. and the EdgeDB authors. # # 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...
# -------------------------------------------------------------------- # main.py - user interface, parses and applies collect commands # June - September 2018 - Franz Nowak, Hrutvik Kanabar, Andrei Diaconu # -------------------------------------------------------------------- """ Controller script - user interface, pa...
import re from vistautils.memory_amount import MemoryAmount, MemoryUnit import pytest UNIT_PARSE_TEST_PAIRS = [ (MemoryUnit.KILOBYTES, "K"), (MemoryUnit.MEGABYTES, "M"), (MemoryUnit.GIGABYTES, "G"), (MemoryUnit.TERABYTES, "T"), ] @pytest.mark.parametrize("reference_unit,string_to_parse", UNIT_PARSE...
# Buy in the evening and then sell next day in the morning # # Buy again the next day # repeat # The idea # we should buy in 10% increments (tunable) towards the end of the day if the price is going up # every buy should be around 10 mins apart (tunable) # Thus we have 10 sales, by eod # Sell each tr...
# coding: utf-8 """ AverageAnalysedValue.py The Clear BSD License Copyright (c) – 2016, NetApp, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are ...
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils.rnn import pad_sequence, pack_padded_sequence, pad_packed_sequence from .fc_encoder import FcEncoder class BiLSTMEncoder(nn.Module): def __init__(self, input_size, hidden_size): super(BiLSTMEncoder, self).__init__() ...
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the #...
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incor...
import os import sys import gym import numpy as np import torch from gym.spaces.box import Box from baselines import bench from baselines.common.atari_wrappers import make_atari, wrap_deepmind from baselines.common.vec_env.vec_env import \ VecEnvWrapper, VecEnv, CloudpickleWrapper, clear_mpi_env_vars from baselin...
# Copyright 2014 NEC Corporation. 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 ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # License: MIT # author: Luis Rei < me@luisrei.com > from collections import defaultdict from datahelper import read_i_json, write_csv, lang_filter, min_token_filter from datahelper import dedup_records, add_id from datamaps import read_label_map, apply_label_map, save_list...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import mock from datetime import date from django.test import TestCase from ralph.account.models import Region from ralph_assets import models ...
# -*- coding: utf-8 -*- from model.contact_data import Contact_option def test_add_new(app): old_contacts = app.contact.get_contact_list() contact = Contact_option(first_name="Kamaz", middle_name="Petroviz", last_name="Testov", nick_name="petro", title="neznay",company="opensystem", address="moskva", ...
import pymongo from pymongo import collection if __name__ == "__main__": print("welcome to pymongo") client = pymongo.MongoClient("mongodb://localhost:27017") # print(client) db = client['pratik'] # client collection = db['mySamplecode'] # dictionary dictionary = [{'name': 'ABC', '...
import json import math import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import plotly as ply import random import scipy.stats as stats from sklearn.feature_extraction.text import CountVectorizer from sklearn.pipeline import Pipeline from sklearn.feature_extraction.text...