text
stringlengths
2
999k
import bpy from . import utils as ut error_bdx_not_installed = "BDX add-on not installed!" error_bdx_project_missing = "BDX project missing!" error_bdx_java_pack = "Java packages are not in sync with BDX project!" class JavaPackageSynchronizer(bpy.types.Operator): bl_description = "Sychronizes package names of jav...
import torch from torchvision import transforms import psychopy.visual import psychopy.event def make_grating(freq, theta, phase, sz=32, grating=None, win=None): was_none = False if win is None: was_none = True win = psychopy.visual.Window( size=(sz, sz), units="pix", ...
import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer calotowersAnalyzer = DQMEDAnalyzer('CaloTowersValidation', outputFile = cms.untracked.string(''), CaloTowerCollectionLabel = cms.untracked.InputTag('towerMaker'), hcalselector = cms.u...
#!/usr/bin/python # Import necessary libraries/modules import os import sys sys.path.append(os.path.join("..", "..")) import argparse import numpy as np from sklearn import metrics from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from...
import mock import zeit.brightcove.convert import zeit.brightcove.testing import zeit.cms.testing from zeit.brightcove import convert class NotificationTest(zeit.brightcove.testing.BrowserTestCase): def test_runs_import_as_system_user(self): # View is available without authentication b = zeit.cms...
from __future__ import absolute_import, unicode_literals import logging import pykka logger = logging.getLogger(__name__) def send(cls, event, **kwargs): listeners = pykka.ActorRegistry.get_by_class(cls) logger.debug('Sending %s to %s: %s', event, cls.__name__, kwargs) for listener in listeners: ...
# src: https://github.com/OpenNMT/OpenNMT-py/blob/master/onmt/decoders/decoder.py class DecoderState(object): """Interface for grouping together the current state of a recurrent decoder. In the simplest case just represents the hidden state of the model. But can also be used for implementing variou...
from direct.directnotify import DirectNotifyGlobal from direct.task import Task from direct.showbase.PythonUtil import lerp, average from toontown.toonbase.PythonUtil import clampScalar from toontown.toonbase import TTLocalizer import random, time, weakref class PetMood: notify = DirectNotifyGlobal.directNotify.ne...
import csv import cv2 import sklearn import numpy as np import matplotlib.image as mpimg from keras.models import Sequential from keras.layers import Dense, Activation, Lambda, Convolution2D, MaxPooling2D from sklearn.model_selection import train_test_split path ='/home/workspace/CarND-Behavioral-Cloning-P3/data/' ## ...
from route_distances.utils.routes import ( calc_depth, calc_llr, extract_leaves, is_solved, route_score, route_scorer, route_ranks, ) def remove_in_stock(tree_dict): if "in_stock" in tree_dict: del tree_dict["in_stock"] for child in tree_dict.get("children", []): re...
# -*- Mode: Python -*- # GObject-Introspection - a framework for introspecting GObject libraries # Copyright (C) 2008 Johan Dahlin # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; eithe...
from django.conf.urls import include, patterns, url from django.views.generic.base import RedirectView from . import views USER_ID = r"""(?P<user_id>[^/<>"']+)""" # These will all start with /user/<user_id>/ detail_patterns = patterns( '', url('^$', views.profile, name='users.profile'), url('^themes(?:...
import FWCore.ParameterSet.Config as cms # This modifier is for SiPixel-specific changes run2_SiPixel_2018 = cms.Modifier()
from .base import * # noqa
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
""" Implementation of all available options """ from __future__ import print_function import configargparse import onmt from onmt.models.sru import CheckSRU def config_opts(parser): print("HI THERE EVERYBUGGY!") parser.add('-config', '--config', required=False, is_config_file_arg=True, help='...
ips = [ 'www.google.com', 'www.wikipedia.com', 'www.microsoft.com', 'www.amazon.com', 'www.yahoo.com', 'www.apple.com' ]
#!/usr/bin/env python """ ############################### Incident Package Work Book View ############################### """ # -*- coding: utf-8 -*- # # rtk.incident.WorkBook.py is part of The RTK Project # # All rights reserved. # Copyright 2007 - 2017 Andrew Rowland andrew.rowland <AT> reliaqual <DOT> com # #...
import requests import getpass class Metabase_API(): def __init__(self, domain, email, password=None): self.domain = domain self.email = email self.password = getpass.getpass(prompt='Please enter your password: ') if password is None else password self.session_id = None self.header = None...
""" @brief test tree node (time=50s) """ import os import unittest from pyquickhelper.loghelper import fLOG from pyquickhelper.pycode import get_temp_folder, ExtTestCase class TestReadme(ExtTestCase): def test_venv_docutils08_readme(self): fLOG( __file__, self._testMethodName...
"""The :mod:`estimator` module defines a ``PushEstimator`` class.""" import json from typing import Union, Tuple, Sequence import pyshgp.gp.search as sr import pyshgp.gp.selection as sl import pyshgp.gp.variation as vr from pyshgp.gp.evaluation import DatasetEvaluator from pyshgp.gp.genome import GeneSpawner from pysh...
""" This script is needed to convert gdb scripts from commands to documentation """ import os def convert_commands_to_docs(): commands_dir = os.getcwd() + "/numba_dppy/examples/debug/commands" examples = os.listdir(commands_dir) os.chdir(commands_dir + "/docs") for file in examples: if file !=...
import matplotlib.pyplot as plt import seaborn as sns from argparse import ArgumentParser from itertools import cycle def parse_args(): argparser = ArgumentParser() argparser.add_argument('file') return argparser.parse_args() if __name__ == "__main__": args = parse_args() experiments = {} with...
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# -*- mode: python; encoding: utf-8 -*- # # Copyright 2012 Jens Lindström, Opera Software ASA # # 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...
""" Estimates likelihood of generated data using kernel density estimation Author(s): Wei Chen (wchen459@umd.edu) """ import numpy as np from utils import mean_err def sample_line(d, m, bounds): # Sample m points along a line parallel to a d-dimensional space's basis basis = np.random.choice(d) c = np.z...
# coding: utf-8 """ Isilon SDK Isilon SDK - Language bindings for the OneFS API # noqa: E501 OpenAPI spec version: 2 Contact: sdk@isilon.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import isi_sdk_7_2 from isi...
import os import pytest import shutil from django.conf import settings @pytest.yield_fixture def cleanup_static_files(): static_files_dir = settings.STATICFILES_DIRS[0] if os.path.isdir(static_files_dir): shutil.rmtree(static_files_dir) yield if os.path.isdir(static_files_dir): shutil....
#!/usr/bin/python ''' Reads in the output of find_pictures.py and prints out some statistics. ''' from collections import defaultdict import fileinput import json rect_counts = [0] * 10 for line in fileinput.input(): d = json.loads(line) f = str(d['file']) if 'rects' not in d: rect_counts[0] += 1 else: ...
#!/usr/bin/python3 # # Notes: # o the master file is bbi-dmux-data/illumina_run_parameters/src/run_info.py # Make changes to the master file and distribute # to all other pipelines that use it in order to # maintain consistency. # o this script is used in # o bbi-dmux-data/illumina_run_par...
#!/usr/bin/env python3 # Copyright (c) 2014-2017 Wladimir J. van der Laan # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Script to generate list of seed nodes for chainparams.cpp. This script expects two text files in the dir...
from .BlockDevice import BlockDevice class ADFBlockDevice(BlockDevice): # number of total sectors for DD/HD disks DD_SECS = 80 * 2 * 11 HD_SECS = 80 * 2 * 22 # byte size (without/with error code byte) DD_IMG_SIZES = (DD_SECS * 512, DD_SECS * 513) HD_IMG_SIZES = (HD_SECS * 512, HD_SECS * 513)...
import matplotlib matplotlib.use('Agg') import itertools import pickle import scipy import sys import pandas as pd from pandas import DataFrame as df import numpy as np import matplotlib.pyplot as plt from net import Net from tqdm import tqdm from sklearn import preprocessing from laplotter import LossAccPlotter fro...
#!/usr/bin/env python import sys import pytest import subprocess def run(cmd): proc = subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr = subprocess.PIPE, ) stdout, stderr = proc.communicate() return proc.returncode, stdout.decode("utf-8"), stderr.decode("utf-8") def test_map__...
from cougar.graphs.modules import L2Norm import torch def test_L2Norm(): input = torch.randn(1, 512, 38, 38) m = L2Norm(n_channels=512, scale=20) out = m(input) assert out.shape == input.shape
import komand from .schema import GetSiteInput, GetSiteOutput # Custom imports below from komand_rapid7_insightvm.util import endpoints from komand_rapid7_insightvm.util.resource_requests import ResourceRequests class GetSite(komand.Action): def __init__(self): super(self.__class__, self).__init__( ...
from .constants import * from numpy import random import cmath class Body: def __init__(self, mass, position, velocity, density=Density, color=None, name=None, charge=None): self.mass = mass self.mass0 = mass self.density = density self.radius = int((mass / density) ** (1 / 3)) ...
#------------------------------------------------------------- # Name: Local Data to Layer # Purpose: Converts CSV, Excel, GPX, KML or shapefile to a layer. # Author: Shaun Weston (shaun_weston@eagle.co.nz) # Date Created: 27/06/2016 # Last Updated: 20/07/2016 # Copyright: (c) Eagle Technology # Ar...
""" This is a basic example which checks syntax. """ from PyFunceble import ipv4_syntax_check as PyFuncebleIPv4Syntax from PyFunceble import is_ipv4_range, is_subdomain from PyFunceble import syntax_check as PyFuncebleDomainSyntax from PyFunceble import url_syntax_check as PyFuncebleURLSyntax print("Start of basic ex...
import numpy as np import pytest import sympy from sympy import cos, cosh, simplify, sin, sinh, symbols, tensorcontraction from einsteinpy.symbolic import ( EinsteinTensor, MetricTensor, RicciScalar, simplify_sympy_array, ) def schwarzschild_metric(): symbolstr = "t r theta phi" syms = sympy....
# -*- coding: utf-8 -*- # occiput # Harvard University, Martinos Center for Biomedical Imaging # Aalto University, Department of Computer Science __all__ = ['KSpace', 'MR_Static_Scan', 'MR_Dynamic_Scan'] from .MR import KSpace, \ MR_Static_Scan, \ MR_Dynamic_Scan
#!/usr/bin/env python3 """ Driver script to run matrix multiply experiments """ import os import json from subprocess import Popen, PIPE import datetime RESULT_FILE = "results.json" XTENSA_CORE = "XTENSA_CORE" DEVICE_TARGET = "FUSION_G3" if __name__ == "__main__": if XTENSA_CORE not in os.environ: #...
import pandas import bokeh from bokeh.functional import * df = pandas.read_csv("../auto-mpg.csv") s = ggplot(df, aes("displ", "mpg", color="red")) + geom_point() u = ggplot(df, aes("hp", "weight")) + \ aes(color="green") + \ geom_point() with open("two.1.html", "w") as f: f.write(s.to_html()) w...
from __future__ import unicode_literals import re import warnings import pytest from scipy import sparse from sklearn.externals.six import PY2 from sklearn.feature_extraction.text import strip_tags from sklearn.feature_extraction.text import strip_accents_unicode from sklearn.feature_extraction.text import strip_acce...
# Generated by Django 3.2.9 on 2021-11-02 04:34 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0002_neighbourhood_events'), ] operations = [ migrations.CreateModel( name='Location', fields=[ ...
# -*- coding: utf-8 -*- # __author__ = u"Nico Schlömer" __email__ = "nico.schloemer@gmail.com" __copyright__ = u"Copyright (c) 2018, {} <{}>".format(__author__, __email__) __license__ = "License :: OSI Approved :: MIT License" __version__ = "0.1.3" __status__ = "Development Status :: 4 - Beta"
# -*- coding: utf-8 -*- class ClientError(Exception): """Generic error class, catch-all for most client issues. """ def __init__(self, msg, code=None): self.code = code or 0 super(ClientError, self).__init__(msg) @property def msg(self): return self.args[0] class ClientL...
from django.forms import CharField, PasswordInput from _utils.passwords.validators import (validate_length, common_sequences, dictionary_words, complexity) class PasswordField(CharField): default_validators = [ validate_length, common_sequences, dictiona...
from math import radians, sin, cos, asin, degrees, pi, sqrt, pow, fabs, atan2 def parse_dxf(dxf_f, material_gallery): output = {} layer_color = {} flag = False x = 0 value = 'dummy' while value !='ENTITIES': key = dxf_f.readline().strip() value = dxf_f.readline().strip() ...
import sys class MergeSol(): def __init__(self): self.order = list() self.fname = './ERC20Token.sol' self.target = './SingleFile.sol' def parseParameters(self): if len(sys.argv) < 3: print('ERROR: 3 or more arguments expected, %d were given' % (l...
# Code generated by github.com/lolopinto/ent/ent, DO NOT edit. """add contact_allow_list_edges table Revision ID: 5736f5b2270e Revises: 7e7c1a878163 Create Date: 2019-10-14 20:03:39.311792+00:00 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, us...
from abc import ABC, abstractmethod from slm_lab.agent.net import net_util from slm_lab.lib import logger, util from slm_lab.lib.decorator import lab_api import numpy as np logger = logger.get_logger(__name__) class Algorithm(ABC): '''Abstract Algorithm class to define the API methods''' def __init__(self, ...
import sys import os current_path = os.path.dirname(os.path.realpath(__file__)) root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) sys.path.append(root_path) import torch.multiprocessing as mp import experiments.options as options from experiments.nmt import main as single_process_main def ma...
# Copyright 2017 Klarna Bank 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 or agreed to in writi...
checkpoint_config = dict(interval=1) log_config = dict( interval=50, hooks=[ dict(type='TextLoggerHook'), dict(type='TensorboardLoggerHook') ]) dist_params = dict(backend='nccl') log_level = 'INFO' work_dir = None load_from = None resume_from = None workflow = [('train', 1)] lr = 1e-3 opti...
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------------------------------------...
''' 8-15. Printing Models: Put the functions for the example printing_models.py in a separate file called printing_functions.py. Write an import statement at the top of printing_models.py, and modify the file to use the imported functions. ''' from printing_functions import car_specs print(car_specs('Model s','Tesla'...
import json from schematics.exceptions import ConversionError, DataError from nose.tools import eq_,raises from moncli import column_value as cv from moncli.enums import ColumnType, PeopleKind from moncli.models import MondayModel from moncli.types import PeopleType def test_should_succeed_when_to_native_returns_a_l...
#!/usr/bin/python # # Copyright 2018-2021 Polyaxon, 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 ...
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from python_targets.test_library import say_test # type: ignore[import] say_test()
class ReducedFunctionalityWarning(Warning): "Reduced networkit functionality warning" pass
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-06-05 08:27 from __future__ import unicode_literals import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('driver', '0003_auto_20170605_1120'), ] operations = [ migrati...
#!/usr/bin/env python3 # # Copyright (c) 2012-2020 MIRACL UK Ltd. # # This file is part of MIRACL Core # (see https://github.com/miracl/core). # # 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...
import npyscreen from models.Club import Club class EditClub(npyscreen.ActionFormV2): def create(self): self.value = None self.wgName = self.add(npyscreen.TitleText, name="Name:") self.wgNumberOfTrophies = self.add(npyscreen.TitleText, name="Number of trophies:") self.wgCreationDa...
from pygsheets.spreadsheet import Spreadsheet from pygsheets.utils import format_addr from pygsheets.exceptions import InvalidArgumentValue from pygsheets.custom_types import ValueRenderOption, DateTimeRenderOption from googleapiclient import discovery from googleapiclient.errors import HttpError import logging impor...
__author__ = 'Neil Butcher' import os from PyQt4 import QtGui, QtCore, uic from PyQt4.QtCore import pyqtSignal from commands_person import CommandChangePerson, CommandChangePersonBlacklist from Rota_System.UI.Roles import RoleListWidget class PersonWidget(QtGui.QWidget): commandIssued = pyqtSignal(QtGui.QUndoCom...
#!/usr/bin/env python3 import time, argparse import numpy as np import arkouda as ak import arkouda.client def time_ak_noop(trial_time): print(">>> arkouda noop") start = time.time() trials = 0 while time.time() - start < trial_time: trials += 1 arkouda.client._no_op() end = time.t...
import numpy as np from utils import l2_dist from nns import linear_fit, load_vec, get_args threshold = 1000 args = get_args() # args.embed = 'gru' # xq_gru, xb_gru, xt_gru, train_dist, query_dist = load_vec(args) # query_dist = query_dist[:, :50000] # xb_gru = xb_gru[:50000, :] # # train_idx = np.where(train_dist...
# -*- coding: utf-8 -*- # # Concreate documentation build configuration file, created by # sphinx-quickstart on Thu Sep 7 12:51:05 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # #...
# -------------- import numpy as np import pandas as pd import seaborn as sns from sklearn.model_selection import train_test_split import warnings warnings.filterwarnings('ignore') # Code starts here df = pd.read_csv(path) print(df.head(5)) X = df.drop('insuranceclaim',axis=1) y = df['insuranceclaim'] X_train,X_test,y...
import datetime import decimal import uuid import pytest import typesystem import typesystem.formats class Person(typesystem.Schema): name = typesystem.String(max_length=100, allow_blank=False) age = typesystem.Integer() class Product(typesystem.Schema): name = typesystem.String(max_length=100, allow_...
# This file is part of listparser. # Copyright 2009-2021 Kurt McKee <contactme@kurtmckee.org> # SPDX-License-Identifier: MIT # from typing import Callable, Dict, List, Tuple, Union from .exceptions import ListparserError namespaces = { 'http://opml.org/spec2': 'opml', 'http://www.google.com/ig': 'iGoogle', ...
from datetime import date, timedelta import re from bs4 import BeautifulSoup import requests class Job(object): '''Stores per job data. Attributes: position: Position title. description_link: Description link. company_name: Company name. company_url: Company URL. job_...
from .instance import BlockchainInstance from datetime import datetime, timedelta from .utils import ( formatTimeFromNow, formatTime, formatTimeString, assets_from_string) from .asset import Asset from .amount import Amount from .price import Price, Order, FilledOrder from .account import Account from bitsharesbase...
from .retrieve import *
# -*- coding: utf-8 -*- # # Copyright 2019 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...
import json import random from enum import Enum class Dimension(Enum): """ Represents a Minecraft dimension. """ OVERWORLD = "minecraft:overworld" NETHER = "minecraft:the_nether" END = "minecraft:the_end" class JSONText: """ A JSON text element that allows formatting. Minecraft...
"""Support for ISY994 sensors.""" from __future__ import annotations from pyisy.constants import ISY_VALUE_UNKNOWN from homeassistant.components.sensor import DOMAIN as SENSOR, SensorEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT from homeassi...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf import settings from django.conf.urls import include, url from django.conf.urls.static import static from django.contrib import admin from django.views.generic.base import TemplateView api_patterns = [ url(r'^questions/', include('at...
from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models from django_fsm import FSMField, FSMKeyField, transition, RETURN_VALUE, GET_STATE, ConcurrentTransitionMixin class Application(models.Model): """ Student app...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** 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 from ... import _utilities, _tables from...
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: diplomacy_tensorflow/contrib/mpi_collectives/mpi_message.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message...
class C(object): def get_self(self): return self class D(C): def foo(self): pass d = D() print(d.foo()) print(d.get_self().foo()) # pass
from django.db import models from .core.entity import Entity class Instance(models.Model, Entity): uid = models.CharField('Unique identifier', max_length=255, editable=False, unique=True) description = models.CharField(max_length=255) def __str__(self): return self.uid def data(self): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Data Structures =============== Defines various data structures classes: - :class:`Structure`: An object similar to C/C++ structured type. - :class:`Lookup`: A *dict* sub-class acting as a lookup to retrieve keys by values. """ from __future__ import divisio...
import requests import json with open("sample_webhook_payload.json") as file: data = json.load(file) response = requests.post("http://127.0.0.1:5000/webhook", json=data) print(response)
# Secret Sign Damage Skin Coupon success = sm.addDamageSkin(2435638) if success: sm.chat("The Secret Sign Damage Skin Coupon has been added to your account's damage skin collection.")
# -*- coding: utf-8 -*- from uamobile.base import UserAgent, Display class SoftBankUserAgent(UserAgent): carrier = 'SoftBank' short_carrier = 'S' serialnumber = None def get_flash_version(self): """ returns Flash Lite version. """ from uamobile.data.flash.softbank impor...
#!/usr/bin/env python3 import json import os import unittest import random from PIL import Image, ImageDraw, ImageFont from cereal import log, car from common.basedir import BASEDIR from common.params import Params from selfdrive.controls.lib.events import Alert, EVENTS, ET from selfdrive.controls.lib.alertmanager imp...
# Copyright 2017-present Open Networking 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-2.0 # # Unless required by applicable law or agr...
# -*- coding: utf-8 -*- # Define here the models for your spider middleware # # See documentation in: # http://doc.scrapy.org/en/latest/topics/spider-middleware.html from scrapy.conf import settings import random class RandomUserAgentMiddleware(object): def process_request(self, request, spider): ua = ra...
#!/usr/bin/env python # coding=utf-8 """MetricsEvaluator engine action. Use this module to add the project main code. """ from .._compatibility import six from .._logging import get_logger from marvin_python_toolbox.engine_base import EngineBaseTraining from ..model_serializer import ModelSerializer __all__ = ['Me...
from __future__ import division, print_function import argparse import matplotlib.image as mpimg import matplotlib.pyplot as plt import numpy as np import os import random def init_centroids(num_clusters, image): """ Initialize a `num_clusters` x image_shape[-1] nparray to RGB values of randomly chosen pi...
#!/usr/bin/env python # Copyright 2014-2021 The PySCF Developers. 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 # # U...
QUESTIONS = [ { "question": "Gdzie się kopie", "answers": [ { "answer": "NA BOISKU", "score": "24" }, { "answer": "W ZIEMI", "score": "15" }, { "answer": "W OGRODZIE", "score": "14" }, { "answer": "NA CMENTARZU",...
from typing import Iterable, List, NamedTuple, Sequence, Tuple import torch from .types import Shape, ShapeRange from .utils import get_dynamic_dims class InputTensorSpec(NamedTuple): """ This class contains the information of a input tensor. shape: shape of the tensor. dtype: dtyep of the tensor....
# Copyright 2018 Google, 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 applicable law or ...
from app import create_app,db from app.models import User from flask_script import Manager,Server from flask_migrate import Migrate, MigrateCommand # Creating app instance app = create_app('production') manager = Manager(app) manager.add_command('server',Server) migrate = Migrate(app,db) manager.add_command('db',Mi...
# Copyright © 2019 Province of British Columbia # # 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...
from rest_framework import status from ee.api.test.base import APILicensedTest from ee.models.dashboard_privilege import DashboardPrivilege from posthog.models import Dashboard, OrganizationMembership, Team, User class TestDashboardCollaboratorsAPI(APILicensedTest): test_dashboard: Dashboard def setUp(self)...