text
stringlengths
2
999k
from ctypes import * import random import os import requests import time import urllib import cv2 from skimage import draw import numpy as np import json import datetime import paho.mqtt.client as paho import yaml import pytz import re import subprocess import select with open("/config/detect.conf"...
import datetime import logging import unittest from paho.mqtt.client import MQTTMessage from tzlocal import get_localzone from src.device.base import device from src.device.base.device import Device from test.mock_mqtt_publisher import MockMqttPublisher _logger = logging.getLogger(__name__) _dummy_logger = _logger ...
""" This whole module and approach is a hack. It's not well documented because it's not official. But the horse is out of the barn on this stuff and we have to do something. """ import base64, hashlib, random, re, string, ssl from urllib.parse import urlencode, urlparse, parse_qs import aiohttp from . import loggin...
class HandshakeParams(object): def __init__(self): self.key: str = "" def set_key(self, key: str): self.key = f"-----BEGIN PUBLIC KEY-----\n{key}\n-----END PUBLIC KEY-----\n" def get_key(self) -> str: return self.key
from django.contrib import admin from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.contrib.admin.sites import AdminSite from users.models import Profile from django.contrib.auth.models import User # Register your models here. @admin.register(Profile) class ProfileAdmin(admin.ModelAdmin): ...
from django.urls import path from .views import AllOpenReviewsApiView, MyDecisionsApiView, \ MyOpenDecisionsApiView, OpenDecisionsApiView, \ OpenSupervisorDecisionApiView, ToConcludeReviewApiView, AllReviewsApiView app_name = 'api' urlpatterns = [ path('<str:committee>/decisions/', MyDecisionsAp...
#! /usr/bin/env python3 import rospy import struct import time from matplotlib import cm import numpy as np from acoustic_msgs.msg import SonarImage from sensor_msgs.msg import PointCloud2, PointField from std_msgs.msg import Header from sensor_msgs import point_cloud2 class SonarTranslator(object): def __ini...
from __future__ import absolute_import #绝对路径导入 from celery import Celery from django.conf import settings import os #设置系统的环境配置用的是Django的 os.environ.setdefault('DJANGO_SETTING_MODULE','MxOnline.settings') #实例化celery app = Celery('mycelery') #设置时区 app.conf.CELERY_TIMEZONE = 'Asia/Shanghai' #指定celery的配置来源 用的是项目的配置文件sett...
from django.conf.urls import url from . import views app_name = 'profiles' urlpatterns = [ url( r'^$', views.profile, name='profile' ), # Login mechanism url( r'^login/$', views.login_user, name='login' ), # Logout mechanism url( r...
# -*- coding: utf-8 -*- import json class ApigwEvent(object): def __init__(self, method=None, path=None, body=None, headers=None, req_context=None, queries_dict=None, path_paras=None): i...
# MIT License # # Copyright (C) IBM Corporation 2018 # # 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...
"""Error classes for PostgreSQL error codes """ # psycopg/errors.py - SQLSTATE and DB-API exceptions # # Copyright (C) 2018-2019 Daniele Varrazzo <daniele.varrazzo@gmail.com> # # psycopg2 is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published...
from django import forms from dal import autocomplete from api import models as api_models from contest import models class ContestForm(forms.ModelForm): suggested_by_username = forms.CharField(required=False) image_by_username = forms.CharField(required=False) result_image_by_username = forms.CharField(re...
# -*- coding: utf-8 -*- from typing import Union, List, Dict, Text, Any from mock import patch from zerver.lib.actions import get_realm, try_add_realm_custom_profile_field, \ do_update_user_custom_profile_data, do_remove_realm_custom_profile_field from zerver.lib.test_classes import ZulipTestCase from zerver.mode...
# Interfas Grafica VII # Interfas Calculadora # Llamadas a funciones # Funciones lambda o anonimas from tkinter import * raiz = Tk() miFrame=Frame(raiz) miFrame.pack() #Entry #------------------------------Pantalla--------------------------------- numeroPantalla=StringVar() pantalla=Entry(miFrame, textvariable=n...
from django.contrib import admin from .models import LostItem # Register your models here. admin.site.register(LostItem)
# -*- coding: utf-8 -*- import urllib import urlparse from django.conf import settings from django.utils.http import urlquote from django.utils.translation import ugettext, ugettext_lazy as _ import requests from django_statsd.clients import statsd import olympia.core.logger from olympia import amo from olympia.amo....
#!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2005-2018 (ita) """ Tasks represent atomic operations such as processes. """ import os, re, sys, tempfile, traceback from waflib import Utils, Logs, Errors # task states NOT_RUN = 0 """The task was not executed yet""" MISSING = 1 """The task has been executed b...
#https://www.hackerrank.com/domains/python?badge_type=python&filters%5Bstatus%5D%5B%5D=unsolved&filters%5Bdifficulty%5D%5B%5D=medium #Day 007 """each probelm link and its solution are given""" #https://www.hackerrank.com/challenges/the-minion-game/problem def minion_game(s): c,v=0,0 le=len(s) for ...
# coding: utf-8 """ Python SDK for Opsgenie REST API Python SDK for Opsgenie REST API # noqa: E501 The version of the OpenAPI document: 2.0.0 Contact: support@opsgenie.com Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six class ListSavedSearch...
from cog.core import Table, Record from cog.core import Table from cog import config import logging import os import shutil from logging.config import dictConfig import string import random import timeit import unittest import matplotlib.pyplot as plt import subprocess from pathlib import Path #!!! clean namespace bef...
from django.db import models from django.contrib.auth.models import AbstractUser from db.base_model import BaseModel # Create your models here. class User(AbstractUser, BaseModel): '''用户模型类''' class Meta: db_table = 'df_user' verbose_name = '用户' verbose_name_plural = verbose_name cl...
from django.conf.urls import url from . import views urlpatterns = [ # url(r'^', views.IndexView.as_view()), ]
# Create your views here. from django.http import HttpResponse from django.shortcuts import render_to_response def hello(request): # return render_to_response('mysite/index.html', {}) return HttpResponse('<h1>Hello world!</h1>')
import pyaf.Bench.TS_datasets as tsds import tests.artificial.process_artificial_dataset as art art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 0, transform = "Fisher", sigma = 0.0, exog_count = 20, ar_order = 0);
# -*- coding: utf-8 -* '''! @file set_ODR_OSR_IIR.py @brief Advanced data processing settings, configure more advanced data sampling and processing modes that meet your needs more @n Configure measurement mode: sleep mode, enforcement mode, normal mode @n Configure pressure and temperature over-sampling mod...
#!/usr/bin/python3 import json from formula.notebook_template import Estimator, render_template def Run(datapoints_amount, category, labeled_data): if datapoints_amount == "<50": print("You should get more data!") return if category == "false": algorithm = "regression" elif label...
from seleniumpagefactory.Pagefactory import PageFactory import time class CasualDress(PageFactory): def __init__(self,driver,logger): self.driver = driver self.logger = logger locators = { "chkMedium": ('ID',"uniform-layered_id_attribute_group_2"), "chkSmall": ('ID'...
#!/usr/bin/env python3 import glob import os import os.path import argparse import re import subprocess import shutil import sys from datetime import datetime # get the of location of script ampfuzz_bin = os.path.dirname(os.path.realpath(__file__)) cc_bin = os.path.join(ampfuzz_bin, 'pre_clang') cxx_bin = os.path.join...
# 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 # d...
from .instance import * import redis import json from ip2geotools.databases.noncommercial import DbIpCity def create_html_result(json_file): html = '<ul>' for i in json_file['country_list']: html += '<li>' + i + '</li>' html += '</ul>' return html def flush_redis(): r = redis.from_url(...
import datetime from django.db import models from relativedeltafield import RelativeDeltaField class Interval(models.Model): value = RelativeDeltaField(null=True, blank=True) date = models.DateField(default=datetime.date(2020, 10, 21))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ cfc_app/test_get_datasets.py -- Characterization of behaviour on get_datasets custom command Written by Robert Bruce, 2022 Licensed under Apache 2.0, see LICENSE for details """ # System imports import datetime import os # Django and other third-party imports from ...
# 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 applicab...
"""Generated message classes for vision version v1. Integrates Google Vision features, including image labeling, face, logo, and landmark detection, optical character recognition (OCR), and detection of explicit content, into applications. """ # NOTE: This file is autogenerated and should not be edited by hand. from ...
#!/usr/bin/env python3 import asyncio import websockets import time async def get_x3d(): uri = "ws://localhost:1234/" async with websockets.connect(uri) as websocket: await websocket.send("x3d;broadcast") while True: x3d_line = await websocket.recv() print(x3d_line) if __name__ == "__main__": ...
# Copyright (c) 2020 AllSeeingEyeTolledEweSew # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERC...
""" Plotting Colormaps ====================== Show all colormaps in kkpy """ import kkpy import matplotlib as mpl import matplotlib.pyplot as plt import inspect # Get all available cmaps def available_functions(module): func_list_with_underscore = [x.__name__ for x in module.__dict__.values() if inspect.isfuncti...
# Copyright 2018 The TensorFlow Probability 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 o...
from scipy.misc import imread from random import shuffle import time import tensorflow as tf from glob import glob from utils import get_image, colorize # this is based on tensorflow tutorial code # https://github.com/tensorflow/tensorflow/blob/r0.8/tensorflow/examples/how_tos/reading_data/convert_to_records.py # TODO...
# -*- 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 #...
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
# -*- coding: utf-8 -*- # Copyright 2014, Digital Reasoning # # 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...
''' Create a bed file for the exome ''' from pavooc.config import EXON_BED_FILE from pavooc.data import gencode_exons def main(): """ https://www.ensembl.org/info/website/upload/bed.html https://genome.ucsc.edu/goldenpath/help/customTrack.html """ with open(EXON_BED_FILE, 'w') as f: for ge...
from electrum_vtc.i18n import _ from electrum_vtc.plugins import run_hook from PyQt4.QtGui import * from PyQt4.QtCore import * from util import ButtonsTextEdit, MessageBoxMixin class ShowQRTextEdit(ButtonsTextEdit): def __init__(self, text=None): ButtonsTextEdit.__init__(self, text) self.setRead...
#! /usr/bin/env python3 def hypothesis_linear(theta0=None, theta1=None, x=None): return theta0 + x*theta1 def cost_function(X=None, Y=None, theta=None): # print("Cost Function X={} Y={} theta={}".format( # X, Y, theta)) m = len(Y) sum_diff_squared = 0 cost = 0 diff = 0 diff_squar...
""" TODO: This needs to be fleshed out as a Sentry service """ import zmq import json CONTEXT = zmq.Context() socket = CONTEXT.socket(zmq.SUB) socket.bind("tcp://127.0.0.1:5000") socket.setsockopt(zmq.SUBSCRIBE, '') while True: data = socket.recv() jdata = json.loads(data) print jdata
#!/usr/bin/env python3 """Plugin to be used to test miscellaneous notifications. Only used for 'channel_opened' for now. """ from pyln.client import Plugin plugin = Plugin() @plugin.init() def init(plugin, options, configuration): plugin.log("misc_notifications initialized") @plugin.subscribe("channel_opened...
from django.http import HttpResponse from django.shortcuts import render from .models import Script, Script_command, Queue, QParam import json from django.core import serializers import datetime import os import uuid import html import time from cmd_runner.tasks import run_script_task import urllib from django.shortcut...
class Error(Exception): def __init__(self): self.error = "Unknown Error" def __str__(self): return self.error class PermissionsError(Error): def __init__(self): self.error = "You do not have permission to do this action" class BadRequestError(Error): def __init__(self): self.error = "Your query was in...
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2015-Present Datadog, Inc import pytest TEST_ACCOUNT_ID = "123456789101" TEST_ROLE_NAME = "DatadogApiTestRole" ...
# MySQL Connector/Python - MySQL driver written in Python. # Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. # MySQL Connector/Python is licensed under the terms of the GPLv2 # <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most # MySQL Connectors. There are special exceptio...
# -*- coding: utf-8 -*- import allure from model.group import Group def test_add_group(app, db, json_groups, check_ui): group_data = json_groups with allure.step('Given a group list'): old_groups = db.get_group_list() with allure.step('When I add a group {} to the list'.format(group_data.name)): ...
# Copyright 2017-2019 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" fil...
# Ex1042 Sort Simples 10/04/2020 valor1, valor2, valor3 = map(int, input().split()) entrada1 = valor1 entrada2 = valor2 entrada3 = valor3 lista = [] lista.append(valor1) lista.append(valor2) lista.append(valor3) lista.sort() valor1 = lista[0] valor2 = lista[1] valor3 = lista[2] print('{}\n{}\n{}'.format(valor1, valor2,...
import enum # Using enum class create enumerations class Gran(enum.Enum): Yearly = 1 Monthly = 2 Weekly = 3 Daily = 4 Hourly = 5 Minutely = 6 Secondly = 7 Custom = 8
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Utils to create scripts and command-line tools""" import codecs import os.path from base64 import urlsafe_b64encode from pathlib import Path from uuid import uuid4 import yaml __all__ = ["read_yaml", "write_yaml", "make_path", "recursive_merge_dicts"] ...
# 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 # d...
from django import test from django.contrib.auth import get_user_model from django.conf import settings from django.utils import timezone from dateutil.parser import parse from model_mommy import mommy from .importer_testcase_mixin import ImporterTestCaseMixin from devilry.devilry_import_v2database.modelimporters.use...
from functools import wraps from .exceptions import EntityDoesNotExist, EntityExists, KnownError class Feedback: def __call__(self, message=None): self.update_message(message) return self def __enter__(self): return self def __exit__(self, exc_type, exc_value, exc_traceback): ...
import contextlib import time import signal import struct import serial class _mBot: def __init__(self, port, timeout=10): self._ser = serial.Serial(port,baudrate=115200,timeout=timeout) def close(self): self._ser.close() def _sendFrame(self, data): self._ser.write(data) def...
#!/usr/bin/env python3 # # Copyright 2016 Sarah Sharp <sharp@otter.technology> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later ...
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # https://doc.scrapy.org/en/latest/topics/items.html import scrapy class LoldeskItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() name = scrapy.Field() ImgUrl = scr...
from . import * class AWS_CertificateManager_Certificate_DomainValidationOption(CloudFormationProperty): def write(self, w): with w.block("domain_validation_option"): self.property(w, "DomainName", "domain_name", StringValueConverter()) self.property(w, "HostedZoneId", "hosted_zone_id", StringValueCo...
from santa.intcode import IntCode ### input ### with open('input/day2.txt') as f: code = [int(x) for x in f.readline().strip().split(",")] ### solver ### def solve_a(): ic = IntCode(code) ic[1:3] = 12, 2 ic.run() print(ic.dump()) return ic[0] def solve_b(): for noun in range(0, 100): ...
import _plotly_utils.basevalidators class ZmidValidator(_plotly_utils.basevalidators.NumberValidator): def __init__(self, plotly_name="zmid", parent_name="densitymapbox", **kwargs): super(ZmidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, e...
import py from rpython.jit.codewriter import heaptracker from rpython.jit.codewriter.policy import StopAtXPolicy from rpython.jit.metainterp.optimizeopt.test.test_util import LLtypeMixin from rpython.jit.metainterp.test.support import LLJitMixin from rpython.jit.metainterp.warmspot import get_translator, get_stats fro...
# # LeetCode # # Problem - 1470 # URL - https://leetcode.com/problems/shuffle-the-array/ # class Solution: def shuffle(self, nums: List[int], n: int) -> List[int]: ans = [] for i in range(0, n): ans.append(nums[i]) ans.append(nums[i+n]) return ans
# -*- coding: utf-8 -*- from mock import Mock try: import unittest2 as unittest except ImportError: import unittest import os from shiva.app import app from shiva.indexer.main import Indexer class IndexerTestCase(unittest.TestCase): def setUp(self): self.config = { 'MEDIA_DIRS': [], ...
#!/usr/bin/env python3 # Software License Agreement (BSD License) # # Copyright (c) 2019, UFACTORY, Inc. # All rights reserved. # # Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com> """ Description: Move Joint """ import os import sys import time import math sys.path.append(os.path.join(os.path.dirname(...
import numpy as np from .subepisoded_reference_generator import SubepisodedReferenceGenerator class WienerProcessReferenceGenerator(SubepisodedReferenceGenerator): """Reference Generator that generates a reference for one state by a Wiener Process with the changing parameter sigma and mean = 0. "...
# coding=utf-8 # *** WARNING: this file was generated by test. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from . import _utilities from ._inputs import * _...
import sys import os import cPickle """ This file provides an interface to a pre-trained politeness SVM. """ ##### # Ensure the proper python dependencies exist try: import numpy as np except: sys.stderr.write("Package not found: Politeness model requires python package numpy\n") sys.exit(2) try: ...
from flask import Flask, render_template, request, make_response import os import random import boto3 import configparser config = configparser.ConfigParser() config.read('config.ini') IAMAccessKey = config['DEFAULT']["IAMAccessKey"] IAMSecretKey = config['DEFAULT']["IAMSecretKey"] s3_region = config['DEFAULT']["s3_r...
import logging import requests from unittest.mock import patch import pytest from common import urls logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s: %(message)s', level=logging.DEBUG) # This avoids needing the internet for testing. urls.tldextract.extract = urls.tldextract.TLDExtract(s...
from selenium import webdriver from selenium.webdriver.common.by import By from utilities.handy_wrappers import HandyWrappers import time class UsingWrappers1(): def test(self): baseUrl = "https://letskodeit.teachable.com/pages/practice" driver = webdriver.Firefox() driver.maximize_window...
''' Generic Database Management functions to perform Database Operation ''' import sys import psycopg2 import datetime from .common_utility_tool import CommonUtility from .log import Logger class DatabaseManagement(object): def __init__(self, path=None, filename=None, logger_obj=None): log_obj = Logger(...
import hashlib import json import logging import urllib from collections import OrderedDict from urllib.parse import parse_qs import requests from django import forms from django.core import signing from django.http import HttpRequest from django.template.loader import get_template from django.utils.translation import...
import argparse import logging from typing import Tuple from deepdiff import DeepDiff import requests from requests.adapters import HTTPAdapter from urllib3.util import Retry from urllib.parse import quote import pprint from concurrent.futures import ThreadPoolExecutor import os import random import math def diff_res...
# python 3.3.2 üstü çalışılır # by Daxtill # Discord: Daxtill•EAUS#6318 # Mail : daxtill@protonmail.com # İllegal kullanımlarından ben sorumlu değilim. from queue import Queue from optparse import OptionParser import time,sys,socket,threading,logging,urllib.request,random import argparse import os import tools.addon...
import hashlib import unittest from binascii import hexlify from unittest import TestCase from ..common.mock_resources import MockDispatcherCallbacks from cryptography.hazmat.backends import default_backend # type: ignore from cryptography.hazmat.primitives import hashes # type: ignore from cryptography.hazmat.primi...
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
# -*- coding: utf-8 -*- import binascii import re def print_data(data): hexstring = binascii.hexlify(data) n = 80 split_string = "\n".join([hexstring[i:i+n] for i in range(0, len(hexstring), n)]) print split_string def round_up(x, k): return ((x + k - 1) & -k) def print_structure(container, s...
#!/usr/bin/env python3 # -*- coding:utf-8 -*- ''' # Created Date: Friday, May 14th 2021, 11:39:18 am # Author: Lc-Liu # Contact: liu.lc.ch@gmail.com # ----- # Copyright (c) 2021 Lc-Liu # Apache License 2.0 # ------------------------------------------------------------------- ''' from multiprocessing import Process i...
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import unittest import tempfile from karesansui.lib.file.k2v import * class TestK2V(unittest.TestCase): _w = {'key.1':'h oge', 'key.2':'fo o', 'key.3':'bar ', 'key.4':' piyo', 'key.5':'s p am'} def setUp(...
""" To ensure compatibility from Python ``2.6`` - ``3.3``, a module has been created. Clearly there is huge need to use conforming syntax. But many changes (e.g. ``property``, ``hasattr`` in ``2.5``) can be rewritten in pure python. """ import sys import imp import os try: import importlib except ImportError: p...
#!/usr/bin/env python3 # Copyright (c) 2014-2020 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test RPCs related to blockchainstate. Test the following RPCs: - getblockchaininfo - gettxouts...
from __future__ import annotations from typing import TYPE_CHECKING, List, Optional from typing_extensions import Literal, NotRequired, TypedDict, final if TYPE_CHECKING: from .application import ApplicationData from .channel import PartialChannelData from .guild import GuildData, GuildMemberData fro...
################################################################################ # Copyright (C) 2016-2019 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # ...
""" This module defines activation functions which provide nonlinearities for neural networks. """ from __future__ import division, print_function import sys from ..util import netlog log = netlog.setup_logging("nnets_activations", level="INFO") from theano import tensor as T if sys.version_info.major == 2: s...
# @Title: 二叉树中的最大路径和 (Binary Tree Maximum Path Sum) # @Author: 18015528893 # @Date: 2021-02-14 11:38:20 # @Runtime: 112 ms # @Memory: 22.3 MB # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # sel...
from dataclasses import dataclass import struct from src.packet_type import PacketType from typing import Optional @dataclass class Packet: packet_length: int packet_type: PacketType data: bytes def __init__(self, packet_type: PacketType, data: str): self.packet_type = packet_type sel...
#! /usr/bin/env python """ Shakespeare -- An interpreter for the Shakespeare Programming Language """ from .shakespeare_parser import shakespeareParser import argparse import math class Shakespeare: """ Interpreter for the Shakespeare Programming Language. Methods: run_play -- Run an SPL play p...
# Copyright 1999-2021 Alibaba Group Holding Ltd. # # 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...
q1 = input('Escreva qualquer coisa: ') print(type(q1)) print('Foi uma letra digitada: ', q1.isalpha()) print('Foi um numero digitado: ', q1.isnumeric()) print('A palavra é alfanumerica: ', q1.isalnum()) print('A palavra esta escreia em MAIUSCULO: ', q1.isupper())
# coing: utf-8 import re import requests import urllib.parse from bs4 import BeautifulSoup import threading import queue import os import time import pybloom count = sum([len(x) for _, _, x in os.walk(os.path.dirname("../dsimage/file/"))]) # index of file MAX_SIZE = 10000 # stop when the count reaches ...
import re, sys VM_HEADER = r''' #include <fcntl.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> #include <cassert> #include <cerrno> #include <cmath> #include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctgmath> #ifdef DEBUG #define SAY fprint...
# Copyright (c) 2021 PaddlePaddle 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...
# 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 ...
# # 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 us...