text
stringlengths
2
999k
''' Question 1 Skeleton Code ''' import sklearn import numpy as np from sklearn.datasets import fetch_20newsgroups from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn.naive_bayes import BernoulliNB from sklearn.linear_model import LogisticRegression from sklearn.linear_model im...
# %% from __future__ import print_function import pickle import numpy as np import pandas as pd from bitarray import bitarray try: # Open Babel >= 3.0 from openbabel import openbabel as ob except ImportError: import openbabel as ob import sys import os import argparse from time import time # from timeout im...
# TODO: CAMPid 0970432108721340872130742130870874321 import importlib import pkg_resources major = int(pkg_resources.get_distribution(__name__.partition('.')[0]).version.partition(".")[0]) def import_it(*segments): m = { "pyqt_tools": "pyqt{major}_tools".format(major=major), "pyqt_plugi...
# -------------------------------------------------------- # Faster R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick and Sean Bell # -------------------------------------------------------- # ------------------------------------------------------...
""" postgres.store ~~~~~~~~~~~~~~ Interface with helper routines for persisting, finding, etc from a postgresql database. """ import goldman import goldman.exceptions as exceptions import goldman.signals as signals from ..base import Store as BaseStore from ..postgres.connect import Connect from gold...
# -*- coding: utf-8 -*- """A Python implemntation of a kd-tree This package provides a simple implementation of a kd-tree in Python. https://en.wikipedia.org/wiki/K-d_tree """ from __future__ import print_function import heapq import itertools import operator import math from collections import deque from functools...
from . import db # connect class user to pitchperfect database class User(db.Model): __table__ = 'users' id = db.Column()
from speaker_encoder.data_objects.speaker_verification_dataset import SpeakerVerificationDataset from speaker_encoder.data_objects.speaker_verification_dataset import SpeakerVerificationDataLoader
# Singly-linked lists are already defined with this interface: class ListNode(object): def __init__(self, x): self.value = x self.next = None def condense_linked_list(node): # Reference the current node's value current = node # List to store the values condensed_list = [] # Loop...
#!/usr/bin/python # # Copyright (c) 2016, Nest Labs, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright # notice, thi...
import eight_puzzle from collections import deque from copy import deepcopy from time import time from operator import attrgetter class eight_puzzle_node(): def __init__(self, puzzle, choice, choiceList, nodeId): result = False self.puzzle_state = puzzle.make_child() if choice != '.': ...
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the #...
import numpy as np import ray from garage import TimeStepBatch from garage.envs import GarageEnv, PointEnv from garage.experiment import deterministic, LocalRunner from garage.sampler import LocalSampler, WorkerFactory from garage.torch.algos import BC from garage.torch.policies import DeterministicMLPPolicy, Gaussian...
from django.apps import AppConfig class AgentsConfig(AppConfig): name = 'geoq.agents' verbose_name = 'GeoQ Agents'
import tensorflow as tf from tensorflow.keras.initializers import RandomUniform from tensorflow.keras.layers import concatenate, Input, Activation, Add, Conv2D, Lambda from tensorflow.keras.models import Model from ISR.models.imagemodel import ImageModel WEIGHTS_URLS = { 'gans': { 'arch_params': {'C': 4, ...
# Copyright 2020 - 2021 MONAI Consortium # 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 wri...
#!/usr/bin/env python2 # # Simulate pool allocator behavior against a memory allocation log written # by duk_alloc_logging.c or in matching format. Provide commands to provide # statistics and graphs, and to optimize pool counts for single or multiple # application profiles. # # The pool allocator simulator incor...
from pyradioconfig.parts.common.calculators.calc_profile_base_beta1 import CALC_Profile_Base class Calc_Legacy_Vars_Ocelot(CALC_Profile_Base): #Inherit all for now pass
import os from argparse import ArgumentError from string import Template import yaml class Docker(object): @staticmethod def _get_main_docker_compose_service(): for name, info in Docker._gel_all_docker_compose_services().items(): if 'build' in info: return name @stati...
from django import template import json register = template.Library() @register.filter def percent_of(value, arg): """Removes all values of arg from the given string""" return round(value/arg *100) @register.filter def to_int(value): return round(value) @register.filter def to_json(value): return json.dump...
# -*- coding: utf-8 -*- # A li’l class for data URI manipulation in Python. # Source: https://gist.github.com/zacharyvoase/5538178 # This code is released under the Unlicense (c.f. http://unlicense.org/). import mimetypes import re import urllib MIMETYPE_REGEX = r'[\w]+\/[\w\-\+\.]+' _MIMETYPE_RE = re.compile('^{}$...
from diofant.combinatorics import (AbelianGroup, AlternatingGroup, CyclicGroup, DihedralGroup, SymmetricGroup) __all__ = () def test_SymmetricGroup(): G = SymmetricGroup(5) elements = list(G.generate()) assert (G.generators[0]).size == 5 assert len(elements) == 120...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import itertools as it import urllib from bob.data_table import DataTableColumn from django.contrib import messages from django.core.urlresolve...
from flask_wtf import FlaskForm from flask_wtf.file import FileField, FileAllowed from wtforms import StringField, PasswordField, SubmitField, BooleanField from wtforms.validators import DataRequired, Length, Email, EqualTo, ValidationError from flask_login import current_user from ..models import User class Registra...
#!/usr/bin/env python # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # ---------------------------------------------...
# -*- coding: utf-8 -*- """ Created on Wed Apr 29 00:13:43 2020 Multilevel inheritece @author: Ayush Gupta """ class A: #base class def class_a_method(self): return 'i\'m just a method' def hello(self): #class fuction return 'hello from...
import copy import numpy as np import torch import os import sys sys.path.insert(0, os.environ['ALFRED_ROOT']) from agents.utils.misc import extract_admissible_commands def evaluate_vision_dagger(env, agent, num_games, debug=False): env.seed(42) agent.eval() episode_no = 0 res_points, res_steps, res_...
#!/usr/bin/python # coding: utf-8 -*- # Copyright (c) 2014 Hewlett-Packard Development Company, L.P. # Copyright (c) 2013, Benno Joy <benno@ansible.com> # Copyright (c) 2013, John Dewey <john@dewey.ws> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import ...
# 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 django.contrib import admin from .models import Tag, Project # Register your models here. admin.site.register(Project) admin.site.register(Tag)
class Color(): BLACK = lambda x: '\u001b[30m' + str(x) RED = lambda x: '\u001b[91m' + str(x) GREEN = lambda x: '\u001b[92m' + str(x) YELLOW = lambda x: '\u001b[93m' + str(x) BLUE = lambda x: '\u001b[94m' + str(x) MAGENTA = lambda x: '\u001b[95m' + str(x) CYAN = lambda x: '\u001b[96m' + str(x...
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
# Generated by Django 3.0.4 on 2020-03-30 19:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('main', '0003_auto_20200326_0012'), ] operations = [ migrations.AddField( model_name='createshoprecommendation', name...
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author: Donny You(donnyyou@163.com) # Make proposals that each consists of all possible keypoints. import math import numpy as np import torch from scipy.spatial.distance import cosine from scipy.ndimage.filters import gaussian_filter from torch.autograd import Variable ...
DB_NAME = 'otus_web_06'
"""Python parser generator This parser generator transforms a Python grammar file into parsing tables that can be consumed by Python's LL(1) parser written in C. Concepts -------- * An LL(1) parser (Left-to-right, Leftmost derivation, 1 token-lookahead) is a top-down parser for a subset of context-free languages....
class Linear(Module): __parameters__ = ["weight", "bias", ] __buffers__ = [] weight : Tensor bias : Tensor training : bool def forward(self: __torch__.torch.nn.modules.linear.___torch_mangle_9502.Linear, argument_1: Tensor) -> Tensor: _0 = self.bias output = torch.matmul(argument_1, torch.t(self...
# Author: Yuan Yao <yy682@cornell.edu> # # This file is an example to set the environment. # The configs will be used in shciscf.py # import os PYSCF_HOME = '/home/yuanyao/pyscf_my_csv/' SHCIEXE = '/home/yuanyao/SHCI/shci/shci_64' SHCIRUNTIMEDIR = '.' MPIPREFIX = '' SHCILIB = PYSCF_HOME + 'pyscf/future/shciscf/SHCI_...
# -*- coding: utf-8 -*- from common import * def test_1282(env): conn = getConnectionByEnv(env) env.expect('FT.CREATE', 'idx', 'ON', 'HASH', 'SCHEMA', 'txt1', 'TEXT').ok() env.assertEqual(conn.execute_command('hset', 'doc1', 'txt1', 'foo'), 1) # optional search for new word would crash server env.expect('F...
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2018, 2020. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
import os import time import boto3 import pytest from moto import mock_s3 from megfile.lib import s3_share_cache_reader from megfile.lib.s3_share_cache_reader import S3ShareCacheReader from megfile.utils import thread_local from tests.test_s3 import s3_empty_client BUCKET = 'bucket' KEY = 'key' def...
import torch import torch.nn as nn from args import get_parser # read parser parser = get_parser() args = parser.parse_args() class Norm(nn.Module): def forward(self, input, p=2, dim=1, eps=1e-12): return input / input.norm(p, dim, keepdim=True).clamp(min=eps).expand_as(input) class LstmFlatten(nn.Module...
import string import pytest from spelling import suggest_word, load_words @pytest.fixture(scope="module") def a_words(): """Get only a[abcdefghijklm]-words to speed up tests""" words = load_words() return { word for word in words if word.startswith("a") and len(word) > 1 ...
from sklearn.linear_model import LogisticRegression from MLFeatureSelection import sequence_selection as ss from sklearn.metrics import log_loss import pandas as pd import numpy as np from sklearn.model_selection import KFold def prepareData(): df = pd.read_csv('clean_train.csv') Title = list(np.unique(df.Titl...
import numpy as np from skimage.restoration import inpaint from skimage._shared import testing from skimage._shared.testing import assert_allclose def test_inpaint_biharmonic_2d(): img = np.tile(np.square(np.linspace(0, 1, 5)), (5, 1)) mask = np.zeros_like(img) mask[2, 2:] = 1 mask[1, 3:] = 1 ma...
# Check that the LNT REST JSON API is working. # create temporary instance # RUN: rm -rf %t.instance # RUN: python %{shared_inputs}/create_temp_instance.py \ # RUN: %s %{shared_inputs}/SmallInstance \ # RUN: %t.instance %S/Inputs/V4Pages_extra_records.sql # # RUN: python %s %t.instance %{tidylib} import unitte...
from django.contrib import admin from django102.models.game import Game from django102.models.person import Person from django102.models.player import Player class GameAdmin(admin.ModelAdmin): filter_horizontal = ('players',) admin.site.register(Game, GameAdmin) admin.site.register(Player) admin.site.register(...
import sys import os import errno import subprocess import json import platform import zlib import base64 import binascii import shutil if __name__ == "__main__": print("-----------------"); print("Debugging"); dir = sys.path[0]; platform = "android"; count = 0; print("Command line arguments: " + str(len(s...
""" @author: Nicklas Ansman-Giertz @contact: U{ngiertz@splunk.com<mailto:ngiertz@splunk.com>} @since: 2011-11-23 """ from abc import ABCMeta, abstractmethod from builtins import object from future.utils import with_metaclass class Collection(with_metaclass(ABCMeta, object)): """ A Collection metaclass that ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Stakkr documentation build configuration file, created by # sphinx-quickstart on Mon Jul 10 13:30:18 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 # aut...
import n = str(input('Digite o seu nome: ')).split print('O seu nome tem Silva? {}'.format('silva' in n.lower()))
"""Tests for the MCP""" import mock import multiprocessing from mock import patch from helper import config from rejected import mcp from . import test_state class TestMCP(test_state.TestState): CONFIG = {'poll_interval': 30.0, 'log_stats': True, 'Consumers': {}} @patch.object(multiprocessing, 'Queue') ...
import pytest import time from indy_common.authorize.auth_constraints import AuthConstraint, \ AuthConstraintAnd, \ AuthConstraintOr, ConstraintsEnum from indy_common.authorize.authorizer import CompositeAuthorizer, RolesAuthorizer, AndAuthorizer, OrAuthorizer, \ AuthValidationError from indy_common.types ...
# 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 vendingmachine.location import Location from vendingmachine.machine import Machine from vendingmachine.database import Database from django.shortcuts import render from django.shortcuts import redirect from django.http import HttpResponse from pprint import pprint db = Database() def index(request): id = requ...
# coding=utf-8 # Copyright 2018 DPR Authors, The Hugging Face 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 a...
# Copyright 2019 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 django.urls import path from rest_framework.urlpatterns import format_suffix_patterns from graphene_django.views import GraphQLView from graphql_jwt.decorators import jwt_cookie from django.views.decorators.csrf import csrf_exempt from api.menu import rest_api app_name = 'menu' urlpatterns = [ path('', csrf...
# -*- coding: utf-8 -*- # pylint: disable=dangerous-default-value # pylint: disable=global-statement import asyncio import logging import os import sys import json from pathlib import Path import dash import dash_core_components as dcc import dash_html_components as html from flask import Flask, Blueprint, Response i...
import os import string import random import pytest from jina.executors.metas import get_default_metas @pytest.fixture(scope='function') def random_workspace_name(): """Generate a random workspace name with digits and letters.""" rand = ''.join(random.choices(string.ascii_uppercase + string.digits, k=6)) ...
from __future__ import absolute_import import rlp from cytoolz import ( curry, ) from eth_utils import ( to_tuple, ValidationError, ) @to_tuple def diff_rlp_object(left, right): if left != right: rlp_type = type(left) for field_name, field_type in rlp_type._meta.fields: ...
import unittest from decimal import Decimal from wexapi.models import OrderInfo class TestOrderInfo(unittest.TestCase): def test_create_valid(self): data = { "order_id": "343152", "pair": "btc_usd", "type": "sell", "start_amount": 13.345, "amount...
# baleen.export # Export an HTML corpus for analyses with NLTK # # Author: Benjamin Bengfort <benjamin@bengfort.com> # Created: Fri Oct 03 16:49:20 2014 -0400 # # Copyright (C) 2014 Bengfort.com # For license information, see LICENSE.txt # # ID: export.py [eb962e7] benjamin@bengfort.com $ """ Export an HTML corpus ...
# Copyright 2020 - 2021 MONAI Consortium # 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 wri...
from __future__ import print_function import sys class Backbone(object): """ This class stores additional information on backbones. """ def __init__(self, backbone): # a dictionary mapping custom layer names to the correct classes from .. import layers from .. import losses ...
#!/usr/bin/env python3 import matplotlib.pyplot as plt import numpy as np update_variables_Adam = __import__('9-Adam').update_variables_Adam def forward_prop(X, W, b): Z = np.matmul(X, W) + b A = 1 / (1 + np.exp(-Z)) return A def calculate_grads(Y, A, W, b): m = Y.shape[0] dZ = A - Y dW = np....
import os import json import time from services.proto import database_pb2 from services.proto import recommend_posts_pb2_grpc from services.proto import recommend_follows_pb2_grpc from utils.users import UsersUtil from utils.connect import get_service_channel class RecommendersUtil: def __init__(self, logger, db...
from flask import render_template, request, url_for, jsonify, Blueprint, current_app, g, redirect, abort from models import Zoom from utils import prepareDatapoints, prepareBasicDatapoints, prepareBounds main = Blueprint('main', __name__, template_folder='templates', static_folder='static') @main.route("/") def index...
#!/usr/bin/env python ''' run like this: python setOverheadValues.py 123 129 to test values from 123 to 129, etc. ''' import time import math import sys import HC595_shift_reg as shifter reg = shifter.HC595() shift_register_state = [0, 0, 0, 0, 0] def turn_on_light(trk_value): shift_reg...
from unittest import TestCase import pytest from hubblestack.audit import command_line_parser from hubblestack.exceptions import HubbleCheckValidationError class TestCommandLineParser(TestCase): """ Unit tests for command_line_parser module """ def testValidateParams1(self): """ Mand...
SECRET_KEY = '1234' DEBUG = True MONGODB_DB='' MONGODB_HOST='' MONGODB_PORT=# a int MONGODB_USERNAME='' MONGODB_PASSWORD=''
from collections import namedtuple import itertools import unittest.mock import requests.exceptions import pytest import gitlab import repobee_plug as plug import _repobee import constants PAGE_SIZE = 10 class Group: """Class mimicking a gitlab.Group""" _Members = namedtuple("_Members", ("create", "list"...
sets = [set(), {1}, {1, 2, 3}, {3, 4, 5}, {5, 6, 7}] args = sets + [[1], [1, 2], [1, 2 ,3]] for i in sets: for j in args: print(i.issubset(j)) print(i.issuperset(j)) print("PASS")
from my_raytracer import * (width, height) = (1920, 1080) # 屏幕尺寸 resolution= height/width light_pos = vec3(-1, 2, -2) # 点光源位置 center = vec4(0, 0, 0, 0) # 摄像机位置 focal_length= 200 shape_ground = Plane(vec3(0, -0.5, 0), vec3(0, 1, 0), diffuse_color_function=lambda p:WHITE) shape_cube= Cube(1, 1, 1,...
# %% [markdown] # # 📝 Exercise M4.01 # # The aim of this exercise is two-fold: # # * understand the parametrization of a linear model; # * quantify the fitting accuracy of a set of such models. # # We will reuse part of the code of the course to: # # * load data; # * create the function representing a linear model. # ...
from os import environ as env from glob import glob import datetime import dropbox FILENAME = 'build/libs/WhoWas.jar' def main(): client = dropbox.client.DropboxClient(env.get('DROPBOX_ACCESS_TOKEN')) base = FILENAME.split('/')[2].split('.jar')[0] date = datetime.datetime.now().strftime("%Y-%m-%d") b...
import math import torch import torch.nn.functional as F from torch import nn from torch.cuda.amp import autocast from functools import partial # helpers def exists(val): return val is not None def empty(tensor): return tensor.numel() == 0 def default(val, d): return val if exists(val) else d def get_...
# Copyright 2019 Google LLC. 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 a...
from setuptools import setup, find_packages from os.path import abspath, dirname, join as ospjoin import re here = abspath(dirname(__file__)) def find_version(filename): with open(filename, 'r') as f: version_file = f.read() version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", ...
# Generated by Django 3.0.2 on 2020-01-27 16:21 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('banco_proyectos', '0002_residente_usuario'), ] operations = [ migrations.AddField( model_name='residente', name='nom...
from setuptools import setup setup( name='UkPostcodeParser', version='1.1.2', author='Simon Brunning', author_email='simon@brunningonline.net', packages=['ukpostcodeparser', 'ukpostcodeparser.test'], url='https://github.com/hamstah/ukpostcodeparser', description='UK Postcode parser', li...
import unittest import os from gimmemotifs.denovo import gimme_motifs from gimmemotifs.motif import read_motifs, motif_from_consensus from gimmemotifs.comparison import MotifComparer from tempfile import mkdtemp class TestDenovo(unittest.TestCase): """A test class to test gimme_motifs denovo""" def setUp(sel...
# Copyright 2022 OpenMined. # # 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, ...
from random import randint from datetime import datetime class Wishes: def __init__(self): self.dic = ["{} Sir ! I am here to Help You" , "{} Sir Glad to See You"] # print(random.randint(3, 9)) @property def wish(self): w = randint(0 , 1) t = int(datetime.now().st...
import seaborn as sns import matplotlib.pyplot as plt import numpy as np import helpers as HL SMALL_SIZE = 15 MEDIUM_SIZE = 25 BIGGER_SIZE = 30 plt.rc('font', size=SMALL_SIZE) # controls default text sizes plt.rc('axes', titlesize=SMALL_SIZE) # fontsize of the axes title plt.rc('axes', labelsize=MEDIUM_...
#!/usr/bin/env python from distutils.core import setup setup( name='tumbkit', version='0.1', description='Tumbkit', author='Stefan De Boey', url='http://github.com/sdb/tumbkit', license='MIT', py_modules=['tumbkit'], requires=['bottle'] )
#!/bin/python # usage: # cat clAmdBlas.h | $0 from __future__ import print_function import sys, re; from common import remove_comments, getTokens, getParameters, postProcessParameters try: if len(sys.argv) > 1: f = open(sys.argv[1], "r") else: f = sys.stdin except: sys.exit("ERROR. Can...
""" The HomeMatic sensor platform. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.homematic/ """ import logging from homeassistant.components.homematic import ATTR_DISCOVER_DEVICES, HMDevice from homeassistant.const import STATE_UNKNOWN _LOGGER ...
# -*- coding: utf-8 -*- """ Created on Fri Jan 6 23:45:59 2017 @author: yxl """ import os, sys, os.path as osp from glob import glob from ..engine import Macros, Widget, Report from sciapp import Source from ... import root_dir from codecs import open def getpath(root, path): for i in range(10,0,-1): if ...
# -*- coding: utf-8 -*- # --------------------------------------------------------------------- # Huawei.VRP.get_vlans # --------------------------------------------------------------------- # Copyright (C) 2007-2017 The NOC Project # See LICENSE for details # -----------------------------------------------------------...
#! /usr/bin/env python # coding: utf-8 # __author__ = 'meisanggou' try: from setuptools import setup except ImportError: from distutils.core import setup import sys if sys.version_info <= (2, 7): sys.stderr.write("ERROR: dms requires Python Version 2.7 or above.\n") sys.stderr.write("Your Python Ve...
# Generated by Django 3.1.4 on 2020-12-01 11:16 from django.db import migrations import taggit.managers class Migration(migrations.Migration): dependencies = [ ('taggit', '0003_taggeditem_add_unique_index'), ('library', '0004_auto_20201201_1100'), ] operations = [ migrations.Add...
class TestClassMethod(): def nothing(self, a, b): return a + b @classmethod def test_classmethod(cls, a, b): return a + b @staticmethod def test_staticmethod(a, b): return a + b print(TestClassMethod.nothing(None, 2, 3)) print(TestClassMethod().nothing(2, 3)) print(Test...
from typing import Optional from pydantic import BaseModel class UserBase(BaseModel): is_active: Optional[bool] = True is_superuser: bool = False full_name: Optional[str] = None class UserInDBBase(UserBase): id: Optional[str] = None
# -*- coding: utf-8 -*- import scrapy import json import re from datetime import date from locations.items import GeojsonPointItem class AthletaSpider(scrapy.Spider): name = "athleta" item_attributes = {"brand": "Athleta"} allowed_domains = ["stores.athleta.net"] athleta_url = "http://stores.athleta...
# Copyright 2019 The Kythe 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...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jan 10 16:00:42 2019 @author: haoqi """ import torch import torch.nn as nn import pdb device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # the model is based on CMU emotion # Base_1D_NN_fixed_seq_len_1s_majvote_v2 class model_cnn_...
#!/usr/bin/env python # Copyright 2014-2020 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...
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.8.2 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import sys import os im...
#!/usr/bin/env python3 from Crypto.Cipher import AES from Crypto.Util.Padding import pad, unpad import urllib.request import base64 import binascii import argparse import json import random import os import sys import pprint import configparser G = int('A4D1CBD5C3FD34126765A442EFB99905F8104DD258AC507FD6406CFF14266D312...