text
stringlengths
1
927k
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class ApplyCodeRequest(object): def __init__(self): self._biz_code = None self._biz_id = None self._context_data = None self._logo_url = None @property def biz_...
""" This is the main program for running daily particle tracking jobs, and then processing them for the interactive DRIFTER website pages. Testing on mac: run make_forcing_main.py -d 2019.07.04 -test True """ import os, sys sys.path.append(os.path.abspath('../')) import forcing_functions as ffun Ldir, Lfun = ffun.i...
# Copyright 2018 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 lxml import etree from parser_rail.netElement import NetElement from parser_rail.netRelation import NetRelation from parser_rail.network import Network from parser_rail.geometricPos import GeometricPosition from parser_rail.linearPos import LinearPosition from parser_rail.level import Level from parser_rail.railwa...
""" In PY3, urllib2 was ported mostly to urllib.request. The original PY2 urllib module is unique to PY2. In this module, we use urllib2 and urllib.request methods interchangeably depending on the version of python. We refer to the original PY2 urllib module as "legacy". """ import io import mock import os from vuln...
#!/usr/bin/python3 import argparse import sys import math # Check correct usage parser = argparse.ArgumentParser(description="Check your Bus.") parser.add_argument('input', metavar='input', type=str, help='Bus timetable input.') args = parser.parse_args() busses = [] board = 0 syncStart = 0 def...
#!/usr/bin/env python from multiprocessing import Process import multiprocessing import os # Miscellaneous operating system interfaces from os.path import abspath from os.path import exists from os.path import isfile from os.path import join import cPickle as pickle import gzip import copy import time import numpy a...
#!/usr/bin/python # -*- coding: utf-8 -*- """ This module implements a friendly (well, friendlier) interface between the raw JSON responses from Jira and the Resource/dict abstractions provided by this library. Users will construct a JIRA object as described below. Full API documentation can be found at: https://jira.r...
numeros = [0, 0, 0, 0, 0] x = 0 while x < 5: numeros[x] = int(input('Numero {0}: '.format(x))) x += 1 escolhido = int(input('Que posição você quer imprimir: ')) print('Você escolheu o número: {0}'.format(numeros[escolhido]))
############################################################################### ## ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## "Redistribution and use in source and binary for...
# 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 or agreed to in writing, ...
import torch.optim as optim from torch.nn.utils import clip_grad_norm class Optim(object): """ Controller class for optimization. Mostly a thin wrapper for `optim`, but also useful for implementing rate scheduling beyond what is currently available. Also implements necessary methods for training R...
import os import os.path import time import mmap import errno from tsdb.error import * from tsdb.row import Aggregate, ROW_VALID, ROW_TYPE_MAP from tsdb.chunk_mapper import CHUNK_MAPPER_MAP from tsdb.util import write_dict, calculate_interval, calculate_slot from tsdb.aggregator import Aggregator from tsdb.filesystem ...
import time from contextlib import contextmanager from ipaddress import IPv4Network from tempfile import NamedTemporaryFile from srsran_controller.mission.enb import Enb from srsran_controller.mission.lte_network import LteNetwork from srsran_controller.mission.mission_configuration import MissionConfiguration from sr...
"""Test whether all elements of cls.args are instances of Basic. """ # NOTE: keep tests sorted by (module, class name) key. If a class can't # be instantiated, add it here anyway with @SKIP("abstract class) (see # e.g. Function). import os import re from sympy import (Basic, S, symbols, sqrt, sin, oo, Interval, exp,...
from flask_restful import Resource, reqparse class Signup(Resource): def get(self): pass
#coding: utf-8 """ Converts some ActionScript3 to a JavaScript file. Usage: python as2js.py actionscriptFile.as [...] Overwrites each .js file parallel to each .as file. Usage: python as2js.py --test Just run unit tests. Forked from 06\_jw as2js by Ethan Kennerly. """ import codecs import os import re import...
# The MIT License (MIT) # Copyright (c) 2021-present foxwhite25 # # 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, ...
# -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
#!/usr/bin/env python # Copyright (C) 2017 Electric Movement Inc. # # This file is part of Robotic Arm: Pick and Place project for Udacity # Robotics nano-degree program # # All Rights Reserved. # Author: Harsh Pandya # import modules import rospy from geometry_msgs.msg import Pose from std_msgs.msg import Float64 f...
"""Ground vehicle path planning problem.""" from math import * import beluga import logging ocp = beluga.OCP('dubin') # Define independent variables ocp.independent('t', 's') # Define equations of motion ocp.state('x','V*cos(theta)','m') \ .state('y','V*sin(theta)','m') \ .state('theta','-V/L*delta','rad') ...
#!/usr/bin/env pytest # -*- coding: utf-8 -*- ############################################################################### # $Id$ # # Project: GDAL/OGR Test Suite # Purpose: Test GeoPackage driver functionality. # Author: Paul Ramsey <pramsey@boundlessgeom.com> # #################################################...
import numpy as np from time import gmtime, strftime, localtime import csv import os from os import path import shutil import pandas as pd from pandas.io.parsers import csv def prep_out_path(out_path): if path.exists(out_path): shutil.rmtree(out_path) os.makedirs(out_path) def append_to_arr(arr, a, ax...
from .. dynamic_array.array import Array class Stack: def __init__(self, cap=float('inf')): self.rep = Array() self.cap = cap self.top = 0 def __repr__(self): return repr(self.rep) def push(self, x): if self.top >= self.cap: raise TypeError('Overflow: ...
# single source of truth for package version, # see https://packaging.python.org/en/latest/single_source_version/ __version__ = "0.2.3" VERSION = __version__ # app name to send as part of SDK requests app_name = "funcX SDK v{}".format(__version__)
from .timing import timethis from . import graph from . import constants from . import enums_conv def looks_like_sql(s: str) -> bool: """ Determine if string `s` looks like an SQL query. :param str s: The string to detect. :return: True if the string looks like an SQL, False otherwise. "...
# MIT License # # Copyright (c) 2015-2019 Iakiv Kramarenko # # 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, modif...
"""The google_translate component."""
# Copyright 2015 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...
# cmu_112_graphics.py # version 0.9.0 # Pre-release for CMU 15-112-s21 # Require Python 3.6 or later import sys if (sys.version_info[0] != 3) or (sys.version_info[1] < 6): raise Exception("cmu_112_graphics.py requires Python version 3.6 or later.") # Track version and file update timestamp import datetime MAJO...
# 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 ...
#-*- coding: utf-8 -*- # https://github.com/Kodi-vStream/venom-xbmc-addons # jordigarnacho from resources.lib.gui.hoster import cHosterGui from resources.lib.gui.gui import cGui from resources.lib.handler.inputParameterHandler import cInputParameterHandler from resources.lib.handler.outputParameterHandler import cOutpu...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Aug 12 22:01:27 2021 @author: feynman """ import fiona import geopandas as gpd g_file = '/home/feynman/DCOP/TKC_Database_MW.gdb' layers = fiona.listlayers(g_file) for layer in layers: gdf = gpd.read_file(g_file, layer=layer)
# -*- coding: utf-8 -*- # --------------------------------------------------------------------- # UserContact model # --------------------------------------------------------------------- # Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------...
import os import shutil from . import TestReader from reader.models import Author, Work, Division, Verse from reader.contentsearch import WorkIndexer, search_verses, search_stats class TestWorkIndexer(WorkIndexer): @classmethod def get_index_dir(cls): return os.path.join("..", "var", "tests", "in...
from django.db import models from django.conf import settings class Edit(models.Model): # If multi-image adding is added, better to credit multiple Edit objs # and approve piecemeal image = models.ImageField(blank=True) # Store change as a JSON to simplify any changes to Noodle # Expected Fields: ...
import numpy as np import matplotlib.pyplot as plt from skimage.exposure import equalize_adapthist from util import hsv2rgb, rgb2hsv, histogram_equalization, CLAHE, correlate, \ black_tophat def threshold_strategy(I, r_b=85, r_t=145, g_b=0, g_t=0, b_b=75, b_t=130): img = black_tophat(I, 11) img = rgb2hs...
"""portfoliWebAPI URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Clas...
from setuptools import setup exec (open('pyldavis_dash/version.py').read()) setup( name='pyldavis_dash', version=__version__, author='antisrdy', packages=['pyldavis_dash'], include_package_data=True, license='MIT', description='pyLDAvis to Dash', install_requires=[] )
from datetime import datetime from airflow.models import DAG from airflow.providers.apache.spark.operators.spark_jdbc import SparkJDBCOperator from airflow.providers.apache.spark.operators.spark_sql import SparkSqlOperator from airflow.providers.apache.spark.operators.spark_submit import SparkSubmitOperator import os...
# Copyright 2015 PerfKitBenchmarker 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 appli...
import discord import random async def hello(introList,channel): embedVar = discord.Embed(title="Hey, My name is Shuttle.",description=random.choice(introList),color=0x00ffff) embedVar.set_thumbnail(url = 'attachment://shuttleLogo.png') await channel.send(embed= embedVar)
# import bot settings from setting import * # function to find the update using selenium def webScrape(): # the three lines below don't work at the moment, will be fixed; it is meant to open webdriver without opening the window options = Options() options.use_chromium = True options.add_argument("headl...
import torch.nn as nn cfg = { 'VGG11': [64, 'M', 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'], 'VGG13': [64, 64, 'M', 128, 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'], 'VGG16': [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512, 'M', 512, 512, 512, 'M'], 'VGG19': [64, ...
# Update this for the versions # Don't change the forth version number from None VERSION = (2, 4, 5, None)
from jsonobject import JsonObject, IntegerProperty, ObjectProperty, StringProperty class MessageToProcessor(JsonObject): operation_type = StringProperty(required=True) operation_subject = StringProperty(required=True) operation_owner = IntegerProperty(required=True) operation_pointer = StringProperty...
import moderngl import numpy as np ctx = moderngl.create_standalone_context() prog = ctx.program( vertex_shader=''' #version 330 in vec2 in_vert; in vec3 in_color; out vec3 v_color; void main() { v_color = in_color; gl_Position = vec4(in_vert, 0.0...
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the Creative Commons Attribution-NonCommercial # 4.0 International License. To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to # Creative Commons, PO Box 1866, Mountain ...
# ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # Copyright (c) 2008-2020 pyglet contributors # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the follo...
from connect.cli.plugins.shared.sync_stats import SynchronizerStats from connect.cli.plugins.product.sync.actions import ActionsSynchronizer from connect.client import ConnectClient def test_skipped(get_sync_actions_env): stats = SynchronizerStats() synchronizer = ActionsSynchronizer( client=ConnectCl...
version = "2020-03-03"
#!/usr/bin/env python # _*_ coding:utf-8 _*_ # # @Version : 1.0 # @Time : 2020/5/18 # @Author : 圈圈烃 # @File : jdSpider # @Description: # # import requests import csv import time from bs4 import BeautifulSoup def get_html(url): """获取页面""" headers = { "Host": "search.jd.com", "Use...
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe, unittest from werkzeug.wrappers import Response from frappe.app import process_response from frappe.tests import set_request HEADERS = ('Access-Control-Allow-Origi...
# -*- coding: UTF-8 -*- """ This module provides classes for the virtual processing of images. * `Image` reads, stores, writes and handles image data. * `ImageFile` gathers information about an image file: file name, data type, byte order. It is used to instruct the `Image.read()` and `Image.save()` routines. * `I...
#!/usr/bin/env python # Copyright 2013, Institute for Bioninformatics and Evolutionary Studies # # 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...
# -*- encoding: utf-8 -*- # Copyright (c) 2020 Modist Team <admin@modist.io> # ISC License <https://opensource.org/licenses/isc> """Contains unit-tests for the mod configuration.""" import re import string from random import Random from typing import List from urllib.parse import urlparse import pytest from hypothes...
import sys import time from bs4 import BeautifulSoup from selenium import webdriver from selenium.common.exceptions import NoSuchElementException, ElementNotInteractableException, ElementClickInterceptedException from selenium.webdriver.firefox.options import Options seleniumException = (NoSuchElementException, Elemen...
import pytest from django.urls import reverse from coruscant_django.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.stat...
import httplib, urllib, base64 headers = { # Request headers 'Content-Type': 'application/json', 'Ocp-Apim-Subscription-Key': '19c31dcea58348279c5d49d4b7973f41', } params = urllib.urlencode({ # Request parameters 'visualFeatures': 'Categories', # 'details': '{string}', 'language': 'en', })...
import json import bpy import os from bpy.types import Operator from . import utils from .assets.scripts.evertims import ( Evertims, evertUtils ) # to launch EVERTims raytracing client import subprocess # --------------------------------------------------------------- # import components necessary to report EVERTims ...
"""Basic message.""" from datetime import datetime from typing import Union from marshmallow import fields from ...agent_message import AgentMessage, AgentMessageSchema from ...util import datetime_now, datetime_to_str from ...valid import INDY_ISO8601_DATETIME from ..message_types import BASIC_MESSAGE HANDLER_CLA...
from adam import PropagationParams from adam import OpmParams from adam import RunnableManager from adam import TargetedPropagation from adam import TargetedPropagations from adam import TargetingParams class TestTargetedPropagationTest: def _new_targeted_propagation(self, initial_maneuver, working_project): ...
# -*- coding: utf-8 -*- import os import sys import random import math import numpy as np import skimage.io import matplotlib import matplotlib.pyplot as plt # Root directory of the project ROOT_DIR = os.path.abspath("../") # Import Mask RCNN sys.path.append(ROOT_DIR) # To find local version of the library from mr...
import openmdao.api as om from openaerostruct.aerodynamics.lift_drag import LiftDrag from openaerostruct.aerodynamics.coeffs import Coeffs from openaerostruct.aerodynamics.total_lift import TotalLift from openaerostruct.aerodynamics.total_drag import TotalDrag from openaerostruct.aerodynamics.viscous_drag import Viscou...
""" Copyright 2016 Markus Wissinger. 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 agreed...
#pylint: disable=R0913 """ Defines the sub-OP2 class. This should never be called outisde of the OP2 class. - OP2_Scalar(debug=False, log=None, debug_file=None) **Methods** - set_subcases(subcases=None) - set_transient_times(times) - read_op2(op2_filename=None, combine=False) - set_additional_general...
import warnings from .distance import PairwiseDistance from .module import Module from .. import functional as F from .. import _reduction as _Reduction from torch import Tensor from typing import Callable, Optional class _Loss(Module): reduction: str def __init__(self, size_average=None, reduce=None, redu...
import pytest import sys import os import time os.environ['SENTINEL_ENV'] = 'test' os.environ['SENTINEL_CONFIG'] = os.path.normpath(os.path.join(os.path.dirname(__file__), '../../test_sentinel.conf')) sys.path.append(os.path.normpath(os.path.join(os.path.dirname(__file__), '../../../lib'))) import misc import config fr...
message = "Hello World" print(type(message)) print(len(message)) # Length Function to Check the Length of the String # Indexing print(message) print(message[0]) print(message[0:len(message)]) print(message[::len(message)]) print(message[::-1]) # EveryThing is Object in Python and Object Has Methods associated to I...
#!/usr/bin/python # Converts a sequence of strings separated by white space into an OpenFST format # FSA. If the text contains multiple lines, they FSA is expanded such that each # line begins at the same start state and then independently follows a path to a # final state. import sys, string, re, codecs, argparse ...
# # Copyright (C) 2018 ETH Zurich and University of Bologna # # 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 applicabl...
#!/usr/bin/python import os import sys import boto3 # get an access token, local (from) directory, and S3 (to) directory # from the command-line local_directory, bucket, destination = sys.argv[1:4] client = boto3.client('s3') # enumerate local files recursively for root, dirs, files in os.walk(local_directory): ...
from typing import List from geniusweb.actions.PartyId import PartyId from geniusweb.actions.Votes import Votes from geniusweb.inform.Inform import Inform class OptIn (Inform): ''' Informs party that it's time to Opt-in. ''' def __init__(self, votes:List[Votes] ) : ''' @param votes a...
from unittest.mock import patch from django.core.management import call_command from django.db.utils import OperationalError from django.test import TestCase class CommandTests(TestCase): """Tests for database""" def test_wait_for_db_ready(self): """Test waiting for db when db is available""" ...
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2017-09-24 01:01 from django.db import migrations, models import django.db.models.deletion import jsonfield.fields class Migration(migrations.Migration): initial = True dependencies = [ ('true_coders', '0001_initial'), ] operations =...
import flask from flask import request from marshmallow import Schema, fields from main import segment_from_sentence from ner import NER from segmenter import Segmenter from utils_ctc.prediction_ctc import CTCModel from utils_ctc.config_ctc import parameters_ctc app = flask.Flask(__name__) app.config["DEBUG"] = True ...
from matplotlib import rcParams, rcdefaults #standardize mpl setup rcdefaults() from .histogram_client import HistogramClient from .image_client import ImageClient from .scatter_client import ScatterClient
from __future__ import print_function import argparse from datetime import datetime, timedelta import os import pytsk3 import pyewf import pymsiecf import sys import unicodecsv as csv from utility.pytskutil import TSKUtil """ MIT License Copyright (c) 2017 Chapin Bryce, Preston Miller Please share comments and quest...
word={0:'zero', 1:'one', 2:'two', 3:'three', 4:'four', 5:'five', 6:'six', 7:'seven', 8:'eight', 9:'nine', 10:'ten', 11:'eleven', 12:'twelve', 13:'thirteen', 14:'fourteen', 15:'fifteen', 16:'sixteen', 17:'seventeen', 18:'eighteen', 19:'nineteen', 20:'twenty', 30:'thirty', 40:'forty', 50:'fifty', 60:'sixty', 70:'seventy'...
# 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 ...
#- # Copyright (c) 2011 Robert N. M. Watson # Copyright (c) 2014 Robert M. Norton # All rights reserved. # # This software was developed by SRI International and the University of # Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 # ("CTSRD"), as part of the DARPA CRASH research programme. # # @...
from toil.common import Toil from toil.job import Job class HelloWorld(Job): def __init__(self, message): Job.__init__(self, memory="2G", cores=2, disk="3G") self.message = message def run(self, fileStore): return "Hello, world!, here's a message: %s" % self.message if __name__=="__...
import math from typing import Union, Sequence import torch def logmeanexp(x: Union[Sequence[torch.Tensor], torch.Tensor], keepdim=False, dim=0): if isinstance(x, (tuple, list)): elem0 = x[0] if elem0.dim() == 0: x = torch.stack(x) elif elem0.dim() == 1: x = torch....
import sys import PyYAML from pprint import pprint def read_yaml(filename): with open(filename) as f: return yaml.safe_load(f) if __name__ == "__main__": try: filename = sys.argv[1] except IndexError: filename = input("Enter YAML file name: ") pprint(read_yaml(filename))
#MIT License #Copyright (c) 2021 SUBIN #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, distr...
""" Django settings for config project. Generated by 'django-admin startproject' using Django 2.2.5. For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.2/ref/settings/ """ import os fro...
from functools import update_wrapper from typing import Any, Callable, Dict, List, Optional, Sequence, Set, Union from dagster import check from ....seven.typing import get_origin from ....utils.backcompat import experimental_decorator from ...errors import DagsterInvariantViolationError from ..inference import Infer...
# # Copyright (c) 2017 Amit Green. All rights reserved. #
from test_plus.test import TestCase from ...generic.tests.test_views import ( AuthorshipViewSetMixin, GenericViewSetMixin, OrderingViewSetMixin, ReadOnlyViewSetMixin, RelatedM2MMixin, ) from ...search.tests.mixins import SearchQueryMixin from ...tags.factories import TagFactory from ...users.factor...
#!/usr/bin/env python3 import argparse import os parser = argparse.ArgumentParser( description='This programme is for preparation of modified yesno.') parser.add_argument('-d', '--dir', help='the path to the dataset.', type=str) args = parser.parse_args() if __name__ == '__main__': dir = args.dir for s...
# Copyright (C) 2019 Bloomberg LP # # 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...
import torch import torch.nn as nn import torch.nn.functional as F from src.EncoderBlockLayer import EncoderBlockLayer from src.PositionalEncodingLayer import PositionalEncodingLayer class EncoderLayer(nn.Module): def __init__(self, vocab_size, max_len, d_model, n_heads, hidden_size, kernel_size, dropout, n_layer...
from flask import Flask, session, jsonify, request import pandas as pd import numpy as np import pickle import os from sklearn import metrics from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression import json #################Load config.json and get path variables wit...
from ctypes import cast, POINTER from comtypes import CLSCTX_ALL from pycaw.pycaw import AudioUtilities, IAudioEndpointVolume import time def main(): # Thanks to WoolDoughnut310 for the values: https://github.com/AndreMiras/pycaw/issues/13#issuecomment453862389 volumes = [64, 56.9, 51.6, 47.7, 44.6, 42, 39.8, 37.8, ...
import gym.spaces as gspaces from edge.envs.environments import Environment from edge.space import StateActionSpace from . import BoxWrapper, DiscreteWrapper class DummyDynamics: def __init__(self, stateaction_space): self.stateaction_space = stateaction_space @property def state_space(self): ...
# Lint as: python3 # Copyright 2018 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 ...
from unittest import TestCase from mock import Mock, patch, create_autospec, MagicMock from pyqryptonight.pyqryptonight import StringToUInt256 from qrl.core.Block import Block from qrl.core.misc import logger from qrl.core.ChainManager import ChainManager from qrl.core.Miner import Miner from qrl.core.TransactionPool...
# Copyright 2012-2017 The Meson development team # 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 agree...
# -*- coding: utf-8 -*- """ Preliminary implementation of batch normalization for Lasagne. Does not include a way to properly compute the normalization factors over the full training set for testing, but can be used as a drop-in for training and validation. Author: Jan Schlüter """ import theano import theano.tensor ...
# -*- coding: utf-8 -*- """ File Name: copyRandomList Author : jing Date: 2020/4/13 复杂链表的复制 https://leetcode-cn.com/problems/copy-list-with-random-pointer/ """ # Definition for a Node. class Node: def __init__(self, x: int, next: 'Node' = None, random: 'Node' = None): ...