text
stringlengths
2
999k
""" CloudStack Cloud Module ======================= The CloudStack cloud module is used to control access to a CloudStack based Public Cloud. :depends: libcloud >= 0.15 Use of this module requires the ``apikey``, ``secretkey``, ``host`` and ``path`` parameters. .. code-block:: yaml my-cloudstack-cloud-config: ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('activities', '0002_auto_20170304_2031'), ] operations = [ migrations.AlterField( model_name='activity', ...
import math from PyQt5.QtCore import QDate from PyQt5.QtCore import Qt from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import QDateEdit from PyQt5.QtWidgets import QGridLayout from PyQt5.QtWidgets import QSlider from PyQt5.QtWidgets import QWidget from sqlalchemy import func class DateRangeInput(QWidget): ...
""" 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 """ import re # noq...
# Copyright 2021 Ruffin White # Licensed under the Apache License, Version 2.0 from colcon_cache.verb_handler import VerbHandlerExtensionPoint from colcon_core.plugin_system import satisfies_version VERB_NAME = 'test' REFERENCE_NAME = 'build' class TestVerbHandler(VerbHandlerExtensionPoint): """Determin how loc...
from schemas import Event from typing import Any, List, Union # local imports from extractors.SessionFeature import SessionFeature from schemas.Event import Event class SessionID(SessionFeature): def __init__(self, name:str, description:str, sessionID:str): SessionFeature.__init__(self, name=name, descript...
def function_one(): x = 1 if x == 1 return True else: return False def function_two(): return 5 x = function_one() + function_two() y = function_one() or function_two)
import json import sys def main(): samples = 1 output_path = '.' if len(sys.argv) > 1: samples = sys.argv[1] output_path = sys.argv[2] print (f"Generating {samples} samples") h_cli_sc = [] broker = open(output_path+"/broker.json", "w") broker_json = json.dumps( { "...
# Copyright 2017 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...
""" This module (along with a few functions in :mod:`.helper_functions`) contains everything that is needed to calculate instantons in one field dimension. The primary class is :class:`SingleFieldInstanton`, which can calculate the instanton solution in any number of spatial dimensions using the overshoot / undershoot ...
import pandas as pd import matplotlib.pyplot as plt import EDA_functions as eda sample_10m = 'data/10m_sample_common_passwords/10m_standard_complete3.csv' pwned_path = '../data/have_i_been_pwned_v4/been_pwned_v4_hash_plain.txt' linkedin_path = '../data/linkedin_leak/linkedin_hash_plain.txt' linkedin_test_file = '../da...
# Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Utilities for assisting in bug management for flaky tests.""" from collections import defaultdict import datetime import logging from google.appengine.ex...
"""Helper script for generating the 'test_constants' test in test_constants.py.""" import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from androidtv import constants EXCLUSIONS = { "CMD_SUCCESS1", "CMD_SUCCESS1_FAILURE0", "CMD_PARSE_CURRENT_APP", "CMD_DEFINE_CURRE...
import numpy as np import pandas as pd import altair as alt import plotnine as p9 from bokeh.plotting import figure from bokeh.models import ColumnDataSource from utils.creators import unpack_graph_object def create_bokeh_graph(graph_object): # format data (X, y, bubble_size, *_), styles = unpack_graph_object(...
""" This module defines base classes for metabolic modeling. Adapted from https://github.com/cdanielmachado/framed Author: Daniel Machado """ import warnings from builtins import object from builtins import str from collections import OrderedDict from copy import copy, deepcopy from .parser import ReactionParser ...
""" WSGI config for mlb_29053 project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SET...
#Capítulo 8: archivo de entrada y de salida Dentro de Python #Cuando se trata de trabajar en un código dentro de Python, hay momentos en #los que desea almacenar los datos de modo que esté disponible para su uso #más adelante, cuando sea necesario. #Cómo crear un nuevo archivo #Una de las primeras cosas que vamos a h...
pdef('Empty') pdef('Axis').add_fields('int32', 'axis', 0) (pdef('Convolution', version=0, is_legacy=True). add_enum('Mode', 'CROSS_CORRELATION = 0', 'CONVOLUTION = 1'). add_fields( 'uint32', Doc('pad_h', 'padding on one side on the first dimension'), 0, Doc('pad_w', 'padding on one side on the second...
from utils import MovieDataApp, movie_protrait_db from movie_protrait.cal_merge_weight import idf_textrank spark = MovieDataApp().spark def get_keyword_weights(): """ 返回关键词和权重 :return: 【dataframe】 """ rt = idf_textrank() rt.registerTempTable("temptable") merge_keywords = spark.sql("select...
from rest_framework import permissions class IsOwnerOrAdmin(permissions.BasePermission): """ Object-level permission to only allow owners of an object or admins to edit it. """ def has_object_permission(self, request, view, obj): if request.user.is_superuser: return True return o...
""" Methods for the events namespace https://docs.github.com/en/rest/reference/activity#events """ from __future__ import annotations import asyncio from datetime import datetime from typing import TYPE_CHECKING, Any, Awaitable, Callable, Dict, Literal from uuid import uuid4 from ..const import LOGGER, GitHubRequest...
from typing import Type import pytest from cx_const import PredefinedActionsMapping from cx_core import type as type_module from cx_core.type_controller import TypeController from pytest_mock.plugin import MockerFixture from tests.test_utils import get_classes def check_mapping(mapping: PredefinedActionsMapping) ->...
# Programa que cria um loop while com inputs para inserir uma chave e seu valor em um dicionário vazio. d1 = {} while True: key = str(input('Digite o nome do aluno: ')).title().strip() if key in d1: # condição para não entrar chaves repetidas no dicionário print('Este nome já está na lista. Por favor,...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import webmap.utils class Migration(migrations.Migration): dependencies = [ ('webmap', '0001_initial'), ] operations = [ migrations.AddField( model_name='layer', ...
#!/usr/bin/env python3 # # 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 "L...
import random from typing import List class Blackjack: """ Single player blackjack game. \n get_actions() gives you all the available actions. \n play(action: int) will make a move. \n get_state() returns the current state [ dealer hand value, dealer ace count, player h...
"""rlocus_test.py - unit test for root locus diagrams RMM, 1 Jul 2011 """ import matplotlib.pyplot as plt import numpy as np from numpy.testing import assert_array_almost_equal import pytest import control as ct from control.rlocus import root_locus, _RLClickDispatcher from control.xferfcn import TransferFunction fr...
''' Constants and presets for command verbs, use aliases and movement commands. Commands verbs are: * 'look' (at room), * (list) 'inv'(entory held), * 'get' (item) * 'drop' (item) * 'ex'(amine) item * 'quit' game Notes: ----- Verbs for using items are specified under use aliases int the TextWorld class. ''' ########...
#!/usr/bin/env python import os from distutils.core import setup from distutils.extension import Extension CLASSIFIERS = ["Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", ...
# Copyright 2020 The Cirq Developers # # 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 ...
""" Configuration file for Flask and Flask-SQLAlchemy modules. All environment variables are stored in local .env file. """ import os from dotenv import load_dotenv load_dotenv() #load environment variables from .env file class Config(object): db_host = os.environ.get('DB_HOST') db_name = os.environ.get('DB...
""" handled_bug_report.py Copyright 2009 Andres Riancho This file is part of w3af, w3af.org . w3af 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 version 2 of the License. w3af is distributed in the hope that ...
# Generated by Django 2.1.1 on 2019-05-15 02:57 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('input', '0003_post'), ] operations = [ migrations.AlterField...
# Generated by Django 3.1.5 on 2021-01-09 21:55 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import main.models class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0012_alter_user_first_name_max_length'), ...
""" Simple script to get transcript infromation from the database generated by Cufflinks """ import optparse, sys, csv, os, sqlite3 from pySeq.common_funcs import regionParse def main(): p = optparse.OptionParser(__doc__) p.add_option("-D", "--debug", action="store_true", dest="D", help="debug") p.add_op...
""" WSGI config for Custom Creations project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLI...
#!/usr/bin/env python3 # -*- coding:utf-8 -*- import cv2 # OpenCV actually stores the pixel values in Blue, Green, Red order image = cv2.imread("../datasets/SteveJobsOneMoreThing.jpg") print(image.shape) print(image[20,100]) # access values in a matrix: first we specify the row number then the column number cv2.imshow...
import pytest import numpy as np from ..univariate_filter import univariate_filter import pkg_resources PATH = pkg_resources.resource_filename(__name__, 'test_data/') def test_univariate_filter(): "Test filter-based dimensionality reduction" # load data X = np.load(PATH+'features_largeN.npy') y ...
from django.urls import path from . import views from .views import PostListView,PostDetailView,PostCreateView,PostUpdateView,PostDeleteView urlpatterns = [ path('', PostListView.as_view(),name="blog-home"), path('post/<int:pk>/', PostDetailView.as_view(),name="post-detail"), path('post/new/', PostCreateVi...
""" Data input preparation from decoding TFrecords, onehot encoding, augmentation, and batching 3.0 Created on 04/26/2019 @author: RH """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf class DataSet(object): # bs is batch siz...
""" This file offers the methods to automatically retrieve the graph Danio rerio. The graph is automatically retrieved from the STRING repository. References --------------------- Please cite the following if you use the data: ```bib @article{szklarczyk2019string, title={STRING v11: protein--protein associatio...
from ansys_functions import * class block_matrix: block_width = 10 def __init__(self, input, type = 's'): ''' Creates an block matrix, which houses the different object values inout = input matrix of the top corner of the matrix Represented as a list of 2D matricies, sta...
"""intro_2django URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/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') Class...
import random from cereal import log from selfdrive.hardware.base import HardwareBase NetworkType = log.DeviceState.NetworkType NetworkStrength = log.DeviceState.NetworkStrength class Pc(HardwareBase): def get_os_version(self): return None def get_device_type(self): return "pc" def get_sound_card_on...
from copy import copy from typing import Optional from django.http.request import HttpRequest from django.http.response import JsonResponse from django.test import override_settings from django.urls import path from django.views import View from django_autowired.autowired import autowired from django_autowired.param_f...
# -*- coding: utf-8 -*- r""" Hyperplane Arrangements Before talking about hyperplane arrangements, let us start with individual hyperplanes. This package uses certain linear expressions to represent hyperplanes, that is, a linear expression `3x + 3y - 5z - 7` stands for the hyperplane with the equation `3x + 3y - 5z =...
import unittest import json import yaml import sys import os from job import Job, JobSchema from pod_template import PodTemplate sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../utils")) from config import config VALID_JOB_ATTRIBUTES = { "cluster": config, "jobId": "ce7dca49-28df-4...
# -*- coding: utf-8 -*- # # ramstk.views.gtk3.design_electric.components.miscellaneous.py is part of the # RAMSTK Project. # # All rights reserved. # Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com """Miscellaneous Devices Input Panel.""" # Standard Library Imports fr...
import os # Keyword arguments for initializing cloudvolume.CloudVolume CloudVolumeKwargs = dict( cloudpath="", parallel=True, cache=True, fill_missing=True, progress=False ...
# Purpose: new entity database, replaces module ezdxf.database # Created: 2019-02-14 # Copyright (c) 2019-2020, Manfred Moitzi # License: MIT License from typing import Optional, Iterable, Tuple, TYPE_CHECKING, Dict, Set from ezdxf.tools.handle import HandleGenerator from ezdxf.lldxf.types import is_valid_handle from e...
import torch from torchvision import transforms import cv2 import numpy as np import types from numpy import random def intersect(box_a, box_b): ''' calcute the intersect of box args: box_a = [boxs_num,4] box_b = [4] return iou_area = [boxs_num,1] ''' max_xy = np.minimum(box...
"""credy URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-base...
def generateEfficiencyStrings(variables, plots): stringTemplate = "{plot} " + \ "'{var} efficiency; Offline E_{{T}}^{{miss}} (GeV); {var} efficiency'" + \ " {num_path} {den_path}" for variable, thresholds in variables.items(): for plot in plots[variable]: for threshold in th...
# # Copyright (c) 2016 Nutanix Inc. All rights reserved. # # # pylint: disable=pointless-statement import unittest from curie.punit_parser import PUnit class TestCuriePUnitParser(unittest.TestCase): UNIT_NAMES = ["byte", "decibel", "decibel ( simple-name_ )"] def setUp(self): pass def test_base_name(self...
from setuptools import setup setup( name='wework', version='0.0.1', keywords=('work wechat sdk', ), description='dead simple work wechat sdk', author='Quseit', author_email='river@quseit.com', packages=['wework'], include_package_data=True, license='Apache License', install_req...
from datetime import timedelta from unittest.mock import patch from django.test import TestCase from django.utils import timezone from data_refinery_api.management.commands.post_downloads_summary import post_downloads_summary from data_refinery_common.models import Dataset, DatasetAnnotation class DownloadsPostTest...
""" Django settings for izone project. Generated by 'django-admin startproject' using Django 1.10.6. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ import os i...
""" [summary] """ import abc import os import re import pickle import shutil from typing import Any, Dict, List, Optional, Union import attr import requests import semver import torch import yaml from requests.adapters import HTTPAdapter from simpletransformers.classification import ClassificationModel # type: ignore...
import pytest from bgmi.lib.fetch import DATA_SOURCE_MAP from bgmi.website import mikan from bgmi.website.base import BaseWebsite from bgmi.website.model import SubtitleGroup, WebsiteBangumi @pytest.mark.parametrize("source", DATA_SOURCE_MAP.keys()) def test_info(source, data_source_bangumi_name): w = DATA_SOURC...
from sklearn.datasets import load_files from keras.utils import np_utils import numpy as np from glob import glob from keras.models import Sequential from keras.layers import Conv2D, MaxPooling2D, GlobalAveragePooling2D from keras.layers import Activation, BatchNormalization from keras.layers import Dropout, Flatten, D...
from .. import Provider as CompanyProvider class Provider(CompanyProvider): formats = ( '{{last_name}} {{company_suffix}}', '{{last_name}} {{last_name}} {{company_suffix}}', '{{last_name}} {{last_name}} {{company_suffix}}', '{{last_name}}', ) company_suffixes = ( '...
# -*- coding: utf-8 -*- from django import forms from django.db.models import get_model from django.forms.models import inlineformset_factory, fields_for_model WishList = get_model('wishlists', 'WishList') Line = get_model('wishlists', 'Line') class WishListForm(forms.ModelForm): def __init__(self, user, *args,...
import findspark findspark.init() from pyspark import SparkConf,SparkContext from pyspark.streaming import StreamingContext from pyspark.sql import Row,SQLContext,SparkSession import sys import requests from pyspark.sql.types import * from pyspark.sql.functions import * import math def cal(x,y): ...
# SPDX-License-Identifier: Apache-2.0 # # http://nexb.com and https://github.com/nexB/scancode.io # The ScanCode.io software is licensed under the Apache License version 2.0. # Data generated with ScanCode.io is provided as-is without warranties. # ScanCode is a trademark of nexB Inc. # # You may not use this software ...
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2018, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
# yellowbrick.model_selection.validation_curve # Implements a visual validation curve for a hyperparameter. # # Author: Benjamin Bengfort # Created: Sat Mar 31 06:27:28 2018 -0400 # # Copyright (C) 2018 The scikit-yb developers # For license information, see LICENSE.txt # # ID: validation_curve.py [c5355ee] benjamin@b...
from aiomongoengine.errors import ValidationError from .base_field import BaseField class ListField(BaseField): """ Field responsible for storing :py:class:`list`. """ def __init__(self, base_field=None, *args, **kw): super().__init__(*args, **kw) if not isinstance(base_field, BaseField): ...
from collections import defaultdict from dataclasses import dataclass @dataclass class Utterance: speaker_id: str message_id: int speaker_name: str speaker_language: str text: str timestamp: float class TranscriptList: """Holds transcripts""" def __init__(self): self.transcr...
# Copyright 2020-2021 Huawei Technologies Co., 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 agre...
""" File: openforcefield2gromos Warnings: this class is WIP! TODO:REWORK Description: This is a super class to convert from a openforcfield topology to a gromos topology Author: Marc Lehner """ #imports import importlib from pygromos.files.topology.top import Top from pygromos.files.gromos_system.ff.for...
# -*- coding: utf-8 -*- # Copyright 2017 IBM RESEARCH. 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 requ...
### intentionally empty
import os from PIL import Image, ImageDraw from datetime import datetime from settings import ( BACKGROUND_COLOR, DATETIME_FORMAT, DEFAULT_IMAGE_SIZE, IMAGE_DIRECTORY_NAME, IMAGE_EXTENSION, IMAGE_FORMAT, IMAGE_FORMAT_COLOR_MODE, ) # if you get a DecompressionBombError, you can uncomment the line below, and n...
# You are given two non-empty linked lists representing two non-negative integers. # The digits are stored in reverse order and each of their nodes contain a single digit. # Add the two numbers and return it as a linked list. # You may assume the two numbers do not contain any leading zero, except the number 0 itself....
import requests def get_token(): url = "https://sbx-nxos-mgmt.cisco.com/api/aaaLogin.json" payload = "{\n\t\"aaaUser\":{\n\t\t\"attributes\":{\n\t\t\t\"name\": \"admin\",\n\t\t\t\"pwd\": \"Admin_1234!\"\n\t\t}\n\t}\n}" headers = { 'Content-Type': 'application/json', } response = requests.po...
import logging from opentracing import InvalidCarrierException, SpanContextCorruptedException from ddtrace.propagation.http import HTTPPropagator as DDHTTPPropagator from ..span_context import SpanContext from .propagator import Propagator log = logging.getLogger(__name__) HTTP_BAGGAGE_PREFIX = 'ot-baggage-' HTTP_...
# a tentative script to upload all existing drstree "versions" into CMIP sqlite database # each variable, mip, experiment, model, ensemble combination add a new instance in "instance" # for each instance there should be at least one version in "version" table # for each version add at least one file in table "files" ...
################################################################# ### @author:郑晋图 JintuZheng ### Email: jintuzheng@outlook.com ### Remarks: Please respect my labor achievements, and contact me to modify the source code ### Date:2020-01-23 ################################################################ import numpy as...
import json import os import smtplib import time from email.mime.text import MIMEText from email.utils import formataddr def main(event, context): send_key = os.environ.get('send_key') # 设置的send_key core_content = event.get('body') # 邮件的主要参数 core_body = json.loads(core_content) ...
from django.conf import settings from django.contrib.auth.models import User from django.db import connection, transaction from django.test.utils import override_settings from dts_test_app.models import DummyModel, ModelWithFkToPublicUser from django_tenants.test.cases import TenantTestCase from django_tenants.tests.t...
# coding: utf-8 """ Copyright 2016 SmartBear Software 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...
import milk.supervised.tree import milk.supervised._tree from milk.supervised._tree import set_entropy from milk.supervised.tree import information_gain, stump_learner import numpy as np def test_tree(): from milksets import wine features, labels = wine.load() selected = (labels < 2) features = feature...
''' 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 use this ...
#!/usr/bin/python # # Created on Aug 25, 2016 # @author: Gaurav Rastogi (grastogi@avinetworks.com) # Eric Anderson (eanderson@avinetworks.com) # module_check: supported # Avi Version: 17.1.1 # # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the te...
# Copyright The Linux Foundation and each contributor to CommunityBridge. # SPDX-License-Identifier: MIT """ Holds the GitHub repository service. """ import json import os import uuid from typing import List, Union, Optional import falcon import github from github import PullRequest from github.GithubException import...
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import logging from closeio_api import APIError, Client as CloseIO_API parser = argparse.ArgumentParser( description='Assigns tasks or opportunities from one user to another' ) group_from = parser.add_mutually_exclusive_group(required=True) group_from...
# 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 ...
import os #, sys import numpy as np import statistics as st from datetime import datetime import csv import matplotlib.pyplot as plt from CChameleonStats import * from CChameleonAggregation import * def write_stats_data_mean( tmp_target_file_path, arr_labels, # nx1 array ...
import numpy as np import torch import torch.nn as nn from ..loss import * class Criterion(object): def __init__(self, device=0, target_opt=['1'], loss_opt=[['WeightedBCE']], loss_weight=[[1.]], regu_opt=[], regu_weight=[]): self.device = device self.target_opt = target_opt self.loss_opt =...
''' Statement Given a sequence of non-negative integers, where each number is written in a separate line. The sequence ends with 0. Print the number of even elements of the sequence. Example input 2 1 4 0 Example output 2 ''' count = 0 while True: num = int(input()) if num == 0: break if num % ...
import json import logging from canari.maltego.entities import Hashtag, Phrase from canari.maltego.message import Unknown, Bookmark, Field from canari.maltego.transform import Transform from yetigo.transforms.utils import get_yeti_connection, \ mapping_yeti_to_maltego, get_hash_entities, get_av_sig, do_transform, ...
# -*- coding: utf-8 -*- from pathlib import Path import urllib from urllib.error import URLError, HTTPError, ContentTooShortError import time import requests import os from bs4 import BeautifulSoup import sys if int(sys.version[0]) < 3: from proxy2 import * else: from proxy3 import * set_logging(True) init() ...
from django.urls import path from website import views urlpatterns = [ path('', views.index, name='website-index'), path('about', views.about, name='website-about'), path('squares', views.explore_by_square, name='website-squares'), path('square_search', views.square_search, name='website-square-search...
# Generated by Django 3.2.6 on 2021-08-16 00:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('write', '0001_initial'), ] operations = [ migrations.CreateModel( name='lotto_data', fields=[ ('id',...
""" API operations on the contents of a history. """ import logging import os import re from galaxy import ( exceptions, util ) from galaxy.managers import ( folders, hdas, hdcas, histories, history_contents ) from galaxy.managers.collections_util import ( api_payload_to_create_params, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import requests import json class KodiController(object): __serverconf = None def __init__(self, serverconf): self.__serverconf = serverconf def post(self,command): url = "http://" + self.__serverconf["...
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pillow_retry', '0007_remove_pillowerror_queued'), ] operations = [ # doc_id index already covered by unique(doc_id, pillow) migrations.AlterField( model_name='pillowerro...
import json import torch from nltk.tokenize import word_tokenize from graph4nlp.pytorch.data.dataset import Text2TextDataItem, Text2TextDataset from graph4nlp.pytorch.modules.utils.padding_utils import pad_2d_vals, pad_2d_vals_no_size class CNNDataset(Text2TextDataset): def __init__( self, root_d...
from django.db import models from django.contrib.auth.models import AbstractUser # Create your models here. class User(AbstractUser): realname = models.CharField(max_length = 20, verbose_name = u'真实姓名') university = models.CharField(max_length = 20, verbose_name = u'学校') title = models.CharField(null=True, ...
# flake8:noqa # isort:skip_file from concurrent.futures import ProcessPoolExecutor from io import BytesIO from typing import List, Optional, Tuple import pytest from PIL import Image, ImageDraw from colorific import settings settings.setup("test") from colorific import application from colorific import db as colori...