filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_30038
"""Prepare MS COCO datasets""" import os import shutil import zipfile import argparse from encoding.utils import download, mkdir _TARGET_DIR = os.path.expanduser('~/.encoding/data') def parse_args(): parser = argparse.ArgumentParser( description='Initialize MS COCO dataset.', epilog='Example: pyt...
the-stack_106_30039
import pytest from pandas import Timedelta, Timestamp import ibis import ibis.common.exceptions as com import ibis.expr.operations as ops from ibis.backends.pandas.execution import execute from ibis.expr.scope import Scope from ibis.expr.timecontext import ( TimeContextRelation, adjust_context, compare_tim...
the-stack_106_30041
import os from .vendored import colorconv, cm import numpy as np import vispy.color _matplotlib_list_file = os.path.join( os.path.dirname(__file__), 'matplotlib_cmaps.txt' ) with open(_matplotlib_list_file) as fin: matplotlib_colormaps = [line.rstrip() for line in fin] primary_color_names = ['red', 'green',...
the-stack_106_30042
""" This is Roeland’s CMD color module, which abstracts away either the ANSI color codes on VT-style terminals, or the win32 console API. The latter is also called directly for printing text so you can print any Unicode character up to U+FFFF on the console. """ import functools as _functools import sys as _sys import...
the-stack_106_30045
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import transforms, utils from torch.utils.data import Dataset, DataLoader import time from matplotlib import pyplot as plt import matplotlib.patches as patches import glob import cv2 import numpy as np devic...
the-stack_106_30047
"""Provides BUILD macros for MediaPipe graphs. mediapipe_binary_graph() converts a graph from text format to serialized binary format. Example: mediapipe_binary_graph( name = "make_graph_binarypb", graph = "//mediapipe/framework/tool/testdata:test_graph", output_name = "test.binarypb", deps = [ ...
the-stack_106_30048
from typing import Optional, Sequence from faker import Factory from tabledata import TableData from ._common import get_providers class TableFaker: def __init__(self, locale: Optional[str] = None, seed: Optional[int] = None) -> None: self.__fake = Factory.create(locale) if seed is not None: ...
the-stack_106_30049
import os import pathlib import uuid from hadoop_fs_wrapper.wrappers.file_system import FileSystem from pyspark.sql import SparkSession from datetime import datetime from spark_utils.common.functions import is_valid_source_path from spark_utils.dataframes.functions import copy_dataframe_to_socket from spark_utils.da...
the-stack_106_30052
# 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 u...
the-stack_106_30053
import gdb from undodb.debugger_extensions import udb def count_calls(func_name): """ Counts how many times func_name is hit during the replay of the currently loaded recording and returns the hit count. """ # Set a breakpoint for the specified function. bp = gdb.Breakpoint(func_name) # ...
the-stack_106_30055
#!/usr/local/bin/python ''' Pipeline for converting XML RES data in JSON and importing into Elasticsearch. ''' from bs4 import BeautifulSoup import glob import hashlib import logging import os from os.path import join, dirname import random import re import requests import simplejson as json import socket import sys ...
the-stack_106_30058
import uuid from django.db import models from django.contrib.auth.models import AbstractUser from django.utils import timezone class UUIDModel(models.Model): id = models.UUIDField( primary_key=True, default=uuid.uuid4, editable=False ) class Meta: abstract = True class U...
the-stack_106_30060
import traceback from django.utils.decorators import method_decorator from drf_yasg import openapi from drf_yasg.utils import swagger_auto_schema from rest_framework.generics import CreateAPIView, ListAPIView, DestroyAPIView, RetrieveAPIView from rest_framework.permissions import IsAuthenticated from rest_framework.re...
the-stack_106_30061
from __future__ import print_function, division from typing import Optional, Union, List import numpy as np from scipy.ndimage.morphology import binary_erosion, binary_dilation from skimage.morphology import erosion, dilation from skimage.measure import label as label_cc # avoid namespace conflict from scipy.signal i...
the-stack_106_30062
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2019-Present Datadog, Inc. from datadog_api_client.v1.model_utils import ( ModelNormal, cached_property, ...
the-stack_106_30063
from collections import deque import numpy as np import torch from torch import nn class PIDController(object): def __init__(self, K_P=1.0, K_I=0.0, K_D=0.0, n=20): self._K_P = K_P self._K_I = K_I self._K_D = K_D self._window = deque([0 for _ in range(n)], maxlen=n) self...
the-stack_106_30064
# -*- coding: utf-8 -*- """ Created on Mon May 26 23:42:03 2014 @author: Administrator """ from support import * import hashlib import io import xml.dom.minidom import random import math import os import sys default_encoding = 'utf-8' if sys.getdefaultencoding() != default_encoding: reload(sys) sys.setdefau...
the-stack_106_30065
# -*- coding: utf-8 -*- """ Created on Mon Sep 20 16:15:37 2021 @author: em42363 """ from catboost import CatBoostRegressor from sklearn.model_selection import train_test_split from sklearn.preprocessing import MinMaxScaler import pandas as pd import numpy as np import os os.chdir(os.path.dirname(__file__)) impo...
the-stack_106_30068
import asyncio import json import logging import time from collections import defaultdict from decimal import Decimal from operator import itemgetter import websockets logger = logging.getLogger('luno_streams') class BackoffException(Exception): pass class Updater: def __init__(self, pair_code, api_key, ...
the-stack_106_30072
import ctypes from typing import ( Generic, TypeVar, Any, Type, get_type_hints, Callable, Iterator, Union ) from typing_extensions import ParamSpec import inspect from functools import wraps from contextlib import suppress import faulthandler from io import Unsup...
the-stack_106_30073
# 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 agreed to in writing, so...
the-stack_106_30074
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np import unittest from caffe2.proto import caffe2_pb2 from caffe2.python import workspace, core, model_helper, brew class CopyOpsTest(unittest.TestCas...
the-stack_106_30075
# pylint: disable=protected-access """Main module of kytos/mef_eline Kytos Network Application. NApp to provision circuits from user request. """ from threading import Lock from flask import jsonify, request from werkzeug.exceptions import (BadRequest, Conflict, Forbidden, MethodNotAl...
the-stack_106_30076
# Copyright 2017 Battelle Energy Alliance, 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 agreed t...
the-stack_106_30077
from collections import deque from dataset import * import redis import sys import pyarrow as pa import numpy as np import pandas as pd import time import ray import gc import pickle #ray.init(ignore_reinit_error=True) # do this locally ray.init("auto", ignore_reinit_error=True, runtime_env={"working_dir":"/home/ubun...
the-stack_106_30078
# coding=utf-8 # # Yu Wang (University of Yamanashi) # May, 2020 # # 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 appl...
the-stack_106_30080
from rlbot.agents.base_agent import BaseAgent from rlbot.utils.structures.game_data_struct import GameTickPacket from util.orientation import Orientation from util.vec import Vec3 import util.const from state.recover import Recover import math class Chase(Recover): def __init__(self, agent: BaseAgent): super(...
the-stack_106_30081
#!/usr/bin/env python # Copyright (c) 2014 The Beginnercoin Core developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # Exercise the listtransactions API # Add python-beginnercoinrpc to module search path: import os imp...
the-stack_106_30083
from experiment_utils import set_env set_env() from cgn_framework.imagenet import train_cgn, config import argparse def disable_loss_from_config(cfg): """Disable the losses as specified in by the configuration of the experiment.""" if 'shape' in cfg.disable_loss: cfg.LAMBDA.BINARY = 0 cfg.LAM...
the-stack_106_30087
# -*- coding: utf-8 -*- """ Map ------ Classes for drawing maps. """ from __future__ import unicode_literals import json from collections import OrderedDict from jinja2 import Environment, PackageLoader, Template from branca.six import text_type, binary_type from branca.utilities import _parse_size from branca.e...
the-stack_106_30090
import datetime from typing import Optional, List from django.db.models import Prefetch from essentials_kit_management.models \ import OrderItem, Form, Brand, Item, Section, User from essentials_kit_management.interactors.storages.dtos \ import FormDto, CompleteFormDetailsDto, OrderedItemDto, SectionDto, \ ...
the-stack_106_30094
# -*- coding: utf-8 -*- # GUI Application automation and testing library # Copyright (C) 2006-2019 Mark Mc Mahon and Contributors # https://github.com/pywinauto/pywinauto/graphs/contributors # http://pywinauto.readthedocs.io/en/latest/credits.html # All rights reserved. # # Redistribution and use in source and binary f...
the-stack_106_30095
from .random_flip import RandomFlip, Flip from .random_affine import RandomAffine, Affine from .random_anisotropy import RandomAnisotropy from .random_elastic_deformation import ( RandomElasticDeformation, ElasticDeformation, ) __all__ = [ 'RandomFlip', 'Flip', 'RandomAffine', 'Affine', 'R...
the-stack_106_30096
# Create a "spring" using the rotational extrusion filter. # import pyvista profile = pyvista.Polygon(center=[1.25, 0.0, 0.0], radius=0.2, normal=(0, 1, 0), n_sides=30) extruded = profile.extrude_rotate(resolution=360, translation=4.0, dradius=.5, angle=1500.0...
the-stack_106_30098
# -*- coding: utf-8 -*- from __future__ import unicode_literals import unicodecsv as csv from django.conf.urls import url from django.contrib import messages from django.forms.forms import pretty_name from django.forms.models import inlineformset_factory, modelform_factory from django.http import HttpResponseRedirect...
the-stack_106_30101
import os import numpy from PyQt5 import QtWidgets, QtGui, QtCore from cryspy_editor.b_rcif_to_cryspy import L_ITEM_CLASS, L_LOOP_CLASS, L_DATA_CLASS from .FUNCTIONS import show_info, get_layout_method_help, make_qtablewidget_for_data_constr, show_widget, add_mandatory_optional_obj from cryspy.common.cl_item_constr i...
the-stack_106_30102
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np import tensorflow as tf import pandas as pd import argparse import os import time import sys import pwd import csv import re import deepchem import pic...
the-stack_106_30104
""" Copyright 2020 The OneFlow 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 applicable law or agr...
the-stack_106_30105
""" Copyright (C) 2017-2021 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to i...
the-stack_106_30106
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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 cop...
the-stack_106_30108
# Code taken from # https://github.com/vn-ki/anime-downloader # All rights to Vishnunarayan K I import base64 import sys from hashlib import md5 from Cryptodome import Random from Cryptodome.Cipher import AES from requests.utils import quote BLOCK_SIZE = 16 #KEY = b"LXgIVP&PorO68Rq7dTx8N^lP!Fa5sGJ^*XK" KEY = b"26704...
the-stack_106_30109
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 18 19:14:37 2019 @author: george """ import sys import dill def warn(*args, **kwargs): pass import warnings warnings.warn = warn warnings.filterwarnings("ignore", category=DeprecationWarning) import numpy as np from sklearn.model_selection im...
the-stack_106_30110
# 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...
the-stack_106_30111
# -*- coding: utf-8 -*- ############################################## # The MIT License (MIT) # Copyright (c) 2019 Kevin Walchko # see LICENSE for full details ############################################## from .helpers import read from collections import namedtuple LinuxInfo = namedtuple("LinuxInfo", "distro distr...
the-stack_106_30112
import argparse import logging from typing import Text, Union, Optional from rasa.shared.constants import ( DEFAULT_CONFIG_PATH, DEFAULT_DOMAIN_PATH, DEFAULT_MODELS_PATH, DEFAULT_DATA_PATH, DEFAULT_ENDPOINTS_PATH, ) def add_model_param( parser: argparse.ArgumentParser, model_name: Text = ...
the-stack_106_30113
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt densTheo = np.loadtxt("testDensity.dat") potTheo = np.loadtxt("testPotential.dat") potSolved = np.loadtxt("solvedPotential.dat") #potTheo -= np.max(potTheo) #potSolved -= np.min(potSolved) dif = potTheo-potSolved s...
the-stack_106_30115
from datetime import datetime from unittest import mock from waffle.testutils import override_switch from olympia import amo from olympia.accounts.tasks import ( clear_sessions_event, delete_user_event, primary_email_change_event, ) from olympia.accounts.tests.test_utils import totimestamp from olympia.am...
the-stack_106_30116
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc. # Copyright 2011 OpenStack Foundation # # 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-...
the-stack_106_30118
from fetch_spacex import get_spacex_images_links, fetch_spacex_images from fetch_hubble import get_hubble_collection_ids, get_hubble_image_links, fetch_hubble_image from prepare_images import IMAGES_PATH, get_image, save_image, get_file_extension, resize_images def main(): url = 'https://api.spacexdata.com/v3/lau...
the-stack_106_30120
""" Utilities for working with the local dataset cache. """ import os import shutil import tempfile import json from urllib.parse import urlparse from pathlib import Path from typing import Tuple, Union, IO from hashlib import sha256 import requests import logging CACHE_ROOT = Path(os.getenv("TAXONERD_CACHE", str(Pa...
the-stack_106_30121
### # Copyright (c) 2010, Daniel Folkinshteyn # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of cond...
the-stack_106_30124
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import csv import distutils from distutils import util import demo_runner as dr import numpy as np pa...
the-stack_106_30128
#!/usr/bin/env python3 # # Copyright 2017 gRPC 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 la...
the-stack_106_30129
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( int_or_none, parse_age_limit, parse_iso8601, xpath_text, ) class VideomoreIE(InfoExtractor): IE_NAME = 'videomore' _VALID_URL = r'videomore:(?P<sid>\d+)$|https?://videomo...
the-stack_106_30132
# -*- coding: utf-8 -*- ''' # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # # This file was generated and any changes will be overwritten. ''' from __future__ import unicode_literals from ..model.notebook impor...
the-stack_106_30133
from run_cm2_10 import run_test TEST_DIR = "./supplementary/Real_Life_Example_Lycopene_Operon/" def test_cm2_lycopene_10(): """ Test CM_2 Lycopene Sanger 10 targets Threshold: 0.7 """ test_params = { "name": "CM_2: Lycopene - 10 targets - Sanger - Threshold: 0.y", "id": "...
the-stack_106_30136
import traceback from ansible.plugins.action import ActionBase class ActionModule(ActionBase): def run(self, tmp=None, task_vars=None): try: method = getattr(self, self._task.args['method']) args = tuple(self._task.args.get('args', ())) kwargs = self._task.args.get('kw...
the-stack_106_30138
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def clear_status(apps, schema_editor): m = apps.get_model('core.Declaration') m.objects.update(confirmed="p") class Migration(migrations.Migration): dependencies = [ ('core', '0063_auto_20151226_22...
the-stack_106_30140
#!/usr/bin/env python from kapteyn import wcsgrat, maputils from matplotlib.pyplot import figure, show fig = figure() myCubes = maputils.Cubes(fig, toolbarinfo=True, printload=False, helptext=False, imageinfo=True) # Create a maputils FITS object from a FITS file on disk fitsobject = map...
the-stack_106_30141
# -------------------------------------------------------- # Licensed under The MIT License [see LICENSE for details] # -------------------------------------------------------- from .util import * import time import torch import IPython from layers.sdf_matching_loss import SDFLoss class Cost(object): """ Cos...
the-stack_106_30142
# Write a Python Program to implement your own myreduce() function which works exactly # like Python's built-in function reduce() def myreduce(fnc, seq): count = seq[0] for next in seq[1:]: count = fnc(count, next) return count myreduce( (lambda x, y: x + y), [1, 2, 3, 4, 5])
the-stack_106_30143
from textwrap import dedent import warnings import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt from ._core import ( VectorPlotter, ) from .utils import ( ci_to_errsize, locator_to_legend_entries, ci as ci_func ) from .algorithms import bootstrap from .axisg...
the-stack_106_30145
# Copyright The PyTorch Lightning 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 agreed to i...
the-stack_106_30147
from __future__ import print_function from __future__ import absolute_import from __future__ import division from functools import partial try: import PySide2 except ImportError: from PySide import QtCore from PySide import QtGui import PySide.QtGui as QtWidgets else: from PySide2 import QtCore ...
the-stack_106_30148
import numpy as np import tensorflow as tf from tensorflow.contrib import rnn def _print_success_message(): print('Tests Passed') def test_create_lookup_tables(create_lookup_tables): with tf.Graph().as_default(): test_text = ''' Moe_Szyslak Moe's Tavern Where the elite meet to drink ...
the-stack_106_30149
# ########################################################################### # # CLOUDERA APPLIED MACHINE LEARNING PROTOTYPE (AMP) # (C) Cloudera, Inc. 2021 # All rights reserved. # # Applicable Open Source License: Apache 2.0 # # NOTE: Cloudera open source products are modular software products # made up of hun...
the-stack_106_30150
#!/usr/bin/env python # Copyright (c) 2014-2018 Michael Hirsch, Ph.D. """ converts right ascension, declination to azimuth, elevation and vice versa. Normally do this via AstroPy. These functions are fallbacks for those wihtout AstroPy. Michael Hirsch implementation of algorithms from D. Vallado """ from datetime imp...
the-stack_106_30152
#!/usr/bin/env python """ This is a test of the API Validator component, it's multimatch feature in particular. The treatment of each configured validator by the filter can be broken down into the following hierarchy: -> Not considered (N) -> Considered (C) -> Skipped (S) -> Considered (C) -> Tried (T) ...
the-stack_106_30153
from enum import Enum import logging from dialog_api import media_and_files_pb2 from dialog_bot_sdk.entities.Peer import Peer, PeerType from dialog_bot_sdk.entities.UUID import UUID from pymongo import MongoClient from config import * import requests from datetime import datetime, timedelta import re from time import s...
the-stack_106_30154
# coding=utf-8 # Copyright 2020 The Uncertainty Baselines 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 ap...
the-stack_106_30155
import os import sys from tkinter import * from tkinter import messagebox from turtle import right from buttonDict import buttonDict from operations import * from colorpallet import * class Application(Tk): def __init__(self, master=None): super().__init__() # Definição de...
the-stack_106_30156
# coding: utf-8 from functools import partial import sublime from sublime_plugin import WindowCommand from .util import StatusSpinner, noop from .cmd import GitCmd from .helpers import GitTagHelper, GitErrorHelper TAG_FORCE = u'The tag %s already exists. Do you want to overwrite it?' class GitAddTagCommand(Window...
the-stack_106_30157
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2020 fetchai # # 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 # #...
the-stack_106_30158
from rest_framework import serializers from .models import Author, FriendRequest, Friends,Post,Comment,VisibleToPost,Categories, Following,Image from django.utils import timezone from django.contrib.auth.models import User from django.contrib.auth import authenticate from django.utils.dateparse import parse_datetime fr...
the-stack_106_30159
import csv import emoji # https://www.mindk.com/blog/how-to-develop-a-chat-bot/ API_KEY = 'telegram token from gotfather bot' time_zone = 'Asia/Tel_Aviv' start_message = emoji.emojize('Hello and welcome to the Israel\'s rent apartment bot \U0001F1EE\U0001F1F1\U0001F1EE\U0001F1F1\U0001F1EE\U0001F1F1 \n' \ ...
the-stack_106_30160
#!/usr/bin/env python ''' A tool for analyzing the tools options for conflicts. This tool analyzes the c files in the directory given as the first argument for conflicting options within tpm command groups. The groups themselves are organized by the standard document: https://trustedcomputinggroup.org/wp-content/uploa...
the-stack_106_30161
from typing import Dict, Optional, Tuple import tokenizers import torch from torch import Tensor, nn from torch.nn import functional as F from torch.nn.modules.transformer import _get_activation_fn from whitespace_repair.model import tokenizer as toklib from whitespace_repair.model.embedding import Embedding from wh...
the-stack_106_30164
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ A package with units for generic executables. Usually, PE, ELF, and MachO formats are covered. """ class ParsingFailure(ValueError): def __init__(self, kind): super().__init__(F'unable to parse input as {kind} file') def exeroute(data, handl...
the-stack_106_30165
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import click import click_log import logging import os import sys from .mqtt_client import MqttClient from .config import load_config from .vbus import DeltaSol_BS_Plus __version__ = '0.0.0' @click.command() @click.version_option(version=__version__) @click.option('--co...
the-stack_106_30166
dict_chisla = {} # Представление числа ПРОСТОЕ ЧИСЛО: КОЛИЧЕСТВО flag_sost_chisla = False # Флаг составного числа prost_chislo = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, ...
the-stack_106_30167
#!/usr/bin/python # -*- encoding: utf-8 -*- import sys sys.path.insert(0, '.') import os import os.path as osp import random import logging import time import argparse import numpy as np from tabulate import tabulate import torch import torch.nn as nn import torch.distributed as dist from torch.utils.data import Data...
the-stack_106_30168
from fairness.data.objects.Data import Data class Adult(Data): def __init__(self): Data.__init__(self) self.dataset_name = 'adult' self.class_attr = 'income-per-year' self.positive_class_val = '>50K' self.sensitive_attrs = ['race', 'sex'] self.privileged_class_names...
the-stack_106_30169
import sys import datetime as dt import pytest import numpy as np # Construction class D: def __index__(self) -> int: return 0 class C: def __complex__(self) -> complex: return 3j class B: def __int__(self) -> int: return 4 class A: def __float__(self) -> float: ...
the-stack_106_30170
import os import math import time import warnings warnings.filterwarnings('ignore') import numpy as np import torch import torch.nn as nn from torch import optim from torch.utils.data import DataLoader from torch.autograd import Variable from torch.utils.tensorboard import SummaryWriter from experiments.exp_basic im...
the-stack_106_30172
from django.shortcuts import render from django.urls import reverse_lazy from django.views.generic import FormView from pointtracker.forms import PointTrackerLoginForm from swesite.contexts.swe_social_context import swe_social from swesite.contexts.swe_volunteer_context import swe_volunteer from users.spreadsheet impo...
the-stack_106_30173
# -*-coding:utf-8-*- # 天堂图片网爬取高质量图片 import urllib.request as urllib2 import os import random, re from bs4 import BeautifulSoup ''' # user_agent是爬虫与反爬虫斗争的第一步 ua_headers = { 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0', }''' # 用于模拟http头的User-agent ua_list = [ ...
the-stack_106_30174
from typing import List, Tuple import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor from .modules import activations, norm2d class DoubleConv2d(nn.Module): def __init__( self, in_channels: int, out_channels: int, norm: str = "identity", ...
the-stack_106_30175
"""operating system relevant deploy functions author: Andreas Poehlmann """ import argparse import ctypes import logging import os import platform import shutil import subprocess import sys import tempfile import time import zipfile from textwrap import dedent from builtins import input, str from future.standard_libr...
the-stack_106_30177
# coding: utf-8 # In[ ]: class Solution: # @param a list of integers # @return an integer #算法思路: #step1:创建两个indices,一个read,一个write,分别开始遍历整个array #step2:read和write的遍历方式不一样,write遇到replicate会停下,read不会停下 #step3:write如果停下,那么它要等到read将replicate的部分走完了,它才能前进 #step4:如果前后没有duplicate,A[write]=A[read] def removeDupl...
the-stack_106_30178
# # Copyright 2019 The FATE 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...
the-stack_106_30181
import math from django import template from django.utils.html import format_html from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ register = template.Library() def _review_score_number(context, score): if score is None: return "×" score = round(s...
the-stack_106_30185
#!/usr/bin/env python3 import importlib import inspect import json import os import re import shutil import subprocess import sys import textwrap import traceback from pathlib import Path from typing import Any from unittest.mock import patch from ansi2html import Ansi2HTMLConverter from devtools import PrettyFormat ...
the-stack_106_30186
from __future__ import absolute_import import sys from argparse import ArgumentParser import pytest from configargparse import Namespace from pytest_mock.plugin import MockerFixture from snakebids.admin import gen_parser @pytest.fixture def parser(): return gen_parser() class TestAdminCli: def test_fails...
the-stack_106_30187
"""Mapping registries for Zigbee Home Automation.""" from __future__ import annotations import collections from typing import Callable, Dict import attr from zigpy import zcl import zigpy.profiles.zha import zigpy.profiles.zll from homeassistant.components.alarm_control_panel import DOMAIN as ALARM from homeassistan...
the-stack_106_30190
from odoo import models, fields, api STATES = {"draft": [("readonly", False)]} def compute_partition_amount(amount, line_amount, total_amount): if total_amount > 0: return round(amount * line_amount / total_amount, 2) return 0 class PurchaseOrder(models.Model): _inherit = "purchase.order" ...
the-stack_106_30191
import os from unittest import TestCase from checkov.cloudformation.graph_builder.graph_components.block_types import BlockType from checkov.cloudformation.graph_manager import CloudformationGraphManager from checkov.cloudformation.parser import parse from checkov.common.graph.db_connectors.networkx.networkx_db_connec...
the-stack_106_30193
import uuid from office365.sharepoint.fields.field import Field from office365.sharepoint.fields.field_creation_information import FieldCreationInformation from office365.sharepoint.fields.field_type import FieldType from office365.sharepoint.views.view_field_collection import ViewFieldCollection from tests import cre...
the-stack_106_30194
# pylint: disable=too-many-lines # 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) AutoRe...
the-stack_106_30196
from django.db.models import Q, Sum, OuterRef, Subquery, F, Value, Case, When, Max from rest_framework.request import Request from rest_framework.response import Response from typing import Any from usaspending_api.accounts.models.appropriation_account_balances import AppropriationAccountBalances from usaspending_api.a...
the-stack_106_30198
import random from service import formatter from . import GeorefLiveTest, asciifold class SearchStreetsTest(GeorefLiveTest): """ Pruebas de búsqueda de calles. Ir al archivo test_addresses.py para ver los tests de búsqueda de calles por dirección (nombre + altura). """ def setUp(self): ...