text
stringlengths
2
999k
# TO PRINT MULTIPLICATION TABLE num = int(input("enter a number")) for i in range(1, 11): print(num, 'x', i, '=', num*i)
''' 03-Load and explore your Twitter data Now that you've got your Twitter data sitting locally in a text file, it's time to explore it! This is what you'll do in the next few interactive exercises. In this exercise, you'll read the Twitter data into a list: tweets_data. Be aware that this is real data from Twitter...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import time import argparse from multiprocessing import Process from core import routine from core import config from core import slack from core import utils ############# # Osmedeus - One line to rude them all ############# __author__ = '@j3ssiej...
# -*- coding: utf-8 -*- def main(): import sys input = sys.stdin.readline n, m, k = map(int, input().split()) graph = [] for _ in range(m): ai, bi = map(int, input().split()) ai -= 1 bi -= 1 graph.append((ai, bi)) mod = 998244353 dp = [0] * n dp...
# # This source file is part of appleseed. # Visit https://appleseedhq.net/ for additional information and resources. # # This software is released under the MIT license. # # Copyright (c) 2016-2018 Esteban Tovagliari, The appleseedhq Organization # # Permission is hereby granted, free of charge, to any person obtaini...
from pymongo import MongoClient import pandas as pd import numpy as np import re class MongoWrapper: def __init__(self): self._client = MongoClient(host=['localhost:27017']) print('Mongo initiation: OK') def query(self, names, categories, gt, min_rating, orderBy, sortRule, required_st...
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved. import dace import numpy as np import pytest from dace.sdfg import nodes, infer_types from dace import dtypes import dace.libraries.nccl as nccl from dace.config import Config N = dace.symbol('N') root_device = dace.symbol('root_device') num_...
# coding: utf-8 """ Isilon SDK Isilon SDK - Language bindings for the OneFS API # noqa: E501 OpenAPI spec version: 6 Contact: sdk@isilon.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six from isi_sdk_8_1_1.models.network...
from fanstatic import Library, Resource import js.jquery import js.jqueryui library = Library('spiffform', 'resources') i18n = Resource(library, 'lib/jquery.i18n.min.js', depends=[js.jquery.jquery]) spiffform = Resource(library, 'spiffform/spiffform.js', depends=[js.jquery.jquery...
import requests import datetime import time import os from lotify.client import Client def moodle_notify(): lotify = Client() moodleToken = os.environ.get("MOODLE_TOKEN") lineToken = os.environ.get("LINE_TOKEN") url = f"{os.environ.get('MOODLE_URL')}webservice/rest/server.php" currentTime = int(ti...
from django.test import TestCase from filler.plain_classes.teams_data import TeamsData class TestTeamsData(TestCase): def test_participants_none(self): with self.assertRaises(AssertionError): TeamsData(participants=None, actions=['Action'], dates=['Date']) def test_actions_none(self): ...
import pdf_to_json as p2j import json url = "file:data/multilingual/Latn.KQN/Mono_8/udhr_Latn.KQN_Mono_8.pdf" lConverter = p2j.pdf_to_json.pdf_to_json_converter() lConverter.mImageHashOnly = True lDict = lConverter.convert(url) print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True))
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries # SPDX-FileCopyrightText: Copyright (c) 2021 Nathan Byrd # SPDX-License-Identifier: MIT import time import uschedule as schedule def greet(): print("Hello, world!") # Note: pass functions, not function calls - i.e. "greet", not "g...
#!/usr/bin/env python """chaostoolkit builder and installer""" import sys import io import setuptools sys.path.insert(0, ".") from chaoshumio import __version__ sys.path.remove(".") name = 'chaostoolkit-humio' desc = 'Chaos Toolkit Humio Extension' with io.open('README.md', encoding='utf-8') as strm: long_desc...
# mssql/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: http://www.opensource.org/licenses/mit-license.php """ .. dialect:: mssql :name: Microsoft SQL Server :full_support: 2017...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import grovepi import time from dotenv import load_dotenv from azure.iot.hub import IoTHubRegistryManager from azure.iot.hub.models import CloudToDeviceMethod # Load the connection string and device id from the .env file load_dotenv() ...
from pathlib import Path from setuptools import (find_packages, setup) import decision project_base_url = 'https://github.com/lycantropos/decision/' def read_file(path_string: str) -> str: return Path(path_string).read_text(encoding='utf-8') setup(name=decision.__name__, package...
#Copyright 2018 Julio Navarro #Built at the University of Strasbourg (France). CSTB team @ ICube laboratory from __future__ import division from os import path from glob import glob import sys def find_ext(dr, ext): return glob(path.join(dr,"*.{}".format(ext))) def search(text,n): '''Searches for text, and r...
from rest_registration.settings import registration_settings from rest_registration.utils.signers import URLParamsSigner from rest_registration.utils.users import get_user_by_verification_id, get_user_setting class RegisterSigner(URLParamsSigner): SALT_BASE = 'register' USE_TIMESTAMP = True def get_base_...
#!/usr/bin/env python # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 from StringIO import StringIO import gzip import json import urllib2 cdn = 'cdn.assets.scratch.mit.edu' #cdn = 'cdn.assets.scratch.ly' def download(fileName): request = urllib2.Request('http://'+cdn+'/internalapi/asset/{0}/get/'.format(f...
# pylint: disable=invalid-name # pylint: disable=missing-docstring # pylint: disable=no-member # pylint: disable=too-many-instance-attributes # pylint: disable=unused-argument from __future__ import print_function from unittest import TestCase from mock import MagicMock, patch from wxpy_rofi_config.gui import Confi...
import os import netCDF4 firstncfn = [fn for fn in os.listdir('.') if fn.split('.')[-1] == 'nc'][0] r = netCDF4.Dataset(firstncfn) lat = r.variables['lat'][:, :] lon = r.variables['lon'][:, :] np.savetxt('lat.txt', lat, fmt = '%.18f') np.savetxt('lon.txt', lon, fmt = '%.18f')
# (C) Datadog, Inc. 2018 # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) from __future__ import division import math import requests from six import iteritems from six.moves.urllib.parse import quote, urljoin from datadog_checks.checks import AgentCheck from datadog_checks.couch im...
""" https://github.com/mikedh/trimesh ------------------------------------ Trimesh is a pure Python (2.7- 3.3+) library for loading and using triangular meshes with an emphasis on watertight meshes. The goal of the library is to provide a fully featured Trimesh object which allows for easy manipulation and analysis, i...
__version__ = "0.2.1" from .classification import classification from .translation import translation from .ner import ner from .summarization import summarization from .question_answering import question_answering
from pytest import fixture from app import factory @fixture(scope="function") def test_app(): app = factory.create_app("testing") with app.app_context(): yield app
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ext...
# coding=utf-8 # -------------------------------------------------------------------------- # 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 ...
''' Function: 定义金币等掉落的物品 Author: Charles 微信公众号: Charles的皮卡丘 ''' import pygame import random '''定义食物类''' class Food(pygame.sprite.Sprite): def __init__(self, images_dict, selected_key, screensize, **kwargs): pygame.sprite.Sprite.__init__(self) self.screensize = screensize self.i...
# coding: utf-8 """ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ ...
############################################################################### # WaterTAP Copyright (c) 2021, The Regents of the University of California, # through Lawrence Berkeley National Laboratory, Oak Ridge National # Laboratory, National Renewable Energy Laboratory, and National Energy # Technology Laboratory ...
import numpy as np import pytest from aesara import _asarray, config from aesara.scalar.basic import round_half_away_from_zero_vec, upcast from aesara.tensor import vector from aesara.tensor.inplace import ( abs__inplace, add_inplace, arccos_inplace, arccosh_inplace, arcsin_inplace, arcsinh_inp...
import abc from functools import partial import matplotlib.animation as mplanim import matplotlib.pyplot as plt import matplotlib.widgets as widgets import mpl_toolkits.axes_grid1.axes_size as Size import numpy as np from mpl_toolkits.axes_grid1 import make_axes_locatable import astropy.units as u __all__ = ['BaseFu...
# -*- coding: utf-8 -*- import logging from torstack.library.encipher import EncipherLibrary from account.models import UserAccount logger = logging.getLogger(__name__) dbname = 'test' class UserAccountService(object): @staticmethod def get_one(db_session, username): with db_session.session_ctx(db...
# # Copyright(c) 2020-2021 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause-Clear # import random import pytest from api.cas import casadm from core.test_run import TestRun from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet from test_tools.disk_utils import Filesystem from test_utils.o...
# Copyright (c) 2012 OpenStack Foundation. # Administrator of the National Aeronautics and Space Administration. # 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 a...
from Tuleap.RestClient.Artifacts import Artifacts from lib.base import BaseTuleapAction class CreateArtifact(BaseTuleapAction): def run(self, tracker_id, values_by_field): success = self._login() if success: # Artifacts artifacts = Artifacts(self.connection) suc...
""" Group Anagrams: Write a method to sort an array of strings so that all the anagrams are next to each other. """ def GroupAnagrams(): strings = initialise_anagrams() anagrams = {} for i in range(len(strings)): word = "".join(sorted(strings[i].lower())) if not anagrams.has_key(word): ...
class PQ: def __init__(self,size=10): self.arr=list() self.arr.append(None)#[None for _ in range(size)] self.size=0 self.totalsize=size def insert(self,item): self.size+=1 self.arr.insert(self.size,item) self.swim(self.size) def swim...
""" Support for the EPH Controls Ember themostats. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/climate.ephember/ """ import logging from datetime import timedelta import voluptuous as vol from homeassistant.components.climate import ( ClimateDevi...
# Copyright 2019, OpenTelemetry 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://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
""" Computes the magnetization as a function of the inverse temperature for a three block SBM with external fields using: a) Block level mean-field approximation b) Full graph mean-field approximation c) Monte Carlo simulations with Metropolis Hastings dynamics Variant which focuses on studying the impact of differen...
class PosTable: def __init__(self): self.pos_id_table = {} self.id_pos_table = {} def put(self, pos): if pos not in self.pos_id_table: self.pos_id_table[pos] = len(self.pos_id_table) self.id_pos_table[len(self.id_pos_table)] = pos def get_id(self, pos): ...
# encoding: utf-8 import ckan.plugins as plugins import ckan.plugins.toolkit as toolkit class ExampleIConfigurerPlugin(plugins.SingletonPlugin): plugins.implements(plugins.IConfigurer) # IConfigurer def update_config_schema(self, schema): ignore_missing = toolkit.get_validator('ignore_missing...
from flask import Flask test = Flask(__name__) @test.route("/") def start(): return "Hello Start Page" @test.route("/home") def home_page(): return "Welcome Home page" @test.route("/blog/<X>") def blog(X): return " <h1>Welcome<h1> Author %s" % X @test.route('/<name>') def base(): if name =='home':...
# Generated by Django 2.2.8 on 2020-01-18 11:07 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='FyleAuth', fields=[ ('id', models.AutoField...
r"""OS routines for NT or Posix depending on what system we're on. This exports: - all functions from posix or nt, e.g. unlink, stat, etc. - os.path is either posixpath or ntpath - os.name is either 'posix' or 'nt' - os.curdir is a string representing the current directory (always '.') - os.pardir is a strin...
from datetime import datetime from factory import db from typing import List, Union from pydantic import BaseModel from utils.models import OrmBase from werkzeug.security import generate_password_hash, check_password_hash from sqlalchemy.orm import deferred class User(db.Model): __tablename__ = "user" id = d...
import unittest from app.models import User,Posts,Comments,Subscribe class UserModelTest(unittest.TestCase): def setUp(self): self.new_user = User(password = 'banana') def test_password_setter(self): self.assertTrue(self.new_user.pass_secure is not None) def test_no_access_passwo...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse from alipay.aop.api.domain.MultiCurrencyMoneyOpenApi import MultiCurrencyMoneyOpenApi from alipay.aop.api.domain.MultiCurrencyMoneyOpenApi import MultiCurrencyMoneyOpenApi from alipay.aop.api.dom...
# Global scope is vary useful in creating constants PI = 3.14159 # Convention is to use uppercase for names for constants URL = "https://www.google.com"
import numpy as np import matplotlib.pyplot as plt import matplotlib SPINE_COLOR = 'grey' def latexify(fig_width=None, fig_height=None, columns=1, largeFonts=False,font_scale=1): """Set up matplotlib's RC params for LaTeX plotting. Call this before plotting a figure. Parameters ---------- fig_widt...
import os import shutil import pathlib import logging from downloadutil.download_config import DownloadConfig from downloadutil.checksum_util import ( compute_string_sha256, SHA256_CHECKSUM_FILE_SUFFIX, get_sha256_file_path_or_url, validate_sha256sum, compute_file_sha256 ) from typing import Option...
from sklearn import datasets, svm, metrics from sklearn.model_selection import train_test_split if __name__ == '__main__': digits = datasets.load_digits() # flatten the images n_samples = len(digits.images) data = digits.images.reshape((n_samples, -1)) # Create a classifier: a support vector cla...
from .base import * # noqa from .base import env # GENERAL # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#debug DEBUG = True # https://docs.djangoproject.com/en/dev/ref/settings/#secret-key SECRET_KEY = env( "DJANGO_SECRET_KEY...
# third party import numpy as np import pytest import torch as th # syft absolute from syft.core.common.message import SyftMessage from syft.core.common.uid import UID from syft.core.node.common.node_service.request_receiver.request_receiver_messages import ( RequestStatus, ) from syft.core.node.domain import Doma...
import contextlib import os import sys from typing import Generator from typing import Sequence from typing import Tuple import pre_commit.constants as C from pre_commit.envcontext import envcontext from pre_commit.envcontext import PatchesT from pre_commit.envcontext import Var from pre_commit.hook import Hook from p...
''' step1. GoTo Command Prompt and install package opencv using command 'pip install opencv-python' after running the code ''' import numpy as np import cv2, time # We point OpenCV's CascadeClassifier function to where our # classifier (XML file format) is stored #face_classifier = cv2.CascadeClassifier('haarcascade...
# encoding: utf-8 from docx.api import Document # noqa __version__ = '0.2.14' # register custom Part classes with opc package reader from docx.opc.constants import CONTENT_TYPE as CT, RELATIONSHIP_TYPE as RT from docx.opc.part import PartFactory from docx.opc.parts.coreprops import CorePropertiesPart from docx....
# # Copyright (c) 2021, NVIDIA 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 ...
import sys import os import yaml from autoremovetorrents import logger from autoremovetorrents.task import Task from autoremovetorrents.exception.connectionfailure import ConnectionFailure from autoremovetorrents.exception.deletionfailure import DeletionFailure from autoremovetorrents.exception.loginfailure import Logi...
# Copyright 2020 Ram Rachum and collaborators. # This program is distributed under the MIT license. import click import webbrowser import pathlib import itertools import re import time from typing import (Optional, Tuple, Union, Container, Hashable, Iterator, Mapping, Iterable, Any, Dict, FrozenSet...
/home/runner/.cache/pip/pool/77/19/95/634959d3e1ed7fe2a49bb327ac55b9e3596479e2019d01b5d10e72d0b2
#!/usr/bin/env python """ s3-object-encryption-cleanup: checks a set of inventory buckets in account(s), downloads all inventories present for all buckets, and checks for the encryption state of all objects Usage: s3-object-encryption-cleanup audit <filename> [--accounts=<accounts>] [--buckets=<>] [--inventory_acco...
api_key = '' base_url = 'https://api.meraki.com/api/v1' organization_id = '' networks = [''] cams = [''] webex_email='' webex_token='' #Q2HV-ACVU-FEF6,Q2EV-6DCD-5QUQ
# -*- coding: utf-8 -*- # file: __init__.py.py # time: 2021/8/9 # author: yangheng <yangheng@m.scnu.edu.cn> # github: https://github.com/yangheng95 # Copyright (C) 2021. All Rights Reserved. from pyabsa.functional.trainer import APCTrainer, ATEPCTrainer, TextClassificationTrainer, Trainer from pyabsa.functional.config...
from django.shortcuts import render from . import forms from django.core.mail import message, send_mail from core.settings import EMAIL_HOST_USER # Create your views here. # bar code import cv2 from pyzbar.pyzbar import decode #send mail # Importing library def subscribe(request): return render(request, 'email/i...
import time from collections import OrderedDict from importlib import import_module from django.apps import apps from django.core.checks import Tags, run_checks from django.core.management.base import BaseCommand, CommandError from django.core.management.sql import ( emit_post_migrate_signal, emit_pre_migrate_sign...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('account', '0004_user_date_joined'), ] operations = [ migrations.RemoveField( model_name='user', name...
import pytest from numbers_parser import Document, TextCell ZZZ_TABLE_1_REF = [ [None, "YYY_COL_1", "YYY_COL_2"], ["YYY_ROW_1", "YYY_1_1", "YYY_1_2"], ["YYY_ROW_2", "YYY_2_1", "YYY_2_2"], ["YYY_ROW_3", "YYY_3_1", "YYY_3_2"], ["YYY_ROW_4", "YYY_4_1", "YYY_4_2"], ] ZZZ_TABLE_2_REF = [ [None, "Z...
N, T = map(int, input().split()) if N == 1: print(T if T != 10 else -1) else: ans = int('1' + '0' * (N-1)) for i in range(10): if (ans + i) % T == 0: print(ans + i) break
#!/usr/bin/env python2 import VBASim import RNG import Basic_Classes import pandas as pd Clock = 0.0 ZRNG = RNG.InitializeRNSeed() Queue = Basic_Classes.FIFOQueue() Wait = Basic_Classes.DTStat() Server = Basic_Classes.Resource() Calendar = Basic_Classes.EventCalendar() TheCTStats = [] TheDTStats = [] TheQueues = []...
import gzip import docker import logging import os import tarfile import time import uuid from collections import OrderedDict from io import BytesIO from textwrap import dedent from .Cluster import Cluster from ..flow_serialization.Minifi_flow_yaml_serializer import Minifi_flow_yaml_serializer from ..flow_serializati...
from logging import getLogger import numpy as np def calc_score(df_truth, pred): logger = getLogger('root') target_types = list(set(df_truth['type'])) diff = df_truth['scalar_coupling_constant'] - np.sum(pred, axis=1) diff_fc = df_truth['fc'] - pred[:, 0] diff_sd = df_truth['sd'] - pred[:, 1] ...
# -*- coding: utf-8 -*- #- This file documents what are the settings needed in production #- The values should not be written here, just documentation what #- is needed. #- #- Infrastructure specific settings in production come from local_settings.py #- which is importing this file. from project.settings import * #f...
import shutil import numpy as np from copy import deepcopy from PyQt5.QtWidgets import * from GUI.Process import Ui_Process from PyQt5.QtCore import * from Utility.EcLog import eclog from FAE.FeatureAnalysis.Normalizer import * from FAE.FeatureAnalysis.DimensionReduction import * from FAE.FeatureAnalysis.FeatureSelect...
import openslide import xml.etree.ElementTree as ET import numpy as np from skimage.draw import polygon from multiprocessing import Pool import cv2 import logging def camelyon16xml2json(inxml, level): """ Convert an annotation of camelyon16 xml format into a json format. Arguments: inxml: string,...
import scrapy from poem_spider.items import PoemItem, PoetItem import re import uuid class PoemSpider(scrapy.Spider): name = "poem" poet_count = 1 poem_count = 1 """ 用于记录某个诗人所有诗词的总页数 例如https://so.gushiwen.org/authors/authorvsw_515ea88d1858A30.aspx 没有到最后一页确展示空无法请求下一页 此时请求下下一页 """ poet_...
# -*- coding: utf-8 -*- from jinja2 import Template TPL_ROUTE_DEFINITION = \ u'''## Rotas para criar/listar a entidade {{entity_name}} [/{{route}}/] ### Lista todas as entidades {{entity_name}} [GET] + Response 200 (application/json) + Attributes(array[{{entity_name}} response]) ### Cria uma nova entidade {{e...
#!/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2009-2016, Mario Vilas # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above cop...
from ..utils.magic import MagicSquare from ..search import annealing, beam, genetic, greedy, randoms from ..stats import calc def print_stats(finder, iter_per_experiment=100): print('============================================================\n' 'Search type: {}\n'.format(finder['type'])) it_mean, ...
#!/usr/bin/python # # Copyright 2020-2021 Bruno Ribeiro # <https://github.com/brunexgeek/jane> # # 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-...
# Generated by Django 3.1.1 on 2021-12-14 12:36 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('openings', '0005_auto_20211207_1155'), ] operations = [ migrations.RemoveField( model_name='opening', name='visible', ...
from abc import abstractmethod from contextlib import contextmanager from dataclasses import dataclass from sqlite3.dbapi2 import Connection from typing import Iterable import sqlite3 @dataclass class DbParameters: """ Класс с типичными параметрами соединения с СУБД """ dbname: str host: str = 'loc...
# adopted from https://github.com/kennethreitz/setup.py/blob/master/setup.py import io import os import sys from shutil import rmtree from setuptools import find_packages, setup, Command NAME = 'drf-channels-oneway-ws' MODULE = 'channels_oneway' DESCRIPTION = 'Simple one-way bindings for django-channels with some sp...
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml; using PrettyGood.Util; namespace PrettyGood.LastFm { public class Error : Exception { public readonly int error; public readonly string message; public Error(XmlElement error) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ In this problem set you work with cities infobox data, audit it, come up with a cleaning idea and then clean it up. Since in the previous quiz you made a decision on which value to keep for the "areaLand" field, you now know what has to be done. Finish the function fi...
# Pre-requisites # 1. Install Anaconda # wget https://repo.continuum.io/archive/Anaconda3-5.0.0-Linux-x86_64.sh -O anaconda3.sh # chmod +x anaconda3.sh # ./anaconda3.sh -b -p ~/local/anaconda3 # 2. Create and activate PyTorch env # ~/local/anaconda3/bin/conda create -yn pytorch # source ~/local/anaconda3/bin/activate p...
from abc import ABCMeta, abstractmethod from hematite.compat import SocketIO from hematite.raw import core from hematite.raw import messages as M from hematite.raw import parser as P import errno import io import socket import ssl from threading import Lock, RLock class BaseIODriver(object): __metaclass__ = ABCMe...
# Copyright 2015 Google Inc. 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 a...
from tkinter import * from tkinter import ttk import random window = Tk() window.resizable(False , False) window.title('Password Generator') window.geometry('300x200') window.iconbitmap('PG.ico') length = IntVar() lbl = StringVar() var1 = StringVar() var2 = StringVar() var3 = StringVar() Alphabet...
from django.contrib import admin from django.core.cache import cache from classification.models import * class CollectionLocalAdmin(admin.TabularInline): model = CollectionLocal extra = 1 class CollectionAdmin(admin.ModelAdmin): model = Collection list_display = ('community_collection_path', 'count...
import numpy as np import pandas as pd from ..signal import signal_autocor def complexity_relativeroughness(signal, **kwargs): """**Relative Roughness (RR)** Relative Roughness is a ratio of local variance (autocovariance at lag-1) to global variance (autocovariance at lag-0) that can be used to classif...
import logging from typing import Any, Dict, List from .utils import get_json logging.basicConfig(level=logging.INFO) def fetch_markets(market_type: str) -> List[Dict[str, Any]]: '''Fetch all trading markets from a crypto exchage.''' if market_type == 'spot': return _fetch_spot_markets() else: ...
from neomodel import (config, StructuredNode, StringProperty, UniqueIdProperty) class Entity(StructuredNode): uid = UniqueIdProperty() name = StringProperty(unique_index=False) class Continuant(Entity): pass class IndependentContinuant(Cont...
import itertools import numpy as np import operator from numba.core import types, errors from numba import prange from numba.parfors.parfor import internal_prange from numba.core.utils import RANGE_ITER_OBJECTS from numba.core.typing.templates import (AttributeTemplate, ConcreteTemplate, ...
import unittest from robot.utils.asserts import (assert_equal, assert_false, assert_true, assert_raises, assert_raises_with_msg) from robot.utils import ConnectionCache class ConnectionMock: def __init__(self, id=None): self.id = id self.closed_by_close = False...
import numpy as np from sklearn.base import TransformerMixin, BaseEstimator from typing import Optional, Union, Tuple class PathEncoder(TransformerMixin, BaseEstimator): """ Encoding of string paths into NumPy array Parameters ---------- order: int Number of states to be enc...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys import numpy as np from keras.datasets.cifar import load_batch import keras.backend as K from keras.utils.data_utils import get_file HERE = os.path.dirname(os.path.abspath(__file__)) de...
import tensorflow as tf EPS = 1e-8 class PPO(tf.Module): """ ニューラルネットワークが絡む推論、学習の2つの計算を行うクラスです。 @tf.functionデコレータは実行時に関数をグラフにコンパイルしてくれるもので、学習の高速化・GPUでの実行を可能にします。 """ def __init__(self, num_actions, input_shape, config): super(PPO, self).__init__(name='ppo_model') self.num_actions =...