text
stringlengths
2
999k
from django.conf.urls import url from . import views app_name = 'posts' urlpatterns = [ url(r'^create/', views.create, name='create'), # Up voting url(r'^(?P<pk>[0-9]+)/upvote', views.upvote, name='upvote'), url(r'^(?P<pk>[0-9]+)/downvote', views.downvote, name='downvote'), url(r'^user/(?P<uid>[0-...
from typing import Dict, Any from ctypes import cdll, c_int, c_char, \ Array, c_char_p, c_void_p, create_string_buffer, byref from threading import currentThread import os import platform #Import the RandomX library. #pylint: disable=invalid-name RandomXLib: Any if os.name == "nt": RandomXLib = cdll.Load...
import numpy as np import random from multiagent.core_vec import World, Agent, Landmark from multiagent.scenario import BaseScenario class Scenario(BaseScenario): def make_world(self, sort_obs=True): world = World() self.np_rnd = np.random.RandomState(0) self.sort_obs = sort_obs # ...
"""my_gettext.py The usual pattern when using gettext is to surround strings to be translated by a call to a function named _, as in _("This string should be translated.") This is done when having gettext "install" a given language: it adds a function named _ to the global builtins. However, this can fail if som...
import sys if sys.version.startswith("2.7"): from MakeDirectory import pymkdir from WriteMetadata import writemetadata from GitMetadata import gitmetadata from MapMaker import mapmaker from MapClass import mapclass from replacehex import ReplaceHexColor elif sys.version.startswith("3."): ...
# EXERCICIO 074 - from random import randint num = (randint(1,10),randint(1,10),randint(1,10),randint(1,10),randint(1,10)) print('Os valores sorteados foram:', end= ' ') for n in num: print(f'{n}', end = ' ') print(f'\n O maior número sorteado foi {max(num)} e o menor {min(num)}')
import os import numpy as np import tensorflow as tf from scipy.io import wavfile import seaborn as sns import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator from sklearn.metrics import accuracy_score, recall_score, matthews_corrcoef from sklearn.metrics import precision_score, f1_score, confusion_m...
__pyarmor__(__name__, __file__, b'\x50\x59\x41\x52\x4d\x4f\x52\x00\x00\x03\x07\x00\x42\x0d\x0d\x0a\x06\x28\xa0\x01\x00\x00\x00\x00\x01\x00\x00\x00\x40\x00\x00\x00\xc2\x07\x00\x00\x00\x00\x00\x10\x90\x5a\x90\x5b\xc7\xc8\xbc\xf1\x76\x49\x51\x28\x0b\x57\xc1\x62\x00\x00\x00\x00\x00\x00\x00\x00\xda\xb1\xa7\x24\x3d\xd6\xc1\x...
# -*- 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
from django import forms from django.contrib.auth import get_user_model class SignupForm(forms.ModelForm): class Meta: model = get_user_model() fields = ["display_name", "profile"] def signup(self, request, user): user.display_name = self.cleaned_data["display_name"] user.prof...
from Include.Canvas import * from Include.Matrix import * @dataclass class Projectile: position: Tuple velocity: Tuple @dataclass class Environment: gravity: Tuple wind: Tuple def tick(env: Environment, proj: Projectile): position = proj.position + proj.velocity velocity = proj.velocity + en...
# Copyright (c) 2004-2015 Odoo S.A. # Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr> # License MIT (https://opensource.org/licenses/MIT). from odoo import api, fields, models class BaseConfigSettings(models.TransientModel): _inherit = "res.config.settings" group_atten...
from typing import List from .spacing import full_cosine_spacing, equal_spacing from .spacing import linear_bias_left from math import atan, sqrt, pi, sin, cos from matplotlib.pyplot import figure class NACA4(object): code: str = None cnum: int = None cspc: str = None teclosed: bool = None _mt: flo...
import os import os.path import errno ################################################################ def create_dir(path): try: os.makedirs(path) except OSError as e: if e.errno != errno.EEXIST: raise #######################################################...
# -*- coding: utf-8 -*- # Copyright 2020 Google 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 ...
#!/usr/bin/env python """Example code of DQN and DoubleDQN on OpenAI Gym environments. For DQN, see: http://www.nature.com/articles/nature14236 For DoubleDQN, see: https://arxiv.org/abs/1509.06461 """ from __future__ import print_function from __future__ import division import argparse import collections import copy i...
import os import argparse parser = argparse.ArgumentParser() parser.add_argument('--save-dir', type = str, default = './trained_models/RobotLocomotion-v0/design-3/') args = parser.parse_args() cmd = 'python train/train.py --rule-sequence 0, 14, 6, 18, 4, 2, 18, 4, 18, 16, 11, 4, 20, 10, 4, 17, 5, 9, 10, 10, 11, 5, 1...
import os __DIR__ = os.path.dirname(__file__) if os.getenv('COFFEEBOT_DATABASE_URI'): DATABASE_URI = os.getenv('COFFEEBOT_DATABASE_URI') else: DATABASE_URI = 'sqlite:////' + __DIR__ + '/../' + \ os.getenv('COFFEEBOT_DATABASE_FILENAME') DEBUG = int(os.getenv('COFFEEBOT_DEBUG', 0)) URL = os.getenv('C...
# Other imports. from simple_rl.agents.AgentClass import Agent from simple_rl.pomdp.BeliefStateClass import BeliefState class BeliefAgent(Agent): def __init__(self, name, actions, gamma=0.99): ''' Args: name (str) actions (list) gamma (float ''' A...
import json from grakn.client import GraknClient def build_graph(keyspace_name): # Builds a Grakn graph within the specified keyspace with GraknClient(uri="localhost:48555") as client: with client.session(keyspace=keyspace_name) as session: load_location_into_grakn(session) loa...
# Copyright 2015 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'conditions': [ ['test_isolation_mode != "noop"', { 'targets': [ { 'target_name': 'bot_default_run', 'type': 'non...
import numpy as np from dynamic_graph.sot.core.filter_differentiator import FilterDifferentiator def create_chebi1_checby2_series_filter(name, dt, size): # b1,a1=cheby2(2, 20,0.05); # b2,a2 = cheby1(4,0.05,0.08); # (b,a) = filter_series(b1,a1,b2,a2); lp_filter = FilterDifferentiator(name) lp_filt...
# -*- coding: utf-8 -*- """ Auto imports all crawlers from the current package directory. To be recognized, your crawler file should meet following conditions: - file does not starts with an underscore - file ends with .py extension - file contains a class that extends `src.utils.crawler.Crawler` - the ...
import re from common.constants import EXCHANGES, STOCK_CODE_ENDINGS def is_year(s): return re.search(r'[12][09][0-9]{2}', s) != None def is_date(s): return re.search(r'[0-9]{8}', s) != None def is_stock_code(s): return re.search(r'[0-9]{6}\.(SH|SZ)', s) != None def is_negative_number(s): return re....
from scrapy.spiderloader import SpiderLoader as BaseSpiderLoader class SpiderLoader( BaseSpiderLoader ): def _load_all_spiders( self ): from scrapy_compose.fields.compose.spider import SpiderCompose spiders = self._spiders for name in self.spider_modules: pkg_name = name.split( ".", 1 )[ 0 ] for s_na...
# Generated by Django 4.0 on 2021-12-29 16:32 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('shop_management', '0008_alter_product_options_alter_productcategory_options_and_more'), ] operations = [ migr...
print("Hello World") print("Trying to Connect")
""" Broker """ import logging from typing import Optional from alsek._defaults import DEFAULT_TASK_TTL from alsek._utils.logging import magic_logger from alsek._utils.printing import auto_repr from alsek.core.concurrency import Lock from alsek.core.message import Message from alsek.exceptions import MessageAlrea...
#!/usr/bin/env python import sys, os # Testing plan: # - Don't mess with Rhino. # - Define a delta operator for print, that displays the string in Scheme. # - Compare stdout from Rhino to stdout from Redex. If they are equal, win. # # Possible failures: # - Desugaring doesn't work. # - Redex does not reduce...
from __future__ import unicode_literals from django.utils.six.moves import filterfalse from django.utils.translation import activate from django.http import QueryDict from django.contrib.admin.views.main import IGNORED_PARAMS from mtr.utils.manager import BaseManager from .helpers import make_model_class, process_at...
import discord from discord import colour from discord.ext import commands import time import random import sqlite3 import discordSuperUtils import requests import traceback import asyncio import datetime import time import aiosqlite from PycordPaginator import Paginator from discord_components import But...
from jlr.utils import by_chunks, prior_current_next def test_by_chunks(): assert list(by_chunks([], 3)) == [], list(by_chunks([], 3)) assert list(by_chunks([1,2,], 3)) == [[1,2]] assert list(by_chunks([1,2,3,], 3)) == [[1,2,3]] assert list(by_chunks([1,2,3,4], 3)) == [[1,2,3], [4]] assert li...
import discord from discord.ext import commands class Lock_Unlock(commands.Cog): def __init__(self, client): self.client = client @commands.command(name="lockchannel", aliases=["lock"]) @commands.has_guild_permissions(manage_channels=True) async def lockchannel(self, ctx, channel: discord.Tex...
from conans import ConanFile, CMake class TargetConan(ConanFile): name = "macos_app" version = "1.0.0" settings = "os", "compiler", "build_type", "arch" options = {"shared": [True, False], "fPIC": [True, False]} default_options = { "shared": False, "fPIC": True, "sqlite3:th...
from minibatch.contrib.kafka import KafkaSink, KafkaSource def producer(url): sink = KafkaSink('test', urls=url) sink.put(dict(foo='bar')) def consumer(url): source = KafkaSource('test-result', urls=url) for data in source.consumer: print(data)
from enum import Enum class Constants(str, Enum): UserAgent = 'RoboDCA'
# -*- coding: utf-8 -*- from __future__ import unicode_literals from ..xml.generated import applikasjonskvittering class BrregApplicationReceipt(object): """ brreg:Applikasjonskvittering """ def __init__(self, xml): element = applikasjonskvittering.CreateFromDocument(xml) self.status...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AnttechBlockchainDefinAssetmanagePenetrateQueryModel(object): def __init__(self): self._biz_params = None self._function = None self._request_id = None @property ...
from . import cli, models, judges, utils __all__ = ['cli', 'judges', 'models', 'utils', 'config']
# -*- coding: utf-8 -*- import logging LOG_LEVEL = logging.INFO # クライアントを待ちうけるポート BIND_PORT_FOR_ENTRY = 5556 # PUSH-PULL用のポート BIND_PORT_FOR_PULL = 5557 # アプリ毎のワーカースレッドの数 #THREAD_NUMS_PER_APPLICATION = 5 # アプリ毎のAPNsの設定 APPLICATIONS = [ { "application_id": "14", "name": "My App1", "sandbo...
from django import forms from django.utils.safestring import mark_safe from django.forms.util import flatatt from django.conf import settings from django.contrib.gis.geos import fromstr class BookmarkWidget(forms.TextInput): def __init__(self, title='Point', attrs=None): super(BookmarkWidget, self).__init...
import sys from photon.demo_util.common.context_base import ContextBase class FailFastDemo: """ Main thread waiting on the 'Fail Fast' event from any other thread. All other threads are 'daemons' and will exit when this thread exits. """ def __init__(self, ctx: ContextBase) -> None: ""...
""" delete.py """ import requests from .exceptions import AgaveFilesError from ..utils import handle_bad_response_status_code def files_delete(tenant_url, access_token, file_path): """ Remove a file or direcotry from a remote system """ # Set request url. endpoint = "{0}/{1}/{2}".format(tenant_url...
import sys from contextlib import suppress from os.path import dirname, join from shutil import rmtree from unittest import IsolatedAsyncioTestCase from dipdup import __version__ from dipdup.config import DipDupConfig from dipdup.dipdup import DipDup class CodegenTest(IsolatedAsyncioTestCase): async def test_cod...
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. BK-BASE 蓝鲸基础平台 is licensed under the MIT License. License for BK-BASE 蓝鲸基础平台: ------------------------------------------...
import logging import boto3 import uuid import argparse import sys import os import time from botocore.exceptions import ClientError logging.basicConfig(level=logging.INFO) TEMP_INSTANCE_TYPE = "t2.micro" def parse_cmd_line_args(): parser = argparse.ArgumentParser() parser.add_argument('--profile', '-p', hel...
import tkinter as tk from tkinter import messagebox from threading import Thread from time import sleep import constants.all as c from components.semaphore import Semaphore, SemaphoreKind from components.record import Record, RecordKind from components.openLogButton import OpenLogButton from modules.finder import read ...
# coding=utf-8 r""" This code was generated by \ / _ _ _| _ _ | (_)\/(_)(_|\/| |(/_ v1.0.0 / / """ from tests import IntegrationTestCase from tests.holodeck import Request from twilio.base.exceptions import TwilioException from twilio.http.response import Response class BuildStatusTestCase(Integ...
import json from datetime import date def assert_equal(context, result, expected_result, custom_message): expected_result = context.module.get_content(expected_result).get_value() #TODO Modificar para utilizar sinal de "menor", "maior". Exemplo: <sim> e <não> if expected_result == 'sim': expecte...
import sys from RPi import GPIO pins = [5, 6, 12, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27] # Means use the pins as they are on the cobbler # GPIO.BOARD means in order numbering def setup(): GPIO.setmode(GPIO.BCM) for pin in pins: GPIO.setup(pin, GPIO.OUT) def main(mode, pin): toggle =...
# RayStation version: 4.7.5.4 import os import time import socket import wpf from System.Windows import * from System.Windows.Controls import * from os.path import join, getsize import datetime import shutil class MyWindow(Window): def __init__(self): self.WindowStartupLocation=WindowStartupLocation.Center...
"""Constants needed by ISAPI filters and extensions.""" # ====================================================================== # Copyright 2002-2003 by Blackdog Software Pty Ltd. # # All Rights Reserved # # Permission to use, copy, modify, and distribute this software and # its d...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test binning.py module.""" # STDLIB import os # THIRD PARTY import numpy as np import pytest # ASTROPY from astropy import units as u from astropy.utils.data import get_pkg_data_filename # LOCAL from synphot import binning, exceptions, specio from s...
""" Migration script to update the migrate_tools.repository_path column to point to the new location lib/tool_shed/galaxy_install/migrate. """ from __future__ import print_function import datetime import logging import sys now = datetime.datetime.utcnow log = logging.getLogger( __name__ ) log.setLevel(logging.DEBUG) ...
"""Get Telegram Profile Picture and other information Syntax: .whois @username""" import html from telethon.tl.functions.photos import GetUserPhotosRequest from telethon.tl.functions.users import GetFullUserRequest from telethon.tl.types import MessageEntityMentionName from telethon.utils import get_input_location fro...
# -*- 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...
import tests import suds
# 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 ...
try: # Attempt to import the build settings from .build import * # noqa except ImportError: # If the build settings cannot be found, import the base settings from .base import * # noqa
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from bson import errors as bson_errors from bson import json_util, objectid from flask import Flask, Response, request from pymongo import MongoClient import config import errors app = Flask(__name__) app.config.from_object(config.main_config) if os.environ....
############################################################################## # Copyright by The HDF Group. # # All rights reserved. # # # # Th...
from werkzeug.exceptions import NotFound, MethodNotAllowed from app.api.utils.http import response_wrapper from flask import jsonify, current_app class CustomHTTPError(Exception): def __init__(self, msg: str, status: int, data=None): self.msg = msg self.status = status self.data = data ...
# -*- coding: utf-8 -*- 'sqas': {'label': [0.0, 0.0]}, # sets theta, phi pairs to calculate 'soc_off': [] # a list of atom labels to switch off SOC term
#! /usr/bin/python3 import sys import os import time from typing import Dict, List, Tuple, Set import re CENTER_OF_MASS = "COM" def part1(planet_orbits: Dict[str, str]) -> int: planets: Set[str] = set() for orbiter, orbited in planet_orbits.items(): planets.add(orbited) planets.add(orbiter) ...
#!/usr/bin/env python3 import argparse import os import sys import random debug_mode = False def create_bram(dsc_f, sim_f, ref_f, tb_f, k1, k2, or_next): while True: init = 0 # random.randrange(2) abits = random.randrange(1, 8) dbits = random.randrange(1, 8) groups = random.rand...
# 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 __future__ import print_function import logging import os import pickle import random import sys import tempfile import unittest import pytest from pysparkling import Context from pysparkling.fileio import File try: import py7zlib except ImportError: py7zlib = None AWS_ACCESS_KEY_ID = os.getenv('AWS_A...
#!/usr/bin/env python3 import concurrent.futures import json import os import subprocess import sys import tempfile import yaml import model.kubernetes import kube.ctx from ci.util import ( Failure, info, which, ) own_dir = os.path.abspath(os.path.dirname(__file__)) repo_dir = os.path.abspath(os.path.j...
from setuptools import setup, find_packages with open("README.md", "r") as f: page_description = f.read() with open("requirements.txt") as f: requirements = f.read().splitlines() setup( name="image_processing-test", version="0.0.2", author="Carlos Alberto de Freitas", author_email="cafreitas@...
import pathlib from collections import OrderedDict,defaultdict, namedtuple from functools import partial, wraps from pprint import PrettyPrinter as pprint pprint = PrettyPrinter(indent=4).pprint def iterate_recursive_dict(dictionary, keys=()): """ Generator; walk through a recursive dict structure yiel...
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # 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 ...
import base64 import hashlib import json import os import platform import re import shutil import sys import sysconfig import warnings from contextlib import contextmanager from typing import Any from typing import Dict from typing import List from typing import Optional from typing import Tuple import tomlkit from ...
from unittest import mock import requests import pytest from django.urls import reverse from django.test import override_settings from .models import ExchangeRate from .literals import CURRENCIES @pytest.mark.django_db def test_rates_list(client): r = client.get(reverse('api:exchangerate-list')) assert r.st...
import numpy as np from gym import utils from gym.envs.mujoco import mujoco_env from utils import * import os class ModularEnv(mujoco_env.MujocoEnv, utils.EzPickle): def __init__(self, xml): self.xml = xml mujoco_env.MujocoEnv.__init__(self, xml, 4) utils.EzPickle.__init__(self) def s...
#!/usr/bin/env python3 # # Copyright 2014 Simone Campagna # # 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 ...
""" Copyright 2017-present Airbnb, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, sof...
# -*- coding: utf-8 -*- import datetime import gettext as gettext_stdlib import os from babel.numbers import NumberFormatError from pytz.gae import pytz import webapp2 from webapp2_extras import i18n import test_base class I18nTestCase(test_base.BaseTestCase): def setUp(self): super(I18nTestCase, self...
import os import torch import pandas as pd from PIL import Image import numpy as np from wilds.datasets.wilds_dataset import WILDSDataset from wilds.common.grouper import CombinatorialGrouper from wilds.common.metrics.all_metrics import Accuracy class WaterbirdsDataset(WILDSDataset): """ The Waterbi...
from JumpScale import j import JumpScale.baselib.serializers import JumpScale.grid.serverbase from JumpScale.grid.serverbase.DaemonClient import Transport import time def retry(func): def wrapper(self, *args, **kwargs): try: if j.system.net.tcpPortConnectionTest(*self._connection[:2]): ...
from typing import Dict, Optional, List, Set, Tuple, Union import pytest import torch from allennlp.common import Params from allennlp.common.from_params import FromParams, takes_arg, remove_optional, create_kwargs from allennlp.common.testing import AllenNlpTestCase from allennlp.data import DatasetReader, Tokenizer...
"""Example script for setting up and solving a thermal grid optimal operation problem.""" import cvxpy as cp import numpy as np import os import pandas as pd import plotly.express as px import plotly.graph_objects as go import mesmo def main(): # Settings. scenario_name = 'singapore_tanjongpagar_thermal_on...
#Builtin imports import logging import os import sys import time import traceback #External imports import importlib log = logging.getLogger() dir_path = 'core/plugins' plugin_subscriptions = [] command_plugins = {} default_plugin_data = None class subscriptions(): ''' Manage plugin subscriptions and ev...
""" pipenv run python -m unittest tests.integration.test_authorize """ from .constants import _ import unittest from chalice.config import Config from chalice.local import LocalGateway import json from app import app from tests.integration.baseTestCase import BaseTestCase class FormAdmin(BaseTestCase): def test_a...
from __future__ import print_function """This file is used to find the site packages of a Python executable, which may be Python 2. This file MUST remain compatible with Python 2. Since we cannot make any assumptions about the Python being executed, this module should not use *any* dependencies outside of the standard...
# -*- encoding: utf-8 -*- # Copyright 2013 Red Hat, 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 re...
class Solution: def fib(self, n: int) -> int: a, b = 0, 1 for i in range(n): a, b = b, a + b return a
import numpy as np def plottest(): import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 3 * np.pi, 500) y1 = np.sin(x) y2 = np.sin(3 * x) fig, ax = plt.subplots() ax.fill(x, y1, 'b', x, y2, 'r', alpha=0.3) plt.show() return def LoadArray_GCDCBlue( fullPathName...
import torch from mmcv.cnn import NonLocal2d from torch import nn from ..builder import HEADS from .fcn_head import FCNHead class DisentangledNonLocal2d(NonLocal2d): """Disentangled Non-Local Blocks. Args: temperature (float): Temperature to adjust attention. Default: 0.05 """ ...
#!/usr/bin/python # Copyright (C) International Business Machines Corp., 2005 # Authors: Dan Smith <danms@us.ibm.com> from XmTestLib import * import os import time rdpath = getRdPath() # status, output = traceCommand("losetup -f %s" % rdpath) # if status != 0: # FAIL("Unable to get a free loop device") # # if...
# windows10 下不可用 import sys sys.path.append('/qinse/V2RaycSpider0925') from config import NGINX_SSR_PATH from MiddleKey.VMes_IO import vmess_IO from spiderNest.ssr_xjcloud_spider import UFO_Spider if __name__ == '__main__': vio = vmess_IO('ssr') if '无可用订阅连接' in vio: UFO_Spider().start() ssr =...
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) import json from datetime import datetime, timedelta from mock.mock import patch from rq import Queue from rq.compat import utc from rq.exceptions import NoSuchJobError from rq.job imp...
from datetime import date import factory from .models import EncryptedModel class EncryptedModelFactory(factory.DjangoModelFactory): """Factory to generate hashed and encrypted data.""" digest_field = factory.Sequence('Text digest {}'.format) hmac_field = factory.Sequence('Text hmac {}'.format) em...
""" This is an implementation of odd-even transposition sort. It works by performing a series of parallel swaps between odd and even pairs of variables in the list. This implementation represents each variable in the list with a process and each process communicates with its neighboring processes in the list to perfo...
from datetime import date from typing import cast, Union from dateutil.parser import isoparse some_source = date(2020, 10, 12) some_destination = some_source.isoformat() if some_source else None _a_prop = some_destination a_prop: Optional[datetime.date] if _a_prop is None: a_prop = None else: a_prop = isopars...
class Student: def __init__(self, name): self.name = name def __repr__(self): return self.name students =[Student(f'Student #{i}') for i in range(5)] print(', '.join(str(s) for s in students))
# Copyright 2021 Red Hat, 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 ...
# coding:utf-8 import time from dongtai.endpoint import R from dongtai.endpoint import UserEndPoint from dongtai.models.project_report import ProjectReport from dongtai.models.project import IastProject from django.utils.translation import gettext_lazy as _ from rest_framework import serializers from iast.utils impor...
import json import logging from pathlib import Path from typing import List import aiofiles from bot.bot import Friendo from bot.settings import MEME_PASSWORD, MEME_USERNAME MEME_DIR = Path.cwd() / 'bot' / 'meme_api' / 'json' / 'meme_list.json' log = logging.getLogger(__name__) class Meme: """Pulls meme templa...
import time from typing import Tuple, Dict, Any import torch from torch.optim.optimizer import Optimizer from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter from models.forward_tacotron import ForwardTacotron from trainer.common import Averager, TTSSession, MaskedL1, to_device, n...
import torch import torch.utils.data import torch.optim as optim import torch.nn.functional as F import torch.nn as nn import os import copy from tqdm import tqdm import matplotlib.pyplot as plt import argparse from dataloader import sceneflow_loader as sf import networks.Aggregator as Agg import networks.U_net as un ...